-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsF-import_trait_associated_functions`#![feature(import_trait_associated_functions)]``#![feature(import_trait_associated_functions)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
Code
#![feature(import_trait_associated_functions)]
pub struct Test;
impl Test {
pub fn method() {}
pub const CONST: usize = 0;
}
pub use self::Test::{method, CONST};Current output
error[E0432]: unresolved import `self::Test`
--> src/lib.rs:10:15
|
10 | pub use self::Test::{method, CONST};
| ^^^^ `Test` is a struct, not a module
For more information about this error, try `rustc --explain E0432`.Desired output
cannot export inherent associated items, only trait associated items
(import *is* resolved, just the wrong type)Rationale and extra context
Previously, only module items could be re-exported, so, this error made sense from that perspective. However, with #134691, this no longer makes sense and is a little misleading. With the feature enabled, it should mention that this is possible with trait associated items, but not inherent associated items.
or, alternatively, it should be implemented for inherent associated items too.
Rust Version
rustc 1.92.0-nightly (57ef8d642 2025-10-15)Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsF-import_trait_associated_functions`#![feature(import_trait_associated_functions)]``#![feature(import_trait_associated_functions)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.