-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
2ecba0f
commit 929d632
Showing
6 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/next-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: -Znext-solver | ||
// 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! | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/ui/traits/next-solver/closure-signature-inference.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,15 @@ | ||
// compile-flags: -Znext-solver | ||
// 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/next-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
File renamed without changes.
File renamed without changes.