File tree Expand file tree Collapse file tree 4 files changed +6
-8
lines changed Expand file tree Collapse file tree 4 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -229,10 +229,6 @@ pub fn expand(input: TokenStream) -> TokenStream {
229229 ) ) ) ]
230230 #unsupported_platform
231231
232- #linkme_path:: __private:: assert!(
233- #linkme_path:: __private:: mem:: size_of:: <<#ty as #linkme_path:: __private:: Slice >:: Element >( ) > 0 ,
234- ) ;
235-
236232 unsafe {
237233 #linkme_path:: DistributedSlice :: private_new(
238234 #name,
Original file line number Diff line number Diff line change @@ -155,13 +155,16 @@ impl<T> Clone for StaticPtr<T> {
155155
156156impl < T > DistributedSlice < [ T ] > {
157157 #[ doc( hidden) ]
158+ #[ track_caller]
158159 pub const unsafe fn private_new (
159160 name : & ' static str ,
160161 section_start : * const [ T ; 0 ] ,
161162 section_stop : * const [ T ; 0 ] ,
162163 dupcheck_start : * const ( ) ,
163164 dupcheck_stop : * const ( ) ,
164165 ) -> Self {
166+ assert ! ( mem:: size_of:: <T >( ) > 0 ) ;
167+
165168 DistributedSlice {
166169 name,
167170 section_start : StaticPtr {
Original file line number Diff line number Diff line change 11#[ doc( hidden) ]
2- pub use core:: assert;
3- #[ doc( hidden) ]
42pub use core:: mem;
53#[ doc( hidden) ]
64pub use core:: primitive:: isize;
Original file line number Diff line number Diff line change 1- error[E0080]: evaluation panicked: assertion failed: ::linkme::__private::mem::size_of::<<[Unit] as
2- ::linkme::__private::Slice>::Element>() > 0
1+ error[E0080]: evaluation panicked: assertion failed: mem::size_of::<T>() > 0
32 --> tests/ui/zerosized.rs:7:1
43 |
547 | #[distributed_slice]
65 | ^^^^^^^^^^^^^^^^^^^^ evaluation of `ZEROSIZED` failed here
6+ |
7+ = note: this error originates in the attribute macro `distributed_slice` (in Nightly builds, run with -Z macro-backtrace for more info)
You can’t perform that action at this time.
0 commit comments