Fix extern prelude failure in rustdoc
This commit is contained in:
parent
0b7c9e756e
commit
dadfa13f47
@ -494,6 +494,13 @@ impl Input {
|
||||
Input::Str { .. } => "rust_out".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_input(&mut self) -> Option<&mut String> {
|
||||
match *self {
|
||||
Input::File(_) => None,
|
||||
Input::Str { ref mut input, .. } => Some(input),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1437,6 +1437,9 @@ pub struct Resolver<'a> {
|
||||
current_type_ascription: Vec<Span>,
|
||||
|
||||
injected_crate: Option<Module<'a>>,
|
||||
|
||||
/// Only supposed to be used by rustdoc, otherwise should be false.
|
||||
pub ignore_extern_prelude_feature: bool,
|
||||
}
|
||||
|
||||
/// Nothing really interesting here, it just provides memory for the rest of the crate.
|
||||
@ -1718,6 +1721,7 @@ impl<'a> Resolver<'a> {
|
||||
unused_macros: FxHashSet(),
|
||||
current_type_ascription: Vec::new(),
|
||||
injected_crate: None,
|
||||
ignore_extern_prelude_feature: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1891,7 +1895,8 @@ impl<'a> Resolver<'a> {
|
||||
if !module.no_implicit_prelude {
|
||||
// `record_used` means that we don't try to load crates during speculative resolution
|
||||
if record_used && ns == TypeNS && self.extern_prelude.contains(&ident.name) {
|
||||
if !self.session.features_untracked().extern_prelude {
|
||||
if !self.session.features_untracked().extern_prelude &&
|
||||
!self.ignore_extern_prelude_feature {
|
||||
feature_err(&self.session.parse_sess, "extern_prelude",
|
||||
ident.span, GateIssue::Language,
|
||||
"access to extern crates through prelude is experimental").emit();
|
||||
|
@ -1103,7 +1103,7 @@ fn resolve(cx: &DocContext, path_str: &str, is_val: bool) -> Result<(Def, Option
|
||||
// early return and try looking for the trait
|
||||
let value = match result.def {
|
||||
Def::Method(_) | Def::AssociatedConst(_) => true,
|
||||
Def::AssociatedTy(_) => false,
|
||||
Def::AssociatedTy(_) => false,
|
||||
Def::Variant(_) => return handle_variant(cx, result.def),
|
||||
// not a trait item, just return what we found
|
||||
_ => return Ok((result.def, None))
|
||||
|
@ -250,10 +250,12 @@ pub fn run_core(search_paths: SearchPaths,
|
||||
|_| Ok(()));
|
||||
let driver::InnerExpansionResult {
|
||||
mut hir_forest,
|
||||
resolver,
|
||||
mut resolver,
|
||||
..
|
||||
} = abort_on_err(result, &sess);
|
||||
|
||||
resolver.ignore_extern_prelude_feature = true;
|
||||
|
||||
// We need to hold on to the complete resolver, so we clone everything
|
||||
// for the analysis passes to use. Suboptimal, but necessary in the
|
||||
// current architecture.
|
||||
|
Loading…
Reference in New Issue
Block a user