-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bivariant alias: set
has_unconstrained_ty_var
- Loading branch information
Showing
2 changed files
with
30 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,20 @@ | ||
//@ revisions: old next | ||
//@[next] compile-flags: -Znext-solver | ||
//@ ignore-compare-mode-next-solver (explicit revisions) | ||
//@ check-pass | ||
|
||
// When generalizing an alias in a bivariant context, we have to set | ||
// `has_unconstrained_ty_var` as we may otherwise never check for | ||
// well-formedness of the generalized type, causing us to error due | ||
// to ambiguity. | ||
trait Trait { | ||
type Assoc; | ||
} | ||
|
||
struct BivariantArg<I, T: Trait<Assoc = I>>(T); | ||
|
||
fn generalize<T: Trait>(input: BivariantArg<T::Assoc, T>) { | ||
let _generalized = input; | ||
} | ||
|
||
pub fn main() {} |