diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-09-03 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-09-04 20:01:15 +0200 |
| commit | 326b772609c4cfbd09026c534be4cbfda36fbcf4 (patch) | |
| tree | b1eecf23461d224dcf39333376c4971be1ec12e7 | |
| parent | cbc396fdfb411b4963131889aeae5c675f4512a2 (diff) | |
| download | rust-326b772609c4cfbd09026c534be4cbfda36fbcf4.tar.gz rust-326b772609c4cfbd09026c534be4cbfda36fbcf4.zip | |
inliner: Check for no_sanitize attribute compatibility
| -rw-r--r-- | compiler/rustc_mir/src/transform/inline.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_mir/src/transform/inline.rs b/compiler/rustc_mir/src/transform/inline.rs index 0fe0169e2c8..7ca454430cc 100644 --- a/compiler/rustc_mir/src/transform/inline.rs +++ b/compiler/rustc_mir/src/transform/inline.rs @@ -251,9 +251,12 @@ impl Inliner<'tcx> { return false; } - // Avoid inlining functions marked as no_sanitize if sanitizer is enabled, - // since instrumentation might be enabled and performed on the caller. - if self.tcx.sess.opts.debugging_opts.sanitizer.intersects(codegen_fn_attrs.no_sanitize) { + let self_no_sanitize = + self.codegen_fn_attrs.no_sanitize & self.tcx.sess.opts.debugging_opts.sanitizer; + let callee_no_sanitize = + codegen_fn_attrs.no_sanitize & self.tcx.sess.opts.debugging_opts.sanitizer; + if self_no_sanitize != callee_no_sanitize { + debug!("`callee has incompatible no_sanitize attribute - not inlining"); return false; } |
