Skip to content

Commit 5a82251

Browse files
Rollup merge of #82598 - GuillaumeGomez:rustdoc-rustc-pass, r=jyn514
Check stability and feature attributes in rustdoc Fixes #82588. cc `@Nemo157` `@camelid` r? `@jyn514`
2 parents b51272e + d20fd62 commit 5a82251

File tree

7 files changed

+20
-1
lines changed

7 files changed

+20
-1
lines changed

library/std/src/os/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub use crate::sys::windows_ext as windows;
2323
pub mod linux;
2424

2525
#[cfg(doc)]
26+
#[stable(feature = "wasi_ext_doc", since = "1.35.0")]
2627
pub use crate::sys::wasi_ext as wasi;
2728

2829
// If we're not documenting libstd then we just expose the main modules as we otherwise would.

library/std/src/sys/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ cfg_if::cfg_if! {
111111
cfg_if::cfg_if! {
112112
if #[cfg(target_os = "wasi")] {
113113
// On WASI we'll document what's already available
114-
#[stable(feature = "rust1", since = "1.0.0")]
114+
#[stable(feature = "wasi_ext_doc", since = "1.35.0")]
115115
pub use self::ext as wasi_ext;
116116
} else if #[cfg(any(target_os = "hermit",
117117
target_arch = "wasm32",
@@ -125,6 +125,7 @@ cfg_if::cfg_if! {
125125
} else {
126126
// On other platforms like Windows document the bare bones of WASI
127127
#[path = "wasi/ext/mod.rs"]
128+
#[stable(feature = "wasi_ext_doc", since = "1.35.0")]
128129
pub mod wasi_ext;
129130
}
130131
}

src/librustdoc/core.rs

+1
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ crate fn run_global_ctxt(
491491
tcx.ensure().check_mod_attrs(module);
492492
}
493493
});
494+
rustc_passes::stability::check_unused_or_stable_features(tcx);
494495

495496
let access_levels = tcx.privacy_access_levels(LOCAL_CRATE);
496497
// Convert from a HirId set to a DefId set since we don't always have easy access

src/librustdoc/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ extern crate rustc_metadata;
4949
extern crate rustc_middle;
5050
extern crate rustc_mir;
5151
extern crate rustc_parse;
52+
extern crate rustc_passes;
5253
extern crate rustc_resolve;
5354
extern crate rustc_session;
5455
extern crate rustc_span as rustc_span;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#![feature(box_syntax)]
2+
#![feature(box_syntax)] //~ ERROR
3+
4+
pub fn foo() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0636]: the feature `box_syntax` has already been declared
2+
--> $DIR/rustc-check-passes.rs:2:12
3+
|
4+
LL | #![feature(box_syntax)]
5+
| ^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0636`.

src/test/rustdoc/implementor-stable-version.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![stable(feature = "bar", since = "OLD 1.0")]
12
#![crate_name = "foo"]
23

34
#![feature(staged_api)]
@@ -8,6 +9,7 @@ pub trait Bar {}
89
#[stable(feature = "baz", since = "OLD 1.0")]
910
pub trait Baz {}
1011

12+
#[stable(feature = "baz", since = "OLD 1.0")]
1113
pub struct Foo;
1214

1315
// @has foo/trait.Bar.html '//div[@id="implementors-list"]//span[@class="since"]' 'NEW 2.0'

0 commit comments

Comments
 (0)