Skip to content

Commit c96ff2d

Browse files
committed
Remove uses of cfg(any()/all())
1 parent d5525a7 commit c96ff2d

File tree

65 files changed

+407
-384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+407
-384
lines changed

compiler/rustc_codegen_cranelift/src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub(crate) fn compile_fn(
167167
context.clear();
168168
context.func = codegened_func.func;
169169

170-
#[cfg(any())] // This is never true
170+
#[cfg(false)]
171171
let _clif_guard = {
172172
use std::fmt::Write;
173173

library/core/src/primitive_docs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ impl () {}
591591
/// # pub unsafe fn malloc(_size: usize) -> *mut core::ffi::c_void { core::ptr::NonNull::dangling().as_ptr() }
592592
/// # pub unsafe fn free(_ptr: *mut core::ffi::c_void) {}
593593
/// # }
594-
/// # #[cfg(any())]
594+
/// # #[cfg(false)]
595595
/// #[allow(unused_extern_crates)]
596596
/// extern crate libc;
597597
///

tests/ui/asm/naked-functions-inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub extern "C" fn inline_never() {
3030
}
3131

3232
#[unsafe(naked)]
33-
#[cfg_attr(all(), inline(never))]
33+
#[cfg_attr(true, inline(never))]
3434
//~^ ERROR [E0736]
3535
pub extern "C" fn conditional_inline_never() {
3636
naked_asm!("");

tests/ui/asm/naked-functions-inline.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ LL | #[inline(never)]
2323
| ^^^^^^ the `inline` attribute is incompatible with `#[unsafe(naked)]`
2424

2525
error[E0736]: attribute incompatible with `#[unsafe(naked)]`
26-
--> $DIR/naked-functions-inline.rs:33:19
26+
--> $DIR/naked-functions-inline.rs:33:18
2727
|
2828
LL | #[unsafe(naked)]
2929
| ---------------- function marked with `#[unsafe(naked)]` here
30-
LL | #[cfg_attr(all(), inline(never))]
31-
| ^^^^^^ the `inline` attribute is incompatible with `#[unsafe(naked)]`
30+
LL | #[cfg_attr(true, inline(never))]
31+
| ^^^^^^ the `inline` attribute is incompatible with `#[unsafe(naked)]`
3232

3333
error: aborting due to 4 previous errors
3434

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ build-pass
22

3-
#[cfg_attr(all(), unsafe(no_mangle))]
3+
#[cfg_attr(true, unsafe(no_mangle))]
44
fn a() {}
55

66
fn main() {}

tests/ui/attributes/unsafe/extraneous-unsafe-attributes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//@ edition: 2024
22

3-
#[unsafe(cfg(any()))] //~ ERROR: is not an unsafe attribute
3+
#[unsafe(cfg(false))] //~ ERROR: is not an unsafe attribute
44
fn a() {}
55

6-
#[unsafe(cfg_attr(any(), allow(dead_code)))] //~ ERROR: is not an unsafe attribute
6+
#[unsafe(cfg_attr(false, allow(dead_code)))] //~ ERROR: is not an unsafe attribute
77
fn b() {}
88

99
#[unsafe(test)] //~ ERROR: is not an unsafe attribute

tests/ui/attributes/unsafe/extraneous-unsafe-attributes.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
error: `cfg` is not an unsafe attribute
22
--> $DIR/extraneous-unsafe-attributes.rs:3:3
33
|
4-
LL | #[unsafe(cfg(any()))]
4+
LL | #[unsafe(cfg(false))]
55
| ^^^^^^ this is not an unsafe attribute
66
|
77
= note: extraneous unsafe is not allowed in attributes
88

99
error: `cfg_attr` is not an unsafe attribute
1010
--> $DIR/extraneous-unsafe-attributes.rs:6:3
1111
|
12-
LL | #[unsafe(cfg_attr(any(), allow(dead_code)))]
12+
LL | #[unsafe(cfg_attr(false, allow(dead_code)))]
1313
| ^^^^^^ this is not an unsafe attribute
1414
|
1515
= note: extraneous unsafe is not allowed in attributes

tests/ui/attributes/unsafe/unsafe-attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn a() {}
66
#[unsafe(export_name = "foo")]
77
fn b() {}
88

9-
#[cfg_attr(any(), unsafe(no_mangle))]
9+
#[cfg_attr(false, unsafe(no_mangle))]
1010
static VAR2: u32 = 1;
1111

1212
fn main() {}

tests/ui/cfg/conditional-compilation-struct-11085.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct Foo {
1111
}
1212

1313
struct Foo2 {
14-
#[cfg(all())]
14+
#[cfg(true)]
1515
foo: isize,
1616
}
1717

tests/ui/cfg/conditional-compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,5 +151,5 @@ mod test_methods {
151151
}
152152
}
153153

154-
#[cfg(any())]
154+
#[cfg(false)]
155155
mod nonexistent_file; // Check that unconfigured non-inline modules are not loaded or parsed.

0 commit comments

Comments
 (0)