diff options
Diffstat (limited to 'tests/ui/cfg/auxiliary')
-rw-r--r-- | tests/ui/cfg/auxiliary/cfg_false_lib.rs | 6 | ||||
-rw-r--r-- | tests/ui/cfg/auxiliary/cfg_false_lib_no_std_after.rs | 5 | ||||
-rw-r--r-- | tests/ui/cfg/auxiliary/cfg_false_lib_no_std_before.rs | 8 | ||||
-rw-r--r-- | tests/ui/cfg/auxiliary/cfged_out.rs | 22 |
4 files changed, 37 insertions, 4 deletions
diff --git a/tests/ui/cfg/auxiliary/cfg_false_lib.rs b/tests/ui/cfg/auxiliary/cfg_false_lib.rs index 3c011d72b..6c2dbb44d 100644 --- a/tests/ui/cfg/auxiliary/cfg_false_lib.rs +++ b/tests/ui/cfg/auxiliary/cfg_false_lib.rs @@ -1,6 +1,4 @@ -// It is unclear whether a fully unconfigured crate should link to standard library, -// or what its `no_std`/`no_core`/`compiler_builtins` status, more precisely. -// Currently the usual standard library prelude is added to such crates, -// and therefore they link to libstd. +// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(FALSE)`. +// This crate has no such attribute, therefore this crate does link to libstd. #![cfg(FALSE)] diff --git a/tests/ui/cfg/auxiliary/cfg_false_lib_no_std_after.rs b/tests/ui/cfg/auxiliary/cfg_false_lib_no_std_after.rs new file mode 100644 index 000000000..3cfa6c510 --- /dev/null +++ b/tests/ui/cfg/auxiliary/cfg_false_lib_no_std_after.rs @@ -0,0 +1,5 @@ +// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(FALSE)`. +// Therefore this crate does link to libstd. + +#![cfg(FALSE)] +#![no_std] diff --git a/tests/ui/cfg/auxiliary/cfg_false_lib_no_std_before.rs b/tests/ui/cfg/auxiliary/cfg_false_lib_no_std_before.rs new file mode 100644 index 000000000..8e89545b8 --- /dev/null +++ b/tests/ui/cfg/auxiliary/cfg_false_lib_no_std_before.rs @@ -0,0 +1,8 @@ +// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(FALSE)`. +// Therefore this crate doesn't link to libstd. + +// no-prefer-dynamic + +#![no_std] +#![crate_type = "lib"] +#![cfg(FALSE)] diff --git a/tests/ui/cfg/auxiliary/cfged_out.rs b/tests/ui/cfg/auxiliary/cfged_out.rs new file mode 100644 index 000000000..f6a9089cf --- /dev/null +++ b/tests/ui/cfg/auxiliary/cfged_out.rs @@ -0,0 +1,22 @@ +pub mod inner { + #[cfg(FALSE)] + pub fn uwu() {} + + #[cfg(FALSE)] + pub mod doesnt_exist { + pub fn hello() {} + } + + pub mod wrong { + #[cfg(feature = "suggesting me fails the test!!")] + pub fn meow() {} + } + + pub mod right { + #[cfg(feature = "what-a-cool-feature")] + pub fn meow() {} + } +} + +#[cfg(i_dont_exist_and_you_can_do_nothing_about_it)] +pub fn vanished() {} |