Skip to content

Correctly Handle Unlinked Module Edge Cases - #22977

Open
George-Ogden wants to merge 15 commits into
rust-lang:masterfrom
George-Ogden:linked-module-names
Open

Correctly Handle Unlinked Module Edge Cases#22977
George-Ogden wants to merge 15 commits into
rust-lang:masterfrom
George-Ogden:linked-module-names

Conversation

@George-Ogden

@George-Ogden George-Ogden commented Aug 1, 2026

Copy link
Copy Markdown

Fixes #22976:

  • do not offer to add a file with an invalid name to main.rs or lib.rs
  • correctly escape keywords when used as module names

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 1, 2026
Comment thread crates/syntax/src/utils.rs Outdated
Comment thread crates/ide-diagnostics/src/handlers/unlinked_file.rs Outdated
Comment thread crates/ide-diagnostics/src/handlers/unlinked_file.rs
Comment thread Cargo.toml
Comment thread crates/ide-diagnostics/src/handlers/unlinked_file.rs Outdated
Comment thread crates/ide-diagnostics/src/handlers/unlinked_file.rs Outdated
@George-Ogden
George-Ogden requested a review from A4-Tacks August 2, 2026 08:35
/// Convert a module name along with its visibility to code.
/// In most cases, this just adds the visibility beforehand,
/// but the exceptions are non-identifiers and keywords.
pub(crate) fn format_mod_name(mod_name: &str, visibility: &str, edition: Edition) -> String {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add pub(crate)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unlinked Files

4 participants