Skip to content

Commit 4bd1a8c

Browse files
committed
cleanup
1 parent 5ec40f5 commit 4bd1a8c

File tree

1 file changed

+11
-52
lines changed

1 file changed

+11
-52
lines changed

compiler/rustc_metadata/src/creader.rs

+11-52
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl<'a> std::fmt::Debug for CrateDump<'a> {
159159
}
160160
}
161161

162-
///
162+
/// Reason that a crate is being sourced as a dependency.
163163
#[derive(Clone, Copy)]
164164
enum CrateOrigin<'a> {
165165
/// This crate was a dependency of another crate.
@@ -168,15 +168,14 @@ enum CrateOrigin<'a> {
168168
/// Dependency info about this crate.
169169
dep: &'a CrateDep,
170170
},
171-
///
171+
/// Injected
172172
Injected,
173173
/// An extern that has been provided with the `force` option.
174174
ForcedExtern,
175-
///
175+
/// Part of the extern prelude.
176176
ExternPrelude,
177-
/// Provided by `extern crate foo` or `extern crate foo as bar`.
178-
#[allow(unused)]
179-
AstExtern { name: Symbol, orig_name: Option<Symbol> },
177+
/// Provided by `extern crate foo`.
178+
AstExtern,
180179
}
181180

182181
impl<'a> CrateOrigin<'a> {
@@ -458,15 +457,6 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
458457
return true;
459458
}
460459

461-
// if name == sym::compiler_builtins {
462-
// // compiler_builtins is an implementation detail and should never show up in
463-
// // diagnostics. `dep_root` is `None` if the requested crate came from an `extern
464-
// // crate ..`, which is the case since `compiler_builtins` is injected into AST at
465-
// // `rustc_builtin_macros::standard_library_imports::inject`.
466-
// //
467-
// // See also the note at that module referencing #113634.
468-
// return true;
469-
// }
470460
// Any descendants of `std` should be private. These crates are usually not marked
471461
// private in metadata, so we ignore that field.
472462
if extern_private.is_none()
@@ -1052,49 +1042,18 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
10521042
return;
10531043
}
10541044

1055-
// let Some((cnum, _meta)) = self
1056-
// .cstore
1057-
// .iter_crate_data()
1058-
// .find(|(_cnum, meta)| meta.name() == sym::compiler_builtins)
1059-
// else {
1060-
// info!("`compiler_builtins` crate was not found for");
1061-
// return;
1062-
// };
1063-
//
1064-
info!("looking for builtins in {}", self.cstore.crate_name(LOCAL_CRATE));
1065-
1066-
// self.process_extern_crate(
1067-
// ast::ItemKind::ExternCrate(Some(sym::compiler_builtins)),
1068-
// def_id,
1069-
// definitions,
1070-
// )
10711045

10721046
let res = self.maybe_resolve_crate(
10731047
sym::compiler_builtins,
1074-
CrateDepKind::Explicit,
1048+
CrateDepKind::Implicit,
10751049
CrateOrigin::Injected,
10761050
);
10771051

1078-
info!("BUILTINS RESULT: {res:?}");
1079-
1080-
// let cnum = self
1081-
// .resolve_crate(
1082-
// sym::compiler_builtins,
1083-
// DUMMY_SP,
1084-
// CrateDepKind::Explicit,
1085-
// CrateOrigin::Injected,
1086-
// )
1087-
// .expect("unresolved builtins");
1088-
1089-
// self.cstore.update_extern_crate(cnum, ExternCrate {
1090-
// src: ExternCrateSource::Path,
1091-
// // src: ExternCrateSource::Extern(def_id.to_def_id()),
1092-
// span: DUMMY_SP,
1093-
// path_len: "compiler_builtins".len(),
1094-
// dependency_of: LOCAL_CRATE,
1095-
// });
1096-
1097-
// self.cstore.get_crate_data_mut(LOCAL_CRATE).add_dependency(cnum);
1052+
if res.is_ok() {
1053+
info!("`compiler_builtins` found");
1054+
} else {
1055+
info!("`compiler_builtins` not found, skipping");
1056+
}
10981057
}
10991058

11001059
fn inject_dependency_if(

0 commit comments

Comments
 (0)