forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#119744 - lcnr:assemble-only-rigid, r=compiler…
…-errors only assemble alias bound candidates for rigid aliases fixes rust-lang/trait-system-refactor-initiative#77 This also causes `<Wrapper<?0> as Trait>::Unwrap: Trait` to always be ambig, as we now normalize the self type before checking whether it is an inference variable. I cannot think of an approach to the underlying issues here which does not require the "may-define means must-define" restriction for opaque types. Going to go ahead with this and added this restriction to the tracking issue for the new solver to make sure we don't stabilize it without getting types + lang signoff here. r? `@compiler-errors`
- Loading branch information
Showing
15 changed files
with
168 additions
and
218 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
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
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
19 changes: 19 additions & 0 deletions
19
tests/ui/traits/next-solver/assembly/ambig-projection-self-is-ambig.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,19 @@ | ||
// check-pass | ||
// compile-flags: -Znext-solver | ||
|
||
trait Reader: Default { | ||
fn read_u8_array<A>(&self) -> Result<A, ()> { | ||
todo!() | ||
} | ||
|
||
fn read_u8(&self) -> Result<u8, ()> { | ||
let a: [u8; 1] = self.read_u8_array::<_>()?; | ||
// This results in a nested `<Result<?0, ()> as Try>::Residual: Sized` goal. | ||
// The self type normalizes to `?0`. We previously did not force that to be | ||
// ambiguous but instead incompletely applied the `Self: Sized` candidate | ||
// from the `ParamEnv`, resulting in a type error. | ||
Ok(a[0]) | ||
} | ||
} | ||
|
||
fn main() {} |
Oops, something went wrong.