mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
6c31f6ce12
``` error: `S2<'_>` is forbidden as the type of a const generic parameter --> $DIR/lifetime-in-const-param.rs:5:23 | LL | struct S<'a, const N: S2>(&'a ()); | ^^ | = note: the only supported types are integers, `bool` and `char` help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types | LL + #![feature(adt_const_params)] | ``` Fix #55941.
61 lines
2.2 KiB
Plaintext
61 lines
2.2 KiB
Plaintext
error: `&'static str` is forbidden as the type of a const generic parameter
|
|
--> $DIR/slice-const-param-mismatch.rs:7:29
|
|
|
|
|
LL | struct ConstString<const T: &'static str>;
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
= note: the only supported types are integers, `bool` and `char`
|
|
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
|
|
|
|
LL + #![feature(adt_const_params)]
|
|
|
|
|
|
|
error: `&'static [u8]` is forbidden as the type of a const generic parameter
|
|
--> $DIR/slice-const-param-mismatch.rs:9:28
|
|
|
|
|
LL | struct ConstBytes<const T: &'static [u8]>;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
= note: the only supported types are integers, `bool` and `char`
|
|
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
|
|
|
|
LL + #![feature(adt_const_params)]
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/slice-const-param-mismatch.rs:14:35
|
|
|
|
|
LL | let _: ConstString<"Hello"> = ConstString::<"World">;
|
|
| -------------------- ^^^^^^^^^^^^^^^^^^^^^^ expected `"Hello"`, found `"World"`
|
|
| |
|
|
| expected due to this
|
|
|
|
|
= note: expected struct `ConstString<"Hello">`
|
|
found struct `ConstString<"World">`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/slice-const-param-mismatch.rs:16:33
|
|
|
|
|
LL | let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">;
|
|
| ------------------- ^^^^^^^^^^^^^^^^^^^^^ expected `"ℇ㇈↦"`, found `"ℇ㇈↥"`
|
|
| |
|
|
| expected due to this
|
|
|
|
|
= note: expected struct `ConstString<"ℇ㇈↦">`
|
|
found struct `ConstString<"ℇ㇈↥">`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/slice-const-param-mismatch.rs:18:33
|
|
|
|
|
LL | let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">;
|
|
| ------------------ ^^^^^^^^^^^^^^^^^^^^ expected `b"AAA"`, found `b"BBB"`
|
|
| |
|
|
| expected due to this
|
|
|
|
|
= note: expected struct `ConstBytes<b"AAA">`
|
|
found struct `ConstBytes<b"BBB">`
|
|
|
|
error: aborting due to 5 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|