Skip to content

Commit e721434

Browse files
committed
Auto merge of #88641 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] backports This PR backports: * Concrete regions can show up in mir borrowck if the originated from there #88533 (fixes #83190) * Fix loading large rlibs #88506 (fixes #88351) * Display associated types of implementors #88490 (fixes #86631) * Tracking issue for UNSUPPORTED_CALLING_CONVENTIONS #88397 r? `@Mark-Simulacrum`
2 parents 27e88d3 + 01ab441 commit e721434

File tree

13 files changed

+124
-70
lines changed

13 files changed

+124
-70
lines changed

Cargo.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -2141,9 +2141,9 @@ dependencies = [
21412141

21422142
[[package]]
21432143
name = "memchr"
2144-
version = "2.4.0"
2144+
version = "2.4.1"
21452145
source = "registry+https://github.com/rust-lang/crates.io-index"
2146-
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
2146+
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
21472147

21482148
[[package]]
21492149
name = "memmap2"
@@ -2304,9 +2304,9 @@ dependencies = [
23042304

23052305
[[package]]
23062306
name = "object"
2307-
version = "0.25.2"
2307+
version = "0.26.2"
23082308
source = "registry+https://github.com/rust-lang/crates.io-index"
2309-
checksum = "f8bc1d42047cf336f0f939c99e97183cf31551bf0f2865a2ec9c8d91fd4ffb5e"
2309+
checksum = "39f37e50073ccad23b6d09bcb5b263f4e76d3bb6038e4a3c08e52162ffa8abc2"
23102310
dependencies = [
23112311
"crc32fast",
23122312
"indexmap",
@@ -3647,7 +3647,7 @@ dependencies = [
36473647
"itertools 0.9.0",
36483648
"jobserver",
36493649
"libc",
3650-
"object 0.25.2",
3650+
"object 0.26.2",
36513651
"pathdiff",
36523652
"rustc_apfloat",
36533653
"rustc_ast",

compiler/rustc_codegen_ssa/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ rustc_target = { path = "../rustc_target" }
3636
rustc_session = { path = "../rustc_session" }
3737

3838
[dependencies.object]
39-
version = "0.25.2"
39+
version = "0.26.2"
4040
default-features = false
4141
features = ["read_core", "elf", "macho", "pe", "unaligned", "archive", "write"]

compiler/rustc_lint_defs/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3345,6 +3345,6 @@ declare_lint! {
33453345
Warn,
33463346
"use of unsupported calling convention",
33473347
@future_incompatible = FutureIncompatibleInfo {
3348-
reference: "issue #00000 <https://github.com/rust-lang/rust/issues/00000>",
3348+
reference: "issue #87678 <https://github.com/rust-lang/rust/issues/87678>",
33493349
};
33503350
}

compiler/rustc_mir/src/borrow_check/region_infer/opaque_types.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
8282
.find(|ur_vid| self.eval_equal(vid, **ur_vid))
8383
.and_then(|ur_vid| self.definitions[*ur_vid].external_name)
8484
.unwrap_or(infcx.tcx.lifetimes.re_root_empty),
85-
ty::ReLateBound(..) => region,
86-
ty::ReStatic => region,
87-
_ => {
88-
infcx.tcx.sess.delay_span_bug(
89-
span,
90-
&format!("unexpected concrete region in borrowck: {:?}", region),
91-
);
92-
region
93-
}
85+
_ => region,
9486
});
9587

9688
debug!(?universal_concrete_type, ?universal_substs);

src/librustdoc/html/render/mod.rs

+62-29
Original file line numberDiff line numberDiff line change
@@ -708,11 +708,15 @@ fn render_impls(
708708
containing_item,
709709
assoc_link,
710710
RenderMode::Normal,
711-
true,
712711
None,
713-
false,
714-
true,
715712
&[],
713+
ImplRenderingParameters {
714+
show_def_docs: true,
715+
is_on_foreign_type: false,
716+
show_default_items: true,
717+
show_non_assoc_items: true,
718+
toggle_open_by_default: true,
719+
},
716720
);
717721
buffer.into_inner()
718722
})
@@ -1047,11 +1051,15 @@ fn render_assoc_items(
10471051
containing_item,
10481052
AssocItemLink::Anchor(None),
10491053
render_mode,
1050-
true,
10511054
None,
1052-
false,
1053-
true,
10541055
&[],
1056+
ImplRenderingParameters {
1057+
show_def_docs: true,
1058+
is_on_foreign_type: false,
1059+
show_default_items: true,
1060+
show_non_assoc_items: true,
1061+
toggle_open_by_default: true,
1062+
},
10551063
);
10561064
}
10571065
}
@@ -1240,20 +1248,26 @@ fn notable_traits_decl(decl: &clean::FnDecl, cx: &Context<'_>) -> String {
12401248
out.into_inner()
12411249
}
12421250

1251+
#[derive(Clone, Copy, Debug)]
1252+
struct ImplRenderingParameters {
1253+
show_def_docs: bool,
1254+
is_on_foreign_type: bool,
1255+
show_default_items: bool,
1256+
/// Whether or not to show methods.
1257+
show_non_assoc_items: bool,
1258+
toggle_open_by_default: bool,
1259+
}
1260+
12431261
fn render_impl(
12441262
w: &mut Buffer,
12451263
cx: &Context<'_>,
12461264
i: &Impl,
12471265
parent: &clean::Item,
12481266
link: AssocItemLink<'_>,
12491267
render_mode: RenderMode,
1250-
show_def_docs: bool,
12511268
use_absolute: Option<bool>,
1252-
is_on_foreign_type: bool,
1253-
show_default_items: bool,
1254-
// This argument is used to reference same type with different paths to avoid duplication
1255-
// in documentation pages for trait with automatic implementations like "Send" and "Sync".
12561269
aliases: &[String],
1270+
rendering_params: ImplRenderingParameters,
12571271
) {
12581272
let cache = cx.cache();
12591273
let traits = &cache.traits;
@@ -1276,17 +1290,18 @@ fn render_impl(
12761290
render_mode: RenderMode,
12771291
is_default_item: bool,
12781292
trait_: Option<&clean::Trait>,
1279-
show_def_docs: bool,
1293+
rendering_params: ImplRenderingParameters,
12801294
) {
12811295
let item_type = item.type_();
12821296
let name = item.name.as_ref().unwrap();
12831297

1284-
let render_method_item = match render_mode {
1285-
RenderMode::Normal => true,
1286-
RenderMode::ForDeref { mut_: deref_mut_ } => {
1287-
should_render_item(&item, deref_mut_, &cx.cache)
1288-
}
1289-
};
1298+
let render_method_item = rendering_params.show_non_assoc_items
1299+
&& match render_mode {
1300+
RenderMode::Normal => true,
1301+
RenderMode::ForDeref { mut_: deref_mut_ } => {
1302+
should_render_item(&item, deref_mut_, &cx.cache)
1303+
}
1304+
};
12901305

12911306
let in_trait_class = if trait_.is_some() { " trait-impl" } else { "" };
12921307

@@ -1309,18 +1324,32 @@ fn render_impl(
13091324
} else {
13101325
// In case the item isn't documented,
13111326
// provide short documentation from the trait.
1312-
document_short(&mut doc_buffer, it, cx, link, parent, show_def_docs);
1327+
document_short(
1328+
&mut doc_buffer,
1329+
it,
1330+
cx,
1331+
link,
1332+
parent,
1333+
rendering_params.show_def_docs,
1334+
);
13131335
}
13141336
}
13151337
} else {
13161338
document_item_info(&mut info_buffer, cx, item, Some(parent));
1317-
if show_def_docs {
1339+
if rendering_params.show_def_docs {
13181340
document_full(&mut doc_buffer, item, cx);
13191341
short_documented = false;
13201342
}
13211343
}
13221344
} else {
1323-
document_short(&mut doc_buffer, item, cx, link, parent, show_def_docs);
1345+
document_short(
1346+
&mut doc_buffer,
1347+
item,
1348+
cx,
1349+
link,
1350+
parent,
1351+
rendering_params.show_def_docs,
1352+
);
13241353
}
13251354
}
13261355
let w = if short_documented && trait_.is_some() { interesting } else { boring };
@@ -1452,7 +1481,7 @@ fn render_impl(
14521481
render_mode,
14531482
false,
14541483
trait_.map(|t| &t.trait_),
1455-
show_def_docs,
1484+
rendering_params,
14561485
);
14571486
}
14581487

@@ -1465,7 +1494,7 @@ fn render_impl(
14651494
parent: &clean::Item,
14661495
containing_item: &clean::Item,
14671496
render_mode: RenderMode,
1468-
show_def_docs: bool,
1497+
rendering_params: ImplRenderingParameters,
14691498
) {
14701499
for trait_item in &t.items {
14711500
let n = trait_item.name;
@@ -1487,7 +1516,7 @@ fn render_impl(
14871516
render_mode,
14881517
true,
14891518
Some(t),
1490-
show_def_docs,
1519+
rendering_params,
14911520
);
14921521
}
14931522
}
@@ -1496,7 +1525,7 @@ fn render_impl(
14961525
// default items which weren't overridden in the implementation block.
14971526
// We don't emit documentation for default items if they appear in the
14981527
// Implementations on Foreign Types or Implementors sections.
1499-
if show_default_items {
1528+
if rendering_params.show_default_items {
15001529
if let Some(t) = trait_ {
15011530
render_default_items(
15021531
&mut default_impl_items,
@@ -1507,15 +1536,19 @@ fn render_impl(
15071536
&i.impl_item,
15081537
parent,
15091538
render_mode,
1510-
show_def_docs,
1539+
rendering_params,
15111540
);
15121541
}
15131542
}
15141543
if render_mode == RenderMode::Normal {
15151544
let toggled = !(impl_items.is_empty() && default_impl_items.is_empty());
15161545
if toggled {
15171546
close_tags.insert_str(0, "</details>");
1518-
write!(w, "<details class=\"rustdoc-toggle implementors-toggle\" open>");
1547+
write!(
1548+
w,
1549+
"<details class=\"rustdoc-toggle implementors-toggle\"{}>",
1550+
if rendering_params.toggle_open_by_default { " open" } else { "" }
1551+
);
15191552
write!(w, "<summary>")
15201553
}
15211554
render_impl_summary(
@@ -1524,9 +1557,9 @@ fn render_impl(
15241557
i,
15251558
parent,
15261559
parent,
1527-
show_def_docs,
1560+
rendering_params.show_def_docs,
15281561
use_absolute,
1529-
is_on_foreign_type,
1562+
rendering_params.is_on_foreign_type,
15301563
aliases,
15311564
);
15321565
if toggled {

src/librustdoc/html/render/print_item.rs

+19-9
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use rustc_span::symbol::{kw, sym, Symbol};
1616
use super::{
1717
collect_paths_for_type, document, ensure_trailing_slash, item_ty_to_strs, notable_traits_decl,
1818
render_assoc_item, render_assoc_items, render_attributes_in_code, render_attributes_in_pre,
19-
render_impl, render_impl_summary, render_stability_since_raw, write_srclink, AssocItemLink,
20-
Context,
19+
render_impl, render_stability_since_raw, write_srclink, AssocItemLink, Context,
20+
ImplRenderingParameters,
2121
};
2222
use crate::clean::{self, GetDefId};
2323
use crate::formats::item_type::ItemType;
@@ -735,11 +735,15 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
735735
it,
736736
assoc_link,
737737
RenderMode::Normal,
738-
false,
739738
None,
740-
true,
741-
false,
742739
&[],
740+
ImplRenderingParameters {
741+
show_def_docs: false,
742+
is_on_foreign_type: true,
743+
show_default_items: false,
744+
show_non_assoc_items: true,
745+
toggle_open_by_default: false,
746+
},
743747
);
744748
}
745749
}
@@ -1361,16 +1365,22 @@ fn render_implementor(
13611365
} => implementor_dups[&path.last()].1,
13621366
_ => false,
13631367
};
1364-
render_impl_summary(
1368+
render_impl(
13651369
w,
13661370
cx,
13671371
implementor,
13681372
trait_,
1369-
trait_,
1370-
false,
1373+
AssocItemLink::Anchor(None),
1374+
RenderMode::Normal,
13711375
Some(use_absolute),
1372-
false,
13731376
aliases,
1377+
ImplRenderingParameters {
1378+
show_def_docs: false,
1379+
is_on_foreign_type: false,
1380+
show_default_items: false,
1381+
show_non_assoc_items: false,
1382+
toggle_open_by_default: false,
1383+
},
13741384
);
13751385
}
13761386

src/test/rustdoc-gui/implementors.goml

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
goto: file://|DOC_PATH|/implementors/trait.Whatever.html
44
assert: "#implementors-list"
55
// There are supposed to be two implementors listed.
6-
assert-count: ("#implementors-list > .impl", 2)
6+
assert-count: ("#implementors-list .impl", 2)
77
// Now we check that both implementors have an anchor, an ID and a similar DOM.
8-
assert: ("#implementors-list > .impl:nth-child(1) > a.anchor")
9-
assert-attribute: ("#implementors-list > .impl:nth-child(1)", {"id": "impl-Whatever"})
10-
assert-attribute: ("#implementors-list > .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"})
11-
assert: "#implementors-list > .impl:nth-child(1) > .code-header.in-band"
8+
assert: ("#implementors-list .impl:nth-child(1) > a.anchor")
9+
assert-attribute: ("#implementors-list .impl:nth-child(1)", {"id": "impl-Whatever"})
10+
assert-attribute: ("#implementors-list .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"})
11+
assert: "#implementors-list .impl:nth-child(1) > .code-header.in-band"
1212

13-
assert: ("#implementors-list > .impl:nth-child(2) > a.anchor")
14-
assert-attribute: ("#implementors-list > .impl:nth-child(2)", {"id": "impl-Whatever-1"})
15-
assert-attribute: ("#implementors-list > .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"})
16-
assert: "#implementors-list > .impl:nth-child(2) > .code-header.in-band"
13+
assert: ("#implementors-list .impl:nth-child(2) > a.anchor")
14+
assert-attribute: ("#implementors-list .impl:nth-child(2)", {"id": "impl-Whatever-1"})
15+
assert-attribute: ("#implementors-list .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"})
16+
assert: "#implementors-list .impl:nth-child(2) > .code-header.in-band"
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
pub trait Whatever {
2+
type Foo;
3+
24
fn method() {}
35
}
46

57
pub struct Struct;
68

7-
impl Whatever for Struct {}
9+
impl Whatever for Struct {
10+
type Foo = u8;
11+
}

src/test/rustdoc-gui/src/lib2/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ impl Trait for Foo {
3838
}
3939

4040

41-
impl implementors::Whatever for Foo {}
41+
impl implementors::Whatever for Foo {
42+
type Foo = u32;
43+
}
4244

4345
pub mod sub_mod {
4446
/// ```txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This test ensures that the implementors toggle are not open by default.
2+
goto: file://|DOC_PATH|/implementors/trait.Whatever.html
3+
4+
assert-attribute-false: ("#implementors-list > details", {"open": ""}, ALL)

0 commit comments

Comments
 (0)