Improve debugging for metadata structures
I had to do a lot of debug by printing; having these `Debug` traits in place made it easier. Additionally, add some more information to existing `info!` statements.
This commit is contained in:
parent
51d9a6c617
commit
83d70c0298
3 changed files with 12 additions and 5 deletions
|
@ -147,6 +147,7 @@ impl<'a> std::fmt::Debug for CrateDump<'a> {
|
|||
writeln!(fmt, " cnum: {cnum}")?;
|
||||
writeln!(fmt, " hash: {}", data.hash())?;
|
||||
writeln!(fmt, " reqd: {:?}", data.dep_kind())?;
|
||||
writeln!(fmt, " priv: {:?}", data.is_private_dep())?;
|
||||
let CrateSource { dylib, rlib, rmeta } = data.source();
|
||||
if let Some(dylib) = dylib {
|
||||
writeln!(fmt, " dylib: {}", dylib.0.display())?;
|
||||
|
@ -770,7 +771,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
|
|||
|
||||
match result {
|
||||
(LoadResult::Previous(cnum), None) => {
|
||||
info!("library for `{}` was loaded previously", name);
|
||||
info!("library for `{}` was loaded previously, cnum {cnum}", name);
|
||||
// When `private_dep` is none, it indicates the directly dependent crate. If it is
|
||||
// not specified by `--extern` on command line parameters, it may be
|
||||
// `private-dependency` when `register_crate` is called for the first time. Then it must be updated to
|
||||
|
|
|
@ -260,7 +260,7 @@ pub(crate) struct CrateLocator<'a> {
|
|||
crate_rejections: CrateRejections,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct CratePaths {
|
||||
pub(crate) name: Symbol,
|
||||
source: CrateSource,
|
||||
|
@ -272,7 +272,7 @@ impl CratePaths {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub(crate) enum CrateFlavor {
|
||||
Rlib,
|
||||
Rmeta,
|
||||
|
@ -893,13 +893,13 @@ fn get_flavor_from_path(path: &Path) -> CrateFlavor {
|
|||
|
||||
// ------------------------------------------ Error reporting -------------------------------------
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
struct CrateMismatch {
|
||||
path: PathBuf,
|
||||
got: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
#[derive(Clone, Debug, Default)]
|
||||
struct CrateRejections {
|
||||
via_hash: Vec<CrateMismatch>,
|
||||
via_triple: Vec<CrateMismatch>,
|
||||
|
@ -912,6 +912,7 @@ struct CrateRejections {
|
|||
/// Candidate rejection reasons collected during crate search.
|
||||
/// If no candidate is accepted, then these reasons are presented to the user,
|
||||
/// otherwise they are ignored.
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct CombinedLocatorError {
|
||||
crate_name: Symbol,
|
||||
dep_root: Option<CratePaths>,
|
||||
|
@ -921,6 +922,7 @@ pub(crate) struct CombinedLocatorError {
|
|||
crate_rejections: CrateRejections,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum CrateError {
|
||||
NonAsciiName(Symbol),
|
||||
ExternLocationNotExist(Symbol, PathBuf),
|
||||
|
|
|
@ -1936,6 +1936,10 @@ impl CrateMetadata {
|
|||
self.root.needs_panic_runtime
|
||||
}
|
||||
|
||||
pub(crate) fn is_private_dep(&self) -> bool {
|
||||
self.private_dep
|
||||
}
|
||||
|
||||
pub(crate) fn is_panic_runtime(&self) -> bool {
|
||||
self.root.panic_runtime
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue