Skip to content

Commit 326b772

Browse files
committed
inliner: Check for no_sanitize attribute compatibility
1 parent cbc396f commit 326b772

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler/rustc_mir/src/transform/inline.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,12 @@ impl Inliner<'tcx> {
251251
return false;
252252
}
253253

254-
// Avoid inlining functions marked as no_sanitize if sanitizer is enabled,
255-
// since instrumentation might be enabled and performed on the caller.
256-
if self.tcx.sess.opts.debugging_opts.sanitizer.intersects(codegen_fn_attrs.no_sanitize) {
254+
let self_no_sanitize =
255+
self.codegen_fn_attrs.no_sanitize & self.tcx.sess.opts.debugging_opts.sanitizer;
256+
let callee_no_sanitize =
257+
codegen_fn_attrs.no_sanitize & self.tcx.sess.opts.debugging_opts.sanitizer;
258+
if self_no_sanitize != callee_no_sanitize {
259+
debug!("`callee has incompatible no_sanitize attribute - not inlining");
257260
return false;
258261
}
259262

0 commit comments

Comments
 (0)