forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test more cases of WF-checking for fields
- Loading branch information
Showing
2 changed files
with
151 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,32 @@ | ||
struct Foo { | ||
struct FooStruct { | ||
nested: &'static Bar<dyn std::fmt::Debug>, | ||
//~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time | ||
} | ||
|
||
struct FooTuple(&'static Bar<dyn std::fmt::Debug>); | ||
//~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time | ||
|
||
enum FooEnum1 { | ||
Struct { nested: &'static Bar<dyn std::fmt::Debug> }, | ||
//~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time | ||
} | ||
|
||
enum FooEnum2 { | ||
Tuple(&'static Bar<dyn std::fmt::Debug>), | ||
//~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time | ||
} | ||
|
||
struct Bar<T>(T); | ||
|
||
fn main() { | ||
let x = Foo { nested: &Bar(4) }; | ||
// Ensure there's an error at the construction site, for error tainting purposes. | ||
|
||
FooStruct { nested: &Bar(4) }; | ||
//~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time | ||
FooTuple(&Bar(4)); | ||
//~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time | ||
FooEnum1::Struct { nested: &Bar(4) }; | ||
//~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time | ||
FooEnum2::Tuple(&Bar(4)); | ||
//~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time | ||
} |
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