-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
show linker output even if the linker succeeds #119286
base: master
Are you sure you want to change the base?
Conversation
|
060a457
to
a34d7ae
Compare
This comment has been minimized.
This comment has been minimized.
64cb47a
to
ab6fb2b
Compare
also i know we settled on not showing stdout by default but it's useful for debugging search paths - maybe we should show it after all? it seems silly to have to pass both |
This comment has been minimized.
This comment has been minimized.
ab6fb2b
to
ba4425d
Compare
ba4425d
to
43edbe0
Compare
☔ The latest upstream changes (presumably #119662) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
hmm. that test has the following comment: rust/tests/incremental/commandline-args.rs Lines 13 to 20 in e9a009f
i suppose those lines are all invalid now, it should be testing that the CGU is not reused? i'm not sure why it's testing --verbose specifically, maybe it's enough to test any untracked CLI arg. i'll change it to --diagnostic-width.
i'm realizing your comments are all about #119129. i feel slightly uncomfortable making unrelated changes in this PR ... how do you feel about splitting them into a separate PR so i can assign michaelwoerister? |
Sure |
I prefer not doing this. It is helpful whenever a linkage issue is opened to not have to ask to rerun with |
☔ The latest upstream changes (presumably #134052) made this pull request unmergeable. Please resolve the merge conflicts. |
…jyn514 don't show the full linker args unless `--verbose` is passed the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them. split out from rust-lang#119286. fixes rust-lang#109979. r? `@bjorn3`
…jyn514 don't show the full linker args unless `--verbose` is passed the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them. split out from rust-lang#119286. fixes rust-lang#109979. r? ``@bjorn3``
…jyn514 don't show the full linker args unless `--verbose` is passed the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them. split out from rust-lang#119286. fixes rust-lang#109979. r? ```@bjorn3```
…jyn514 don't show the full linker args unless `--verbose` is passed the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them. split out from rust-lang#119286. fixes rust-lang#109979. r? ````@bjorn3````
don't show the full linker args unless `--verbose` is passed the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them. split out from rust-lang#119286. fixes rust-lang#109979. r? `@bjorn3` try-build: dist-x86_64-linux
…jyn514 don't show the full linker args unless `--verbose` is passed the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them. split out from rust-lang#119286. fixes rust-lang#109979. r? `@bjorn3` try-build: dist-x86_64-linux
…jyn514 don't show the full linker args unless `--verbose` is passed the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them. split out from rust-lang#119286. fixes rust-lang#109979. r? ``@bjorn3`` try-build: dist-x86_64-linux
don't show the full linker args unless `--verbose` is passed the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them. split out from rust-lang#119286. fixes rust-lang#109979. r? `@bjorn3` try-build: i686-mingw
…jyn514 don't show the full linker args unless `--verbose` is passed the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them. split out from rust-lang#119286. fixes rust-lang#109979. r? `@bjorn3` try-build: i686-mingw
Rollup merge of rust-lang#133633 - jyn514:hide-linker-args, r=bjorn3,jyn514 don't show the full linker args unless `--verbose` is passed the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them. split out from rust-lang#119286. fixes rust-lang#109979. r? `@bjorn3` try-build: i686-mingw
b3b0202
to
f89d8db
Compare
@bjorn3 this is ready for review :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from some concern about serialization of Span
without serializing the corresponding source map, this LGTM.
@@ -173,7 +173,7 @@ impl TyCtxt<'_> { | |||
/// This struct represents a lint expectation and holds all required information | |||
/// to emit the `unfulfilled_lint_expectations` lint if it is unfulfilled after | |||
/// the `LateLintPass` has completed. | |||
#[derive(Clone, Debug, HashStable)] | |||
#[derive(Clone, Debug, Encodable, Decodable, HashStable)] | |||
pub struct LintExpectation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodegenResults::serialize_rlink
doesn't serialize the source map. While it this is fully correct and shouldn't be changed, this means that when a LintExpectation
inside CodegenResults
gets deserialized in a new compiler session, the Span
inside of it will be garbage and similarly for the Span
in LintLevelSource
. Would it be possible to avoid serializing the spans? Or if not, replace them with DUMMY_SP
? I'm not sure how well the linting infrastructure handles garbage spans.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how well the linting infrastructure handles garbage spans.
Probably doesn't handle garbage spans. If the spans are empty or hi < lo, I think that triggers debug assertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The raw lo and hi values are preserved across the serialization roundtrip (so the lo <= hi invariant is preserved (empty spans are valid and rendered as a span from lo to lo + 1)), however they refer to non-existent parts of the source map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, if those become OOB, then I think they also trigger debug assertions (or actual assertions) if there's any lint that unwraps when trying to read a SourceMap snippet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this indeed crashes currently:
=== STDERR ===
thread 'rustc' panicked at compiler/rustc_span/src/source_map.rs:1056:40:
index out of bounds: the len is 0 but the index is 18446744073709551615
i thought i could solve this by deserializing to a dummy span but that doesn't seem to have worked for some reason? it still gives the same error.
INFO rustc_codegen_ssa::back::link Deny Node { name: "linker_messages", span: no-location (#0), reason: None }
i think the right fix here is not to use a source span map at all during -Z link-only
, to have the emitter return None in Emitter::source_map
. but i am not sure exactly how to set that up.
☔ The latest upstream changes (presumably #134582) made this pull request unmergeable. Please resolve the merge conflicts. |
this was slightly complicated because codegen_ssa doesn't have access to a tcx.
note that this still ICEs when passed `-Z link-only --error-format json` because i can't be bothered to fix it right now
d018f4d
to
6baa8e6
Compare
@@ -804,6 +804,9 @@ passes_unused_duplicate = | |||
passes_unused_empty_lints_note = | |||
attribute `{$name}` with an empty list has no effect | |||
|
|||
passes_unused_linker_warnings_note = | |||
the `linker_warnings` lint can only be controlled at the root of a crate with `--crate-type bin` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is also allowed at the root of dylib, cdylib and proc-macro crates. Maybe say that it can only be controlled at the root of a crate that needs to be linked. Or just always allow it. If you define a crate as both rlib and dylib in Cargo.toml and compile for a target that doesn't support dylibs, cargo will drop the dylib crate type. This probably shouldn't cause a warning that #[allow(linker_messages)]
is not allowed.
// probably good enough. | ||
.assert_stderr_contains("linker stderr: bar"); | ||
|
||
// Same thing, but with json output. This currently isn't supported and just ICEs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you at least add a FIXME at the location where this ICEs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this will have to be fixed before the PR can land as cargo always uses the json output format and thus would cause an ICE on any linker warning.
--verbose
is passed--verbose
is passedfixes #83436. fixes #38206. fixes #109979. helps with #46998. cc https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/uplift.20some.20-Zverbose.20calls.20and.20rename.20to.E2.80.A6.20compiler-team.23706/near/408986134
try-job: aarch64-apple
r? @bjorn3