2024-08-05 19:56:50 -05:00
|
|
|
struct FooStruct {
|
2024-07-31 22:33:48 -05:00
|
|
|
nested: &'static Bar<dyn std::fmt::Debug>,
|
|
|
|
//~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time
|
|
|
|
}
|
|
|
|
|
2024-08-05 19:56:50 -05:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2024-07-31 22:33:48 -05:00
|
|
|
struct Bar<T>(T);
|
|
|
|
|
|
|
|
fn main() {
|
2024-08-05 19:56:50 -05:00
|
|
|
// 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));
|
2024-08-05 19:26:46 -05:00
|
|
|
//~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time
|
2024-07-31 22:33:48 -05:00
|
|
|
}
|