Skip to content

Dead code not linked in beta or nightly #46467

Closed
@xd009642

Description

@xd009642

I've noticed with beta and nightly the rust flag link-dead-code no longer includes unused source files when running cargo test. Testing it out on this test project, I used objdump -WL to get the decoded lines in the binary. With rustc stable both source files in the crate are linked into the test binary (lib.rs and unused.rs), however with stable and nightly only lib.rs is linked.

This is counter to what I'd expect link-dead-code to do. Is this a desired feature? And if so is there the means to obtain the old behaviour?

Metadata

Metadata

Labels

C-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions