Skip to content

Commit 7f9ab03

Browse files
committed
Auto merge of #85886 - GuillaumeGomez:rollup-l3yr3np, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - #85473 (fix split-debuginfo error message) - #85622 (Remove toggle for "undocumented items.") - #85826 (Mention "null pointer optimization" in option docs.) - #85860 (Fix details rustdoc toggle for blanket impl) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1160cf8 + 82b84bf commit 7f9ab03

File tree

11 files changed

+68
-57
lines changed

11 files changed

+68
-57
lines changed

compiler/rustc_session/src/options.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ mod desc {
368368
pub const parse_target_feature: &str = parse_string;
369369
pub const parse_wasi_exec_model: &str = "either `command` or `reactor`";
370370
pub const parse_split_debuginfo: &str =
371-
"one of supported split-debuginfo modes (`off` or `dsymutil`)";
371+
"one of supported split-debuginfo modes (`off`, `packed`, or `unpacked`)";
372372
}
373373

374374
mod parse {

library/core/src/option.rs

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383
//! * [`ptr::NonNull<U>`]
8484
//! * `#[repr(transparent)]` struct around one of the types in this list.
8585
//!
86+
//! This is called the "null pointer optimization" or NPO.
87+
//!
8688
//! It is further guaranteed that, for the cases above, one can
8789
//! [`mem::transmute`] from all valid values of `T` to `Option<T>` and
8890
//! from `Some::<T>(_)` to `T` (but transmuting `None::<T>` to `T`

src/librustdoc/html/render/mod.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -1649,16 +1649,10 @@ fn render_impl(
16491649
);
16501650
}
16511651
}
1652-
if toggled {
1653-
w.write_str("<div class=\"impl-items\">");
1654-
w.push_buffer(default_impl_items);
1655-
if trait_.is_some() && !impl_items.is_empty() {
1656-
w.write_str("<details class=\"undocumented\"><summary></summary>");
1657-
close_tags.insert_str(0, "</details>");
1658-
}
1659-
w.push_buffer(impl_items);
1660-
close_tags.insert_str(0, "</div>");
1661-
}
1652+
w.write_str("<div class=\"impl-items\">");
1653+
w.push_buffer(default_impl_items);
1654+
w.push_buffer(impl_items);
1655+
close_tags.insert_str(0, "</div>");
16621656
w.write_str(&close_tags);
16631657
}
16641658

src/librustdoc/html/static/rustdoc.css

+1-2
Original file line numberDiff line numberDiff line change
@@ -1468,13 +1468,12 @@ details.rustdoc-toggle > summary.hideme::before {
14681468
details.rustdoc-toggle > summary:not(.hideme)::before {
14691469
position: absolute;
14701470
left: -23px;
1471-
top: initial;
1471+
top: 3px;
14721472
}
14731473

14741474
.impl-items > details.rustdoc-toggle > summary:not(.hideme)::before,
14751475
.undocumented > details.rustdoc-toggle > summary:not(.hideme)::before {
14761476
position: absolute;
1477-
top: 3px;
14781477
left: -2px;
14791478
}
14801479

src/test/rustdoc/assoc-consts.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,12 @@ impl Qux for Bar {
8888
/// Docs for QUX1 in impl.
8989
const QUX1: i8 = 5;
9090
// @has - '//*[@id="associatedconstant.QUX_DEFAULT0"]' 'const QUX_DEFAULT0: u16'
91-
// @!has - '//div[@class="impl-items"]/details[@open=""]//*[@class="docblock"]' "Docs for QUX_DEFAULT12 in trait."
92-
// @has - '//div[@class="impl-items"]/details//*[@class="docblock"]' "Docs for QUX_DEFAULT12 in trait."
91+
// @has - '//div[@class="impl-items"]//*[@class="docblock"]' "Docs for QUX_DEFAULT12 in trait."
9392
const QUX_DEFAULT0: u16 = 6;
9493
// @has - '//*[@id="associatedconstant.QUX_DEFAULT1"]' 'const QUX_DEFAULT1: i16'
9594
// @has - '//*[@class="docblock"]' "Docs for QUX_DEFAULT1 in impl."
9695
/// Docs for QUX_DEFAULT1 in impl.
9796
const QUX_DEFAULT1: i16 = 7;
9897
// @has - '//*[@id="associatedconstant.QUX_DEFAULT2"]' 'const QUX_DEFAULT2: u32'
99-
// @!has - '//div[@class="impl-items"]/details[@open=""]//*[@class="docblock"]' "Docs for QUX_DEFAULT2 in trait."
100-
// @has - '//div[@class="impl-items"]/details//*[@class="docblock"]' "Docs for QUX_DEFAULT2 in trait."
98+
// @has - '//div[@class="impl-items"]//*[@class="docblock"]' "Docs for QUX_DEFAULT2 in trait."
10199
}

src/test/rustdoc/inline_cross/assoc-items.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,15 @@ extern crate assoc_items;
1616
// @has - '//*[@id="associatedconstant.ConstNoDefault"]' 'const ConstNoDefault: i16'
1717
// @has - '//*[@class="docblock"]' 'dox for ConstNoDefault'
1818
// @has - '//*[@id="associatedconstant.ConstWithDefault"]' 'const ConstWithDefault: u16'
19-
// @!has - '//details[@open=""]/details/div[@class="docblock"]' 'docs for ConstWithDefault'
20-
// @has - '//details/details/div[@class="docblock"]' 'docs for ConstWithDefault'
19+
// @has - '//div[@class="docblock"]' 'docs for ConstWithDefault'
2120
// @has - '//*[@id="associatedtype.TypeNoDefault"]' 'type TypeNoDefault = i32'
2221
// @has - '//*[@class="docblock"]' 'dox for TypeNoDefault'
2322
// @has - '//*[@id="associatedtype.TypeWithDefault"]' 'type TypeWithDefault = u32'
24-
// @!has - '//details[@open=""]/details/div[@class="docblock"]' 'docs for TypeWithDefault'
25-
// @has - '//details/details/div[@class="docblock"]' 'docs for TypeWithDefault'
23+
// @has - '//div[@class="docblock"]' 'docs for TypeWithDefault'
2624
// @has - '//*[@id="method.method_no_default"]' 'fn method_no_default()'
2725
// @has - '//*[@class="docblock"]' 'dox for method_no_default'
2826
// @has - '//*[@id="method.method_with_default"]' 'fn method_with_default()'
29-
// @!has - '//details[@open=""]/details/div[@class="docblock"]' 'docs for method_with_default'
30-
// @has - '//details/details/div[@class="docblock"]' 'docs for method_with_default'
27+
// @has - '//div[@class="docblock"]' 'docs for method_with_default'
3128
pub use assoc_items::MyStruct;
3229

3330
// @has foo/trait.MyTrait.html

src/test/rustdoc/inline_cross/impl-inline-without-trait.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ extern crate impl_inline_without_trait;
88

99
// @has 'foo/struct.MyStruct.html'
1010
// @has - '//*[@id="method.my_trait_method"]' 'fn my_trait_method()'
11-
// @!has - '//details[@open=""]/details/div[@class="docblock"]' 'docs for my_trait_method'
12-
// @has - '//details/details/div[@class="docblock"]' 'docs for my_trait_method'
11+
// @has - '//div[@class="docblock"]' 'docs for my_trait_method'
1312
pub use impl_inline_without_trait::MyStruct;

src/test/rustdoc/manual_impl.rs

+7-15
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@ pub trait T {
2424
// @has - '//*[@class="docblock"]' 'Docs associated with the S1 trait implementation.'
2525
// @has - '//*[@class="docblock"]' 'Docs associated with the S1 trait a_method implementation.'
2626
// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
27-
// @!has - '//div[@class="impl-items"]/details[@open=""]//div[@class="docblock"]' 'Docs associated with the trait b_method definition.'
28-
// @has - '//div[@class="impl-items"]/details//div[@class="docblock"]' 'Docs associated with the trait b_method definition.'
29-
// @!has - '//div[@class="impl-items"]/details[@open=""]//div[@class="docblock"]' 'Docs associated with the trait c_method definition.'
30-
// @has - '//div[@class="impl-items"]/details//div[@class="docblock"]' 'Docs associated with the trait c_method definition.'
27+
// @has - '//div[@class="impl-items"]//div[@class="docblock"]' 'Docs associated with the trait b_method definition.'
28+
// @has - '//div[@class="impl-items"]//div[@class="docblock"]' 'Docs associated with the trait c_method definition.'
3129
// @!has - '//*[@class="docblock"]' 'There is another line'
32-
// @!has - '//div[@class="impl-items"]/details[@open=""]//div[@class="docblock"]' 'Read more'
33-
// @has - '//div[@class="impl-items"]/details//div[@class="docblock"]' 'Read more'
30+
// @has - '//div[@class="impl-items"]//div[@class="docblock"]' 'Read more'
3431
pub struct S1(usize);
3532

3633
/// Docs associated with the S1 trait implementation.
@@ -45,10 +42,7 @@ impl T for S1 {
4542
// @has - '//*[@class="docblock"]' 'Docs associated with the S2 trait implementation.'
4643
// @has - '//*[@class="docblock"]' 'Docs associated with the S2 trait a_method implementation.'
4744
// @has - '//*[@class="docblock"]' 'Docs associated with the S2 trait c_method implementation.'
48-
// @!has - '//details[open=""]/div[@class="docblock"]' 'Docs associated with the trait a_method definition.'
49-
// @!has - '//details[open=""]/div[@class="docblock"]' 'Docs associated with the trait c_method definition.'
50-
// @!has - '//div[@class="impl-items"]/details[@open=""]//div[@class="docblock"]' 'Docs associated with the trait b_method definition.'
51-
// @has - '//div[@class="impl-items"]/details//div[@class="docblock"]' 'Docs associated with the trait b_method definition.'
45+
// @has - '//div[@class="impl-items"]//div[@class="docblock"]' 'Docs associated with the trait b_method definition.'
5246
pub struct S2(usize);
5347

5448
/// Docs associated with the S2 trait implementation.
@@ -65,11 +59,9 @@ impl T for S2 {
6559
}
6660

6761
// @has manual_impl/struct.S3.html '//*[@class="trait"]' 'T'
68-
// @has - '//details/div[@class="docblock"]' 'Docs associated with the S3 trait implementation.'
69-
// @!has - '//details[@open=""]/div[@class="docblock"]' 'Docs associated with the S3 trait implementation.'
70-
// @has - '//details[@open=""]/div[@class="docblock"]' 'Docs associated with the S3 trait b_method implementation.'
71-
// @!has - '//div[@class="impl-items"]/details[@open=""]//div[@class="docblock"]' 'Docs associated with the trait a_method definition.'
72-
// @has - '//div[@class="impl-items"]/details//div[@class="docblock"]' 'Docs associated with the trait a_method definition.'
62+
// @has - '//div[@class="docblock"]' 'Docs associated with the S3 trait implementation.'
63+
// @has - '//div[@class="docblock"]' 'Docs associated with the S3 trait b_method implementation.'
64+
// @has - '//div[@class="impl-items"]//div[@class="docblock"]' 'Docs associated with the trait a_method definition.'
7365
pub struct S3(usize);
7466

7567
/// Docs associated with the S3 trait implementation.

src/test/rustdoc/item-hide-threshold.rs src/test/rustdoc/toggle-item-contents.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#![allow(unused)]
22

3-
// @has 'item_hide_threshold/struct.PubStruct.html'
3+
// @has 'toggle_item_contents/struct.PubStruct.html'
44
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0
55
pub struct PubStruct {
66
pub a: usize,
77
pub b: usize,
88
}
99

10-
// @has 'item_hide_threshold/struct.BigPubStruct.html'
10+
// @has 'toggle_item_contents/struct.BigPubStruct.html'
1111
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
1212
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show fields'
1313
pub struct BigPubStruct {
@@ -26,7 +26,7 @@ pub struct BigPubStruct {
2626
pub m: usize,
2727
}
2828

29-
// @has 'item_hide_threshold/union.BigUnion.html'
29+
// @has 'toggle_item_contents/union.BigUnion.html'
3030
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
3131
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show fields'
3232
pub union BigUnion {
@@ -45,23 +45,23 @@ pub union BigUnion {
4545
pub m: usize,
4646
}
4747

48-
// @has 'item_hide_threshold/union.Union.html'
48+
// @has 'toggle_item_contents/union.Union.html'
4949
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0
5050
pub union Union {
5151
pub a: usize,
5252
pub b: usize,
5353
pub c: usize,
5454
}
5555

56-
// @has 'item_hide_threshold/struct.PrivStruct.html'
56+
// @has 'toggle_item_contents/struct.PrivStruct.html'
5757
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0
5858
// @has - '//div[@class="docblock type-decl"]' 'fields omitted'
5959
pub struct PrivStruct {
6060
a: usize,
6161
b: usize,
6262
}
6363

64-
// @has 'item_hide_threshold/enum.Enum.html'
64+
// @has 'toggle_item_contents/enum.Enum.html'
6565
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
6666
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show fields'
6767
pub enum Enum {
@@ -72,14 +72,14 @@ pub enum Enum {
7272
}
7373
}
7474

75-
// @has 'item_hide_threshold/enum.LargeEnum.html'
75+
// @has 'toggle_item_contents/enum.LargeEnum.html'
7676
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
7777
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show variants'
7878
pub enum LargeEnum {
7979
A, B, C, D, E, F(u8), G, H, I, J, K, L, M
8080
}
8181

82-
// @has 'item_hide_threshold/trait.Trait.html'
82+
// @has 'toggle_item_contents/trait.Trait.html'
8383
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0
8484
pub trait Trait {
8585
type A;
@@ -88,7 +88,7 @@ pub trait Trait {
8888
fn bar();
8989
}
9090

91-
// @has 'item_hide_threshold/trait.GinormousTrait.html'
91+
// @has 'toggle_item_contents/trait.GinormousTrait.html'
9292
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
9393
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show associated items'
9494
pub trait GinormousTrait {
@@ -111,7 +111,7 @@ pub trait GinormousTrait {
111111
fn bar();
112112
}
113113

114-
// @has 'item_hide_threshold/trait.HugeTrait.html'
114+
// @has 'toggle_item_contents/trait.HugeTrait.html'
115115
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
116116
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show associated constants and methods'
117117
pub trait HugeTrait {
@@ -133,7 +133,7 @@ pub trait HugeTrait {
133133
fn bar();
134134
}
135135

136-
// @has 'item_hide_threshold/trait.BigTrait.html'
136+
// @has 'toggle_item_contents/trait.BigTrait.html'
137137
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
138138
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show methods'
139139
pub trait BigTrait {

src/test/rustdoc/toggle-method.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#![crate_name = "foo"]
2+
3+
// Struct methods with documentation should be wrapped in a <details> toggle with an appropriate
4+
// summary. Struct methods with no documentation should not be wrapped.
5+
//
6+
// @has foo/struct.Foo.html
7+
// @has - '//details[@class="rustdoc-toggle method-toggle"]//summary//code' 'is_documented()'
8+
// @has - '//details[@class="rustdoc-toggle method-toggle"]//*[@class="docblock"]' 'is_documented is documented'
9+
// @!has - '//details[@class="rustdoc-toggle method-toggle"]//summary//code' 'not_documented()'
10+
pub struct Foo {
11+
}
12+
13+
impl Foo {
14+
pub fn not_documented() {}
15+
16+
/// is_documented is documented
17+
pub fn is_documented() {}
18+
}

src/test/rustdoc/toggle-trait-fn.rs

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
#![crate_name = "foo"]
22

3+
// Trait methods with documentation should be wrapped in a <details> toggle with an appropriate
4+
// summary. Trait methods with no documentation should not be wrapped.
5+
//
36
// @has foo/trait.Foo.html
4-
// @!has - '//details[@class="rustdoc-toggle"]//code' 'bar'
5-
// @has - '//code' 'bar'
6-
// @has - '//details[@class="rustdoc-toggle"]//code' 'foo'
7+
// @has - '//details[@class="rustdoc-toggle"]//summary//code' 'is_documented()'
8+
// @!has - '//details[@class="rustdoc-toggle"]//summary//code' 'not_documented()'
9+
// @has - '//details[@class="rustdoc-toggle"]//*[@class="docblock"]' 'is_documented is documented'
10+
// @has - '//details[@class="rustdoc-toggle"]//summary//code' 'is_documented_optional()'
11+
// @!has - '//details[@class="rustdoc-toggle"]//summary//code' 'not_documented_optional()'
12+
// @has - '//details[@class="rustdoc-toggle"]//*[@class="docblock"]' 'is_documented_optional is documented'
713
pub trait Foo {
8-
fn bar() -> ();
9-
/// hello
10-
fn foo();
14+
fn not_documented();
15+
16+
/// is_documented is documented
17+
fn is_documented();
18+
19+
fn not_documented_optional() {}
20+
21+
/// is_documented_optional is documented
22+
fn is_documented_optional() {}
1123
}

0 commit comments

Comments
 (0)