Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/ui/const-generics/unsized-const-param-default.rs
Comment thread
Kivooeo marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Regression test for <https://github.com/rust-lang/rust/issues/146084>.

//@ compile-flags: --crate-type=lib

struct S<const N: [()] = { loop {} }>;
//~^ ERROR the size for values of type `[()]` cannot be known at compilation time
//~| ERROR `[()]` is forbidden as the type of a const generic parameter
28 changes: 28 additions & 0 deletions tests/ui/const-generics/unsized-const-param-default.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
error[E0277]: the size for values of type `[()]` cannot be known at compilation time
--> $DIR/unsized-const-param-default.rs:5:26
|
LL | struct S<const N: [()] = { loop {} }>;
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[()]`
= note: statics and constants must have a statically known size

error: `[()]` is forbidden as the type of a const generic parameter
--> $DIR/unsized-const-param-default.rs:5:19
|
LL | struct S<const N: [()] = { loop {} }>;
| ^^^^
|
= note: the only supported types are integers, `bool`, and `char`
help: add `#![feature(min_adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
LL + #![feature(min_adt_const_params)]
|
help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait
|
LL + #![feature(unsized_const_params)]
|

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
Loading