Fix diagnostic for matching/creating x-crate re-exported tuple structs with private fields.
The more helpful diagnostic already existed but wasn't working if the struct in question was a re-export from a different crate.
This commit is contained in:
parent
377d1a984c
commit
57fda67291
3 changed files with 42 additions and 10 deletions
|
@ -27,7 +27,7 @@ use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
|
|||
use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState};
|
||||
use rustc_middle::mir::{self, Body, Promoted};
|
||||
use rustc_middle::ty::codec::TyDecoder;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, Visibility};
|
||||
use rustc_serialize::{opaque, Decodable, Decoder};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::hygiene::ExpnDataDecodeMode;
|
||||
|
@ -1305,6 +1305,17 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
.collect()
|
||||
}
|
||||
|
||||
fn get_struct_field_visibilities(&self, id: DefIndex) -> Vec<Visibility> {
|
||||
self.root
|
||||
.tables
|
||||
.children
|
||||
.get(self, id)
|
||||
.unwrap_or_else(Lazy::empty)
|
||||
.decode(self)
|
||||
.map(|field_index| self.get_visibility(field_index))
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn get_inherent_implementations_for_type(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
|
|
|
@ -8,7 +8,7 @@ use rustc_ast::expand::allocator::AllocatorKind;
|
|||
use rustc_data_structures::stable_map::FxHashMap;
|
||||
use rustc_data_structures::svh::Svh;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def::{CtorKind, DefKind};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE};
|
||||
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash};
|
||||
use rustc_middle::hir::exports::Export;
|
||||
|
@ -17,7 +17,7 @@ use rustc_middle::middle::cstore::{CrateSource, CrateStore, EncodedMetadata};
|
|||
use rustc_middle::middle::exported_symbols::ExportedSymbol;
|
||||
use rustc_middle::middle::stability::DeprecationEntry;
|
||||
use rustc_middle::ty::query::Providers;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_middle::ty::{self, TyCtxt, Visibility};
|
||||
use rustc_session::utils::NativeLibKind;
|
||||
use rustc_session::{CrateDisambiguator, Session};
|
||||
use rustc_span::source_map::{Span, Spanned};
|
||||
|
@ -392,6 +392,20 @@ impl CStore {
|
|||
self.get_crate_data(def.krate).get_struct_field_names(def.index, sess)
|
||||
}
|
||||
|
||||
pub fn struct_field_visibilities_untracked(&self, def: DefId) -> Vec<Visibility> {
|
||||
self.get_crate_data(def.krate).get_struct_field_visibilities(def.index)
|
||||
}
|
||||
|
||||
pub fn ctor_def_id_and_kind_untracked(&self, def: DefId) -> Option<(DefId, CtorKind)> {
|
||||
self.get_crate_data(def.krate).get_ctor_def_id(def.index).map(|ctor_def_id| {
|
||||
(ctor_def_id, self.get_crate_data(def.krate).get_ctor_kind(def.index))
|
||||
})
|
||||
}
|
||||
|
||||
pub fn visibility_untracked(&self, def: DefId) -> Visibility {
|
||||
self.get_crate_data(def.krate).get_visibility(def.index)
|
||||
}
|
||||
|
||||
pub fn item_children_untracked(
|
||||
&self,
|
||||
def_id: DefId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue