You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pchickey opened this issue
Nov 30, 2020
· 4 comments
· Fixed by #80009
Assignees
Labels
A-lintArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/
Rustc 1.48.0 gives an incorrect warning about an external symbol being redeclared with a different signature, when the external symbols are in different wasm_import_module namespaces.
I tried this code:
pubmod a {#[link(wasm_import_module = "a")]extern"C"{pubfnfoo();}}pubmod b {#[link(wasm_import_module = "b")]extern"C"{pubfnfoo() -> usize;}}
I expected to see this happen: Compile without warnings
Instead, this happened:
warning: `foo` redeclared with a different signature
--> src/lib.rs:11:9
|
4 | pub fn foo();
| ------------- `foo` previously declared here
...
11 | pub fn foo() -> usize;
| ^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: `#[warn(clashing_extern_declarations)]` on by default
= note: expected `unsafe extern "C" fn()`
found `unsafe extern "C" fn() -> usize`
cc @jumbatm, would you be willing to help take a look at this? (it looks like you added this way-back-when in #70946)
On wasm targets there's special logic for symbol mangling which is why this should work but not actually generate a warning. Do you know if it's possible to call that logic from here perhaps? (would be able to consolidate "what's the name of this symbol" logic too!)
No worries, and thanks! If you run out of time/steam I'm happy to look into this as well
nagisa
added
O-wasm
Target: WASM (WebAssembly), http://webassembly.org/
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
labels
Dec 2, 2020
A-lintArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/
Rustc 1.48.0 gives an incorrect warning about an external symbol being redeclared with a different signature, when the external symbols are in different
wasm_import_module
namespaces.I tried this code:
I expected to see this happen: Compile without warnings
Instead, this happened:
Meta
rustc --version --verbose
:The same behavior exists on nightly as well:
Backtrace
The text was updated successfully, but these errors were encountered: