You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use module::*;mod module {pubenumB{}implB{pubconstASSOC:bool = true;}// used to distinguish the `B`s}#[derive()]pubenumB{}implB{pubconstASSOC:bool = false;}fnmain(){let it = {useself::*;B::ASSOC};assert_eq!(
it,{useself::*;B::ASSOC},);}
I expected to see this happen: the assertion passing, since { use self::*; B::ASSOC } should have a consistent value/meaning within main's fn body where no other items are defined.
The key element playing a role here, beyond the blob imports, is the #[derive()] slapped onto B. This seems to allow for the blob-imported module::B to somehow gain priority over the clearly-defined crate::B type within fn main's blob import.
I did not expect the "moving of { use self::*; B::ASSOC } block" to alter this quirk (I was initially writing the MRE as assert_eq!(B::ASSSOC, { use … }) when I ran into this extra bug).
I tried this code:
I expected to see this happen: the assertion passing, since
{ use self::*; B::ASSOC }should have a consistent value/meaning withinmain'sfn bodywhere no other items are defined.Instead, this happened: the assertion fails!
Meta
This regressed in
1.52.0Extra comments
The key element playing a role here, beyond the blob imports, is the
#[derive()]slapped ontoB. This seems to allow for the blob-importedmodule::Bto somehow gain priority over the clearly-definedcrate::Btype withinfn main's blob import.I did not expect the "moving of
{ use self::*; B::ASSOC }block" to alter this quirk (I was initially writing the MRE asassert_eq!(B::ASSSOC, { use … })when I ran into this extra bug).Could resolve: Remove artificial import ambiguity errors #112086 be relevant? cc @petrochenkovInitially discovered on Discord by user
@kyuuhachi@rustbot modify labels: +regression-from-stable-to-stable