Skip to content

Commit 1d23d06

Browse files
committed
Auto merge of rust-lang#147997 - jhpratt:rollup-nupruru, r=jhpratt
Rollup of 5 pull requests Successful merges: - rust-lang#145617 (docs(style): Specify the frontmatter style) - rust-lang#147830 (Reword unstable fingerprints ICE to ask for reproduction) - rust-lang#147988 (Remove unused field `style` from `AttributeKind::CrateName`) - rust-lang#147990 (Fix invalid jump to def link generated on derive attributes) - rust-lang#147991 ([rustdoc] Check `doc(cfg())` even of private/hidden items) r? `@ghost` `@rustbot` modify labels: rollup
2 parents dc1feab + 071b9de commit 1d23d06

File tree

11 files changed

+93
-15
lines changed

11 files changed

+93
-15
lines changed

compiler/rustc_attr_parsing/src/attributes/crate_level.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@ impl<S: Stage> SingleAttributeParser<S> for CrateNameParser {
2020
return None;
2121
};
2222

23-
Some(AttributeKind::CrateName {
24-
name,
25-
name_span: n.value_span,
26-
attr_span: cx.attr_span,
27-
style: cx.attr_style,
28-
})
23+
Some(AttributeKind::CrateName { name, name_span: n.value_span, attr_span: cx.attr_span })
2924
}
3025
}
3126

