Skip to content

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

Diff for: Cargo.lock

+165-152
Large diffs are not rendered by default.

Diff for: compiler/rustc_ast/Cargo.toml

+1-2
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" }

Diff for: compiler/rustc_lint/messages.ftl

+3
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

Diff for: compiler/rustc_lint/src/internal.rs

+28-2
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) =>

Diff for: compiler/rustc_lint/src/lints.rs

+5
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 {

Diff for: compiler/rustc_next_trait_solver/src/lib.rs

+1
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

Diff for: compiler/rustc_resolve/src/def_collector.rs

+1-1
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
}

Diff for: compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs

-1
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(),

Diff for: compiler/rustc_type_ir/src/lib.rs

+1
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;

Diff for: library/Cargo.lock

+40-30
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"

Diff for: library/std/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ unwind = { path = "../unwind" }
2323
hashbrown = { version = "0.14", default-features = false, features = [
2424
'rustc-dep-of-std',
2525
] }
26+
# FIXME(#127890): `object` depends on `memchr`, but `memchr` > v2.5 causes
27+
# issues with LTO. This dependency is not used directly, but pin it here so
28+
# it is resolved 2.5. To be removed once rust-lang/rust#127890 is fixed.
29+
memchr = { version = "=2.5.0", default-features = false, features = ["rustc-dep-of-std"] }
2630
std_detect = { path = "../stdarch/crates/std_detect", default-features = false, features = [
2731
'rustc-dep-of-std',
2832
] }

Diff for: src/librustdoc/html/render/mod.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,7 @@ fn render_assoc_items_inner(
12501250
let Some(v) = cache.impls.get(&it) else { return };
12511251
let (non_trait, traits): (Vec<_>, _) = v.iter().partition(|i| i.inner_impl().trait_.is_none());
12521252
if !non_trait.is_empty() {
1253+
let mut close_tags = <Vec<&str>>::with_capacity(1);
12531254
let mut tmp_buf = Buffer::html();
12541255
let (render_mode, id, class_html) = match what {
12551256
AssocItemRender::All => {
@@ -1260,6 +1261,8 @@ fn render_assoc_items_inner(
12601261
let id =
12611262
cx.derive_id(small_url_encode(format!("deref-methods-{:#}", type_.print(cx))));
12621263
let derived_id = cx.derive_id(&id);
1264+
tmp_buf.write_str("<details class=\"toggle big-toggle\" open><summary>");
1265+
close_tags.push("</details>");
12631266
write_impl_section_heading(
12641267
&mut tmp_buf,
12651268
&format!(
@@ -1269,6 +1272,7 @@ fn render_assoc_items_inner(
12691272
),
12701273
&id,
12711274
);
1275+
tmp_buf.write_str("</summary>");
12721276
if let Some(def_id) = type_.def_id(cx.cache()) {
12731277
cx.deref_id_map.insert(def_id, id);
12741278
}
@@ -1302,6 +1306,9 @@ fn render_assoc_items_inner(
13021306
impls_buf.into_inner()
13031307
)
13041308
.unwrap();
1309+
for tag in close_tags.into_iter().rev() {
1310+
w.write_str(tag).unwrap();
1311+
}
13051312
}
13061313
}
13071314

@@ -1558,7 +1565,7 @@ fn render_impl(
15581565
let cache = &shared.cache;
15591566
let traits = &cache.traits;
15601567
let trait_ = i.trait_did().map(|did| &traits[&did]);
1561-
let mut close_tags = String::new();
1568+
let mut close_tags = <Vec<&str>>::with_capacity(2);
15621569

15631570
// For trait implementations, the `interesting` output contains all methods that have doc
15641571
// comments, and the `boring` output contains all methods that do not. The distinction is
@@ -1870,7 +1877,7 @@ fn render_impl(
18701877
if render_mode == RenderMode::Normal {
18711878
let toggled = !(impl_items.is_empty() && default_impl_items.is_empty());
18721879
if toggled {
1873-
close_tags.insert_str(0, "</details>");
1880+
close_tags.push("</details>");
18741881
write!(
18751882
w,
18761883
"<details class=\"toggle implementors-toggle\"{}>\
@@ -1916,14 +1923,16 @@ fn render_impl(
19161923
}
19171924
if !default_impl_items.is_empty() || !impl_items.is_empty() {
19181925
w.write_str("<div class=\"impl-items\">");
1919-
close_tags.insert_str(0, "</div>");
1926+
close_tags.push("</div>");
19201927
}
19211928
}
19221929
if !default_impl_items.is_empty() || !impl_items.is_empty() {
19231930
w.push_buffer(default_impl_items);
19241931
w.push_buffer(impl_items);
19251932
}
1926-
w.write_str(&close_tags);
1933+
for tag in close_tags.into_iter().rev() {
1934+
w.write_str(tag);
1935+
}
19271936
}
19281937

19291938
// Render the items that appear on the right side of methods, impls, and

Diff for: src/librustdoc/html/static/css/rustdoc.css

+10
Original file line numberDiff line numberDiff line change
@@ -1852,6 +1852,11 @@ details.toggle {
18521852
position: relative;
18531853
}
18541854

1855+
details.big-toggle {
1856+
/* This makes [-] on the same line as <summary>. */
1857+
contain: inline-size;
1858+
}
1859+
18551860
/* The hideme class is used on summary tags that contain a span with
18561861
placeholder text shown only when the toggle is closed. For instance,
18571862
"Expand description" or "Show methods". */
@@ -1942,6 +1947,11 @@ details.toggle > summary:not(.hideme)::before {
19421947
left: -24px;
19431948
}
19441949

1950+
details.big-toggle > summary:not(.hideme)::before {
1951+
left: -34px;
1952+
top: 9px;
1953+
}
1954+
19451955
/* When a "hideme" summary is open and the "Expand description" or "Show
19461956
methods" text is hidden, we want the [-] toggle that remains to not
19471957
affect the layout of the items to its right. To do that, we use

0 commit comments

Comments
 (0)