Skip to content

Commit 3ffca9e

Browse files
committed
Don't evaluate the sanitizer attribute if no sanitizer is enabled
This is just logical as the attribute has anyways no effect in that case.
1 parent e8a792d commit 3ffca9e

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)