Skip to content

Commit c6e6ecb

Browse files
committed
rustdoc: remove rust logo from non-Rust crates
1 parent 6d6fa79 commit c6e6ecb

File tree

46 files changed

+208
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+208
-36
lines changed

compiler/rustc_arena/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
1212
test(no_crate_inject, attr(deny(warnings)))
1313
)]
14+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
15+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
1416
#![feature(core_intrinsics)]
1517
#![feature(dropck_eyepatch)]
1618
#![feature(new_uninit)]

compiler/rustc_ast/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
99
test(attr(deny(warnings)))
1010
)]
11+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
12+
#![cfg_attr(not(bootstrap), allow(internal_features))]
13+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
1114
#![feature(associated_type_bounds)]
1215
#![feature(box_patterns)]
1316
#![feature(const_trait_impl)]

compiler/rustc_codegen_ssa/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
3+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
4+
#![cfg_attr(not(bootstrap), allow(internal_features))]
25
#![feature(associated_type_bounds)]
36
#![feature(box_patterns)]
47
#![feature(if_let_guard)]

compiler/rustc_driver_impl/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
//! This API is completely unstable and subject to change.
66
77
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
8+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
9+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
10+
#![cfg_attr(not(bootstrap), allow(internal_features))]
811
#![feature(lazy_cell)]
912
#![feature(decl_macro)]
1013
#![feature(panic_update_hook)]

compiler/rustc_errors/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
//! This module contains the code for creating and emitting diagnostics.
44
55
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
6+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
7+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
68
#![feature(array_windows)]
79
#![feature(extract_if)]
810
#![feature(if_let_guard)]

compiler/rustc_fluent_macro/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
3+
#![cfg_attr(not(bootstrap), allow(internal_features))]
4+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
25
#![feature(proc_macro_diagnostic)]
36
#![feature(proc_macro_span)]
47
#![deny(rustc::untranslatable_diagnostic)]

compiler/rustc_graphviz/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@
273273
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
274274
test(attr(allow(unused_variables), deny(warnings)))
275275
)]
276+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
277+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
278+
#![cfg_attr(not(bootstrap), allow(internal_features))]
276279
#![deny(rustc::untranslatable_diagnostic)]
277280
#![deny(rustc::diagnostic_outside_of_impl)]
278281

compiler/rustc_hir_analysis/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ This API is completely unstable and subject to change.
5757

5858
#![allow(rustc::potential_query_instability)]
5959
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
60+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
61+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
62+
#![cfg_attr(not(bootstrap), allow(internal_features))]
6063
#![feature(box_patterns)]
6164
#![feature(control_flow_enum)]
6265
#![feature(if_let_guard)]

compiler/rustc_incremental/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
33
#![deny(missing_docs)]
44
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
5+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
6+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
7+
#![cfg_attr(not(bootstrap), allow(internal_features))]
58
#![feature(never_type)]
69
#![recursion_limit = "256"]
710
#![deny(rustc::untranslatable_diagnostic)]

compiler/rustc_infer/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
//! This API is completely unstable and subject to change.
1414
1515
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
16+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
17+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
18+
#![cfg_attr(not(bootstrap), allow(internal_features))]
1619
#![feature(associated_type_bounds)]
1720
#![feature(box_patterns)]
1821
#![feature(control_flow_enum)]

compiler/rustc_lint/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
2828
#![allow(rustc::potential_query_instability)]
2929
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
30+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
31+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
3032
#![feature(array_windows)]
3133
#![feature(box_patterns)]
3234
#![feature(control_flow_enum)]

compiler/rustc_llvm/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#![deny(rustc::untranslatable_diagnostic)]
22
#![deny(rustc::diagnostic_outside_of_impl)]
33
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
4+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
5+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
6+
#![cfg_attr(not(bootstrap), allow(internal_features))]
47

58
// NOTE: This crate only exists to allow linking on mingw targets.
69

compiler/rustc_metadata/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
3+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
4+
#![cfg_attr(not(bootstrap), allow(internal_features))]
25
#![feature(decl_macro)]
36
#![feature(extract_if)]
47
#![feature(generators)]

compiler/rustc_middle/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
//! This API is completely unstable and subject to change.
2424
2525
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
26+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
27+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
2628
#![feature(allocator_api)]
2729
#![feature(array_windows)]
2830
#![feature(assert_matches)]

compiler/rustc_parse_format/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
html_playground_url = "https://play.rust-lang.org/",
1010
test(attr(deny(warnings)))
1111
)]
12+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
13+
#![cfg_attr(not(bootstrap), allow(internal_features))]
14+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
1215
#![deny(rustc::untranslatable_diagnostic)]
1316
#![deny(rustc::diagnostic_outside_of_impl)]
1417
// We want to be able to build this crate with a stable compiler, so no

compiler/rustc_passes/src/check_attr.rs

+13
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,7 @@ impl CheckAttrVisitor<'_> {
11081108
| sym::html_root_url
11091109
| sym::html_no_source
11101110
| sym::test
1111+
| sym::rust_logo
11111112
if !self.check_attr_crate_level(attr, meta, hir_id) =>
11121113
{
11131114
is_valid = false;
@@ -1166,6 +1167,18 @@ impl CheckAttrVisitor<'_> {
11661167
| sym::plugins
11671168
| sym::fake_variadic => {}
11681169

1170+
sym::rust_logo => {
1171+
if !self.tcx.features().rustdoc_internals {
1172+
feature_err(
1173+
&self.tcx.sess.parse_sess,
1174+
sym::rustdoc_internals,
1175+
meta.span(),
1176+
"the `#[doc(rust_logo)]` attribute is used for Rust branding",
1177+
)
1178+
.emit();
1179+
}
1180+
}
1181+
11691182
sym::test => {
11701183
if !self.check_test_attr(meta, hir_id) {
11711184
is_valid = false;

compiler/rustc_passes/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
77
#![allow(rustc::potential_query_instability)]
88
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
9+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
10+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
11+
#![cfg_attr(not(bootstrap), allow(internal_features))]
912
#![feature(iter_intersperse)]
1013
#![feature(let_chains)]
1114
#![feature(map_try_insert)]

compiler/rustc_plugin_impl/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
//! of the Unstable Book for some examples.
88
99
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
10+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
11+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
12+
#![cfg_attr(not(bootstrap), allow(internal_features))]
1013
#![recursion_limit = "256"]
1114
#![deny(rustc::untranslatable_diagnostic)]
1215
#![deny(rustc::diagnostic_outside_of_impl)]

compiler/rustc_privacy/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
3+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
4+
#![cfg_attr(not(bootstrap), allow(internal_features))]
25
#![feature(associated_type_defaults)]
36
#![feature(rustc_private)]
47
#![feature(try_blocks)]

compiler/rustc_query_impl/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//! Support for serializing the dep-graph and reloading it.
22
33
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
4+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
5+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
46
// this shouldn't be necessary, but the check for `&mut _` is too naive and denies returning a function pointer that takes a mut ref
57
#![feature(const_mut_refs)]
68
#![feature(const_refs_to_cell)]

compiler/rustc_resolve/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
//! Type-relative name resolution (methods, fields, associated items) happens in `rustc_hir_analysis`.
88
99
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
10+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
11+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
1012
#![feature(assert_matches)]
1113
#![feature(box_patterns)]
1214
#![feature(extract_if)]

compiler/rustc_serialize/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
html_playground_url = "https://play.rust-lang.org/",
66
test(attr(allow(unused_variables), deny(warnings)))
77
)]
8+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
9+
#![cfg_attr(not(bootstrap), allow(internal_features))]
10+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
811
#![feature(allocator_api)]
912
#![feature(associated_type_bounds)]
1013
#![feature(const_option)]

compiler/rustc_smir/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
1111
test(attr(allow(unused_variables), deny(warnings)))
1212
)]
13+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
14+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
15+
#![cfg_attr(not(bootstrap), allow(internal_features))]
1316

1417
pub mod rustc_internal;
1518

compiler/rustc_span/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
//! This API is completely unstable and subject to change.
1515
1616
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
17+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
18+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
1719
#![feature(array_windows)]
1820
#![feature(if_let_guard)]
1921
#![feature(negative_impls)]

compiler/rustc_span/src/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,7 @@ symbols! {
13271327
rust_cold_cc,
13281328
rust_eh_catch_typeinfo,
13291329
rust_eh_personality,
1330+
rust_logo,
13301331
rustc,
13311332
rustc_abi,
13321333
rustc_allocator,

compiler/rustc_symbol_mangling/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@
8888
//! DefPaths which are much more robust in the face of changes to the code base.
8989
9090
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
91+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
92+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
93+
#![cfg_attr(not(bootstrap), allow(internal_features))]
9194
#![feature(never_type)]
9295
#![recursion_limit = "256"]
9396
#![allow(rustc::potential_query_instability)]

compiler/rustc_target/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
//! LLVM.
99
1010
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
11+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
12+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
1113
#![feature(assert_matches)]
1214
#![feature(associated_type_bounds)]
1315
#![feature(exhaustive_patterns)]

compiler/rustc_trait_selection/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
//! This API is completely unstable and subject to change.
1212
1313
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
14+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
15+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
16+
#![cfg_attr(not(bootstrap), allow(internal_features))]
1417
#![feature(associated_type_bounds)]
1518
#![feature(box_patterns)]
1619
#![feature(control_flow_enum)]

compiler/rustc_ty_utils/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
//! This API is completely unstable and subject to change.
66
77
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
8+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
9+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
10+
#![cfg_attr(not(bootstrap), allow(internal_features))]
811
#![feature(assert_matches)]
912
#![feature(iterator_try_collect)]
1013
#![feature(let_chains)]

library/alloc/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@
7878
not(no_sync),
7979
target_has_atomic = "ptr"
8080
))]
81+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
82+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
8183
#![no_std]
8284
#![needs_allocator]
8385
// Lints:

library/core/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
test(no_crate_inject, attr(deny(warnings))),
6969
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut)))
7070
)]
71+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
7172
#![doc(cfg_hide(
7273
not(test),
7374
any(not(feature = "miri-test-libstd"), test, doctest),

library/proc_macro/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
test(no_crate_inject, attr(deny(warnings))),
1818
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut)))
1919
)]
20+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
21+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
2022
// This library is copied into rust-analyzer to allow loading rustc compiled proc macros.
2123
// Please avoid unstable features where possible to minimize the amount of changes necessary
2224
// to make it compile with rust-analyzer on stable.

library/std/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@
227227
test(no_crate_inject, attr(deny(warnings))),
228228
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut)))
229229
)]
230+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
230231
#![doc(cfg_hide(
231232
not(test),
232233
not(any(test, bootstrap)),

library/test/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#![unstable(feature = "test", issue = "50297")]
1818
#![doc(test(attr(deny(warnings))))]
19+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
20+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
1921
#![feature(internal_output_capture)]
2022
#![feature(staged_api)]
2123
#![feature(process_exitcode_internals)]

src/doc/rustdoc/src/unstable-features.md

+15
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,21 @@ To do so, the `#[doc(keyword = "...")]` attribute is used. Example:
207207
mod empty_mod {}
208208
```
209209

210+
### Use the Rust logo as the crate logo
211+
212+
This is for official Rust project use only.
213+
214+
Internal Rustdoc pages like settings.html and scrape-examples-help.html show the Rust logo.
215+
This logo is tracked as a static resource. The attribute `#![doc(rust_logo)]` makes this same
216+
built-in resource act as the main logo.
217+
218+
```rust
219+
#![feature(rustdoc_internals)]
220+
#![allow(internal_features)]
221+
#![doc(rust_logo)]
222+
//! This crate has the Rust(tm) branding on it.
223+
```
224+
210225
## Effects of other nightly features
211226

212227
These nightly-only features are not primarily related to Rustdoc,

0 commit comments

Comments
 (0)