forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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 rust-lang#121853 - lcnr:normalizes_to-polarity, r=com…
…piler-errors normalizes-to: handle negative impls necessary to build the stage 2 compiler in rust-lang#121848 😁 r? `@compiler-errors`
- Loading branch information
Showing
2 changed files
with
38 additions
and
3 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
22 changes: 22 additions & 0 deletions
22
tests/ui/traits/negative-impls/negative-impl-normalizes-to.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,22 @@ | ||
//@ revisions: current next | ||
//@[next] compile-flags: -Znext-solver | ||
//@ check-pass | ||
|
||
// Check that negative impls for traits with associated types | ||
// do not result in an ICE when trying to normalize. | ||
#![feature(negative_impls)] | ||
trait Trait { | ||
type Assoc; | ||
} | ||
|
||
struct Local<T>(T); | ||
impl !Trait for Local<u32> {} | ||
impl Trait for Local<i32> { | ||
type Assoc = i32; | ||
} | ||
|
||
trait NoOverlap {} | ||
impl<T: Trait<Assoc = u32>> NoOverlap for T {} | ||
impl<T> NoOverlap for Local<T> {} | ||
|
||
fn main() {} |