Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Account for non-types in substs for opaque type error messages
Fixes #68368 Previously, I assumed that the substs contained only types, which caused the computed index number to be wrong.
- Loading branch information
Showing
3 changed files
with
36 additions
and
2 deletions.
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
13 changes: 13 additions & 0 deletions
13
src/test/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs
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,13 @@ | ||
// Regression test for issue #68368 | ||
// Ensures that we don't ICE when emitting an error | ||
// for a non-defining use when lifetimes are involved | ||
|
||
#![feature(type_alias_impl_trait)] | ||
trait Trait<T> {} | ||
type Alias<'a, U> = impl Trait<U>; //~ ERROR could not find defining uses | ||
fn f<'a>() -> Alias<'a, ()> {} | ||
//~^ ERROR defining opaque type use does not fully define opaque type: generic parameter `U` | ||
|
||
fn main() {} | ||
|
||
impl Trait<()> for () {} |
14 changes: 14 additions & 0 deletions
14
src/test/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr
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: defining opaque type use does not fully define opaque type: generic parameter `U` is specified as concrete type `()` | ||
--> $DIR/issue-68368-non-defining-use.rs:8:1 | ||
| | ||
LL | fn f<'a>() -> Alias<'a, ()> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: could not find defining uses | ||
--> $DIR/issue-68368-non-defining-use.rs:7:1 | ||
| | ||
LL | type Alias<'a, U> = impl Trait<U>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|