-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Register wf obligation before normalizing in wfcheck #100046
Closed
compiler-errors
wants to merge
1
commit into
rust-lang:master
from
compiler-errors:dont-normalize-in-wfcheck
Closed
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 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 |
---|---|---|
@@ -1,15 +1,9 @@ | ||
error[E0275]: overflow evaluating the requirement `<bool as Tr>::B == _` | ||
--> $DIR/defaults-cyclic-fail-1.rs:26:14 | ||
| | ||
LL | type A = Box<Self::B>; | ||
| ^^^^^^^^^^^^ | ||
|
||
error[E0275]: overflow evaluating the requirement `<usize as Tr>::A == _` | ||
--> $DIR/defaults-cyclic-fail-1.rs:32:14 | ||
--> $DIR/defaults-cyclic-fail-1.rs:30:14 | ||
| | ||
LL | type B = &'static Self::A; | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0275`. |
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,15 +1,9 @@ | ||
error[E0275]: overflow evaluating the requirement `<bool as Tr>::B == _` | ||
--> $DIR/defaults-cyclic-fail-2.rs:27:14 | ||
| | ||
LL | type A = Box<Self::B>; | ||
| ^^^^^^^^^^^^ | ||
|
||
error[E0275]: overflow evaluating the requirement `<usize as Tr>::A == _` | ||
--> $DIR/defaults-cyclic-fail-2.rs:33:14 | ||
--> $DIR/defaults-cyclic-fail-2.rs:31:14 | ||
| | ||
LL | type B = &'static Self::A; | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0275`. |
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,23 @@ | ||
trait Wf { | ||
type Ty; | ||
} | ||
|
||
impl<T: ?Sized> Wf for T { | ||
type Ty = (); | ||
} | ||
|
||
const _: <Vec<str> as Wf>::Ty = (); | ||
//~^ ERROR the size for values of type `str` cannot be known at compilation time | ||
|
||
struct Foo { | ||
x: <Vec<str> as Wf>::Ty, | ||
//~^ ERROR the size for values of type `str` cannot be known at compilation time | ||
} | ||
|
||
fn foo(x: <Vec<str> as Wf>::Ty) {} | ||
//~^ ERROR the size for values of type `str` cannot be known at compilation time | ||
|
||
fn bar() -> <Vec<str> as Wf>::Ty {} | ||
//~^ ERROR the size for values of type `str` cannot be known at compilation time | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
error[E0277]: the size for values of type `str` cannot be known at compilation time | ||
--> $DIR/issue-100041.rs:9:11 | ||
| | ||
LL | const _: <Vec<str> as Wf>::Ty = (); | ||
| ^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `str` | ||
note: required by a bound in `Vec` | ||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | ||
| | ||
LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { | ||
| ^ required by this bound in `Vec` | ||
|
||
error[E0277]: the size for values of type `str` cannot be known at compilation time | ||
--> $DIR/issue-100041.rs:13:9 | ||
| | ||
LL | x: <Vec<str> as Wf>::Ty, | ||
| ^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `str` | ||
note: required by a bound in `Vec` | ||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | ||
| | ||
LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { | ||
| ^ required by this bound in `Vec` | ||
|
||
error[E0277]: the size for values of type `str` cannot be known at compilation time | ||
--> $DIR/issue-100041.rs:17:12 | ||
| | ||
LL | fn foo(x: <Vec<str> as Wf>::Ty) {} | ||
| ^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `str` | ||
note: required by a bound in `Vec` | ||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | ||
| | ||
LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { | ||
| ^ required by this bound in `Vec` | ||
|
||
error[E0277]: the size for values of type `str` cannot be known at compilation time | ||
--> $DIR/issue-100041.rs:20:13 | ||
| | ||
LL | fn bar() -> <Vec<str> as Wf>::Ty {} | ||
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `str` | ||
note: required by a bound in `Vec` | ||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | ||
| | ||
LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { | ||
| ^ required by this bound in `Vec` | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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
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
27 changes: 15 additions & 12 deletions
27
src/test/ui/fn/implied-bounds-unnorm-associated-type-2.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 |
---|---|---|
@@ -1,17 +1,20 @@ | ||
error: lifetime may not live long enough | ||
--> $DIR/implied-bounds-unnorm-associated-type-2.rs:19:5 | ||
error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references | ||
--> $DIR/implied-bounds-unnorm-associated-type-2.rs:11:17 | ||
| | ||
LL | fn g<'a, 'b>() { | ||
| -- -- lifetime `'b` defined here | ||
| | | ||
| lifetime `'a` defined here | ||
LL | f::<'a, 'b>(()); | ||
| ^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a` | ||
LL | fn f<'a, 'b>(_: <&'a &'b () as Trait>::Type) | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: consider adding the following bound: `'b: 'a` | ||
= note: requirement occurs because of a function pointer to `f` | ||
= note: the function `f` is invariant over the parameter `'a` | ||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance | ||
note: the pointer is valid for the lifetime `'a` as defined here | ||
--> $DIR/implied-bounds-unnorm-associated-type-2.rs:11:6 | ||
| | ||
LL | fn f<'a, 'b>(_: <&'a &'b () as Trait>::Type) | ||
| ^^ | ||
note: but the referenced data is only valid for the lifetime `'b` as defined here | ||
--> $DIR/implied-bounds-unnorm-associated-type-2.rs:11:10 | ||
| | ||
LL | fn f<'a, 'b>(_: <&'a &'b () as Trait>::Type) | ||
| ^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0491`. |
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.
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.
already dealt with by
try_normalize_with_depth_to
, no need to check forallow_normalization
hereThere 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.
Oh cool