This repository was archived by the owner on May 28, 2025. It is now read-only.
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() {
2521
2521
) ;
2522
2522
check_number (
2523
2523
r#"
2524
- //- minicore: size_of
2524
+ //- minicore: size_of, fn
2525
2525
//- /a/lib.rs crate:a
2526
2526
use core::mem::size_of;
2527
2527
pub struct S<T>(T);
2528
2528
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
+ };
2530
2534
}
2531
2535
//- /main.rs crate:main deps:a
2532
2536
use a::{S};
Original file line number Diff line number Diff line change @@ -438,6 +438,8 @@ fn atomic() {
438
438
pub fn atomic_nand_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
439
439
pub fn atomic_or_release<T: Copy>(dst: *mut T, src: T) -> T;
440
440
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();
441
443
}
442
444
443
445
fn should_not_reach() {
@@ -452,13 +454,15 @@ fn atomic() {
452
454
if (30, true) != atomic_cxchg_release_seqcst(&mut y, 30, 40) {
453
455
should_not_reach();
454
456
}
457
+ atomic_fence_seqcst();
455
458
if (40, false) != atomic_cxchg_release_seqcst(&mut y, 30, 50) {
456
459
should_not_reach();
457
460
}
458
461
if (40, true) != atomic_cxchgweak_acquire_acquire(&mut y, 40, 30) {
459
462
should_not_reach();
460
463
}
461
464
let mut z = atomic_xsub_seqcst(&mut x, -200);
465
+ atomic_singlethreadfence_acqrel();
462
466
atomic_xor_seqcst(&mut x, 1024);
463
467
atomic_load_seqcst(&x) + z * 3 + atomic_load_seqcst(&y) * 2
464
468
};
Original file line number Diff line number Diff line change @@ -702,9 +702,7 @@ impl Evaluator<'_> {
702
702
}
703
703
704
704
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 ) )
708
706
}
709
707
710
708
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<'_> {
1057
1057
_span : MirSpan ,
1058
1058
) -> Result < ( ) > {
1059
1059
// 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
+
1061
1068
let Some ( ty) = generic_args. as_slice ( Interner ) . get ( 0 ) . and_then ( |it| it. ty ( Interner ) ) else {
1062
1069
return Err ( MirEvalError :: TypeError ( "atomic intrinsic generic arg is not provided" ) ) ;
1063
1070
} ;
Original file line number Diff line number Diff line change @@ -660,6 +660,11 @@ impl<'ctx> MirLowerCtx<'ctx> {
660
660
expr_id. into ( ) ,
661
661
)
662
662
}
663
+ TyKind :: Closure ( _, _) => {
664
+ not_supported ! (
665
+ "method resolution not emitted for closure (Are Fn traits available?)"
666
+ ) ;
667
+ }
663
668
TyKind :: Error => {
664
669
return Err ( MirLowerError :: MissingFunctionDefinition ( self . owner , expr_id) )
665
670
}
You can’t perform that action at this time.
0 commit comments