Change:
The test appears to be intermittently changing its output. Usually, it prints: but sometimes it prints: See for an example of this happening. Here's a log snippet from a compiler build which prints (the current expected output): Note - this indicates that the chosen (which is what actually gets printed) is Output from a compiler which prints : Note - here, the is . There appears to be some non-determinism occuring, but I'm not sure where.
This is blocking - some builders are printing while others are printing , making it impossible to merge.

Discussion:
in_module_is_extern)) = worklist.pop() { // We have to visit module children in deterministic order to avoid // instabilities in reported imports (#43552). <del> in_module.for_each_child_stable(self, |this, ident, ns, name_binding| { </del> <ins> in_module.for_each_child(self, |this, ident, ns, name_binding| { </ins> // avoid imports entirely if name_binding.is_import() && !name_binding.is_extern_crate() { return; } // avoid non-importable candidates as well

// abort if the module is already found if result.is_some() { break; } <del> in_module.for_each_child_stable(self.r, |_, ident, _, name_binding| { </del> <ins> in_module.for_each_child(self.r, |_, ident, _, name_binding| { </ins> // abort if the module is already found or if name_binding is private external if result.is_some() || !name_binding.vis.is_visible_locally() { return

fn collect_enum_variants(&mut self, def_id: DefId) -> Option<Vec<Path>> { self.find_module(def_id).map(|(enum_module, enum_import_suggestion)| { let mut variants = Vec::new(); <del> enum_module.for_each_child_stable(self.r, |_, ident, _, name_binding| { </del> <ins> enum_module.for_each_child(self.r, |_, ident, _, name_binding| { </ins> if let Res::Def(DefKind::Variant, _) = name_binding.res() { let mut segms = enum_import_suggestion.path.segments.clone(); segms.push(ast::PathSegment::from_ident(ident));

use std::collections::BTreeSet; use rustc_data_structures::ptr_key::PtrKey; use rustc_data_structures::sync::Lrc; <ins> use rustc_data_structures::fx::FxIndexMap; </ins> use diagnostics::{Suggestion, ImportSuggestion}; use diagnostics::{find_span_of_binding_until_next_binding, extend_span_to_previous_binding};

} } <del> type Resolutions<'a> = RefCell<FxHashMap<(Ident, Namespace), &'a RefCell<NameResolution<'a>>>>; </del> <ins> type Resolutions<'a> = RefCell<FxIndexMap<(Ident, Namespace), &'a RefCell<NameResolution<'a>>>>; </ins> /// One node in the tree of modules. pub struct ModuleData<'a> {

} } <del> fn for_each_child_stable<R, F>(&'a self, resolver: &mut R, mut f: F) where R: AsMut<Resolver<'a>>, F: FnMut(&mut R, Ident, Namespace, &'a NameBinding<'a>) { let resolutions = resolver.as_mut().resolutions(self).borrow(); let mut resolutions = resolutions.iter().collect::<Vec<_>>(); resolutions.sort_by_cached_key(|&(&(ident, ns), _)| (ident.as_str(), ns)); for &(&(ident, ns), &resolution) in resolutions.iter() { resolution.borrow().binding.map(|binding| f(resolver, ident, ns, binding)); } } </del> fn res(&self) -> Option<Res> { match self.kind { ModuleKind::Def(kind, def_id, _) => Some(Res::Def(kind, def_id)),

|             ^^^^^^ help: try using one of the enum's variants | <del> LL |     let x = std::prelude::v1::Option::None(1); |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL |     let x = std::prelude::v1::Option::Some(1); |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ </del> <ins> LL |     let x = std::option::Option::None(1); |             ^^^^^^^^^^^^^^^^^^^^^^^^^ LL |     let x = std::option::Option::Some(1); |             ^^^^^^^^^^^^^^^^^^^^^^^^^ </ins> error[E0532]: expected tuple struct/variant, found enum `Option` --> $DIR/issue-43871-enum-instead-of-variant.rs:21:12

|            ^^^^^^ help: try using one of the enum's variants | <del> LL |     if let std::prelude::v1::Option::None(_) = x { |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL |     if let std::prelude::v1::Option::Some(_) = x { |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ </del> <ins> LL |     if let std::option::Option::None(_) = x { |            ^^^^^^^^^^^^^^^^^^^^^^^^^ LL |     if let std::option::Option::Some(_) = x { |            ^^^^^^^^^^^^^^^^^^^^^^^^^ </ins> error[E0532]: expected tuple struct/variant, found enum `Example` --> $DIR/issue-43871-enum-instead-of-variant.rs:27:12

|             ^^^^^^^^^^^^ help: try using one of the enum's variants | <del> LL |     let z = ManyVariants::Eight(); </del> <ins> LL |     let z = ManyVariants::One(); |             ^^^^^^^^^^^^^^^^^ LL |     let z = ManyVariants::Two(); |             ^^^^^^^^^^^^^^^^^ LL |     let z = ManyVariants::Three(); </ins> |             ^^^^^^^^^^^^^^^^^^^ <del> LL |     let z = ManyVariants::Five(); |             ^^^^^^^^^^^^^^^^^^ </del> LL |     let z = ManyVariants::Four(); |             ^^^^^^^^^^^^^^^^^^ <del> LL |     let z = ManyVariants::Nine(); |             ^^^^^^^^^^^^^^^^^^ </del> and 6 other candidates error: aborting due to 5 previous errors

|             ^^^^ |             | |             not a type <del> |             help: try using the variant's enum: `Option` </del> <ins> |             help: try using the variant's enum: `std::option::Option` </ins> error: aborting due to 7 previous errors