Skip to content

Commit 9f073b0

Browse files
authored
Rollup merge of rust-lang#101904 - Rageking8:fix-101712, r=oli-obk
Add help for invalid inline argument Fixes rust-lang#101712 Removed 1 part of the test as its identical with another one. Do let me know if this is undesirable, so I can revert those changes.
2 parents 7697a24 + b248a6f commit 9f073b0

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

compiler/rustc_typeck/src/collect.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3154,6 +3154,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
31543154
E0535,
31553155
"invalid argument"
31563156
)
3157+
.help("valid inline arguments are `always` and `never`")
31573158
.emit();
31583159

31593160
InlineAttr::None

src/test/ui/invalid/invalid-inline.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
#![allow(dead_code)]
22

3-
#[inline(please_no)] //~ ERROR invalid argument
4-
fn a() {
5-
}
6-
73
#[inline(please,no)] //~ ERROR expected one argument
8-
fn b() {
4+
fn a() {
95
}
106

117
#[inline()] //~ ERROR expected one argument
12-
fn c() {
8+
fn b() {
139
}
1410

1511
fn main() {
1612
a();
1713
b();
18-
c();
1914
}
Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
error[E0535]: invalid argument
2-
--> $DIR/invalid-inline.rs:3:10
3-
|
4-
LL | #[inline(please_no)]
5-
| ^^^^^^^^^
6-
71
error[E0534]: expected one argument
8-
--> $DIR/invalid-inline.rs:7:1
2+
--> $DIR/invalid-inline.rs:3:1
93
|
104
LL | #[inline(please,no)]
115
| ^^^^^^^^^^^^^^^^^^^^
126

137
error[E0534]: expected one argument
14-
--> $DIR/invalid-inline.rs:11:1
8+
--> $DIR/invalid-inline.rs:7:1
159
|
1610
LL | #[inline()]
1711
| ^^^^^^^^^^^
1812

19-
error: aborting due to 3 previous errors
13+
error: aborting due to 2 previous errors
2014

21-
Some errors have detailed explanations: E0534, E0535.
22-
For more information about an error, try `rustc --explain E0534`.
15+
For more information about this error, try `rustc --explain E0534`.

src/test/ui/span/E0535.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ error[E0535]: invalid argument
33
|
44
LL | #[inline(unknown)]
55
| ^^^^^^^
6+
|
7+
= help: valid inline arguments are `always` and `never`
68

79
error: aborting due to previous error
810

0 commit comments

Comments
 (0)