Don't expect early-bound region to be local in RPITIT well-formedness
This commit is contained in:
parent
037f515caf
commit
d9cd0d4d11
@ -1193,7 +1193,7 @@ pub fn is_suitable_region(self, mut region: Region<'tcx>) -> Option<FreeRegionIn
|
|||||||
let (suitable_region_binding_scope, bound_region) = loop {
|
let (suitable_region_binding_scope, bound_region) = loop {
|
||||||
let def_id = match region.kind() {
|
let def_id = match region.kind() {
|
||||||
ty::ReLateParam(fr) => fr.bound_region.get_id()?.as_local()?,
|
ty::ReLateParam(fr) => fr.bound_region.get_id()?.as_local()?,
|
||||||
ty::ReEarlyParam(ebr) => ebr.def_id.expect_local(),
|
ty::ReEarlyParam(ebr) => ebr.def_id.as_local()?,
|
||||||
_ => return None, // not a free region
|
_ => return None, // not a free region
|
||||||
};
|
};
|
||||||
let scope = self.local_parent(def_id);
|
let scope = self.local_parent(def_id);
|
||||||
|
7
tests/ui/async-await/in-trait/auxiliary/bad-region.rs
Normal file
7
tests/ui/async-await/in-trait/auxiliary/bad-region.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// edition:2021
|
||||||
|
|
||||||
|
#[allow(async_fn_in_trait)]
|
||||||
|
|
||||||
|
pub trait BleRadio<'a> {
|
||||||
|
async fn transmit(&mut self);
|
||||||
|
}
|
17
tests/ui/async-await/in-trait/bad-region.rs
Normal file
17
tests/ui/async-await/in-trait/bad-region.rs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// aux-build:bad-region.rs
|
||||||
|
// edition:2021
|
||||||
|
|
||||||
|
#![allow(async_fn_in_trait)]
|
||||||
|
|
||||||
|
extern crate bad_region as jewel;
|
||||||
|
|
||||||
|
use jewel::BleRadio;
|
||||||
|
|
||||||
|
pub struct Radio {}
|
||||||
|
|
||||||
|
impl BleRadio for Radio {
|
||||||
|
//~^ ERROR implicit elided lifetime not allowed here
|
||||||
|
async fn transmit(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
14
tests/ui/async-await/in-trait/bad-region.stderr
Normal file
14
tests/ui/async-await/in-trait/bad-region.stderr
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
error[E0726]: implicit elided lifetime not allowed here
|
||||||
|
--> $DIR/bad-region.rs:12:6
|
||||||
|
|
|
||||||
|
LL | impl BleRadio for Radio {
|
||||||
|
| ^^^^^^^^ expected lifetime parameter
|
||||||
|
|
|
||||||
|
help: indicate the anonymous lifetime
|
||||||
|
|
|
||||||
|
LL | impl BleRadio<'_> for Radio {
|
||||||
|
| ++++
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0726`.
|
Loading…
Reference in New Issue
Block a user