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.
Auto merge of rust-lang#121864 - compiler-errors:type-relating-varian…
…ces, r=aliemjay Don't grab variances in `TypeRelating` relation if we're invariant Since `Invariant.xform(var) = Invariant` always, so just copy what the generalizer relation does. Fixes rust-lang#110106
- Loading branch information
Showing
3 changed files
with
52 additions
and
1 deletion.
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
20 changes: 20 additions & 0 deletions
20
tests/ui/associated-inherent-types/variance-computation-requires-equality.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,20 @@ | ||
//@ check-pass | ||
|
||
#![feature(inherent_associated_types)] | ||
//~^ WARN the feature `inherent_associated_types` is incomplete | ||
|
||
struct D<T> { | ||
a: T | ||
} | ||
|
||
impl<T: Default> D<T> { | ||
type Item = T; | ||
|
||
fn next() -> Self::Item { | ||
Self::Item::default() | ||
} | ||
} | ||
|
||
|
||
fn main() { | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/ui/associated-inherent-types/variance-computation-requires-equality.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
warning: the feature `inherent_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/variance-computation-requires-equality.rs:3:12 | ||
| | ||
LL | #![feature(inherent_associated_types)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
warning: 1 warning emitted | ||
|