Skip to content

Commit 3d8d1e7

Browse files
Add a few more cases to the unsupported_attribute.rs test
Signed-off-by: Jonathan Brouwer <[email protected]>
1 parent d1fed9c commit 3d8d1e7

File tree

3 files changed

+81
-28
lines changed

3 files changed

+81
-28
lines changed

tests/crashes/138510.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/ui/where-clauses/unsupported_attribute.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#![feature(custom_test_frameworks)]
66
#![feature(derive_const)]
77
#![feature(where_clause_attrs)]
8+
#![feature(stmt_expr_attributes)]
89
#![allow(soft_unstable)]
910

1011
trait Trait {}
@@ -33,4 +34,15 @@ where
3334
//~| ERROR expected non-macro attribute, found attribute macro `derive`
3435
#[rustfmt::skip] T: Trait, //~ ERROR most attributes are not supported in `where` clauses
3536
#[rustfmt::skip] 'a: 'static, //~ ERROR most attributes are not supported in `where` clauses
37+
#[must_use] T: Trait, //~ ERROR most attributes are not supported in `where` clauses
38+
#[must_use] 'a: 'static, //~ ERROR most attributes are not supported in `where` clauses
39+
#[cold] T: Trait, //~ ERROR most attributes are not supported in `where` clauses
40+
#[cold] 'a: 'static, //~ ERROR most attributes are not supported in `where` clauses
41+
#[repr()] T: Trait, //~ ERROR most attributes are not supported in `where` clauses
42+
#[repr()] 'a: 'static, //~ ERROR most attributes are not supported in `where` clauses
3643
{}
44+
45+
fn another_one() {
46+
// Regression test for https://github.com/rust-lang/rust/issues/143787
47+
let _: String = #[repr()] std::string::String::new();
48+
}
Lines changed: 69 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,206 @@
11
error: expected non-macro attribute, found attribute macro `derive`
2-
--> $DIR/unsupported_attribute.rs:28:7
2+
--> $DIR/unsupported_attribute.rs:29:7
33
|
44
LL | #[derive(Clone)] T: Trait,
55
| ^^^^^^ not a non-macro attribute
66

77
error: expected non-macro attribute, found attribute macro `derive`
8-
--> $DIR/unsupported_attribute.rs:31:7
8+
--> $DIR/unsupported_attribute.rs:32:7
99
|
1010
LL | #[derive(Clone)] 'a: 'static,
1111
| ^^^^^^ not a non-macro attribute
1212

1313
error: most attributes are not supported in `where` clauses
14-
--> $DIR/unsupported_attribute.rs:14:5
14+
--> $DIR/unsupported_attribute.rs:15:5
1515
|
1616
LL | #[doc = "doc"] T: Trait,
1717
| ^^^^^^^^^^^^^^
1818
|
1919
= help: only `#[cfg]` and `#[cfg_attr]` are supported
2020

2121
error: most attributes are not supported in `where` clauses
22-
--> $DIR/unsupported_attribute.rs:15:5
22+
--> $DIR/unsupported_attribute.rs:16:5
2323
|
2424
LL | #[doc = "doc"] 'a: 'static,
2525
| ^^^^^^^^^^^^^^
2626
|
2727
= help: only `#[cfg]` and `#[cfg_attr]` are supported
2828

2929
error: most attributes are not supported in `where` clauses
30-
--> $DIR/unsupported_attribute.rs:16:5
30+
--> $DIR/unsupported_attribute.rs:17:5
3131
|
3232
LL | #[ignore] T: Trait,
3333
| ^^^^^^^^^
3434
|
3535
= help: only `#[cfg]` and `#[cfg_attr]` are supported
3636

3737
error: most attributes are not supported in `where` clauses
38-
--> $DIR/unsupported_attribute.rs:17:5
38+
--> $DIR/unsupported_attribute.rs:18:5
3939
|
4040
LL | #[ignore] 'a: 'static,
4141
| ^^^^^^^^^
4242
|
4343
= help: only `#[cfg]` and `#[cfg_attr]` are supported
4444

4545
error: most attributes are not supported in `where` clauses
46-
--> $DIR/unsupported_attribute.rs:18:5
46+
--> $DIR/unsupported_attribute.rs:19:5
4747
|
4848
LL | #[should_panic] T: Trait,
4949
| ^^^^^^^^^^^^^^^
5050
|
5151
= help: only `#[cfg]` and `#[cfg_attr]` are supported
5252

5353
error: most attributes are not supported in `where` clauses
54-
--> $DIR/unsupported_attribute.rs:19:5
54+
--> $DIR/unsupported_attribute.rs:20:5
5555
|
5656
LL | #[should_panic] 'a: 'static,
5757
| ^^^^^^^^^^^^^^^
5858
|
5959
= help: only `#[cfg]` and `#[cfg_attr]` are supported
6060

6161
error: most attributes are not supported in `where` clauses
62-
--> $DIR/unsupported_attribute.rs:20:5
62+
--> $DIR/unsupported_attribute.rs:21:5
6363
|
6464
LL | #[macro_use] T: Trait,
6565
| ^^^^^^^^^^^^
6666
|
6767
= help: only `#[cfg]` and `#[cfg_attr]` are supported
6868

6969
error: most attributes are not supported in `where` clauses
70-
--> $DIR/unsupported_attribute.rs:21:5
70+
--> $DIR/unsupported_attribute.rs:22:5
7171
|
7272
LL | #[macro_use] 'a: 'static,
7373
| ^^^^^^^^^^^^
7474
|
7575
= help: only `#[cfg]` and `#[cfg_attr]` are supported
7676

7777
error: most attributes are not supported in `where` clauses
78-
--> $DIR/unsupported_attribute.rs:22:5
78+
--> $DIR/unsupported_attribute.rs:23:5
7979
|
8080
LL | #[allow(unused)] T: Trait,
8181
| ^^^^^^^^^^^^^^^^
8282
|
8383
= help: only `#[cfg]` and `#[cfg_attr]` are supported
8484

8585
error: most attributes are not supported in `where` clauses
86-
--> $DIR/unsupported_attribute.rs:23:5
86+
--> $DIR/unsupported_attribute.rs:24:5
8787
|
8888
LL | #[allow(unused)] 'a: 'static,
8989
| ^^^^^^^^^^^^^^^^
9090
|
9191
= help: only `#[cfg]` and `#[cfg_attr]` are supported
9292

9393
error: most attributes are not supported in `where` clauses
94-
--> $DIR/unsupported_attribute.rs:24:5
94+
--> $DIR/unsupported_attribute.rs:25:5
9595
|
9696
LL | #[deprecated] T: Trait,
9797
| ^^^^^^^^^^^^^
9898
|
9999
= help: only `#[cfg]` and `#[cfg_attr]` are supported
100100

101101
error: most attributes are not supported in `where` clauses
102-
--> $DIR/unsupported_attribute.rs:25:5
102+
--> $DIR/unsupported_attribute.rs:26:5
103103
|
104104
LL | #[deprecated] 'a: 'static,
105105
| ^^^^^^^^^^^^^
106106
|
107107
= help: only `#[cfg]` and `#[cfg_attr]` are supported
108108

109109
error: most attributes are not supported in `where` clauses
110-
--> $DIR/unsupported_attribute.rs:26:5
110+
--> $DIR/unsupported_attribute.rs:27:5
111111
|
112112
LL | #[automatically_derived] T: Trait,
113113
| ^^^^^^^^^^^^^^^^^^^^^^^^
114114
|
115115
= help: only `#[cfg]` and `#[cfg_attr]` are supported
116116

