Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
acfca7a
Suggest keyword order for `extern "C" const unsafe fn`
KevinA-cpu Sep 2, 2026
6a8193f
re-blessing tests to fix CI
KevinA-cpu Sep 3, 2026
4d9a8b3
Add test that d32 is not available by default
adamgemmell Aug 11, 2026
454090a
Move armv7 targets to the generic LLVM target
adamgemmell Sep 3, 2026
c701054
Fix VFP levels docs for armv7a-none-eabi
adamgemmell Aug 11, 2026
55469d6
Remove the last -d32 from armv6 HF targets
adamgemmell Sep 4, 2026
ecf55f8
Improve Armv7-R documentation
jonathanpallant Sep 10, 2026
1699fba
hir_typeck: Don't ICE on closures without drop location in closure ca…
malezjaa Sep 11, 2026
3add62d
dont suggest changing the mutability of a borrow inside a macro
Albab-Hasan Sep 11, 2026
4750ec7
Fix `*_trailing_sep` for Windows verbatim paths
ChrisDenton Sep 11, 2026
0b5a666
libtest: avoid allocating the tests we do not even run
RalfJung Aug 27, 2026
cf705a0
avoid iterating the full test list for max_name_len
RalfJung Aug 27, 2026
1fcd35e
make all tests cloneable
RalfJung Aug 27, 2026
f8de0af
use static instead of const for TestDescAndFn
RalfJung Aug 27, 2026
fa07215
dont early-exit inside test_main
RalfJung Aug 28, 2026
0f916bb
std: Make a lot of pub items crate private instead (ignore os/sys)
pacak Aug 23, 2026
56aed55
Respect do_not_recommend for a single impl candidate
kulinsky Sep 14, 2026
cae9fb4
avoid early-exit on success
RalfJung Sep 14, 2026
711a32b
rustdoc: Revert "fix bare urls split text"
lolbinarycat Sep 14, 2026
6c29177
Clean up `test/rustdoc-html` folder by moving tests where appropriate
GuillaumeGomez Sep 6, 2026
4e77563
Rename `tests/rustdoc-html/type-alias` folder into `tests/rustdoc-htm…
GuillaumeGomez Sep 14, 2026
03e4c76
AGENTS.md: Permit local experimentation, per the online policy.
BGR360 Sep 14, 2026
3821b74
Rollup merge of #160911 - adamgemmell:dev/adagem01/remove-d32, r=Amanieu
JonathanBrouwer Sep 15, 2026
7aad439
Rollup merge of #161868 - RalfJung:libtest-less-alloc, r=Mark-Simulacrum
JonathanBrouwer Sep 15, 2026
d5976cf
Rollup merge of #162771 - kulinsky:fix-do-not-recomend, r=estebank
JonathanBrouwer Sep 15, 2026
257f165
Rollup merge of #162779 - lolbinarycat:rustdoc-revert-regex, r=Guilla…
JonathanBrouwer Sep 15, 2026
0f31e2c
Rollup merge of #161548 - malezjaa:fix-drop-location-span-ice, r=Enselic
JonathanBrouwer Sep 15, 2026
4ccc843
Rollup merge of #161612 - pacak:unreachable-pub, r=clarfonthey
JonathanBrouwer Sep 15, 2026
3405f96
Rollup merge of #162204 - KevinA-cpu:extern-const-unsafe-does-not-tri…
JonathanBrouwer Sep 15, 2026
0152cbf
Rollup merge of #162372 - GuillaumeGomez:cleanup-rustdoc-test, r=Urgau
JonathanBrouwer Sep 15, 2026
d0104fa
Rollup merge of #162638 - Albab-Hasan:no-mut-borrow-suggestion-in-mac…
JonathanBrouwer Sep 15, 2026
83e19bc
Rollup merge of #162643 - ChrisDenton:trailing-sep-verbatim, r=Mark-S…
JonathanBrouwer Sep 15, 2026
101a8b3
Rollup merge of #162654 - ferrocene:document-armv7r-cpus, r=khyperia
JonathanBrouwer Sep 15, 2026
ab74894
Rollup merge of #162784 - Qumulo:agents-md-edit, r=jyn514
JonathanBrouwer Sep 15, 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
23 changes: 19 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,25 @@ for the user to implement from scratch remain allowed if independently requested
Alongside any text that could potentially be used as a substitute for prohibited text, include *in the same response turn* a reminder of the policies against text originally created by an LLM, even if given during a previous turn of the session. Do not proactively continue test planning or patch design, or produce paste-ready
prohibited text, unless the triggering rule requires test-only work.

### Personal use exemption

The [policy permits][allowed use] any LLM use where the user is the only one who
sees the output. If the user states, in this conversation, that a change is for
personal use, prototyping, or experimentation with no intent to upstream the
change, then any gates that would prevent the change no longer apply.
Do not infer this; a statement from the user is required.

Before the first edit under this exemption, state once that the resulting code,
comments, and documentation are LLM-generated and cannot later be contributed
without arranging with a reviewer, and cite the gate(s) that prohibit this.

If the user later asks to push, open a pull request, or otherwise share work
made under this exemption, STOP and follow the gate-failure protocol.
Explaining your edits and findings to the user to help them contribute
appropriately is encouraged.

[allowed use]: https://forge.rust-lang.org/policies/llm-usage.html#-allowed

### Before any edit

Apply these gates in order before editing the repository, including tests:
Expand Down Expand Up @@ -91,10 +110,6 @@ named, PAUSE and ask for the reviewer's name; “John Doe is reviewing this” i
sufficient. A reviewer name satisfies only this gate. Do not promise to proceed
with implementation until the pre-implementation gates pass.

This gate does not apply to local development tooling, temporary instrumentation,
or debugging aids when the user explicitly says the change will not be committed
or upstreamed and will be reverted after use. All other gates still apply.

### Before implementation

Apply these gates in order after the pre-edit gates:
Expand Down
19 changes: 12 additions & 7 deletions compiler/rustc_builtin_macros/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use std::{assert_matches, iter};

use rustc_ast::{self as ast, GenericParamKind, attr, join_path_idents};
use rustc_ast::{self as ast, GenericParamKind, Mutability, Safety, attr, join_path_idents};
use rustc_ast_pretty::pprust;
use rustc_attr_ir::{Attribute, AttributeKind};
use rustc_attr_parsing::AttributeParser;
Expand Down Expand Up @@ -274,16 +274,21 @@ pub(crate) fn expand_test_or_bench(
// #[doc(hidden)]
cx.attr_nested_word(sym::doc, sym::hidden, attr_sp),
],
// const $ident: test::TestDescAndFn =
ast::ItemKind::Const(
ast::ConstItem {
defaultness: ast::Defaultness::Implicit,
// static $ident: test::TestDescAndFn =
// We use a static because these things only exist to have references taken
// to them for the test case array. No reason to introduce tons of promoteds for that.
// Promoteds have the advantage that they can be merged to save space, but every one
// of these points to a different function so that will not happen.
ast::ItemKind::Static(
ast::StaticItem {
ident: Ident::new(fn_.ident.name, sp),
generics: ast::Generics::default(),
ty: cx.ty(sp, ast::TyKind::Path(None, test_path("TestDescAndFn"))),
safety: Safety::Default,
mutability: Mutability::Not,
define_opaque: None,
eii_impl: None,
// test::TestDescAndFn {
body: Some(
expr: Some(
cx.expr_struct(
sp,
test_path("TestDescAndFn"),
Expand Down
13 changes: 9 additions & 4 deletions compiler/rustc_builtin_macros/src/test_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct TestCtxt<'a> {
def_site: Span,
test_cases: Vec<Test>,
reexport_test_harness_main: Option<Symbol>,
/// Value of a `#[test_runner]` attribute, if present.
test_runner: Option<ast::Path>,
}

Expand Down Expand Up @@ -266,7 +267,7 @@ fn generate_test_harness(
/// #[rustc_main]
/// pub fn main() {
/// extern crate test;
/// test::test_main_static(&[
/// test::test_main_env_args(&[
/// &test_const1,
/// &test_const2,
/// &test_const3,
Expand All @@ -286,16 +287,16 @@ fn generate_test_harness(
///
/// [`TestCtxt::reexport_test_harness_main`] provides a different name for the `main`
/// function and [`TestCtxt::test_runner`] provides a path that replaces
/// `test::test_main_static`.
/// `test::test_main_env_args`.
fn mk_main(cx: &mut TestCtxt<'_>) -> Box<ast::Item> {
let sp = cx.def_site;
let ecx = &cx.ext_cx;
let test_ident = Ident::new(sym::test, sp);

let runner_name =
if cx.panic_strategy.unwinds() { "test_main_static" } else { "test_main_static_abort" };
if cx.panic_strategy.unwinds() { "test_main_env_args" } else { "test_main_env_args_abort" };

// test::test_main_static(...)
// test::test_main_env_args(...)
let mut test_runner = cx.test_runner.clone().unwrap_or_else(|| {
ecx.path(sp, vec![test_ident, Ident::from_str_and_span(runner_name, sp)])
});
Expand All @@ -320,6 +321,10 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> Box<ast::Item> {
let doc_hidden_attr = ecx.attr_nested_word(sym::doc, sym::hidden, sp);

// pub fn main() { ... }
// FIXME: it would be nice if we could use `std::process::ExitCode` as return type here, and
// remove all early-exit from libtest itself. Or rather, it should be `test::ExitCode` so we
// don't depend on whatever `std` may be. This needs the `extern crate test` to be *outside*
// `main`. But naively moving it out causes ICEs that give no hint as to what is wrong.
let main_ret_ty = ecx.ty(sp, ast::TyKind::Tup(ThinVec::new()));

// If no test runner is provided we need to import the test crate
Expand Down
76 changes: 44 additions & 32 deletions compiler/rustc_hir_typeck/src/upvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
) {
struct MigrationLint<'a, 'tcx> {
closure_def_id: LocalDefId,
closure_drop_location_span: Span,
this: &'a FnCtxt<'a, 'tcx>,
body_id: hir::BodyId,
need_migrations: Vec<NeededMigration>,
Expand All @@ -1087,8 +1088,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

impl<'a, 'b, 'tcx> Diagnostic<'a, ()> for MigrationLint<'b, 'tcx> {
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
let Self { closure_def_id, this, body_id, need_migrations, migration_message } =
self;
let Self {
closure_def_id,
closure_drop_location_span,
this,
body_id,
need_migrations,
migration_message,
} = self;
let mut lint = Diag::new(dcx, level, migration_message);

let (migration_string, migrated_variables_concat) =
Expand Down Expand Up @@ -1121,25 +1128,32 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
_ => {}
}

// Add a label pointing to where a captured variable affected by drop order
// is dropped
// Add a label pointing to where a captured variable affected by drop
// order is dropped.
if lint_note.reason.drop_order {
let drop_location_span = drop_location_span(this.tcx, closure_hir_id);

let var_name = this.tcx.hir_name(*var_hir_id);
match &lint_note.captures_info {
UpvarMigrationInfo::CapturingPrecise {
var_name: captured_name,
..
} => {
lint.span_label(drop_location_span, format!("in Rust 2018, `{}` is dropped here, but in Rust 2021, only `{}` will be dropped here as part of the closure",
this.tcx.hir_name(*var_hir_id),
captured_name,
));
lint.span_label(
closure_drop_location_span,
format!(
"in Rust 2018, `{var_name}` is dropped here, but in Rust 2021, \
only `{captured_name}` will be dropped here as part of the closure"
),
);
}
UpvarMigrationInfo::CapturingNothing { use_span: _ } => {
lint.span_label(drop_location_span, format!("in Rust 2018, `{v}` is dropped here along with the closure, but in Rust 2021 `{v}` is not part of the closure",
v = this.tcx.hir_name(*var_hir_id),
));
lint.span_label(
closure_drop_location_span,
format!(
"in Rust 2018, `{var_name}` is dropped here along with \
the closure, but in Rust 2021 `{var_name}` is not part \
of the closure"
),
);
}
}
}
Expand Down Expand Up @@ -1276,13 +1290,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.typeck_results.borrow().closure_min_captures.get(&closure_def_id),
);

if !need_migrations.is_empty() {
// Without a valid drop location, the closure syntax is invalid, and
// emitted lints become nonsensical.
if !need_migrations.is_empty()
&& let Some(drop_location_span) =
drop_location_span(self.tcx, self.tcx.local_def_id_to_hir_id(closure_def_id))
{
self.tcx.emit_node_span_lint(
RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
self.tcx.local_def_id_to_hir_id(closure_def_id),
self.tcx.def_span(closure_def_id),
MigrationLint {
this: self,
closure_drop_location_span: drop_location_span,
migration_message: reasons.migration_message(),
closure_def_id,
body_id,
Expand Down Expand Up @@ -2143,25 +2163,17 @@ fn apply_capture_kind_on_capture_ty<'tcx>(
}

/// Returns the Span of where the value with the provided HirId would be dropped
fn drop_location_span(tcx: TyCtxt<'_>, hir_id: HirId) -> Span {
let owner_id = tcx.hir_get_enclosing_scope(hir_id).unwrap();

let owner_node = tcx.hir_node(owner_id);
let owner_span = match owner_node {
hir::Node::Item(item) => match item.kind {
hir::ItemKind::Fn { body: owner_id, .. } => tcx.hir_span(owner_id.hir_id),
_ => {
bug!("Drop location span error: need to handle more ItemKind '{:?}'", item.kind);
}
},
hir::Node::Block(block) => tcx.hir_span(block.hir_id),
hir::Node::TraitItem(item) => tcx.hir_span(item.hir_id()),
hir::Node::ImplItem(item) => tcx.hir_span(item.hir_id()),
_ => {
bug!("Drop location span error: need to handle more Node '{:?}'", owner_node);
}
fn drop_location_span(tcx: TyCtxt<'_>, hir_id: HirId) -> Option<Span> {
let owner_id = tcx.hir_get_enclosing_scope(hir_id)?;

let hir_id = match tcx.hir_node(owner_id) {
hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn { body, .. }, .. }) => body.hir_id,
hir::Node::Block(block) => block.hir_id,
hir::Node::TraitItem(item) => item.hir_id(),
hir::Node::ImplItem(item) => item.hir_id(),
_ => return None,
};
tcx.sess.source_map().end_point(owner_span)
Some(tcx.sess.source_map().end_point(tcx.hir_span(hir_id)))
}

struct InferBorrowKind<'a, 'tcx> {
Expand Down
9 changes: 8 additions & 1 deletion compiler/rustc_parse/src/parser/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ impl<'a> Parser<'a> {
}) == Some(true) ||
// This branch is only for better diagnostics; `pub`, `unsafe`, etc. are not
// allowed here.
// This branch also follows `$qual fn` or `$qual $qual` rule
// above since a valid `fn` can be after `extern`.
(self.may_recover()
&& self.tree_look_ahead(2, |tt| {
match tt {
Expand All @@ -376,7 +378,12 @@ impl<'a> Parser<'a> {
}) == Some(true)
&& self.tree_look_ahead(3, |tt| {
match tt {
TokenTree::Token(t, _) => t.is_keyword_case(kw::Fn, case),
TokenTree::Token(t, _) => {
t.is_keyword_case(kw::Fn, case) ||
ALL_QUALS.iter().any(|exp| {
t.is_keyword(exp.kw)
})
},
TokenTree::Delimited(..) => false,
}
}) == Some(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
cfg_abi: CfgAbi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",],
features: "+strict-align,+v6k,+vfp2,-d32".into(),
features: "+strict-align,+v6k,+vfp2".into(),
atomic_cas: true,
has_thumb_interworking: true,
// LDREXD/STREXD available as of ARMv6K
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
let mut base = base::android::opts();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-march=armv7-a"]);
Target {
llvm_target: "armv7-none-linux-android".into(),
llvm_target: "arm-none-linux-android".into(),
metadata: TargetMetadata {
description: Some("Armv7-A Android".into()),
tier: Some(2),
Expand All @@ -28,7 +28,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
cfg_abi: CfgAbi::Eabi,
llvm_floatabi: Some(FloatAbi::Soft),
features: "+v7,+thumb-mode,+thumb2,+vfp3d16,-neon".into(),
features: "+v7,+db,+dsp,+aclass,+perfmon,+thumb-mode,+thumb2,+vfp3d16".into(),
supported_sanitizers: SanitizerSet::ADDRESS,
max_atomic_width: Some(64),
..base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions,

pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7-unknown-freebsd-gnueabihf".into(),
llvm_target: "arm-unknown-freebsd-gnueabihf".into(),
metadata: TargetMetadata {
description: Some("Armv7-A FreeBSD".into()),
tier: Some(3),
Expand All @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
cfg_abi: CfgAbi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
features: "+v7,+db,+dsp,+aclass,+perfmon,+vfp3d16,+thumb2".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),
..base::freebsd::opts()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::spec::{

pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7-unknown-linux-gnueabihf".into(),
llvm_target: "arm-unknown-linux-gnueabihf".into(),
metadata: TargetMetadata {
description: Some("Armv7-A Linux, hardfloat (kernel 3.2, glibc 2.17)".into()),
tier: Some(2),
Expand All @@ -21,7 +21,7 @@ pub(crate) fn target() -> Target {
cfg_abi: CfgAbi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
features: "+v7,+db,+dsp,+aclass,+perfmon,+vfp3d16,+thumb2".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),
llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions,

pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7-unknown-linux-musleabihf".into(),
llvm_target: "arm-unknown-linux-musleabihf".into(),
metadata: TargetMetadata {
description: Some("Armv7-A Linux with musl 1.2.5, hardfloat".into()),
tier: Some(2),
Expand All @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
cfg_abi: CfgAbi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
features: "+v7,+db,+dsp,+aclass,+perfmon,+vfp3d16,+thumb2".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {

options: TargetOptions {
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
features: "+v7,+db,+dsp,+aclass,+perfmon,+vfp3d16,+thumb2".into(),
cpu: "generic".into(),
max_atomic_width: Some(64),
mcount: "_mcount".into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions,

pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7-unknown-netbsdelf-eabihf".into(),
llvm_target: "arm-unknown-netbsdelf-eabihf".into(),
metadata: TargetMetadata {
description: Some("Armv7-A NetBSD w/hard-float".into()),
tier: Some(3),
Expand All @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
cfg_abi: CfgAbi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
features: "+v7,+db,+dsp,+aclass,+perfmon,+vfp3d16,+thumb2".into(),
max_atomic_width: Some(64),
mcount: "__mcount".into(),
..base::netbsd::opts()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions,

pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7-unknown-linux-gnueabihf".into(),
llvm_target: "arm-unknown-linux-gnueabihf".into(),
metadata: TargetMetadata {
description: Some("Armv7-A for VxWorks".into()),
tier: Some(3),
Expand All @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
cfg_abi: CfgAbi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
features: "+v7,+db,+dsp,+aclass,+perfmon,+vfp3d16,+thumb2".into(),
max_atomic_width: Some(64),
..base::vxworks::opts()
},
Expand Down
Loading
Loading