Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f486a6f
Update bootstrapping docs to account for new stage meanings
lolbinarycat Aug 11, 2025
0cf5b67
Update for changes to macro parser
joshtriplett Aug 19, 2025
5ca2b9e
Losslessly optimize PNG files
lumiscosity Aug 19, 2025
88c42a2
add gpu device side instructions
ZuseZ4 Aug 19, 2025
636e147
Merge pull request #2524 from rust-lang/offload-device
ZuseZ4 Aug 19, 2025
b7b98ec
Merge pull request #2549 from lumiscosity/optimize-images
Noratrieb Aug 20, 2025
519854f
Merge pull request #2546 from lolbinarycat/patch-7
Noratrieb Aug 20, 2025
78c552d
suggest using `@bors try jobs=...`
WaffleLapkin Aug 23, 2025
c27f6e5
Rewrite try jobs section a bit
Kobzol Aug 23, 2025
c957c4e
Account for impossible bounds making seemingly unsatisfyable dyn-to-d…
compiler-errors Aug 19, 2025
e0fb6eb
Nits
compiler-errors Aug 23, 2025
45bcbd9
bootstrap.py: Improve CPU detection on NetBSD,
he32 Aug 23, 2025
3a2392b
bootstrap.py: follow up tidy output from CI.
he32 Aug 23, 2025
c12ab84
Merge pull request #2548 from joshtriplett/macro-parser
jieyouxu Aug 24, 2025
2f1b6d1
bootstrap.py: follow up more 'tidy' insistence (string quotes).
he32 Aug 24, 2025
3f339ab
Dial down detail of B-tree description
hkBst Jan 20, 2025
bb7993f
focus more on ordered aspect and restore old comments
hkBst Jan 21, 2025
1b77387
Prevent confusion with insertion-ordered maps.
hkBst Jan 22, 2025
3851e6c
Warn on macro calls for attributes that had this behaviour previously
JonathanBrouwer Aug 23, 2025
06608ba
Merge pull request #2550 from WaffleLapkin/try-bors
WaffleLapkin Aug 24, 2025
fe81a79
Regression test for attributes on macro calls
JonathanBrouwer Aug 23, 2025
455a67b
Replace the `llvm::Bool` typedef with a proper newtype
Zalathar Aug 24, 2025
b4e97e5
Rename `llvm::Bool` aliases to standard const case
Zalathar Aug 24, 2025
b1be775
raw-dylib-elf: set correct `DT_VERDEFNUM`
mati865 Aug 23, 2025
63b26c5
Update `bitflags` to 2.9.3.
nnethercote Aug 24, 2025
a06c388
Remove the lifetime from `ExpTokenPair`/`SeqSep`.
nnethercote Aug 24, 2025
c4cd29b
Prepare for merging from rust-lang/rust
invalid-email-address Aug 25, 2025
721337b
Merge ref 'a1dbb443527b' from rust-lang/rust
invalid-email-address Aug 25, 2025
baff99c
Remove bug comments from Repeat variant
minux-lee Aug 25, 2025
d1d1fb3
Merge pull request #2551 from rust-lang/rustc-pull
tshepang Aug 25, 2025
9b46273
Rollup merge of #135761 - hkBst:patch-9, r=ibraheemdev
Zalathar Aug 25, 2025
8a2568a
Rollup merge of #145620 - compiler-errors:fake-dyn-to-dyn, r=lcnr
Zalathar Aug 25, 2025
c38bbf5
Rollup merge of #145788 - JonathanBrouwer:proper-fix-for-macro-call-t…
Zalathar Aug 25, 2025
d89d8a7
Rollup merge of #145794 - he32:bootstrap-netbsd-fix, r=Kobzol
Zalathar Aug 25, 2025
0b67285
Rollup merge of #145817 - Zalathar:llvm-bool, r=workingjubilee
Zalathar Aug 25, 2025
488496b
Rollup merge of #145820 - mati865:raw-elf-verdefnum, r=bjorn3
Zalathar Aug 25, 2025
eb9e6f4
Rollup merge of #145828 - nnethercote:bitflags-2.9.3, r=joshtriplett
Zalathar Aug 25, 2025
078bfaa
Rollup merge of #145830 - nnethercote:TokenKind-unref, r=chenyukang
Zalathar Aug 25, 2025
a12516f
Rollup merge of #145836 - minux-lee:issue-145835, r=RalfJung
Zalathar Aug 25, 2025
0119d16
Rollup merge of #145842 - tshepang:rdg-sync, r=jieyouxu
Zalathar Aug 25, 2025
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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ dependencies = [

[[package]]
name = "bitflags"
version = "2.9.2"
version = "2.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a65b545ab31d687cff52899d4890855fec459eb6afe0da6417b8a18da87aa29"
checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d"

[[package]]
name = "blake3"
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ impl<S: Stage> SingleAttributeParser<S> for ExportNameParser {
Warn(Target::Field),
Warn(Target::Arm),
Warn(Target::MacroDef),
Warn(Target::MacroCall),
]);
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name");

Expand Down Expand Up @@ -174,6 +175,7 @@ impl<S: Stage> AttributeParser<S> for NakedParser {
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Method(MethodKind::TraitImpl)),
Warn(Target::MacroCall),
]);

fn finalize(self, cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
Expand Down Expand Up @@ -278,6 +280,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for TrackCallerParser {
Warn(Target::MacroDef),
Warn(Target::Arm),
Warn(Target::Field),
Warn(Target::MacroCall),
]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::TrackCaller;
}
Expand Down Expand Up @@ -365,7 +368,8 @@ impl<S: Stage> AttributeParser<S> for UsedParser {
}
},
)];
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Static)]);
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Static), Warn(Target::MacroCall)]);

fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
// Ratcheting behaviour, if both `linker` and `compiler` are specified, use `linker`
Expand Down Expand Up @@ -450,6 +454,7 @@ impl<S: Stage> CombineAttributeParser<S> for TargetFeatureParser {
Warn(Target::Field),
Warn(Target::Arm),
Warn(Target::MacroDef),
Warn(Target::MacroCall),
]);
}

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_attr_parsing/src/attributes/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ impl<S: Stage> SingleAttributeParser<S> for InlineParser {
Warn(Target::MacroDef),
Warn(Target::Arm),
Warn(Target::AssocConst),
Warn(Target::MacroCall),
]);
const TEMPLATE: AttributeTemplate = template!(
Word,
Expand Down
7 changes: 5 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/link_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ impl<S: Stage> SingleAttributeParser<S> for LinkOrdinalParser {
const PATH: &[Symbol] = &[sym::link_ordinal];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::ForeignFn), Allow(Target::ForeignStatic)]);
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::ForeignFn),
Allow(Target::ForeignStatic),
Warn(Target::MacroCall),
]);
const TEMPLATE: AttributeTemplate = template!(
List: &["ordinal"],
"https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for NonExhaustiveParser {
Warn(Target::Field),
Warn(Target::Arm),
Warn(Target::MacroDef),
Warn(Target::MacroCall),
]);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::NonExhaustive;
}
12 changes: 6 additions & 6 deletions compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
use super::prelude::*;

const PROC_MACRO_ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Fn), Warn(Target::Crate), Warn(Target::MacroCall)]);

pub(crate) struct ProcMacroParser;
impl<S: Stage> NoArgsAttributeParser<S> for ProcMacroParser {
const PATH: &[Symbol] = &[sym::proc_macro];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Fn), Warn(Target::Crate)]);
const ALLOWED_TARGETS: AllowedTargets = PROC_MACRO_ALLOWED_TARGETS;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::ProcMacro;
}

pub(crate) struct ProcMacroAttributeParser;
impl<S: Stage> NoArgsAttributeParser<S> for ProcMacroAttributeParser {
const PATH: &[Symbol] = &[sym::proc_macro_attribute];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Fn), Warn(Target::Crate)]);
const ALLOWED_TARGETS: AllowedTargets = PROC_MACRO_ALLOWED_TARGETS;
const CREATE: fn(Span) -> AttributeKind = AttributeKind::ProcMacroAttribute;
}

Expand All @@ -23,8 +24,7 @@ impl<S: Stage> SingleAttributeParser<S> for ProcMacroDeriveParser {
const PATH: &[Symbol] = &[sym::proc_macro_derive];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowList(&[Allow(Target::Fn), Warn(Target::Crate)]);
const ALLOWED_TARGETS: AllowedTargets = PROC_MACRO_ALLOWED_TARGETS;
const TEMPLATE: AttributeTemplate = template!(
List: &["TraitName", "TraitName, attributes(name1, name2, ...)"],
"https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros"
Expand Down
10 changes: 8 additions & 2 deletions compiler/rustc_attr_parsing/src/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ pub fn emit_attribute_lint<L: LintEmitter>(lint: &AttributeLint<L::Id>, lint_emi
.emit_node_span_lint(
// This check is here because `deprecated` had its own lint group and removing this would be a breaking change
if name.segments[0].name == sym::deprecated
&& ![Target::Closure, Target::Expression, Target::Statement, Target::Arm]
.contains(target)
&& ![
Target::Closure,
Target::Expression,
Target::Statement,
Target::Arm,
Target::MacroCall,
]
.contains(target)
{
rustc_session::lint::builtin::USELESS_DEPRECATED
} else {
Expand Down
136 changes: 74 additions & 62 deletions compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use rustc_mir_dataflow::points::DenseLocationMap;
use rustc_span::def_id::CRATE_DEF_ID;
use rustc_span::source_map::Spanned;
use rustc_span::{Span, sym};
use rustc_trait_selection::infer::InferCtxtExt;
use rustc_trait_selection::traits::query::type_op::custom::scrape_region_constraints;
use rustc_trait_selection::traits::query::type_op::{TypeOp, TypeOpOutput};
use tracing::{debug, instrument, trace};
Expand Down Expand Up @@ -1454,68 +1455,79 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
}
CastKind::PtrToPtr => {
let ty_from = op.ty(self.body, tcx);
let cast_ty_from = CastTy::from_ty(ty_from);
let cast_ty_to = CastTy::from_ty(*ty);
match (cast_ty_from, cast_ty_to) {
(Some(CastTy::Ptr(src)), Some(CastTy::Ptr(dst))) => {
let src_tail = self.struct_tail(src.ty, location);
let dst_tail = self.struct_tail(dst.ty, location);

// This checks (lifetime part of) vtable validity for pointer casts,
// which is irrelevant when there are aren't principal traits on
// both sides (aka only auto traits).
//
// Note that other checks (such as denying `dyn Send` -> `dyn
// Debug`) are in `rustc_hir_typeck`.
if let ty::Dynamic(src_tty, _src_lt, ty::Dyn) = *src_tail.kind()
&& let ty::Dynamic(dst_tty, dst_lt, ty::Dyn) = *dst_tail.kind()
&& src_tty.principal().is_some()
&& dst_tty.principal().is_some()
{
// Remove auto traits.
// Auto trait checks are handled in `rustc_hir_typeck` as FCW.
let src_obj = Ty::new_dynamic(
tcx,
tcx.mk_poly_existential_predicates(
&src_tty.without_auto_traits().collect::<Vec<_>>(),
),
// FIXME: Once we disallow casting `*const dyn Trait + 'short`
// to `*const dyn Trait + 'long`, then this can just be `src_lt`.
dst_lt,
ty::Dyn,
);
let dst_obj = Ty::new_dynamic(
tcx,
tcx.mk_poly_existential_predicates(
&dst_tty.without_auto_traits().collect::<Vec<_>>(),
),
dst_lt,
ty::Dyn,
);

debug!(?src_tty, ?dst_tty, ?src_obj, ?dst_obj);

self.sub_types(
src_obj,
dst_obj,
location.to_locations(),
ConstraintCategory::Cast {
is_implicit_coercion: false,
unsize_to: None,
},
)
.unwrap();
}
}
_ => {
span_mirbug!(
self,
rvalue,
"Invalid PtrToPtr cast {:?} -> {:?}",
ty_from,
ty
)
}
let Some(CastTy::Ptr(src)) = CastTy::from_ty(ty_from) else {
unreachable!();
};
let Some(CastTy::Ptr(dst)) = CastTy::from_ty(*ty) else {
unreachable!();
};

if self.infcx.type_is_sized_modulo_regions(self.infcx.param_env, dst.ty) {
// Wide to thin ptr cast. This may even occur in an env with
// impossible predicates, such as `where dyn Trait: Sized`.
// In this case, we don't want to fall into the case below,
// since the types may not actually be equatable, but it's
// fine to perform this operation in an impossible env.
let trait_ref = ty::TraitRef::new(
tcx,
tcx.require_lang_item(LangItem::Sized, self.last_span),
[dst.ty],
);
self.prove_trait_ref(
trait_ref,
location.to_locations(),
ConstraintCategory::Cast {
is_implicit_coercion: true,
unsize_to: None,
},
);
} else if let ty::Dynamic(src_tty, _src_lt, ty::Dyn) =
*self.struct_tail(src.ty, location).kind()
&& let ty::Dynamic(dst_tty, dst_lt, ty::Dyn) =
*self.struct_tail(dst.ty, location).kind()
&& src_tty.principal().is_some()
&& dst_tty.principal().is_some()
{
// This checks (lifetime part of) vtable validity for pointer casts,
// which is irrelevant when there are aren't principal traits on
// both sides (aka only auto traits).
//
// Note that other checks (such as denying `dyn Send` -> `dyn
// Debug`) are in `rustc_hir_typeck`.

// Remove auto traits.
// Auto trait checks are handled in `rustc_hir_typeck` as FCW.
let src_obj = Ty::new_dynamic(
tcx,
tcx.mk_poly_existential_predicates(
&src_tty.without_auto_traits().collect::<Vec<_>>(),
),
// FIXME: Once we disallow casting `*const dyn Trait + 'short`
// to `*const dyn Trait + 'long`, then this can just be `src_lt`.
dst_lt,
ty::Dyn,
);
let dst_obj = Ty::new_dynamic(
tcx,
tcx.mk_poly_existential_predicates(
&dst_tty.without_auto_traits().collect::<Vec<_>>(),
),
dst_lt,
ty::Dyn,
);

debug!(?src_tty, ?dst_tty, ?src_obj, ?dst_obj);

self.sub_types(
src_obj,
dst_obj,
location.to_locations(),
ConstraintCategory::Cast {
is_implicit_coercion: false,
unsize_to: None,
},
)
.unwrap();
}
}
CastKind::Transmute => {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_llvm/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use smallvec::SmallVec;

use crate::builder::SBuilder;
use crate::declare::declare_simple_fn;
use crate::llvm::{self, False, True, Type, Value};
use crate::llvm::{self, FALSE, TRUE, Type, Value};
use crate::{SimpleCx, attributes, debuginfo, llvm_util};

pub(crate) unsafe fn codegen(
Expand Down Expand Up @@ -80,7 +80,7 @@ pub(crate) unsafe fn codegen(
&cx,
&mangle_internal_symbol(tcx, OomStrategy::SYMBOL),
&i8,
&llvm::LLVMConstInt(i8, tcx.sess.opts.unstable_opts.oom.should_panic() as u64, False),
&llvm::LLVMConstInt(i8, tcx.sess.opts.unstable_opts.oom.should_panic() as u64, FALSE),
);

// __rust_no_alloc_shim_is_unstable_v2
Expand Down Expand Up @@ -201,7 +201,7 @@ fn create_wrapper_function(
.map(|(i, _)| llvm::get_param(llfn, i as c_uint))
.collect::<Vec<_>>();
let ret = bx.call(ty, callee, &args, None);
llvm::LLVMSetTailCall(ret, True);
llvm::LLVMSetTailCall(ret, TRUE);
if output.is_some() {
bx.ret(ret);
} else {
Expand Down
11 changes: 4 additions & 7 deletions compiler/rustc_codegen_llvm/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use tracing::debug;
use crate::builder::Builder;
use crate::common::Funclet;
use crate::context::CodegenCx;
use crate::llvm::ToLlvmBool;
use crate::type_::Type;
use crate::type_of::LayoutLlvmExt;
use crate::value::Value;
Expand Down Expand Up @@ -470,10 +471,6 @@ pub(crate) fn inline_asm_call<'ll>(
dest: Option<&'ll llvm::BasicBlock>,
catch_funclet: Option<(&'ll llvm::BasicBlock, Option<&Funclet<'ll>>)>,
) -> Option<&'ll Value> {
let volatile = if volatile { llvm::True } else { llvm::False };
let alignstack = if alignstack { llvm::True } else { llvm::False };
let can_throw = if unwind { llvm::True } else { llvm::False };

let argtys = inputs
.iter()
.map(|v| {
Expand All @@ -500,10 +497,10 @@ pub(crate) fn inline_asm_call<'ll>(
asm.len(),
cons.as_ptr(),
cons.len(),
volatile,
alignstack,
volatile.to_llvm_bool(),
alignstack.to_llvm_bool(),
dia,
can_throw,
unwind.to_llvm_bool(),
)
};

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ fn embed_bitcode(

llvm::set_section(llglobal, bitcode_section_name(cgcx));
llvm::set_linkage(llglobal, llvm::Linkage::PrivateLinkage);
llvm::LLVMSetGlobalConstant(llglobal, llvm::True);
llvm::LLVMSetGlobalConstant(llglobal, llvm::TRUE);

let llconst = common::bytes_in_context(llcx, &[]);
let llglobal = llvm::add_global(llmod, common::val_ty(llconst), c"rustc.embedded.cmdline");
Expand Down
Loading
Loading