Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 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
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
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
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
61867e9
Rollup merge of #160911 - adamgemmell:dev/adagem01/remove-d32, r=Amanieu
jhpratt Sep 15, 2026
598c443
Rollup merge of #162771 - kulinsky:fix-do-not-recomend, r=estebank
jhpratt Sep 15, 2026
7a13ddb
Rollup merge of #162779 - lolbinarycat:rustdoc-revert-regex, r=Guilla…
jhpratt Sep 15, 2026
dc0de82
Rollup merge of #161548 - malezjaa:fix-drop-location-span-ice, r=Enselic
jhpratt Sep 15, 2026
aa6a1b2
Rollup merge of #161612 - pacak:unreachable-pub, r=clarfonthey
jhpratt Sep 15, 2026
4cd1fe0
Rollup merge of #162204 - KevinA-cpu:extern-const-unsafe-does-not-tri…
jhpratt Sep 15, 2026
1c1a3da
Rollup merge of #162372 - GuillaumeGomez:cleanup-rustdoc-test, r=Urgau
jhpratt Sep 15, 2026
f1703e0
Rollup merge of #162638 - Albab-Hasan:no-mut-borrow-suggestion-in-mac…
jhpratt Sep 15, 2026
fb64d5d
Rollup merge of #162643 - ChrisDenton:trailing-sep-verbatim, r=Mark-S…
jhpratt Sep 15, 2026
f32e0ce
Rollup merge of #162784 - Qumulo:agents-md-edit, r=jyn514
jhpratt 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
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::spec::{
pub(crate) fn target() -> Target {
let base = base::solid::opts();
Target {
llvm_target: "armv7a-none-eabihf".into(),
llvm_target: "arm-none-eabihf".into(),
metadata: TargetMetadata {
description: Some("Arm SOLID with TOPPERS/ASP3, hardfloat".into()),
tier: Some(3),
Expand All @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
cfg_abi: CfgAbi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
linker: Some("arm-kmc-eabi-gcc".into()),
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
features: "+v7,+db,+dsp,+aclass,+perfmon,+vfp3d16,+thumb2".into(),
relocation_model: RelocModel::Static,
disable_redzone: true,
max_atomic_width: Some(64),
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs
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: "armv7a-none-eabihf".into(),
llvm_target: "arm-none-eabihf".into(),
metadata: TargetMetadata {
description: Some("Bare Armv7-A, hardfloat".into()),
tier: Some(2),
Expand All @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
cfg_abi: CfgAbi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
features: "+vfp3d16,-neon,+strict-align".into(),
features: "+v7,+db,+dsp,+aclass,+perfmon,+vfp3d16,+strict-align".into(),
max_atomic_width: Some(64),
has_thumb_interworking: true,
..base::arm_none::opts()
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: "thumbv7a-none-eabihf".into(),
llvm_target: "thumb-none-eabihf".into(),
metadata: TargetMetadata {
description: Some("Thumb-mode Bare Armv7-A, hardfloat".into()),
tier: Some(2),
Expand All @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
cfg_abi: CfgAbi::EabiHf,
llvm_floatabi: Some(FloatAbi::Hard),
features: "+vfp3d16,-neon,+strict-align".into(),
features: "+v7,+db,+dsp,+aclass,+perfmon,+vfp3d16,+strict-align".into(),
max_atomic_width: Some(64),
has_thumb_interworking: true,
..base::arm_none::opts()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
impl_candidates
};

if let [single] = &impl_candidates {
if let [single] = &impl_candidates
&& !self.tcx.do_not_recommend_impl(single.impl_def_id)
{
let self_ty = trait_pred.skip_binder().self_ty();
if !self_ty.has_escaping_bound_vars() {
let self_ty = self.tcx.instantiate_bound_regions_with_erased(trait_pred.self_ty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2530,7 +2530,14 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
.sess
.source_map()
.span_take_while(span, |c| c.is_whitespace() || *c == '&');
if points_at_arg && mutability.is_not() && refs_number > 0 {
if points_at_arg
&& mutability.is_not()
&& refs_number > 0
// The borrow can sit in a macro body, where rewriting it would edit the
// macro definition and so every one of its call sites, or a crate the user
// does not own. Fall through to the note in that case.
&& span.can_be_used_for_suggestions()
{
// If we have a call like foo(&mut buf), then don't suggest foo(&mut mut buf)
if snippet
.trim_start_matches(|c: char| c.is_whitespace() || c == '&')
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/collections/hash/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Unordered containers, implemented as hash-tables
pub mod map;
pub mod set;
pub(crate) mod map;
pub(crate) mod set;
Loading
Loading