Skip to content

Commit c413250

Browse files
committed
Add tests for "not sure" case of cfg_accessible
1 parent 1633746 commit c413250

File tree

3 files changed

+303
-0
lines changed

3 files changed

+303
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
error: not sure whether the path is accessible or not
2+
--> $DIR/cfg_accessible-not_sure.rs:14:18
3+
|
4+
LL | #[cfg_accessible(Struct::existing)]
5+
| ^^^^^^^^^^^^^^^^
6+
|
7+
= note: the type may have associated items, but we are currently not checking them
8+
9+
error: not sure whether the path is accessible or not
10+
--> $DIR/cfg_accessible-not_sure.rs:16:18
11+
|
12+
LL | #[cfg_accessible(Struct::unresolved)]
13+
| ^^^^^^^^^^^^^^^^^^
14+
|
15+
= note: the type may have associated items, but we are currently not checking them
16+
17+
error: not sure whether the path is accessible or not
18+
--> $DIR/cfg_accessible-not_sure.rs:25:18
19+
|
20+
LL | #[cfg_accessible(Union::existing)]
21+
| ^^^^^^^^^^^^^^^
22+
|
23+
= note: the type may have associated items, but we are currently not checking them
24+
25+
error: not sure whether the path is accessible or not
26+
--> $DIR/cfg_accessible-not_sure.rs:27:18
27+
|
28+
LL | #[cfg_accessible(Union::unresolved)]
29+
| ^^^^^^^^^^^^^^^^^
30+
|
31+
= note: the type may have associated items, but we are currently not checking them
32+
33+
error: not sure whether the path is accessible or not
34+
--> $DIR/cfg_accessible-not_sure.rs:36:18
35+
|
36+
LL | #[cfg_accessible(Enum::unresolved)]
37+
| ^^^^^^^^^^^^^^^^
38+
|
39+
= note: the type may have associated items, but we are currently not checking them
40+
41+
error: not sure whether the path is accessible or not
42+
--> $DIR/cfg_accessible-not_sure.rs:46:18
43+
|
44+
LL | #[cfg_accessible(Trait::existing)]
45+
| ^^^^^^^^^^^^^^^
46+
|
47+
= note: the type may have associated items, but we are currently not checking them
48+
49+
error: not sure whether the path is accessible or not
50+
--> $DIR/cfg_accessible-not_sure.rs:48:18
51+
|
52+
LL | #[cfg_accessible(Trait::unresolved)]
53+
| ^^^^^^^^^^^^^^^^^
54+
|
55+
= note: the type may have associated items, but we are currently not checking them
56+
57+
error: not sure whether the path is accessible or not
58+
--> $DIR/cfg_accessible-not_sure.rs:55:18
59+
|
60+
LL | #[cfg_accessible(TypeAlias::existing)]
61+
| ^^^^^^^^^^^^^^^^^^^
62+
|
63+
= note: the type may have associated items, but we are currently not checking them
64+
65+
error: not sure whether the path is accessible or not
66+
--> $DIR/cfg_accessible-not_sure.rs:57:18
67+
|
68+
LL | #[cfg_accessible(TypeAlias::unresolved)]
69+
| ^^^^^^^^^^^^^^^^^^^^^
70+
|
71+
= note: the type may have associated items, but we are currently not checking them
72+
73+
error: not sure whether the path is accessible or not
74+
--> $DIR/cfg_accessible-not_sure.rs:66:18
75+
|
76+
LL | #[cfg_accessible(ForeignType::unresolved)]
77+
| ^^^^^^^^^^^^^^^^^^^^^^^
78+
|
79+
= note: the type may have associated items, but we are currently not checking them
80+
81+
error: not sure whether the path is accessible or not
82+
--> $DIR/cfg_accessible-not_sure.rs:75:18
83+
|
84+
LL | #[cfg_accessible(AssocType::AssocType::unresolved)]
85+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86+
|
87+
= note: the type may have associated items, but we are currently not checking them
88+
89+
error: not sure whether the path is accessible or not
90+
--> $DIR/cfg_accessible-not_sure.rs:80:18
91+
|
92+
LL | #[cfg_accessible(u8::unresolved)]
93+
| ^^^^^^^^^^^^^^
94+
|
95+
= note: the type may have associated items, but we are currently not checking them
96+
97+
error: not sure whether the path is accessible or not
98+
--> $DIR/cfg_accessible-not_sure.rs:82:18
99+
|
100+
LL | #[cfg_accessible(u8::is_ascii)]
101+
| ^^^^^^^^^^^^
102+
|
103+
= note: the type may have associated items, but we are currently not checking them
104+
105+
error: aborting due to 13 previous errors
106+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
error: not sure whether the path is accessible or not
2+
--> $DIR/cfg_accessible-not_sure.rs:14:18
3+
|
4+
LL | #[cfg_accessible(Struct::existing)]
5+
| ^^^^^^^^^^^^^^^^
6+
|
7+
= note: the type may have associated items, but we are currently not checking them
8+
9+
error: not sure whether the path is accessible or not
10+
--> $DIR/cfg_accessible-not_sure.rs:16:18
11+
|
12+
LL | #[cfg_accessible(Struct::unresolved)]
13+
| ^^^^^^^^^^^^^^^^^^
14+
|
15+
= note: the type may have associated items, but we are currently not checking them
16+
17+
error: not sure whether the path is accessible or not
18+
--> $DIR/cfg_accessible-not_sure.rs:25:18
19+
|
20+
LL | #[cfg_accessible(Union::existing)]
21+
| ^^^^^^^^^^^^^^^
22+
|
23+
= note: the type may have associated items, but we are currently not checking them
24+
25+
error: not sure whether the path is accessible or not
26+
--> $DIR/cfg_accessible-not_sure.rs:27:18
27+
|
28+
LL | #[cfg_accessible(Union::unresolved)]
29+
| ^^^^^^^^^^^^^^^^^
30+
|
31+
= note: the type may have associated items, but we are currently not checking them
32+
33+
error: not sure whether the path is accessible or not
34+
--> $DIR/cfg_accessible-not_sure.rs:36:18
35+
|
36+
LL | #[cfg_accessible(Enum::unresolved)]
37+
| ^^^^^^^^^^^^^^^^
38+
|
39+
= note: the type may have associated items, but we are currently not checking them
40+
41+
error: not sure whether the path is accessible or not
42+
--> $DIR/cfg_accessible-not_sure.rs:46:18
43+
|
44+
LL | #[cfg_accessible(Trait::existing)]
45+
| ^^^^^^^^^^^^^^^
46+
|
47+
= note: the type may have associated items, but we are currently not checking them
48+
49+
error: not sure whether the path is accessible or not
50+
--> $DIR/cfg_accessible-not_sure.rs:48:18
51+
|
52+
LL | #[cfg_accessible(Trait::unresolved)]
53+
| ^^^^^^^^^^^^^^^^^
54+
|
55+
= note: the type may have associated items, but we are currently not checking them
56+
57+
error: not sure whether the path is accessible or not
58+
--> $DIR/cfg_accessible-not_sure.rs:55:18
59+
|
60+
LL | #[cfg_accessible(TypeAlias::existing)]
61+
| ^^^^^^^^^^^^^^^^^^^
62+
|
63+
= note: the type may have associated items, but we are currently not checking them
64+
65+
error: not sure whether the path is accessible or not
66+
--> $DIR/cfg_accessible-not_sure.rs:57:18
67+
|
68+
LL | #[cfg_accessible(TypeAlias::unresolved)]
69+
| ^^^^^^^^^^^^^^^^^^^^^
70+
|
71+
= note: the type may have associated items, but we are currently not checking them
72+
73+
error: not sure whether the path is accessible or not
74+
--> $DIR/cfg_accessible-not_sure.rs:66:18
75+
|
76+
LL | #[cfg_accessible(ForeignType::unresolved)]
77+
| ^^^^^^^^^^^^^^^^^^^^^^^
78+
|
79+
= note: the type may have associated items, but we are currently not checking them
80+
81+
error: not sure whether the path is accessible or not
82+
--> $DIR/cfg_accessible-not_sure.rs:75:18
83+
|
84+
LL | #[cfg_accessible(AssocType::AssocType::unresolved)]
85+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86+
|
87+
= note: the type may have associated items, but we are currently not checking them
88+
89+
error: not sure whether the path is accessible or not
90+
--> $DIR/cfg_accessible-not_sure.rs:80:18
91+
|
92+
LL | #[cfg_accessible(u8::unresolved)]
93+
| ^^^^^^^^^^^^^^
94+
|
95+
= note: the type may have associated items, but we are currently not checking them
96+
97+
error: not sure whether the path is accessible or not
98+
--> $DIR/cfg_accessible-not_sure.rs:82:18
99+
|
100+
LL | #[cfg_accessible(u8::is_ascii)]
101+
| ^^^^^^^^^^^^
102+
|
103+
= note: the type may have associated items, but we are currently not checking them
104+
105+
error: aborting due to 13 previous errors
106+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// revisions: edition2015 edition2021
2+
// [edition2015]compile-flags: --edition=2015
3+
// [edition2021]compile-flags: --edition=2021
4+
5+
#![feature(extern_types)]
6+
#![feature(cfg_accessible)]
7+
8+
// Struct::unresolved - error
9+
10+
struct Struct {
11+
existing: u8,
12+
}
13+
14+
#[cfg_accessible(Struct::existing)] //~ ERROR not sure
15+
const A: bool = true;
16+
#[cfg_accessible(Struct::unresolved)] //~ ERROR not sure
17+
const B: bool = true;
18+
19+
// Union::unresolved - error
20+
21+
struct Union {
22+
existing: u8,
23+
}
24+
25+
#[cfg_accessible(Union::existing)] //~ ERROR not sure
26+
const A: bool = true;
27+
#[cfg_accessible(Union::unresolved)] //~ ERROR not sure
28+
const B: bool = true;
29+
30+
// Enum::unresolved - error
31+
32+
enum Enum {
33+
Existing { existing: u8 },
34+
}
35+
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;
42+
#[cfg_accessible(Enum::unresolved)] //~ ERROR not sure
43+
const C: bool = true;
44+
45+
// Trait::unresolved - false or error, depending on edition (error if you can write Trait::foo
46+
// instead of <dyn Trait>::foo for methods like impl dyn Trait { fn foo() {} })
47+
48+
trait Trait {}
49+
impl dyn Trait { fn existing() {} }
50+
51+
// FIXME: Should be a error for edition > 2015
52+
#[cfg_accessible(Trait::existing)] //~ ERROR not sure
53+
const A: bool = true;
54+
#[cfg_accessible(Trait::unresolved)] //~ ERROR not sure
55+
const B: bool = true;
56+
57+
// TypeAlias::unresolved - error
58+
59+
type TypeAlias = Struct;
60+
61+
#[cfg_accessible(TypeAlias::existing)] //~ ERROR not sure
62+
const A: bool = true;
63+
#[cfg_accessible(TypeAlias::unresolved)] //~ ERROR not sure
64+
const B: bool = true;
65+
66+
// ForeignType::unresolved - error
67+
68+
extern {
69+
type ForeignType;
70+
}
71+
72+
#[cfg_accessible(ForeignType::unresolved)] //~ ERROR not sure
73+
const A: bool = true;
74+
75+
// AssocType::unresolved - error
76+
77+
trait AssocType {
78+
type AssocType;
79+
}
80+
81+
#[cfg_accessible(AssocType::AssocType::unresolved)] //~ ERROR not sure
82+
const A: bool = true;
83+
84+
// PrimitiveType::unresolved - error
85+
86+
#[cfg_accessible(u8::unresolved)] //~ ERROR not sure
87+
const A: bool = true;
88+
#[cfg_accessible(u8::is_ascii)] //~ ERROR not sure
89+
const B: bool = true;
90+
91+
fn main() {}

0 commit comments

Comments
 (0)