Rename sty
to kind
This commit is contained in:
parent
2808a46a49
commit
e2e0f9af85
@ -343,7 +343,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
|
||||
}
|
||||
|
||||
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Infer(ty::TyVar(vid)) => {
|
||||
debug!("canonical: type var found with vid {:?}", vid);
|
||||
match self.infcx.unwrap().probe_ty_var(vid) {
|
||||
|
@ -471,7 +471,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
match result_value.unpack() {
|
||||
UnpackedKind::Type(result_value) => {
|
||||
// e.g., here `result_value` might be `?0` in the example above...
|
||||
if let ty::Bound(debruijn, b) = result_value.sty {
|
||||
if let ty::Bound(debruijn, b) = result_value.kind {
|
||||
// ...in which case we would set `canonical_vars[0]` to `Some(?U)`.
|
||||
|
||||
// We only allow a `ty::INNERMOST` index in substitutions.
|
||||
|
@ -70,7 +70,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
|
||||
{
|
||||
let a_is_expected = relation.a_is_expected();
|
||||
|
||||
match (&a.sty, &b.sty) {
|
||||
match (&a.kind, &b.kind) {
|
||||
// Relate integral variables to other types
|
||||
(&ty::Infer(ty::IntVar(a_id)), &ty::Infer(ty::IntVar(b_id))) => {
|
||||
self.int_unification_table
|
||||
@ -486,7 +486,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
|
||||
// any other type variable related to `vid` via
|
||||
// subtyping. This is basically our "occurs check", preventing
|
||||
// us from creating infinitely sized types.
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Infer(ty::TyVar(vid)) => {
|
||||
let mut variables = self.infcx.type_variables.borrow_mut();
|
||||
let vid = variables.root_var(vid);
|
||||
|
@ -68,7 +68,7 @@ impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
|
||||
|
||||
debug!("{}.tys: replacements ({:?}, {:?})", self.tag(), a, b);
|
||||
|
||||
match (&a.sty, &b.sty) {
|
||||
match (&a.kind, &b.kind) {
|
||||
(&ty::Infer(TyVar(a_id)), &ty::Infer(TyVar(b_id))) => {
|
||||
infcx.type_variables.borrow_mut().equate(a_id, b_id);
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
// if they are both "path types", there's a chance of ambiguity
|
||||
// due to different versions of the same crate
|
||||
if let (&ty::Adt(exp_adt, _), &ty::Adt(found_adt, _))
|
||||
= (&exp_found.expected.sty, &exp_found.found.sty)
|
||||
= (&exp_found.expected.kind, &exp_found.found.kind)
|
||||
{
|
||||
report_path_match(err, exp_adt.did, found_adt.did);
|
||||
}
|
||||
@ -803,7 +803,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty);
|
||||
return Some(());
|
||||
}
|
||||
if let &ty::Adt(def, _) = &ta.sty {
|
||||
if let &ty::Adt(def, _) = &ta.kind {
|
||||
let path_ = self.tcx.def_path_str(def.did.clone());
|
||||
if path_ == other_path {
|
||||
self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty);
|
||||
@ -868,7 +868,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
/// relevant differences, and return two representation of those types for highlighted printing.
|
||||
fn cmp(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> (DiagnosticStyledString, DiagnosticStyledString) {
|
||||
fn equals<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
|
||||
match (&a.sty, &b.sty) {
|
||||
match (&a.kind, &b.kind) {
|
||||
(a, b) if *a == *b => true,
|
||||
(&ty::Int(_), &ty::Infer(ty::InferTy::IntVar(_)))
|
||||
| (&ty::Infer(ty::InferTy::IntVar(_)), &ty::Int(_))
|
||||
@ -902,7 +902,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
s.push_normal(ty.to_string());
|
||||
}
|
||||
|
||||
match (&t1.sty, &t2.sty) {
|
||||
match (&t1.kind, &t2.kind) {
|
||||
(&ty::Adt(def1, sub1), &ty::Adt(def2, sub2)) => {
|
||||
let sub_no_defaults_1 = self.strip_generic_default_params(def1.did, sub1);
|
||||
let sub_no_defaults_2 = self.strip_generic_default_params(def2.did, sub2);
|
||||
@ -1138,7 +1138,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
match (terr, is_simple_error, expected == found) {
|
||||
(&TypeError::Sorts(ref values), false, true) => {
|
||||
let sort_string = | a_type: Ty<'tcx> |
|
||||
if let ty::Opaque(def_id, _) = a_type.sty {
|
||||
if let ty::Opaque(def_id, _) = a_type.kind {
|
||||
format!(" (opaque type at {})", self.tcx.sess.source_map()
|
||||
.mk_substr_filename(self.tcx.def_span(def_id)))
|
||||
} else {
|
||||
@ -1179,9 +1179,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
exp_found: &ty::error::ExpectedFound<Ty<'tcx>>,
|
||||
diag: &mut DiagnosticBuilder<'tcx>,
|
||||
) {
|
||||
match (&exp_found.expected.sty, &exp_found.found.sty) {
|
||||
match (&exp_found.expected.kind, &exp_found.found.kind) {
|
||||
(ty::Adt(exp_def, exp_substs), ty::Ref(_, found_ty, _)) => {
|
||||
if let ty::Adt(found_def, found_substs) = found_ty.sty {
|
||||
if let ty::Adt(found_def, found_substs) = found_ty.kind {
|
||||
let path_str = format!("{:?}", exp_def);
|
||||
if exp_def == &found_def {
|
||||
let opt_msg = "you can convert from `&Option<T>` to `Option<&T>` using \
|
||||
@ -1203,9 +1203,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
{
|
||||
let mut show_suggestion = true;
|
||||
for (exp_ty, found_ty) in exp_substs.types().zip(found_substs.types()) {
|
||||
match exp_ty.sty {
|
||||
match exp_ty.kind {
|
||||
ty::Ref(_, exp_ty, _) => {
|
||||
match (&exp_ty.sty, &found_ty.sty) {
|
||||
match (&exp_ty.kind, &found_ty.kind) {
|
||||
(_, ty::Param(_)) |
|
||||
(_, ty::Infer(_)) |
|
||||
(ty::Param(_), _) |
|
||||
|
@ -44,7 +44,7 @@ impl<'a, 'tcx> FindLocalByTypeVisitor<'a, 'tcx> {
|
||||
Some(ty) => {
|
||||
let ty = self.infcx.resolve_vars_if_possible(&ty);
|
||||
if ty.walk().any(|inner_ty| {
|
||||
inner_ty == self.target_ty || match (&inner_ty.sty, &self.target_ty.sty) {
|
||||
inner_ty == self.target_ty || match (&inner_ty.kind, &self.target_ty.kind) {
|
||||
(&Infer(TyVar(a_vid)), &Infer(TyVar(b_vid))) => {
|
||||
self.infcx
|
||||
.type_variables
|
||||
@ -151,7 +151,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
highlight: Option<ty::print::RegionHighlightMode>,
|
||||
) -> (String, Option<Span>) {
|
||||
if let ty::Infer(ty::TyVar(ty_vid)) = ty.sty {
|
||||
if let ty::Infer(ty::TyVar(ty_vid)) = ty.kind {
|
||||
let ty_vars = self.type_variables.borrow();
|
||||
let var_origin = ty_vars.var_origin(ty_vid);
|
||||
if let TypeVariableOriginKind::TypeParameterDefinition(name) = var_origin.kind {
|
||||
@ -219,7 +219,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
};
|
||||
|
||||
let ty_msg = match local_visitor.found_ty {
|
||||
Some(ty::TyS { sty: ty::Closure(def_id, substs), .. }) => {
|
||||
Some(ty::TyS { kind: ty::Closure(def_id, substs), .. }) => {
|
||||
let fn_sig = substs.closure_sig(*def_id, self.tcx);
|
||||
let args = closure_args(&fn_sig);
|
||||
let ret = fn_sig.output().skip_binder().to_string();
|
||||
@ -254,7 +254,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
);
|
||||
|
||||
let suffix = match local_visitor.found_ty {
|
||||
Some(ty::TyS { sty: ty::Closure(def_id, substs), .. }) => {
|
||||
Some(ty::TyS { kind: ty::Closure(def_id, substs), .. }) => {
|
||||
let fn_sig = substs.closure_sig(*def_id, self.tcx);
|
||||
let ret = fn_sig.output().skip_binder().to_string();
|
||||
|
||||
|
@ -109,7 +109,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
decl: &hir::FnDecl,
|
||||
) -> Option<Span> {
|
||||
let ret_ty = self.tcx().type_of(scope_def_id);
|
||||
if let ty::FnDef(_, _) = ret_ty.sty {
|
||||
if let ty::FnDef(_, _) = ret_ty.kind {
|
||||
let sig = ret_ty.fn_sig(self.tcx());
|
||||
let late_bound_regions = self.tcx()
|
||||
.collect_referenced_late_bound_regions(&sig.output());
|
||||
|
@ -153,7 +153,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
|
||||
|
||||
let tcx = self.infcx.tcx;
|
||||
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Infer(ty::TyVar(v)) => {
|
||||
let opt_ty = self.infcx.type_variables.borrow_mut().probe(v).known();
|
||||
self.freshen_ty(
|
||||
|
@ -148,7 +148,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for InferenceFudger<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Infer(ty::InferTy::TyVar(vid)) => {
|
||||
if self.type_vars.0.contains(&vid) {
|
||||
// This variable was created during the fudging.
|
||||
|
@ -61,7 +61,7 @@ where
|
||||
let infcx = this.infcx();
|
||||
let a = infcx.type_variables.borrow_mut().replace_if_possible(a);
|
||||
let b = infcx.type_variables.borrow_mut().replace_if_possible(b);
|
||||
match (&a.sty, &b.sty) {
|
||||
match (&a.kind, &b.kind) {
|
||||
// If one side is known to be a variable and one is not,
|
||||
// create a variable (`v`) to represent the LUB. Make sure to
|
||||
// relate `v` to the non-type-variable first (by passing it
|
||||
|
@ -614,7 +614,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
pub fn type_var_diverges(&'a self, ty: Ty<'_>) -> bool {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Infer(ty::TyVar(vid)) => self.type_variables.borrow().var_diverges(vid),
|
||||
_ => false,
|
||||
}
|
||||
@ -627,7 +627,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
pub fn type_is_unconstrained_numeric(&'a self, ty: Ty<'_>) -> UnconstrainedNumeric {
|
||||
use crate::ty::error::UnconstrainedNumeric::Neither;
|
||||
use crate::ty::error::UnconstrainedNumeric::{UnconstrainedFloat, UnconstrainedInt};
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Infer(ty::IntVar(vid)) => {
|
||||
if self.int_unification_table
|
||||
.borrow_mut()
|
||||
@ -1563,7 +1563,7 @@ impl<'a, 'tcx> ShallowResolver<'a, 'tcx> {
|
||||
}
|
||||
|
||||
pub fn shallow_resolve(&mut self, typ: Ty<'tcx>) -> Ty<'tcx> {
|
||||
match typ.sty {
|
||||
match typ.kind {
|
||||
ty::Infer(ty::TyVar(v)) => {
|
||||
// Not entirely obvious: if `typ` is a type variable,
|
||||
// it can be resolved to an int/float variable, which
|
||||
|
@ -274,7 +274,7 @@ where
|
||||
use crate::traits::WhereClause;
|
||||
use syntax_pos::DUMMY_SP;
|
||||
|
||||
match value_ty.sty {
|
||||
match value_ty.kind {
|
||||
ty::Projection(other_projection_ty) => {
|
||||
let var = self.infcx.next_ty_var(TypeVariableOrigin {
|
||||
kind: TypeVariableOriginKind::MiscVariable,
|
||||
@ -328,7 +328,7 @@ where
|
||||
// This only presently applies to chalk integration, as NLL
|
||||
// doesn't permit type variables to appear on both sides (and
|
||||
// doesn't use lazy norm).
|
||||
match value_ty.sty {
|
||||
match value_ty.kind {
|
||||
ty::Infer(ty::TyVar(value_vid)) => {
|
||||
// Two type variables: just equate them.
|
||||
self.infcx
|
||||
@ -548,7 +548,7 @@ where
|
||||
b = self.infcx.shallow_resolve(b);
|
||||
}
|
||||
|
||||
match (&a.sty, &b.sty) {
|
||||
match (&a.kind, &b.kind) {
|
||||
(_, &ty::Infer(ty::TyVar(vid))) => {
|
||||
if D::forbid_inference_vars() {
|
||||
// Forbid inference variables in the RHS.
|
||||
@ -878,7 +878,7 @@ where
|
||||
|
||||
debug!("TypeGeneralizer::tys(a={:?})", a);
|
||||
|
||||
match a.sty {
|
||||
match a.kind {
|
||||
ty::Infer(ty::TyVar(_)) | ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_))
|
||||
if D::forbid_inference_vars() =>
|
||||
{
|
||||
|
@ -720,7 +720,7 @@ where
|
||||
return false; // keep visiting
|
||||
}
|
||||
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Closure(def_id, ref substs) => {
|
||||
// Skip lifetime parameters of the enclosing item(s)
|
||||
|
||||
@ -857,7 +857,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
|
||||
}
|
||||
|
||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Closure(def_id, substs) => {
|
||||
// I am a horrible monster and I pray for death. When
|
||||
// we encounter a closure here, it is always a closure
|
||||
@ -990,7 +990,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
|
||||
ty_op: |ty| {
|
||||
if ty.references_error() {
|
||||
return tcx.types.err;
|
||||
} else if let ty::Opaque(def_id, substs) = ty.sty {
|
||||
} else if let ty::Opaque(def_id, substs) = ty.kind {
|
||||
// Check that this is `impl Trait` type is
|
||||
// declared by `parent_def_id` -- i.e., one whose
|
||||
// value we are inferring. At present, this is
|
||||
|
@ -403,7 +403,7 @@ where
|
||||
// 'a` in the environment but `trait Foo<'b> { type Item: 'b
|
||||
// }` in the trait definition.
|
||||
approx_env_bounds.retain(|bound| {
|
||||
match bound.0.sty {
|
||||
match bound.0.kind {
|
||||
ty::Projection(projection_ty) => {
|
||||
self.verify_bound.projection_declared_bounds_from_trait(projection_ty)
|
||||
.all(|r| r != bound.1)
|
||||
|
@ -44,7 +44,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
|
||||
}
|
||||
|
||||
fn type_bound(&self, ty: Ty<'tcx>) -> VerifyBound<'tcx> {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Param(p) => self.param_bound(p),
|
||||
ty::Projection(data) => self.projection_bound(data),
|
||||
_ => self.recursive_type_bound(ty),
|
||||
@ -87,7 +87,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
|
||||
let projection_ty = GenericKind::Projection(projection_ty).to_ty(self.tcx);
|
||||
let erased_projection_ty = self.tcx.erase_regions(&projection_ty);
|
||||
self.declared_generic_bounds_from_env_with_compare_fn(|ty| {
|
||||
if let ty::Projection(..) = ty.sty {
|
||||
if let ty::Projection(..) = ty.kind {
|
||||
let erased_ty = self.tcx.erase_regions(&ty);
|
||||
erased_ty == erased_projection_ty
|
||||
} else {
|
||||
|
@ -118,7 +118,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> {
|
||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
|
||||
let t = self.infcx.shallow_resolve(t);
|
||||
if t.has_infer_types() {
|
||||
if let ty::Infer(infer_ty) = t.sty {
|
||||
if let ty::Infer(infer_ty) = t.kind {
|
||||
// Since we called `shallow_resolve` above, this must
|
||||
// be an (as yet...) unresolved inference variable.
|
||||
let ty_var_span =
|
||||
@ -188,7 +188,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
|
||||
// defaulted tuples.
|
||||
} else {
|
||||
let t = self.infcx.shallow_resolve(t);
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Infer(ty::TyVar(vid)) => {
|
||||
self.err = Some(FixupError::UnresolvedTy(vid));
|
||||
self.tcx().types.err
|
||||
|
@ -71,7 +71,7 @@ impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
|
||||
let infcx = self.fields.infcx;
|
||||
let a = infcx.type_variables.borrow_mut().replace_if_possible(a);
|
||||
let b = infcx.type_variables.borrow_mut().replace_if_possible(b);
|
||||
match (&a.sty, &b.sty) {
|
||||
match (&a.kind, &b.kind) {
|
||||
(&ty::Infer(TyVar(a_vid)), &ty::Infer(TyVar(b_vid))) => {
|
||||
// Shouldn't have any LBR here, so we can safely put
|
||||
// this under a binder below without fear of accidental
|
||||
|
@ -247,7 +247,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
|
||||
/// instantiated, then return the with which it was
|
||||
/// instantiated. Otherwise, returns `t`.
|
||||
pub fn replace_if_possible(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Infer(ty::TyVar(v)) => {
|
||||
match self.probe(v) {
|
||||
TypeVariableValue::Unknown { .. } => t,
|
||||
|
@ -829,7 +829,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
|
||||
trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
) -> Result<Self::Path, Self::Error> {
|
||||
if trait_ref.is_none() {
|
||||
if let ty::Adt(def, substs) = self_ty.sty {
|
||||
if let ty::Adt(def, substs) = self_ty.kind {
|
||||
return self.print_def_path(def.did, substs);
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn handle_field_access(&mut self, lhs: &hir::Expr, hir_id: hir::HirId) {
|
||||
match self.tables.expr_ty_adjusted(lhs).sty {
|
||||
match self.tables.expr_ty_adjusted(lhs).kind {
|
||||
ty::Adt(def, _) => {
|
||||
let index = self.tcx.field_index(hir_id, self.tables);
|
||||
self.insert_def_id(def.non_enum_variant().fields[index].did);
|
||||
@ -128,7 +128,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn handle_field_pattern_match(&mut self, lhs: &hir::Pat, res: Res, pats: &[hir::FieldPat]) {
|
||||
let variant = match self.tables.node_type(lhs.hir_id).sty {
|
||||
let variant = match self.tables.node_type(lhs.hir_id).kind {
|
||||
ty::Adt(adt, _) => adt.variant_of_res(res),
|
||||
_ => span_bug!(lhs.span, "non-ADT in struct pattern")
|
||||
};
|
||||
@ -248,7 +248,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
|
||||
self.handle_field_access(&lhs, expr.hir_id);
|
||||
}
|
||||
hir::ExprKind::Struct(_, ref fields, _) => {
|
||||
if let ty::Adt(ref adt, _) = self.tables.expr_ty(expr).sty {
|
||||
if let ty::Adt(ref adt, _) = self.tables.expr_ty(expr).kind {
|
||||
self.mark_as_used_if_union(adt, fields);
|
||||
}
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
|
||||
// make sure that the thing we are pointing out stays valid
|
||||
// for the lifetime `scope_r` of the resulting ptr:
|
||||
let expr_ty = return_if_err!(self.mc.expr_ty(expr));
|
||||
if let ty::Ref(r, _, _) = expr_ty.sty {
|
||||
if let ty::Ref(r, _, _) = expr_ty.kind {
|
||||
let bk = ty::BorrowKind::from_mutbl(m);
|
||||
self.borrow_expr(&base, r, bk, AddrOf);
|
||||
}
|
||||
@ -553,7 +553,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
|
||||
let callee_ty = return_if_err!(self.mc.expr_ty_adjusted(callee));
|
||||
debug!("walk_callee: callee={:?} callee_ty={:?}",
|
||||
callee, callee_ty);
|
||||
match callee_ty.sty {
|
||||
match callee_ty.kind {
|
||||
ty::FnDef(..) | ty::FnPtr(_) => {
|
||||
self.consume_expr(callee);
|
||||
}
|
||||
@ -658,7 +658,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
|
||||
|
||||
// Select just those fields of the `with`
|
||||
// expression that will actually be used
|
||||
match with_cmt.ty.sty {
|
||||
match with_cmt.ty.kind {
|
||||
ty::Adt(adt, substs) if adt.is_struct() => {
|
||||
// Consume those fields of the with expression that are needed.
|
||||
for (f_index, with_field) in adt.non_enum_variant().fields.iter().enumerate() {
|
||||
@ -867,7 +867,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
|
||||
// It is also a borrow or copy/move of the value being matched.
|
||||
match bm {
|
||||
ty::BindByReference(m) => {
|
||||
if let ty::Ref(r, _, _) = pat_ty.sty {
|
||||
if let ty::Ref(r, _, _) = pat_ty.kind {
|
||||
let bk = ty::BorrowKind::from_mutbl(m);
|
||||
delegate.borrow(pat.hir_id, pat.span, &cmt_pat, r, bk, RefBinding);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ struct ExprVisitor<'tcx> {
|
||||
/// If the type is `Option<T>`, it will return `T`, otherwise
|
||||
/// the type itself. Works on most `Option`-like types.
|
||||
fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
let (def, substs) = match ty.sty {
|
||||
let (def, substs) = match ty.kind {
|
||||
ty::Adt(def, substs) => (def, substs),
|
||||
_ => return ty
|
||||
};
|
||||
@ -83,7 +83,7 @@ impl ExprVisitor<'tcx> {
|
||||
// Special-case transmutting from `typeof(function)` and
|
||||
// `Option<typeof(function)>` to present a clearer error.
|
||||
let from = unpack_option_like(self.tcx.global_tcx(), from);
|
||||
if let (&ty::FnDef(..), SizeSkeleton::Known(size_to)) = (&from.sty, sk_to) {
|
||||
if let (&ty::FnDef(..), SizeSkeleton::Known(size_to)) = (&from.kind, sk_to) {
|
||||
if size_to == Pointer.size(&self.tcx) {
|
||||
struct_span_err!(self.tcx.sess, span, E0591,
|
||||
"can't transmute zero-sized type")
|
||||
|
@ -738,7 +738,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
||||
LocalDefId::from_def_id(closure_expr_def_id),
|
||||
);
|
||||
let ty = self.node_ty(fn_hir_id)?;
|
||||
let kind = match ty.sty {
|
||||
let kind = match ty.kind {
|
||||
ty::Generator(..) => ty::ClosureKind::FnOnce,
|
||||
ty::Closure(closure_def_id, closure_substs) => {
|
||||
match self.infcx {
|
||||
@ -900,7 +900,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
||||
debug!("cat_rvalue_node: promotable = {:?}", promotable);
|
||||
|
||||
// Always promote `[T; 0]` (even when e.g., borrowed mutably).
|
||||
let promotable = match expr_ty.sty {
|
||||
let promotable = match expr_ty.kind {
|
||||
ty::Array(_, len) if len.try_eval_usize(self.tcx, self.param_env) == Some(0) => true,
|
||||
_ => promotable,
|
||||
};
|
||||
@ -974,7 +974,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
||||
let place_ty = self.expr_ty(expr)?;
|
||||
let base_ty = self.expr_ty_adjusted(base)?;
|
||||
|
||||
let (region, mutbl) = match base_ty.sty {
|
||||
let (region, mutbl) = match base_ty.kind {
|
||||
ty::Ref(region, _, mutbl) => (region, mutbl),
|
||||
_ => span_bug!(expr.span, "cat_overloaded_place: base is not a reference")
|
||||
};
|
||||
@ -1004,7 +1004,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
||||
}
|
||||
};
|
||||
|
||||
let ptr = match base_cmt.ty.sty {
|
||||
let ptr = match base_cmt.ty.kind {
|
||||
ty::Adt(def, ..) if def.is_box() => Unique,
|
||||
ty::RawPtr(ref mt) => UnsafePtr(mt.mutbl),
|
||||
ty::Ref(r, _, mutbl) => {
|
||||
@ -1230,7 +1230,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
||||
Res::Def(DefKind::Ctor(CtorOf::Struct, CtorKind::Fn), _)
|
||||
| Res::SelfCtor(..) => {
|
||||
let ty = self.pat_ty_unadjusted(&pat)?;
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Adt(adt_def, _) => {
|
||||
(cmt, adt_def.non_enum_variant().fields.len())
|
||||
}
|
||||
@ -1303,7 +1303,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
||||
PatKind::Tuple(ref subpats, ddpos) => {
|
||||
// (p1, ..., pN)
|
||||
let ty = self.pat_ty_unadjusted(&pat)?;
|
||||
let expected_len = match ty.sty {
|
||||
let expected_len = match ty.kind {
|
||||
ty::Tuple(ref tys) => tys.len(),
|
||||
_ => span_bug!(pat.span, "tuple pattern unexpected type {:?}", ty),
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ impl<'tcx> PlaceTy<'tcx> {
|
||||
///
|
||||
/// Note that the resulting type has not been normalized.
|
||||
pub fn field_ty(self, tcx: TyCtxt<'tcx>, f: &Field) -> Ty<'tcx> {
|
||||
let answer = match self.ty.sty {
|
||||
let answer = match self.ty.kind {
|
||||
ty::Adt(adt_def, substs) => {
|
||||
let variant_def = match self.variant_index {
|
||||
None => adt_def.non_enum_variant(),
|
||||
@ -89,7 +89,7 @@ impl<'tcx> PlaceTy<'tcx> {
|
||||
ProjectionElem::Index(_) | ProjectionElem::ConstantIndex { .. } =>
|
||||
PlaceTy::from_ty(self.ty.builtin_index().unwrap()),
|
||||
ProjectionElem::Subslice { from, to } => {
|
||||
PlaceTy::from_ty(match self.ty.sty {
|
||||
PlaceTy::from_ty(match self.ty.kind {
|
||||
ty::Array(inner, size) => {
|
||||
let size = size.eval_usize(tcx, param_env);
|
||||
let len = size - (from as u64) - (to as u64);
|
||||
@ -195,7 +195,7 @@ impl<'tcx> Rvalue<'tcx> {
|
||||
}
|
||||
Rvalue::Discriminant(ref place) => {
|
||||
let ty = place.ty(local_decls, tcx).ty;
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Adt(adt_def, _) => adt_def.repr.discr_type().to_ty(tcx),
|
||||
ty::Generator(_, substs, _) => substs.discr_ty(tcx),
|
||||
_ => {
|
||||
|
@ -601,7 +601,7 @@ impl AutoTraitFinder<'tcx> {
|
||||
}
|
||||
|
||||
pub fn is_of_param(&self, ty: Ty<'_>) -> bool {
|
||||
return match ty.sty {
|
||||
return match ty.kind {
|
||||
ty::Param(_) => true,
|
||||
ty::Projection(p) => self.is_of_param(p.self_ty()),
|
||||
_ => false,
|
||||
@ -609,7 +609,7 @@ impl AutoTraitFinder<'tcx> {
|
||||
}
|
||||
|
||||
fn is_self_referential_projection(&self, p: ty::PolyProjectionPredicate<'_>) -> bool {
|
||||
match p.ty().skip_binder().sty {
|
||||
match p.ty().skip_binder().kind {
|
||||
ty::Projection(proj) if proj == p.skip_binder().projection_ty => {
|
||||
true
|
||||
},
|
||||
|
@ -383,7 +383,7 @@ fn orphan_check_trait_ref<'tcx>(
|
||||
if ty_is_local(tcx, input_ty, in_crate) {
|
||||
debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty);
|
||||
return Ok(());
|
||||
} else if let ty::Param(_) = input_ty.sty {
|
||||
} else if let ty::Param(_) = input_ty.kind {
|
||||
debug!("orphan_check_trait_ref: uncovered ty: `{:?}`", input_ty);
|
||||
return Err(OrphanCheckErr::UncoveredTy(input_ty))
|
||||
}
|
||||
@ -444,7 +444,7 @@ fn uncovered_tys<'tcx>(tcx: TyCtxt<'_>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec<
|
||||
}
|
||||
|
||||
fn is_possibly_remote_type(ty: Ty<'_>, _in_crate: InCrate) -> bool {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Projection(..) | ty::Param(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -456,7 +456,7 @@ fn ty_is_local(tcx: TyCtxt<'_>, ty: Ty<'_>, in_crate: InCrate) -> bool {
|
||||
}
|
||||
|
||||
fn fundamental_ty(ty: Ty<'_>) -> bool {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Ref(..) => true,
|
||||
ty::Adt(def, _) => def.is_fundamental(),
|
||||
_ => false
|
||||
@ -475,7 +475,7 @@ fn def_id_is_local(def_id: DefId, in_crate: InCrate) -> bool {
|
||||
fn ty_is_local_constructor(tcx: TyCtxt<'_>, ty: Ty<'_>, in_crate: InCrate) -> bool {
|
||||
debug!("ty_is_local_constructor({:?})", ty);
|
||||
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Bool |
|
||||
ty::Char |
|
||||
ty::Int(..) |
|
||||
|
@ -258,7 +258,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
/// returns the fuzzy category of a given type, or None
|
||||
/// if the type can be equated to any type.
|
||||
fn type_category(t: Ty<'_>) -> Option<u32> {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Bool => Some(0),
|
||||
ty::Char => Some(1),
|
||||
ty::Str => Some(2),
|
||||
@ -288,7 +288,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
match (type_category(a), type_category(b)) {
|
||||
(Some(cat_a), Some(cat_b)) => match (&a.sty, &b.sty) {
|
||||
(Some(cat_a), Some(cat_b)) => match (&a.kind, &b.kind) {
|
||||
(&ty::Adt(def_a, _), &ty::Adt(def_b, _)) => def_a == def_b,
|
||||
_ => cat_a == cat_b
|
||||
},
|
||||
@ -419,7 +419,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
flags.push((sym::_Self, Some("{integral}".to_owned())));
|
||||
}
|
||||
|
||||
if let ty::Array(aty, len) = self_ty.sty {
|
||||
if let ty::Array(aty, len) = self_ty.kind {
|
||||
flags.push((sym::_Self, Some("[]".to_owned())));
|
||||
flags.push((sym::_Self, Some(format!("[{}]", aty))));
|
||||
if let Some(def) = aty.ty_adt_def() {
|
||||
@ -876,7 +876,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
|
||||
let found_trait_ty = found_trait_ref.self_ty();
|
||||
|
||||
let found_did = match found_trait_ty.sty {
|
||||
let found_did = match found_trait_ty.kind {
|
||||
ty::Closure(did, _) | ty::Foreign(did) | ty::FnDef(did, _) => Some(did),
|
||||
ty::Adt(def, _) => Some(def.did),
|
||||
_ => None,
|
||||
@ -886,13 +886,13 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
self.tcx.hir().span_if_local(did)
|
||||
).map(|sp| self.tcx.sess.source_map().def_span(sp)); // the sp could be an fn def
|
||||
|
||||
let found = match found_trait_ref.skip_binder().substs.type_at(1).sty {
|
||||
let found = match found_trait_ref.skip_binder().substs.type_at(1).kind {
|
||||
ty::Tuple(ref tys) => vec![ArgKind::empty(); tys.len()],
|
||||
_ => vec![ArgKind::empty()],
|
||||
};
|
||||
|
||||
let expected_ty = expected_trait_ref.skip_binder().substs.type_at(1);
|
||||
let expected = match expected_ty.sty {
|
||||
let expected = match expected_ty.kind {
|
||||
ty::Tuple(ref tys) => tys.iter()
|
||||
.map(|t| ArgKind::from_expected_ty(t.expect_ty(), Some(span))).collect(),
|
||||
_ => vec![ArgKind::Arg("_".to_owned(), expected_ty.to_string())],
|
||||
@ -979,7 +979,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
points_at_arg: bool,
|
||||
) {
|
||||
let self_ty = trait_ref.self_ty();
|
||||
match self_ty.sty {
|
||||
match self_ty.kind {
|
||||
ty::FnDef(def_id, _) => {
|
||||
// We tried to apply the bound to an `fn`. Check whether calling it would evaluate
|
||||
// to a type that *would* satisfy the trait binding. If it would, suggest calling
|
||||
@ -1066,7 +1066,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
let mut trait_type = trait_ref.self_ty();
|
||||
|
||||
for refs_remaining in 0..refs_number {
|
||||
if let ty::Ref(_, t_type, _) = trait_type.sty {
|
||||
if let ty::Ref(_, t_type, _) = trait_type.kind {
|
||||
trait_type = t_type;
|
||||
|
||||
let substs = self.tcx.mk_substs_trait(trait_type, &[]);
|
||||
@ -1340,7 +1340,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
) -> DiagnosticBuilder<'tcx> {
|
||||
fn build_fn_sig_string<'tcx>(tcx: TyCtxt<'tcx>, trait_ref: &ty::TraitRef<'tcx>) -> String {
|
||||
let inputs = trait_ref.substs.type_at(1);
|
||||
let sig = if let ty::Tuple(inputs) = inputs.sty {
|
||||
let sig = if let ty::Tuple(inputs) = inputs.kind {
|
||||
tcx.mk_fn_sig(
|
||||
inputs.iter().map(|k| k.expect_ty()),
|
||||
tcx.mk_ty_infer(ty::TyVar(ty::TyVid { index: 0 })),
|
||||
@ -1564,7 +1564,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> { self.infcx.tcx }
|
||||
|
||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
if let ty::Param(ty::ParamTy {name, .. }) = ty.sty {
|
||||
if let ty::Param(ty::ParamTy {name, .. }) = ty.kind {
|
||||
let infcx = self.infcx;
|
||||
self.var_map.entry(ty).or_insert_with(||
|
||||
infcx.next_ty_var(
|
||||
@ -1834,7 +1834,7 @@ impl ArgKind {
|
||||
/// Creates an `ArgKind` from the expected type of an
|
||||
/// argument. It has no name (`_`) and an optional source span.
|
||||
pub fn from_expected_ty(t: Ty<'_>, span: Option<Span>) -> ArgKind {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Tuple(ref tys) => ArgKind::Tuple(
|
||||
span,
|
||||
tys.iter()
|
||||
|
@ -548,7 +548,7 @@ fn trait_ref_type_vars<'a, 'tcx>(
|
||||
.map(|t| selcx.infcx().resolve_vars_if_possible(&t))
|
||||
.filter(|t| t.has_infer_types())
|
||||
.flat_map(|t| t.walk())
|
||||
.filter(|t| match t.sty { ty::Infer(_) => true, _ => false })
|
||||
.filter(|t| match t.kind { ty::Infer(_) => true, _ => false })
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
@ -677,7 +677,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
let mut error = false;
|
||||
let self_ty = self.types.self_param;
|
||||
ty.maybe_walk(|ty| {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Param(_) => {
|
||||
if ty == self_ty {
|
||||
error = true;
|
||||
|
@ -337,7 +337,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
|
||||
// should occur eventually).
|
||||
|
||||
let ty = ty.super_fold_with(self);
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => { // (*)
|
||||
// Only normalize `impl Trait` after type-checking, usually in codegen.
|
||||
match self.param_env.reveal {
|
||||
@ -921,7 +921,7 @@ fn assemble_candidates_from_trait_def<'cx, 'tcx>(
|
||||
|
||||
let tcx = selcx.tcx();
|
||||
// Check whether the self-type is itself a projection.
|
||||
let (def_id, substs) = match obligation_trait_ref.self_ty().sty {
|
||||
let (def_id, substs) = match obligation_trait_ref.self_ty().kind {
|
||||
ty::Projection(ref data) => {
|
||||
(data.trait_ref(tcx).def_id, data.substs)
|
||||
}
|
||||
@ -1199,7 +1199,7 @@ fn confirm_object_candidate<'cx, 'tcx>(
|
||||
let object_ty = selcx.infcx().shallow_resolve(self_ty);
|
||||
debug!("confirm_object_candidate(object_ty={:?})",
|
||||
object_ty);
|
||||
let data = match object_ty.sty {
|
||||
let data = match object_ty.kind {
|
||||
ty::Dynamic(ref data, ..) => data,
|
||||
_ => {
|
||||
span_bug!(
|
||||
|
@ -186,7 +186,7 @@ impl_stable_hash_for!(struct DtorckConstraint<'tcx> {
|
||||
/// Note also that `needs_drop` requires a "global" type (i.e., one
|
||||
/// with erased regions), but this function does not.
|
||||
pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
// None of these types have a destructor and hence they do not
|
||||
// require anything in particular to outlive the dtor's
|
||||
// execution.
|
||||
|
@ -88,7 +88,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
|
||||
|
||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
let ty = ty.super_fold_with(self);
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Opaque(def_id, substs) if !substs.has_escaping_bound_vars() => {
|
||||
// (*)
|
||||
// Only normalize `impl Trait` after type-checking, usually in codegen.
|
||||
|
@ -1785,7 +1785,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
|
||||
// before we go into the whole placeholder thing, just
|
||||
// quickly check if the self-type is a projection at all.
|
||||
match obligation.predicate.skip_binder().trait_ref.self_ty().sty {
|
||||
match obligation.predicate.skip_binder().trait_ref.self_ty().kind {
|
||||
ty::Projection(_) | ty::Opaque(..) => {}
|
||||
ty::Infer(ty::TyVar(_)) => {
|
||||
span_bug!(
|
||||
@ -1823,7 +1823,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
placeholder_trait_predicate,
|
||||
);
|
||||
|
||||
let (def_id, substs) = match placeholder_trait_predicate.trait_ref.self_ty().sty {
|
||||
let (def_id, substs) = match placeholder_trait_predicate.trait_ref.self_ty().kind {
|
||||
ty::Projection(ref data) => (data.trait_ref(self.tcx()).def_id, data.substs),
|
||||
ty::Opaque(def_id, substs) => (def_id, substs),
|
||||
_ => {
|
||||
@ -1971,7 +1971,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
// touch bound regions, they just capture the in-scope
|
||||
// type/region parameters.
|
||||
let self_ty = *obligation.self_ty().skip_binder();
|
||||
match self_ty.sty {
|
||||
match self_ty.kind {
|
||||
ty::Generator(..) => {
|
||||
debug!(
|
||||
"assemble_generator_candidates: self_ty={:?} obligation={:?}",
|
||||
@ -2014,7 +2014,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
// Okay to skip binder because the substs on closure types never
|
||||
// touch bound regions, they just capture the in-scope
|
||||
// type/region parameters
|
||||
match obligation.self_ty().skip_binder().sty {
|
||||
match obligation.self_ty().skip_binder().kind {
|
||||
ty::Closure(closure_def_id, closure_substs) => {
|
||||
debug!(
|
||||
"assemble_unboxed_candidates: kind={:?} obligation={:?}",
|
||||
@ -2063,7 +2063,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
|
||||
// Okay to skip binder because what we are inspecting doesn't involve bound regions
|
||||
let self_ty = *obligation.self_ty().skip_binder();
|
||||
match self_ty.sty {
|
||||
match self_ty.kind {
|
||||
ty::Infer(ty::TyVar(_)) => {
|
||||
debug!("assemble_fn_pointer_candidates: ambiguous self-type");
|
||||
candidates.ambiguous = true; // could wind up being a fn() type
|
||||
@ -2125,7 +2125,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
let def_id = obligation.predicate.def_id();
|
||||
|
||||
if self.tcx().trait_is_auto(def_id) {
|
||||
match self_ty.sty {
|
||||
match self_ty.kind {
|
||||
ty::Dynamic(..) => {
|
||||
// For object types, we don't know what the closed
|
||||
// over types are. This means we conservatively
|
||||
@ -2198,7 +2198,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
// self-ty here doesn't escape this probe, so just erase
|
||||
// any LBR.
|
||||
let self_ty = self.tcx().erase_late_bound_regions(&obligation.self_ty());
|
||||
let poly_trait_ref = match self_ty.sty {
|
||||
let poly_trait_ref = match self_ty.kind {
|
||||
ty::Dynamic(ref data, ..) => {
|
||||
if data.auto_traits()
|
||||
.any(|did| did == obligation.predicate.def_id())
|
||||
@ -2294,7 +2294,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
source, target
|
||||
);
|
||||
|
||||
let may_apply = match (&source.sty, &target.sty) {
|
||||
let may_apply = match (&source.kind, &target.kind) {
|
||||
// Trait+Kx+'a -> Trait+Ky+'b (upcasts).
|
||||
(&ty::Dynamic(ref data_a, ..), &ty::Dynamic(ref data_b, ..)) => {
|
||||
// Upcasts permit two things:
|
||||
@ -2532,7 +2532,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
let self_ty = self.infcx
|
||||
.shallow_resolve(obligation.predicate.skip_binder().self_ty());
|
||||
|
||||
match self_ty.sty {
|
||||
match self_ty.kind {
|
||||
ty::Infer(ty::IntVar(_))
|
||||
| ty::Infer(ty::FloatVar(_))
|
||||
| ty::Uint(_)
|
||||
@ -2598,7 +2598,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
|
||||
use self::BuiltinImplConditions::{Ambiguous, None, Where};
|
||||
|
||||
match self_ty.sty {
|
||||
match self_ty.kind {
|
||||
ty::Infer(ty::IntVar(_))
|
||||
| ty::Infer(ty::FloatVar(_))
|
||||
| ty::FnDef(..)
|
||||
@ -2680,7 +2680,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
/// Zed<i32> where enum Zed { A(T), B(u32) } -> [i32, u32]
|
||||
/// ```
|
||||
fn constituent_types_for_ty(&self, t: Ty<'tcx>) -> Vec<Ty<'tcx>> {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Uint(_)
|
||||
| ty::Int(_)
|
||||
| ty::Bool
|
||||
@ -3118,7 +3118,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
// results.
|
||||
let self_ty = self.infcx
|
||||
.shallow_resolve(*obligation.self_ty().skip_binder());
|
||||
let poly_trait_ref = match self_ty.sty {
|
||||
let poly_trait_ref = match self_ty.kind {
|
||||
ty::Dynamic(ref data, ..) =>
|
||||
data.principal().unwrap_or_else(|| {
|
||||
span_bug!(obligation.cause.span, "object candidate with no principal")
|
||||
@ -3252,7 +3252,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
// touch bound regions, they just capture the in-scope
|
||||
// type/region parameters.
|
||||
let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
|
||||
let (generator_def_id, substs) = match self_ty.sty {
|
||||
let (generator_def_id, substs) = match self_ty.kind {
|
||||
ty::Generator(id, substs, _) => (id, substs),
|
||||
_ => bug!("closure candidate for non-closure {:?}", obligation),
|
||||
};
|
||||
@ -3309,7 +3309,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
// touch bound regions, they just capture the in-scope
|
||||
// type/region parameters.
|
||||
let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
|
||||
let (closure_def_id, substs) = match self_ty.sty {
|
||||
let (closure_def_id, substs) = match self_ty.kind {
|
||||
ty::Closure(id, substs) => (id, substs),
|
||||
_ => bug!("closure candidate for non-closure {:?}", obligation),
|
||||
};
|
||||
@ -3418,7 +3418,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
);
|
||||
|
||||
let mut nested = vec![];
|
||||
match (&source.sty, &target.sty) {
|
||||
match (&source.kind, &target.kind) {
|
||||
// Trait+Kx+'a -> Trait+Ky+'b (upcasts).
|
||||
(&ty::Dynamic(ref data_a, r_a), &ty::Dynamic(ref data_b, r_b)) => {
|
||||
// See assemble_candidates_for_unsizing for more info.
|
||||
@ -3550,7 +3550,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
let mut ty_params = GrowableBitSet::new_empty();
|
||||
let mut found = false;
|
||||
for ty in field.walk() {
|
||||
if let ty::Param(p) = ty.sty {
|
||||
if let ty::Param(p) = ty.kind {
|
||||
ty_params.insert(p.index as usize);
|
||||
found = true;
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ impl<'tcx> TypeVisitor<'tcx> for BoundNamesCollector {
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Bound(debruijn, bound_ty) if debruijn == self.binder_index => {
|
||||
self.types.insert(
|
||||
bound_ty.var.as_u32(),
|
||||
|
@ -59,7 +59,7 @@ impl TypeRelation<'tcx> for Match<'tcx> {
|
||||
a, b);
|
||||
if a == b { return Ok(a); }
|
||||
|
||||
match (&a.sty, &b.sty) {
|
||||
match (&a.kind, &b.kind) {
|
||||
(_, &ty::Infer(ty::FreshTy(_))) |
|
||||
(_, &ty::Infer(ty::FreshIntTy(_))) |
|
||||
(_, &ty::Infer(ty::FreshFloatTy(_))) => {
|
||||
|
@ -52,7 +52,7 @@ impl<'tcx> CastTy<'tcx> {
|
||||
/// Returns `Some` for integral/pointer casts.
|
||||
/// casts like unsizing casts will return `None`
|
||||
pub fn from_ty(t: Ty<'tcx>) -> Option<CastTy<'tcx>> {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Bool => Some(CastTy::Int(IntTy::Bool)),
|
||||
ty::Char => Some(CastTy::Int(IntTy::Char)),
|
||||
ty::Int(_) => Some(CastTy::Int(IntTy::I)),
|
||||
|
@ -31,7 +31,7 @@ pub trait EncodableWithShorthand: Clone + Eq + Hash {
|
||||
impl<'tcx> EncodableWithShorthand for Ty<'tcx> {
|
||||
type Variant = ty::TyKind<'tcx>;
|
||||
fn variant(&self) -> &Self::Variant {
|
||||
&self.sty
|
||||
&self.kind
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ impl<'tcx> CtxtInterners<'tcx> {
|
||||
let flags = super::flags::FlagComputation::for_sty(&st);
|
||||
|
||||
let ty_struct = TyS {
|
||||
sty: st,
|
||||
kind: st,
|
||||
flags: flags.flags,
|
||||
outer_exclusive_binder: flags.outer_exclusive_binder,
|
||||
};
|
||||
@ -828,7 +828,7 @@ impl CanonicalUserType<'tcx> {
|
||||
|
||||
user_substs.substs.iter().zip(BoundVar::new(0)..).all(|(kind, cvar)| {
|
||||
match kind.unpack() {
|
||||
UnpackedKind::Type(ty) => match ty.sty {
|
||||
UnpackedKind::Type(ty) => match ty.kind {
|
||||
ty::Bound(debruijn, b) => {
|
||||
// We only allow a `ty::INNERMOST` index in substitutions.
|
||||
assert_eq!(debruijn, ty::INNERMOST);
|
||||
@ -1565,7 +1565,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
}
|
||||
|
||||
let ret_ty = self.type_of(scope_def_id);
|
||||
match ret_ty.sty {
|
||||
match ret_ty.kind {
|
||||
ty::FnDef(_, _) => {
|
||||
let sig = ret_ty.fn_sig(*self);
|
||||
let output = self.erase_late_bound_regions(&sig.output());
|
||||
@ -2011,7 +2011,7 @@ macro_rules! sty_debug_print {
|
||||
let shards = tcx.interners.type_.lock_shards();
|
||||
let types = shards.iter().flat_map(|shard| shard.keys());
|
||||
for &Interned(t) in types {
|
||||
let variant = match t.sty {
|
||||
let variant = match t.kind {
|
||||
ty::Bool | ty::Char | ty::Int(..) | ty::Uint(..) |
|
||||
ty::Float(..) | ty::Str | ty::Never => continue,
|
||||
ty::Error => /* unimportant */ continue,
|
||||
@ -2083,7 +2083,7 @@ impl<'tcx, T: 'tcx+?Sized> Copy for Interned<'tcx, T> {}
|
||||
// N.B., an `Interned<Ty>` compares and hashes as a sty.
|
||||
impl<'tcx> PartialEq for Interned<'tcx, TyS<'tcx>> {
|
||||
fn eq(&self, other: &Interned<'tcx, TyS<'tcx>>) -> bool {
|
||||
self.0.sty == other.0.sty
|
||||
self.0.kind == other.0.kind
|
||||
}
|
||||
}
|
||||
|
||||
@ -2091,14 +2091,14 @@ impl<'tcx> Eq for Interned<'tcx, TyS<'tcx>> {}
|
||||
|
||||
impl<'tcx> Hash for Interned<'tcx, TyS<'tcx>> {
|
||||
fn hash<H: Hasher>(&self, s: &mut H) {
|
||||
self.0.sty.hash(s)
|
||||
self.0.kind.hash(s)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(rustc::usage_of_ty_tykind)]
|
||||
impl<'tcx> Borrow<TyKind<'tcx>> for Interned<'tcx, TyS<'tcx>> {
|
||||
fn borrow<'a>(&'a self) -> &'a TyKind<'tcx> {
|
||||
&self.0.sty
|
||||
&self.0.kind
|
||||
}
|
||||
}
|
||||
|
||||
@ -2292,7 +2292,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
/// It cannot convert a closure that requires unsafe.
|
||||
pub fn coerce_closure_fn_ty(self, sig: PolyFnSig<'tcx>, unsafety: hir::Unsafety) -> Ty<'tcx> {
|
||||
let converted_sig = sig.map_bound(|s| {
|
||||
let params_iter = match s.inputs()[0].sty {
|
||||
let params_iter = match s.inputs()[0].kind {
|
||||
ty::Tuple(params) => {
|
||||
params.into_iter().map(|k| k.expect_ty())
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
|
||||
|
||||
impl<'tcx> ty::TyS<'tcx> {
|
||||
pub fn sort_string(&self, tcx: TyCtxt<'_>) -> Cow<'static, str> {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
ty::Bool | ty::Char | ty::Int(_) |
|
||||
ty::Uint(_) | ty::Float(_) | ty::Str | ty::Never => self.to_string().into(),
|
||||
ty::Tuple(ref tys) if tys.is_empty() => self.to_string().into(),
|
||||
@ -275,7 +275,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
`.await`ing on both of them");
|
||||
}
|
||||
}
|
||||
match (&values.expected.sty, &values.found.sty) {
|
||||
match (&values.expected.kind, &values.found.kind) {
|
||||
(ty::Float(_), ty::Infer(ty::IntVar(_))) => if let Ok( // Issue #53280
|
||||
snippet,
|
||||
) = self.sess.source_map().span_to_snippet(sp) {
|
||||
|
@ -60,7 +60,7 @@ pub fn simplify_type(
|
||||
ty: Ty<'_>,
|
||||
can_simplify_params: bool,
|
||||
) -> Option<SimplifiedType> {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Bool => Some(BoolSimplifiedType),
|
||||
ty::Char => Some(CharSimplifiedType),
|
||||
ty::Int(int_type) => Some(IntSimplifiedType(int_type)),
|
||||
|
@ -472,7 +472,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for BoundVarReplacer<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Bound(debruijn, bound_ty) => {
|
||||
if debruijn == self.current_index {
|
||||
let fld_t = &mut self.fld_t;
|
||||
@ -776,7 +776,7 @@ impl TypeFolder<'tcx> for Shifter<'tcx> {
|
||||
}
|
||||
|
||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Bound(debruijn, bound_ty) => {
|
||||
if self.amount == 0 || debruijn < self.current_index {
|
||||
ty
|
||||
@ -985,7 +985,7 @@ impl<'tcx> TypeVisitor<'tcx> for LateBoundRegionsCollector {
|
||||
// ignore the inputs to a projection, as they may not appear
|
||||
// in the normalized form
|
||||
if self.just_constrained {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Projection(..) | ty::Opaque(..) => { return false; }
|
||||
_ => { }
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ impl<'tcx> FieldDef {
|
||||
impl<'tcx> TyS<'tcx> {
|
||||
/// Calculates the forest of `DefId`s from which this type is visibly uninhabited.
|
||||
fn uninhabited_from(&self, tcx: TyCtxt<'tcx>) -> DefIdForest {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Adt(def, substs) => def.uninhabited_from(tcx, substs),
|
||||
|
||||
Never => DefIdForest::full(tcx),
|
||||
|
@ -54,7 +54,7 @@ impl<'tcx> Instance<'tcx> {
|
||||
|
||||
fn fn_sig_noadjust(&self, tcx: TyCtxt<'tcx>) -> PolyFnSig<'tcx> {
|
||||
let ty = self.ty(tcx);
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::FnDef(..) |
|
||||
// Shims currently have type FnPtr. Not sure this should remain.
|
||||
ty::FnPtr(_) => ty.fn_sig(tcx),
|
||||
@ -255,7 +255,7 @@ impl<'tcx> Instance<'tcx> {
|
||||
&ty,
|
||||
);
|
||||
|
||||
let def = match item_type.sty {
|
||||
let def = match item_type.kind {
|
||||
ty::FnDef(..) if {
|
||||
let f = item_type.fn_sig(tcx);
|
||||
f.abi() == Abi::RustIntrinsic ||
|
||||
|
@ -520,7 +520,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
|
||||
};
|
||||
debug_assert!(!ty.has_infer_types());
|
||||
|
||||
Ok(match ty.sty {
|
||||
Ok(match ty.kind {
|
||||
// Basic scalars.
|
||||
ty::Bool => {
|
||||
tcx.intern_layout(LayoutDetails::scalar(self, Scalar {
|
||||
@ -573,7 +573,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
|
||||
}
|
||||
|
||||
let unsized_part = tcx.struct_tail_erasing_lifetimes(pointee, param_env);
|
||||
let metadata = match unsized_part.sty {
|
||||
let metadata = match unsized_part.kind {
|
||||
ty::Foreign(..) => {
|
||||
return Ok(tcx.intern_layout(LayoutDetails::scalar(self, data_ptr)));
|
||||
}
|
||||
@ -1618,7 +1618,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
|
||||
variants);
|
||||
};
|
||||
|
||||
let adt_def = match layout.ty.sty {
|
||||
let adt_def = match layout.ty.kind {
|
||||
ty::Adt(ref adt_def, _) => {
|
||||
debug!("print-type-size t: `{:?}` process adt", layout.ty);
|
||||
adt_def
|
||||
@ -1759,12 +1759,12 @@ impl<'tcx> SizeSkeleton<'tcx> {
|
||||
Err(err) => err
|
||||
};
|
||||
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Ref(_, pointee, _) |
|
||||
ty::RawPtr(ty::TypeAndMut { ty: pointee, .. }) => {
|
||||
let non_zero = !ty.is_unsafe_ptr();
|
||||
let tail = tcx.struct_tail_erasing_lifetimes(pointee, param_env);
|
||||
match tail.sty {
|
||||
match tail.kind {
|
||||
ty::Param(_) | ty::Projection(_) => {
|
||||
debug_assert!(tail.has_param_types());
|
||||
Ok(SizeSkeleton::Pointer {
|
||||
@ -2040,7 +2040,7 @@ where
|
||||
assert_eq!(layout.variants, Variants::Single { index });
|
||||
}
|
||||
|
||||
let fields = match this.ty.sty {
|
||||
let fields = match this.ty.kind {
|
||||
ty::Adt(def, _) => def.variants[variant_index].fields.len(),
|
||||
_ => bug!()
|
||||
};
|
||||
@ -2078,7 +2078,7 @@ where
|
||||
}))
|
||||
};
|
||||
|
||||
cx.layout_of(match this.ty.sty {
|
||||
cx.layout_of(match this.ty.kind {
|
||||
ty::Bool |
|
||||
ty::Char |
|
||||
ty::Int(_) |
|
||||
@ -2115,7 +2115,7 @@ where
|
||||
}));
|
||||
}
|
||||
|
||||
match tcx.struct_tail_erasing_lifetimes(pointee, cx.param_env()).sty {
|
||||
match tcx.struct_tail_erasing_lifetimes(pointee, cx.param_env()).kind {
|
||||
ty::Slice(_) |
|
||||
ty::Str => tcx.types.usize,
|
||||
ty::Dynamic(_, _) => {
|
||||
@ -2202,7 +2202,7 @@ where
|
||||
cx: &C,
|
||||
offset: Size,
|
||||
) -> Option<PointeeInfo> {
|
||||
match this.ty.sty {
|
||||
match this.ty.kind {
|
||||
ty::RawPtr(mt) if offset.bytes() == 0 => {
|
||||
cx.layout_of(mt.ty).to_result().ok()
|
||||
.map(|layout| PointeeInfo {
|
||||
@ -2309,7 +2309,7 @@ where
|
||||
|
||||
// FIXME(eddyb) This should be for `ptr::Unique<T>`, not `Box<T>`.
|
||||
if let Some(ref mut pointee) = result {
|
||||
if let ty::Adt(def, _) = this.ty.sty {
|
||||
if let ty::Adt(def, _) = this.ty.kind {
|
||||
if def.is_box() && offset.bytes() == 0 {
|
||||
pointee.safe = Some(PointerKind::UniqueOwned);
|
||||
}
|
||||
@ -2641,7 +2641,7 @@ where
|
||||
let extra_args = if sig.abi == RustCall {
|
||||
assert!(!sig.c_variadic && extra_args.is_empty());
|
||||
|
||||
match sig.inputs().last().unwrap().sty {
|
||||
match sig.inputs().last().unwrap().kind {
|
||||
ty::Tuple(tupled_arguments) => {
|
||||
inputs = &sig.inputs()[0..sig.inputs().len() - 1];
|
||||
tupled_arguments.iter().map(|k| k.expect_ty()).collect()
|
||||
@ -2753,7 +2753,7 @@ where
|
||||
Some(did) => did,
|
||||
None => bug!("`va_list` lang item required for C-variadic functions"),
|
||||
};
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Adt(def, _) if def.did == va_list_did => {
|
||||
// This is the "spoofed" `VaListImpl`. Set the arguments mode
|
||||
// so that it will be ignored.
|
||||
|
@ -479,7 +479,7 @@ bitflags! {
|
||||
|
||||
#[allow(rustc::usage_of_ty_tykind)]
|
||||
pub struct TyS<'tcx> {
|
||||
pub sty: TyKind<'tcx>,
|
||||
pub kind: TyKind<'tcx>,
|
||||
pub flags: TypeFlags,
|
||||
|
||||
/// This is a kind of confusing thing: it stores the smallest
|
||||
@ -508,13 +508,13 @@ static_assert_size!(TyS<'_>, 32);
|
||||
|
||||
impl<'tcx> Ord for TyS<'tcx> {
|
||||
fn cmp(&self, other: &TyS<'tcx>) -> Ordering {
|
||||
self.sty.cmp(&other.sty)
|
||||
self.kind.cmp(&other.kind)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> PartialOrd for TyS<'tcx> {
|
||||
fn partial_cmp(&self, other: &TyS<'tcx>) -> Option<Ordering> {
|
||||
Some(self.sty.cmp(&other.sty))
|
||||
Some(self.kind.cmp(&other.kind))
|
||||
}
|
||||
}
|
||||
|
||||
@ -534,7 +534,7 @@ impl<'tcx> Hash for TyS<'tcx> {
|
||||
|
||||
impl<'tcx> TyS<'tcx> {
|
||||
pub fn is_primitive_ty(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Bool |
|
||||
Char |
|
||||
Int(_) |
|
||||
@ -550,7 +550,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
}
|
||||
|
||||
pub fn is_suggestable(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Opaque(..) |
|
||||
FnDef(..) |
|
||||
FnPtr(..) |
|
||||
@ -568,16 +568,16 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::TyS<'tcx> {
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
let ty::TyS {
|
||||
ref sty,
|
||||
ref kind,
|
||||
|
||||
// The other fields just provide fast access to information that is
|
||||
// also contained in `sty`, so no need to hash them.
|
||||
// also contained in `kind`, so no need to hash them.
|
||||
flags: _,
|
||||
|
||||
outer_exclusive_binder: _,
|
||||
} = *self;
|
||||
|
||||
sty.hash_stable(hcx, hasher);
|
||||
kind.hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2494,7 +2494,7 @@ impl<'tcx> AdtDef {
|
||||
}
|
||||
|
||||
fn sized_constraint_for_ty(&self, tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Vec<Ty<'tcx>> {
|
||||
let result = match ty.sty {
|
||||
let result = match ty.kind {
|
||||
Bool | Char | Int(..) | Uint(..) | Float(..) |
|
||||
RawPtr(..) | Ref(..) | FnDef(..) | FnPtr(_) |
|
||||
Array(..) | Closure(..) | Generator(..) | Never => {
|
||||
@ -3339,7 +3339,7 @@ fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Ty<'_>> {
|
||||
}
|
||||
|
||||
let self_ty = trait_ref.self_ty();
|
||||
let self_ty_matches = match self_ty.sty {
|
||||
let self_ty_matches = match self_ty.kind {
|
||||
ty::Dynamic(ref data, ty::ReStatic) => data.principal().is_none(),
|
||||
_ => false
|
||||
};
|
||||
|
@ -60,7 +60,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
// with `collect()` because of the need to sometimes skip subtrees
|
||||
// in the `subtys` iterator (e.g., when encountering a
|
||||
// projection).
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Closure(def_id, ref substs) => {
|
||||
for upvar_ty in substs.upvar_tys(def_id, *self) {
|
||||
self.compute_components(upvar_ty, out);
|
||||
|
@ -266,7 +266,7 @@ pub trait Printer<'tcx>: Sized {
|
||||
/// type. It's just a heuristic so it makes some questionable
|
||||
/// decisions and we may want to adjust it later.
|
||||
pub fn characteristic_def_id_of_type(ty: Ty<'_>) -> Option<DefId> {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Adt(adt_def, _) => Some(adt_def.did),
|
||||
|
||||
ty::Dynamic(data, ..) => data.principal_def_id(),
|
||||
|
@ -34,7 +34,7 @@ impl DefPathBasedNames<'tcx> {
|
||||
// When being used for codegen purposes, `debug` should be set to `false`
|
||||
// in order to catch unexpected types that should never end up in a type name.
|
||||
pub fn push_type_name(&self, t: Ty<'tcx>, output: &mut String, debug: bool) {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Bool => output.push_str("bool"),
|
||||
ty::Char => output.push_str("char"),
|
||||
ty::Str => output.push_str("str"),
|
||||
|
@ -414,7 +414,7 @@ pub trait PrettyPrinter<'tcx>:
|
||||
// Inherent impls. Try to print `Foo::bar` for an inherent
|
||||
// impl on `Foo`, but fallback to `<Foo>::bar` if self-type is
|
||||
// anything other than a simple path.
|
||||
match self_ty.sty {
|
||||
match self_ty.kind {
|
||||
ty::Adt(..) | ty::Foreign(_) |
|
||||
ty::Bool | ty::Char | ty::Str |
|
||||
ty::Int(_) | ty::Uint(_) | ty::Float(_) => {
|
||||
@ -463,7 +463,7 @@ pub trait PrettyPrinter<'tcx>:
|
||||
) -> Result<Self::Type, Self::Error> {
|
||||
define_scoped_cx!(self);
|
||||
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Bool => p!(write("bool")),
|
||||
ty::Char => p!(write("char")),
|
||||
ty::Int(t) => p!(write("{}", t.ty_to_string())),
|
||||
@ -739,7 +739,7 @@ pub trait PrettyPrinter<'tcx>:
|
||||
// Special-case `Fn(...) -> ...` and resugar it.
|
||||
let fn_trait_kind = self.tcx().lang_items().fn_trait_kind(principal.def_id);
|
||||
if !self.tcx().sess.verbose() && fn_trait_kind.is_some() {
|
||||
if let ty::Tuple(ref args) = principal.substs.type_at(0).sty {
|
||||
if let ty::Tuple(ref args) = principal.substs.type_at(0).kind {
|
||||
let mut projections = predicates.projection_bounds();
|
||||
if let (Some(proj), None) = (projections.next(), projections.next()) {
|
||||
let tys: Vec<_> = args.iter().map(|k| k.expect_ty()).collect();
|
||||
@ -856,7 +856,7 @@ pub trait PrettyPrinter<'tcx>:
|
||||
define_scoped_cx!(self);
|
||||
|
||||
let u8 = self.tcx().types.u8;
|
||||
if let ty::FnDef(did, substs) = ct.ty.sty {
|
||||
if let ty::FnDef(did, substs) = ct.ty.kind {
|
||||
p!(print_value_path(did, substs));
|
||||
return Ok(self);
|
||||
}
|
||||
@ -887,7 +887,7 @@ pub trait PrettyPrinter<'tcx>:
|
||||
return Ok(self);
|
||||
}
|
||||
if let ConstValue::Scalar(Scalar::Raw { data, .. }) = ct.val {
|
||||
match ct.ty.sty {
|
||||
match ct.ty.kind {
|
||||
ty::Bool => {
|
||||
p!(write("{}", if data == 0 { "false" } else { "true" }));
|
||||
return Ok(self);
|
||||
@ -935,8 +935,8 @@ pub trait PrettyPrinter<'tcx>:
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
if let ty::Ref(_, ref_ty, _) = ct.ty.sty {
|
||||
let byte_str = match (ct.val, &ref_ty.sty) {
|
||||
if let ty::Ref(_, ref_ty, _) = ct.ty.kind {
|
||||
let byte_str = match (ct.val, &ref_ty.kind) {
|
||||
(ConstValue::Scalar(Scalar::Ptr(ptr)), ty::Array(t, n)) if *t == u8 => {
|
||||
let n = n.eval_usize(self.tcx(), ty::ParamEnv::empty());
|
||||
Some(self.tcx()
|
||||
|
@ -349,7 +349,7 @@ pub fn super_relate_tys<R: TypeRelation<'tcx>>(
|
||||
) -> RelateResult<'tcx, Ty<'tcx>> {
|
||||
let tcx = relation.tcx();
|
||||
debug!("super_relate_tys: a={:?} b={:?}", a, b);
|
||||
match (&a.sty, &b.sty) {
|
||||
match (&a.kind, &b.kind) {
|
||||
(&ty::Infer(_), _) |
|
||||
(_, &ty::Infer(_)) =>
|
||||
{
|
||||
|
@ -1023,7 +1023,7 @@ impl<'tcx> TypeFoldable<'tcx> for interpret::GlobalId<'tcx> {
|
||||
|
||||
impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
|
||||
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
|
||||
let sty = match self.sty {
|
||||
let sty = match self.kind {
|
||||
ty::RawPtr(tm) => ty::RawPtr(tm.fold_with(folder)),
|
||||
ty::Array(typ, sz) => ty::Array(typ.fold_with(folder), sz.fold_with(folder)),
|
||||
ty::Slice(typ) => ty::Slice(typ.fold_with(folder)),
|
||||
@ -1067,7 +1067,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
|
||||
ty::Foreign(..) => return self
|
||||
};
|
||||
|
||||
if self.sty == sty {
|
||||
if self.kind == sty {
|
||||
self
|
||||
} else {
|
||||
folder.tcx().mk_ty(sty)
|
||||
@ -1079,7 +1079,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
|
||||
}
|
||||
|
||||
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
ty::RawPtr(ref tm) => tm.visit_with(visitor),
|
||||
ty::Array(typ, sz) => typ.visit_with(visitor) || sz.visit_with(visitor),
|
||||
ty::Slice(typ) => typ.visit_with(visitor),
|
||||
|
@ -384,9 +384,9 @@ impl<'tcx> ClosureSubsts<'tcx> {
|
||||
/// If you have an inference context, use `infcx.closure_sig()`.
|
||||
pub fn closure_sig(self, def_id: DefId, tcx: TyCtxt<'tcx>) -> ty::PolyFnSig<'tcx> {
|
||||
let ty = self.closure_sig_ty(def_id, tcx);
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::FnPtr(sig) => sig,
|
||||
_ => bug!("closure_sig_ty is not a fn-ptr: {:?}", ty.sty),
|
||||
_ => bug!("closure_sig_ty is not a fn-ptr: {:?}", ty.kind),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1678,7 +1678,7 @@ impl RegionKind {
|
||||
impl<'tcx> TyS<'tcx> {
|
||||
#[inline]
|
||||
pub fn is_unit(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Tuple(ref tys) => tys.is_empty(),
|
||||
_ => false,
|
||||
}
|
||||
@ -1686,7 +1686,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_never(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Never => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -1701,7 +1701,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
pub fn conservative_is_privately_uninhabited(&self, tcx: TyCtxt<'tcx>) -> bool {
|
||||
// FIXME(varkor): we can make this less conversative by substituting concrete
|
||||
// type arguments.
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
ty::Never => true,
|
||||
ty::Adt(def, _) if def.is_union() => {
|
||||
// For now, `union`s are never considered uninhabited.
|
||||
@ -1741,7 +1741,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_primitive(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Bool | Char | Int(_) | Uint(_) | Float(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -1749,7 +1749,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_ty_var(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Infer(TyVar(_)) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -1757,7 +1757,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_ty_infer(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Infer(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -1765,7 +1765,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_phantom_data(&self) -> bool {
|
||||
if let Adt(def, _) = self.sty {
|
||||
if let Adt(def, _) = self.kind {
|
||||
def.is_phantom_data()
|
||||
} else {
|
||||
false
|
||||
@ -1773,11 +1773,11 @@ impl<'tcx> TyS<'tcx> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_bool(&self) -> bool { self.sty == Bool }
|
||||
pub fn is_bool(&self) -> bool { self.kind == Bool }
|
||||
|
||||
#[inline]
|
||||
pub fn is_param(&self, index: u32) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
ty::Param(ref data) => data.index == index,
|
||||
_ => false,
|
||||
}
|
||||
@ -1785,8 +1785,8 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_slice(&self) -> bool {
|
||||
match self.sty {
|
||||
RawPtr(TypeAndMut { ty, .. }) | Ref(_, ty, _) => match ty.sty {
|
||||
match self.kind {
|
||||
RawPtr(TypeAndMut { ty, .. }) | Ref(_, ty, _) => match ty.kind {
|
||||
Slice(_) | Str => true,
|
||||
_ => false,
|
||||
},
|
||||
@ -1796,14 +1796,14 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_simd(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Adt(def, _) => def.repr.simd(),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn sequence_element_type(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Array(ty, _) | Slice(ty) => ty,
|
||||
Str => tcx.mk_mach_uint(ast::UintTy::U8),
|
||||
_ => bug!("sequence_element_type called on non-sequence value: {}", self),
|
||||
@ -1811,7 +1811,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
}
|
||||
|
||||
pub fn simd_type(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Adt(def, substs) => {
|
||||
def.non_enum_variant().fields[0].ty(tcx, substs)
|
||||
}
|
||||
@ -1820,7 +1820,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
}
|
||||
|
||||
pub fn simd_size(&self, _cx: TyCtxt<'_>) -> usize {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Adt(def, _) => def.non_enum_variant().fields.len(),
|
||||
_ => bug!("simd_size called on invalid type")
|
||||
}
|
||||
@ -1828,7 +1828,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_region_ptr(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Ref(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -1836,7 +1836,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_mutable_ptr(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
RawPtr(TypeAndMut { mutbl: hir::Mutability::MutMutable, .. }) |
|
||||
Ref(_, _, hir::Mutability::MutMutable) => true,
|
||||
_ => false
|
||||
@ -1845,7 +1845,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_unsafe_ptr(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
RawPtr(_) => return true,
|
||||
_ => return false,
|
||||
}
|
||||
@ -1860,7 +1860,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
/// Returns `true` if this type is an `Arc<T>`.
|
||||
#[inline]
|
||||
pub fn is_arc(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Adt(def, _) => def.is_arc(),
|
||||
_ => false,
|
||||
}
|
||||
@ -1869,7 +1869,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
/// Returns `true` if this type is an `Rc<T>`.
|
||||
#[inline]
|
||||
pub fn is_rc(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Adt(def, _) => def.is_rc(),
|
||||
_ => false,
|
||||
}
|
||||
@ -1877,7 +1877,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_box(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Adt(def, _) => def.is_box(),
|
||||
_ => false,
|
||||
}
|
||||
@ -1885,7 +1885,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
/// panics if called on any type other than `Box<T>`
|
||||
pub fn boxed_ty(&self) -> Ty<'tcx> {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Adt(def, substs) if def.is_box() => substs.type_at(0),
|
||||
_ => bug!("`boxed_ty` is called on non-box type {:?}", self),
|
||||
}
|
||||
@ -1896,7 +1896,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
/// contents are abstract to rustc.)
|
||||
#[inline]
|
||||
pub fn is_scalar(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Bool | Char | Int(_) | Float(_) | Uint(_) |
|
||||
Infer(IntVar(_)) | Infer(FloatVar(_)) |
|
||||
FnDef(..) | FnPtr(_) | RawPtr(_) => true,
|
||||
@ -1907,7 +1907,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
/// Returns `true` if this type is a floating point type.
|
||||
#[inline]
|
||||
pub fn is_floating_point(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Float(_) |
|
||||
Infer(FloatVar(_)) => true,
|
||||
_ => false,
|
||||
@ -1916,7 +1916,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_trait(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Dynamic(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -1924,7 +1924,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_enum(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Adt(adt_def, _) => {
|
||||
adt_def.is_enum()
|
||||
}
|
||||
@ -1934,7 +1934,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_closure(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Closure(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -1942,7 +1942,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_generator(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Generator(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -1950,7 +1950,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_integral(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Infer(IntVar(_)) | Int(_) | Uint(_) => true,
|
||||
_ => false
|
||||
}
|
||||
@ -1958,7 +1958,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_fresh_ty(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Infer(FreshTy(_)) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -1966,7 +1966,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_fresh(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Infer(FreshTy(_)) => true,
|
||||
Infer(FreshIntTy(_)) => true,
|
||||
Infer(FreshFloatTy(_)) => true,
|
||||
@ -1976,7 +1976,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_char(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Char => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -1989,7 +1989,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_signed(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Int(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -1997,7 +1997,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_ptr_sized_integral(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Int(ast::IntTy::Isize) | Uint(ast::UintTy::Usize) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -2005,7 +2005,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_machine(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Int(..) | Uint(..) | Float(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -2013,7 +2013,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn has_concrete_skeleton(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Param(_) | Infer(_) | Error => false,
|
||||
_ => true,
|
||||
}
|
||||
@ -2024,7 +2024,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
/// The parameter `explicit` indicates if this is an *explicit* dereference.
|
||||
/// Some types -- notably unsafe ptrs -- can only be dereferenced explicitly.
|
||||
pub fn builtin_deref(&self, explicit: bool) -> Option<TypeAndMut<'tcx>> {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Adt(def, _) if def.is_box() => {
|
||||
Some(TypeAndMut {
|
||||
ty: self.boxed_ty(),
|
||||
@ -2039,14 +2039,14 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
/// Returns the type of `ty[i]`.
|
||||
pub fn builtin_index(&self) -> Option<Ty<'tcx>> {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Array(ty, _) | Slice(ty) => Some(ty),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fn_sig(&self, tcx: TyCtxt<'tcx>) -> PolyFnSig<'tcx> {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
FnDef(def_id, substs) => {
|
||||
tcx.fn_sig(def_id).subst(tcx, substs)
|
||||
}
|
||||
@ -2063,7 +2063,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_fn(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
FnDef(..) | FnPtr(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -2071,7 +2071,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_fn_ptr(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
FnPtr(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -2079,7 +2079,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn is_impl_trait(&self) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Opaque(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
@ -2087,7 +2087,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn ty_adt_def(&self) -> Option<&'tcx AdtDef> {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Adt(adt, _) => Some(adt),
|
||||
_ => None,
|
||||
}
|
||||
@ -2096,7 +2096,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
/// Iterates over tuple fields.
|
||||
/// Panics when called on anything but a tuple.
|
||||
pub fn tuple_fields(&self) -> impl DoubleEndedIterator<Item=Ty<'tcx>> {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Tuple(substs) => substs.iter().map(|field| field.expect_ty()),
|
||||
_ => bug!("tuple_fields called on non-tuple"),
|
||||
}
|
||||
@ -2106,7 +2106,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
/// FIXME This requires the optimized MIR in the case of generators.
|
||||
#[inline]
|
||||
pub fn variant_range(&self, tcx: TyCtxt<'tcx>) -> Option<Range<VariantIdx>> {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
TyKind::Adt(adt, _) => Some(adt.variant_range()),
|
||||
TyKind::Generator(def_id, substs, _) => Some(substs.variant_range(def_id, tcx)),
|
||||
_ => None,
|
||||
@ -2122,7 +2122,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
variant_index: VariantIdx,
|
||||
) -> Option<Discr<'tcx>> {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
TyKind::Adt(adt, _) => Some(adt.discriminant_for_variant(tcx, variant_index)),
|
||||
TyKind::Generator(def_id, substs, _) =>
|
||||
Some(substs.discriminant_for_variant(def_id, tcx, variant_index)),
|
||||
@ -2134,7 +2134,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
/// types reachable from this type via `walk_tys`). This ignores late-bound
|
||||
/// regions binders.
|
||||
pub fn push_regions(&self, out: &mut SmallVec<[ty::Region<'tcx>; 4]>) {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Ref(region, _, _) => {
|
||||
out.push(region);
|
||||
}
|
||||
@ -2190,7 +2190,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
/// inferred. Once upvar inference (in `src/librustc_typeck/check/upvar.rs`)
|
||||
/// is complete, that type variable will be unified.
|
||||
pub fn to_opt_closure_kind(&self) -> Option<ty::ClosureKind> {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
Int(int_ty) => match int_ty {
|
||||
ast::IntTy::I8 => Some(ty::ClosureKind::Fn),
|
||||
ast::IntTy::I16 => Some(ty::ClosureKind::FnMut),
|
||||
@ -2211,7 +2211,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
/// Returning true means the type is known to be sized. Returning
|
||||
/// `false` means nothing -- could be sized, might not be.
|
||||
pub fn is_trivially_sized(&self, tcx: TyCtxt<'tcx>) -> bool {
|
||||
match self.sty {
|
||||
match self.kind {
|
||||
ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_)) |
|
||||
ty::Uint(_) | ty::Int(_) | ty::Bool | ty::Float(_) |
|
||||
ty::FnDef(..) | ty::FnPtr(_) | ty::RawPtr(..) |
|
||||
|
@ -501,7 +501,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> {
|
||||
}
|
||||
self.ty_stack_depth += 1;
|
||||
|
||||
let t1 = match t.sty {
|
||||
let t1 = match t.kind {
|
||||
ty::Param(p) => {
|
||||
self.ty_for_param(p, t)
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ pub struct Discr<'tcx> {
|
||||
|
||||
impl<'tcx> fmt::Display for Discr<'tcx> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.ty.sty {
|
||||
match self.ty.kind {
|
||||
ty::Int(ity) => {
|
||||
let size = ty::tls::with(|tcx| {
|
||||
Integer::from_attr(&tcx, SignedInt(ity)).size()
|
||||
@ -54,7 +54,7 @@ impl<'tcx> Discr<'tcx> {
|
||||
self.checked_add(tcx, 1).0
|
||||
}
|
||||
pub fn checked_add(self, tcx: TyCtxt<'tcx>, n: u128) -> (Self, bool) {
|
||||
let (int, signed) = match self.ty.sty {
|
||||
let (int, signed) = match self.ty.kind {
|
||||
Int(ity) => (Integer::from_attr(&tcx, SignedInt(ity)), true),
|
||||
Uint(uty) => (Integer::from_attr(&tcx, UnsignedInt(uty)), false),
|
||||
_ => bug!("non integer discriminant"),
|
||||
@ -179,7 +179,7 @@ impl<'tcx> ty::ParamEnv<'tcx> {
|
||||
) -> Result<(), CopyImplementationError<'tcx>> {
|
||||
// FIXME: (@jroesch) float this code up
|
||||
tcx.infer_ctxt().enter(|infcx| {
|
||||
let (adt, substs) = match self_type.sty {
|
||||
let (adt, substs) = match self_type.kind {
|
||||
// These types used to have a builtin impl.
|
||||
// Now libcore provides that impl.
|
||||
ty::Uint(_) | ty::Int(_) | ty::Bool | ty::Float(_) |
|
||||
@ -246,10 +246,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx> {
|
||||
pub fn has_error_field(self, ty: Ty<'tcx>) -> bool {
|
||||
if let ty::Adt(def, substs) = ty.sty {
|
||||
if let ty::Adt(def, substs) = ty.kind {
|
||||
for field in def.all_fields() {
|
||||
let field_ty = field.ty(self, substs);
|
||||
if let Error = field_ty.sty {
|
||||
if let Error = field_ty.kind {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -298,7 +298,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
-> Ty<'tcx>
|
||||
{
|
||||
loop {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Adt(def, substs) => {
|
||||
if !def.is_struct() {
|
||||
break;
|
||||
@ -370,7 +370,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
{
|
||||
let (mut a, mut b) = (source, target);
|
||||
loop {
|
||||
match (&a.sty, &b.sty) {
|
||||
match (&a.kind, &b.kind) {
|
||||
(&Adt(a_def, a_substs), &Adt(b_def, b_substs))
|
||||
if a_def == b_def && a_def.is_struct() => {
|
||||
if let Some(f) = a_def.non_enum_variant().fields.last() {
|
||||
@ -544,12 +544,12 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
// <P1, P2, P0>, and then look up which of the impl substs refer to
|
||||
// parameters marked as pure.
|
||||
|
||||
let impl_substs = match self.type_of(impl_def_id).sty {
|
||||
let impl_substs = match self.type_of(impl_def_id).kind {
|
||||
ty::Adt(def_, substs) if def_ == def => substs,
|
||||
_ => bug!()
|
||||
};
|
||||
|
||||
let item_substs = match self.type_of(def.did).sty {
|
||||
let item_substs = match self.type_of(def.did).kind {
|
||||
ty::Adt(def_, substs) if def_ == def => substs,
|
||||
_ => bug!()
|
||||
};
|
||||
@ -561,7 +561,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
!impl_generics.region_param(ebr, self).pure_wrt_drop
|
||||
}
|
||||
UnpackedKind::Type(&ty::TyS {
|
||||
sty: ty::Param(ref pt), ..
|
||||
kind: ty::Param(ref pt), ..
|
||||
}) => {
|
||||
!impl_generics.type_param(pt, self).pure_wrt_drop
|
||||
}
|
||||
@ -733,7 +733,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
}
|
||||
|
||||
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
|
||||
if let ty::Opaque(def_id, substs) = t.sty {
|
||||
if let ty::Opaque(def_id, substs) = t.kind {
|
||||
self.expand_opaque_ty(def_id, substs).unwrap_or(t)
|
||||
} else {
|
||||
t.super_fold_with(self)
|
||||
@ -811,7 +811,7 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||
}
|
||||
|
||||
pub fn same_type(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
|
||||
match (&a.sty, &b.sty) {
|
||||
match (&a.kind, &b.kind) {
|
||||
(&Adt(did_a, substs_a), &Adt(did_b, substs_b)) => {
|
||||
if did_a != did_b {
|
||||
return false;
|
||||
@ -846,7 +846,7 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||
representable_cache: &mut FxHashMap<Ty<'tcx>, Representability>,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Representability {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
Tuple(..) => {
|
||||
// Find non representable
|
||||
fold_repr(ty.tuple_fields().map(|ty| {
|
||||
@ -889,7 +889,7 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||
}
|
||||
|
||||
fn same_struct_or_enum<'tcx>(ty: Ty<'tcx>, def: &'tcx ty::AdtDef) -> bool {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
Adt(ty_def, _) => {
|
||||
ty_def == def
|
||||
}
|
||||
@ -927,7 +927,7 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||
representable_cache: &mut FxHashMap<Ty<'tcx>, Representability>,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Representability {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
Adt(def, _) => {
|
||||
{
|
||||
// Iterate through stack of previously seen types.
|
||||
@ -1009,7 +1009,7 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||
/// - `&'a *const &'b u8 -> *const &'b u8`
|
||||
pub fn peel_refs(&'tcx self) -> Ty<'tcx> {
|
||||
let mut ty = self;
|
||||
while let Ref(_, inner_ty, _) = ty.sty {
|
||||
while let Ref(_, inner_ty, _) = ty.kind {
|
||||
ty = inner_ty;
|
||||
}
|
||||
ty
|
||||
@ -1067,7 +1067,7 @@ fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>
|
||||
|
||||
assert!(!ty.needs_infer());
|
||||
|
||||
NeedsDrop(match ty.sty {
|
||||
NeedsDrop(match ty.kind {
|
||||
// Fast-path for primitive types
|
||||
ty::Infer(ty::FreshIntTy(_)) | ty::Infer(ty::FreshFloatTy(_)) |
|
||||
ty::Bool | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Never |
|
||||
@ -1170,7 +1170,7 @@ impl<'tcx> ExplicitSelf<'tcx> {
|
||||
{
|
||||
use self::ExplicitSelf::*;
|
||||
|
||||
match self_arg_ty.sty {
|
||||
match self_arg_ty.kind {
|
||||
_ if is_self_ty(self_arg_ty) => ByValue,
|
||||
ty::Ref(region, ty, mutbl) if is_self_ty(ty) => {
|
||||
ByReference(region, mutbl)
|
||||
|
@ -69,7 +69,7 @@ pub fn walk_shallow(ty: Ty<'_>) -> smallvec::IntoIter<TypeWalkerArray<'_>> {
|
||||
// natural order one would expect (basically, the order of the
|
||||
// types as they are written).
|
||||
fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) {
|
||||
match parent_ty.sty {
|
||||
match parent_ty.kind {
|
||||
ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) |
|
||||
ty::Str | ty::Infer(_) | ty::Param(_) | ty::Never | ty::Error |
|
||||
ty::Placeholder(..) | ty::Bound(..) | ty::Foreign(..) => {
|
||||
|
@ -236,7 +236,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
||||
let mut subtys = ty0.walk();
|
||||
let param_env = self.param_env;
|
||||
while let Some(ty) = subtys.next() {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Bool |
|
||||
ty::Char |
|
||||
ty::Int(..) |
|
||||
@ -407,7 +407,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
||||
// is satisfied to ensure termination.)
|
||||
ty::Infer(_) => {
|
||||
let ty = self.infcx.shallow_resolve(ty);
|
||||
if let ty::Infer(_) = ty.sty { // not yet resolved...
|
||||
if let ty::Infer(_) = ty.kind { // not yet resolved...
|
||||
if ty == ty0 { // ...this is the type we started from! no progress.
|
||||
return false;
|
||||
}
|
||||
|
@ -615,7 +615,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
|
||||
self.check_if_assigned_path_is_moved(id, lp_base);
|
||||
}
|
||||
LpExtend(ref lp_base, _, LpInterior(_, InteriorField(_))) => {
|
||||
match lp_base.to_type().sty {
|
||||
match lp_base.to_type().kind {
|
||||
ty::Adt(def, _) if def.has_dtor(self.tcx()) => {
|
||||
// In the case where the owner implements drop, then
|
||||
// the path must be initialized to prevent a case of
|
||||
|
@ -108,7 +108,7 @@ fn check_and_get_illegal_move_origin<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
|
||||
Categorization::Downcast(ref b, _) |
|
||||
Categorization::Interior(ref b, mc::InteriorField(_)) |
|
||||
Categorization::Interior(ref b, mc::InteriorElement(Kind::Pattern)) => {
|
||||
match b.ty.sty {
|
||||
match b.ty.kind {
|
||||
ty::Adt(def, _) => {
|
||||
if def.has_dtor(bccx.tcx) {
|
||||
Some(cmt.clone())
|
||||
|
@ -89,7 +89,7 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
|
||||
let base_ty = cmt_base.ty;
|
||||
let result = self.restrict(&cmt_base);
|
||||
// Borrowing one union field automatically borrows all its fields.
|
||||
match base_ty.sty {
|
||||
match base_ty.kind {
|
||||
ty::Adt(adt_def, _) if adt_def.is_union() => match result {
|
||||
RestrictionResult::Safe => RestrictionResult::Safe,
|
||||
RestrictionResult::SafeIf(base_lp, mut base_vec) => {
|
||||
|
@ -309,7 +309,7 @@ impl MoveData<'tcx> {
|
||||
let mut lp = orig_lp.clone();
|
||||
while let LpExtend(ref base_lp, mutbl, lp_elem) = lp.clone().kind {
|
||||
if let (&ty::Adt(adt_def, _), LpInterior(opt_variant_id, interior))
|
||||
= (&base_lp.ty.sty, lp_elem) {
|
||||
= (&base_lp.ty.kind, lp_elem) {
|
||||
if adt_def.is_union() {
|
||||
for (i, field) in adt_def.non_enum_variant().fields.iter().enumerate() {
|
||||
let field =
|
||||
@ -361,7 +361,7 @@ impl MoveData<'tcx> {
|
||||
) {
|
||||
// Assigning to one union field automatically assigns to all its fields.
|
||||
if let LpExtend(ref base_lp, mutbl, LpInterior(opt_variant_id, interior)) = lp.kind {
|
||||
if let ty::Adt(adt_def, _) = base_lp.ty.sty {
|
||||
if let ty::Adt(adt_def, _) = base_lp.ty.kind {
|
||||
if adt_def.is_union() {
|
||||
for (i, field) in adt_def.non_enum_variant().fields.iter().enumerate() {
|
||||
let field =
|
||||
|
@ -324,7 +324,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
||||
use syntax::ast::UintTy::*;
|
||||
use rustc::ty::{Int, Uint};
|
||||
|
||||
let new_sty = match ty.sty {
|
||||
let new_sty = match ty.kind {
|
||||
Int(Isize) => Int(self.tcx.sess.target.isize_ty),
|
||||
Uint(Usize) => Uint(self.tcx.sess.target.usize_ty),
|
||||
ref t @ Uint(_) | ref t @ Int(_) => t.clone(),
|
||||
|
@ -134,7 +134,7 @@ fn check_and_apply_linkage(
|
||||
// extern "C" fn() from being non-null, so we can't just declare a
|
||||
// static and call it a day. Some linkages (like weak) will make it such
|
||||
// that the static actually has a null value.
|
||||
let llty2 = if let ty::RawPtr(ref mt) = ty.sty {
|
||||
let llty2 = if let ty::RawPtr(ref mt) = ty.kind {
|
||||
cx.layout_of(mt.ty).llvm_type(cx)
|
||||
} else {
|
||||
cx.sess().span_fatal(
|
||||
|
@ -340,7 +340,7 @@ fn fixed_vec_metadata(
|
||||
|
||||
let (size, align) = cx.size_and_align_of(array_or_slice_type);
|
||||
|
||||
let upper_bound = match array_or_slice_type.sty {
|
||||
let upper_bound = match array_or_slice_type.kind {
|
||||
ty::Array(_, len) => len.eval_usize(cx.tcx, ty::ParamEnv::reveal_all()) as c_longlong,
|
||||
_ => -1
|
||||
};
|
||||
@ -427,7 +427,7 @@ fn subroutine_type_metadata(
|
||||
|
||||
let signature_metadata: Vec<_> = iter::once(
|
||||
// return type
|
||||
match signature.output().sty {
|
||||
match signature.output().kind {
|
||||
ty::Tuple(ref tys) if tys.is_empty() => None,
|
||||
_ => Some(type_metadata(cx, signature.output(), span))
|
||||
}
|
||||
@ -466,7 +466,7 @@ fn trait_pointer_metadata(
|
||||
// type is assigned the correct name, size, namespace, and source location.
|
||||
// However, it does not describe the trait's methods.
|
||||
|
||||
let containing_scope = match trait_type.sty {
|
||||
let containing_scope = match trait_type.kind {
|
||||
ty::Dynamic(ref data, ..) =>
|
||||
data.principal_def_id().map(|did| get_namespace_for_item(cx, did)),
|
||||
_ => {
|
||||
@ -563,7 +563,7 @@ pub fn type_metadata(
|
||||
debug!("type_metadata: {:?}", t);
|
||||
|
||||
let ptr_metadata = |ty: Ty<'tcx>| {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Slice(typ) => {
|
||||
Ok(vec_slice_metadata(cx, t, typ, unique_type_id, usage_site_span))
|
||||
}
|
||||
@ -591,7 +591,7 @@ pub fn type_metadata(
|
||||
}
|
||||
};
|
||||
|
||||
let MetadataCreationResult { metadata, already_stored_in_typemap } = match t.sty {
|
||||
let MetadataCreationResult { metadata, already_stored_in_typemap } = match t.kind {
|
||||
ty::Never |
|
||||
ty::Bool |
|
||||
ty::Char |
|
||||
@ -835,7 +835,7 @@ fn file_metadata_raw(cx: &CodegenCx<'ll, '_>,
|
||||
fn basic_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
|
||||
debug!("basic_type_metadata: {:?}", t);
|
||||
|
||||
let (name, encoding) = match t.sty {
|
||||
let (name, encoding) = match t.kind {
|
||||
ty::Never => ("!", DW_ATE_unsigned),
|
||||
ty::Tuple(ref elements) if elements.is_empty() =>
|
||||
("()", DW_ATE_unsigned),
|
||||
@ -1145,7 +1145,7 @@ fn prepare_struct_metadata(
|
||||
) -> RecursiveTypeDescription<'ll, 'tcx> {
|
||||
let struct_name = compute_debuginfo_type_name(cx.tcx, struct_type, false);
|
||||
|
||||
let (struct_def_id, variant) = match struct_type.sty {
|
||||
let (struct_def_id, variant) = match struct_type.kind {
|
||||
ty::Adt(def, _) => (def.did, def.non_enum_variant()),
|
||||
_ => bug!("prepare_struct_metadata on a non-ADT")
|
||||
};
|
||||
@ -1268,7 +1268,7 @@ fn prepare_union_metadata(
|
||||
) -> RecursiveTypeDescription<'ll, 'tcx> {
|
||||
let union_name = compute_debuginfo_type_name(cx.tcx, union_type, false);
|
||||
|
||||
let (union_def_id, variant) = match union_type.sty {
|
||||
let (union_def_id, variant) = match union_type.kind {
|
||||
ty::Adt(def, _) => (def.did, def.non_enum_variant()),
|
||||
_ => bug!("prepare_union_metadata on a non-ADT")
|
||||
};
|
||||
@ -1334,7 +1334,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
|
||||
fn create_member_descriptions(&self, cx: &CodegenCx<'ll, 'tcx>)
|
||||
-> Vec<MemberDescription<'ll>> {
|
||||
let variant_info_for = |index: VariantIdx| {
|
||||
match &self.enum_type.sty {
|
||||
match &self.enum_type.kind {
|
||||
ty::Adt(adt, _) => VariantInfo::Adt(&adt.variants[index]),
|
||||
ty::Generator(def_id, substs, _) => {
|
||||
let generator_layout = cx.tcx.generator_layout(*def_id);
|
||||
@ -1354,7 +1354,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
|
||||
|
||||
match self.layout.variants {
|
||||
layout::Variants::Single { index } => {
|
||||
if let ty::Adt(adt, _) = &self.enum_type.sty {
|
||||
if let ty::Adt(adt, _) = &self.enum_type.kind {
|
||||
if adt.variants.is_empty() {
|
||||
return vec![];
|
||||
}
|
||||
@ -1747,7 +1747,7 @@ fn prepare_enum_metadata(
|
||||
let file_metadata = unknown_file_metadata(cx);
|
||||
|
||||
let discriminant_type_metadata = |discr: layout::Primitive| {
|
||||
let enumerators_metadata: Vec<_> = match enum_type.sty {
|
||||
let enumerators_metadata: Vec<_> = match enum_type.kind {
|
||||
ty::Adt(def, _) => def
|
||||
.discriminants(cx.tcx)
|
||||
.zip(&def.variants)
|
||||
@ -1790,7 +1790,7 @@ fn prepare_enum_metadata(
|
||||
let discriminant_base_type_metadata =
|
||||
type_metadata(cx, discr.to_ty(cx.tcx), syntax_pos::DUMMY_SP);
|
||||
|
||||
let discriminant_name = match enum_type.sty {
|
||||
let discriminant_name = match enum_type.kind {
|
||||
ty::Adt(..) => SmallCStr::new(&cx.tcx.item_name(enum_def_id).as_str()),
|
||||
ty::Generator(..) => SmallCStr::new(&enum_name),
|
||||
_ => bug!(),
|
||||
@ -1881,7 +1881,7 @@ fn prepare_enum_metadata(
|
||||
);
|
||||
}
|
||||
|
||||
let discriminator_name = match &enum_type.sty {
|
||||
let discriminator_name = match &enum_type.kind {
|
||||
ty::Generator(..) => Some(SmallCStr::new(&"__state")),
|
||||
_ => None,
|
||||
};
|
||||
@ -2091,7 +2091,7 @@ fn set_members_of_composite_type(cx: &CodegenCx<'ll, 'tcx>,
|
||||
// Compute the type parameters for a type, if any, for the given
|
||||
// metadata.
|
||||
fn compute_type_parameters(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>) -> Option<&'ll DIArray> {
|
||||
if let ty::Adt(def, substs) = ty.sty {
|
||||
if let ty::Adt(def, substs) = ty.kind {
|
||||
if !substs.types().next().is_none() {
|
||||
let generics = cx.tcx.generics_of(def.did);
|
||||
let names = get_parameter_names(cx, generics);
|
||||
|
@ -377,7 +377,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
let mut signature = Vec::with_capacity(sig.inputs().len() + 1);
|
||||
|
||||
// Return type -- llvm::DIBuilder wants this at index 0
|
||||
signature.push(match sig.output().sty {
|
||||
signature.push(match sig.output().kind {
|
||||
ty::Tuple(ref tys) if tys.is_empty() => None,
|
||||
_ => Some(type_metadata(cx, sig.output(), syntax_pos::DUMMY_SP))
|
||||
});
|
||||
@ -401,7 +401,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
// This transformed type is wrong, but these function types are
|
||||
// already inaccurate due to ABI adjustments (see #42800).
|
||||
signature.extend(inputs.iter().map(|&t| {
|
||||
let t = match t.sty {
|
||||
let t = match t.kind {
|
||||
ty::Array(ct, _)
|
||||
if (ct == cx.tcx.types.u8) || cx.layout_of(ct).is_zst() => {
|
||||
cx.tcx.mk_imm_ptr(ct)
|
||||
@ -417,7 +417,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
}
|
||||
|
||||
if sig.abi == Abi::RustCall && !sig.inputs().is_empty() {
|
||||
if let ty::Tuple(args) = sig.inputs()[sig.inputs().len() - 1].sty {
|
||||
if let ty::Tuple(args) = sig.inputs()[sig.inputs().len() - 1].kind {
|
||||
signature.extend(
|
||||
args.iter().map(|argument_type| {
|
||||
Some(type_metadata(cx, argument_type.expect_ty(), syntax_pos::DUMMY_SP))
|
||||
@ -516,7 +516,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
|
||||
// Only "class" methods are generally understood by LLVM,
|
||||
// so avoid methods on other types (e.g., `<*mut T>::null`).
|
||||
match impl_self_ty.sty {
|
||||
match impl_self_ty.kind {
|
||||
ty::Adt(def, ..) if !def.is_box() => {
|
||||
Some(type_metadata(cx, impl_self_ty, syntax_pos::DUMMY_SP))
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
|
||||
let tcx = self.tcx;
|
||||
let callee_ty = instance.ty(tcx);
|
||||
|
||||
let (def_id, substs) = match callee_ty.sty {
|
||||
let (def_id, substs) = match callee_ty.kind {
|
||||
ty::FnDef(def_id, substs) => (def_id, substs),
|
||||
_ => bug!("expected fn item type, found {}", callee_ty)
|
||||
};
|
||||
@ -1074,7 +1074,7 @@ fn generic_simd_intrinsic(
|
||||
|
||||
if name == "simd_select_bitmask" {
|
||||
let in_ty = arg_tys[0];
|
||||
let m_len = match in_ty.sty {
|
||||
let m_len = match in_ty.kind {
|
||||
// Note that this `.unwrap()` crashes for isize/usize, that's sort
|
||||
// of intentional as there's not currently a use case for that.
|
||||
ty::Int(i) => i.bit_width().unwrap(),
|
||||
@ -1203,7 +1203,7 @@ fn generic_simd_intrinsic(
|
||||
"mismatched lengths: mask length `{}` != other vector length `{}`",
|
||||
m_len, v_len
|
||||
);
|
||||
match m_elem_ty.sty {
|
||||
match m_elem_ty.kind {
|
||||
ty::Int(_) => {},
|
||||
_ => return_error!("mask element type is `{}`, expected `i_`", m_elem_ty)
|
||||
}
|
||||
@ -1223,7 +1223,7 @@ fn generic_simd_intrinsic(
|
||||
// If the vector has less than 8 lanes, an u8 is returned with zeroed
|
||||
// trailing bits.
|
||||
let expected_int_bits = in_len.max(8);
|
||||
match ret_ty.sty {
|
||||
match ret_ty.kind {
|
||||
ty::Uint(i) if i.bit_width() == Some(expected_int_bits) => (),
|
||||
_ => return_error!(
|
||||
"bitmask `{}`, expected `u{}`",
|
||||
@ -1232,7 +1232,7 @@ fn generic_simd_intrinsic(
|
||||
}
|
||||
|
||||
// Integer vector <i{in_bitwidth} x in_len>:
|
||||
let (i_xn, in_elem_bitwidth) = match in_elem.sty {
|
||||
let (i_xn, in_elem_bitwidth) = match in_elem.kind {
|
||||
ty::Int(i) => (
|
||||
args[0].immediate(),
|
||||
i.bit_width().unwrap_or(bx.data_layout().pointer_size.bits() as _)
|
||||
@ -1288,7 +1288,7 @@ fn generic_simd_intrinsic(
|
||||
}
|
||||
}
|
||||
}
|
||||
let ety = match in_elem.sty {
|
||||
let ety = match in_elem.kind {
|
||||
ty::Float(f) if f.bit_width() == 32 => {
|
||||
if in_len < 2 || in_len > 16 {
|
||||
return_error!(
|
||||
@ -1375,7 +1375,7 @@ fn generic_simd_intrinsic(
|
||||
// https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Intrinsics.h#L81
|
||||
fn llvm_vector_str(elem_ty: Ty<'_>, vec_len: usize, no_pointers: usize) -> String {
|
||||
let p0s: String = "p0".repeat(no_pointers);
|
||||
match elem_ty.sty {
|
||||
match elem_ty.kind {
|
||||
ty::Int(v) => format!("v{}{}i{}", vec_len, p0s, v.bit_width().unwrap()),
|
||||
ty::Uint(v) => format!("v{}{}i{}", vec_len, p0s, v.bit_width().unwrap()),
|
||||
ty::Float(v) => format!("v{}{}f{}", vec_len, p0s, v.bit_width()),
|
||||
@ -1386,7 +1386,7 @@ fn generic_simd_intrinsic(
|
||||
fn llvm_vector_ty(cx: &CodegenCx<'ll, '_>, elem_ty: Ty<'_>, vec_len: usize,
|
||||
mut no_pointers: usize) -> &'ll Type {
|
||||
// FIXME: use cx.layout_of(ty).llvm_type() ?
|
||||
let mut elem_ty = match elem_ty.sty {
|
||||
let mut elem_ty = match elem_ty.kind {
|
||||
ty::Int(v) => cx.type_int_from_ty( v),
|
||||
ty::Uint(v) => cx.type_uint_from_ty( v),
|
||||
ty::Float(v) => cx.type_float_from_ty( v),
|
||||
@ -1430,7 +1430,7 @@ fn generic_simd_intrinsic(
|
||||
|
||||
// This counts how many pointers
|
||||
fn ptr_count(t: Ty<'_>) -> usize {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::RawPtr(p) => 1 + ptr_count(p.ty),
|
||||
_ => 0,
|
||||
}
|
||||
@ -1438,7 +1438,7 @@ fn generic_simd_intrinsic(
|
||||
|
||||
// Non-ptr type
|
||||
fn non_ptr(t: Ty<'_>) -> Ty<'_> {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::RawPtr(p) => non_ptr(p.ty),
|
||||
_ => t,
|
||||
}
|
||||
@ -1446,7 +1446,7 @@ fn generic_simd_intrinsic(
|
||||
|
||||
// The second argument must be a simd vector with an element type that's a pointer
|
||||
// to the element type of the first argument
|
||||
let (pointer_count, underlying_ty) = match arg_tys[1].simd_type(tcx).sty {
|
||||
let (pointer_count, underlying_ty) = match arg_tys[1].simd_type(tcx).kind {
|
||||
ty::RawPtr(p) if p.ty == in_elem => (ptr_count(arg_tys[1].simd_type(tcx)),
|
||||
non_ptr(arg_tys[1].simd_type(tcx))),
|
||||
_ => {
|
||||
@ -1463,7 +1463,7 @@ fn generic_simd_intrinsic(
|
||||
assert_eq!(underlying_ty, non_ptr(arg_tys[0].simd_type(tcx)));
|
||||
|
||||
// The element type of the third argument must be a signed integer type of any width:
|
||||
match arg_tys[2].simd_type(tcx).sty {
|
||||
match arg_tys[2].simd_type(tcx).kind {
|
||||
ty::Int(_) => (),
|
||||
_ => {
|
||||
require!(false, "expected element type `{}` of third argument `{}` \
|
||||
@ -1529,7 +1529,7 @@ fn generic_simd_intrinsic(
|
||||
|
||||
// This counts how many pointers
|
||||
fn ptr_count(t: Ty<'_>) -> usize {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::RawPtr(p) => 1 + ptr_count(p.ty),
|
||||
_ => 0,
|
||||
}
|
||||
@ -1537,7 +1537,7 @@ fn generic_simd_intrinsic(
|
||||
|
||||
// Non-ptr type
|
||||
fn non_ptr(t: Ty<'_>) -> Ty<'_> {
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::RawPtr(p) => non_ptr(p.ty),
|
||||
_ => t,
|
||||
}
|
||||
@ -1545,7 +1545,7 @@ fn generic_simd_intrinsic(
|
||||
|
||||
// The second argument must be a simd vector with an element type that's a pointer
|
||||
// to the element type of the first argument
|
||||
let (pointer_count, underlying_ty) = match arg_tys[1].simd_type(tcx).sty {
|
||||
let (pointer_count, underlying_ty) = match arg_tys[1].simd_type(tcx).kind {
|
||||
ty::RawPtr(p) if p.ty == in_elem && p.mutbl == hir::MutMutable
|
||||
=> (ptr_count(arg_tys[1].simd_type(tcx)),
|
||||
non_ptr(arg_tys[1].simd_type(tcx))),
|
||||
@ -1563,7 +1563,7 @@ fn generic_simd_intrinsic(
|
||||
assert_eq!(underlying_ty, non_ptr(arg_tys[0].simd_type(tcx)));
|
||||
|
||||
// The element type of the third argument must be a signed integer type of any width:
|
||||
match arg_tys[2].simd_type(tcx).sty {
|
||||
match arg_tys[2].simd_type(tcx).kind {
|
||||
ty::Int(_) => (),
|
||||
_ => {
|
||||
require!(false, "expected element type `{}` of third argument `{}` \
|
||||
@ -1612,7 +1612,7 @@ fn generic_simd_intrinsic(
|
||||
require!(ret_ty == in_elem,
|
||||
"expected return type `{}` (element of input `{}`), found `{}`",
|
||||
in_elem, in_ty, ret_ty);
|
||||
return match in_elem.sty {
|
||||
return match in_elem.kind {
|
||||
ty::Int(_) | ty::Uint(_) => {
|
||||
let r = bx.$integer_reduce(args[0].immediate());
|
||||
if $ordered {
|
||||
@ -1669,7 +1669,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
|
||||
require!(ret_ty == in_elem,
|
||||
"expected return type `{}` (element of input `{}`), found `{}`",
|
||||
in_elem, in_ty, ret_ty);
|
||||
return match in_elem.sty {
|
||||
return match in_elem.kind {
|
||||
ty::Int(_i) => {
|
||||
Ok(bx.$int_red(args[0].immediate(), true))
|
||||
},
|
||||
@ -1704,7 +1704,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
|
||||
in_elem, in_ty, ret_ty);
|
||||
args[0].immediate()
|
||||
} else {
|
||||
match in_elem.sty {
|
||||
match in_elem.kind {
|
||||
ty::Int(_) | ty::Uint(_) => {},
|
||||
_ => {
|
||||
return_error!("unsupported {} from `{}` with element `{}` to `{}`",
|
||||
@ -1717,7 +1717,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
|
||||
let i1xn = bx.type_vector(i1, in_len as u64);
|
||||
bx.trunc(args[0].immediate(), i1xn)
|
||||
};
|
||||
return match in_elem.sty {
|
||||
return match in_elem.kind {
|
||||
ty::Int(_) | ty::Uint(_) => {
|
||||
let r = bx.$red(input);
|
||||
Ok(
|
||||
@ -1758,7 +1758,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
|
||||
|
||||
enum Style { Float, Int(/* is signed? */ bool), Unsupported }
|
||||
|
||||
let (in_style, in_width) = match in_elem.sty {
|
||||
let (in_style, in_width) = match in_elem.kind {
|
||||
// vectors of pointer-sized integers should've been
|
||||
// disallowed before here, so this unwrap is safe.
|
||||
ty::Int(i) => (Style::Int(true), i.bit_width().unwrap()),
|
||||
@ -1766,7 +1766,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
|
||||
ty::Float(f) => (Style::Float, f.bit_width()),
|
||||
_ => (Style::Unsupported, 0)
|
||||
};
|
||||
let (out_style, out_width) = match out_elem.sty {
|
||||
let (out_style, out_width) = match out_elem.kind {
|
||||
ty::Int(i) => (Style::Int(true), i.bit_width().unwrap()),
|
||||
ty::Uint(u) => (Style::Int(false), u.bit_width().unwrap()),
|
||||
ty::Float(f) => (Style::Float, f.bit_width()),
|
||||
@ -1816,7 +1816,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
|
||||
macro_rules! arith {
|
||||
($($name: ident: $($($p: ident),* => $call: ident),*;)*) => {
|
||||
$(if name == stringify!($name) {
|
||||
match in_elem.sty {
|
||||
match in_elem.kind {
|
||||
$($(ty::$p(_))|* => {
|
||||
return Ok(bx.$call(args[0].immediate(), args[1].immediate()))
|
||||
})*
|
||||
@ -1850,7 +1850,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
|
||||
let rhs = args[1].immediate();
|
||||
let is_add = name == "simd_saturating_add";
|
||||
let ptr_bits = bx.tcx().data_layout.pointer_size.bits() as _;
|
||||
let (signed, elem_width, elem_ty) = match in_elem.sty {
|
||||
let (signed, elem_width, elem_ty) = match in_elem.kind {
|
||||
ty::Int(i) =>
|
||||
(
|
||||
true,
|
||||
@ -1896,7 +1896,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
|
||||
// FIXME: there’s multiple of this functions, investigate using some of the already existing
|
||||
// stuffs.
|
||||
fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, bool)> {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Int(t) => Some((match t {
|
||||
ast::IntTy::Isize => cx.tcx.sess.target.isize_ty.bit_width().unwrap() as u64,
|
||||
ast::IntTy::I8 => 8,
|
||||
@ -1920,7 +1920,7 @@ fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, boo
|
||||
// Returns the width of a float Ty
|
||||
// Returns None if the type is not a float
|
||||
fn float_type_width(ty: Ty<'_>) -> Option<u64> {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Float(t) => Some(t.bit_width() as u64),
|
||||
_ => None,
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ fn uncached_llvm_type<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
|
||||
layout::Abi::Aggregate { .. } => {}
|
||||
}
|
||||
|
||||
let name = match layout.ty.sty {
|
||||
let name = match layout.ty.kind {
|
||||
ty::Closure(..) |
|
||||
ty::Generator(..) |
|
||||
ty::Adt(..) |
|
||||
@ -56,14 +56,14 @@ fn uncached_llvm_type<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
|
||||
let printer = DefPathBasedNames::new(cx.tcx, true, true);
|
||||
printer.push_type_name(layout.ty, &mut name, false);
|
||||
if let (&ty::Adt(def, _), &layout::Variants::Single { index })
|
||||
= (&layout.ty.sty, &layout.variants)
|
||||
= (&layout.ty.kind, &layout.variants)
|
||||
{
|
||||
if def.is_enum() && !def.variants.is_empty() {
|
||||
write!(&mut name, "::{}", def.variants[index].ident).unwrap();
|
||||
}
|
||||
}
|
||||
if let (&ty::Generator(_, substs, _), &layout::Variants::Single { index })
|
||||
= (&layout.ty.sty, &layout.variants)
|
||||
= (&layout.ty.kind, &layout.variants)
|
||||
{
|
||||
write!(&mut name, "::{}", substs.variant_name(index)).unwrap();
|
||||
}
|
||||
@ -226,7 +226,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> {
|
||||
if let Some(&llty) = cx.scalar_lltypes.borrow().get(&self.ty) {
|
||||
return llty;
|
||||
}
|
||||
let llty = match self.ty.sty {
|
||||
let llty = match self.ty.kind {
|
||||
ty::Ref(_, ty, _) |
|
||||
ty::RawPtr(ty::TypeAndMut { ty, .. }) => {
|
||||
cx.type_ptr_to(cx.layout_of(ty).llvm_type(cx))
|
||||
@ -318,7 +318,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> {
|
||||
index: usize, immediate: bool) -> &'a Type {
|
||||
// HACK(eddyb) special-case fat pointers until LLVM removes
|
||||
// pointee types, to avoid bitcasting every `OperandRef::deref`.
|
||||
match self.ty.sty {
|
||||
match self.ty.kind {
|
||||
ty::Ref(..) |
|
||||
ty::RawPtr(_) => {
|
||||
return self.field(cx, index).llvm_type(cx);
|
||||
|
@ -96,7 +96,7 @@ pub fn compare_simd_types<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
ret_ty: Bx::Type,
|
||||
op: hir::BinOpKind,
|
||||
) -> Bx::Value {
|
||||
let signed = match t.sty {
|
||||
let signed = match t.kind {
|
||||
ty::Float(_) => {
|
||||
let cmp = bin_op_to_fcmp_predicate(op);
|
||||
let cmp = bx.fcmp(cmp, lhs, rhs);
|
||||
@ -130,7 +130,7 @@ pub fn unsized_info<'tcx, Cx: CodegenMethods<'tcx>>(
|
||||
) -> Cx::Value {
|
||||
let (source, target) =
|
||||
cx.tcx().struct_lockstep_tails_erasing_lifetimes(source, target, cx.param_env());
|
||||
match (&source.sty, &target.sty) {
|
||||
match (&source.kind, &target.kind) {
|
||||
(&ty::Array(_, len), &ty::Slice(_)) => {
|
||||
cx.const_usize(len.eval_usize(cx.tcx(), ty::ParamEnv::reveal_all()))
|
||||
}
|
||||
@ -160,7 +160,7 @@ pub fn unsize_thin_ptr<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
dst_ty: Ty<'tcx>,
|
||||
) -> (Bx::Value, Bx::Value) {
|
||||
debug!("unsize_thin_ptr: {:?} => {:?}", src_ty, dst_ty);
|
||||
match (&src_ty.sty, &dst_ty.sty) {
|
||||
match (&src_ty.kind, &dst_ty.kind) {
|
||||
(&ty::Ref(_, a, _),
|
||||
&ty::Ref(_, b, _)) |
|
||||
(&ty::Ref(_, a, _),
|
||||
@ -232,7 +232,7 @@ pub fn coerce_unsized_into<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
};
|
||||
OperandValue::Pair(base, info).store(bx, dst);
|
||||
};
|
||||
match (&src_ty.sty, &dst_ty.sty) {
|
||||
match (&src_ty.kind, &dst_ty.kind) {
|
||||
(&ty::Ref(..), &ty::Ref(..)) |
|
||||
(&ty::Ref(..), &ty::RawPtr(..)) |
|
||||
(&ty::RawPtr(..), &ty::RawPtr(..)) => {
|
||||
|
@ -32,7 +32,7 @@ pub fn push_debuginfo_type_name<'tcx>(
|
||||
// .natvis visualizers (and perhaps other existing native debuggers?)
|
||||
let cpp_like_names = tcx.sess.target.target.options.is_like_msvc;
|
||||
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Bool => output.push_str("bool"),
|
||||
ty::Char => output.push_str("char"),
|
||||
ty::Str => output.push_str("str"),
|
||||
|
@ -20,7 +20,7 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
let align = bx.const_usize(layout.align.abi.bytes());
|
||||
return (size, align);
|
||||
}
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Dynamic(..) => {
|
||||
// load size/align from vtable
|
||||
let vtable = info.unwrap();
|
||||
@ -64,7 +64,7 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
let size = bx.add(sized_size, unsized_size);
|
||||
|
||||
// Packed types ignore the alignment of their fields.
|
||||
if let ty::Adt(def, _) = t.sty {
|
||||
if let ty::Adt(def, _) = t.kind {
|
||||
if def.repr.packed() {
|
||||
unsized_align = sized_align;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
|
||||
mir::TerminatorKind::Call {
|
||||
func: mir::Operand::Constant(ref c),
|
||||
ref args, ..
|
||||
} => match c.literal.ty.sty {
|
||||
} => match c.literal.ty.kind {
|
||||
ty::FnDef(did, _) => Some((did, args)),
|
||||
_ => None,
|
||||
},
|
||||
|
@ -323,7 +323,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
args1 = [place.llval];
|
||||
&args1[..]
|
||||
};
|
||||
let (drop_fn, fn_ty) = match ty.sty {
|
||||
let (drop_fn, fn_ty) = match ty.kind {
|
||||
ty::Dynamic(..) => {
|
||||
let sig = drop_fn.fn_sig(self.cx.tcx());
|
||||
let sig = self.cx.tcx().normalize_erasing_late_bound_regions(
|
||||
@ -455,7 +455,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
// Create the callee. This is a fn ptr or zero-sized and hence a kind of scalar.
|
||||
let callee = self.codegen_operand(&mut bx, func);
|
||||
|
||||
let (instance, mut llfn) = match callee.layout.ty.sty {
|
||||
let (instance, mut llfn) = match callee.layout.ty.kind {
|
||||
ty::FnDef(def_id, substs) => {
|
||||
(Some(ty::Instance::resolve(bx.tcx(),
|
||||
ty::ParamEnv::reveal_all(),
|
||||
|
@ -40,7 +40,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
constant
|
||||
.map(|c| {
|
||||
let field_ty = c.ty.builtin_index().unwrap();
|
||||
let fields = match c.ty.sty {
|
||||
let fields = match c.ty.kind {
|
||||
ty::Array(_, n) => n.eval_usize(bx.tcx(), ty::ParamEnv::reveal_all()),
|
||||
_ => bug!("invalid simd shuffle type: {}", c.ty),
|
||||
};
|
||||
|
@ -467,7 +467,7 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
// individual LLVM function arguments.
|
||||
|
||||
let arg_ty = fx.monomorphize(&arg_decl.ty);
|
||||
let tupled_arg_tys = match arg_ty.sty {
|
||||
let tupled_arg_tys = match arg_ty.kind {
|
||||
ty::Tuple(ref tys) => tys,
|
||||
_ => bug!("spread argument isn't a tuple?!")
|
||||
};
|
||||
@ -573,7 +573,7 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
Some(did) => did,
|
||||
None => bug!("`va_list` lang item required for C-variadic functions"),
|
||||
};
|
||||
match arg_decl.ty.sty {
|
||||
match arg_decl.ty.kind {
|
||||
ty::Adt(def, _) if def.did == va_list_did => {
|
||||
// Call `va_start` on the spoofed `VaListImpl`.
|
||||
bx.va_start(tmp.llval);
|
||||
@ -612,11 +612,11 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
|
||||
let pin_did = tcx.lang_items().pin_type();
|
||||
// Or is it the closure environment?
|
||||
let (closure_layout, env_ref) = match arg.layout.ty.sty {
|
||||
let (closure_layout, env_ref) = match arg.layout.ty.kind {
|
||||
ty::RawPtr(ty::TypeAndMut { ty, .. }) |
|
||||
ty::Ref(_, ty, _) => (bx.layout_of(ty), true),
|
||||
ty::Adt(def, substs) if Some(def.did) == pin_did => {
|
||||
match substs.type_at(0).sty {
|
||||
match substs.type_at(0).kind {
|
||||
ty::Ref(_, ty, _) => (bx.layout_of(ty), true),
|
||||
_ => (arg.layout, false),
|
||||
}
|
||||
@ -624,7 +624,7 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
_ => (arg.layout, false)
|
||||
};
|
||||
|
||||
let (def_id, upvar_substs) = match closure_layout.ty.sty {
|
||||
let (def_id, upvar_substs) = match closure_layout.ty.kind {
|
||||
ty::Closure(def_id, substs) => (def_id, UpvarSubsts::Closure(substs)),
|
||||
ty::Generator(def_id, substs, _) => (def_id, UpvarSubsts::Generator(substs)),
|
||||
_ => bug!("upvar debuginfo with non-closure arg0 type `{}`", closure_layout.ty)
|
||||
@ -641,7 +641,7 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
});
|
||||
|
||||
let generator_fields = mir.generator_layout.as_ref().map(|generator_layout| {
|
||||
let (def_id, gen_substs) = match closure_layout.ty.sty {
|
||||
let (def_id, gen_substs) = match closure_layout.ty.kind {
|
||||
ty::Generator(def_id, substs, _) => (def_id, substs),
|
||||
_ => bug!("generator layout without generator substs"),
|
||||
};
|
||||
@ -695,7 +695,7 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
// The environment and the capture can each be indirect.
|
||||
let mut ops = if env_ref { &ops[..] } else { &ops[1..] };
|
||||
|
||||
let ty = if let (true, &ty::Ref(_, ty, _)) = (by_ref, &ty.sty) {
|
||||
let ty = if let (true, &ty::Ref(_, ty, _)) = (by_ref, &ty.kind) {
|
||||
ty
|
||||
} else {
|
||||
ops = &ops[..ops.len() - 1];
|
||||
|
@ -144,7 +144,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
|
||||
// * no metadata available - just log the case
|
||||
// * known alignment - sized types, `[T]`, `str` or a foreign type
|
||||
// * packed struct - there is no alignment padding
|
||||
match field.ty.sty {
|
||||
match field.ty.kind {
|
||||
_ if self.llextra.is_none() => {
|
||||
debug!("unsized field `{}`, of `{:?}` has no metadata for adjustment",
|
||||
ix, self.llval);
|
||||
|
@ -184,7 +184,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
|
||||
let val = match *kind {
|
||||
mir::CastKind::Pointer(PointerCast::ReifyFnPointer) => {
|
||||
match operand.layout.ty.sty {
|
||||
match operand.layout.ty.kind {
|
||||
ty::FnDef(def_id, substs) => {
|
||||
if bx.cx().tcx().has_attr(def_id, sym::rustc_args_required_const) {
|
||||
bug!("reifying a fn ptr that requires const arguments");
|
||||
@ -198,7 +198,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
}
|
||||
}
|
||||
mir::CastKind::Pointer(PointerCast::ClosureFnPointer(_)) => {
|
||||
match operand.layout.ty.sty {
|
||||
match operand.layout.ty.kind {
|
||||
ty::Closure(def_id, substs) => {
|
||||
let instance = Instance::resolve_closure(
|
||||
bx.cx().tcx(), def_id, substs, ty::ClosureKind::FnOnce);
|
||||
@ -525,7 +525,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
projection: box [],
|
||||
} = *place {
|
||||
if let LocalRef::Operand(Some(op)) = self.locals[index] {
|
||||
if let ty::Array(_, n) = op.layout.ty.sty {
|
||||
if let ty::Array(_, n) = op.layout.ty.kind {
|
||||
let n = n.eval_usize(bx.cx().tcx(), ty::ParamEnv::reveal_all());
|
||||
return bx.cx().const_usize(n);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ pub trait DerivedTypeMethods<'tcx>: BaseTypeMethods<'tcx> + MiscMethods<'tcx> {
|
||||
}
|
||||
|
||||
let tail = self.tcx().struct_tail_erasing_lifetimes(ty, param_env);
|
||||
match tail.sty {
|
||||
match tail.kind {
|
||||
ty::Foreign(..) => false,
|
||||
ty::Str | ty::Slice(..) | ty::Dynamic(..) => true,
|
||||
_ => bug!("unexpected unsized tail: {:?}", tail),
|
||||
|
@ -111,7 +111,7 @@ fn get_symbol_hash<'tcx>(
|
||||
// If this is a function, we hash the signature as well.
|
||||
// This is not *strictly* needed, but it may help in some
|
||||
// situations, see the `run-make/a-b-a-linker-guard` test.
|
||||
if let ty::FnDef(..) = item_type.sty {
|
||||
if let ty::FnDef(..) = item_type.kind {
|
||||
item_type.fn_sig(tcx).hash_stable(&mut hcx, &mut hasher);
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ impl Printer<'tcx> for SymbolPrinter<'tcx> {
|
||||
self,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Result<Self::Type, Self::Error> {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
// Print all nominal types as paths (unlike `pretty_print_type`).
|
||||
ty::FnDef(def_id, substs) |
|
||||
ty::Opaque(def_id, substs) |
|
||||
@ -275,7 +275,7 @@ impl Printer<'tcx> for SymbolPrinter<'tcx> {
|
||||
) -> Result<Self::Path, Self::Error> {
|
||||
// Similar to `pretty_path_qualified`, but for the other
|
||||
// types that are printed as paths (see `print_type` above).
|
||||
match self_ty.sty {
|
||||
match self_ty.kind {
|
||||
ty::FnDef(..) |
|
||||
ty::Opaque(..) |
|
||||
ty::Projection(_) |
|
||||
|
@ -323,7 +323,7 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
|
||||
ty: Ty<'tcx>,
|
||||
) -> Result<Self::Type, Self::Error> {
|
||||
// Basic types, never cached (single-character).
|
||||
let basic_type = match ty.sty {
|
||||
let basic_type = match ty.kind {
|
||||
ty::Bool => "b",
|
||||
ty::Char => "c",
|
||||
ty::Str => "e",
|
||||
@ -360,7 +360,7 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
|
||||
}
|
||||
let start = self.out.len();
|
||||
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
// Basic types, handled above.
|
||||
ty::Bool | ty::Char | ty::Str |
|
||||
ty::Int(_) | ty::Uint(_) | ty::Float(_) |
|
||||
@ -511,7 +511,7 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
|
||||
}
|
||||
let start = self.out.len();
|
||||
|
||||
match ct.ty.sty {
|
||||
match ct.ty.kind {
|
||||
ty::Uint(_) => {}
|
||||
_ => {
|
||||
bug!("symbol_names: unsupported constant of type `{}` ({:?})",
|
||||
|
@ -918,7 +918,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes {
|
||||
|
||||
let msg = "mutating transmuted &mut T from &T may cause undefined behavior, \
|
||||
consider instead using an UnsafeCell";
|
||||
match get_transmute_from_to(cx, expr).map(|(ty1, ty2)| (&ty1.sty, &ty2.sty)) {
|
||||
match get_transmute_from_to(cx, expr).map(|(ty1, ty2)| (&ty1.kind, &ty2.kind)) {
|
||||
Some((&ty::Ref(_, _, from_mt), &ty::Ref(_, _, to_mt))) => {
|
||||
if to_mt == hir::Mutability::MutMutable &&
|
||||
from_mt == hir::Mutability::MutImmutable {
|
||||
@ -1954,7 +1954,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue {
|
||||
init: InitKind,
|
||||
) -> Option<InitError> {
|
||||
use rustc::ty::TyKind::*;
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
// Primitive types that don't like 0 as a value.
|
||||
Ref(..) => Some((format!("References must be non-null"), None)),
|
||||
Adt(..) if ty.is_box() => Some((format!("`Box` must be non-null"), None)),
|
||||
|
@ -227,7 +227,7 @@ fn get_type_suggestion(t: Ty<'_>, val: u128, negative: bool) -> Option<String> {
|
||||
}
|
||||
}
|
||||
}
|
||||
match t.sty {
|
||||
match t.kind {
|
||||
ty::Int(i) => find_fit!(i, val, negative,
|
||||
I8 => [U8] => [I16, I32, I64, I128],
|
||||
I16 => [U16] => [I32, I64, I128],
|
||||
@ -320,7 +320,7 @@ fn lint_uint_literal<'a, 'tcx>(
|
||||
if let Node::Expr(par_e) = cx.tcx.hir().get(parent_id) {
|
||||
match par_e.node {
|
||||
hir::ExprKind::Cast(..) => {
|
||||
if let ty::Char = cx.tables.expr_ty(par_e).sty {
|
||||
if let ty::Char = cx.tables.expr_ty(par_e).kind {
|
||||
let mut err = cx.struct_span_lint(
|
||||
OVERFLOWING_LITERALS,
|
||||
par_e.span,
|
||||
@ -364,7 +364,7 @@ fn lint_literal<'a, 'tcx>(
|
||||
e: &'tcx hir::Expr,
|
||||
lit: &hir::Lit,
|
||||
) {
|
||||
match cx.tables.node_type(e.hir_id).sty {
|
||||
match cx.tables.node_type(e.hir_id).kind {
|
||||
ty::Int(t) => {
|
||||
match lit.node {
|
||||
ast::LitKind::Int(v, ast::LitIntType::Signed(_)) |
|
||||
@ -453,7 +453,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
|
||||
// Normalize the binop so that the literal is always on the RHS in
|
||||
// the comparison
|
||||
let norm_binop = if swap { rev_binop(binop) } else { binop };
|
||||
match cx.tables.node_type(expr.hir_id).sty {
|
||||
match cx.tables.node_type(expr.hir_id).kind {
|
||||
ty::Int(int_ty) => {
|
||||
let (min, max) = int_ty_range(int_ty);
|
||||
let lit_val: i128 = match lit.node {
|
||||
@ -526,7 +526,7 @@ fn is_zst<'tcx>(tcx: TyCtxt<'tcx>, did: DefId, ty: Ty<'tcx>) -> bool {
|
||||
}
|
||||
|
||||
fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::FnPtr(_) => true,
|
||||
ty::Ref(..) => true,
|
||||
ty::Adt(field_def, substs) if field_def.repr.transparent() && !field_def.is_union() => {
|
||||
@ -615,7 +615,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
||||
return FfiSafe;
|
||||
}
|
||||
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Adt(def, substs) => {
|
||||
if def.is_phantom_data() {
|
||||
return FfiPhantom(ty);
|
||||
@ -876,7 +876,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
||||
diag.help(help);
|
||||
}
|
||||
diag.note(note);
|
||||
if let ty::Adt(def, _) = ty.sty {
|
||||
if let ty::Adt(def, _) = ty.kind {
|
||||
if let Some(sp) = self.cx.tcx.hir().span_if_local(def.did) {
|
||||
diag.span_note(sp, "type defined here");
|
||||
}
|
||||
@ -893,7 +893,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
||||
|
||||
impl<'tcx> ty::fold::TypeVisitor<'tcx> for ProhibitOpaqueTypes<'tcx> {
|
||||
fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
|
||||
if let ty::Opaque(..) = ty.sty {
|
||||
if let ty::Opaque(..) = ty.kind {
|
||||
self.ty = Some(ty);
|
||||
true
|
||||
} else {
|
||||
|
@ -145,7 +145,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
|
||||
|
||||
let plural_suffix = pluralise!(plural_len);
|
||||
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Adt(..) if ty.is_box() => {
|
||||
let boxed_ty = ty.boxed_ty();
|
||||
let descr_pre = &format!("{}boxed ", descr_pre);
|
||||
|
@ -1427,7 +1427,7 @@ impl EncodeContext<'tcx> {
|
||||
|
||||
let tables = self.tcx.typeck_tables_of(def_id);
|
||||
let hir_id = self.tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
let kind = match tables.node_type(hir_id).sty {
|
||||
let kind = match tables.node_type(hir_id).kind {
|
||||
ty::Generator(def_id, ..) => {
|
||||
let layout = self.tcx.generator_layout(def_id);
|
||||
let data = GeneratorData {
|
||||
@ -1978,7 +1978,7 @@ pub fn encode_metadata(tcx: TyCtxt<'_>) -> EncodedMetadata {
|
||||
|
||||
pub fn get_repr_options(tcx: TyCtxt<'_>, did: DefId) -> ReprOptions {
|
||||
let ty = tcx.type_of(did);
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Adt(ref def, _) => return def.repr,
|
||||
_ => bug!("{} is not an ADT", ty),
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
let ty =
|
||||
Place::ty_from(used_place.base, used_place.projection, self.body, self.infcx.tcx)
|
||||
.ty;
|
||||
let needs_note = match ty.sty {
|
||||
let needs_note = match ty.kind {
|
||||
ty::Closure(id, _) => {
|
||||
let tables = self.infcx.tcx.typeck_tables_of(id);
|
||||
let hir_id = self.infcx.tcx.hir().as_local_hir_id(id).unwrap();
|
||||
@ -232,7 +232,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
Some(ref name) => format!("`{}`", name),
|
||||
None => "value".to_owned(),
|
||||
};
|
||||
if let ty::Param(param_ty) = ty.sty {
|
||||
if let ty::Param(param_ty) = ty.kind {
|
||||
let tcx = self.infcx.tcx;
|
||||
let generics = tcx.generics_of(self.mir_def_id);
|
||||
let def_id = generics.type_param(¶m_ty, tcx).def_id;
|
||||
@ -1243,7 +1243,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
let escapes_from = if tcx.is_closure(self.mir_def_id) {
|
||||
let tables = tcx.typeck_tables_of(self.mir_def_id);
|
||||
let mir_hir_id = tcx.hir().def_index_to_hir_id(self.mir_def_id.index);
|
||||
match tables.node_type(mir_hir_id).sty {
|
||||
match tables.node_type(mir_hir_id).kind {
|
||||
ty::Closure(..) => "closure",
|
||||
ty::Generator(..) => "generator",
|
||||
_ => bug!("Closure body doesn't have a closure or generator type"),
|
||||
@ -1543,7 +1543,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
},
|
||||
ProjectionElem::Field(..) | ProjectionElem::Downcast(..) => {
|
||||
let base_ty = Place::ty_from(&place.base, proj_base, self.body, tcx).ty;
|
||||
match base_ty.sty {
|
||||
match base_ty.kind {
|
||||
ty::Adt(def, _) if def.has_dtor(tcx) => {
|
||||
// Report the outermost adt with a destructor
|
||||
match base_access {
|
||||
@ -1579,7 +1579,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
None
|
||||
} else {
|
||||
let ty = self.infcx.tcx.type_of(self.mir_def_id);
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::FnDef(_, _) | ty::FnPtr(_) => self.annotate_fn_sig(
|
||||
self.mir_def_id,
|
||||
self.infcx.tcx.fn_sig(self.mir_def_id),
|
||||
@ -1834,13 +1834,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
// 3. The return type is not a reference. In this case, we don't highlight
|
||||
// anything.
|
||||
let return_ty = sig.output();
|
||||
match return_ty.skip_binder().sty {
|
||||
match return_ty.skip_binder().kind {
|
||||
ty::Ref(return_region, _, _) if return_region.has_name() && !is_closure => {
|
||||
// This is case 1 from above, return type is a named reference so we need to
|
||||
// search for relevant arguments.
|
||||
let mut arguments = Vec::new();
|
||||
for (index, argument) in sig.inputs().skip_binder().iter().enumerate() {
|
||||
if let ty::Ref(argument_region, _, _) = argument.sty {
|
||||
if let ty::Ref(argument_region, _, _) = argument.kind {
|
||||
if argument_region == return_region {
|
||||
// Need to use the `rustc::ty` types to compare against the
|
||||
// `return_region`. Then use the `rustc::hir` type to get only
|
||||
@ -1886,9 +1886,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
|
||||
// Closure arguments are wrapped in a tuple, so we need to get the first
|
||||
// from that.
|
||||
if let ty::Tuple(elems) = argument_ty.sty {
|
||||
if let ty::Tuple(elems) = argument_ty.kind {
|
||||
let argument_ty = elems.first()?.expect_ty();
|
||||
if let ty::Ref(_, _, _) = argument_ty.sty {
|
||||
if let ty::Ref(_, _, _) = argument_ty.kind {
|
||||
return Some(AnnotatedBorrowFnSignature::Closure {
|
||||
argument_ty,
|
||||
argument_span,
|
||||
@ -1908,7 +1908,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
let return_ty = *sig.output().skip_binder();
|
||||
|
||||
// We expect the first argument to be a reference.
|
||||
match argument_ty.sty {
|
||||
match argument_ty.kind {
|
||||
ty::Ref(_, _, _) => {}
|
||||
_ => return None,
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
if let TerminatorKind::Call {
|
||||
func: Operand::Constant(box Constant {
|
||||
literal: ty::Const {
|
||||
ty: &ty::TyS { sty: ty::FnDef(id, _), .. },
|
||||
ty: &ty::TyS { kind: ty::FnDef(id, _), .. },
|
||||
..
|
||||
},
|
||||
..
|
||||
@ -76,7 +76,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
};
|
||||
|
||||
debug!("add_moved_or_invoked_closure_note: closure={:?}", closure);
|
||||
if let ty::Closure(did, _) = self.body.local_decls[closure].ty.sty {
|
||||
if let ty::Closure(did, _) = self.body.local_decls[closure].ty.kind {
|
||||
let hir_id = self.infcx.tcx.hir().as_local_hir_id(did).unwrap();
|
||||
|
||||
if let Some((span, name)) = self.infcx.tcx.typeck_tables_of(did)
|
||||
@ -99,7 +99,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
|
||||
// Check if we are just moving a closure after it has been invoked.
|
||||
if let Some(target) = target {
|
||||
if let ty::Closure(did, _) = self.body.local_decls[target].ty.sty {
|
||||
if let ty::Closure(did, _) = self.body.local_decls[target].ty.kind {
|
||||
let hir_id = self.infcx.tcx.hir().as_local_hir_id(did).unwrap();
|
||||
|
||||
if let Some((span, name)) = self.infcx.tcx.typeck_tables_of(did)
|
||||
@ -400,7 +400,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
// If the type is a box, the field is described from the boxed type
|
||||
self.describe_field_from_ty(&ty.boxed_ty(), field, variant_index)
|
||||
} else {
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Adt(def, _) => {
|
||||
let variant = if let Some(idx) = variant_index {
|
||||
assert!(def.is_enum());
|
||||
@ -558,7 +558,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
// We need to add synthesized lifetimes where appropriate. We do
|
||||
// this by hooking into the pretty printer and telling it to label the
|
||||
// lifetimes without names with the value `'0`.
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Ref(ty::RegionKind::ReLateBound(_, br), _, _)
|
||||
| ty::Ref(
|
||||
ty::RegionKind::RePlaceholder(ty::PlaceholderRegion { name: br, .. }),
|
||||
@ -578,7 +578,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
let mut s = String::new();
|
||||
let mut printer = ty::print::FmtPrinter::new(self.infcx.tcx, &mut s, Namespace::TypeNS);
|
||||
|
||||
let region = match ty.sty {
|
||||
let region = match ty.kind {
|
||||
ty::Ref(region, _, _) => {
|
||||
match region {
|
||||
ty::RegionKind::ReLateBound(_, br)
|
||||
@ -754,7 +754,7 @@ impl BorrowedContentSource<'tcx> {
|
||||
}
|
||||
|
||||
fn from_call(func: Ty<'tcx>, tcx: TyCtxt<'tcx>) -> Option<Self> {
|
||||
match func.sty {
|
||||
match func.kind {
|
||||
ty::FnDef(def_id, substs) => {
|
||||
let trait_id = tcx.trait_of_item(def_id)?;
|
||||
|
||||
|
@ -1796,7 +1796,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
// be already initialized
|
||||
let tcx = self.infcx.tcx;
|
||||
let base_ty = Place::ty_from(&place.base, proj_base, self.body, tcx).ty;
|
||||
match base_ty.sty {
|
||||
match base_ty.kind {
|
||||
ty::Adt(def, _) if def.has_dtor(tcx) => {
|
||||
self.check_if_path_or_subpath_is_moved(
|
||||
location, InitializationRequiringAction::Assignment,
|
||||
@ -1902,7 +1902,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
// of the union - we should error in that case.
|
||||
let tcx = this.infcx.tcx;
|
||||
if let ty::Adt(def, _) =
|
||||
Place::ty_from(base.base, base.projection, this.body, tcx).ty.sty
|
||||
Place::ty_from(base.base, base.projection, this.body, tcx).ty.kind
|
||||
{
|
||||
if def.is_union() {
|
||||
if this.move_data.path_map[mpi].iter().any(|moi| {
|
||||
@ -2195,7 +2195,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
Place::ty_from(place.base, proj_base, self.body, self.infcx.tcx).ty;
|
||||
|
||||
// Check the kind of deref to decide
|
||||
match base_ty.sty {
|
||||
match base_ty.kind {
|
||||
ty::Ref(_, _, mutbl) => {
|
||||
match mutbl {
|
||||
// Shared borrowed data is never mutable
|
||||
|
@ -335,7 +335,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
debug!("report: ty={:?}", ty);
|
||||
let mut err = match ty.sty {
|
||||
let mut err = match ty.kind {
|
||||
ty::Array(..) | ty::Slice(..) =>
|
||||
self.cannot_move_out_of_interior_noncopy(span, ty, None),
|
||||
ty::Closure(def_id, closure_substs)
|
||||
|
@ -283,7 +283,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||
// for a `self: &mut Self` to suggest removing the `&mut`.
|
||||
if let ty::Ref(
|
||||
_, _, hir::Mutability::MutMutable
|
||||
) = local_decl.ty.sty {
|
||||
) = local_decl.ty.kind {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
@ -630,8 +630,8 @@ fn annotate_struct_field(
|
||||
field: &mir::Field,
|
||||
) -> Option<(Span, String)> {
|
||||
// Expect our local to be a reference to a struct of some kind.
|
||||
if let ty::Ref(_, ty, _) = ty.sty {
|
||||
if let ty::Adt(def, _) = ty.sty {
|
||||
if let ty::Ref(_, ty, _) = ty.kind {
|
||||
if let ty::Adt(def, _) = ty.kind {
|
||||
let field = def.all_fields().nth(field.index())?;
|
||||
// Use the HIR types to construct the diagnostic message.
|
||||
let hir_id = tcx.hir().as_local_hir_id(field.did)?;
|
||||
|
@ -95,7 +95,7 @@ impl BorrowExplanation {
|
||||
should_note_order,
|
||||
} => {
|
||||
let local_decl = &body.local_decls[dropped_local];
|
||||
let (dtor_desc, type_desc) = match local_decl.ty.sty {
|
||||
let (dtor_desc, type_desc) = match local_decl.ty.kind {
|
||||
// If type is an ADT that implements Drop, then
|
||||
// simplify output by reporting just the ADT name.
|
||||
ty::Adt(adt, _substs) if adt.has_dtor(tcx) && !adt.is_box() => (
|
||||
@ -612,7 +612,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
{
|
||||
debug!("was_captured_by_trait_object: ty={:?}", ty);
|
||||
// Check the type for a trait object.
|
||||
return match ty.sty {
|
||||
return match ty.kind {
|
||||
// `&dyn Trait`
|
||||
ty::Ref(_, ty, _) if ty.is_trait() => true,
|
||||
// `Box<dyn Trait>`
|
||||
|
@ -627,7 +627,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
(self.to_error_region(fr), self.to_error_region(outlived_fr))
|
||||
{
|
||||
if let Some(ty::TyS {
|
||||
sty: ty::Opaque(did, substs),
|
||||
kind: ty::Opaque(did, substs),
|
||||
..
|
||||
}) = infcx
|
||||
.tcx
|
||||
|
@ -527,7 +527,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
&mut vec![(argument_ty, argument_hir_ty)];
|
||||
|
||||
while let Some((ty, hir_ty)) = search_stack.pop() {
|
||||
match (&ty.sty, &hir_ty.node) {
|
||||
match (&ty.kind, &hir_ty.node) {
|
||||
// Check if the `argument_ty` is `&'X ..` where `'X`
|
||||
// is the region we are looking for -- if so, and we have a `&T`
|
||||
// on the RHS, then we want to highlight the `&` like so:
|
||||
|
@ -314,7 +314,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
|
||||
);
|
||||
}
|
||||
}
|
||||
if let ty::FnDef(def_id, substs) = constant.literal.ty.sty {
|
||||
if let ty::FnDef(def_id, substs) = constant.literal.ty.kind {
|
||||
let tcx = self.tcx();
|
||||
|
||||
let instantiated_predicates = tcx
|
||||
@ -342,7 +342,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
|
||||
let ty = if !local_decl.is_nonref_binding() {
|
||||
// If we have a binding of the form `let ref x: T = ..` then remove the outermost
|
||||
// reference so we can check the type annotation for the remaining type.
|
||||
if let ty::Ref(_, rty, _) = local_decl.ty.sty {
|
||||
if let ty::Ref(_, rty, _) = local_decl.ty.kind {
|
||||
rty
|
||||
} else {
|
||||
bug!("{:?} with ref binding has wrong type {}", local, local_decl.ty);
|
||||
@ -637,7 +637,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
|
||||
)
|
||||
}
|
||||
ProjectionElem::Subslice { from, to } => PlaceTy::from_ty(
|
||||
match base_ty.sty {
|
||||
match base_ty.kind {
|
||||
ty::Array(inner, size) => {
|
||||
let size = size.eval_usize(tcx, self.cx.param_env);
|
||||
let min_size = (from as u64) + (to as u64);
|
||||
@ -656,7 +656,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
|
||||
_ => span_mirbug_and_err!(self, place, "slice of non-array {:?}", base_ty),
|
||||
},
|
||||
),
|
||||
ProjectionElem::Downcast(maybe_name, index) => match base_ty.sty {
|
||||
ProjectionElem::Downcast(maybe_name, index) => match base_ty.kind {
|
||||
ty::Adt(adt_def, _substs) if adt_def.is_enum() => {
|
||||
if index.as_usize() >= adt_def.variants.len() {
|
||||
PlaceTy::from_ty(
|
||||
@ -738,7 +738,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
|
||||
let tcx = self.tcx();
|
||||
|
||||
let (variant, substs) = match base_ty {
|
||||
PlaceTy { ty, variant_index: Some(variant_index) } => match ty.sty {
|
||||
PlaceTy { ty, variant_index: Some(variant_index) } => match ty.kind {
|
||||
ty::Adt(adt_def, substs) => (&adt_def.variants[variant_index], substs),
|
||||
ty::Generator(def_id, substs, _) => {
|
||||
let mut variants = substs.state_tys(def_id, tcx);
|
||||
@ -759,7 +759,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
|
||||
}
|
||||
_ => bug!("can't have downcast of non-adt non-generator type"),
|
||||
}
|
||||
PlaceTy { ty, variant_index: None } => match ty.sty {
|
||||
PlaceTy { ty, variant_index: None } => match ty.kind {
|
||||
ty::Adt(adt_def, substs) if !adt_def.is_enum() =>
|
||||
(&adt_def.variants[VariantIdx::new(0)], substs),
|
||||
ty::Closure(def_id, substs) => {
|
||||
@ -1142,7 +1142,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
category: ConstraintCategory,
|
||||
) -> Fallible<()> {
|
||||
if let Err(terr) = self.sub_types(sub, sup, locations, category) {
|
||||
if let ty::Opaque(..) = sup.sty {
|
||||
if let ty::Opaque(..) = sup.kind {
|
||||
// When you have `let x: impl Foo = ...` in a closure,
|
||||
// the resulting inferend values are stored with the
|
||||
// def-id of the base function.
|
||||
@ -1430,7 +1430,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
variant_index,
|
||||
} => {
|
||||
let place_type = place.ty(body, tcx).ty;
|
||||
let adt = match place_type.sty {
|
||||
let adt = match place_type.kind {
|
||||
ty::Adt(adt, _) if adt.is_enum() => adt,
|
||||
_ => {
|
||||
span_bug!(
|
||||
@ -1559,7 +1559,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
} => {
|
||||
let func_ty = func.ty(body, tcx);
|
||||
debug!("check_terminator: call, func_ty={:?}", func_ty);
|
||||
let sig = match func_ty.sty {
|
||||
let sig = match func_ty.kind {
|
||||
ty::FnDef(..) | ty::FnPtr(_) => func_ty.fn_sig(tcx),
|
||||
_ => {
|
||||
span_mirbug!(self, term, "call to non-function {:?}", func_ty);
|
||||
@ -2056,7 +2056,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
}
|
||||
|
||||
CastKind::Pointer(PointerCast::ClosureFnPointer(unsafety)) => {
|
||||
let sig = match op.ty(body, tcx).sty {
|
||||
let sig = match op.ty(body, tcx).kind {
|
||||
ty::Closure(def_id, substs) => {
|
||||
substs.closure_sig_ty(def_id, tcx).fn_sig(tcx)
|
||||
}
|
||||
@ -2125,7 +2125,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
}
|
||||
|
||||
CastKind::Pointer(PointerCast::MutToConstPointer) => {
|
||||
let ty_from = match op.ty(body, tcx).sty {
|
||||
let ty_from = match op.ty(body, tcx).kind {
|
||||
ty::RawPtr(ty::TypeAndMut {
|
||||
ty: ty_from,
|
||||
mutbl: hir::MutMutable,
|
||||
@ -2140,7 +2140,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
return;
|
||||
}
|
||||
};
|
||||
let ty_to = match ty.sty {
|
||||
let ty_to = match ty.kind {
|
||||
ty::RawPtr(ty::TypeAndMut {
|
||||
ty: ty_to,
|
||||
mutbl: hir::MutImmutable,
|
||||
@ -2173,11 +2173,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
}
|
||||
|
||||
CastKind::Misc => {
|
||||
if let ty::Ref(_, mut ty_from, _) = op.ty(body, tcx).sty {
|
||||
if let ty::Ref(_, mut ty_from, _) = op.ty(body, tcx).kind {
|
||||
let (mut ty_to, mutability) = if let ty::RawPtr(ty::TypeAndMut {
|
||||
ty: ty_to,
|
||||
mutbl,
|
||||
}) = ty.sty {
|
||||
}) = ty.kind {
|
||||
(ty_to, mutbl)
|
||||
} else {
|
||||
span_mirbug!(
|
||||
@ -2192,9 +2192,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
|
||||
// Handle the direct cast from `&[T; N]` to `*const T` by unwrapping
|
||||
// any array we find.
|
||||
while let ty::Array(ty_elem_from, _) = ty_from.sty {
|
||||
while let ty::Array(ty_elem_from, _) = ty_from.kind {
|
||||
ty_from = ty_elem_from;
|
||||
if let ty::Array(ty_elem_to, _) = ty_to.sty {
|
||||
if let ty::Array(ty_elem_to, _) = ty_to.kind {
|
||||
ty_to = ty_elem_to;
|
||||
} else {
|
||||
break;
|
||||
@ -2250,7 +2250,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
| Rvalue::BinaryOp(BinOp::Gt, left, right)
|
||||
| Rvalue::BinaryOp(BinOp::Ge, left, right) => {
|
||||
let ty_left = left.ty(body, tcx);
|
||||
if let ty::RawPtr(_) | ty::FnPtr(_) = ty_left.sty {
|
||||
if let ty::RawPtr(_) | ty::FnPtr(_) = ty_left.kind {
|
||||
let ty_right = right.ty(body, tcx);
|
||||
let common_ty = self.infcx.next_ty_var(
|
||||
TypeVariableOrigin {
|
||||
@ -2431,7 +2431,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
let base_ty = Place::ty_from(&borrowed_place.base, proj_base, body, tcx).ty;
|
||||
|
||||
debug!("add_reborrow_constraint - base_ty = {:?}", base_ty);
|
||||
match base_ty.sty {
|
||||
match base_ty.kind {
|
||||
ty::Ref(ref_region, _, mutbl) => {
|
||||
constraints.outlives_constraints.push(OutlivesConstraint {
|
||||
sup: ref_region.to_region_vid(),
|
||||
|
@ -486,7 +486,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
||||
let defining_ty = self.infcx
|
||||
.replace_free_regions_with_nll_infer_vars(FR, &defining_ty);
|
||||
|
||||
match defining_ty.sty {
|
||||
match defining_ty.kind {
|
||||
ty::Closure(def_id, substs) => DefiningTy::Closure(def_id, substs),
|
||||
ty::Generator(def_id, substs, movability) => {
|
||||
DefiningTy::Generator(def_id, substs, movability)
|
||||
@ -573,7 +573,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
||||
// flattens this tuple.
|
||||
let (&output, tuplized_inputs) = inputs_and_output.split_last().unwrap();
|
||||
assert_eq!(tuplized_inputs.len(), 1, "multiple closure inputs");
|
||||
let inputs = match tuplized_inputs[0].sty {
|
||||
let inputs = match tuplized_inputs[0].kind {
|
||||
ty::Tuple(inputs) => inputs,
|
||||
_ => bug!("closure inputs not a tuple: {:?}", tuplized_inputs[0]),
|
||||
};
|
||||
|
@ -57,7 +57,7 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
|
||||
|
||||
if *elem == ProjectionElem::Deref {
|
||||
let ty = Place::ty_from(&self.base, proj_base, body, tcx).ty;
|
||||
if let ty::RawPtr(..) | ty::Ref(_, _, hir::MutImmutable) = ty.sty {
|
||||
if let ty::RawPtr(..) | ty::Ref(_, _, hir::MutImmutable) = ty.kind {
|
||||
// For both derefs of raw pointers and `&T`
|
||||
// references, the original path is `Copy` and
|
||||
// therefore not significant. In particular,
|
||||
|
@ -231,7 +231,7 @@ fn place_components_conflict<'tcx>(
|
||||
let proj_base = &borrow_place.projection[..access_place.projection.len() + i];
|
||||
let base_ty = Place::ty_from(borrow_base, proj_base, body, tcx).ty;
|
||||
|
||||
match (elem, &base_ty.sty, access) {
|
||||
match (elem, &base_ty.kind, access) {
|
||||
(_, _, Shallow(Some(ArtificialField::ArrayLength)))
|
||||
| (_, _, Shallow(Some(ArtificialField::ShallowBorrow))) => {
|
||||
// The array length is like additional fields on the
|
||||
@ -349,7 +349,7 @@ fn place_base_conflict<'tcx>(
|
||||
},
|
||||
(StaticKind::Promoted(promoted_1, _), StaticKind::Promoted(promoted_2, _)) => {
|
||||
if promoted_1 == promoted_2 {
|
||||
if let ty::Array(_, len) = s1.ty.sty {
|
||||
if let ty::Array(_, len) = s1.ty.kind {
|
||||
if let Some(0) = len.try_eval_usize(tcx, param_env) {
|
||||
// Ignore conflicts with promoted [T; 0].
|
||||
debug!("place_element_conflict: IGNORE-LEN-0-PROMOTED");
|
||||
@ -404,7 +404,7 @@ fn place_projection_conflict<'tcx>(
|
||||
Overlap::EqualOrDisjoint
|
||||
} else {
|
||||
let ty = Place::ty_from(pi1_base, pi1_proj_base, body, tcx).ty;
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::Adt(def, _) if def.is_union() => {
|
||||
// Different fields of a union, we are basically stuck.
|
||||
debug!("place_element_conflict: STUCK-UNION");
|
||||
|
@ -144,7 +144,7 @@ impl<'cx, 'tcx> Iterator for Prefixes<'cx, 'tcx> {
|
||||
// reference.
|
||||
|
||||
let ty = Place::ty_from(cursor.base, proj_base, self.body, self.tcx).ty;
|
||||
match ty.sty {
|
||||
match ty.kind {
|
||||
ty::RawPtr(_) |
|
||||
ty::Ref(
|
||||
_, /*rgn*/
|
||||
|
@ -196,7 +196,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
exit_block.unit()
|
||||
}
|
||||
ExprKind::Call { ty, fun, args, from_hir_call } => {
|
||||
let intrinsic = match ty.sty {
|
||||
let intrinsic = match ty.kind {
|
||||
ty::FnDef(def_id, _) => {
|
||||
let f = ty.fn_sig(this.hir.tcx());
|
||||
if f.abi() == Abi::RustIntrinsic || f.abi() == Abi::PlatformIntrinsic {
|
||||
|
@ -109,7 +109,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
}
|
||||
|
||||
PatternKind::Range(PatternRange { lo, hi, end }) => {
|
||||
let (range, bias) = match lo.ty.sty {
|
||||
let (range, bias) = match lo.ty.kind {
|
||||
ty::Char => {
|
||||
(Some(('\u{0000}' as u128, '\u{10FFFF}' as u128, Size::from_bits(32))), 0)
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
|
||||
TestKind::SwitchInt { switch_ty, ref options, indices: _ } => {
|
||||
let target_blocks = make_target_blocks(self);
|
||||
let terminator = if switch_ty.sty == ty::Bool {
|
||||
let terminator = if switch_ty.kind == ty::Bool {
|
||||
assert!(options.len() > 0 && options.len() <= 2);
|
||||
if let [first_bb, second_bb] = *target_blocks {
|
||||
let (true_bb, false_bb) = match options[0] {
|
||||
@ -400,8 +400,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
// We want to do this even when the scrutinee is a reference to an
|
||||
// array, so we can call `<[u8]>::eq` rather than having to find an
|
||||
// `<[u8; N]>::eq`.
|
||||
let unsize = |ty: Ty<'tcx>| match ty.sty {
|
||||
ty::Ref(region, rty, _) => match rty.sty {
|
||||
let unsize = |ty: Ty<'tcx>| match ty.kind {
|
||||
ty::Ref(region, rty, _) => match rty.kind {
|
||||
ty::Array(inner_ty, n) => Some((region, inner_ty, n)),
|
||||
_ => None,
|
||||
},
|
||||
@ -438,7 +438,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
},
|
||||
}
|
||||
|
||||
let deref_ty = match ty.sty {
|
||||
let deref_ty = match ty.kind {
|
||||
ty::Ref(_, deref_ty, _) => deref_ty,
|
||||
_ => bug!("non_scalar_compare called on non-reference type: {}", ty),
|
||||
};
|
||||
|
@ -73,7 +73,7 @@ pub fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> Body<'_> {
|
||||
|
||||
let ty = tcx.type_of(fn_def_id);
|
||||
let mut abi = fn_sig.abi;
|
||||
let implicit_argument = match ty.sty {
|
||||
let implicit_argument = match ty.kind {
|
||||
ty::Closure(..) => {
|
||||
// HACK(eddyb) Avoid having RustCall on closures,
|
||||
// as it adds unnecessary (and wrong) auto-tupling.
|
||||
@ -127,7 +127,7 @@ pub fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> Body<'_> {
|
||||
let arguments = implicit_argument.into_iter().chain(explicit_arguments);
|
||||
|
||||
let (yield_ty, return_ty) = if body.generator_kind.is_some() {
|
||||
let gen_sig = match ty.sty {
|
||||
let gen_sig = match ty.kind {
|
||||
ty::Generator(gen_def_id, gen_substs, ..) =>
|
||||
gen_substs.sig(gen_def_id, tcx),
|
||||
_ =>
|
||||
@ -178,7 +178,7 @@ fn liberated_closure_env_ty(
|
||||
) -> Ty<'_> {
|
||||
let closure_ty = tcx.body_tables(body_id).node_type(closure_expr_id);
|
||||
|
||||
let (closure_def_id, closure_substs) = match closure_ty.sty {
|
||||
let (closure_def_id, closure_substs) = match closure_ty.kind {
|
||||
ty::Closure(closure_def_id, closure_substs) => (closure_def_id, closure_substs),
|
||||
_ => bug!("closure expr does not have closure type: {:?}", closure_ty)
|
||||
};
|
||||
|
@ -63,8 +63,8 @@ fn op_to_const<'tcx>(
|
||||
// `Undef` situation.
|
||||
let try_as_immediate = match op.layout.abi {
|
||||
layout::Abi::Scalar(..) => true,
|
||||
layout::Abi::ScalarPair(..) => match op.layout.ty.sty {
|
||||
ty::Ref(_, inner, _) => match inner.sty {
|
||||
layout::Abi::ScalarPair(..) => match op.layout.ty.kind {
|
||||
ty::Ref(_, inner, _) => match inner.kind {
|
||||
ty::Slice(elem) => elem == ecx.tcx.types.u8,
|
||||
ty::Str => true,
|
||||
_ => false,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user