Skip to content

Commit e2e0f9a

Browse files
committed
Rename sty to kind
1 parent 2808a46 commit e2e0f9a

File tree

176 files changed

+691
-691
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+691
-691
lines changed

Diff for: src/librustc/infer/canonical/canonicalizer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
343343
}
344344

345345
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
346-
match t.sty {
346+
match t.kind {
347347
ty::Infer(ty::TyVar(vid)) => {
348348
debug!("canonical: type var found with vid {:?}", vid);
349349
match self.infcx.unwrap().probe_ty_var(vid) {

Diff for: src/librustc/infer/canonical/query_response.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
471471
match result_value.unpack() {
472472
UnpackedKind::Type(result_value) => {
473473
// e.g., here `result_value` might be `?0` in the example above...
474-
if let ty::Bound(debruijn, b) = result_value.sty {
474+
if let ty::Bound(debruijn, b) = result_value.kind {
475475
// ...in which case we would set `canonical_vars[0]` to `Some(?U)`.
476476

477477
// We only allow a `ty::INNERMOST` index in substitutions.

Diff for: src/librustc/infer/combine.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
7070
{
7171
let a_is_expected = relation.a_is_expected();
7272

73-
match (&a.sty, &b.sty) {
73+
match (&a.kind, &b.kind) {
7474
// Relate integral variables to other types
7575
(&ty::Infer(ty::IntVar(a_id)), &ty::Infer(ty::IntVar(b_id))) => {
7676
self.int_unification_table
@@ -486,7 +486,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
486486
// any other type variable related to `vid` via
487487
// subtyping. This is basically our "occurs check", preventing
488488
// us from creating infinitely sized types.
489-
match t.sty {
489+
match t.kind {
490490
ty::Infer(ty::TyVar(vid)) => {
491491
let mut variables = self.infcx.type_variables.borrow_mut();
492492
let vid = variables.root_var(vid);

Diff for: src/librustc/infer/equate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
6868

6969
debug!("{}.tys: replacements ({:?}, {:?})", self.tag(), a, b);
7070

71-
match (&a.sty, &b.sty) {
71+
match (&a.kind, &b.kind) {
7272
(&ty::Infer(TyVar(a_id)), &ty::Infer(TyVar(b_id))) => {
7373
infcx.type_variables.borrow_mut().equate(a_id, b_id);
7474
}

Diff for: src/librustc/infer/error_reporting/mod.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
589589
// if they are both "path types", there's a chance of ambiguity
590590
// due to different versions of the same crate
591591
if let (&ty::Adt(exp_adt, _), &ty::Adt(found_adt, _))
592-
= (&exp_found.expected.sty, &exp_found.found.sty)
592+
= (&exp_found.expected.kind, &exp_found.found.kind)
593593
{
594594
report_path_match(err, exp_adt.did, found_adt.did);
595595
}
@@ -803,7 +803,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
803803
self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty);
804804
return Some(());
805805
}
806-
if let &ty::Adt(def, _) = &ta.sty {
806+
if let &ty::Adt(def, _) = &ta.kind {
807807
let path_ = self.tcx.def_path_str(def.did.clone());
808808
if path_ == other_path {
809809
self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty);
@@ -868,7 +868,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
868868
/// relevant differences, and return two representation of those types for highlighted printing.
869869
fn cmp(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> (DiagnosticStyledString, DiagnosticStyledString) {
870870
fn equals<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
871-
match (&a.sty, &b.sty) {
871+
match (&a.kind, &b.kind) {
872872
(a, b) if *a == *b => true,
873873
(&ty::Int(_), &ty::Infer(ty::InferTy::IntVar(_)))
874874
| (&ty::Infer(ty::InferTy::IntVar(_)), &ty::Int(_))
@@ -902,7 +902,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
902902
s.push_normal(ty.to_string());
903903
}
904904

905-
match (&t1.sty, &t2.sty) {
905+
match (&t1.kind, &t2.kind) {
906906
(&ty::Adt(def1, sub1), &ty::Adt(def2, sub2)) => {
907907
let sub_no_defaults_1 = self.strip_generic_default_params(def1.did, sub1);
908908
let sub_no_defaults_2 = self.strip_generic_default_params(def2.did, sub2);
@@ -1138,7 +1138,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11381138
match (terr, is_simple_error, expected == found) {
11391139
(&TypeError::Sorts(ref values), false, true) => {
11401140
let sort_string = | a_type: Ty<'tcx> |
1141-
if let ty::Opaque(def_id, _) = a_type.sty {
1141+
if let ty::Opaque(def_id, _) = a_type.kind {
11421142
format!(" (opaque type at {})", self.tcx.sess.source_map()
11431143
.mk_substr_filename(self.tcx.def_span(def_id)))
11441144
} else {
@@ -1179,9 +1179,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11791179
exp_found: &ty::error::ExpectedFound<Ty<'tcx>>,
11801180
diag: &mut DiagnosticBuilder<'tcx>,
11811181
) {
1182-
match (&exp_found.expected.sty, &exp_found.found.sty) {
1182+
match (&exp_found.expected.kind, &exp_found.found.kind) {
11831183
(ty::Adt(exp_def, exp_substs), ty::Ref(_, found_ty, _)) => {
1184-
if let ty::Adt(found_def, found_substs) = found_ty.sty {
1184+
if let ty::Adt(found_def, found_substs) = found_ty.kind {
11851185
let path_str = format!("{:?}", exp_def);
11861186
if exp_def == &found_def {
11871187
let opt_msg = "you can convert from `&Option<T>` to `Option<&T>` using \
@@ -1203,9 +1203,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
12031203
{
12041204
let mut show_suggestion = true;
12051205
for (exp_ty, found_ty) in exp_substs.types().zip(found_substs.types()) {
1206-
match exp_ty.sty {
1206+
match exp_ty.kind {
12071207
ty::Ref(_, exp_ty, _) => {
1208-
match (&exp_ty.sty, &found_ty.sty) {
1208+
match (&exp_ty.kind, &found_ty.kind) {
12091209
(_, ty::Param(_)) |
12101210
(_, ty::Infer(_)) |
12111211
(ty::Param(_), _) |

Diff for: src/librustc/infer/error_reporting/need_type_info.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<'a, 'tcx> FindLocalByTypeVisitor<'a, 'tcx> {
4444
Some(ty) => {
4545
let ty = self.infcx.resolve_vars_if_possible(&ty);
4646
if ty.walk().any(|inner_ty| {
47-
inner_ty == self.target_ty || match (&inner_ty.sty, &self.target_ty.sty) {
47+
inner_ty == self.target_ty || match (&inner_ty.kind, &self.target_ty.kind) {
4848
(&Infer(TyVar(a_vid)), &Infer(TyVar(b_vid))) => {
4949
self.infcx
5050
.type_variables
@@ -151,7 +151,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
151151
ty: Ty<'tcx>,
152152
highlight: Option<ty::print::RegionHighlightMode>,
153153
) -> (String, Option<Span>) {
154-
if let ty::Infer(ty::TyVar(ty_vid)) = ty.sty {
154+
if let ty::Infer(ty::TyVar(ty_vid)) = ty.kind {
155155
let ty_vars = self.type_variables.borrow();
156156
let var_origin = ty_vars.var_origin(ty_vid);
157157
if let TypeVariableOriginKind::TypeParameterDefinition(name) = var_origin.kind {
@@ -219,7 +219,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
219219
};
220220

221221
let ty_msg = match local_visitor.found_ty {
222-
Some(ty::TyS { sty: ty::Closure(def_id, substs), .. }) => {
222+
Some(ty::TyS { kind: ty::Closure(def_id, substs), .. }) => {
223223
let fn_sig = substs.closure_sig(*def_id, self.tcx);
224224
let args = closure_args(&fn_sig);
225225
let ret = fn_sig.output().skip_binder().to_string();
@@ -254,7 +254,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
254254
);
255255

256256
let suffix = match local_visitor.found_ty {
257-
Some(ty::TyS { sty: ty::Closure(def_id, substs), .. }) => {
257+
Some(ty::TyS { kind: ty::Closure(def_id, substs), .. }) => {
258258
let fn_sig = substs.closure_sig(*def_id, self.tcx);
259259
let ret = fn_sig.output().skip_binder().to_string();
260260

Diff for: src/librustc/infer/error_reporting/nice_region_error/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
109109
decl: &hir::FnDecl,
110110
) -> Option<Span> {
111111
let ret_ty = self.tcx().type_of(scope_def_id);
112-
if let ty::FnDef(_, _) = ret_ty.sty {
112+
if let ty::FnDef(_, _) = ret_ty.kind {
113113
let sig = ret_ty.fn_sig(self.tcx());
114114
let late_bound_regions = self.tcx()
115115
.collect_referenced_late_bound_regions(&sig.output());

Diff for: src/librustc/infer/freshen.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
153153

154154
let tcx = self.infcx.tcx;
155155

156-
match t.sty {
156+
match t.kind {
157157
ty::Infer(ty::TyVar(v)) => {
158158
let opt_ty = self.infcx.type_variables.borrow_mut().probe(v).known();
159159
self.freshen_ty(

Diff for: src/librustc/infer/fudge.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for InferenceFudger<'a, 'tcx> {
148148
}
149149

150150
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
151-
match ty.sty {
151+
match ty.kind {
152152
ty::Infer(ty::InferTy::TyVar(vid)) => {
153153
if self.type_vars.0.contains(&vid) {
154154
// This variable was created during the fudging.

Diff for: src/librustc/infer/lattice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ where
6161
let infcx = this.infcx();
6262
let a = infcx.type_variables.borrow_mut().replace_if_possible(a);
6363
let b = infcx.type_variables.borrow_mut().replace_if_possible(b);
64-
match (&a.sty, &b.sty) {
64+
match (&a.kind, &b.kind) {
6565
// If one side is known to be a variable and one is not,
6666
// create a variable (`v`) to represent the LUB. Make sure to
6767
// relate `v` to the non-type-variable first (by passing it

Diff for: src/librustc/infer/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
614614
}
615615

616616
pub fn type_var_diverges(&'a self, ty: Ty<'_>) -> bool {
617-
match ty.sty {
617+
match ty.kind {
618618
ty::Infer(ty::TyVar(vid)) => self.type_variables.borrow().var_diverges(vid),
619619
_ => false,
620620
}
@@ -627,7 +627,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
627627
pub fn type_is_unconstrained_numeric(&'a self, ty: Ty<'_>) -> UnconstrainedNumeric {
628628
use crate::ty::error::UnconstrainedNumeric::Neither;
629629
use crate::ty::error::UnconstrainedNumeric::{UnconstrainedFloat, UnconstrainedInt};
630-
match ty.sty {
630+
match ty.kind {
631631
ty::Infer(ty::IntVar(vid)) => {
632632
if self.int_unification_table
633633
.borrow_mut()
@@ -1563,7 +1563,7 @@ impl<'a, 'tcx> ShallowResolver<'a, 'tcx> {
15631563
}
15641564

15651565
pub fn shallow_resolve(&mut self, typ: Ty<'tcx>) -> Ty<'tcx> {
1566-
match typ.sty {
1566+
match typ.kind {
15671567
ty::Infer(ty::TyVar(v)) => {
15681568
// Not entirely obvious: if `typ` is a type variable,
15691569
// it can be resolved to an int/float variable, which

Diff for: src/librustc/infer/nll_relate/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ where
274274
use crate::traits::WhereClause;
275275
use syntax_pos::DUMMY_SP;
276276

277-
match value_ty.sty {
277+
match value_ty.kind {
278278
ty::Projection(other_projection_ty) => {
279279
let var = self.infcx.next_ty_var(TypeVariableOrigin {
280280
kind: TypeVariableOriginKind::MiscVariable,
@@ -328,7 +328,7 @@ where
328328
// This only presently applies to chalk integration, as NLL
329329
// doesn't permit type variables to appear on both sides (and
330330
// doesn't use lazy norm).
331-
match value_ty.sty {
331+
match value_ty.kind {
332332
ty::Infer(ty::TyVar(value_vid)) => {
333333
// Two type variables: just equate them.
334334
self.infcx
@@ -548,7 +548,7 @@ where
548548
b = self.infcx.shallow_resolve(b);
549549
}
550550

551-
match (&a.sty, &b.sty) {
551+
match (&a.kind, &b.kind) {
552552
(_, &ty::Infer(ty::TyVar(vid))) => {
553553
if D::forbid_inference_vars() {
554554
// Forbid inference variables in the RHS.
@@ -878,7 +878,7 @@ where
878878

879879
debug!("TypeGeneralizer::tys(a={:?})", a);
880880

881-
match a.sty {
881+
match a.kind {
882882
ty::Infer(ty::TyVar(_)) | ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_))
883883
if D::forbid_inference_vars() =>
884884
{

Diff for: src/librustc/infer/opaque_types/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ where
720720
return false; // keep visiting
721721
}
722722

723-
match ty.sty {
723+
match ty.kind {
724724
ty::Closure(def_id, ref substs) => {
725725
// Skip lifetime parameters of the enclosing item(s)
726726

@@ -857,7 +857,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
857857
}
858858

859859
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
860-
match ty.sty {
860+
match ty.kind {
861861
ty::Closure(def_id, substs) => {
862862
// I am a horrible monster and I pray for death. When
863863
// we encounter a closure here, it is always a closure
@@ -990,7 +990,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
990990
ty_op: |ty| {
991991
if ty.references_error() {
992992
return tcx.types.err;
993-
} else if let ty::Opaque(def_id, substs) = ty.sty {
993+
} else if let ty::Opaque(def_id, substs) = ty.kind {
994994
// Check that this is `impl Trait` type is
995995
// declared by `parent_def_id` -- i.e., one whose
996996
// value we are inferring. At present, this is

Diff for: src/librustc/infer/outlives/obligations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ where
403403
// 'a` in the environment but `trait Foo<'b> { type Item: 'b
404404
// }` in the trait definition.
405405
approx_env_bounds.retain(|bound| {
406-
match bound.0.sty {
406+
match bound.0.kind {
407407
ty::Projection(projection_ty) => {
408408
self.verify_bound.projection_declared_bounds_from_trait(projection_ty)
409409
.all(|r| r != bound.1)

Diff for: src/librustc/infer/outlives/verify.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
4444
}
4545

4646
fn type_bound(&self, ty: Ty<'tcx>) -> VerifyBound<'tcx> {
47-
match ty.sty {
47+
match ty.kind {
4848
ty::Param(p) => self.param_bound(p),
4949
ty::Projection(data) => self.projection_bound(data),
5050
_ => self.recursive_type_bound(ty),
@@ -87,7 +87,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
8787
let projection_ty = GenericKind::Projection(projection_ty).to_ty(self.tcx);
8888
let erased_projection_ty = self.tcx.erase_regions(&projection_ty);
8989
self.declared_generic_bounds_from_env_with_compare_fn(|ty| {
90-
if let ty::Projection(..) = ty.sty {
90+
if let ty::Projection(..) = ty.kind {
9191
let erased_ty = self.tcx.erase_regions(&ty);
9292
erased_ty == erased_projection_ty
9393
} else {

Diff for: src/librustc/infer/resolve.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> {
118118
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
119119
let t = self.infcx.shallow_resolve(t);
120120
if t.has_infer_types() {
121-
if let ty::Infer(infer_ty) = t.sty {
121+
if let ty::Infer(infer_ty) = t.kind {
122122
// Since we called `shallow_resolve` above, this must
123123
// be an (as yet...) unresolved inference variable.
124124
let ty_var_span =
@@ -188,7 +188,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
188188
// defaulted tuples.
189189
} else {
190190
let t = self.infcx.shallow_resolve(t);
191-
match t.sty {
191+
match t.kind {
192192
ty::Infer(ty::TyVar(vid)) => {
193193
self.err = Some(FixupError::UnresolvedTy(vid));
194194
self.tcx().types.err

Diff for: src/librustc/infer/sub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
7171
let infcx = self.fields.infcx;
7272
let a = infcx.type_variables.borrow_mut().replace_if_possible(a);
7373
let b = infcx.type_variables.borrow_mut().replace_if_possible(b);
74-
match (&a.sty, &b.sty) {
74+
match (&a.kind, &b.kind) {
7575
(&ty::Infer(TyVar(a_vid)), &ty::Infer(TyVar(b_vid))) => {
7676
// Shouldn't have any LBR here, so we can safely put
7777
// this under a binder below without fear of accidental

Diff for: src/librustc/infer/type_variable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
247247
/// instantiated, then return the with which it was
248248
/// instantiated. Otherwise, returns `t`.
249249
pub fn replace_if_possible(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
250-
match t.sty {
250+
match t.kind {
251251
ty::Infer(ty::TyVar(v)) => {
252252
match self.probe(v) {
253253
TypeVariableValue::Unknown { .. } => t,

Diff for: src/librustc/lint/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
829829
trait_ref: Option<ty::TraitRef<'tcx>>,
830830
) -> Result<Self::Path, Self::Error> {
831831
if trait_ref.is_none() {
832-
if let ty::Adt(def, substs) = self_ty.sty {
832+
if let ty::Adt(def, substs) = self_ty.kind {
833833
return self.print_def_path(def.did, substs);
834834
}
835835
}

Diff for: src/librustc/middle/dead.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
117117
}
118118

119119
fn handle_field_access(&mut self, lhs: &hir::Expr, hir_id: hir::HirId) {
120-
match self.tables.expr_ty_adjusted(lhs).sty {
120+
match self.tables.expr_ty_adjusted(lhs).kind {
121121
ty::Adt(def, _) => {
122122
let index = self.tcx.field_index(hir_id, self.tables);
123123
self.insert_def_id(def.non_enum_variant().fields[index].did);
@@ -128,7 +128,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
128128
}
129129

130130
fn handle_field_pattern_match(&mut self, lhs: &hir::Pat, res: Res, pats: &[hir::FieldPat]) {
131-
let variant = match self.tables.node_type(lhs.hir_id).sty {
131+
let variant = match self.tables.node_type(lhs.hir_id).kind {
132132
ty::Adt(adt, _) => adt.variant_of_res(res),
133133
_ => span_bug!(lhs.span, "non-ADT in struct pattern")
134134
};
@@ -248,7 +248,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
248248
self.handle_field_access(&lhs, expr.hir_id);
249249
}
250250
hir::ExprKind::Struct(_, ref fields, _) => {
251-
if let ty::Adt(ref adt, _) = self.tables.expr_ty(expr).sty {
251+
if let ty::Adt(ref adt, _) = self.tables.expr_ty(expr).kind {
252252
self.mark_as_used_if_union(adt, fields);
253253
}
254254
}

0 commit comments

Comments
 (0)