forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for ice rust-lang#90691 ICE: resolution failed during buildi…
…ng vtable representation Fixes rust-lang#90691
- Loading branch information
1 parent
f44ee8f
commit 5ae9025
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
.../ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.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,41 @@ | ||
// ICE #90691 Encountered error `Unimplemented` selecting ... | ||
//@ build-pass | ||
|
||
trait TError: std::fmt::Debug {} | ||
impl TError for () {} | ||
|
||
trait SuperTrait { | ||
type Error; | ||
} | ||
|
||
trait Trait: SuperTrait<Error: TError> {} | ||
|
||
impl<T> Trait for T | ||
where | ||
T: SuperTrait, | ||
<T as SuperTrait>::Error: TError, | ||
{ | ||
} | ||
|
||
struct SomeTrait<S>(S); | ||
struct BoxedTrait(Box<dyn Trait<Error = ()>>); | ||
|
||
impl<S: 'static> From<SomeTrait<S>> for BoxedTrait { | ||
fn from(other: SomeTrait<S>) -> Self { | ||
Self(Box::new(other)) | ||
} | ||
} | ||
|
||
impl<S> SuperTrait for SomeTrait<S> { | ||
type Error = (); | ||
} | ||
|
||
impl From<()> for BoxedTrait { | ||
fn from(c: ()) -> Self { | ||
Self::from(SomeTrait(c)) | ||
} | ||
} | ||
|
||
fn main() { | ||
let _: BoxedTrait = ().into(); | ||
} |