about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2025-01-17 08:00:28 -0500
committerjyn <github@jyn.dev>2025-01-20 16:46:47 -0500
commit26708aa941d64242e2cd8a8e29e0d16c875bcc2a (patch)
treefb2c105856459872d529c4dc5a3dc5e173553081 /compiler
parentb757663a00260e22799a1bbdc5d6ba603e4bb30d (diff)
downloadrust-26708aa941d64242e2cd8a8e29e0d16c875bcc2a.tar.gz
rust-26708aa941d64242e2cd8a8e29e0d16c875bcc2a.zip
Don't require `--verbose` to show linker stdout
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/link.rs11
-rw-r--r--compiler/rustc_passes/src/check_attr.rs17
2 files changed, 20 insertions, 8 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index 80758aac134..fae59a3b9dc 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1040,6 +1040,11 @@ fn link_natively(
                 sess.dcx().abort_if_errors();
             }
 
+            let stderr = escape_string(&prog.stderr);
+            let stdout = escape_string(&prog.stdout);
+            info!("linker stderr:\n{}", &stderr);
+            info!("linker stdout:\n{}", &stdout);
+
             let (level, src) = codegen_results.crate_info.lint_levels.linker_messages;
             let lint = |msg| {
                 lint_level(sess, LINKER_MESSAGES, level, src, None, |diag| {
@@ -1049,16 +1054,14 @@ fn link_natively(
 
             if !prog.stderr.is_empty() {
                 // We already print `warning:` at the start of the diagnostic. Remove it from the linker output if present.
-                let stderr = escape_string(&prog.stderr);
-                debug!("original stderr: {stderr}");
                 let stderr = stderr
                     .strip_prefix("warning: ")
                     .unwrap_or(&stderr)
                     .replace(": warning: ", ": ");
                 lint(format!("linker stderr: {stderr}"));
             }
-            if !prog.stdout.is_empty() && sess.opts.verbose {
-                lint(format!("linker stdout: {}", escape_string(&prog.stdout)))
+            if !prog.stdout.is_empty() {
+                lint(format!("linker stdout: {}", stdout))
             }
         }
         Err(e) => {
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 7df792c0f79..3d88fe1a4d3 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -2338,11 +2338,20 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
             })
         {
             if hir_id != CRATE_HIR_ID {
-                let err = match attr.style {
-                    ast::AttrStyle::Outer => errors::OuterCrateLevelAttr,
-                    ast::AttrStyle::Inner => errors::OuterCrateLevelAttr,
+                match attr.style {
+                    ast::AttrStyle::Outer => self.tcx.emit_node_span_lint(
+                        UNUSED_ATTRIBUTES,
+                        hir_id,
+                        attr.span,
+                        errors::OuterCrateLevelAttr,
+                    ),
+                    ast::AttrStyle::Inner => self.tcx.emit_node_span_lint(
+                        UNUSED_ATTRIBUTES,
+                        hir_id,
+                        attr.span,
+                        errors::InnerCrateLevelAttr,
+                    ),
                 };
-                self.tcx.emit_node_span_lint(UNUSED_ATTRIBUTES, hir_id, attr.span, err);
                 return;
             } else {
                 let never_needs_link = self