-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat weak alias types more like ADTs when computing implied bounds
- Loading branch information
Showing
9 changed files
with
41 additions
and
50 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
11 changes: 11 additions & 0 deletions
11
tests/ui/lazy-type-alias/implied-outlives-bounds-1.print.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 @@ | ||
error: rustc_outlives | ||
--> $DIR/implied-outlives-bounds-1.rs:16:1 | ||
| | ||
LL | struct Type<'a, K, V>(&'a mut Alias<K, V>); | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: K: 'a | ||
= note: V: 'a | ||
|
||
error: aborting due to 1 previous error | ||
|
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 that we infer the outlives-predicates `K: 'a`, `V: 'a` for `Type` | ||
// from the weak alias `Alias`. | ||
// This mirrors the behavior of ADTs instead of other kinds of alias types | ||
// like projections and opaque types. | ||
// If we were to mirror the semantics of the latter, we would infer the | ||
// outlives-predicate `Alias<K, V>: 'a` instead which is not what we want. | ||
|
||
//@ revisions: default print | ||
//@[default] check-pass | ||
|
||
#![feature(lazy_type_alias)] | ||
#![cfg_attr(print, feature(rustc_attrs))] | ||
#![allow(incomplete_features)] | ||
|
||
#[cfg_attr(print, rustc_outlives)] | ||
struct Type<'a, K, V>(&'a mut Alias<K, V>); //[print]~ ERROR rustc_outlives | ||
|
||
type Alias<K, V> = (K, V); | ||
|
||
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
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