-
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.
Rollup merge of #97780 - compiler-errors:field-wfcheck-before-sized, …
…r=jackh726 Check ADT field is well-formed before checking it is sized Fixes #96810. There is one diagnostics regression, in [`src/test/ui/generic-associated-types/bugs/issue-80626.stderr`](https://github.com/rust-lang/rust/pull/97780/files#diff-53795946378e78a0af23a10277c628ff79091c18090fdc385801ee70c1ba6963). I am not super concerned about it, since it's GAT related. We _could_ fix it, possibly by using the `FieldSized` obligation cause code instead of `BuiltinDerivedObligation`. But that would require changing `Sized` trait confirmation and the `adt_sized_constraint` query.
- Loading branch information
Showing
6 changed files
with
51 additions
and
34 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
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,12 @@ | ||
struct S<T: Tr>(T::Assoc); | ||
|
||
trait Tr { | ||
type Assoc; | ||
} | ||
|
||
struct Hoge<K> { | ||
s: S<K>, //~ ERROR the trait bound `K: Tr` is not satisfied | ||
a: u32, | ||
} | ||
|
||
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,19 @@ | ||
error[E0277]: the trait bound `K: Tr` is not satisfied | ||
--> $DIR/issue-96810.rs:8:8 | ||
| | ||
LL | s: S<K>, | ||
| ^^^^ the trait `Tr` is not implemented for `K` | ||
| | ||
note: required by a bound in `S` | ||
--> $DIR/issue-96810.rs:1:13 | ||
| | ||
LL | struct S<T: Tr>(T::Assoc); | ||
| ^^ required by this bound in `S` | ||
help: consider restricting type parameter `K` | ||
| | ||
LL | struct Hoge<K: Tr> { | ||
| ++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |