11#![ feature(  
22    no_core,  lang_items,  intrinsics,  unboxed_closures,  type_ascription,  extern_types,  
3-     untagged_unions ,   decl_macro,  rustc_attrs,  transparent_unions,  auto_traits,  
3+     decl_macro,  rustc_attrs,  transparent_unions,  auto_traits,  
44    thread_local 
55) ] 
66#![ no_core]  
@@ -39,14 +39,14 @@ impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a mut U> for &'a mut
3939impl < T :  ?Sized +Unsize < U > ,  U :  ?Sized >  DispatchFromDyn < * const  U >  for  * const  T  { } 
4040// *mut T -> *mut U 
4141impl < T :  ?Sized +Unsize < U > ,  U :  ?Sized >  DispatchFromDyn < * mut  U >  for  * mut  T  { } 
42- impl < T :  ?Sized  + Unsize < U > ,  U :  ?Sized >  DispatchFromDyn < Box < U > >  for  Box < T >  { } 
42+ impl < T :  ?Sized  + Unsize < U > ,  U :  ?Sized >  DispatchFromDyn < Box < U ,   ( ) > >  for  Box < T ,   ( ) >  { } 
4343
4444#[ lang = "receiver" ]  
4545pub  trait  Receiver  { } 
4646
4747impl < T :  ?Sized >  Receiver  for  & T  { } 
4848impl < T :  ?Sized >  Receiver  for  & mut  T  { } 
49- impl < T :  ?Sized >  Receiver  for  Box < T >  { } 
49+ impl < T :  ?Sized ,   A :   Allocator >  Receiver  for  Box < T ,   A >  { } 
5050
5151#[ lang = "copy" ]  
5252pub  unsafe  trait  Copy  { } 
@@ -411,7 +411,15 @@ pub trait FnMut<Args>: FnOnce<Args> {
411411
412412#[ lang = "panic" ]  
413413#[ track_caller]  
414- pub  fn  panic ( _msg :  & str )  -> ! { 
414+ pub  fn  panic ( _msg :  & ' static  str )  -> ! { 
415+     unsafe  { 
416+         libc:: puts ( "Panicking\n \0 "  as  * const  str  as  * const  u8 ) ; 
417+         intrinsics:: abort ( ) ; 
418+     } 
419+ } 
420+ 
421+ #[ lang = "panic_no_unwind" ]  
422+ fn  panic_no_unwind ( )  -> ! { 
415423    unsafe  { 
416424        libc:: puts ( "Panicking\n \0 "  as  * const  str  as  * const  u8 ) ; 
417425        intrinsics:: abort ( ) ; 
@@ -450,25 +458,40 @@ pub trait Deref {
450458pub  trait  Allocator  { 
451459} 
452460
461+ impl  Allocator  for  ( )  { } 
462+ 
453463pub  struct  Global ; 
454464
455465impl  Allocator  for  Global  { } 
456466
467+ #[ repr( transparent) ]  
468+ #[ rustc_layout_scalar_valid_range_start( 1 ) ]  
469+ #[ rustc_nonnull_optimization_guaranteed]  
470+ pub  struct  NonNull < T :  ?Sized > ( pub  * const  T ) ; 
471+ 
472+ impl < T :  ?Sized ,  U :  ?Sized >  CoerceUnsized < NonNull < U > >  for  NonNull < T >  where  T :  Unsize < U >  { } 
473+ impl < T :  ?Sized ,  U :  ?Sized >  DispatchFromDyn < NonNull < U > >  for  NonNull < T >  where  T :  Unsize < U >  { } 
474+ 
475+ pub  struct  Unique < T :  ?Sized >  { 
476+     pub  pointer :  NonNull < T > , 
477+     pub  _marker :  PhantomData < T > , 
478+ } 
479+ 
480+ impl < T :  ?Sized ,  U :  ?Sized >  CoerceUnsized < Unique < U > >  for  Unique < T >  where  T :  Unsize < U >  { } 
481+ impl < T :  ?Sized ,  U :  ?Sized >  DispatchFromDyn < Unique < U > >  for  Unique < T >  where  T :  Unsize < U >  { } 
482+ 
457483#[ lang = "owned_box" ]  
458- pub  struct  Box < 
459-     T :  ?Sized , 
460-     A :  Allocator  = Global , 
461- > ( * mut  T ,  A ) ; 
484+ pub  struct  Box < T :  ?Sized ,  A :  Allocator  = Global > ( Unique < T > ,  A ) ; 
462485
463- impl < T :  ?Sized  + Unsize < U > ,  U :  ?Sized >  CoerceUnsized < Box < U > >  for  Box < T >  { } 
486+ impl < T :  ?Sized  + Unsize < U > ,  U :  ?Sized ,   A :   Allocator >  CoerceUnsized < Box < U ,   A > >  for  Box < T ,   A >  { } 
464487
465488impl < T :  ?Sized ,  A :  Allocator >  Drop  for  Box < T ,  A >  { 
466489    fn  drop ( & mut  self )  { 
467490        // drop is currently performed by compiler. 
468491    } 
469492} 
470493
471- impl < T >  Deref  for  Box < T >  { 
494+ impl < T :  ? Sized ,   A :   Allocator >  Deref  for  Box < T ,   A >  { 
472495    type  Target  = T ; 
473496
474497    fn  deref ( & self )  -> & Self :: Target  { 
@@ -482,8 +505,8 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
482505} 
483506
484507#[ lang = "box_free" ]  
485- unsafe  fn  box_free < T :  ?Sized ,   A :   Allocator > ( ptr :  * mut   T ,   alloc :   A )  { 
486-     libc:: free ( ptr as  * mut  u8 ) ; 
508+ unsafe  fn  box_free < T :  ?Sized > ( ptr :  Unique < T > ,   _alloc :   ( ) )  { 
509+     libc:: free ( ptr. pointer . 0  as  * mut  u8 ) ; 
487510} 
488511
489512#[ lang = "drop" ]  
@@ -505,16 +528,18 @@ pub union MaybeUninit<T> {
505528} 
506529
507530pub  mod  intrinsics { 
531+     use  crate :: Sized ; 
532+ 
508533    extern  "rust-intrinsic"  { 
509534        pub  fn  abort ( )  -> !; 
510535        pub  fn  size_of < T > ( )  -> usize ; 
511-         pub  fn  size_of_val < T :  ?:: Sized > ( val :  * const  T )  -> usize ; 
536+         pub  fn  size_of_val < T :  ?Sized > ( val :  * const  T )  -> usize ; 
512537        pub  fn  min_align_of < T > ( )  -> usize ; 
513-         pub  fn  min_align_of_val < T :  ?:: Sized > ( val :  * const  T )  -> usize ; 
538+         pub  fn  min_align_of_val < T :  ?Sized > ( val :  * const  T )  -> usize ; 
514539        pub  fn  copy < T > ( src :  * const  T ,  dst :  * mut  T ,  count :  usize ) ; 
515540        pub  fn  transmute < T ,  U > ( e :  T )  -> U ; 
516541        pub  fn  ctlz_nonzero < T > ( x :  T )  -> T ; 
517-         pub  fn  needs_drop < T > ( )  -> bool ; 
542+         pub  fn  needs_drop < T :  ? Sized > ( )  -> bool ; 
518543        pub  fn  bitreverse < T > ( x :  T )  -> T ; 
519544        pub  fn  bswap < T > ( x :  T )  -> T ; 
520545        pub  fn  write_bytes < T > ( dst :  * mut  T ,  val :  u8 ,  count :  usize ) ; 
0 commit comments