Skip to content

Rollup of 9 pull requests #143601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
bb74f47
Do not suggest borrow that is already there in fully-qualified call
estebank Nov 1, 2024
a0111ec
awhile -> a while where appropriate
nabijaczleweli Jul 1, 2025
7603adc
Rework logic and provide structured suggestion
estebank Jul 3, 2025
f7046bd
Regression tests for repr ICEs
JonathanBrouwer Jul 6, 2025
8b33e93
Fix `x86_64-unknown-netbsd` platform support page
jieyouxu Jul 7, 2025
6d58a88
`loop_match`: fix 'no terminator on block'
folkertdev Jul 7, 2025
be6cd11
make `Machine::load_mir` infallible
fee1-dead Jul 7, 2025
3b48407
Remove unused allow attrs
yotamofek Jun 28, 2025
be9669f
fix the link in `rustdoc.md`
makai410 Jul 4, 2025
2cb2478
Fix missing words in future tracking issue
ehuss Jul 7, 2025
00a4418
Rollup merge of #132469 - estebank:issue-132041, r=Nadrieril
matthiaskrgr Jul 7, 2025
2554c42
Rollup merge of #143340 - nabijaczleweli:awhile, r=mati865
matthiaskrgr Jul 7, 2025
1b922d3
Rollup merge of #143438 - makai410:rustdoc-fix, r=ehuss
matthiaskrgr Jul 7, 2025
6c8482e
Rollup merge of #143539 - JonathanBrouwer:ice-regression-tests, r=oli…
matthiaskrgr Jul 7, 2025
b6777b1
Rollup merge of #143566 - jieyouxu:fix-x86_64-unknown-netbsd, r=fee1-…
matthiaskrgr Jul 7, 2025
7ed6bd9
Rollup merge of #143572 - yotamofek:pr/unused-allow-attrs, r=fee1-dead
matthiaskrgr Jul 7, 2025
f5df1f5
Rollup merge of #143583 - folkertdev:loop-match-no-terminator-on-bloc…
matthiaskrgr Jul 7, 2025
42b105e
Rollup merge of #143584 - fee1-dead-contrib:push-skswvrwsrmll, r=Ralf…
matthiaskrgr Jul 7, 2025
ff6b881
Rollup merge of #143591 - ehuss:future-typos, r=jieyouxu
matthiaskrgr Jul 7, 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 .github/ISSUE_TEMPLATE/tracking_issue_future.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ it would be `T-libs-api`.
Also check for any `A-` labels to add.
-->

This is the **tracking issue** for the `YOUR_LINT_NAME_HERE` future-compatibility warning and other related errors. The goal of this page is describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made. For more information on the policy around future-compatibility warnings, see our [breaking change policy guidelines][guidelines].
This is the **tracking issue** for the `YOUR_LINT_NAME_HERE` future-compatibility warning and other related errors. The goal of this page is to describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made. For more information on the policy around future-compatibility warnings, see our [breaking change policy guidelines][guidelines].

[guidelines]: https://rustc-dev-guide.rust-lang.org/bug-fix-procedure.html

Expand Down Expand Up @@ -44,7 +44,7 @@ This is the **tracking issue** for the `YOUR_LINT_NAME_HERE` future-compatibilit

- [ ] Implement the lint
- [ ] Raise lint level to deny
- [ ] Make lint report in dependencies
- [ ] Change the lint to report in dependencies
- [ ] Switch to a hard error

### Implementation history
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#![doc(rust_logo)]
#![feature(rustdoc_internals)]
#![feature(rustc_private)]
#![allow(broken_intra_doc_links)]
#![recursion_limit = "256"]
#![warn(rust_2018_idioms)]
#![warn(unused_lifetimes)]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(non_camel_case_types)]
#![expect(dead_code)]

use libc::{c_char, c_uint};
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_const_eval/src/const_eval/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,10 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
fn load_mir(
ecx: &InterpCx<'tcx, Self>,
instance: ty::InstanceKind<'tcx>,
) -> InterpResult<'tcx, &'tcx mir::Body<'tcx>> {
) -> &'tcx mir::Body<'tcx> {
match instance {
ty::InstanceKind::Item(def) => interp_ok(ecx.tcx.mir_for_ctfe(def)),
_ => interp_ok(ecx.tcx.instance_mir(instance)),
ty::InstanceKind::Item(def) => ecx.tcx.mir_for_ctfe(def),
_ => ecx.tcx.instance_mir(instance),
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/interpret/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
let def = instance.def_id();
&self.tcx.promoted_mir(def)[promoted]
} else {
M::load_mir(self, instance)?
M::load_mir(self, instance)
};
// do not continue if typeck errors occurred (can only occur in local crate)
if let Some(err) = body.tainted_by_errors {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_const_eval/src/interpret/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ pub trait Machine<'tcx>: Sized {
fn load_mir(
ecx: &InterpCx<'tcx, Self>,
instance: ty::InstanceKind<'tcx>,
) -> InterpResult<'tcx, &'tcx mir::Body<'tcx>> {
interp_ok(ecx.tcx.instance_mir(instance))
) -> &'tcx mir::Body<'tcx> {
ecx.tcx.instance_mir(instance)
}

/// Entry point to all function calls.
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//! This module contains the code for creating and emitting diagnostics.

// tidy-alphabetical-start
#![allow(incomplete_features)]
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::direct_use_of_rustc_type_ir)]
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_infer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

// tidy-alphabetical-start
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::direct_use_of_rustc_type_ir)]
#![allow(rustc::untranslatable_diagnostic)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(assert_matches)]
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_lint/src/early/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]

use std::borrow::Cow;

use rustc_ast::util::unicode::TEXT_FLOW_CONTROL_CHARS;
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_lint/src/lints.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use std::num::NonZero;

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ extern "C" void LLVMRustSetModuleCodeModel(LLVMModuleRef M,
//
// Otherwise I'll apologize in advance, it probably requires a relatively
// significant investment on your part to "truly understand" what's going on
// here. Not saying I do myself, but it took me awhile staring at LLVM's source
// here. Not saying I do myself, but it took me a while staring at LLVM's source
// and various online resources about ThinLTO to make heads or tails of all
// this.

Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/arena.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(rustc::usage_of_ty_tykind)]

/// This higher-order macro declares a list of types which can be allocated by `Arena`.
///
/// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]` where `T` is the type
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_mir_build/src/builder/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {

valtree
}
Err(ErrorHandled::Reported(..)) => return self.cfg.start_new_block().unit(),
Err(ErrorHandled::Reported(..)) => {
return block.unit();
}
Err(ErrorHandled::TooGeneric(_)) => {
self.tcx.dcx().emit_fatal(ConstContinueBadConst { span: constant.span });
}
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_parse/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! The main parser interface.

// tidy-alphabetical-start
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_query_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

// tidy-alphabetical-start
#![allow(internal_features)]
#![allow(unused_parens)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(min_specialization)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
has_custom_message: bool,
) -> bool {
let span = obligation.cause.span;
let param_env = obligation.param_env;

let mk_result = |trait_pred_and_new_ty| {
let obligation =
self.mk_trait_obligation_with_new_self_ty(param_env, trait_pred_and_new_ty);
self.predicate_must_hold_modulo_regions(&obligation)
};

let code = match obligation.cause.code() {
ObligationCauseCode::FunctionArg { parent_code, .. } => parent_code,
Expand All @@ -1195,6 +1202,76 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
c @ ObligationCauseCode::WhereClauseInExpr(_, _, hir_id, _)
if self.tcx.hir_span(*hir_id).lo() == span.lo() =>
{
// `hir_id` corresponds to the HIR node that introduced a `where`-clause obligation.
// If that obligation comes from a type in an associated method call, we need
// special handling here.
if let hir::Node::Expr(expr) = self.tcx.parent_hir_node(*hir_id)
&& let hir::ExprKind::Call(base, _) = expr.kind
&& let hir::ExprKind::Path(hir::QPath::TypeRelative(ty, segment)) = base.kind
&& let hir::Node::Expr(outer) = self.tcx.parent_hir_node(expr.hir_id)
&& let hir::ExprKind::AddrOf(hir::BorrowKind::Ref, mtbl, _) = outer.kind
&& ty.span == span
{
// We've encountered something like `&str::from("")`, where the intended code
// was likely `<&str>::from("")`. The former is interpreted as "call method
// `from` on `str` and borrow the result", while the latter means "call method
// `from` on `&str`".

let trait_pred_and_imm_ref = poly_trait_pred.map_bound(|p| {
(p, Ty::new_imm_ref(self.tcx, self.tcx.lifetimes.re_static, p.self_ty()))
});
let trait_pred_and_mut_ref = poly_trait_pred.map_bound(|p| {
(p, Ty::new_mut_ref(self.tcx, self.tcx.lifetimes.re_static, p.self_ty()))
});

let imm_ref_self_ty_satisfies_pred = mk_result(trait_pred_and_imm_ref);
let mut_ref_self_ty_satisfies_pred = mk_result(trait_pred_and_mut_ref);
let sugg_msg = |pre: &str| {
format!(
"you likely meant to call the associated function `{FN}` for type \
`&{pre}{TY}`, but the code as written calls associated function `{FN}` on \
type `{TY}`",
FN = segment.ident,
TY = poly_trait_pred.self_ty(),
)
};
match (imm_ref_self_ty_satisfies_pred, mut_ref_self_ty_satisfies_pred, mtbl) {
(true, _, hir::Mutability::Not) | (_, true, hir::Mutability::Mut) => {
err.multipart_suggestion_verbose(
sugg_msg(mtbl.prefix_str()),
vec![
(outer.span.shrink_to_lo(), "<".to_string()),
(span.shrink_to_hi(), ">".to_string()),
],
Applicability::MachineApplicable,
);
}
(true, _, hir::Mutability::Mut) => {
// There's an associated function found on the immutable borrow of the
err.multipart_suggestion_verbose(
sugg_msg("mut "),
vec![
(outer.span.shrink_to_lo().until(span), "<&".to_string()),
(span.shrink_to_hi(), ">".to_string()),
],
Applicability::MachineApplicable,
);
}
(_, true, hir::Mutability::Not) => {
err.multipart_suggestion_verbose(
sugg_msg(""),
vec![
(outer.span.shrink_to_lo().until(span), "<&mut ".to_string()),
(span.shrink_to_hi(), ">".to_string()),
],
Applicability::MachineApplicable,
);
}
_ => {}
}
// If we didn't return early here, we would instead suggest `&&str::from("")`.
return false;
}
c
}
c if matches!(
Expand All @@ -1220,8 +1297,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
never_suggest_borrow.push(def_id);
}

let param_env = obligation.param_env;

// Try to apply the original trait bound by borrowing.
let mut try_borrowing = |old_pred: ty::PolyTraitPredicate<'tcx>,
blacklist: &[DefId]|
Expand All @@ -1243,11 +1318,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
)
});

let mk_result = |trait_pred_and_new_ty| {
let obligation =
self.mk_trait_obligation_with_new_self_ty(param_env, trait_pred_and_new_ty);
self.predicate_must_hold_modulo_regions(&obligation)
};
let imm_ref_self_ty_satisfies_pred = mk_result(trait_pred_and_imm_ref);
let mut_ref_self_ty_satisfies_pred = mk_result(trait_pred_and_mut_ref);

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sync/mpmc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ use crate::time::{Duration, Instant};
/// sender.send(expensive_computation()).unwrap();
/// });
///
/// // Do some useful work for awhile
/// // Do some useful work for a while
///
/// // Let's see what that answer was
/// println!("{:?}", receiver.recv().unwrap());
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sync/mpsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ pub enum TrySendError<T> {
/// sender.send(expensive_computation()).unwrap();
/// });
///
/// // Do some useful work for awhile
/// // Do some useful work for a while
///
/// // Let's see what that answer was
/// println!("{:?}", receiver.recv().unwrap());
Expand Down
28 changes: 13 additions & 15 deletions src/doc/rustc/src/platform-support/netbsd.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# \*-unknown-netbsd

**Tier: 3**

[NetBSD] multi-platform 4.4BSD-based UNIX-like operating system.

[NetBSD]: https://www.NetBSD.org/
Expand All @@ -11,19 +9,19 @@ where `$ARCH` specifies the target processor architecture and
`-$SUFFIX` (optional) might indicate the ABI. The following targets
are currently defined running NetBSD:

| Target name | NetBSD Platform |
|--------------------------------|-----------------|
| `x86_64-unknown-netbsd` | [amd64 / x86_64 systems](https://wiki.netbsd.org/ports/amd64/) |
| `armv7-unknown-netbsd-eabihf` | [32-bit ARMv7 systems with hard-float](https://wiki.netbsd.org/ports/evbarm/) |
| `armv6-unknown-netbsd-eabihf` | [32-bit ARMv6 systems with hard-float](https://wiki.netbsd.org/ports/evbarm/) |
| `aarch64-unknown-netbsd` | [64-bit ARM systems, little-endian](https://wiki.netbsd.org/ports/evbarm/) |
| `aarch64_be-unknown-netbsd` | [64-bit ARM systems, big-endian](https://wiki.netbsd.org/ports/evbarm/) |
| `i586-unknown-netbsd` | [32-bit i386, restricted to Pentium](https://wiki.netbsd.org/ports/i386/) |
| `i686-unknown-netbsd` | [32-bit i386 with SSE](https://wiki.netbsd.org/ports/i386/) |
| `mipsel-unknown-netbsd` | [32-bit mips, requires mips32 cpu support](https://wiki.netbsd.org/ports/evbmips/) |
| `powerpc-unknown-netbsd` | [Various 32-bit PowerPC systems, e.g. MacPPC](https://wiki.netbsd.org/ports/macppc/) |
| `riscv64gc-unknown-netbsd` | [64-bit RISC-V](https://wiki.netbsd.org/ports/riscv/) |
| `sparc64-unknown-netbsd` | [Sun UltraSPARC systems](https://wiki.netbsd.org/ports/sparc64/) |
| Target tier | Target name | NetBSD Platform |
|---------------------|-------------------------------|--------------------------------------------------------------------------------------|
| 2 (with host tools) | `x86_64-unknown-netbsd` | [amd64 / x86_64 systems](https://wiki.netbsd.org/ports/amd64/) |
| 3 | `armv7-unknown-netbsd-eabihf` | [32-bit ARMv7 systems with hard-float](https://wiki.netbsd.org/ports/evbarm/) |
| 3 | `armv6-unknown-netbsd-eabihf` | [32-bit ARMv6 systems with hard-float](https://wiki.netbsd.org/ports/evbarm/) |
| 3 | `aarch64-unknown-netbsd` | [64-bit ARM systems, little-endian](https://wiki.netbsd.org/ports/evbarm/) |
| 3 | `aarch64_be-unknown-netbsd` | [64-bit ARM systems, big-endian](https://wiki.netbsd.org/ports/evbarm/) |
| 3 | `i586-unknown-netbsd` | [32-bit i386, restricted to Pentium](https://wiki.netbsd.org/ports/i386/) |
| 3 | `i686-unknown-netbsd` | [32-bit i386 with SSE](https://wiki.netbsd.org/ports/i386/) |
| 3 | `mipsel-unknown-netbsd` | [32-bit mips, requires mips32 cpu support](https://wiki.netbsd.org/ports/evbmips/) |
| 3 | `powerpc-unknown-netbsd` | [Various 32-bit PowerPC systems, e.g. MacPPC](https://wiki.netbsd.org/ports/macppc/) |
| 3 | `riscv64gc-unknown-netbsd` | [64-bit RISC-V](https://wiki.netbsd.org/ports/riscv/) |
| 3 | `sparc64-unknown-netbsd` | [Sun UltraSPARC systems](https://wiki.netbsd.org/ports/sparc64/) |

All use the "native" `stdc++` library which goes along with the natively
supplied GNU C++ compiler for the given OS version. Many of the bootstraps
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustdoc.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
% Rust Documentation

This has been moved [into the book](book/documentation.html).
This has been moved [into the rustdoc book](rustdoc/index.html).
2 changes: 0 additions & 2 deletions src/librustdoc/json/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! the `clean` types but with some fields removed or stringified to simplify the output and not
//! expose unstable compiler internals.

#![allow(rustc::default_hash_types)]

use rustc_abi::ExternAbi;
use rustc_ast::ast;
use rustc_attr_data_structures::{self as attrs, DeprecatedSince};
Expand Down
Loading
Loading