Skip to content

Rollup of 8 pull requests #121332

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

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
361fd7e
intrinsics::simd: add missing functions
RalfJung Feb 17, 2024
f12d248
Implement `NonZero` traits generically.
reitermarkus Feb 17, 2024
bb399b1
generate `getelementptr` instead of `inttoptr` for `ptr::invalid`
joboet Feb 17, 2024
24cffbf
resolve: Scale back unloading of speculatively loaded crates
petrochenkov Feb 14, 2024
f70538c
make simd_reduce_{mul,add}_unordered use only the 'reassoc' flag, not…
RalfJung Feb 18, 2024
9b193de
Remove two comments that shouldn't be there.
nnethercote Feb 15, 2024
bb4748f
Remove dead `expect_error_or_delayed_bug` method.
nnethercote Feb 16, 2024
ebb78c2
Remove `EarlyDiagCtxt::abort_if_errors`.
nnethercote Feb 16, 2024
6fa6f55
Adjust the `has_errors*` methods.
nnethercote Feb 18, 2024
9e68d89
Remove the "codegen" profile from bootstrap
Noratrieb Feb 18, 2024
03d03c6
Always inline check in `assert_unsafe_precondition` with cfg(debug_as…
Noratrieb Feb 16, 2024
226faa9
Overhaul the handling of errors at the top-level.
nnethercote Feb 18, 2024
add3457
Inline and remove `Session::compile_status`.
nnethercote Feb 18, 2024
86ba1ab
Refactor `run_global_ctxt`.
nnethercote Feb 18, 2024
2eb88a7
Replace unnecessary `abort_if_errors`.
nnethercote Feb 18, 2024
a094903
Inline and remove `abort_on_err`.
nnethercote Feb 19, 2024
42c4df0
Rename `ConstPropLint` to `KnownPanicsLint`
gurry Feb 20, 2024
12d33f3
Rollup merge of #121167 - petrochenkov:unload2, r=wesleywiser
Noratrieb Feb 20, 2024
265ae67
Rollup merge of #121196 - Nilstrieb:the-clever-solution, r=saethlin
Noratrieb Feb 20, 2024
66ee1ac
Rollup merge of #121206 - nnethercote:top-level-error-handling, r=oli…
Noratrieb Feb 20, 2024
37046c3
Rollup merge of #121223 - RalfJung:simd-intrinsics, r=Amanieu
Noratrieb Feb 20, 2024
736f958
Rollup merge of #121241 - reitermarkus:generic-nonzero-traits, r=dtolnay
Noratrieb Feb 20, 2024
5906e8e
Rollup merge of #121242 - joboet:ptr_invalid_codegen, r=scottmcm,Nils…
Noratrieb Feb 20, 2024
60a7c54
Rollup merge of #121278 - Nilstrieb:no-more-codegen, r=clubby789
Noratrieb Feb 20, 2024
76a78ef
Rollup merge of #121286 - gurry:constprop-lint-rename, r=oli-obk
Noratrieb Feb 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions compiler/rustc_metadata/src/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,16 +1070,6 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
pub fn maybe_process_path_extern(&mut self, name: Symbol) -> Option<CrateNum> {
self.maybe_resolve_crate(name, CrateDepKind::Explicit, None).ok()
}

pub fn unload_unused_crates(&mut self) {
for opt_cdata in &mut self.cstore.metas {
if let Some(cdata) = opt_cdata
&& !cdata.used()
{
*opt_cdata = None;
}
}
}
}

fn global_allocator_spans(krate: &ast::Crate) -> Vec<Span> {
Expand Down
10 changes: 10 additions & 0 deletions compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,16 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
tcx.untracked().cstore.freeze();
tcx.arena.alloc_from_iter(CStore::from_tcx(tcx).iter_crate_data().map(|(cnum, _)| cnum))
},
used_crates: |tcx, ()| {
// The list of loaded crates is now frozen in query cache,
// so make sure cstore is not mutably accessed from here on.
tcx.untracked().cstore.freeze();
tcx.arena.alloc_from_iter(
CStore::from_tcx(tcx)
.iter_crate_data()
.filter_map(|(cnum, data)| data.used().then_some(cnum)),
)
},
..providers.queries
};
provide_extern(&mut providers.extern_queries);
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,13 @@ rustc_queries! {
eval_always
desc { "fetching all foreign CrateNum instances" }
}
// Crates that are loaded non-speculatively (not for diagnostics or doc links).
// FIXME: This is currently only used for collecting lang items, but should be used instead of
// `crates` in most other cases too.
query used_crates(_: ()) -> &'tcx [CrateNum] {
eval_always
desc { "fetching `CrateNum`s for all crates loaded non-speculatively" }
}

/// A list of all traits in a crate, used by rustdoc and error reporting.
query traits(_: CrateNum) -> &'tcx [DefId] {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ fn get_lang_items(tcx: TyCtxt<'_>, (): ()) -> LanguageItems {
let mut collector = LanguageItemCollector::new(tcx, resolver);

// Collect lang items in other crates.
for &cnum in tcx.crates(()).iter() {
for &cnum in tcx.used_crates(()).iter() {
for &(def_id, lang_item) in tcx.defined_lang_items(cnum).iter() {
collector.collect_item(lang_item, def_id, None);
}
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use rustc_hir::def::Namespace::{self, *};
use rustc_hir::def::{self, CtorKind, DefKind, LifetimeRes, NonMacroAttrKind, PartialRes, PerNS};
use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID, LOCAL_CRATE};
use rustc_hir::{PrimTy, TraitCandidate};
use rustc_metadata::creader::CStore;
use rustc_middle::middle::resolve_bound_vars::Set1;
use rustc_middle::{bug, span_bug};
use rustc_session::config::{CrateType, ResolveDocLinks};
Expand Down Expand Up @@ -4574,10 +4573,6 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
// Encoding foreign def ids in proc macro crate metadata will ICE.
return None;
}
// Doc paths should be resolved speculatively and should not produce any
// diagnostics, but if they are indeed resolved, then we need to keep the
// corresponding crate alive.
CStore::from_tcx_mut(self.r.tcx).set_used_recursively(def_id.krate);
}
res
});
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
self.tcx
.sess
.time("resolve_postprocess", || self.crate_loader(|c| c.postprocess(krate)));
self.crate_loader(|c| c.unload_unused_crates());
});

// Make sure we don't mutate the cstore from here on.
Expand Down
9 changes: 8 additions & 1 deletion tests/ui/extern-flag/empty-extern-arg.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
error: extern location for std does not exist:

error: `#[panic_handler]` function required, but not found

error: unwinding panics are not supported without std
|
= help: using nightly cargo, use -Zbuild-std with panic="abort" to avoid unwinding
= note: since the core library is usually precompiled with panic="unwind", rebuilding your crate with panic="abort" may not be enough to fix the problem

error: requires `sized` lang_item

error: aborting due to 2 previous errors
error: aborting due to 4 previous errors