-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Register wf obligation before normalizing in wfcheck
- Loading branch information
1 parent
9f4d5d2
commit 1634023
Showing
32 changed files
with
348 additions
and
227 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
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.