forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#120707 - compiler-errors:suitable-region, r…
…=nnethercote Don't expect early-bound region to be local when reporting errors in RPITIT well-formedness The implicit lifetime in the example code gets replaced with `ReError`, which fails a `sub_regions` check in the lexical region solver. Error reporting ends up calling `is_suitable_region` on an early bound region in the *trait* definition. This causes an ICE because we `expect_local()`. This is kind of a bad explanation, but this code just makes diagnostics reporting a bit more gracefully fallible. If the reviewer wants a thorough investigation of exactly where we get this region outlives obligation, I can write one up. Doesn't really seem worth it, though, imo. Fixes rust-lang#120638 Fixes rust-lang#120648
- Loading branch information
Showing
4 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// edition:2021 | ||
|
||
#[allow(async_fn_in_trait)] | ||
|
||
pub trait BleRadio<'a> { | ||
async fn transmit(&mut self); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |