Skip to content

Commit 6fcc151

Browse files
Auto merge of #145679 - 1c3t3a:sanitizer-attribute-fast, r=<try>
Don't evaluate the sanitizer attribute if no sanitizer is enabled
2 parents e8a792d + 3ffca9e commit 6fcc151

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,11 @@ fn parse_sanitize_attr(
630630
}
631631

632632
fn disabled_sanitizers_for(tcx: TyCtxt<'_>, did: LocalDefId) -> SanitizerSet {
633+
// No need to evaluate the sanitizer attribute if no sanitizer is enabled.
634+
if tcx.sess.opts.unstable_opts.sanitizer.is_empty() {
635+
return SanitizerSet::empty();
636+
}
637+
633638
// Backtrack to the crate root.
634639
let disabled = match tcx.opt_local_parent(did) {
635640
// Check the parent (recursively).

0 commit comments

Comments
 (0)