Fix tests and AstConv -> dyn AstConv

This commit is contained in:
Jack Huey 2021-03-25 12:15:45 -04:00
parent 4ff65ec782
commit 0c98dc66fd
5 changed files with 20 additions and 21 deletions

View file

@ -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)
<dyn AstConv<'_>>::ast_ty_to_ty(&item_cx, hir_ty)
}
pub fn hir_trait_to_predicates<'tcx>(

View file

@ -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() {}

View file

@ -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`.

View file

@ -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
}

View file

@ -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 <https://github.com/rust-lang/rust/issues/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`.