Add E0534 error explanation
This commit is contained in:
parent
028c796363
commit
38a0177917
@ -373,7 +373,7 @@ pub fn find_inline_attr(diagnostic: Option<&Handler>, attrs: &[Attribute]) -> In
|
|||||||
InlineAttr::None
|
InlineAttr::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => ia
|
_ => ia,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,43 @@ fn main() {}
|
|||||||
```
|
```
|
||||||
"##,
|
"##,
|
||||||
|
|
||||||
|
E0534: r##"
|
||||||
|
The inline attribute was badly used.
|
||||||
|
|
||||||
|
Erroneous code example:
|
||||||
|
|
||||||
|
```compile_fail,E0534
|
||||||
|
#[inline()] // error: expected one argument
|
||||||
|
pub fn something() {}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
|
```
|
||||||
|
|
||||||
|
The inline attribute can be used without arguments:
|
||||||
|
|
||||||
|
```
|
||||||
|
#[inline] // ok!
|
||||||
|
pub fn something() {}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
|
```
|
||||||
|
|
||||||
|
Or with arguments (and parens have to be used for this case!):
|
||||||
|
|
||||||
|
```
|
||||||
|
#[inline(always)] // ok!
|
||||||
|
pub fn something() {}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information about the inline attribute, take a look here:
|
||||||
|
https://doc.rust-lang.org/reference.html#inline-attributes)
|
||||||
|
"##,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
register_diagnostics! {
|
register_diagnostics! {
|
||||||
E0534, // expected one argument
|
|
||||||
E0535, // invalid argument
|
E0535, // invalid argument
|
||||||
E0536, // expected 1 cfg-pattern
|
E0536, // expected 1 cfg-pattern
|
||||||
E0537, // invalid predicate
|
E0537, // invalid predicate
|
||||||
|
Loading…
Reference in New Issue
Block a user