Skip to content

Commit dd88b71

Browse files
committed
windows-gnu tests
1 parent c666de8 commit dd88b71

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,11 +783,13 @@ fn report_linker_output(sess: &Session, levels: CodegenLintLevels, stdout: &[u8]
783783

784784
if !escaped_stderr.is_empty() {
785785
// We already print `warning:` at the start of the diagnostic. Remove it from the linker output if present.
786-
let stderr = escaped_stderr
787-
.strip_prefix("warning: ")
786+
escaped_stderr =
787+
escaped_stderr.strip_prefix("warning: ").unwrap_or(&escaped_stderr).to_owned();
788+
escaped_stderr = escaped_stderr
789+
.strip_prefix("Warning: ")
788790
.unwrap_or(&escaped_stderr)
789791
.replace(": warning: ", ": ");
790-
lint_msg(format!("linker stderr: {stderr}"));
792+
lint_msg(format!("linker stderr: {escaped_stderr}"));
791793
}
792794
if !escaped_stdout.is_empty() {
793795
lint_msg(format!("linker stdout: {}", escaped_stdout))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//@ only-windows-gnu
2+
//@ build-fail
3+
#![deny(linker_info)]
4+
//~? ERROR Warning: .drectve
5+
fn main() {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error: Warning: .drectve `-exclude-symbols:_ZN28windows_gnu_corrupt_drective4main17h291ed884c1aada69E ' unrecognized
2+
Warning: corrupt .drectve at end of def file
3+
4+
|
5+
note: the lint level is defined here
6+
--> $DIR/windows-gnu-corrupt-drective.rs:3:9
7+
|
8+
LL | #![deny(linker_info)]
9+
| ^^^^^^^^^^^
10+
11+
error: aborting due to 1 previous error
12+

0 commit comments

Comments
 (0)