File tree Expand file tree Collapse file tree 5 files changed +24
-6
lines changed Expand file tree Collapse file tree 5 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -2521,12 +2521,16 @@ fn const_trait_assoc() {
25212521 ) ;
25222522 check_number (
25232523 r#"
2524- //- minicore: size_of
2524+ //- minicore: size_of, fn
25252525 //- /a/lib.rs crate:a
25262526 use core::mem::size_of;
25272527 pub struct S<T>(T);
25282528 impl<T> S<T> {
2529- pub const X: usize = core::mem::size_of::<T>();
2529+ pub const X: usize = {
2530+ let k: T;
2531+ let f = || core::mem::size_of::<T>();
2532+ f()
2533+ };
25302534 }
25312535 //- /main.rs crate:main deps:a
25322536 use a::{S};
Original file line number Diff line number Diff line change @@ -438,6 +438,8 @@ fn atomic() {
438438 pub fn atomic_nand_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
439439 pub fn atomic_or_release<T: Copy>(dst: *mut T, src: T) -> T;
440440 pub fn atomic_xor_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
441+ pub fn atomic_fence_seqcst();
442+ pub fn atomic_singlethreadfence_acqrel();
441443 }
442444
443445 fn should_not_reach() {
@@ -452,13 +454,15 @@ fn atomic() {
452454 if (30, true) != atomic_cxchg_release_seqcst(&mut y, 30, 40) {
453455 should_not_reach();
454456 }
457+ atomic_fence_seqcst();
455458 if (40, false) != atomic_cxchg_release_seqcst(&mut y, 30, 50) {
456459 should_not_reach();
457460 }
458461 if (40, true) != atomic_cxchgweak_acquire_acquire(&mut y, 40, 30) {
459462 should_not_reach();
460463 }
461464 let mut z = atomic_xsub_seqcst(&mut x, -200);
465+ atomic_singlethreadfence_acqrel();
462466 atomic_xor_seqcst(&mut x, 1024);
463467 atomic_load_seqcst(&x) + z * 3 + atomic_load_seqcst(&y) * 2
464468 };
Original file line number Diff line number Diff line change @@ -702,9 +702,7 @@ impl Evaluator<'_> {
702702 }
703703
704704 fn layout_adt ( & self , adt : AdtId , subst : Substitution ) -> Result < Arc < Layout > > {
705- self . db . layout_of_adt ( adt, subst. clone ( ) , self . trait_env . clone ( ) ) . map_err ( |e| {
706- MirEvalError :: LayoutError ( e, TyKind :: Adt ( chalk_ir:: AdtId ( adt) , subst) . intern ( Interner ) )
707- } )
705+ self . layout ( & TyKind :: Adt ( chalk_ir:: AdtId ( adt) , subst) . intern ( Interner ) )
708706 }
709707
710708 fn place_ty < ' a > ( & ' a self , p : & Place , locals : & ' a Locals ) -> Result < Ty > {
Original file line number Diff line number Diff line change @@ -1057,7 +1057,14 @@ impl Evaluator<'_> {
10571057 _span : MirSpan ,
10581058 ) -> Result < ( ) > {
10591059 // We are a single threaded runtime with no UB checking and no optimization, so
1060- // we can implement these as normal functions.
1060+ // we can implement atomic intrinsics as normal functions.
1061+
1062+ if name. starts_with ( "singlethreadfence_" ) || name. starts_with ( "fence_" ) {
1063+ return Ok ( ( ) ) ;
1064+ }
1065+
1066+ // The rest of atomic intrinsics have exactly one generic arg
1067+
10611068 let Some ( ty) = generic_args. as_slice ( Interner ) . get ( 0 ) . and_then ( |it| it. ty ( Interner ) ) else {
10621069 return Err ( MirEvalError :: TypeError ( "atomic intrinsic generic arg is not provided" ) ) ;
10631070 } ;
Original file line number Diff line number Diff line change @@ -660,6 +660,11 @@ impl<'ctx> MirLowerCtx<'ctx> {
660660 expr_id. into ( ) ,
661661 )
662662 }
663+ TyKind :: Closure ( _, _) => {
664+ not_supported ! (
665+ "method resolution not emitted for closure (Are Fn traits available?)"
666+ ) ;
667+ }
663668 TyKind :: Error => {
664669 return Err ( MirLowerError :: MissingFunctionDefinition ( self . owner , expr_id) )
665670 }
You can’t perform that action at this time.
0 commit comments