Skip to content

Conversation

@alexcrichton
Copy link
Member

@alexcrichton alexcrichton commented Nov 1, 2025

This commit fixes an accidental regression from #144678 where wasm targets would now accidentally use the wrong import module map for a symbol causing a symbol to skip mangling. This can result in compilation failures when symbols are used in cross-crate situations.

Closes #148347

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 1, 2025

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

This commit fixes an accidental regression from 144678 where wasm
targets would now accidentally use the wrong import module map for a
symbol causing a symbol to skip mangling. This can result in compilation
failures when symbols are used in cross-crate situations.

Closes 148347
@posborne
Copy link
Contributor

posborne commented Nov 1, 2025

I built this and verified that it now works as expected for both the smaller examples shared as well as for some larger projects that had previously encountered a large number of linker errors.

@alexcrichton
Copy link
Member Author

It looks like we found some more issues as a result of this bug, namely a runtime issue so this isn't just a build failure. Given that I'd like to propose this get backported to beta at least, so I'm going to attempt to beta nominate this. Haven't done this in awhile...

@rustbot beta-nominate compiler

This is not something I'd ask for a stable backport of, but if a stable point release is already going out I wouldn't mind trying to champion trying to get this in there. I'll sort that out if/when this is accepted for a beta backport.

@rustbot
Copy link
Collaborator

rustbot commented Nov 1, 2025

Error: The feature nominate is not enabled in this repository.
To enable it add its section in the triagebot.toml in the root of the repository.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@alexcrichton alexcrichton added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 1, 2025
@alexcrichton
Copy link
Member Author

alexcrichton commented Nov 1, 2025

I've probably abused my priviledges and manually added the label here, please teach me the error of my ways if that is uncouth.

@jieyouxu
Copy link
Member

jieyouxu commented Nov 2, 2025

I've probably abused my priviledges and manually added the label here, please teach me the error of my ways if that is uncouth.

(This is perfectly fine, the triagebot invocation is just @rustbot label +beta-nominated, or since you have write permissions, you can just add a label like you did :) This will create a beta-backport nomination zulip thread #t-compiler/backports > #148363: beta-nominated where compiler team members can vote or discuss. They will be discussed during the next compiler triage meeting. This is obviously still being experimented with to see if we can make it smoother.)

@alexcrichton
Copy link
Member Author

@rustbot label +stable-nominated

Some discussion at #t-compiler/backports > #148363: beta-nominated @ 💬 and it sounds like it's ok to tag this as stable-nominated but also to be clear that this alone, in my opinion, doesn't justify a point release on its own. If one's already going out I think this would be reasonable to include, however.

@rustbot rustbot added the stable-nominated Nominated for backporting to the compiler in the stable channel. label Nov 3, 2025
@jackh726
Copy link
Member

jackh726 commented Nov 3, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 3, 2025

📌 Commit 93fef45 has been approved by jackh726

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 3, 2025
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 3, 2025
…=jackh726

Fix `wasm_import_module` attribute cross-crate

This commit fixes an accidental regression from rust-lang#144678 where wasm targets would now accidentally use the wrong import module map for a symbol causing a symbol to skip mangling. This can result in compilation failures when symbols are used in cross-crate situations.

Closes rust-lang#148347
@wesleywiser
Copy link
Member

@bors p=1

Fixes high-priority issue, beta and stable backport nominated PR

bors added a commit that referenced this pull request Nov 3, 2025
Rollup of 7 pull requests

Successful merges:

 - #147141 (Suggest making binding `mut` on `&mut` reborrow)
 - #147945 (Port `cfg!()` macro to the new attribute parsing system )
 - #147951 (Add check for `+=` typo in let chains)
 - #148004 (fix: Only special case single line item attribute suggestions)
 - #148264 (reflect that type and const parameter can be intermixed)
 - #148363 (Fix `wasm_import_module` attribute cross-crate)
 - #148447 (Tweak E0401)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b93b0d2 into rust-lang:master Nov 4, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 4, 2025
rust-timer added a commit that referenced this pull request Nov 4, 2025
Rollup merge of #148363 - alexcrichton:fix-wasm-link-name, r=jackh726

Fix `wasm_import_module` attribute cross-crate

This commit fixes an accidental regression from #144678 where wasm targets would now accidentally use the wrong import module map for a symbol causing a symbol to skip mangling. This can result in compilation failures when symbols are used in cross-crate situations.

Closes #148347
@bors
Copy link
Collaborator

bors commented Nov 4, 2025

⌛ Testing commit 93fef45 with merge 5f9dd05...

@RalfJung
Copy link
Member

RalfJung commented Nov 4, 2025

This makes it near impossible to recognize wasi symbols in Miri to implement shims... we now see the mangled name there, unlike on every other target. I thought I could implement basic support for wasi myself, that was apparently a misjudgment on my side. I think I'm going to remove the little bit of wasi support we have in Miri as this target is clearly too strange to support it without someone who knows it in detail being actively involved.

@bjorn3
Copy link
Member

bjorn3 commented Nov 4, 2025

Miri can look up the DefId of the function in wasm_import_map to get the name by which the wasm module would import it and from which module it would import it.

@RalfJung
Copy link
Member

RalfJung commented Nov 4, 2025

Yeah we could add more target-specific hacks... but that falls into the "target is too strange" category for me. I thought it'd be easy to get a bit of wasi support, but I won't commit to maintaining a target that needs special treatment for even just the most basic functionality. So, if someone shows up who wants to maintain wasi in Miri, we can make that work, but I see this as a signal that I shouldn't be trying to do this myself. ;)

@rustbot
Copy link
Collaborator

rustbot commented Nov 6, 2025

beta backport approved as per compiler team on Zulip. A backport PR will be authored by the release team at the end of the current development cycle. Backport labels are handled by them.

@rustbot label +beta-accepted

@rustbot
Copy link
Collaborator

rustbot commented Nov 6, 2025

Error: Label beta-accepted can only be set by Rust team members

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@alexcrichton alexcrichton deleted the fix-wasm-link-name branch November 6, 2025 16:37
@apiraino
Copy link
Contributor

apiraino commented Nov 6, 2025

Beta backport accepted as per compiler team on Zulip.

Stable backport accepted as well since T-release has already a few patches for a 1.91.1 dot release

@rustbot label +beta-accepted +stable-accepted

@rustbot rustbot added beta-accepted Accepted for backporting to the compiler in the beta channel. stable-accepted Accepted for backporting to the compiler in the stable channel. labels Nov 6, 2025
@cuviper cuviper mentioned this pull request Nov 6, 2025
@cuviper cuviper modified the milestones: 1.93.0, 1.92.0 Nov 6, 2025
@cuviper cuviper removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Nov 6, 2025
bors added a commit that referenced this pull request Nov 6, 2025
[stable] Prepare Rust 1.91.1

This PR prepares the artifacts for Rust 1.91.1, targeting next Monday with the following backports:

* #148322
* #148363

cc `@rust-lang/release`
bors added a commit that referenced this pull request Nov 7, 2025
[stable] Prepare Rust 1.91.1

This PR prepares the artifacts for Rust 1.91.1, targeting next Monday with the following backports:

* #148322
* #148363

cc `@rust-lang/release`
bors added a commit that referenced this pull request Nov 7, 2025
[stable] Prepare Rust 1.91.1

This PR prepares the artifacts for Rust 1.91.1, targeting next Monday with the following backports:

* #148322
* #148363

cc `@rust-lang/release`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. stable-accepted Accepted for backporting to the compiler in the stable channel. stable-nominated Nominated for backporting to the compiler in the stable channel. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wasm Linker "module mismatch for symbol" Regression in 1.91.0