Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 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
411024b
Rollup merge of #157447 - danieljofficial:move-tests-cross-crate, r=j…
JonathanBrouwer Jun 7, 2026
27d63f6
Rollup merge of #145108 - LorrensP-2158466:batched-import-resolution,…
JonathanBrouwer Jun 7, 2026
0e5508b
Rollup merge of #156119 - Kmeakin:km/optimize-str-index, r=Mark-Simul…
JonathanBrouwer Jun 7, 2026
3f101c5
Rollup merge of #157289 - Walnut356:msvc_template_args, r=jieyouxu
JonathanBrouwer Jun 7, 2026
d401bc6
Rollup merge of #157540 - yotamofek:pr/rustdoc/render_all_impls-clean…
JonathanBrouwer Jun 7, 2026
016eff1
Rollup merge of #157543 - zedddie:gsoc-batch-5-meow, r=Kivooeo
JonathanBrouwer Jun 7, 2026
ffd7a6a
Rollup merge of #156188 - romancardenas:riscv-target-feature-cfg-stab…
JonathanBrouwer Jun 7, 2026
344f0bd
Rollup merge of #157323 - majiayu000:docs-repeat-last-panic, r=jhpratt
JonathanBrouwer Jun 7, 2026
4c76565
Rollup merge of #157545 - ariagivens:suggest-comma, r=JonathanBrouwer
JonathanBrouwer Jun 7, 2026
f230678
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,
}
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
Loading
Loading