compiler/rustc_hir/src/attrs/data_structures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ pub enum AttributeKind {
499499
Coverage(Span, CoverageAttrKind),
500500

501501
/// Represents `#[crate_name = ...]`
502-
CrateName { name: Symbol, name_span: Span, attr_span: Span, style: AttrStyle },
502+
CrateName { name: Symbol, name_span: Span, attr_span: Span },
503503

504504
/// Represents `#[custom_mir]`.
505505
CustomMir(Option<(MirDialect, Span)>, Option<(MirPhase, Span)>, Span),

compiler/rustc_query_system/messages.ftl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ query_system_cycle_stack_single = ...which immediately requires {$stack_bottom}
1616
query_system_cycle_usage = cycle used when {$usage}
1717
1818
query_system_increment_compilation = internal compiler error: encountered incremental compilation error with {$dep_node}
19-
.help = This is a known issue with the compiler. Run {$run_cmd} to allow your project to compile
2019
2120
query_system_increment_compilation_note1 = please follow the instructions below to create a bug report with the provided information
22-
query_system_increment_compilation_note2 = see <https://github.com/rust-lang/rust/issues/84970> for more information
21+
query_system_increment_compilation_note2 = for incremental compilation bugs, having a reproduction is vital
22+
query_system_increment_compilation_note3 = an ideal reproduction consists of the code before and some patch that then triggers the bug when applied and compiled again
23+
query_system_increment_compilation_note4 = as a workaround, you can run {$run_cmd} to allow your project to compile
2324
2425
query_system_overflow_note = query depth increased by {$depth} when {$desc}
2526

compiler/rustc_query_system/src/error.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ pub(crate) struct Reentrant;
6969

7070
#[derive(Diagnostic)]
7171
#[diag(query_system_increment_compilation)]
72-
#[help]
7372
#[note(query_system_increment_compilation_note1)]
7473
#[note(query_system_increment_compilation_note2)]
74+
#[note(query_system_increment_compilation_note3)]
75+
#[note(query_system_increment_compilation_note4)]
7576
pub(crate) struct IncrementCompilation {
7677
pub run_cmd: String,
7778
pub dep_node: String,

src/doc/style-guide/src/nightly.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,29 @@ This chapter documents style and formatting for nightly-only syntax. The rest of
55
Style and formatting for nightly-only syntax should be removed from this chapter and integrated into the appropriate sections of the style guide at the time of stabilization.
66

77
There is no guarantee of the stability of this chapter in contrast to the rest of the style guide. Refer to the style team policy for nightly formatting procedure regarding breaking changes to this chapter.
8+
9+
### Frontmatter
10+
11+
*Location: Placed before comments and attributes in the [root](index.html).*
12+
13+
*Tracking issue: [#136889](https://github.com/rust-lang/rust/issues/136889)*
14+
15+
*Feature gate: `frontmatter`*
16+
17+
There should be no blank lines between the frontmatter and either the start of the file or a shebang.
18+
There can be zero or one line between the frontmatter and any following content.
19+
20+
The frontmatter fences should use the minimum number of dashes necessary for the contained content (one more than the longest series of initial dashes in the
21+
content, with a minimum of 3 to be recognized as frontmatter delimiters).
22+
If an infostring is present after the opening fence, there should be one space separating them.
23+
The frontmatter fence lines should not have trailing whitespace.
24+
25+
```rust
26+
#!/usr/bin/env cargo
27+
--- cargo
28+
[dependencies]
29+
regex = "1"
30+
---
31+
32+
fn main() {}
33+
```

src/librustdoc/html/render/span_map.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use rustc_hir::intravisit::{self, Visitor, VisitorExt};
77
use rustc_hir::{ExprKind, HirId, Item, ItemKind, Mod, Node, QPath};
88
use rustc_middle::hir::nested_filter;
99
use rustc_middle::ty::TyCtxt;
10-
use rustc_span::hygiene::MacroKind;
1110
use rustc_span::{BytePos, ExpnKind};
1211

1312
use crate::clean::{self, PrimitiveType, rustc_span};
@@ -194,7 +193,7 @@ impl SpanMapVisitor<'_> {
194193
}
195194

196195
let macro_name = match data.kind {
197-
ExpnKind::Macro(MacroKind::Bang, macro_name) => macro_name,
196+
ExpnKind::Macro(_, macro_name) => macro_name,
198197
// Even though we don't handle this kind of macro, this `data` still comes from
199198
// expansion so we return `true` so we don't go any deeper in this code.
200199
_ => return true,

src/librustdoc/passes/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ pub(crate) const DEFAULT_PASSES: &[ConditionalPass] = &[
9595
ConditionalPass::always(CHECK_DOC_TEST_VISIBILITY),
9696
ConditionalPass::always(CHECK_DOC_CFG),
9797
ConditionalPass::always(STRIP_ALIASED_NON_LOCAL),
98+
ConditionalPass::always(PROPAGATE_DOC_CFG),
9899
ConditionalPass::new(STRIP_HIDDEN, WhenNotDocumentHidden),
99100
ConditionalPass::new(STRIP_PRIVATE, WhenNotDocumentPrivate),
100101
ConditionalPass::new(STRIP_PRIV_IMPORTS, WhenDocumentPrivate),
101102
ConditionalPass::always(COLLECT_INTRA_DOC_LINKS),
102-
ConditionalPass::always(PROPAGATE_DOC_CFG),
103103
ConditionalPass::always(PROPAGATE_STABILITY),
104104
ConditionalPass::always(RUN_LINTS),
105105
];

tests/rustdoc-ui/invalid-cfg.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,20 @@
22
#[doc(cfg = "x")] //~ ERROR not followed by parentheses
33
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates
44
pub struct S {}
5+
6+
// We check it also fails on private items.
7+
#[doc(cfg = "x")] //~ ERROR not followed by parentheses
8+
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates
9+
struct X {}
10+
11+
// We check it also fails on hidden items.
12+
#[doc(cfg = "x")] //~ ERROR not followed by parentheses
13+
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates
14+
#[doc(hidden)]
15+
pub struct Y {}
16+
17+
// We check it also fails on hidden AND private items.
18+
#[doc(cfg = "x")] //~ ERROR not followed by parentheses
19+
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates
20+
#[doc(hidden)]
21+
struct Z {}

tests/rustdoc-ui/invalid-cfg.stderr

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,41 @@ error: multiple `cfg` predicates are specified
1010
LL | #[doc(cfg(x, y))]
1111
| ^
1212

13-
error: aborting due to 2 previous errors
13+
error: `cfg` is not followed by parentheses
14+
--> $DIR/invalid-cfg.rs:7:7
15+
|
16+
LL | #[doc(cfg = "x")]
17+
| ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
18+
19+
error: multiple `cfg` predicates are specified
20+
--> $DIR/invalid-cfg.rs:8:14
21+
|
22+
LL | #[doc(cfg(x, y))]
23+
| ^
24+
25+
error: `cfg` is not followed by parentheses
26+
--> $DIR/invalid-cfg.rs:12:7
27+
|
28+
LL | #[doc(cfg = "x")]
29+
| ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
30+
31+
error: multiple `cfg` predicates are specified
32+
--> $DIR/invalid-cfg.rs:13:14
33+
|
34+
LL | #[doc(cfg(x, y))]
35+
| ^
36+
37+
error: `cfg` is not followed by parentheses
38+
--> $DIR/invalid-cfg.rs:18:7
39+
|
40+
LL | #[doc(cfg = "x")]
41+
| ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
42+
43+
error: multiple `cfg` predicates are specified
44+
--> $DIR/invalid-cfg.rs:19:14
45+
|
46+
LL | #[doc(cfg(x, y))]
47+
| ^
48+
49+
error: aborting due to 8 previous errors
1450

tests/rustdoc-ui/issues/issue-91713.stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ Default passes for rustdoc:
1717
check_doc_test_visibility
1818
check-doc-cfg
1919
strip-aliased-non-local
20+
propagate-doc-cfg
2021
strip-hidden (when not --document-hidden-items)
2122
strip-private (when not --document-private-items)
2223
strip-priv-imports (when --document-private-items)
2324
collect-intra-doc-links
24-
propagate-doc-cfg
2525
propagate-stability
2626
run-lints
2727

0 commit comments

Comments
 (0)