forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#110272 - Ezrashaw:fix-unconned-lt-in-implbo…
…unds, r=aliemjay fix: skip implied bounds if unconstrained lifetime exists Fixes rust-lang#110161 r? `@aliemjay`
- Loading branch information
Showing
3 changed files
with
50 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,26 @@ | ||
// ICE regression relating to unconstrained lifetimes in implied | ||
// bounds. See #110161. | ||
|
||
// compile-flags: --crate-type=lib | ||
|
||
trait LtTrait { | ||
type Ty; | ||
} | ||
|
||
// erroneous `Ty` impl | ||
impl LtTrait for () { | ||
//~^ ERROR not all trait items implemented, missing: `Ty` [E0046] | ||
} | ||
|
||
// `'lt` is not constrained by the erroneous `Ty` | ||
impl<'lt, T> LtTrait for Box<T> | ||
where | ||
T: LtTrait<Ty = &'lt ()>, | ||
{ | ||
type Ty = &'lt (); | ||
} | ||
|
||
// unconstrained lifetime appears in implied bounds | ||
fn test(_: <Box<()> as LtTrait>::Ty) {} | ||
|
||
fn test2<'x>(_: &'x <Box<()> as LtTrait>::Ty) {} |
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,12 @@ | ||
error[E0046]: not all trait items implemented, missing: `Ty` | ||
--> $DIR/issue-110161.rs:11:1 | ||
| | ||
LL | type Ty; | ||
| ------- `Ty` from trait | ||
... | ||
LL | impl LtTrait for () { | ||
| ^^^^^^^^^^^^^^^^^^^ missing `Ty` in implementation | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0046`. |