Add warn(unreachable_pub)
to rustc_metadata
.
This commit is contained in:
parent
4b92682530
commit
05e07381d0
6 changed files with 29 additions and 14 deletions
|
@ -16,6 +16,7 @@
|
|||
#![feature(proc_macro_internals)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(trusted_len)]
|
||||
#![warn(unreachable_pub)]
|
||||
// tidy-alphabetical-end
|
||||
|
||||
extern crate proc_macro;
|
||||
|
|
|
@ -56,13 +56,13 @@ impl std::ops::Deref for MetadataBlob {
|
|||
|
||||
impl MetadataBlob {
|
||||
/// Runs the [`MemDecoder`] validation and if it passes, constructs a new [`MetadataBlob`].
|
||||
pub fn new(slice: OwnedSlice) -> Result<Self, ()> {
|
||||
pub(crate) fn new(slice: OwnedSlice) -> Result<Self, ()> {
|
||||
if MemDecoder::new(&slice, 0).is_ok() { Ok(Self(slice)) } else { Err(()) }
|
||||
}
|
||||
|
||||
/// Since this has passed the validation of [`MetadataBlob::new`], this returns bytes which are
|
||||
/// known to pass the [`MemDecoder`] validation.
|
||||
pub fn bytes(&self) -> &OwnedSlice {
|
||||
pub(crate) fn bytes(&self) -> &OwnedSlice {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
@ -332,12 +332,12 @@ impl<'a, 'tcx> DecodeContext<'a, 'tcx> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn blob(&self) -> &'a MetadataBlob {
|
||||
pub(crate) fn blob(&self) -> &'a MetadataBlob {
|
||||
self.blob
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn cdata(&self) -> CrateMetadataRef<'a> {
|
||||
fn cdata(&self) -> CrateMetadataRef<'a> {
|
||||
debug_assert!(self.cdata.is_some(), "missing CrateMetadata in DecodeContext");
|
||||
self.cdata.unwrap()
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ impl<'a, 'tcx> DecodeContext<'a, 'tcx> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn read_raw_bytes(&mut self, len: usize) -> &[u8] {
|
||||
fn read_raw_bytes(&mut self, len: usize) -> &[u8] {
|
||||
self.opaque.read_raw_bytes(len)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ parameterized_over_tcx! {
|
|||
|
||||
impl DefPathHashMapRef<'_> {
|
||||
#[inline]
|
||||
pub fn def_path_hash_to_def_index(&self, def_path_hash: &DefPathHash) -> DefIndex {
|
||||
pub(crate) fn def_path_hash_to_def_index(&self, def_path_hash: &DefPathHash) -> DefIndex {
|
||||
match *self {
|
||||
DefPathHashMapRef::OwnedFromMetadata(ref map) => {
|
||||
map.get(&def_path_hash.local_hash()).unwrap()
|
||||
|
|
|
@ -2309,7 +2309,7 @@ fn encode_root_position(mut file: &File, pos: usize) -> Result<(), std::io::Erro
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
*providers = Providers {
|
||||
doc_link_resolutions: |tcx, def_id| {
|
||||
tcx.resolutions(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue