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.
Unconditionally register alias-relate in projection goal
- Loading branch information
1 parent
56d25ba
commit d33eb34
Showing
4 changed files
with
71 additions
and
13 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
21 changes: 21 additions & 0 deletions
21
tests/ui/traits/new-solver/closure-signature-inference-2.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,21 @@ | ||
// compile-flags: -Ztrait-solver=next | ||
// check-pass | ||
|
||
fn map<T: Default, U, F: FnOnce(T) -> U>(f: F) { | ||
f(T::default()); | ||
} | ||
|
||
fn main() { | ||
map::<i32, _ /* ?U */, _ /* ?F */>(|x| x.to_string()); | ||
// PREVIOUSLY when confirming the `map` call, we register: | ||
// | ||
// (1.) ?F: FnOnce<(i32,)> | ||
// (2.) <?F as FnOnce<(i32,)>>::Output projects-to ?U | ||
// | ||
// While (1.) is ambiguous, (2.) immediately gets processed | ||
// and we infer `?U := <?F as FnOnce<(i32,)>>::Output`. | ||
// | ||
// Thus, the only pending obligation that remains is (1.). | ||
// Since it is a trait obligation, we don't use it to deduce | ||
// the closure signature, and we fail! | ||
} |
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,15 @@ | ||
// compile-flags: -Ztrait-solver=next | ||
// check-pass | ||
|
||
struct A; | ||
impl A { | ||
fn hi(self) {} | ||
} | ||
|
||
fn hello() -> Result<(A,), ()> { | ||
Err(()) | ||
} | ||
|
||
fn main() { | ||
let x = hello().map(|(x,)| x.hi()); | ||
} |
14 changes: 12 additions & 2 deletions
14
tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.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