Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ef9eff9
Further optimize `SliceIndex<str>` impl for `Range<usize>`
Kmeakin May 3, 2026
d2c767f
rustc: riscv: promote d, e, and f target_features to CfgStableToggleU…
romancardenas May 5, 2026
d396920
rustc: riscv: adapt target_feature tests
romancardenas May 6, 2026
4e9a3de
rustc: riscv: add tests for cfg-only stable features
romancardenas May 6, 2026
355b501
Document Repeat::last panic behavior
majiayu000 Jun 2, 2026
17ebb8f
move cross crate tests out of ui/issues
danieljofficial May 19, 2026
1e1560b
add issue links and bless
danieljofficial Jun 4, 2026
f1d8aed
add infallible primitive type lookups to template arg resolver
Walnut356 Jun 2, 2026
c6945a5
fix `breakpoint_callback` path
Walnut356 Jun 6, 2026
c4d84db
Resolver: Batched import resolution.
LorrensP-2158466 Aug 8, 2025
b09dbec
hack for RustEmbed with updated test
LorrensP-2158466 Feb 24, 2026
fe7c7a1
Add extra line in generator script for `core_arch` that unambiguously…
LorrensP-2158466 Jun 5, 2026
d21aa1c
move batch
zedddie Jun 6, 2026
eff5e8d
bless batch
zedddie Jun 6, 2026
8cac9a3
Suggest using comma to separate valid attribute list items
ariagivens Jun 6, 2026
a23630f
Document Repeat::count panic behavior
majiayu000 Jun 7, 2026
4e26424
chore: Update annotate-snippets to 0.12.16
InvalidPathException Jun 7, 2026
0053d76
Cleanup and optimize `render_impls`
yotamofek Jun 6, 2026
5ec82ec
Use WorkProductMap instead of FxIndexMap
bjorn3 Jun 3, 2026
19d28a9
Assert incr comp in copy_cgu_workproduct_to_incr_comp_cache_dir
bjorn3 Jun 4, 2026
4ffc261
Rollup merge of #157447 - danieljofficial:move-tests-cross-crate, r=j…
JonathanBrouwer Jun 7, 2026
1b47481
Rollup merge of #145108 - LorrensP-2158466:batched-import-resolution,…
JonathanBrouwer Jun 7, 2026
d35668f
Rollup merge of #156119 - Kmeakin:km/optimize-str-index, r=Mark-Simul…
JonathanBrouwer Jun 7, 2026
ee2c518
Rollup merge of #157289 - Walnut356:msvc_template_args, r=jieyouxu
JonathanBrouwer Jun 7, 2026
4b29bc4
Rollup merge of #157540 - yotamofek:pr/rustdoc/render_all_impls-clean…
JonathanBrouwer Jun 7, 2026
0ea65ed
Rollup merge of #157444 - bjorn3:lto_refactors21, r=lqd
JonathanBrouwer Jun 7, 2026
90d8e30
Rollup merge of #157543 - zedddie:gsoc-batch-5-meow, r=Kivooeo
JonathanBrouwer Jun 7, 2026
1eb6744
Rollup merge of #156188 - romancardenas:riscv-target-feature-cfg-stab…
JonathanBrouwer Jun 7, 2026
dcb3e98
Rollup merge of #157323 - majiayu000:docs-repeat-last-panic, r=jhpratt
JonathanBrouwer Jun 7, 2026
65a65e9
Rollup merge of #157545 - ariagivens:suggest-comma, r=JonathanBrouwer
JonathanBrouwer Jun 7, 2026
b3d7e2c
Rollup merge of #157559 - InvalidPathException:main, r=jieyouxu
JonathanBrouwer Jun 7, 2026
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
6 changes: 3 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ dependencies = [

[[package]]
name = "annotate-snippets"
version = "0.12.15"
version = "0.12.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92570a3f9c98e7e84df84b71d0965ac99b1871fcd75a3773a3bd1bad13f64cf7"
checksum = "f211a51805bc641f3ad5b7664c77d2547af685cc33b4cd8d31964027a46f13f1"
dependencies = [
"anstyle",
"memchr",
Expand Down Expand Up @@ -3958,7 +3958,7 @@ dependencies = [
name = "rustc_errors"
version = "0.0.0"
dependencies = [
"annotate-snippets 0.12.15",
"annotate-snippets 0.12.16",
"anstream",
"anstyle",
"derive_setters",
Expand Down
33 changes: 26 additions & 7 deletions compiler/rustc_attr_parsing/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ use thin_vec::ThinVec;

use crate::ShouldEmit;
use crate::session_diagnostics::{
InvalidMetaItem, InvalidMetaItemQuoteIdentSugg, InvalidMetaItemRemoveNegSugg, MetaBadDelim,
MetaBadDelimSugg, SuffixedLiteralInAttribute,
ExpectedComma, InvalidMetaItem, InvalidMetaItemQuoteIdentSugg, InvalidMetaItemRemoveNegSugg,
MetaBadDelim, MetaBadDelimSugg, SuffixedLiteralInAttribute,
};

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -704,6 +704,29 @@ impl<'a, 'sess> MetaItemListParserContext<'a, 'sess> {
self.parser.dcx().create_err(err)
}

fn should_continue_parsing_meta_items(&mut self) -> Result<bool, Diag<'sess>> {
if self.parser.eat(exp!(Comma)) {
return Ok(true);
} else if self.parser.token == token::Eof {
return Ok(false);
}

let mut snapshot = self.parser.create_snapshot_for_diagnostic();
if matches!(self.should_emit, ShouldEmit::ErrorsAndLints { recovery: Recovery::Allowed }) {
let span = self.parser.prev_token.span.shrink_to_hi();
self.should_emit = ShouldEmit::Nothing;
match self.parse_meta_item_inner() {
Ok(_) => {
return Err(self.parser.dcx().create_err(ExpectedComma { span }));
}
Err(e) => {
e.cancel();
}
}
}
snapshot.unexpected_any()
}

fn parse(
tokens: TokenStream,
psess: &'sess ParseSess,
Expand All @@ -724,15 +747,11 @@ impl<'a, 'sess> MetaItemListParserContext<'a, 'sess> {
while this.parser.token != token::Eof {
sub_parsers.push(this.parse_meta_item_inner()?);

if !this.parser.eat(exp!(Comma)) {
if !this.should_continue_parsing_meta_items()? {
break;
}
}

if parser.token != token::Eof {
parser.unexpected()?;
}

Ok(MetaItemListParser { sub_parsers, span })
}
}
Expand Down
13 changes: 13 additions & 0 deletions compiler/rustc_attr_parsing/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,3 +1032,16 @@ pub(crate) struct SanitizeInvalidStatic {
pub span: Span,
pub field: &'static str,
}

#[derive(Diagnostic)]
#[diag("attribute items not separated with `,`")]
pub(crate) struct ExpectedComma {
#[primary_span]
#[suggestion(
"try adding `,` here",
code = ",",
applicability = "maybe-incorrect",
style = "short"
)]
pub span: Span,
}
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_cranelift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use cranelift_codegen::settings::{self, Configurable};
use rustc_codegen_ssa::traits::CodegenBackend;
use rustc_codegen_ssa::{CompiledModules, CrateInfo, TargetConfig, back};
use rustc_log::tracing::info;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::dep_graph::WorkProductMap;
use rustc_session::Session;
use rustc_session::config::OutputFilenames;
use rustc_span::{Symbol, sym};
Expand Down Expand Up @@ -88,7 +88,7 @@ mod prelude {
};
pub(crate) use cranelift_module::{self, DataDescription, FuncId, Linkage, Module};
pub(crate) use rustc_abi::{BackendRepr, FIRST_VARIANT, FieldIdx, Scalar, Size, VariantIdx};
pub(crate) use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
pub(crate) use rustc_data_structures::fx::FxHashMap;
pub(crate) use rustc_hir::def_id::{DefId, LOCAL_CRATE};
pub(crate) use rustc_index::Idx;
pub(crate) use rustc_middle::mir::{self, *};
Expand Down Expand Up @@ -235,7 +235,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
sess: &Session,
_outputs: &OutputFilenames,
crate_info: &CrateInfo,
) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
) -> (CompiledModules, WorkProductMap) {
ongoing_codegen
.downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<driver::aot::AotDriver>>()
.unwrap()
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ use rustc_codegen_ssa::base::codegen_crate;
use rustc_codegen_ssa::target_features::cfg_target_feature;
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, WriteBackendMethods};
use rustc_codegen_ssa::{CompiledModule, CompiledModules, CrateInfo, ModuleCodegen, TargetConfig};
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_data_structures::sync::IntoDynSyncSend;
use rustc_errors::{DiagCtxt, DiagCtxtHandle};
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
use rustc_middle::ty::TyCtxt;
use rustc_middle::util::Providers;
use rustc_session::Session;
Expand Down Expand Up @@ -301,7 +300,7 @@ impl CodegenBackend for GccCodegenBackend {
sess: &Session,
_outputs: &OutputFilenames,
crate_info: &CrateInfo,
) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
) -> (CompiledModules, WorkProductMap) {
ongoing_codegen
.downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<GccCodegenBackend>>()
.expect("Expected GccCodegenBackend's OngoingCodegen, found Box<Any>")
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ use rustc_codegen_ssa::back::write::{
};
use rustc_codegen_ssa::traits::*;
use rustc_codegen_ssa::{CompiledModule, CompiledModules, CrateInfo, ModuleCodegen, TargetConfig};
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_errors::{DiagCtxt, DiagCtxtHandle};
use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
use rustc_middle::ty::TyCtxt;
use rustc_middle::util::Providers;
use rustc_session::Session;
Expand Down Expand Up @@ -358,7 +357,7 @@ impl CodegenBackend for LlvmCodegenBackend {
sess: &Session,
outputs: &OutputFilenames,
crate_info: &CrateInfo,
) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
) -> (CompiledModules, WorkProductMap) {
let (compiled_modules, work_products) = ongoing_codegen
.downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<LlvmCodegenBackend>>()
.expect("Expected LlvmCodegenBackend's OngoingCodegen, found Box<Any>")
Expand Down
20 changes: 7 additions & 13 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::sync::mpsc::{Receiver, Sender, channel};
use std::{assert_matches, fs, io, mem, str, thread};

use rustc_abi::Size;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::jobserver::{self, Acquired};
use rustc_data_structures::profiling::{SelfProfilerRef, VerboseTimingGuard};
use rustc_errors::emitter::Emitter;
Expand All @@ -22,7 +21,7 @@ use rustc_incremental::{
use rustc_macros::{Decodable, Encodable};
use rustc_metadata::fs::copy_to_stdout;
use rustc_middle::bug;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
use rustc_middle::ty::TyCtxt;
use rustc_session::Session;
use rustc_session::config::{
Expand Down Expand Up @@ -460,8 +459,8 @@ pub(crate) fn start_async_codegen<B: WriteBackendMethods>(
fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
sess: &Session,
compiled_modules: &CompiledModules,
) -> FxIndexMap<WorkProductId, WorkProduct> {
let mut work_products = FxIndexMap::default();
) -> WorkProductMap {
let mut work_products = WorkProductMap::default();

if sess.opts.incremental.is_none() || sess.opts.unstable_opts.disable_incr_comp_backend_caching
{
Expand Down Expand Up @@ -490,14 +489,13 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
if let Some(path) = &module.bytecode {
files.push((OutputType::Bitcode.extension(), path.as_path()));
}
if let Some((id, product)) = copy_cgu_workproduct_to_incr_comp_cache_dir(
let (id, product) = copy_cgu_workproduct_to_incr_comp_cache_dir(
sess,
&module.name,
files.as_slice(),
&module.links_from_incr_cache,
) {
work_products.insert(id, product);
}
);
work_products.insert(id, product);
}

work_products
Expand Down Expand Up @@ -2099,11 +2097,7 @@ pub struct OngoingCodegen<B: WriteBackendMethods> {
}

impl<B: WriteBackendMethods> OngoingCodegen<B> {
pub fn join(
self,
sess: &Session,
crate_info: &CrateInfo,
) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
pub fn join(self, sess: &Session, crate_info: &CrateInfo) -> (CompiledModules, WorkProductMap) {
self.shared_emitter_main.check(sess, true);

let maybe_lto_modules = sess.time("join_worker_thread", || match self.coordinator.join() {
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_codegen_ssa/src/traits/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ use std::any::Any;
use std::hash::Hash;

use rustc_ast::expand::allocator::AllocatorMethod;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::sync::{DynSend, DynSync};
use rustc_metadata::EncodedMetadata;
use rustc_metadata::creader::MetadataLoaderDyn;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::dep_graph::WorkProductMap;
use rustc_middle::ty::TyCtxt;
use rustc_middle::util::Providers;
use rustc_session::Session;
Expand Down Expand Up @@ -130,7 +129,7 @@ pub trait CodegenBackend {
sess: &Session,
outputs: &OutputFilenames,
crate_info: &CrateInfo,
) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>);
) -> (CompiledModules, WorkProductMap);

fn print_pass_timings(&self) {}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2024"

[dependencies]
# tidy-alphabetical-start
annotate-snippets = { version = "0.12.15", features = ["simd"] }
annotate-snippets = { version = "0.12.16", features = ["simd"] }
anstream = "0.6.20"
anstyle = "1.0.13"
derive_setters = "0.1.6"
Expand Down
15 changes: 6 additions & 9 deletions compiler/rustc_incremental/src/persist/save.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::fs;

use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::sync::par_join;
use rustc_middle::dep_graph::{DepGraph, WorkProduct, WorkProductId};
use rustc_middle::dep_graph::{DepGraph, WorkProductMap};
use rustc_middle::query::on_disk_cache;
use rustc_middle::ty::TyCtxt;
use rustc_serialize::Encodable as RustcEncodable;
Expand Down Expand Up @@ -93,7 +92,7 @@ pub(crate) fn save_dep_graph(tcx: TyCtxt<'_>) {
pub fn save_work_product_index(
sess: &Session,
dep_graph: &DepGraph,
new_work_products: FxIndexMap<WorkProductId, WorkProduct>,
new_work_products: WorkProductMap,
) {
if sess.opts.incremental.is_none() {
return;
Expand Down Expand Up @@ -126,18 +125,16 @@ pub fn save_work_product_index(

// Check that we did not delete one of the current work-products:
debug_assert!({
new_work_products.iter().all(|(_, wp)| {
new_work_products.items().all(|(_, wp)| {
wp.saved_files.items().all(|(_, path)| in_incr_comp_dir_sess(sess, path).exists())
})
});
}

fn encode_work_product_index(
work_products: &FxIndexMap<WorkProductId, WorkProduct>,
encoder: &mut FileEncoder,
) {
fn encode_work_product_index(work_products: &WorkProductMap, encoder: &mut FileEncoder) {
let serialized_products: Vec<_> = work_products
.iter()
.to_sorted_stable_ord()
.into_iter()
.map(|(id, work_product)| SerializedWorkProduct {
id: *id,
work_product: work_product.clone(),
Expand Down
8 changes: 5 additions & 3 deletions compiler/rustc_incremental/src/persist/work_product.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ use crate::persist::fs::*;

/// Copies a CGU work product to the incremental compilation directory, so next compilation can
/// find and reuse it.
///
/// Panics when incr comp is disabled.
pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
sess: &Session,
cgu_name: &str,
files: &[(&'static str, &Path)],
known_links: &[PathBuf],
) -> Option<(WorkProductId, WorkProduct)> {
) -> (WorkProductId, WorkProduct) {
debug!(?cgu_name, ?files);
sess.opts.incremental.as_ref()?;
assert!(sess.opts.incremental.is_some());

let mut saved_files = UnordMap::default();
for (ext, path) in files {
Expand All @@ -50,7 +52,7 @@ pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
let work_product = WorkProduct { cgu_name: cgu_name.to_string(), saved_files };
debug!(?work_product);
let work_product_id = WorkProductId::from_cgu_name(cgu_name);
Some((work_product_id, work_product))
(work_product_id, work_product)
}

/// Removes files for a given work product.
Expand Down
18 changes: 8 additions & 10 deletions compiler/rustc_interface/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ use std::sync::Arc;

use rustc_codegen_ssa::traits::CodegenBackend;
use rustc_codegen_ssa::{CompiledModules, CrateInfo};
use rustc_data_structures::indexmap::IndexMap;
use rustc_data_structures::svh::Svh;
use rustc_errors::timings::TimingSection;
use rustc_hir::def_id::LOCAL_CRATE;
use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::DepGraph;
use rustc_middle::dep_graph::{DepGraph, WorkProductMap};
use rustc_middle::ty::TyCtxt;
use rustc_session::Session;
use rustc_session::config::{self, OutputFilenames, OutputType};
Expand Down Expand Up @@ -51,7 +50,7 @@ impl Linker {
let (compiled_modules, mut work_products) = sess.time("finish_ongoing_codegen", || {
match self.ongoing_codegen.downcast::<CompiledModules>() {
// This was a check only build
Ok(compiled_modules) => (*compiled_modules, IndexMap::default()),
Ok(compiled_modules) => (*compiled_modules, WorkProductMap::default()),

Err(ongoing_codegen) => codegen_backend.join_codegen(
ongoing_codegen,
Expand Down Expand Up @@ -90,14 +89,13 @@ impl Linker {

if sess.opts.incremental.is_some()
&& let Some(path) = self.metadata.path()
&& let Some((id, product)) =
rustc_incremental::copy_cgu_workproduct_to_incr_comp_cache_dir(
sess,
"metadata",
&[("rmeta", path)],
&[],
)
{
let (id, product) = rustc_incremental::copy_cgu_workproduct_to_incr_comp_cache_dir(
sess,
"metadata",
&[("rmeta", path)],
&[],
);
work_products.insert(id, product);
}

Expand Down
7 changes: 3 additions & 4 deletions compiler/rustc_interface/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ use rustc_codegen_ssa::target_features::cfg_target_feature;
use rustc_codegen_ssa::traits::CodegenBackend;
use rustc_codegen_ssa::{CompiledModules, CrateInfo, TargetConfig};
use rustc_data_structures::base_n::{CASE_INSENSITIVE, ToBaseN};
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::jobserver::Proxy;
use rustc_data_structures::sync;
use rustc_metadata::{DylibError, EncodedMetadata, load_symbol_from_dylib};
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::dep_graph::WorkProductMap;
use rustc_middle::ty::{CurrentGcx, TyCtxt};
use rustc_query_impl::{CollectActiveJobsKind, collect_active_query_jobs};
use rustc_session::config::{
Expand Down Expand Up @@ -418,8 +417,8 @@ impl CodegenBackend for DummyCodegenBackend {
_sess: &Session,
_outputs: &OutputFilenames,
_crate_info: &CrateInfo,
) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
(*ongoing_codegen.downcast().unwrap(), FxIndexMap::default())
) -> (CompiledModules, WorkProductMap) {
(*ongoing_codegen.downcast().unwrap(), WorkProductMap::default())
}

fn link(
Expand Down
Loading
Loading