From 0c98dc66fdc1bd5a2ff56bc72c67b03c2d376cd0 Mon Sep 17 00:00:00 2001 From: Jack Huey Date: Thu, 25 Mar 2021 12:15:45 -0400 Subject: [PATCH] Fix tests and AstConv -> dyn AstConv --- compiler/rustc_typeck/src/lib.rs | 2 +- .../no_introducing_in_band_in_locals.rs | 2 +- .../no_introducing_in_band_in_locals.stderr | 18 +++++++++++++++++- .../method-call-lifetime-args-unresolved.rs | 2 -- ...method-call-lifetime-args-unresolved.stderr | 17 +---------------- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/compiler/rustc_typeck/src/lib.rs b/compiler/rustc_typeck/src/lib.rs index 4244d37232f2..190744fe6f1d 100644 --- a/compiler/rustc_typeck/src/lib.rs +++ b/compiler/rustc_typeck/src/lib.rs @@ -430,7 +430,7 @@ pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty<'_>) -> Ty<'tcx> { let env_node_id = tcx.hir().get_parent_item(hir_ty.hir_id); let env_def_id = tcx.hir().local_def_id(env_node_id); let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id.to_def_id()); - AstConv::ast_ty_to_ty(&item_cx, hir_ty) + >::ast_ty_to_ty(&item_cx, hir_ty) } pub fn hir_trait_to_predicates<'tcx>( diff --git a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs index 3b407871e37e..c1c40afdbab5 100644 --- a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs +++ b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs @@ -7,7 +7,7 @@ fn foo(x: &u32) { fn foo2(x: &u32) {} fn bar() { - let y: fn(&'test u32) = foo2; + let y: fn(&'test u32) = foo2; //~ ERROR use of undeclared lifetime } fn main() {} diff --git a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr index 7ecb6ff0c9da..a43b49041ec2 100644 --- a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr +++ b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr @@ -6,6 +6,22 @@ LL | fn foo(x: &u32) { LL | let y: &'test u32 = x; | ^^^^^ undeclared lifetime -error: aborting due to previous error +error[E0261]: use of undeclared lifetime name `'test` + --> $DIR/no_introducing_in_band_in_locals.rs:10:16 + | +LL | let y: fn(&'test u32) = foo2; + | ^^^^^ undeclared lifetime + | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider introducing lifetime `'test` here + | +LL | fn bar<'test>() { + | ^^^^^^^ +help: consider making the type lifetime-generic with a new `'test` lifetime + | +LL | let y: for<'test> fn(&'test u32) = foo2; + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0261`. diff --git a/src/test/ui/methods/method-call-lifetime-args-unresolved.rs b/src/test/ui/methods/method-call-lifetime-args-unresolved.rs index d7760985ec6f..d16ba3df47b6 100644 --- a/src/test/ui/methods/method-call-lifetime-args-unresolved.rs +++ b/src/test/ui/methods/method-call-lifetime-args-unresolved.rs @@ -1,5 +1,3 @@ fn main() { 0.clone::<'a>(); //~ ERROR use of undeclared lifetime name `'a` - //~^ WARNING cannot specify lifetime arguments - //~| WARNING this was previously accepted } diff --git a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr index 5a958bc4b9c3..93c0384fcc26 100644 --- a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr @@ -1,18 +1,3 @@ -warning: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-unresolved.rs:2:15 - | -LL | 0.clone::<'a>(); - | ^^ - | - ::: $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | fn clone(&self) -> Self; - | - the late bound lifetime parameter is introduced here - | - = note: `#[warn(late_bound_lifetime_arguments)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #42868 - error[E0261]: use of undeclared lifetime name `'a` --> $DIR/method-call-lifetime-args-unresolved.rs:2:15 | @@ -23,6 +8,6 @@ LL | 0.clone::<'a>(); | = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0261`.