Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8aae7a7
Use attribute parser for `#[inline()]` attribute check
obeis Sep 12, 2026
0dde918
Deterministic def path hash map encoding
aerooneqq Sep 21, 2026
c57dbad
Review: use Option instead of a bool flag, inline `switch_to_non_det_…
aerooneqq Sep 25, 2026
1b504b3
Review: use `or_else` instead of matches
aerooneqq Sep 25, 2026
956cc84
Review: pass hash by value
aerooneqq Sep 25, 2026
070652c
remove `ast::MutTy`
cyrgani Sep 27, 2026
ac6f00d
remove `hir::MutTy`
cyrgani Sep 28, 2026
9c7ce01
lint on `Ident::from_str_and_span` taking a string literal
cyrgani Sep 28, 2026
5e0bd1a
Address review comments
aerooneqq Sep 28, 2026
2f77d20
Assert that `commit_end_of_determinism` is called only once
aerooneqq Sep 28, 2026
e67d798
Support also `try-jobs:` to specify custom try jobs
Kobzol Sep 28, 2026
199f903
Allow `#[repr(simd)]` with `f16b`
Jamesbarford Sep 28, 2026
d3d2163
dont store arbitrary parsed attributes in thir
mejrs Sep 19, 2026
9e293c7
Rollup merge of #163327 - cyrgani:mut-ty, r=mejrs
JonathanBrouwer Sep 28, 2026
2cc3eeb
Rollup merge of #162910 - aerooneqq:det-def-path-hash-map-encoding, r…
JonathanBrouwer Sep 28, 2026
3adf5b2
Rollup merge of #163009 - mejrs:lint_ice, r=jonathanbrouwer
JonathanBrouwer Sep 28, 2026
3f5b1fe
Rollup merge of #162683 - obeis:check-inline, r=JonathanBrouwer,mejrs
JonathanBrouwer Sep 28, 2026
52519b5
Rollup merge of #163429 - cyrgani:preintern-lint, r=folkertdev
JonathanBrouwer Sep 28, 2026
915d17b
Rollup merge of #163431 - Jamesbarford:fix/f16b-repr-simd, r=folkertdev
JonathanBrouwer Sep 28, 2026
c47aa35
Rollup merge of #163433 - Kobzol:try-jobs, r=jieyouxu
JonathanBrouwer Sep 28, 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
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4417,6 +4417,7 @@ dependencies = [
"rustc_expand",
"rustc_feature",
"rustc_fs_util",
"rustc_hashes",
"rustc_hir",
"rustc_hir_pretty",
"rustc_index",
Expand Down
37 changes: 11 additions & 26 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ impl Pat {
PatKind::MacCall(mac) => TyKind::MacCall(mac.clone()),
// `&mut? P` can be reinterpreted as `&mut? T` where `T` is `P` reparsed as a type.
PatKind::Ref(pat, pinned, mutbl) => pat.to_ty().map(|ty| match pinned {
Pinnedness::Not => TyKind::Ref(None, MutTy { ty, mutbl: *mutbl }),
Pinnedness::Pinned => TyKind::PinnedRef(None, MutTy { ty, mutbl: *mutbl }),
Pinnedness::Not => TyKind::Ref(None, ty, *mutbl),
Pinnedness::Pinned => TyKind::PinnedRef(None, ty, *mutbl),
})?,
// A slice/array pattern `[P]` can be reparsed as `[T]`, an unsized array,
// when `P` can be reparsed as a type `T`.
Expand Down Expand Up @@ -1507,7 +1507,7 @@ impl Expr {
ExprKind::Paren(expr) => expr.to_ty().map(TyKind::Paren)?,

ExprKind::AddrOf(BorrowKind::Ref, mutbl, expr) => {
expr.to_ty().map(|ty| TyKind::Ref(None, MutTy { ty, mutbl: *mutbl }))?
expr.to_ty().map(|ty| TyKind::Ref(None, ty, *mutbl))?
}

ExprKind::Repeat(expr, expr_len) => {
Expand Down Expand Up @@ -2336,14 +2336,6 @@ impl LitKind {
}
}

// N.B., If you change this, you'll probably want to change the corresponding
// type structure in `middle/ty.rs` as well.
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
pub struct MutTy {
pub ty: Box<Ty>,
pub mutbl: Mutability,
}

/// Represents a function's signature in a trait declaration,
/// trait implementation, or free function.
#[derive(Clone, Encodable, Decodable, Debug)]
Expand Down Expand Up @@ -2470,8 +2462,7 @@ impl From<Box<Ty>> for Ty {
impl Ty {
pub fn peel_refs(&self) -> &Self {
let mut final_ty = self;
while let TyKind::Ref(_, MutTy { ty, .. }) | TyKind::Ptr(MutTy { ty, .. }) = &final_ty.kind
{
while let TyKind::Ref(_, ty, _) | TyKind::Ptr(ty, ..) = &final_ty.kind {
final_ty = ty;
}
final_ty
Expand Down Expand Up @@ -2528,13 +2519,13 @@ pub enum TyKind {
/// A fixed length array (`[T; n]`).
Array(Box<Ty>, AnonConst),
/// A raw pointer (`*const T` or `*mut T`).
Ptr(MutTy),
Ptr(Box<Ty>, Mutability),
/// A reference (`&'a T` or `&'a mut T`).
Ref(#[visitable(extra = LifetimeCtxt::Ref)] Option<Lifetime>, MutTy),
Ref(#[visitable(extra = LifetimeCtxt::Ref)] Option<Lifetime>, Box<Ty>, Mutability),
/// A pinned reference (`&'a pin const T` or `&'a pin mut T`).
///
/// Desugars into `Pin<&'a T>` or `Pin<&'a mut T>`.
PinnedRef(#[visitable(extra = LifetimeCtxt::Ref)] Option<Lifetime>, MutTy),
PinnedRef(#[visitable(extra = LifetimeCtxt::Ref)] Option<Lifetime>, Box<Ty>, Mutability),
/// A function pointer type (e.g., `fn(usize) -> bool`).
FnPtr(Box<FnPtrTy>),
/// An unsafe existential lifetime binder (e.g., `unsafe<'a> &'a ()`).
Expand Down Expand Up @@ -2979,12 +2970,10 @@ impl Param {
if ident.name == kw::SelfLower {
return match self.ty.kind {
TyKind::ImplicitSelf => Some(respan(self.pat.span, SelfKind::Value(mutbl))),
TyKind::Ref(lt, MutTy { ref ty, mutbl }) if ty.kind.is_implicit_self() => {
TyKind::Ref(lt, ref ty, mutbl) if ty.kind.is_implicit_self() => {
Some(respan(self.pat.span, SelfKind::Region(lt, mutbl)))
}
TyKind::PinnedRef(lt, MutTy { ref ty, mutbl })
if ty.kind.is_implicit_self() =>
{
TyKind::PinnedRef(lt, ref ty, mutbl) if ty.kind.is_implicit_self() => {
Some(respan(self.pat.span, SelfKind::Pinned(lt, mutbl)))
}
_ => Some(respan(
Expand Down Expand Up @@ -3016,17 +3005,13 @@ impl Param {
SelfKind::Value(mutbl) => (mutbl, infer_ty),
SelfKind::Region(lt, mutbl) => (
Mutability::Not,
Box::new(Ty {
id: DUMMY_NODE_ID,
kind: TyKind::Ref(lt, MutTy { ty: infer_ty, mutbl }),
span,
}),
Box::new(Ty { id: DUMMY_NODE_ID, kind: TyKind::Ref(lt, infer_ty, mutbl), span }),
),
SelfKind::Pinned(lt, mutbl) => (
Mutability::Not,
Box::new(Ty {
id: DUMMY_NODE_ID,
kind: TyKind::PinnedRef(lt, MutTy { ty: infer_ty, mutbl }),
kind: TyKind::PinnedRef(lt, infer_ty, mutbl),
span,
}),
),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/expand/autodiff_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub fn valid_ty_for_activity(ty: &Box<Ty>, activity: DiffActivity) -> bool {
if matches!(activity, Active | ActiveOnly) {
return true;
}
matches!(ty.kind, TyKind::Ptr(_) | TyKind::Ref(..))
matches!(ty.kind, TyKind::Ptr(..) | TyKind::Ref(..))
&& matches!(activity, Duplicated | DuplicatedOnly)
}
pub fn valid_input_activity(mode: DiffMode, activity: DiffActivity) -> bool {
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_ast/src/util/classify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ fn type_trailing_braced_mac_call(mut ty: &ast::Ty) -> Option<&ast::MacCall> {
break (mac.args.delim == Delimiter::Brace).then_some(mac);
}

ast::TyKind::Ptr(mut_ty)
| ast::TyKind::Ref(_, mut_ty)
| ast::TyKind::PinnedRef(_, mut_ty) => {
ty = &mut_ty.ty;
ast::TyKind::Ptr(inner_ty, _)
| ast::TyKind::Ref(_, inner_ty, _)
| ast::TyKind::PinnedRef(_, inner_ty, _) => {
ty = inner_ty;
}

ast::TyKind::UnsafeBinder(binder) => {
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@ macro_rules! common_visitor_and_walkers {
MethodCall,
ModKind,
ModSpans,
MutTy,
NormalAttr,
Parens,
ParenthesizedArgs,
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_ast_lowering/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::sync::Arc;

use rustc_attr_ir::lang_items::LangItem;
use rustc_attr_ir::target::Target;
use rustc_span::sym;
use thin_vec::thin_vec;

use crate::LoweringContext;
Expand Down Expand Up @@ -239,7 +240,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
postcond_span: rustc_span::Span,
) -> &'hir rustc_hir::Block<'hir> {
let check_ident: rustc_span::Ident =
rustc_span::Ident::from_str_and_span("__ensures_checker", postcond_span);
rustc_span::Ident::new(sym::__ensures_checker, postcond_span);
let (check_hir_id, postcond_decl) = {
// Set up the postcondition `let` statement.
let (checker_pat, check_hir_id) = self.pat_ident_binding_mode_mut(
Expand Down Expand Up @@ -309,7 +310,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
// ret
// }
// }
let ret_ident: rustc_span::Ident = rustc_span::Ident::from_str_and_span("__ret", span);
let ret_ident: rustc_span::Ident = rustc_span::Ident::new(sym::__ret, span);

// Set up the return `let` statement.
let (ret_pat, ret_hir_id) =
Expand Down
20 changes: 8 additions & 12 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1527,14 +1527,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
TyKind::Infer => hir::TyKind::Infer(()),
TyKind::Err(guar) => hir::TyKind::Err(*guar),
TyKind::Slice(ty) => hir::TyKind::Slice(self.lower_ty_alloc(ty, itctx)),
TyKind::Ptr(mt) => hir::TyKind::Ptr(self.lower_mt(mt, itctx)),
TyKind::Ref(region, mt) => {
TyKind::Ptr(ty, mutbl) => hir::TyKind::Ptr(self.lower_ty_alloc(ty, itctx), *mutbl),
TyKind::Ref(region, ty, mutbl) => {
let lifetime = self.lower_ty_direct_lifetime(t, *region);
hir::TyKind::Ref(lifetime, self.lower_mt(mt, itctx))
hir::TyKind::Ref(lifetime, self.lower_ty_alloc(ty, itctx), *mutbl)
}
TyKind::PinnedRef(region, mt) => {
TyKind::PinnedRef(region, ty, mutbl) => {
let lifetime = self.lower_ty_direct_lifetime(t, *region);
let kind = hir::TyKind::Ref(lifetime, self.lower_mt(mt, itctx));
let kind = hir::TyKind::Ref(lifetime, self.lower_ty_alloc(ty, itctx), *mutbl);
let span = self.lower_span(t.span);
let arg = hir::Ty { kind, span, hir_id: self.next_id() };
let args = self.arena.alloc(hir::GenericArgs {
Expand Down Expand Up @@ -1998,10 +1998,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
// Given we are only considering `ImplicitSelf` types, we needn't consider
// the case where we have a mutable pattern to a reference as that would
// no longer be an `ImplicitSelf`.
TyKind::Ref(_, mt) | TyKind::PinnedRef(_, mt)
if mt.ty.kind.is_implicit_self() =>
TyKind::Ref(_, ty, mutbl) | TyKind::PinnedRef(_, ty, mutbl)
if ty.kind.is_implicit_self() =>
{
match mt.mutbl {
match mutbl {
hir::Mutability::Not => hir::ImplicitSelfKind::RefImm,
hir::Mutability::Mut => hir::ImplicitSelfKind::RefMut,
}
Expand Down Expand Up @@ -2473,10 +2473,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
.emit();
}

fn lower_mt(&mut self, mt: &MutTy, itctx: ImplTraitContext) -> hir::MutTy<'hir> {
hir::MutTy { ty: self.lower_ty_alloc(&mt.ty, itctx), mutbl: mt.mutbl }
}

#[instrument(level = "debug", skip(self), ret)]
fn lower_param_bounds(
&mut self,
Expand Down
20 changes: 9 additions & 11 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,20 +1346,23 @@ impl<'a> State<'a> {
self.print_type(ty);
self.word("]");
}
ast::TyKind::Ptr(mt) => {
ast::TyKind::Ptr(ty, mutbl) => {
self.word("*");
self.print_mt(mt, true);
self.print_mutability(*mutbl, true);
self.print_type(ty);
}
ast::TyKind::Ref(lifetime, mt) => {
ast::TyKind::Ref(lifetime, ty, mutbl) => {
self.word("&");
self.print_opt_lifetime(lifetime);
self.print_mt(mt, false);
self.print_mutability(*mutbl, false);
self.print_type(ty);
}
ast::TyKind::PinnedRef(lifetime, mt) => {
ast::TyKind::PinnedRef(lifetime, ty, mutbl) => {
self.word("&");
self.print_opt_lifetime(lifetime);
self.word("pin ");
self.print_mt(mt, true);
self.print_mutability(*mutbl, true);
self.print_type(ty);
}
ast::TyKind::Never => {
self.word("!");
Expand Down Expand Up @@ -2229,11 +2232,6 @@ impl<'a> State<'a> {
}
}

fn print_mt(&mut self, mt: &ast::MutTy, print_const: bool) {
self.print_mutability(mt.mutbl, print_const);
self.print_type(&mt.ty)
}

fn print_param(&mut self, input: &ast::Param, is_closure: bool) {
let ib = self.ibox(INDENT_UNIT);

Expand Down
Loading
Loading