Skip to content

Commit 89bbc41

Browse files
committed
Add test for known-bugs of cfg_accessible
1 parent 6bc6839 commit 89bbc41

File tree

3 files changed

+47
-6
lines changed

3 files changed

+47
-6
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// check-fail
2+
// known-bug
3+
4+
// This should pass.
5+
6+
#![feature(cfg_accessible)]
7+
#![feature(trait_alias)]
8+
9+
enum Enum {
10+
Existing { existing: u8 },
11+
}
12+
13+
trait TraitAlias = std::fmt::Debug + Send;
14+
15+
// FIXME: Currently returns `false` but should be "not sure"
16+
#[cfg_accessible(Enum::Existing::existing)]
17+
const A: bool = true;
18+
19+
// FIXME: Currently returns `false` but should be "not sure"
20+
#[cfg_accessible(Enum::Existing::unresolved)]
21+
const B: bool = true;
22+
23+
// FIXME: Currently shows "cannot determine" but should be `false`
24+
#[cfg_accessible(unresolved)]
25+
const C: bool = true;
26+
27+
// FIXME: Currently shows "not sure" but should be `false`
28+
#[cfg_accessible(TraitAlias::unresolved)]
29+
const D: bool = true;
30+
31+
fn main() {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: not sure whether the path is accessible or not
2+
--> $DIR/cfg_accessible-bugs.rs:28:18
3+
|
4+
LL | #[cfg_accessible(TraitAlias::unresolved)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: the type may have associated items, but we are currently not checking them
8+
9+
error: cannot determine whether the path is accessible or not
10+
--> $DIR/cfg_accessible-bugs.rs:24:1
11+
|
12+
LL | #[cfg_accessible(unresolved)]
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
15+
error: aborting due to 2 previous errors
16+

src/test/ui/conditional-compilation/cfg_accessible-not_sure.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ enum Enum {
3333
Existing { existing: u8 },
3434
}
3535

36-
// FIXME: Currently returns `false` but should be "not sure"
37-
#[cfg_accessible(Enum::Existing::existing)]
38-
const A: bool = true;
39-
// FIXME: Currently returns `false` but should be "not sure"
40-
#[cfg_accessible(Enum::Existing::unresolved)]
41-
const B: bool = true;
4236
#[cfg_accessible(Enum::unresolved)] //~ ERROR not sure
4337
const C: bool = true;
4438

0 commit comments

Comments
 (0)