Skip to content

Fix leading qualifiers in use-import prefixes - #13

Draft
PLeVasseur wants to merge 3 commits into
mainfrom
fix-use-import-leading-namespace
Draft

Fix leading qualifiers in use-import prefixes#13
PLeVasseur wants to merge 3 commits into
mainfrom
fix-use-import-leading-namespace

Conversation

@PLeVasseur

Copy link
Copy Markdown
Owner

Summary

  • Preserve leading namespace qualifiers when constructing import path prefixes.
  • Distinguish empty local prefixes, bare extern-prelude prefixes, and qualified global prefixes.
  • Retain qualifiers through nested use trees and reject invalid non-leading or duplicate qualifiers.
  • Centralize the empty and bare-:: glob-import restrictions.
  • Add the corresponding FLS maintenance accounting.

Tracks rust-lang#711.

Reference alignment

The FLS models brace grouping through explicit recursive prefix construction rather than the Reference's prose description. This is a structural difference with no intentional behavioral deviation.

The changes are limited to Rust 2021 semantics. The Rust 2015 interpretation of leading :: is excluded.

Glob-import restrictions are centralized in fls_iNUBX5fJAI1N; its macro-consumption allowance intentionally applies to both empty and bare-:: glob prefixes because macros may consume those token forms before import resolution rejects them.

Testing

  • ./make.py --clear
    • Passed with no warnings or errors.
  • ./make.py --check-links
    • Passed: 31 HTML files, 16,985 links checked, zero errors.
  • Rust 1.95.0 positive matrix under edition 2021
    • All six valid declarations accepted.
  • Rust 1.95.0 negative matrix under edition 2021
    • All six invalid declarations produced the expected diagnostics.
  • git diff --check upstream/main...HEAD
    • Passed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant