Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e0e14a6

Browse files
committed
Auto merge of rust-lang#129862 - GuillaumeGomez:rollup-cl5b7lh, r=GuillaumeGomez
Rollup of 7 pull requests Successful merges: - rust-lang#127474 (doc: Make block of inline Deref methods foldable) - rust-lang#129624 (Adjust `memchr` pinning and run `cargo update`) - rust-lang#129678 (Deny imports of `rustc_type_ir::inherent` outside of type ir + new trait solver) - rust-lang#129837 (Actually parse stdout json, instead of using hacky contains logic.) - rust-lang#129842 (Fix LLVM ABI NAME for riscv64imac-unknown-nuttx-elf) - rust-lang#129843 (Mark myself as on vacation for triagebot) - rust-lang#129858 (Replace walk with visit so we dont skip outermost expr kind in def collector) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 94885bc + 11732eb commit e0e14a6

File tree

22 files changed

+600
-404
lines changed

22 files changed

+600
-404
lines changed

Cargo.lock

Lines changed: 165 additions & 152 deletions
Large diffs are not rendered by default.

compiler/rustc_ast/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ version = "0.0.0"
44
edition = "2021"
55

66
[dependencies]
7-
# FIXME: bumping memchr to 2.7.1 causes linker errors in MSVC thin-lto
87
# tidy-alphabetical-start
98
bitflags = "2.4.1"
10-
memchr = "=2.5.0"
9+
memchr = "2.7.4"
1110
rustc_ast_ir = { path = "../rustc_ast_ir" }
1211
rustc_data_structures = { path = "../rustc_data_structures" }
1312
rustc_index = { path = "../rustc_index" }

compiler/rustc_lint/messages.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,9 @@ lint_tykind = usage of `ty::TyKind`
783783
lint_tykind_kind = usage of `ty::TyKind::<kind>`
784784
.suggestion = try using `ty::<kind>` directly
785785
786+
lint_type_ir_inherent_usage = do not use `rustc_type_ir::inherent` unless you're inside of the trait solver
787+
.note = the method or struct you're looking for is likely defined somewhere else downstream in the compiler
788+
786789
lint_undropped_manually_drops = calls to `std::mem::drop` with `std::mem::ManuallyDrop` instead of the inner value does nothing
787790
.label = argument has type `{$arg_ty}`
788791
.suggestion = use `std::mem::ManuallyDrop::into_inner` to get the inner value

compiler/rustc_lint/src/internal.rs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use tracing::debug;
1818
use crate::lints::{
1919
BadOptAccessDiag, DefaultHashTypesDiag, DiagOutOfImpl, LintPassByHand, NonExistentDocKeyword,
2020
NonGlobImportTypeIrInherent, QueryInstability, SpanUseEqCtxtDiag, TyQualified, TykindDiag,
21-
TykindKind, UntranslatableDiag,
21+
TykindKind, TypeIrInherentUsage, UntranslatableDiag,
2222
};
2323
use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext};
2424

@@ -277,13 +277,39 @@ declare_tool_lint! {
277277
report_in_external_macro: true
278278
}
279279

280-
declare_lint_pass!(TypeIr => [NON_GLOB_IMPORT_OF_TYPE_IR_INHERENT]);
280+
declare_tool_lint! {
281+
/// The `usage_of_type_ir_inherent` lint detects usage `rustc_type_ir::inherent`.
282+
///
283+
/// This module should only be used within the trait solver.
284+
pub rustc::USAGE_OF_TYPE_IR_INHERENT,
285+
Allow,
286+
"usage `rustc_type_ir::inherent` outside of trait system",
287+
report_in_external_macro: true
288+
}
289+
290+
declare_lint_pass!(TypeIr => [NON_GLOB_IMPORT_OF_TYPE_IR_INHERENT, USAGE_OF_TYPE_IR_INHERENT]);
281291

282292
impl<'tcx> LateLintPass<'tcx> for TypeIr {
283293
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
284294
let rustc_hir::ItemKind::Use(path, kind) = item.kind else { return };
285295

286296
let is_mod_inherent = |def_id| cx.tcx.is_diagnostic_item(sym::type_ir_inherent, def_id);
297+
298+
// Path segments except for the final.
299+
if let Some(seg) =
300+
path.segments.iter().find(|seg| seg.res.opt_def_id().is_some_and(is_mod_inherent))
301+
{
302+
cx.emit_span_lint(USAGE_OF_TYPE_IR_INHERENT, seg.ident.span, TypeIrInherentUsage);
303+
}
304+
// Final path resolutions, like `use rustc_type_ir::inherent`
305+
else if path.res.iter().any(|res| res.opt_def_id().is_some_and(is_mod_inherent)) {
306+
cx.emit_span_lint(
307+
USAGE_OF_TYPE_IR_INHERENT,
308+
path.segments.last().unwrap().ident.span,
309+
TypeIrInherentUsage,
310+
);
311+
}
312+
287313
let (lo, hi, snippet) = match path.segments {
288314
[.., penultimate, segment]
289315
if penultimate.res.opt_def_id().is_some_and(is_mod_inherent) =>

compiler/rustc_lint/src/lints.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,11 @@ pub(crate) struct TyQualified {
918918
pub suggestion: Span,
919919
}
920920

921+
#[derive(LintDiagnostic)]
922+
#[diag(lint_type_ir_inherent_usage)]
923+
#[note]
924+
pub(crate) struct TypeIrInherentUsage;
925+
921926
#[derive(LintDiagnostic)]
922927
#[diag(lint_non_glob_import_type_ir_inherent)]
923928
pub(crate) struct NonGlobImportTypeIrInherent {

compiler/rustc_next_trait_solver/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
//! So if you got to this crate from the old solver, it's totally normal.
66
77
// tidy-alphabetical-start
8+
#![cfg_attr(not(bootstrap), allow(rustc::usage_of_type_ir_inherent))]
89
#![warn(unreachable_pub)]
910
// tidy-alphabetical-end
1011

compiler/rustc_resolve/src/def_collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
223223
// we must create two defs.
224224
let coroutine_def =
225225
self.create_def(coroutine_kind.closure_id(), kw::Empty, DefKind::Closure, span);
226-
self.with_parent(coroutine_def, |this| visit::walk_expr(this, body));
226+
self.with_parent(coroutine_def, |this| this.visit_expr(body));
227227
}
228228
_ => visit::walk_fn(self, fn_kind),
229229
}

compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub fn target() -> Target {
2121
os: "nuttx".into(),
2222
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2323
linker: Some("rust-lld".into()),
24-
llvm_abiname: "lp64d".into(),
2524
cpu: "generic-rv64".into(),
2625
max_atomic_width: Some(64),
2726
features: "+m,+a,+c".into(),

compiler/rustc_type_ir/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
feature(associated_type_defaults, never_type, rustc_attrs, negative_impls)
66
)]
77
#![cfg_attr(feature = "nightly", allow(internal_features))]
8+
#![cfg_attr(not(bootstrap), allow(rustc::usage_of_type_ir_inherent))]
89
// tidy-alphabetical-end
910

1011
extern crate self as rustc_type_ir;

library/Cargo.lock

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
4242

4343
[[package]]
4444
name = "cc"
45-
version = "1.0.99"
45+
version = "1.1.15"
4646
source = "registry+https://github.com/rust-lang/crates.io-index"
47-
checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695"
47+
checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6"
48+
dependencies = [
49+
"shlex",
50+
]
4851

4952
[[package]]
5053
name = "cfg-if"
@@ -110,9 +113,9 @@ dependencies = [
110113

111114
[[package]]
112115
name = "gimli"
113-
version = "0.28.1"
116+
version = "0.29.0"
114117
source = "registry+https://github.com/rust-lang/crates.io-index"
115-
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
118+
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
116119
dependencies = [
117120
"compiler_builtins",
118121
"rustc-std-workspace-alloc",
@@ -121,9 +124,9 @@ dependencies = [
121124

122125
[[package]]
123126
name = "gimli"
124-
version = "0.29.0"
127+
version = "0.30.0"
125128
source = "registry+https://github.com/rust-lang/crates.io-index"
126-
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
129+
checksum = "e2e1d97fbe9722ba9bbd0c97051c2956e726562b61f86a25a4360398a40edfc9"
127130
dependencies = [
128131
"compiler_builtins",
129132
"rustc-std-workspace-alloc",
@@ -186,9 +189,9 @@ dependencies = [
186189

187190
[[package]]
188191
name = "object"
189-
version = "0.36.2"
192+
version = "0.36.4"
190193
source = "registry+https://github.com/rust-lang/crates.io-index"
191-
checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e"
194+
checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a"
192195
dependencies = [
193196
"compiler_builtins",
194197
"memchr",
@@ -312,6 +315,12 @@ dependencies = [
312315
"std",
313316
]
314317

318+
[[package]]
319+
name = "shlex"
320+
version = "1.3.0"
321+
source = "registry+https://github.com/rust-lang/crates.io-index"
322+
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
323+
315324
[[package]]
316325
name = "std"
317326
version = "0.0.0"
@@ -326,6 +335,7 @@ dependencies = [
326335
"hashbrown",
327336
"hermit-abi",
328337
"libc",
338+
"memchr",
329339
"miniz_oxide",
330340
"object",
331341
"panic_abort",
@@ -396,12 +406,12 @@ dependencies = [
396406

397407
[[package]]
398408
name = "unwinding"
399-
version = "0.2.1"
409+
version = "0.2.2"
400410
source = "registry+https://github.com/rust-lang/crates.io-index"
401-
checksum = "37a19a21a537f635c16c7576f22d0f2f7d63353c1337ad4ce0d8001c7952a25b"
411+
checksum = "dc55842d0db6329a669d55a623c674b02d677b16bfb2d24857d4089d41eba882"
402412
dependencies = [
403413
"compiler_builtins",
404-
"gimli 0.28.1",
414+
"gimli 0.30.0",
405415
"rustc-std-workspace-core",
406416
]
407417

@@ -422,7 +432,7 @@ version = "0.52.0"
422432
source = "registry+https://github.com/rust-lang/crates.io-index"
423433
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
424434
dependencies = [
425-
"windows-targets 0.52.5",
435+
"windows-targets 0.52.6",
426436
]
427437

428438
[[package]]
@@ -431,9 +441,9 @@ version = "0.0.0"
431441

432442
[[package]]
433443
name = "windows-targets"
434-
version = "0.52.5"
444+
version = "0.52.6"
435445
source = "registry+https://github.com/rust-lang/crates.io-index"
436-
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
446+
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
437447
dependencies = [
438448
"windows_aarch64_gnullvm",
439449
"windows_aarch64_msvc",
@@ -447,48 +457,48 @@ dependencies = [
447457

448458
[[package]]
449459
name = "windows_aarch64_gnullvm"
450-
version = "0.52.5"
460+
version = "0.52.6"
451461
source = "registry+https://github.com/rust-lang/crates.io-index"
452-
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
462+
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
453463

454464
[[package]]
455465
name = "windows_aarch64_msvc"
456-
version = "0.52.5"
466+
version = "0.52.6"
457467
source = "registry+https://github.com/rust-lang/crates.io-index"
458-
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
468+
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
459469

460470
[[package]]
461471
name = "windows_i686_gnu"
462-
version = "0.52.5"
472+
version = "0.52.6"
463473
source = "registry+https://github.com/rust-lang/crates.io-index"
464-
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
474+
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
465475

466476
[[package]]
467477
name = "windows_i686_gnullvm"
468-
version = "0.52.5"
478+
version = "0.52.6"
469479
source = "registry+https://github.com/rust-lang/crates.io-index"
470-
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
480+
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
471481

472482
[[package]]
473483
name = "windows_i686_msvc"
474-
version = "0.52.5"
484+
version = "0.52.6"
475485
source = "registry+https://github.com/rust-lang/crates.io-index"
476-
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
486+
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
477487

478488
[[package]]
479489
name = "windows_x86_64_gnu"
480-
version = "0.52.5"
490+
version = "0.52.6"
481491
source = "registry+https://github.com/rust-lang/crates.io-index"
482-
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
492+
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
483493

484494
[[package]]
485495
name = "windows_x86_64_gnullvm"
486-
version = "0.52.5"
496+
version = "0.52.6"
487497
source = "registry+https://github.com/rust-lang/crates.io-index"
488-
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
498+
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
489499

490500
[[package]]
491501
name = "windows_x86_64_msvc"
492-
version = "0.52.5"
502+
version = "0.52.6"
493503
source = "registry+https://github.com/rust-lang/crates.io-index"
494-
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
504+
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"

0 commit comments

Comments
 (0)