Skip to content

Commit dc45735

Browse files
committed
Auto merge of #64513 - varkor:sty-begone, r=eddyb
Rename `TyS.sty` to `TyS.kind` Fixes #64353. r? @eddyb
2 parents a5bc0f0 + bc2a373 commit dc45735

File tree

179 files changed

+735
-736
lines changed

Some content is hidden

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

179 files changed

+735
-736
lines changed

src/librustc/infer/canonical/canonicalizer.rs

Lines changed: 1 addition & 1 deletion
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) {

src/librustc/infer/canonical/query_response.rs

Lines changed: 1 addition & 1 deletion
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.

src/librustc/infer/combine.rs

Lines changed: 2 additions & 2 deletions
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);

src/librustc/infer/equate.rs

Lines changed: 1 addition & 1 deletion
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
}

src/librustc/infer/error_reporting/mod.rs

Lines changed: 9 additions & 9 deletions
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(_), _) |

src/librustc/infer/error_reporting/need_type_info.rs

Lines changed: 4 additions & 4 deletions
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

src/librustc/infer/error_reporting/nice_region_error/util.rs

Lines changed: 1 addition & 1 deletion
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());

src/librustc/infer/freshen.rs

Lines changed: 1 addition & 1 deletion
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(

src/librustc/infer/fudge.rs

Lines changed: 1 addition & 1 deletion
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.

src/librustc/infer/lattice.rs

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)