-
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.
Rollup merge of #107786 - compiler-errors:new-solver-some-tweaks, r=lcnr
Implement some tweaks in the new solver I've been testing the new solver on some small codebases, and these are a few small changes I've needed to make. The most "controversial" here is implementing `trait_candidate_should_be_dropped_in_favor_of`, which I just implemented to always return false. This surprisingly allows some code to compile, without us having to actually decide on any semantics yet. r? `@rust-lang/initiative-trait-system-refactor`
- Loading branch information
Showing
8 changed files
with
129 additions
and
144 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// compile-flags: -Ztrait-solver=next | ||
// check-pass | ||
|
||
trait Foo { | ||
type Bar: Bar; | ||
} | ||
|
||
trait Bar: Baz {} | ||
|
||
trait Baz {} | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
error: the compiler unexpectedly panicked. this is a bug. | ||
error[E0283]: type annotations needed: cannot satisfy `Bar<T>: Coinductive` | ||
--> $DIR/provisional-result-done.rs:16:25 | ||
| | ||
LL | impl<T> Coinductive for Bar<T> | ||
| ^^^^^^ | ||
| | ||
= note: cannot satisfy `Bar<T>: Coinductive` | ||
|
||
query stack during panic: | ||
#0 [check_well_formed] checking that `<impl at $DIR/provisional-result-done.rs:20:1: 20:31>` is well-formed | ||
#1 [check_mod_type_wf] checking that types are well-formed in top-level module | ||
end of query stack | ||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0283`. |
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,22 @@ | ||
// compile-flags: -Ztrait-solver=next | ||
// check-pass | ||
|
||
// Checks that we don't explode when we assemble >1 candidate for a goal. | ||
|
||
struct Wrapper<T>(T); | ||
|
||
trait Foo {} | ||
|
||
impl Foo for Wrapper<i32> {} | ||
|
||
impl Foo for Wrapper<()> {} | ||
|
||
fn needs_foo(_: impl Foo) {} | ||
|
||
fn main() { | ||
let mut x = Default::default(); | ||
let w = Wrapper(x); | ||
needs_foo(w); | ||
x = 1; | ||
drop(x); | ||
} |