-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-incr-compArea: Incremental compilationArea: Incremental compilationA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
Steps to reproduce:
- make an new crate, set crate type to
cdylib
- put a simple function in
src/lib.rs
:
#[no_mangle]
pub extern "C" fn rust_no_mangle() -> i32{
42
}
- build with
cargo build --verbose
- copy the
rustc
command line used from above step, and run it as-is
example:
$ cargo build --verbose
Compiling nm v0.1.0 (/tmp/nm)
Running `rustc --edition=2018 --crate-name nm src/lib.rs --color always --crate-type cdylib --emit=dep-info,link -C debuginfo=2 -C metadata=38c165a3ed3ed429 --out-dir /tmp/nm/target/debug/deps -C incremental=/tmp/nm/target/debug/incremental -L dependency=/tmp/nm/target/debug/deps`
Finished dev [unoptimized + debuginfo] target(s) in 0.22s
$ rustc --edition=2018 --crate-name nm src/lib.rs --color always --crate-type cdylib --emit=dep-info,link -C debuginfo=2 -C metadata=38c165a3ed3ed429 --out-dir /tmp/nm/target/debug/deps -C incremental=/tmp/nm/target/debug/incremental -L dependency=/tmp/nm/target/debug/deps
warning: unused attribute
--> src/lib.rs:1:1
|
1 | #[no_mangle]
| ^^^^^^^^^^^^
|
= note: #[warn(unused_attributes)] on by default
As you can see, the first time cargo build
in step 3) has no warnings, however, step 4) cause rustc
complains #[no_mangle]
is unused, which isn't true.
Step 4) can be replaced by:
- modify
src/lib.rs
, so that it cause rebuild - run
cargo build
again
rustc 1.35.0-nightly (70f1309 2019-04-16)
MikailBag, alexandermerritt, phil-opp, galich, jonas-schievink and 2 more
Metadata
Metadata
Labels
A-incr-compArea: Incremental compilationArea: Incremental compilationA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.