117117
error: most attributes are not supported in `where` clauses
118-
--> $DIR/unsupported_attribute.rs:27:5
118+
--> $DIR/unsupported_attribute.rs:28:5
119119
|
120120
LL | #[automatically_derived] 'a: 'static,
121121
| ^^^^^^^^^^^^^^^^^^^^^^^^
122122
|
123123
= help: only `#[cfg]` and `#[cfg_attr]` are supported
124124

125125
error: most attributes are not supported in `where` clauses
126-
--> $DIR/unsupported_attribute.rs:28:5
126+
--> $DIR/unsupported_attribute.rs:29:5
127127
|
128128
LL | #[derive(Clone)] T: Trait,
129129
| ^^^^^^^^^^^^^^^^
130130
|
131131
= help: only `#[cfg]` and `#[cfg_attr]` are supported
132132

133133
error: most attributes are not supported in `where` clauses
134-
--> $DIR/unsupported_attribute.rs:31:5
134+
--> $DIR/unsupported_attribute.rs:32:5
135135
|
136136
LL | #[derive(Clone)] 'a: 'static,
137137
| ^^^^^^^^^^^^^^^^
138138
|
139139
= help: only `#[cfg]` and `#[cfg_attr]` are supported
140140

141141
error: most attributes are not supported in `where` clauses
142-
--> $DIR/unsupported_attribute.rs:34:5
142+
--> $DIR/unsupported_attribute.rs:35:5
143143
|
144144
LL | #[rustfmt::skip] T: Trait,
145145
| ^^^^^^^^^^^^^^^^
146146
|
147147
= help: only `#[cfg]` and `#[cfg_attr]` are supported
148148

149149
error: most attributes are not supported in `where` clauses
150-
--> $DIR/unsupported_attribute.rs:35:5
150+
--> $DIR/unsupported_attribute.rs:36:5
151151
|
152152
LL | #[rustfmt::skip] 'a: 'static,
153153
| ^^^^^^^^^^^^^^^^
154154
|
155155
= help: only `#[cfg]` and `#[cfg_attr]` are supported
156156

157-
error: aborting due to 20 previous errors
157+
error: most attributes are not supported in `where` clauses
158+
--> $DIR/unsupported_attribute.rs:37:5
159+
|
160+
LL | #[must_use] T: Trait,
161+
| ^^^^^^^^^^^
162+
|
163+
= help: only `#[cfg]` and `#[cfg_attr]` are supported
164+
165+
error: most attributes are not supported in `where` clauses
166+
--> $DIR/unsupported_attribute.rs:38:5
167+
|
168+
LL | #[must_use] 'a: 'static,
169+
| ^^^^^^^^^^^
170+
|
171+
= help: only `#[cfg]` and `#[cfg_attr]` are supported
172+
173+
error: most attributes are not supported in `where` clauses
174+
--> $DIR/unsupported_attribute.rs:39:5
175+
|
176+
LL | #[cold] T: Trait,
177+
| ^^^^^^^
178+
|
179+
= help: only `#[cfg]` and `#[cfg_attr]` are supported
180+
181+
error: most attributes are not supported in `where` clauses
182+
--> $DIR/unsupported_attribute.rs:40:5
183+
|
184+
LL | #[cold] 'a: 'static,
185+
| ^^^^^^^
186+
|
187+
= help: only `#[cfg]` and `#[cfg_attr]` are supported
188+
189+
error: most attributes are not supported in `where` clauses
190+
--> $DIR/unsupported_attribute.rs:41:5
191+
|
192+
LL | #[repr()] T: Trait,
193+
| ^^^^^^^^^
194+
|
195+
= help: only `#[cfg]` and `#[cfg_attr]` are supported
196+
197+
error: most attributes are not supported in `where` clauses
198+
--> $DIR/unsupported_attribute.rs:42:5
199+
|
200+
LL | #[repr()] 'a: 'static,
201+
| ^^^^^^^^^
202+
|
203+
= help: only `#[cfg]` and `#[cfg_attr]` are supported
204+
205+
error: aborting due to 26 previous errors
158206

0 commit comments

Comments
 (0)