-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Inject compiler_builtins during crate resolution #113634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -758,6 +758,27 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> { | |||||
self.inject_dependency_if(cnum, "a panic runtime", &|data| data.needs_panic_runtime()); | ||||||
} | ||||||
|
||||||
fn inject_compiler_builtins(&mut self, krate: &ast::Crate) { | ||||||
// Don't inject compiler_builtins for core and compiler_builtins. | ||||||
if attr::contains_name(&krate.attrs, sym::no_core) | ||||||
|| attr::contains_name(&krate.attrs, sym::compiler_builtins) | ||||||
{ | ||||||
return; | ||||||
} | ||||||
|
||||||
info!("loading compiler_builtins"); | ||||||
|
||||||
let Some(cnum) = self.resolve_crate(sym::compiler_builtins, DUMMY_SP, CrateDepKind::Implicit) else { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't help. |
||||||
return; | ||||||
}; | ||||||
let data = self.cstore.get_crate_data(cnum); | ||||||
|
||||||
// Sanity check the loaded crate to ensure it is indeed compiler_builtins | ||||||
if !data.is_compiler_builtins() { | ||||||
self.sess.emit_err(errors::NotCompilerBuiltins { crate_name: sym::compiler_builtins }); | ||||||
} | ||||||
} | ||||||
|
||||||
fn inject_profiler_runtime(&mut self, krate: &ast::Crate) { | ||||||
if self.sess.opts.unstable_opts.no_profiler_runtime | ||||||
|| !(self.sess.instrument_coverage() | ||||||
|
@@ -968,6 +989,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> { | |||||
|
||||||
pub fn postprocess(&mut self, krate: &ast::Crate) { | ||||||
self.inject_forced_externs(); | ||||||
self.inject_compiler_builtins(krate); | ||||||
self.inject_profiler_runtime(krate); | ||||||
self.inject_allocator_crate(krate); | ||||||
self.inject_panic_runtime(krate); | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.