Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f78cbce
refactor: remove `Adjust::ReborrowPin`
frank-king Feb 1, 2026
69d9576
refactor: move doc(rust_logo) check to parser
mehdiakiki Mar 17, 2026
48987fd
refactor: reuse doc attr helper for rust_logo
mehdiakiki Mar 18, 2026
de1b0ac
fix: guard paren-sugar pretty-printing on short trait args
Embers-of-the-Fire Mar 20, 2026
576a727
Take first task group for further execution
zetanumbers Mar 12, 2026
785b511
fix where clause rustfix suggestion spacing
chenyukang Mar 30, 2026
17e0cc3
Create `Ty` type alias in `rustc_type_ir`
Jamesbarford Mar 23, 2026
fe4e53e
extract AttributeParseError rendering code into smaller subfunctions
scrabsha Mar 29, 2026
bb40df6
document why it is important to early return on ExpectedStringLiteral
scrabsha Mar 29, 2026
61ea83d
delete some duplicated tests
cyrgani Mar 30, 2026
d24ebcb
rename some `issues-*` tests
cyrgani Mar 30, 2026
6cd2656
add more FIXMEs and details to `ui/README.md`
cyrgani Mar 30, 2026
2d87df1
Add a test for a now fixed ICE with `offset_of!()`
jakubadamw Mar 30, 2026
4ca5c07
build-manifest: Use zlib-rs
joshtriplett Mar 31, 2026
3d1fb4c
rust-installer: Use zlib-rs
joshtriplett Mar 31, 2026
1a67e2b
Fix AtomicPtr::update's cfg gate
CAD97 Mar 31, 2026
722b2d3
Cargo.lock: Update for zlib-rs
joshtriplett Mar 31, 2026
3fd1107
tidy: Allow zlib-rs as a Rust dependency
joshtriplett Mar 31, 2026
dd1d5b7
citool: use zlib-rs
joshtriplett Mar 31, 2026
620e92f
stabilize new Range type and iterator
pitaj Mar 4, 2026
8427445
Rollup merge of #154419 - zetanumbers:take-first-group, r=nnethercote
JonathanBrouwer Mar 31, 2026
04987e7
Rollup merge of #154569 - chenyukang:yukang-fix-153567-where-clause-s…
JonathanBrouwer Mar 31, 2026
c91d040
Rollup merge of #154617 - joshtriplett:flate2-zlib-rs, r=Mark-Simulacrum
JonathanBrouwer Mar 31, 2026
d304cd6
Rollup merge of #154618 - CAD97:atomicptr-update-cfg-is-not-eight, r=…
JonathanBrouwer Mar 31, 2026
028a626
Rollup merge of #154620 - pitaj:stabilize-new_range_api, r=tgross35
JonathanBrouwer Mar 31, 2026
3869a8e
Rollup merge of #151932 - frank-king:refactor/pin-coerce-3, r=jackh726
JonathanBrouwer Mar 31, 2026
bfffbb6
Rollup merge of #153980 - mehdiakiki:pr-check_attrs-rust_logo, r=jdon…
JonathanBrouwer Mar 31, 2026
29c210d
Rollup merge of #154134 - Embers-of-the-Fire:fix-153855, r=fmease
JonathanBrouwer Mar 31, 2026
2862633
Rollup merge of #154270 - Jamesbarford:chore/move-ty-pt1, r=lcnr
JonathanBrouwer Mar 31, 2026
6188955
Rollup merge of #154580 - scrabsha:push-uzvmzwlqvqzr, r=jdonszelmann
JonathanBrouwer Mar 31, 2026
e9f6a77
Rollup merge of #154606 - cyrgani:misc-test-cleanups, r=Kivooeo
JonathanBrouwer Mar 31, 2026
bbeec42
Rollup merge of #154612 - jakubadamw:issue-125805, r=Kivooeo
JonathanBrouwer Mar 31, 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
11 changes: 9 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1422,12 +1422,13 @@ checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844"

[[package]]
name = "flate2"
version = "1.1.5"
version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb"
checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
dependencies = [
"crc32fast",
"miniz_oxide",
"zlib-rs",
]

[[package]]
Expand Down Expand Up @@ -6944,3 +6945,9 @@ dependencies = [
"quote",
"syn 2.0.110",
]

[[package]]
name = "zlib-rs"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3be3d40e40a133f9c916ee3f9f4fa2d9d63435b5fbe1bfc6d9dae0aa0ada1513"
20 changes: 13 additions & 7 deletions compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,19 @@ impl<'a> AstValidator<'a> {
{
let mut state = State::new();

let mut needs_comma = !ty_alias.after_where_clause.predicates.is_empty();
if !ty_alias.after_where_clause.has_where_token {
state.space();
state.word_space("where");
} else if !needs_comma {
state.space();
}

let mut first = ty_alias.after_where_clause.predicates.is_empty();
for p in &ty_alias.generics.where_clause.predicates {
if !first {
if needs_comma {
state.word_space(",");
}
first = false;
needs_comma = true;
state.print_where_predicate(p);
}

Expand Down Expand Up @@ -1832,7 +1834,11 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
Some((right, snippet))
}
};
let left_sp = err.span;
let left_sp = self
.sess
.source_map()
.span_extend_prev_while(err.span, char::is_whitespace)
.unwrap_or(err.span);
self.lint_buffer.dyn_buffer_lint(
DEPRECATED_WHERE_CLAUSE_LOCATION,
item.id,
Expand All @@ -1846,9 +1852,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
sugg,
}
}
None => {
errors::DeprecatedWhereClauseLocationSugg::RemoveWhere { span: left_sp }
}
None => errors::DeprecatedWhereClauseLocationSugg::RemoveWhere {
span: err.span,
},
};
errors::DeprecatedWhereClauseLocation { suggestion }.into_diag(dcx, level)
},
Expand Down
24 changes: 20 additions & 4 deletions compiler/rustc_attr_parsing/src/attributes/doc.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use rustc_ast::ast::{AttrStyle, LitKind, MetaItemLit};
use rustc_errors::msg;
use rustc_feature::template;
use rustc_hir::Target;
use rustc_hir::attrs::{
AttributeKind, CfgEntry, CfgHideShow, CfgInfo, DocAttribute, DocInline, HideOrShow,
};
use rustc_hir::lints::AttributeLintKind;
use rustc_session::parse::feature_err;
use rustc_span::{Span, Symbol, edition, sym};
use thin_vec::ThinVec;

