Skip to content

Commit f1867c5

Browse files
committed
Rename infer_types to infer_args
1 parent 8b36867 commit f1867c5

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

src/librustc/hir/lowering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,7 +2168,7 @@ impl<'a> LoweringContext<'a> {
21682168
itctx: ImplTraitContext<'_>,
21692169
explicit_owner: Option<NodeId>,
21702170
) -> hir::PathSegment {
2171-
let (mut generic_args, infer_types) = if let Some(ref generic_args) = segment.args {
2171+
let (mut generic_args, infer_args) = if let Some(ref generic_args) = segment.args {
21722172
let msg = "parenthesized type parameters may only be used with a `Fn` trait";
21732173
match **generic_args {
21742174
GenericArgs::AngleBracketed(ref data) => {
@@ -2305,7 +2305,7 @@ impl<'a> LoweringContext<'a> {
23052305
Some(id),
23062306
Some(self.lower_res(res)),
23072307
generic_args,
2308-
infer_types,
2308+
infer_args,
23092309
)
23102310
}
23112311

src/librustc/hir/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ pub struct PathSegment {
348348
/// This only applies to expression and pattern paths, and
349349
/// out of those only the segments with no type parameters
350350
/// to begin with, e.g., `Vec::new` is `<Vec<..>>::new::<..>`.
351-
pub infer_types: bool,
351+
pub infer_args: bool,
352352
}
353353

354354
impl PathSegment {
@@ -358,7 +358,7 @@ impl PathSegment {
358358
ident,
359359
hir_id: None,
360360
res: None,
361-
infer_types: true,
361+
infer_args: true,
362362
args: None,
363363
}
364364
}
@@ -368,13 +368,13 @@ impl PathSegment {
368368
hir_id: Option<HirId>,
369369
res: Option<Res>,
370370
args: GenericArgs,
371-
infer_types: bool,
371+
infer_args: bool,
372372
) -> Self {
373373
PathSegment {
374374
ident,
375375
hir_id,
376376
res,
377-
infer_types,
377+
infer_args,
378378
args: if args.is_empty() {
379379
None
380380
} else {

src/librustc/hir/print.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ impl<'a> State<'a> {
11961196

11971197
segment.with_generic_args(|generic_args| {
11981198
if !generic_args.args.is_empty() || !generic_args.bindings.is_empty() {
1199-
return self.print_generic_args(&generic_args, segment.infer_types, true);
1199+
return self.print_generic_args(&generic_args, segment.infer_args, true);
12001200
}
12011201
Ok(())
12021202
})?;
@@ -1561,7 +1561,7 @@ impl<'a> State<'a> {
15611561
if segment.ident.name != kw::PathRoot {
15621562
self.print_ident(segment.ident)?;
15631563
segment.with_generic_args(|generic_args| {
1564-
self.print_generic_args(generic_args, segment.infer_types,
1564+
self.print_generic_args(generic_args, segment.infer_args,
15651565
colons_before_params)
15661566
})?;
15671567
}
@@ -1574,7 +1574,7 @@ impl<'a> State<'a> {
15741574
if segment.ident.name != kw::PathRoot {
15751575
self.print_ident(segment.ident)?;
15761576
segment.with_generic_args(|generic_args| {
1577-
self.print_generic_args(generic_args, segment.infer_types, false)
1577+
self.print_generic_args(generic_args, segment.infer_args, false)
15781578
})?;
15791579
}
15801580
Ok(())
@@ -1602,7 +1602,7 @@ impl<'a> State<'a> {
16021602
self.print_ident(segment.ident)?;
16031603
segment.with_generic_args(|generic_args| {
16041604
self.print_generic_args(generic_args,
1605-
segment.infer_types,
1605+
segment.infer_args,
16061606
colons_before_params)
16071607
})?;
16081608
}
@@ -1614,7 +1614,7 @@ impl<'a> State<'a> {
16141614
self.print_ident(item_segment.ident)?;
16151615
item_segment.with_generic_args(|generic_args| {
16161616
self.print_generic_args(generic_args,
1617-
item_segment.infer_types,
1617+
item_segment.infer_args,
16181618
colons_before_params)
16191619
})
16201620
}
@@ -1626,7 +1626,7 @@ impl<'a> State<'a> {
16261626
self.print_ident(item_segment.ident)?;
16271627
item_segment.with_generic_args(|generic_args| {
16281628
self.print_generic_args(generic_args,
1629-
item_segment.infer_types,
1629+
item_segment.infer_args,
16301630
colons_before_params)
16311631
})
16321632
}
@@ -1635,7 +1635,7 @@ impl<'a> State<'a> {
16351635

16361636
fn print_generic_args(&mut self,
16371637
generic_args: &hir::GenericArgs,
1638-
infer_types: bool,
1638+
infer_args: bool,
16391639
colons_before_params: bool)
16401640
-> io::Result<()> {
16411641
if generic_args.parenthesized {
@@ -1681,7 +1681,7 @@ impl<'a> State<'a> {
16811681

16821682
// FIXME(eddyb): this would leak into error messages (e.g.,
16831683
// "non-exhaustive patterns: `Some::<..>(_)` not covered").
1684-
if infer_types && false {
1684+
if infer_args && false {
16851685
start_or_comma(self)?;
16861686
self.s.word("..")?;
16871687
}

src/librustc_typeck/astconv.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
191191
span,
192192
def_id,
193193
generic_args,
194-
item_segment.infer_types,
194+
item_segment.infer_args,
195195
None,
196196
)
197197
});
@@ -208,7 +208,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
208208
seg: &hir::PathSegment,
209209
generics: &ty::Generics,
210210
) -> bool {
211-
let explicit = !seg.infer_types;
211+
let explicit = !seg.infer_args;
212212
let impl_trait = generics.params.iter().any(|param| match param.kind {
213213
ty::GenericParamDefKind::Type {
214214
synthetic: Some(hir::SyntheticTyParamKind::ImplTrait), ..
@@ -259,7 +259,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
259259
GenericArgPosition::Value
260260
},
261261
def.parent.is_none() && def.has_self, // `has_self`
262-
seg.infer_types || suppress_mismatch, // `infer_types`
262+
seg.infer_args || suppress_mismatch, // `infer_args`
263263
).0
264264
}
265265

@@ -272,7 +272,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
272272
args: &hir::GenericArgs,
273273
position: GenericArgPosition,
274274
has_self: bool,
275-
infer_types: bool,
275+
infer_args: bool,
276276
) -> (bool, Option<Vec<Span>>) {
277277
// At this stage we are guaranteed that the generic arguments are in the correct order, e.g.
278278
// that lifetimes will proceed types. So it suffices to check the number of each generic
@@ -414,7 +414,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
414414
);
415415
}
416416
// Note that type errors are currently be emitted *after* const errors.
417-
if !infer_types
417+
if !infer_args
418418
|| arg_counts.types > param_counts.types - defaults.types - has_self as usize {
419419
check_kind_count(
420420
"type",
@@ -511,7 +511,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
511511
}
512512

513513
// Check whether this segment takes generic arguments and the user has provided any.
514-
let (generic_args, infer_types) = args_for_def_id(def_id);
514+
let (generic_args, infer_args) = args_for_def_id(def_id);
515515

516516
let mut args = generic_args.iter().flat_map(|generic_args| generic_args.args.iter())
517517
.peekable();
@@ -535,7 +535,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
535535
| (GenericArg::Const(_), GenericParamDefKind::Lifetime) => {
536536
// We expected a lifetime argument, but got a type or const
537537
// argument. That means we're inferring the lifetimes.
538-
substs.push(inferred_kind(None, param, infer_types));
538+
substs.push(inferred_kind(None, param, infer_args));
539539
params.next();
540540
}
541541
(_, _) => {
@@ -556,7 +556,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
556556
(None, Some(&param)) => {
557557
// If there are fewer arguments than parameters, it means
558558
// we're inferring the remaining arguments.
559-
substs.push(inferred_kind(Some(&substs), param, infer_types));
559+
substs.push(inferred_kind(Some(&substs), param, infer_args));
560560
args.next();
561561
params.next();
562562
}
@@ -592,7 +592,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
592592
span: Span,
593593
def_id: DefId,
594594
generic_args: &'a hir::GenericArgs,
595-
infer_types: bool,
595+
infer_args: bool,
596596
self_ty: Option<Ty<'tcx>>)
597597
-> (SubstsRef<'tcx>, Vec<ConvertedBinding<'tcx>>, Option<Vec<Span>>)
598598
{
@@ -617,7 +617,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
617617
&generic_args,
618618
GenericArgPosition::Type,
619619
has_self,
620-
infer_types,
620+
infer_args,
621621
);
622622

623623
let is_object = self_ty.map_or(false, |ty| {
@@ -644,7 +644,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
644644
self_ty.is_some(),
645645
self_ty,
646646
// Provide the generic args, and whether types should be inferred.
647-
|_| (Some(generic_args), infer_types),
647+
|_| (Some(generic_args), infer_args),
648648
// Provide substitutions for parameters for which (valid) arguments have been provided.
649649
|param, arg| {
650650
match (&param.kind, arg) {
@@ -661,11 +661,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
661661
}
662662
},
663663
// Provide substitutions for parameters for which arguments are inferred.
664-
|substs, param, infer_types| {
664+
|substs, param, infer_args| {
665665
match param.kind {
666666
GenericParamDefKind::Lifetime => tcx.lifetimes.re_static.into(),
667667
GenericParamDefKind::Type { has_default, .. } => {
668-
if !infer_types && has_default {
668+
if !infer_args && has_default {
669669
// No type parameter provided, but a default exists.
670670

671671
// If we are converting an object type, then the
@@ -693,7 +693,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
693693
.subst_spanned(tcx, substs.unwrap(), Some(span))
694694
).into()
695695
}
696-
} else if infer_types {
696+
} else if infer_args {
697697
// No type parameters were provided, we can infer all.
698698
if !default_needs_object_self(param) {
699699
self.ty_infer_for_def(param, span).into()
@@ -880,7 +880,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
880880
self.create_substs_for_ast_path(span,
881881
trait_def_id,
882882
generic_args,
883-
trait_segment.infer_types,
883+
trait_segment.infer_args,
884884
Some(self_ty))
885885
})
886886
}

src/librustc_typeck/check/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5419,10 +5419,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
54195419
if !infer_args_for_err.contains(&index) {
54205420
// Check whether the user has provided generic arguments.
54215421
if let Some(ref data) = segments[index].args {
5422-
return (Some(data), segments[index].infer_types);
5422+
return (Some(data), segments[index].infer_args);
54235423
}
54245424
}
5425-
return (None, segments[index].infer_types);
5425+
return (None, segments[index].infer_args);
54265426
}
54275427

54285428
(None, true)
@@ -5443,13 +5443,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
54435443
}
54445444
},
54455445
// Provide substitutions for parameters for which arguments are inferred.
5446-
|substs, param, infer_types| {
5446+
|substs, param, infer_args| {
54475447
match param.kind {
54485448
GenericParamDefKind::Lifetime => {
54495449
self.re_infer(span, Some(param)).unwrap().into()
54505450
}
54515451
GenericParamDefKind::Type { has_default, .. } => {
5452-
if !infer_types && has_default {
5452+
if !infer_args && has_default {
54535453
// If we have a default, then we it doesn't matter that we're not
54545454
// inferring the type arguments: we provide the default where any
54555455
// is missing.

0 commit comments

Comments
 (0)