Skip to content

Commit

Permalink
remove suggestion that cannot always be applied
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Sep 5, 2024
1 parent 7a0922c commit d2aa0e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 0 additions & 2 deletions compiler/rustc_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,8 +1191,6 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for NakedFunctionsAsmBlock {
pub(crate) struct NakedFunctionsMustNakedAsm {
#[primary_span]
pub span: Span,
#[suggestion(code = "naked_asm!", applicability = "machine-applicable")]
pub macro_span: Span,
}

#[derive(Diagnostic)]
Expand Down
7 changes: 2 additions & 5 deletions compiler/rustc_passes/src/naked_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_middle::query::Providers;
use rustc_middle::ty::TyCtxt;
use rustc_session::lint::builtin::UNDEFINED_NAKED_FUNCTION_ABI;
use rustc_span::symbol::sym;
use rustc_span::{BytePos, Span};
use rustc_span::Span;
use rustc_target::spec::abi::Abi;

use crate::errors::{
Expand Down Expand Up @@ -133,10 +133,7 @@ fn check_asm<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId, body: &'tcx hir::Body<
ItemKind::InlineAsm => {
has_err = true;

// the span that contains the `asm!` call,
// so tooling can replace it with `naked_asm!`
let macro_span = span.with_hi(span.lo() + BytePos("asm!".len() as u32));
tcx.dcx().emit_err(NakedFunctionsMustNakedAsm { span, macro_span });
tcx.dcx().emit_err(NakedFunctionsMustNakedAsm { span });
}
ItemKind::NonAsm => {
must_show_error = true;
Expand Down

0 comments on commit d2aa0e0

Please sign in to comment.