Skip to content

Commit 7a85aa9

Browse files
Update uitests
Signed-off-by: Jonathan Brouwer <[email protected]>
1 parent 6366b78 commit 7a85aa9

File tree

103 files changed

+2445
-2258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2445
-2258
lines changed

tests/crashes/138510.rs

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

tests/rustdoc-ui/check-doc-alias-attr-location.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ error: `#[doc(alias = "...")]` isn't allowed on foreign module
44
LL | #[doc(alias = "foo")]
55
| ^^^^^^^^^^^^^
66

7-
error: `#[doc(alias = "...")]` isn't allowed on inherent implementation block
7+
error: `#[doc(alias = "...")]` isn't allowed on implementation block
88
--> $DIR/check-doc-alias-attr-location.rs:10:7
99
|
1010
LL | #[doc(alias = "bar")]
1111
| ^^^^^^^^^^^^^
1212

13-
error: `#[doc(alias = "...")]` isn't allowed on trait implementation block
13+
error: `#[doc(alias = "...")]` isn't allowed on implementation block
1414
--> $DIR/check-doc-alias-attr-location.rs:16:7
1515
|
1616
LL | #[doc(alias = "foobar")]

tests/ui/asm/naked-invalid-attr.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
// Checks that the #[unsafe(naked)] attribute can be placed on function definitions only.
22
//
33
//@ needs-asm-support
4-
#![unsafe(naked)] //~ ERROR should be applied to a function definition
4+
#![unsafe(naked)] //~ ERROR attribute cannot be used on
55

66
use std::arch::naked_asm;
77

88
extern "C" {
9-
#[unsafe(naked)] //~ ERROR should be applied to a function definition
9+
#[unsafe(naked)] //~ ERROR attribute cannot be used on
1010
fn f();
1111
}
1212

13-
#[unsafe(naked)] //~ ERROR should be applied to a function definition
13+
#[unsafe(naked)] //~ ERROR attribute cannot be used on
1414
#[repr(C)]
1515
struct S {
16-
#[unsafe(naked)] //~ ERROR should be applied to a function definition
16+
#[unsafe(naked)] //~ ERROR attribute cannot be used on
1717
a: u32,
1818
b: u32,
1919
}
2020

2121
trait Invoke {
22-
#[unsafe(naked)] //~ ERROR should be applied to a function definition
22+
#[unsafe(naked)] //~ ERROR attribute cannot be used on
2323
extern "C" fn invoke(&self);
2424
}
2525

@@ -48,7 +48,7 @@ impl S {
4848
}
4949

5050
fn main() {
51-
#[unsafe(naked)] //~ ERROR should be applied to a function definition
51+
#[unsafe(naked)] //~ ERROR attribute cannot be used on
5252
|| {};
5353
}
5454

tests/ui/asm/naked-invalid-attr.stderr

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,62 @@ error[E0433]: failed to resolve: use of unresolved module or unlinked crate `a`
44
LL | #[::a]
55
| ^ use of unresolved module or unlinked crate `a`
66

7-
error[E0736]: attribute incompatible with `#[unsafe(naked)]`
8-
--> $DIR/naked-invalid-attr.rs:56:3
7+
error: `#[naked]` attribute cannot be used on crates
8+
--> $DIR/naked-invalid-attr.rs:4:1
99
|
10-
LL | #[::a]
11-
| ^^^ the `::a` attribute is incompatible with `#[unsafe(naked)]`
12-
...
13-
LL | #[unsafe(naked)]
14-
| ---------------- function marked with `#[unsafe(naked)]` here
15-
16-
error: attribute should be applied to a function definition
17-
--> $DIR/naked-invalid-attr.rs:13:1
10+
LL | #![unsafe(naked)]
11+
| ^^^^^^^^^^^^^^^^^
1812
|
19-
LL | #[unsafe(naked)]
20-
| ^^^^^^^^^^^^^^^^
21-
LL | #[repr(C)]
22-
LL | / struct S {
23-
LL | | #[unsafe(naked)]
24-
LL | | a: u32,
25-
LL | | b: u32,
26-
LL | | }
27-
| |_- not a function definition
13+
= help: `#[naked]` can only be applied to functions
2814

29-
error: attribute should be applied to a function definition
30-
--> $DIR/naked-invalid-attr.rs:16:5
15+
error: `#[naked]` attribute cannot be used on foreign functions
16+
--> $DIR/naked-invalid-attr.rs:9:5
3117
|
3218
LL | #[unsafe(naked)]
3319
| ^^^^^^^^^^^^^^^^
34-
LL | a: u32,
35-
| ------ not a function definition
20+
|
21+
= help: `#[naked]` can be applied to methods, functions
3622

37-
error: attribute should be applied to a function definition
38-
--> $DIR/naked-invalid-attr.rs:51:5
23+
error: `#[naked]` attribute cannot be used on structs
24+
--> $DIR/naked-invalid-attr.rs:13:1
25+
|
26+
LL | #[unsafe(naked)]
27+
| ^^^^^^^^^^^^^^^^
28+
|
29+
= help: `#[naked]` can only be applied to functions
30+
31+
error: `#[naked]` attribute cannot be used on struct fields
32+
--> $DIR/naked-invalid-attr.rs:16:5
3933
|
4034
LL | #[unsafe(naked)]
4135
| ^^^^^^^^^^^^^^^^
42-
LL | || {};
43-
| ----- not a function definition
36+
|
37+
= help: `#[naked]` can only be applied to functions
4438

