Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions compiler/rustc_attr_parsing/src/attributes/crate_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ impl<S: Stage> SingleAttributeParser<S> for CrateNameParser {
return None;
};

Some(AttributeKind::CrateName {
name,
name_span: n.value_span,
attr_span: cx.attr_span,
style: cx.attr_style,
})
Some(AttributeKind::CrateName { name, name_span: n.value_span, attr_span: cx.attr_span })
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/attrs/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ pub enum AttributeKind {
Coverage(Span, CoverageAttrKind),

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

/// Represents `#[custom_mir]`.
CustomMir(Option<(MirDialect, Span)>, Option<(MirPhase, Span)>, Span),
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_query_system/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ query_system_cycle_stack_single = ...which immediately requires {$stack_bottom}
query_system_cycle_usage = cycle used when {$usage}

query_system_increment_compilation = internal compiler error: encountered incremental compilation error with {$dep_node}
.help = This is a known issue with the compiler. Run {$run_cmd} to allow your project to compile

query_system_increment_compilation_note1 = please follow the instructions below to create a bug report with the provided information
query_system_increment_compilation_note2 = see <https://github.com/rust-lang/rust/issues/84970> for more information
query_system_increment_compilation_note2 = for incremental compilation bugs, having a reproduction is vital
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
query_system_increment_compilation_note4 = as a workaround, you can run {$run_cmd} to allow your project to compile

query_system_overflow_note = query depth increased by {$depth} when {$desc}

Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_query_system/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ pub(crate) struct Reentrant;

#[derive(Diagnostic)]
#[diag(query_system_increment_compilation)]
#[help]
#[note(query_system_increment_compilation_note1)]
#[note(query_system_increment_compilation_note2)]
#[note(query_system_increment_compilation_note3)]
#[note(query_system_increment_compilation_note4)]
pub(crate) struct IncrementCompilation {
pub run_cmd: String,
pub dep_node: String,
Expand Down
26 changes: 26 additions & 0 deletions src/doc/style-guide/src/nightly.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,29 @@ This chapter documents style and formatting for nightly-only syntax. The rest of
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.

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.

### Frontmatter

*Location: Placed before comments and attributes in the [root](index.html).*

*Tracking issue: [#136889](https://github.com/rust-lang/rust/issues/136889)*

*Feature gate: `frontmatter`*

There should be no blank lines between the frontmatter and either the start of the file or a shebang.
There can be zero or one line between the frontmatter and any following content.

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
content, with a minimum of 3 to be recognized as frontmatter delimiters).
If an infostring is present after the opening fence, there should be one space separating them.
The frontmatter fence lines should not have trailing whitespace.

```rust
#!/usr/bin/env cargo
--- cargo
[dependencies]
regex = "1"
---

fn main() {}
```
3 changes: 1 addition & 2 deletions src/librustdoc/html/render/span_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use rustc_hir::intravisit::{self, Visitor, VisitorExt};
use rustc_hir::{ExprKind, HirId, Item, ItemKind, Mod, Node, QPath};
use rustc_middle::hir::nested_filter;
use rustc_middle::ty::TyCtxt;
use rustc_span::hygiene::MacroKind;
use rustc_span::{BytePos, ExpnKind};

use crate::clean::{self, PrimitiveType, rustc_span};
Expand Down Expand Up @@ -194,7 +193,7 @@ impl SpanMapVisitor<'_> {
}

let macro_name = match data.kind {
ExpnKind::Macro(MacroKind::Bang, macro_name) => macro_name,
ExpnKind::Macro(_, macro_name) => macro_name,
// Even though we don't handle this kind of macro, this `data` still comes from
// expansion so we return `true` so we don't go any deeper in this code.
_ => return true,
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/passes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ pub(crate) const DEFAULT_PASSES: &[ConditionalPass] = &[
ConditionalPass::always(CHECK_DOC_TEST_VISIBILITY),
ConditionalPass::always(CHECK_DOC_CFG),
ConditionalPass::always(STRIP_ALIASED_NON_LOCAL),
ConditionalPass::always(PROPAGATE_DOC_CFG),
ConditionalPass::new(STRIP_HIDDEN, WhenNotDocumentHidden),
ConditionalPass::new(STRIP_PRIVATE, WhenNotDocumentPrivate),
ConditionalPass::new(STRIP_PRIV_IMPORTS, WhenDocumentPrivate),
ConditionalPass::always(COLLECT_INTRA_DOC_LINKS),
ConditionalPass::always(PROPAGATE_DOC_CFG),
ConditionalPass::always(PROPAGATE_STABILITY),
ConditionalPass::always(RUN_LINTS),
];
Expand Down
17 changes: 17 additions & 0 deletions tests/rustdoc-ui/invalid-cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,20 @@
#[doc(cfg = "x")] //~ ERROR not followed by parentheses
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates
pub struct S {}

// We check it also fails on private items.
#[doc(cfg = "x")] //~ ERROR not followed by parentheses
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates
struct X {}

// We check it also fails on hidden items.
#[doc(cfg = "x")] //~ ERROR not followed by parentheses
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates
#[doc(hidden)]
pub struct Y {}

// We check it also fails on hidden AND private items.
#[doc(cfg = "x")] //~ ERROR not followed by parentheses
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates
#[doc(hidden)]
struct Z {}
38 changes: 37 additions & 1 deletion tests/rustdoc-ui/invalid-cfg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,41 @@ error: multiple `cfg` predicates are specified
LL | #[doc(cfg(x, y))]
| ^

error: aborting due to 2 previous errors
error: `cfg` is not followed by parentheses
--> $DIR/invalid-cfg.rs:7:7
|
LL | #[doc(cfg = "x")]
| ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`

error: multiple `cfg` predicates are specified
--> $DIR/invalid-cfg.rs:8:14
|
LL | #[doc(cfg(x, y))]
| ^

error: `cfg` is not followed by parentheses
--> $DIR/invalid-cfg.rs:12:7
|
LL | #[doc(cfg = "x")]
| ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`

error: multiple `cfg` predicates are specified
--> $DIR/invalid-cfg.rs:13:14
|
LL | #[doc(cfg(x, y))]
| ^

error: `cfg` is not followed by parentheses
--> $DIR/invalid-cfg.rs:18:7
|
LL | #[doc(cfg = "x")]
| ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`

error: multiple `cfg` predicates are specified
--> $DIR/invalid-cfg.rs:19:14
|
LL | #[doc(cfg(x, y))]
| ^

error: aborting due to 8 previous errors

2 changes: 1 addition & 1 deletion tests/rustdoc-ui/issues/issue-91713.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ Default passes for rustdoc:
check_doc_test_visibility
check-doc-cfg
strip-aliased-non-local
propagate-doc-cfg
strip-hidden (when not --document-hidden-items)
strip-private (when not --document-private-items)
strip-priv-imports (when --document-private-items)
collect-intra-doc-links
propagate-doc-cfg
propagate-stability
run-lints

Expand Down
3 changes: 3 additions & 0 deletions tests/rustdoc/jump-to-def-assoc-items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ impl C {
pub fn wat() {}
}

//@ has - '//a[@href="{{channel}}/core/fmt/macros/macro.Debug.html"]' 'Debug'
//@ has - '//a[@href="{{channel}}/core/cmp/macro.PartialEq.html"]' 'PartialEq'
#[derive(Debug, PartialEq)]
pub struct Bar;
impl Trait for Bar {
type T = Foo;
Expand Down
Loading