Skip to content

Commit 0c98dc6

Browse files
committed
Fix tests and AstConv -> dyn AstConv
1 parent 4ff65ec commit 0c98dc6

File tree

5 files changed

+20
-21
lines changed

5 files changed

+20
-21
lines changed

compiler/rustc_typeck/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty<'_>) -> Ty<'tcx> {
430430
let env_node_id = tcx.hir().get_parent_item(hir_ty.hir_id);
431431
let env_def_id = tcx.hir().local_def_id(env_node_id);
432432
let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id.to_def_id());
433-
AstConv::ast_ty_to_ty(&item_cx, hir_ty)
433+
<dyn AstConv<'_>>::ast_ty_to_ty(&item_cx, hir_ty)
434434
}
435435

436436
pub fn hir_trait_to_predicates<'tcx>(

src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fn foo(x: &u32) {
77

88
fn foo2(x: &u32) {}
99
fn bar() {
10-
let y: fn(&'test u32) = foo2;
10+
let y: fn(&'test u32) = foo2; //~ ERROR use of undeclared lifetime
1111
}
1212

1313
fn main() {}

src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr

+17-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ LL | fn foo(x: &u32) {
66
LL | let y: &'test u32 = x;
77
| ^^^^^ undeclared lifetime
88

9-
error: aborting due to previous error
9+
error[E0261]: use of undeclared lifetime name `'test`
10+
--> $DIR/no_introducing_in_band_in_locals.rs:10:16
11+
|
12+
LL | let y: fn(&'test u32) = foo2;
13+
| ^^^^^ undeclared lifetime
14+
|
15+
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
16+
help: consider introducing lifetime `'test` here
17+
|
18+
LL | fn bar<'test>() {
19+
| ^^^^^^^
20+
help: consider making the type lifetime-generic with a new `'test` lifetime
21+
|
22+
LL | let y: for<'test> fn(&'test u32) = foo2;
23+
| ^^^^^^^^^^
24+
25+
error: aborting due to 2 previous errors
1026

1127
For more information about this error, try `rustc --explain E0261`.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
fn main() {
22
0.clone::<'a>(); //~ ERROR use of undeclared lifetime name `'a`
3-
//~^ WARNING cannot specify lifetime arguments
4-
//~| WARNING this was previously accepted
53
}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
warning: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
2-
--> $DIR/method-call-lifetime-args-unresolved.rs:2:15
3-
|
4-
LL | 0.clone::<'a>();
5-
| ^^
6-
|
7-
::: $SRC_DIR/core/src/clone.rs:LL:COL
8-
|
9-
LL | fn clone(&self) -> Self;
10-
| - the late bound lifetime parameter is introduced here
11-
|
12-
= note: `#[warn(late_bound_lifetime_arguments)]` on by default
13-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
14-
= note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
15-
161
error[E0261]: use of undeclared lifetime name `'a`
172
--> $DIR/method-call-lifetime-args-unresolved.rs:2:15
183
|
@@ -23,6 +8,6 @@ LL | 0.clone::<'a>();
238
|
249
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
2510

26-
error: aborting due to previous error; 1 warning emitted
11+
error: aborting due to previous error
2712

2813
For more information about this error, try `rustc --explain E0261`.

0 commit comments

Comments
 (0)