Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3c51fb8

Browse files
authoredFeb 18, 2024··
Unrolled build for rust-lang#121218
Rollup merge of rust-lang#121218 - ShoyuVanilla:fix-issue-76736, r=notriddle Fix missing trait impls for type in rustc docs Fixes rust-lang#76736
2 parents d3df8ff + f5d43a0 commit 3c51fb8

File tree

7 files changed

+74
-7
lines changed

7 files changed

+74
-7
lines changed
 

‎src/librustdoc/clean/inline.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,13 @@ pub(crate) fn build_impl(
443443
return;
444444
}
445445

446-
if let Some(stab) = tcx.lookup_stability(did)
447-
&& stab.is_unstable()
448-
&& stab.feature == sym::rustc_private
449-
{
450-
return;
446+
if !tcx.features().rustc_private && !cx.render_options.force_unstable_if_unmarked {
447+
if let Some(stab) = tcx.lookup_stability(did)
448+
&& stab.is_unstable()
449+
&& stab.feature == sym::rustc_private
450+
{
451+
return;
452+
}
451453
}
452454
}
453455

@@ -477,8 +479,11 @@ pub(crate) fn build_impl(
477479
return;
478480
}
479481

480-
if let Some(stab) = tcx.lookup_stability(did) {
481-
if stab.is_unstable() && stab.feature == sym::rustc_private {
482+
if !tcx.features().rustc_private && !cx.render_options.force_unstable_if_unmarked {
483+
if let Some(stab) = tcx.lookup_stability(did)
484+
&& stab.is_unstable()
485+
&& stab.feature == sym::rustc_private
486+
{
482487
return;
483488
}
484489
}

‎src/librustdoc/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ pub(crate) struct RenderOptions {
281281
pub(crate) no_emit_shared: bool,
282282
/// If `true`, HTML source code pages won't be generated.
283283
pub(crate) html_no_source: bool,
284+
/// Whether `-Zforce-unstable-if-unmarked` unstable option is set
285+
pub(crate) force_unstable_if_unmarked: bool,
284286
}
285287

286288
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
@@ -347,6 +349,7 @@ impl Options {
347349

348350
let codegen_options = CodegenOptions::build(early_dcx, matches);
349351
let unstable_opts = UnstableOptions::build(early_dcx, matches);
352+
let force_unstable_if_unmarked = unstable_opts.force_unstable_if_unmarked;
350353

351354
let dcx = new_dcx(error_format, None, diagnostic_width, &unstable_opts);
352355

@@ -760,6 +763,7 @@ impl Options {
760763
call_locations,
761764
no_emit_shared: false,
762765
html_no_source,
766+
force_unstable_if_unmarked,
763767
};
764768
Some((options, render_options))
765769
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(staged_api)]
2+
#![unstable(feature = "rustc_private", issue = "none")]
3+
4+
pub trait MaybeResult<T> {}
5+
6+
impl<T> MaybeResult<T> for T {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#![feature(rustc_private)]
2+
3+
extern crate issue_76736_1;
4+
5+
pub struct Bar;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// aux-build:issue-76736-1.rs
2+
// aux-build:issue-76736-2.rs
3+
4+
#![crate_name = "foo"]
5+
6+
extern crate issue_76736_1;
7+
extern crate issue_76736_2;
8+
9+
// @has foo/struct.Foo.html
10+
// @!has - '//*[@class="impl"]//h3[@class="code-header"]' 'MaybeResult'
11+
pub struct Foo;
12+
13+
// @has foo/struct.Bar.html
14+
// @!has - '//*[@class="impl"]//h3[@class="code-header"]' 'MaybeResult'
15+
pub use issue_76736_2::Bar;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// aux-build:issue-76736-1.rs
2+
// aux-build:issue-76736-2.rs
3+
4+
#![crate_name = "foo"]
5+
#![feature(rustc_private)]
6+
7+
extern crate issue_76736_1;
8+
extern crate issue_76736_2;
9+
10+
// @has foo/struct.Foo.html
11+
// @has - '//*[@class="impl"]//h3[@class="code-header"]' 'MaybeResult'
12+
pub struct Foo;
13+
14+
// @has foo/struct.Bar.html
15+
// @has - '//*[@class="impl"]//h3[@class="code-header"]' 'MaybeResult'
16+
pub use issue_76736_2::Bar;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// compile-flags: -Zforce-unstable-if-unmarked
2+
// aux-build:issue-76736-1.rs
3+
// aux-build:issue-76736-2.rs
4+
5+
#![crate_name = "foo"]
6+
7+
extern crate issue_76736_1;
8+
extern crate issue_76736_2;
9+
10+
// @has foo/struct.Foo.html
11+
// @has - '//*[@class="impl"]//h3[@class="code-header"]' 'MaybeResult'
12+
pub struct Foo;
13+
14+
// @has foo/struct.Bar.html
15+
// @has - '//*[@class="impl"]//h3[@class="code-header"]' 'MaybeResult'
16+
pub use issue_76736_2::Bar;

0 commit comments

Comments
 (0)
Please sign in to comment.