Skip to content

Commit d4a62a7

Browse files
authored
Rollup merge of #58722 - Centril:deny-elided_lifetimes_in_paths-librustc_typeck, r=oli-obk
librustc_typeck: deny(elided_lifetimes_in_paths) As part of the Rust 2018 transition, remove `#![allow(elided_lifetimes_in_paths)]` from `librustc_typeck`. r? @oli-obk
2 parents 2a69aec + e8ce56f commit d4a62a7

22 files changed

+59
-53
lines changed

src/librustc_typeck/astconv.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
196196

197197
/// Report error if there is an explicit type parameter when using `impl Trait`.
198198
fn check_impl_trait(
199-
tcx: TyCtxt,
199+
tcx: TyCtxt<'_, '_, '_>,
200200
span: Span,
201201
seg: &hir::PathSegment,
202202
generics: &ty::Generics,
@@ -227,7 +227,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
227227
/// Checks that the correct number of generic arguments have been provided.
228228
/// Used specifically for function calls.
229229
pub fn check_generic_arg_count_for_call(
230-
tcx: TyCtxt,
230+
tcx: TyCtxt<'_, '_, '_>,
231231
span: Span,
232232
def: &ty::Generics,
233233
seg: &hir::PathSegment,
@@ -259,7 +259,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
259259
/// Checks that the correct number of generic arguments have been provided.
260260
/// This is used both for datatypes and function calls.
261261
fn check_generic_arg_count(
262-
tcx: TyCtxt,
262+
tcx: TyCtxt<'_, '_, '_>,
263263
span: Span,
264264
def: &ty::Generics,
265265
args: &hir::GenericArgs,
@@ -1502,7 +1502,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
15021502
has_err
15031503
}
15041504

1505-
pub fn prohibit_assoc_ty_binding(tcx: TyCtxt, span: Span) {
1505+
pub fn prohibit_assoc_ty_binding(tcx: TyCtxt<'_, '_, '_>, span: Span) {
15061506
let mut err = struct_span_err!(tcx.sess, span, E0229,
15071507
"associated type bindings are not allowed here");
15081508
err.span_label(span, "associated type not allowed here").emit();

src/librustc_typeck/check/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
183183
let rhs_ty = self.check_expr(end);
184184

185185
// Check that both end-points are of numeric or char type.
186-
let numeric_or_char = |ty: Ty| ty.is_numeric() || ty.is_char();
186+
let numeric_or_char = |ty: Ty<'_>| ty.is_numeric() || ty.is_char();
187187
let lhs_compat = numeric_or_char(lhs_ty);
188188
let rhs_compat = numeric_or_char(rhs_ty);
189189

src/librustc_typeck/check/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rustc::hir;
1818
/// Checks that it is legal to call methods of the trait corresponding
1919
/// to `trait_id` (this only cares about the trait, not the specific
2020
/// method that is called).
21-
pub fn check_legal_trait_for_method_call(tcx: TyCtxt, span: Span, trait_id: DefId) {
21+
pub fn check_legal_trait_for_method_call(tcx: TyCtxt<'_, '_, '_>, span: Span, trait_id: DefId) {
2222
if tcx.lang_items().drop_trait() == Some(trait_id) {
2323
struct_span_err!(tcx.sess, span, E0040, "explicit use of destructor method")
2424
.span_label(span, "explicit destructor calls not allowed")

src/librustc_typeck/check/closure.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
574574
expr_def_id: DefId,
575575
decl: &hir::FnDecl,
576576
) -> ty::PolyFnSig<'tcx> {
577-
let astconv: &dyn AstConv = self;
577+
let astconv: &dyn AstConv<'_, '_> = self;
578578

579579
// First, convert the types that the user supplied (if any).
580580
let supplied_arguments = decl.inputs.iter().map(|a| astconv.ast_ty_to_ty(a));
@@ -606,7 +606,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
606606
/// so should yield an error, but returns back a signature where
607607
/// all parameters are of type `TyErr`.
608608
fn error_sig_of_closure(&self, decl: &hir::FnDecl) -> ty::PolyFnSig<'tcx> {
609-
let astconv: &dyn AstConv = self;
609+
let astconv: &dyn AstConv<'_, '_> = self;
610610

611611
let supplied_arguments = decl.inputs.iter().map(|a| {
612612
// Convert the types that the user supplied (if any), but ignore them.

src/librustc_typeck/check/coercion.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn coerce_mutbls<'tcx>(from_mutbl: hir::Mutability,
101101
}
102102
}
103103

104-
fn identity(_: Ty) -> Vec<Adjustment> { vec![] }
104+
fn identity(_: Ty<'_>) -> Vec<Adjustment<'_>> { vec![] }
105105

106106
fn simple<'tcx>(kind: Adjust<'tcx>) -> impl FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>> {
107107
move |target| vec![Adjustment { kind, target }]
@@ -1084,7 +1084,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E>
10841084
pub fn coerce_forced_unit<'a>(&mut self,
10851085
fcx: &FnCtxt<'a, 'gcx, 'tcx>,
10861086
cause: &ObligationCause<'tcx>,
1087-
augment_error: &mut dyn FnMut(&mut DiagnosticBuilder),
1087+
augment_error: &mut dyn FnMut(&mut DiagnosticBuilder<'_>),
10881088
label_unit_as_expected: bool)
10891089
{
10901090
self.coerce_inner(fcx,
@@ -1103,7 +1103,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E>
11031103
cause: &ObligationCause<'tcx>,
11041104
expression: Option<&'gcx hir::Expr>,
11051105
mut expression_ty: Ty<'tcx>,
1106-
augment_error: Option<&mut dyn FnMut(&mut DiagnosticBuilder)>,
1106+
augment_error: Option<&mut dyn FnMut(&mut DiagnosticBuilder<'_>)>,
11071107
label_expression_as_expected: bool)
11081108
{
11091109
// Incorporate whatever type inference information we have

src/librustc_typeck/check/compare_method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ fn check_region_bounds_on_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
408408

409409
fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>,
410410
param_env: ty::ParamEnv<'tcx>,
411-
terr: &TypeError,
411+
terr: &TypeError<'_>,
412412
cause: &ObligationCause<'tcx>,
413413
impl_m: &ty::AssociatedItem,
414414
impl_sig: ty::FnSig<'tcx>,

src/librustc_typeck/check/demand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
544544
};
545545

546546
let into_sugg = into_suggestion.clone();
547-
let suggest_to_change_suffix_or_into = |err: &mut DiagnosticBuilder,
547+
let suggest_to_change_suffix_or_into = |err: &mut DiagnosticBuilder<'_>,
548548
note: Option<&str>| {
549549
let suggest_msg = if literal_is_ty_suffixed(expr) {
550550
format!(

src/librustc_typeck/check/method/confirm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
598598
})
599599
}
600600

601-
fn enforce_illegal_method_limitations(&self, pick: &probe::Pick) {
601+
fn enforce_illegal_method_limitations(&self, pick: &probe::Pick<'_>) {
602602
// Disallow calls to the method `drop` defined in the `Drop` trait.
603603
match pick.item.container {
604604
ty::TraitContainer(trait_def_id) => {

src/librustc_typeck/check/method/probe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
388388
}
389389
}
390390

391-
pub fn provide(providers: &mut ty::query::Providers) {
391+
pub fn provide(providers: &mut ty::query::Providers<'_>) {
392392
providers.method_autoderef_steps = method_autoderef_steps;
393393
}
394394

@@ -1180,7 +1180,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
11801180

11811181
fn emit_unstable_name_collision_hint(
11821182
&self,
1183-
stable_pick: &Pick,
1183+
stable_pick: &Pick<'_>,
11841184
unstable_candidates: &[(&Candidate<'tcx>, Symbol)],
11851185
) {
11861186
let mut diag = self.tcx.struct_span_lint_hir(

src/librustc_typeck/check/method/suggest.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
7272
return;
7373
}
7474

75-
let report_candidates = |err: &mut DiagnosticBuilder, mut sources: Vec<CandidateSource>| {
75+
let report_candidates = |err: &mut DiagnosticBuilder<'_>,
76+
mut sources: Vec<CandidateSource>| {
7677
sources.sort();
7778
sources.dedup();
7879
// Dynamic limit to avoid hiding just one candidate, which is silly.
@@ -497,7 +498,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
497498
}
498499

499500
fn suggest_use_candidates(&self,
500-
err: &mut DiagnosticBuilder,
501+
err: &mut DiagnosticBuilder<'_>,
501502
mut msg: String,
502503
candidates: Vec<DefId>) {
503504
let module_did = self.tcx.hir().get_module_parent_by_hir_id(self.body_id);
@@ -549,7 +550,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
549550
}
550551

551552
fn suggest_valid_traits(&self,
552-
err: &mut DiagnosticBuilder,
553+
err: &mut DiagnosticBuilder<'_>,
553554
valid_out_of_scope_traits: Vec<DefId>) -> bool {
554555
if !valid_out_of_scope_traits.is_empty() {
555556
let mut candidates = valid_out_of_scope_traits;
@@ -577,7 +578,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
577578
}
578579

579580
fn suggest_traits_to_import<'b>(&self,
580-
err: &mut DiagnosticBuilder,
581+
err: &mut DiagnosticBuilder<'_>,
581582
span: Span,
582583
rcvr_ty: Ty<'tcx>,
583584
item_name: ast::Ident,
@@ -648,8 +649,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
648649
fn type_derefs_to_local(&self,
649650
span: Span,
650651
rcvr_ty: Ty<'tcx>,
651-
source: SelfSource) -> bool {
652-
fn is_local(ty: Ty) -> bool {
652+
source: SelfSource<'_>) -> bool {
653+
fn is_local(ty: Ty<'_>) -> bool {
653654
match ty.sty {
654655
ty::Adt(def, _) => def.did.is_local(),
655656
ty::Foreign(did) => did.is_local(),
@@ -749,7 +750,7 @@ fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec<DefId>
749750
// Cross-crate:
750751

751752
let mut external_mods = FxHashSet::default();
752-
fn handle_external_def(tcx: TyCtxt,
753+
fn handle_external_def(tcx: TyCtxt<'_, '_, '_>,
753754
traits: &mut Vec<DefId>,
754755
external_mods: &mut FxHashSet<DefId>,
755756
def: Def) {
@@ -779,7 +780,7 @@ fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec<DefId>
779780
traits
780781
}
781782

782-
pub fn provide(providers: &mut ty::query::Providers) {
783+
pub fn provide(providers: &mut ty::query::Providers<'_>) {
783784
providers.all_traits = |tcx, cnum| {
784785
assert_eq!(cnum, LOCAL_CRATE);
785786
Lrc::new(compute_all_traits(tcx))

0 commit comments

Comments
 (0)