Skip to content

Modify error message of importing inherent associated items when #[feature(import_trait_associated_functions)] is enabled#152611

Open
CoCo-Japan-pan wants to merge 1 commit intorust-lang:mainfrom
CoCo-Japan-pan:fix-148009
Open

Modify error message of importing inherent associated items when #[feature(import_trait_associated_functions)] is enabled#152611
CoCo-Japan-pan wants to merge 1 commit intorust-lang:mainfrom
CoCo-Japan-pan:fix-148009

Conversation

@CoCo-Japan-pan
Copy link
Contributor

@CoCo-Japan-pan CoCo-Japan-pan commented Feb 14, 2026

Fixes #148009

This PR improves the diagnostic for importing inherent associated items from a struct or union when the
#[feature(import_trait_associated_functions)] (#134691) is enabled.

Previously, this would result in a "not a module" error. This change provides a more specific error message clarifying that only trait associated items can be imported, while inherent associated items remain ineligible for import.

Enums are currently excluded from this change because their variants are valid import targets and require distinct handling.

`#[feature(import_trait_associated_functions)]` is enabled
@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 Feb 14, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 14, 2026

r? @madsmtm

rustbot has assigned @madsmtm.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 68 candidates
  • Random selection from 17 candidates

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 18, 2026

☔ The latest upstream changes (presumably #152785) made this pull request unmergeable. Please resolve the merge conflicts.

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. 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.

useing inherent method/const gives misleading error

3 participants

Comments