-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Expand free alias types during variance computation #141030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fmease
wants to merge
1
commit into
rust-lang:main
Choose a base branch
from
fmease:lta-no-variance
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,18 @@ | ||
| // Test that we check the body at the definition site for well-formedness. | ||
|
|
||
| #![feature(lazy_type_alias)] | ||
|
|
||
| // unsatisified trait bounds | ||
| type _A<T> = <T as std::ops::Mul>::Output; //~ ERROR cannot multiply `T` by `T` | ||
| type _B = Vec<str>; //~ ERROR the size for values of type `str` cannot be known at compilation time | ||
|
|
||
| // unsatisfied outlives-bounds | ||
| type _C<'a> = &'static &'a (); //~ ERROR reference has a longer lifetime than the data it references | ||
|
|
||
| // diverging const exprs | ||
| type _D = [(); panic!()]; //~ ERROR evaluation panicked | ||
|
|
||
| // dyn incompatibility | ||
| type _E = dyn Sized; //~ ERROR the trait `Sized` is not dyn compatible | ||
|
|
||
| fn main() {} |
This file contains hidden or 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,54 @@ | ||
| error[E0277]: cannot multiply `T` by `T` | ||
| --> $DIR/def-site-body-wf.rs:6:14 | ||
| | | ||
| LL | type _A<T> = <T as std::ops::Mul>::Output; | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T * T` | ||
| | | ||
| help: consider restricting type parameter `T` with trait `Mul` | ||
| | | ||
| LL | type _A<T: std::ops::Mul> = <T as std::ops::Mul>::Output; | ||
| | +++++++++++++++ | ||
|
|
||
| error[E0277]: the size for values of type `str` cannot be known at compilation time | ||
| --> $DIR/def-site-body-wf.rs:7:11 | ||
| | | ||
| LL | type _B = Vec<str>; | ||
| | ^^^^^^^^ doesn't have a size known at compile-time | ||
| | | ||
| = help: the trait `Sized` is not implemented for `str` | ||
| note: required by an implicit `Sized` bound in `Vec` | ||
| --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | ||
|
|
||
| error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references | ||
| --> $DIR/def-site-body-wf.rs:10:1 | ||
| | | ||
| LL | type _C<'a> = &'static &'a (); | ||
| | ^^^^^^^^^^^ | ||
| | | ||
| = note: the pointer is valid for the static lifetime | ||
| note: but the referenced data is only valid for the lifetime `'a` as defined here | ||
| --> $DIR/def-site-body-wf.rs:10:9 | ||
| | | ||
| LL | type _C<'a> = &'static &'a (); | ||
| | ^^ | ||
|
|
||
| error[E0080]: evaluation panicked: explicit panic | ||
| --> $DIR/def-site-body-wf.rs:13:16 | ||
| | | ||
| LL | type _D = [(); panic!()]; | ||
| | ^^^^^^^^ evaluation of `_D::{constant#0}` failed here | ||
|
|
||
| error[E0038]: the trait `Sized` is not dyn compatible | ||
| --> $DIR/def-site-body-wf.rs:16:11 | ||
| | | ||
| LL | type _E = dyn Sized; | ||
| | ^^^^^^^^^ `Sized` is not dyn compatible | ||
| | | ||
| = note: the trait is not dyn compatible because it requires `Self: Sized` | ||
| = note: for a trait to be dyn compatible it needs to allow building a vtable | ||
| for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> | ||
|
|
||
| error: aborting due to 5 previous errors | ||
|
|
||
| Some errors have detailed explanations: E0038, E0080, E0277, E0491. | ||
| For more information about an error, try `rustc --explain E0038`. |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does variance computation have a mechanism to avoid infinite recursion? I'm wondering whether we need to be concerned about sth like
type Foo = (Foo,);. I realise that item wfcks do eventually check for diverging free aliases (or atleast ought to 😌) but I'm unsure about query orderings and whether that's always checked before computing variancesView changes since the review