File tree 4 files changed +39
-1
lines changed
compiler/rustc_middle/src/ty
tests/ui/async-await/in-trait
4 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -1193,7 +1193,7 @@ impl<'tcx> TyCtxt<'tcx> {
1193
1193
let ( suitable_region_binding_scope, bound_region) = loop {
1194
1194
let def_id = match region. kind ( ) {
1195
1195
ty:: ReLateParam ( fr) => fr. bound_region . get_id ( ) ?. as_local ( ) ?,
1196
- ty:: ReEarlyParam ( ebr) => ebr. def_id . expect_local ( ) ,
1196
+ ty:: ReEarlyParam ( ebr) => ebr. def_id . as_local ( ) ? ,
1197
1197
_ => return None , // not a free region
1198
1198
} ;
1199
1199
let scope = self . local_parent ( def_id) ;
Original file line number Diff line number Diff line change
1
+ // edition:2021
2
+
3
+ #[ allow( async_fn_in_trait) ]
4
+
5
+ pub trait BleRadio < ' a > {
6
+ async fn transmit ( & mut self ) ;
7
+ }
Original file line number Diff line number Diff line change
1
+ // aux-build:bad-region.rs
2
+ // edition:2021
3
+
4
+ #![ allow( async_fn_in_trait) ]
5
+
6
+ extern crate bad_region as jewel;
7
+
8
+ use jewel:: BleRadio ;
9
+
10
+ pub struct Radio { }
11
+
12
+ impl BleRadio for Radio {
13
+ //~^ ERROR implicit elided lifetime not allowed here
14
+ async fn transmit ( & mut self ) { }
15
+ }
16
+
17
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0726]: implicit elided lifetime not allowed here
2
+ --> $DIR/bad-region.rs:12:6
3
+ |
4
+ LL | impl BleRadio for Radio {
5
+ | ^^^^^^^^ expected lifetime parameter
6
+ |
7
+ help: indicate the anonymous lifetime
8
+ |
9
+ LL | impl BleRadio<'_> for Radio {
10
+ | ++++
11
+
12
+ error: aborting due to 1 previous error
13
+
14
+ For more information about this error, try `rustc --explain E0726`.
You can’t perform that action at this time.
0 commit comments