diff options
| author | Sven Kanoldt <sven@d34dl0ck.me> | 2024-12-09 20:23:02 +0100 |
|---|---|---|
| committer | Sven Kanoldt <sven@d34dl0ck.me> | 2024-12-09 20:51:34 +0100 |
| commit | 7951d1928086c2c64b80f9ea5d512d365bfdf9b6 (patch) | |
| tree | fcef8726a73bc0728df94e13e5ed2f6d64dad591 | |
| parent | 1696f534abe0655ee43ed57972a62d1cce42c233 (diff) | |
| download | rust-7951d1928086c2c64b80f9ea5d512d365bfdf9b6.tar.gz rust-7951d1928086c2c64b80f9ea5d512d365bfdf9b6.zip | |
Apply suggestions from code review
commit suggestion of not always pretty printing Co-authored-by: Urgau <3616612+Urgau@users.noreply.github.com>
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/codegen_attrs.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index 59c543bb397..56f0cdbb319 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -120,7 +120,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { mixed_export_name_no_mangle_lint_state.track_no_mangle( attr.span, tcx.local_def_id_to_hir_id(did), - rustc_ast_pretty::pprust::attribute_to_string(attr), + attr, ); } else { tcx.dcx() @@ -788,22 +788,22 @@ fn check_link_name_xor_ordinal( } #[derive(Default)] -struct MixedExportNameAndNoMangleState { +struct MixedExportNameAndNoMangleState<'a> { export_name: Option<Span>, hir_id: Option<HirId>, no_mangle: Option<Span>, - no_mangle_attr_name: Option<String>, + no_mangle_attr: Option<&'a ast::Attribute>, } -impl MixedExportNameAndNoMangleState { +impl<'a> MixedExportNameAndNoMangleState<'a> { fn track_export_name(&mut self, span: Span) { self.export_name = Some(span); } - fn track_no_mangle(&mut self, span: Span, hir_id: HirId, attr_name: String) { + fn track_no_mangle(&mut self, span: Span, hir_id: HirId, attr_name: &'a ast::Attribute) { self.no_mangle = Some(span); self.hir_id = Some(hir_id); - self.no_mangle_attr_name = Some(attr_name); + self.no_mangle_attr = Some(attr_name); } /// Emit diagnostics if the lint condition is met. @@ -812,7 +812,7 @@ impl MixedExportNameAndNoMangleState { export_name: Some(export_name), no_mangle: Some(no_mangle), hir_id: Some(hir_id), - no_mangle_attr_name: Some(no_mangle_attr_name), + no_mangle_attr: Some(no_mangle_attr), } = self { tcx.emit_node_span_lint( @@ -821,7 +821,7 @@ impl MixedExportNameAndNoMangleState { no_mangle, errors::MixedExportNameAndNoMangle { no_mangle, - no_mangle_attr: no_mangle_attr_name, + no_mangle_attr: rustc_ast_pretty::pprust::attribute_to_string(no_mangle_attr), export_name, removal_span: no_mangle, }, |
