mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
Move prelude crate names into Session.
Avoid hardcoding and special-casing the `std` crate name in the item path logic by moving the prelude crate name logic into the `Session` type so it can be reused in the item path logic and resolve module.
This commit is contained in:
@@ -28,17 +28,16 @@
|
||||
use rustc_data_structures::base_n;
|
||||
use rustc_data_structures::sync::{self, Lrc, Lock, LockCell, OneThread, Once, RwLock};
|
||||
|
||||
use syntax::ast::NodeId;
|
||||
use errors::{self, DiagnosticBuilder, DiagnosticId, Applicability};
|
||||
use errors::emitter::{Emitter, EmitterWriter};
|
||||
use syntax::ast::{self, NodeId};
|
||||
use syntax::edition::Edition;
|
||||
use syntax::feature_gate::{self, AttributeType};
|
||||
use syntax::json::JsonEmitter;
|
||||
use syntax::feature_gate;
|
||||
use syntax::parse;
|
||||
use syntax::parse::ParseSess;
|
||||
use syntax::{ast, source_map};
|
||||
use syntax::feature_gate::AttributeType;
|
||||
use syntax_pos::{MultiSpan, Span, symbol::Symbol};
|
||||
use syntax::source_map;
|
||||
use syntax::symbol::Symbol;
|
||||
use syntax::parse::{self, ParseSess};
|
||||
use syntax_pos::{MultiSpan, Span};
|
||||
use util::profiling::SelfProfiler;
|
||||
|
||||
use rustc_target::spec::PanicStrategy;
|
||||
|
||||
@@ -281,7 +281,9 @@ pub fn push_item_path<T>(self, buffer: &mut T, def_id: DefId)
|
||||
// In particular, don't recurse to print the crate root if we
|
||||
// just printed `std`. In doing this, we are able to add
|
||||
// `crate::` to trait import suggestions.
|
||||
DefPathData::CrateRoot if data.as_interned_str() == "std" => {},
|
||||
DefPathData::CrateRoot if self.sess.extern_prelude.contains(
|
||||
&data.as_interned_str().as_symbol()
|
||||
) => {},
|
||||
_ => self.push_item_path(buffer, parent_def_id),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user