Allow #[inline] on closures

Fixes #49632
This commit is contained in:
Amanieu d'Antras 2018-04-27 07:20:46 +02:00
parent 9822b5709c
commit 5f2c111165
8 changed files with 54 additions and 32 deletions

View file

@ -1,19 +1,19 @@
error[E0518]: attribute should be applied to function
error[E0518]: attribute should be applied to function or closure
--> $DIR/E0518.rs:11:1
|
LL | #[inline(always)] //~ ERROR: E0518
| ^^^^^^^^^^^^^^^^^
LL | struct Foo;
| ----------- not a function
| ----------- not a function or closure
error[E0518]: attribute should be applied to function
error[E0518]: attribute should be applied to function or closure
--> $DIR/E0518.rs:14:1
|
LL | #[inline(never)] //~ ERROR: E0518
| ^^^^^^^^^^^^^^^^
LL | / impl Foo {
LL | | }
| |_- not a function
| |_- not a function or closure
error: aborting due to 2 previous errors

View file

@ -19,21 +19,21 @@
#![inline = "2100"]
#[inline = "2100"]
//~^ ERROR attribute should be applied to function
//~^ ERROR attribute should be applied to function or closure
mod inline {
mod inner { #![inline="2100"] }
//~^ ERROR attribute should be applied to function
//~^ ERROR attribute should be applied to function or closure
#[inline = "2100"] fn f() { }
#[inline = "2100"] struct S;
//~^ ERROR attribute should be applied to function
//~^ ERROR attribute should be applied to function or closure
#[inline = "2100"] type T = S;
//~^ ERROR attribute should be applied to function
//~^ ERROR attribute should be applied to function or closure
#[inline = "2100"] impl S { }
//~^ ERROR attribute should be applied to function
//~^ ERROR attribute should be applied to function or closure
}
fn main() {}

View file

@ -1,41 +1,41 @@
error[E0518]: attribute should be applied to function
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43106-gating-of-inline.rs:21:1
|
LL | #[inline = "2100"]
| ^^^^^^^^^^^^^^^^^^
LL | //~^ ERROR attribute should be applied to function
LL | //~^ ERROR attribute should be applied to function or closure
LL | / mod inline {
LL | | mod inner { #![inline="2100"] }
LL | | //~^ ERROR attribute should be applied to function
LL | | //~^ ERROR attribute should be applied to function or closure
LL | |
... |
LL | | //~^ ERROR attribute should be applied to function
LL | | //~^ ERROR attribute should be applied to function or closure
LL | | }
| |_- not a function
| |_- not a function or closure
error[E0518]: attribute should be applied to function
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43106-gating-of-inline.rs:24:17
|
LL | mod inner { #![inline="2100"] }
| ------------^^^^^^^^^^^^^^^^^-- not a function
| ------------^^^^^^^^^^^^^^^^^-- not a function or closure
error[E0518]: attribute should be applied to function
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43106-gating-of-inline.rs:29:5
|
LL | #[inline = "2100"] struct S;
| ^^^^^^^^^^^^^^^^^^ --------- not a function
| ^^^^^^^^^^^^^^^^^^ --------- not a function or closure
error[E0518]: attribute should be applied to function
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43106-gating-of-inline.rs:32:5
|
LL | #[inline = "2100"] type T = S;
| ^^^^^^^^^^^^^^^^^^ ----------- not a function
| ^^^^^^^^^^^^^^^^^^ ----------- not a function or closure
error[E0518]: attribute should be applied to function
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43106-gating-of-inline.rs:35:5
|
LL | #[inline = "2100"] impl S { }
| ^^^^^^^^^^^^^^^^^^ ---------- not a function
| ^^^^^^^^^^^^^^^^^^ ---------- not a function or closure
error: aborting due to 5 previous errors