Expand Down Expand Up @@ -481,15 +483,19 @@ impl DocParser {
}
macro_rules! no_args_and_crate_level {
($ident: ident) => {{
no_args_and_crate_level!($ident, |span| {});
}};
($ident: ident, |$span:ident| $extra_validation:block) => {{
if let Err(span) = args.no_args() {
expected_no_args(cx, span);
return;
}
let span = path.span();
if !check_attr_crate_level(cx, span) {
let $span = path.span();
if !check_attr_crate_level(cx, $span) {
return;
}
self.attribute.$ident = Some(span);
$extra_validation
self.attribute.$ident = Some($span);
}};
}
macro_rules! string_arg_and_crate_level {
Expand Down Expand Up @@ -553,7 +559,17 @@ impl DocParser {
),
Some(sym::fake_variadic) => no_args_and_not_crate_level!(fake_variadic),
Some(sym::search_unbox) => no_args_and_not_crate_level!(search_unbox),
Some(sym::rust_logo) => no_args_and_crate_level!(rust_logo),
Some(sym::rust_logo) => no_args_and_crate_level!(rust_logo, |span| {
if !cx.features().rustdoc_internals() {
feature_err(
cx.sess(),
sym::rustdoc_internals,
span,
msg!("the `#[doc(rust_logo)]` attribute is used for Rust branding"),
)
.emit();
}
}),
Some(sym::auto_cfg) => self.parse_auto_cfg(cx, path, args),
Some(sym::test) => {
let Some(list) = args.list() else {
Expand Down
143 changes: 87 additions & 56 deletions compiler/rustc_attr_parsing/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,29 +594,108 @@ pub(crate) struct AttributeParseError<'a> {
pub(crate) suggestions: Vec<String>,
}

impl<'a> AttributeParseError<'a> {
fn render_expected_specific_argument<G>(
&self,
diag: &mut Diag<'_, G>,
possibilities: &[Symbol],
strings: bool,
) where
G: EmissionGuarantee,
{
let quote = if strings { '"' } else { '`' };
match possibilities {
&[] => {}
&[x] => {
diag.span_label(
self.span,
format!("the only valid argument here is {quote}{x}{quote}"),
);
}
[first, second] => {
diag.span_label(
self.span,
format!("valid arguments are {quote}{first}{quote} or {quote}{second}{quote}"),
);
}
[first @ .., second_to_last, last] => {
let mut res = String::new();
for i in first {
res.push_str(&format!("{quote}{i}{quote}, "));
}
res.push_str(&format!("{quote}{second_to_last}{quote} or {quote}{last}{quote}"));

diag.span_label(self.span, format!("valid arguments are {res}"));
}
}
}

fn render_expected_specific_argument_list<G>(
&self,
diag: &mut Diag<'_, G>,
possibilities: &[Symbol],
strings: bool,
) where
G: EmissionGuarantee,
{
let description = self.description();

let quote = if strings { '"' } else { '`' };
match possibilities {
&[] => {}
&[x] => {
diag.span_label(
self.span,
format!(
"this {description} is only valid with {quote}{x}{quote} as an argument"
),
);
}
[first, second] => {
diag.span_label(self.span, format!("this {description} is only valid with either {quote}{first}{quote} or {quote}{second}{quote} as an argument"));
}
[first @ .., second_to_last, last] => {
let mut res = String::new();
for i in first {
res.push_str(&format!("{quote}{i}{quote}, "));
}
res.push_str(&format!("{quote}{second_to_last}{quote} or {quote}{last}{quote}"));

diag.span_label(self.span, format!("this {description} is only valid with one of the following arguments: {res}"));
}
}
}

fn description(&self) -> &'static str {
match self.description {
ParsedDescription::Attribute => "attribute",
ParsedDescription::Macro => "macro",
}
}
}

impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError<'_> {
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
let name = self.path.to_string();

let description = match self.description {
ParsedDescription::Attribute => "attribute",
ParsedDescription::Macro => "macro",
};
let description = self.description();

let mut diag = Diag::new(dcx, level, format!("malformed `{name}` {description} input"));
diag.span(self.attr_span);
diag.code(E0539);
match self.reason {
match &self.reason {
AttributeParseErrorReason::ExpectedStringLiteral { byte_string } => {
if let Some(start_point_span) = byte_string {
diag.span_suggestion(
start_point_span,
*start_point_span,
"consider removing the prefix",
"",
Applicability::MaybeIncorrect,
);
diag.note("expected a normal string literal, not a byte string literal");

// Avoid emitting an "attribute must be of the form" suggestion, as the
// attribute is likely to be well-formed already.
return diag;
} else {
diag.span_label(self.span, "expected a string literal here");
Expand Down Expand Up @@ -693,62 +772,14 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError<'_> {
strings,
list: false,
} => {
let quote = if strings { '"' } else { '`' };
match possibilities {
&[] => {}
&[x] => {
diag.span_label(
self.span,
format!("the only valid argument here is {quote}{x}{quote}"),
);
}
[first, second] => {
diag.span_label(self.span, format!("valid arguments are {quote}{first}{quote} or {quote}{second}{quote}"));
}
[first @ .., second_to_last, last] => {
let mut res = String::new();
for i in first {
res.push_str(&format!("{quote}{i}{quote}, "));
}
res.push_str(&format!(
"{quote}{second_to_last}{quote} or {quote}{last}{quote}"
));

diag.span_label(self.span, format!("valid arguments are {res}"));
}
}
self.render_expected_specific_argument(&mut diag, *possibilities, *strings);
}
AttributeParseErrorReason::ExpectedSpecificArgument {
possibilities,
strings,
list: true,
} => {
let quote = if strings { '"' } else { '`' };
match possibilities {
&[] => {}
&[x] => {
diag.span_label(
self.span,
format!(
"this {description} is only valid with {quote}{x}{quote} as an argument"
),
);
}
[first, second] => {
diag.span_label(self.span, format!("this {description} is only valid with either {quote}{first}{quote} or {quote}{second}{quote} as an argument"));
}
[first @ .., second_to_last, last] => {
let mut res = String::new();
for i in first {
res.push_str(&format!("{quote}{i}{quote}, "));
}
res.push_str(&format!(
"{quote}{second_to_last}{quote} or {quote}{last}{quote}"
));

diag.span_label(self.span, format!("this {description} is only valid with one of the following arguments: {res}"));
}
}
self.render_expected_specific_argument_list(&mut diag, *possibilities, *strings);
}
AttributeParseErrorReason::ExpectedIdentifier => {
diag.span_label(self.span, "expected a valid identifier here");
Expand Down
9 changes: 8 additions & 1 deletion compiler/rustc_data_structures/src/sync/parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ fn par_slice<I: DynSend>(

const MAX_GROUP_COUNT: usize = 128;
let group_size = items.len().div_ceil(MAX_GROUP_COUNT);
let groups = items.chunks_mut(group_size);
let mut groups = items.chunks_mut(group_size);

let Some(first_group) = groups.next() else { return };

// Reverse the order of the later functions since Rayon executes them in reverse
// order when using a single thread. This ensures the execution order matches
Expand All @@ -159,6 +161,11 @@ fn par_slice<I: DynSend>(
}
});
}

// Run the first function without spawning to avoid overwhelming stealing.
for i in first_group.iter_mut() {
guard.run(|| for_each(i));
}
});
}

Expand Down
13 changes: 1 addition & 12 deletions compiler/rustc_hir_typeck/src/expr_use_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,16 +751,6 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
adjustment::Adjust::Borrow(ref autoref) => {
self.walk_autoref(expr, &place_with_id, autoref);
}

adjustment::Adjust::ReborrowPin(mutbl) => {
// Reborrowing a Pin is like a combinations of a deref and a borrow, so we do
// both.
let bk = match mutbl {
ty::Mutability::Not => ty::BorrowKind::Immutable,
ty::Mutability::Mut => ty::BorrowKind::Mutable,
};
self.delegate.borrow_mut().borrow(&place_with_id, place_with_id.hir_id, bk);
}
}
place_with_id = self.cat_expr_adjusted(expr, place_with_id, adjustment)?;
}
Expand Down Expand Up @@ -1292,8 +1282,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx

adjustment::Adjust::NeverToAny
| adjustment::Adjust::Pointer(_)
| adjustment::Adjust::Borrow(_)
| adjustment::Adjust::ReborrowPin(..) => {
| adjustment::Adjust::Borrow(_) => {
// Result is an rvalue.
Ok(self.cat_rvalue(expr.hir_id, target))
}
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
Adjust::Pointer(_pointer_coercion) => {
// FIXME(const_trait_impl): We should probably enforce these.
}
Adjust::ReborrowPin(_mutability) => {
// FIXME(const_trait_impl): We could enforce these; they correspond to
// `&mut T: DerefMut` tho, so it's kinda moot.
}
Adjust::Borrow(_) => {
// No effects to enforce here.
}
Expand Down
11 changes: 8 additions & 3 deletions compiler/rustc_hir_typeck/src/method/confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ use rustc_lint::builtin::{
};
use rustc_middle::traits::ObligationCauseCode;
use rustc_middle::ty::adjustment::{
Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability, PointerCoercion,
Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability, DerefAdjustKind,
PointerCoercion,
};
use rustc_middle::ty::{
self, AssocContainer, GenericArgs, GenericArgsRef, GenericParamDefKind, Ty, TyCtxt,
Expand Down Expand Up @@ -243,12 +244,16 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
ty::Ref(_, ty, _) => *ty,
_ => bug!("Expected a reference type for argument to Pin"),
};
adjustments.push(Adjustment {
kind: Adjust::Deref(DerefAdjustKind::Pin),
target: inner_ty,
});
Ty::new_pinned_ref(self.tcx, region, inner_ty, mutbl)
}
_ => bug!("Cannot adjust receiver type for reborrowing pin of {target:?}"),
};

adjustments.push(Adjustment { kind: Adjust::ReborrowPin(mutbl), target });
adjustments
.push(Adjustment { kind: Adjust::Borrow(AutoBorrow::Pin(mutbl)), target });
}
None => {}
}
Expand Down
Loading
Loading