Skip to content

Commit a2d45f7

Browse files
committed
Auto merge of #143601 - matthiaskrgr:rollup-9iw2sqk, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #132469 (Do not suggest borrow that is already there in fully-qualified call) - #143340 (awhile -> a while where appropriate) - #143438 (Fix the link in `rustdoc.md`) - #143539 (Regression tests for repr ICEs) - #143566 (Fix `x86_64-unknown-netbsd` platform support page) - #143572 (Remove unused allow attrs) - #143583 (`loop_match`: fix 'no terminator on block') - #143584 (make `Machine::load_mir` infallible) - #143591 (Fix missing words in future tracking issue) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 2f8eeb2 + ff6b881 commit a2d45f7

File tree

30 files changed

+311
-76
lines changed

30 files changed

+311
-76
lines changed

.github/ISSUE_TEMPLATE/tracking_issue_future.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ it would be `T-libs-api`.
1414
Also check for any `A-` labels to add.
1515
-->
1616

17-
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].
17+
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].
1818

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

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

4545
- [ ] Implement the lint
4646
- [ ] Raise lint level to deny
47-
- [ ] Make lint report in dependencies
47+
- [ ] Change the lint to report in dependencies
4848
- [ ] Switch to a hard error
4949

5050
### Implementation history

compiler/rustc_codegen_gcc/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#![doc(rust_logo)]
2020
#![feature(rustdoc_internals)]
2121
#![feature(rustc_private)]
22-
#![allow(broken_intra_doc_links)]
2322
#![recursion_limit = "256"]
2423
#![warn(rust_2018_idioms)]
2524
#![warn(unused_lifetimes)]

compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(non_camel_case_types)]
21
#![expect(dead_code)]
32

43
use libc::{c_char, c_uint};

compiler/rustc_const_eval/src/const_eval/machine.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,10 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
331331
fn load_mir(
332332
ecx: &InterpCx<'tcx, Self>,
333333
instance: ty::InstanceKind<'tcx>,
334-
) -> InterpResult<'tcx, &'tcx mir::Body<'tcx>> {
334+
) -> &'tcx mir::Body<'tcx> {
335335
match instance {
336-
ty::InstanceKind::Item(def) => interp_ok(ecx.tcx.mir_for_ctfe(def)),
337-
_ => interp_ok(ecx.tcx.instance_mir(instance)),
336+
ty::InstanceKind::Item(def) => ecx.tcx.mir_for_ctfe(def),
337+
_ => ecx.tcx.instance_mir(instance),
338338
}
339339
}
340340

compiler/rustc_const_eval/src/interpret/eval_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
272272
let def = instance.def_id();
273273
&self.tcx.promoted_mir(def)[promoted]
274274
} else {
275-
M::load_mir(self, instance)?
275+
M::load_mir(self, instance)
276276
};
277277
// do not continue if typeck errors occurred (can only occur in local crate)
278278
if let Some(err) = body.tainted_by_errors {

compiler/rustc_const_eval/src/interpret/machine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ pub trait Machine<'tcx>: Sized {
189189
fn load_mir(
190190
ecx: &InterpCx<'tcx, Self>,
191191
instance: ty::InstanceKind<'tcx>,
192-
) -> InterpResult<'tcx, &'tcx mir::Body<'tcx>> {
193-
interp_ok(ecx.tcx.instance_mir(instance))
192+
) -> &'tcx mir::Body<'tcx> {
193+
ecx.tcx.instance_mir(instance)
194194
}
195195

196196
/// Entry point to all function calls.

compiler/rustc_errors/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//! This module contains the code for creating and emitting diagnostics.
44
55
// tidy-alphabetical-start
6-
#![allow(incomplete_features)]
76
#![allow(internal_features)]
87
#![allow(rustc::diagnostic_outside_of_impl)]
98
#![allow(rustc::direct_use_of_rustc_type_ir)]

compiler/rustc_infer/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
1515
// tidy-alphabetical-start
1616
#![allow(internal_features)]
17-
#![allow(rustc::diagnostic_outside_of_impl)]
1817
#![allow(rustc::direct_use_of_rustc_type_ir)]
19-
#![allow(rustc::untranslatable_diagnostic)]
2018
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2119
#![doc(rust_logo)]
2220
#![feature(assert_matches)]

compiler/rustc_lint/src/early/diagnostics.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#![allow(rustc::diagnostic_outside_of_impl)]
2-
#![allow(rustc::untranslatable_diagnostic)]
3-
41
use std::borrow::Cow;
52

63
use rustc_ast::util::unicode::TEXT_FLOW_CONTROL_CHARS;

compiler/rustc_lint/src/lints.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(rustc::diagnostic_outside_of_impl)]
21
#![allow(rustc::untranslatable_diagnostic)]
32
use std::num::NonZero;
43

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,7 @@ extern "C" void LLVMRustSetModuleCodeModel(LLVMModuleRef M,
12751275
//
12761276
// Otherwise I'll apologize in advance, it probably requires a relatively
12771277
// significant investment on your part to "truly understand" what's going on
1278-
// here. Not saying I do myself, but it took me awhile staring at LLVM's source
1278+
// here. Not saying I do myself, but it took me a while staring at LLVM's source
12791279
// and various online resources about ThinLTO to make heads or tails of all
12801280
// this.
12811281

compiler/rustc_middle/src/arena.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(rustc::usage_of_ty_tykind)]
2-
31
/// This higher-order macro declares a list of types which can be allocated by `Arena`.
42
///
53
/// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]` where `T` is the type

compiler/rustc_mir_build/src/builder/scope.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
936936

937937
valtree
938938
}
939-
Err(ErrorHandled::Reported(..)) => return self.cfg.start_new_block().unit(),
939+
Err(ErrorHandled::Reported(..)) => {
940+
return block.unit();
941+
}
940942
Err(ErrorHandled::TooGeneric(_)) => {
941943
self.tcx.dcx().emit_fatal(ConstContinueBadConst { span: constant.span });
942944
}

compiler/rustc_parse/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! The main parser interface.
22
33
// tidy-alphabetical-start
4-
#![allow(internal_features)]
54
#![allow(rustc::diagnostic_outside_of_impl)]
65
#![allow(rustc::untranslatable_diagnostic)]
76
#![feature(assert_matches)]

compiler/rustc_query_impl/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
// tidy-alphabetical-start
44
#![allow(internal_features)]
5-
#![allow(unused_parens)]
65
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
76
#![doc(rust_logo)]
87
#![feature(min_specialization)]

compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs

Lines changed: 77 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
11871187
has_custom_message: bool,
11881188
) -> bool {
11891189
let span = obligation.cause.span;
1190+
let param_env = obligation.param_env;
1191+
1192+
let mk_result = |trait_pred_and_new_ty| {
1193+
let obligation =
1194+
self.mk_trait_obligation_with_new_self_ty(param_env, trait_pred_and_new_ty);
1195+
self.predicate_must_hold_modulo_regions(&obligation)
1196+
};
11901197

11911198
let code = match obligation.cause.code() {
11921199
ObligationCauseCode::FunctionArg { parent_code, .. } => parent_code,
@@ -1195,6 +1202,76 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
11951202
c @ ObligationCauseCode::WhereClauseInExpr(_, _, hir_id, _)
11961203
if self.tcx.hir_span(*hir_id).lo() == span.lo() =>
11971204
{
1205+
// `hir_id` corresponds to the HIR node that introduced a `where`-clause obligation.
1206+
// If that obligation comes from a type in an associated method call, we need
1207+
// special handling here.
1208+
if let hir::Node::Expr(expr) = self.tcx.parent_hir_node(*hir_id)
1209+
&& let hir::ExprKind::Call(base, _) = expr.kind
1210+
&& let hir::ExprKind::Path(hir::QPath::TypeRelative(ty, segment)) = base.kind
1211+
&& let hir::Node::Expr(outer) = self.tcx.parent_hir_node(expr.hir_id)
1212+
&& let hir::ExprKind::AddrOf(hir::BorrowKind::Ref, mtbl, _) = outer.kind
1213+
&& ty.span == span
1214+
{
1215+
// We've encountered something like `&str::from("")`, where the intended code
1216+
// was likely `<&str>::from("")`. The former is interpreted as "call method
1217+
// `from` on `str` and borrow the result", while the latter means "call method
1218+
// `from` on `&str`".
1219+
1220+
let trait_pred_and_imm_ref = poly_trait_pred.map_bound(|p| {
1221+
(p, Ty::new_imm_ref(self.tcx, self.tcx.lifetimes.re_static, p.self_ty()))
1222+
});
1223+
let trait_pred_and_mut_ref = poly_trait_pred.map_bound(|p| {
1224+
(p, Ty::new_mut_ref(self.tcx, self.tcx.lifetimes.re_static, p.self_ty()))
1225+
});
1226+
1227+
let imm_ref_self_ty_satisfies_pred = mk_result(trait_pred_and_imm_ref);
1228+
let mut_ref_self_ty_satisfies_pred = mk_result(trait_pred_and_mut_ref);
1229+
let sugg_msg = |pre: &str| {
1230+
format!(
1231+
"you likely meant to call the associated function `{FN}` for type \
1232+
`&{pre}{TY}`, but the code as written calls associated function `{FN}` on \
1233+
type `{TY}`",
1234+
FN = segment.ident,
1235+
TY = poly_trait_pred.self_ty(),
1236+
)
1237+
};
1238+
match (imm_ref_self_ty_satisfies_pred, mut_ref_self_ty_satisfies_pred, mtbl) {
1239+
(true, _, hir::Mutability::Not) | (_, true, hir::Mutability::Mut) => {
1240+
err.multipart_suggestion_verbose(
1241+
sugg_msg(mtbl.prefix_str()),
1242+
vec![
1243+
(outer.span.shrink_to_lo(), "<".to_string()),
1244+
(span.shrink_to_hi(), ">".to_string()),
1245+
],
1246+
Applicability::MachineApplicable,
1247+
);
1248+
}
1249+
(true, _, hir::Mutability::Mut) => {
1250+
// There's an associated function found on the immutable borrow of the
1251+
err.multipart_suggestion_verbose(
1252+
sugg_msg("mut "),
1253+
vec![
1254+
(outer.span.shrink_to_lo().until(span), "<&".to_string()),
1255+
(span.shrink_to_hi(), ">".to_string()),
1256+
],
1257+
Applicability::MachineApplicable,
1258+
);
1259+
}
1260+
(_, true, hir::Mutability::Not) => {
1261+
err.multipart_suggestion_verbose(
1262+
sugg_msg(""),
1263+
vec![
1264+
(outer.span.shrink_to_lo().until(span), "<&mut ".to_string()),
1265+
(span.shrink_to_hi(), ">".to_string()),
1266+
],
1267+
Applicability::MachineApplicable,
1268+
);
1269+
}
1270+
_ => {}
1271+
}
1272+
// If we didn't return early here, we would instead suggest `&&str::from("")`.
1273+
return false;
1274+
}
11981275
c
11991276
}
12001277
c if matches!(
@@ -1220,8 +1297,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
12201297
never_suggest_borrow.push(def_id);
12211298
}
12221299

1223-
let param_env = obligation.param_env;
1224-
12251300
// Try to apply the original trait bound by borrowing.
12261301
let mut try_borrowing = |old_pred: ty::PolyTraitPredicate<'tcx>,
12271302
blacklist: &[DefId]|
@@ -1243,11 +1318,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
12431318
)
12441319
});
12451320

1246-
let mk_result = |trait_pred_and_new_ty| {
1247-
let obligation =
1248-
self.mk_trait_obligation_with_new_self_ty(param_env, trait_pred_and_new_ty);
1249-
self.predicate_must_hold_modulo_regions(&obligation)
1250-
};
12511321
let imm_ref_self_ty_satisfies_pred = mk_result(trait_pred_and_imm_ref);
12521322
let mut_ref_self_ty_satisfies_pred = mk_result(trait_pred_and_mut_ref);
12531323

library/std/src/sync/mpmc/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ use crate::time::{Duration, Instant};
187187
/// sender.send(expensive_computation()).unwrap();
188188
/// });
189189
///
190-
/// // Do some useful work for awhile
190+
/// // Do some useful work for a while
191191
///
192192
/// // Let's see what that answer was
193193
/// println!("{:?}", receiver.recv().unwrap());

library/std/src/sync/mpsc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ pub enum TrySendError<T> {
509509
/// sender.send(expensive_computation()).unwrap();
510510
/// });
511511
///
512-
/// // Do some useful work for awhile
512+
/// // Do some useful work for a while
513513
///
514514
/// // Let's see what that answer was
515515
/// println!("{:?}", receiver.recv().unwrap());

src/doc/rustc/src/platform-support/netbsd.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# \*-unknown-netbsd
22

3-
**Tier: 3**
4-
53
[NetBSD] multi-platform 4.4BSD-based UNIX-like operating system.
64

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

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

2826
All use the "native" `stdc++` library which goes along with the natively
2927
supplied GNU C++ compiler for the given OS version. Many of the bootstraps

src/doc/rustdoc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
% Rust Documentation
22

3-
This has been moved [into the book](book/documentation.html).
3+
This has been moved [into the rustdoc book](rustdoc/index.html).

src/librustdoc/json/conversions.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
//! the `clean` types but with some fields removed or stringified to simplify the output and not
33
//! expose unstable compiler internals.
44
5-
#![allow(rustc::default_hash_types)]
6-
75
use rustc_abi::ExternAbi;
86
use rustc_ast::ast;
97
use rustc_attr_data_structures::{self as attrs, DeprecatedSince};

0 commit comments

Comments
 (0)