From a4d03c6c94b7c46a2d53a9412c447932d69316a4 Mon Sep 17 00:00:00 2001 From: Urgau Date: Wed, 25 May 2022 16:25:18 +0200 Subject: [PATCH] Add test for known-bugs of cfg_accessible --- .../cfg_accessible-bugs.rs | 30 +++++++++++++++++++ .../cfg_accessible-bugs.stderr | 16 ++++++++++ .../cfg_accessible-not_sure.rs | 6 ---- 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 src/test/ui/conditional-compilation/cfg_accessible-bugs.rs create mode 100644 src/test/ui/conditional-compilation/cfg_accessible-bugs.stderr diff --git a/src/test/ui/conditional-compilation/cfg_accessible-bugs.rs b/src/test/ui/conditional-compilation/cfg_accessible-bugs.rs new file mode 100644 index 00000000000..a95d397d3d2 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg_accessible-bugs.rs @@ -0,0 +1,30 @@ +// This test is a collection of test that should pass. +// +// check-fail + +#![feature(cfg_accessible)] +#![feature(trait_alias)] + +enum Enum { + Existing { existing: u8 }, +} + +trait TraitAlias = std::fmt::Debug + Send; + +// FIXME: Currently returns `false` but should be "not sure" +#[cfg_accessible(Enum::Existing::existing)] +const A: bool = true; + +// FIXME: Currently returns `false` but should be "not sure" +#[cfg_accessible(Enum::Existing::unresolved)] +const B: bool = true; + +// FIXME: Currently shows "cannot determine" but should be `false` +#[cfg_accessible(unresolved)] //~ ERROR cannot determine +const C: bool = true; + +// FIXME: Currently shows "not sure" but should be `false` +#[cfg_accessible(TraitAlias::unresolved)] //~ ERROR not sure whether the path is accessible or not +const D: bool = true; + +fn main() {} diff --git a/src/test/ui/conditional-compilation/cfg_accessible-bugs.stderr b/src/test/ui/conditional-compilation/cfg_accessible-bugs.stderr new file mode 100644 index 00000000000..30db6063041 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg_accessible-bugs.stderr @@ -0,0 +1,16 @@ +error: not sure whether the path is accessible or not + --> $DIR/cfg_accessible-bugs.rs:28:18 + | +LL | #[cfg_accessible(TraitAlias::unresolved)] + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the type may have associated items, but we are currently not checking them + +error: cannot determine whether the path is accessible or not + --> $DIR/cfg_accessible-bugs.rs:24:1 + | +LL | #[cfg_accessible(unresolved)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/conditional-compilation/cfg_accessible-not_sure.rs b/src/test/ui/conditional-compilation/cfg_accessible-not_sure.rs index 3baf72b0de9..55b68ce0d63 100644 --- a/src/test/ui/conditional-compilation/cfg_accessible-not_sure.rs +++ b/src/test/ui/conditional-compilation/cfg_accessible-not_sure.rs @@ -33,12 +33,6 @@ enum Enum { Existing { existing: u8 }, } -// FIXME: Currently returns `false` but should be "not sure" -#[cfg_accessible(Enum::Existing::existing)] -const A: bool = true; -// FIXME: Currently returns `false` but should be "not sure" -#[cfg_accessible(Enum::Existing::unresolved)] -const B: bool = true; #[cfg_accessible(Enum::unresolved)] //~ ERROR not sure const C: bool = true;