You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pubfncheck<T:Sized>(){traitCheckableIfTooBigForStack:Sized{constIS_TOO_BIG:bool =
// Use 1 KiB.
std::mem::size_of::<Self>() > 1024;// Compile error can be triggered by `let _ = T::TRIGGER_COMPILE_CHK;`constTRIGGER_COMPILE_CHK:u8 = ifSelf::IS_TOO_BIG{panic!("Type is too big")}else{0};}impl<T,constN:usize>CheckableIfTooBigForStackfor[T;N]{}let _ = <[T;1024]asCheckableIfTooBigForStack>::TRIGGER_COMPILE_CHK;}pubfntwo_checks(){check::<i8>();check::<i64>();}
Error:
error[[E0080]](https://doc.rust-lang.org/stable/error-index.html#E0080): evaluation of `<[i64; 1024] as check::CheckableIfTooBigForStack>::TRIGGER_COMPILE_CHK` failed
--> src/lib.rs:11:13
|
11 | panic!("Type is too big")
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Type is too big', src/lib.rs:11:13
|
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
note: the above error was encountered while instantiating `fn check::<i64>`
--> src/lib.rs:25:5
|
25 | check::<i64>();
| ^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0080`.
error: could not compile `playground` due to previous error
AFAIK, your crate currently cannot check generic type parameters and I help that this example would help you to make it available.
The text was updated successfully, but these errors were encountered:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=50be29638d90a53122b59d7da0cbecf3
Error:
AFAIK, your crate currently cannot check generic type parameters and I help that this example would help you to make it available.
The text was updated successfully, but these errors were encountered: