track_caller: harden naked interactions
This commit is contained in:
parent
42abbd8878
commit
f6c729d4a0
3 changed files with 29 additions and 4 deletions
|
|
@ -141,7 +141,7 @@ impl CheckAttrVisitor<'tcx> {
|
|||
target: Target,
|
||||
) -> bool {
|
||||
match target {
|
||||
Target::Fn if attr::contains_name(attrs, sym::naked) => {
|
||||
_ if attr::contains_name(attrs, sym::naked) => {
|
||||
struct_span_err!(
|
||||
self.tcx.sess,
|
||||
*attr_span,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,21 @@
|
|||
#![feature(naked_functions, track_caller)]
|
||||
|
||||
#[track_caller]
|
||||
#[track_caller] //~ ERROR cannot use `#[track_caller]` with `#[naked]`
|
||||
#[naked]
|
||||
fn f() {}
|
||||
//~^^^ ERROR cannot use `#[track_caller]` with `#[naked]`
|
||||
|
||||
struct S;
|
||||
|
||||
impl S {
|
||||
#[track_caller] //~ ERROR cannot use `#[track_caller]` with `#[naked]`
|
||||
#[naked]
|
||||
fn g() {}
|
||||
}
|
||||
|
||||
extern "Rust" {
|
||||
#[track_caller] //~ ERROR cannot use `#[track_caller]` with `#[naked]`
|
||||
#[naked]
|
||||
fn h();
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,18 @@ error[E0736]: cannot use `#[track_caller]` with `#[naked]`
|
|||
LL | #[track_caller]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0736]: cannot use `#[track_caller]` with `#[naked]`
|
||||
--> $DIR/error-with-naked.rs:16:5
|
||||
|
|
||||
LL | #[track_caller]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0736]: cannot use `#[track_caller]` with `#[naked]`
|
||||
--> $DIR/error-with-naked.rs:10:5
|
||||
|
|
||||
LL | #[track_caller]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0736`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue