-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Structurallyresolve adts and tuples expectations too
- Loading branch information
1 parent
a1eceec
commit 2a8f080
Showing
2 changed files
with
34 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
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,32 @@ | ||
//@ compile-flags: -Znext-solver | ||
//@ check-pass | ||
|
||
// Makes sure we structurally normalize before trying to use expectation to guide | ||
// coercion in adt and tuples. | ||
|
||
use std::any::Any; | ||
|
||
trait Coerce { | ||
type Assoc; | ||
} | ||
|
||
struct TupleGuidance; | ||
impl Coerce for TupleGuidance { | ||
type Assoc = (&'static dyn Any,); | ||
} | ||
|
||
struct AdtGuidance; | ||
impl Coerce for AdtGuidance { | ||
type Assoc = Adt<&'static dyn Any>; | ||
} | ||
|
||
struct Adt<T> { | ||
f: T, | ||
} | ||
|
||
fn foo<'a, T: Coerce>(_: T::Assoc) {} | ||
|
||
fn main() { | ||
foo::<TupleGuidance>((&0u32,)); | ||
foo::<AdtGuidance>(Adt { f: &0u32 }); | ||
} |