45-
error: attribute should be applied to a function definition
39+
error: `#[naked]` attribute cannot be used on required trait methods
4640
--> $DIR/naked-invalid-attr.rs:22:5
4741
|
4842
LL | #[unsafe(naked)]
4943
| ^^^^^^^^^^^^^^^^
50-
LL | extern "C" fn invoke(&self);
51-
| ---------------------------- not a function definition
44+
|
45+
= help: `#[naked]` can be applied to functions, inherent methods, provided trait methods, trait methods in impl blocks
5246

53-
error: attribute should be applied to a function definition
54-
--> $DIR/naked-invalid-attr.rs:9:5
47+
error: `#[naked]` attribute cannot be used on closures
48+
--> $DIR/naked-invalid-attr.rs:51:5
5549
|
5650
LL | #[unsafe(naked)]
5751
| ^^^^^^^^^^^^^^^^
58-
LL | fn f();
59-
| ------- not a function definition
52+
|
53+
= help: `#[naked]` can be applied to methods, functions
6054

61-
error: attribute should be applied to a function definition
62-
--> $DIR/naked-invalid-attr.rs:4:1
55+
error[E0736]: attribute incompatible with `#[unsafe(naked)]`
56+
--> $DIR/naked-invalid-attr.rs:56:3
6357
|
64-
LL | #![unsafe(naked)]
65-
| ^^^^^^^^^^^^^^^^^ cannot be applied to crates
58+
LL | #[::a]
59+
| ^^^ the `::a` attribute is incompatible with `#[unsafe(naked)]`
60+
...
61+
LL | #[unsafe(naked)]
62+
| ---------------- function marked with `#[unsafe(naked)]` here
6663

6764
error: aborting due to 8 previous errors
6865

tests/ui/attributes/attrs-on-params.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This checks that incorrect params on function parameters are caught
22

33
fn function(#[inline] param: u32) {
4-
//~^ ERROR attribute should be applied to function or closure
4+
//~^ ERROR attribute cannot be used on
55
//~| ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes
66
}
77

tests/ui/attributes/attrs-on-params.stderr

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed
44
LL | fn function(#[inline] param: u32) {
55
| ^^^^^^^^^
66

7-
error[E0518]: attribute should be applied to function or closure
7+
error: `#[inline]` attribute cannot be used on function params
88
--> $DIR/attrs-on-params.rs:3:13
99
|
1010
LL | fn function(#[inline] param: u32) {
11-
| ^^^^^^^^^-----------
12-
| |
13-
| not a function or closure
11+
| ^^^^^^^^^
12+
|
13+
= help: `#[inline]` can only be applied to functions
1414

1515
error: aborting due to 2 previous errors
1616

17-
For more information about this error, try `rustc --explain E0518`.

tests/ui/attributes/cold-attribute-application-54044.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
#![deny(unused_attributes)] //~ NOTE lint level is defined here
33

44
#[cold]
5-
//~^ ERROR attribute should be applied to a function
6-
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
7-
struct Foo; //~ NOTE not a function
5+
//~^ ERROR attribute cannot be used on
6+
//~| WARN previously accepted
7+
struct Foo;
88

99
fn main() {
1010
#[cold]
11-
//~^ ERROR attribute should be applied to a function
12-
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
13-
5; //~ NOTE not a function
11+
//~^ ERROR attribute cannot be used on
12+
//~| WARN previously accepted
13+
5;
1414
}
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
1-
error: attribute should be applied to a function definition
1+
error: `#[cold]` attribute cannot be used on structs
22
--> $DIR/cold-attribute-application-54044.rs:4:1
33
|
44
LL | #[cold]
55
| ^^^^^^^
6-
...
7-
LL | struct Foo;
8-
| ----------- not a function definition
96
|
107
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8+
= help: `#[cold]` can only be applied to functions
119
note: the lint level is defined here
1210
--> $DIR/cold-attribute-application-54044.rs:2:9
1311
|
1412
LL | #![deny(unused_attributes)]
1513
| ^^^^^^^^^^^^^^^^^
1614

17-
error: attribute should be applied to a function definition
15+
error: `#[cold]` attribute cannot be used on expressions
1816
--> $DIR/cold-attribute-application-54044.rs:10:5
1917
|
2018
LL | #[cold]
2119
| ^^^^^^^
22-
...
23-
LL | 5;
24-
| - not a function definition
2520
|
2621
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
22+
= help: `#[cold]` can only be applied to functions
2723

2824
error: aborting due to 2 previous errors
2925

tests/ui/attributes/empty-repr.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Regression test for https://github.com/rust-lang/rust/issues/138510
2+
3+
#![feature(where_clause_attrs)]
4+
#![deny(unused_attributes)]
5+
6+
fn main() {
7+
}
8+
9+
fn test() where
10+
#[repr()]
11+
//~^ ERROR unused attribute
12+
(): Sized {
13+
14+
}

tests/ui/attributes/empty-repr.stderr

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: unused attribute
2+
--> $DIR/empty-repr.rs:10:1
3+
|
4+
LL | #[repr()]
5+
| ^^^^^^^^^ help: remove this attribute
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/empty-repr.rs:4:9
9+
|
10+
LL | #![deny(unused_attributes)]
11+
| ^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to 1 previous error
14+

0 commit comments

Comments
 (0)