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,
#![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() {}
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`.