-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Open
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.
Description
Code
#[allow(non_camel_case_types)]
mod repro {
pub enum B {}
pub enum P {}
pub enum R {}
pub enum S {}
pub enum a {}
pub enum c {}
pub enum e {}
pub enum g {}
pub enum i {}
pub enum n {}
pub enum r {}
pub enum t {}
pub enum y {}
}
fn main() {
let core::marker::PhantomData::<(
repro::S,
repro::t,
repro::r,
repro::i,
repro::n,
repro::g,
repro::P,
repro::i,
repro::e,
repro::c,
repro::e,
)> = core::marker::PhantomData::<(
repro::B,
repro::y,
repro::t,
repro::e,
repro::R,
repro::a,
repro::n,
repro::g,
repro::e,
)>;
}Current output
error[E0308]: mismatched types
--> src/main.rs:19:9
|
19 | let core::marker::PhantomData::<(
| __________^
20 | | repro::S,
21 | | repro::t,
22 | | repro::r,
... |
30 | | repro::e,
31 | | )> = core::marker::PhantomData::<(
| | ______^___-
| ||______|
| | expected a tuple with 9 elements, found one with 11 elements
32 | | repro::B,
33 | | repro::y,
34 | | repro::t,
... |
40 | | repro::e,
41 | | )>;
| |______- this expression has type `PhantomData<(B, y, t, e, R, a, repro::n, g, e)>`
|
= note: expected struct `PhantomData<(B, y, t, e, R, a, repro::n, g, e)>`
found struct `PhantomData<(S, t, r, i, repro::n, g, P, i, e, c, e)>`Desired output
error[E0308]: mismatched types
--> src/main.rs:19:9
|
19 | let core::marker::PhantomData::<(
| __________^
20 | | repro::S,
21 | | repro::t,
22 | | repro::r,
... |
30 | | repro::e,
31 | | )> = core::marker::PhantomData::<(
| | ______^___-
| ||______|
| | expected a tuple with 9 elements, found one with 11 elements
32 | | repro::B,
33 | | repro::y,
34 | | repro::t,
... |
40 | | repro::e,
41 | | )>;
| |______- this expression has type `PhantomData<(B, y, t, e, R, a, n, g, e)>`
|
= note: expected struct `PhantomData<(B, y, t, e, R, a, n, g, e)>`
found struct `PhantomData<(S, t, r, i, n, g, P, i, e, c, e)>`Rationale and extra context
I observed in dtolnay/cxx@1e6e75f (which bisects to #147622) that rustc is treating this newly publicly reachable standard library module as a potential name collision requiring disambiguation for the name n:
rust/library/core/src/unicode/unicode_data.rs
Line 538 in bd3ac03
| pub mod n { |
Rustc is thinking that the source of your type error might be that you meant to write this somewhere, but forgot it:
#![allow(internal_features)]
#![feature(unicode_internals)]
use core::unicode::unicode_data::n;I propose that rustc should not consider "internal features" as something that the programmer might have forgotten to refer to, since these are not something they are intended to refer to in the first place.
Rust Version
rustc 1.93.0-nightly (bd3ac0330 2025-11-01)
binary: rustc
commit-hash: bd3ac0330018c23b111bbee176f32c377be7b319
commit-date: 2025-11-01
host: aarch64-apple-darwin
release: 1.93.0-nightly
LLVM version: 21.1.3Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.