Skip to content

Commit c6e273c

Browse files
committed
bless and fmt
1 parent 0c98929 commit c6e273c

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/tools/miri/src/intrinsics/mod.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use rustc_middle::{
1010
mir,
1111
ty::{self, FloatTy},
1212
};
13-
use rustc_target::abi::Size;
1413
use rustc_span::{sym, Symbol};
14+
use rustc_target::abi::Size;
1515

1616
use crate::*;
1717
use atomic::EvalContextExt as _;
@@ -70,13 +70,20 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
7070
throw_unsup_format!("unimplemented intrinsic: `{intrinsic_name}`")
7171
}
7272
let intrinsic_fallback_checks_ub = Symbol::intern("intrinsic_fallback_checks_ub");
73-
if this.tcx.get_attrs_by_path(instance.def_id(), &[sym::miri, intrinsic_fallback_checks_ub]).next().is_none() {
74-
throw_unsup_format!("miri can only use intrinsic fallback bodies that check UB. After verifying that `{intrinsic_name}` does so, add the `#[miri::intrinsic_fallback_checks_ub]` attribute to it; also ping @rust-lang/miri when you do that");
73+
if this
74+
.tcx
75+
.get_attrs_by_path(instance.def_id(), &[sym::miri, intrinsic_fallback_checks_ub])
76+
.next()
77+
.is_none()
78+
{
79+
throw_unsup_format!(
80+
"miri can only use intrinsic fallback bodies that check UB. After verifying that `{intrinsic_name}` does so, add the `#[miri::intrinsic_fallback_checks_ub]` attribute to it; also ping @rust-lang/miri when you do that"
81+
);
7582
}
7683
return Ok(Some(ty::Instance {
7784
def: ty::InstanceDef::Item(instance.def_id()),
7885
args: instance.args,
79-
}))
86+
}));
8087
}
8188

8289
trace!("{:?}", this.dump_place(&dest.clone().into()));

src/tools/miri/tests/fail/intrinsic_fallback_checks_ub.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ error: unsupported operation: miri can only use intrinsic fallback bodies that c
44
LL | ptr_guaranteed_cmp::<()>(std::ptr::null(), std::ptr::null());
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ miri can only use intrinsic fallback bodies that check UB. After verifying that `ptr_guaranteed_cmp` does so, add the `#[miri::intrinsic_fallback_checks_ub]` attribute to it; also ping @rust-lang/miri when you do that
66
|
7-
= help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
7+
= help: this is likely not a bug in the program; it indicates that the program performed an operation that Miri does not support
8+
= help: if this is a basic API commonly used on this target, please report an issue; but note that Miri does not aim to support every FFI function out there
89
= note: BACKTRACE:
910
= note: inside `main` at $DIR/intrinsic_fallback_checks_ub.rs:LL:CC
1011

0 commit comments

Comments
 (0)