Rename doctest attribute standalone-crate
into standalone_crate
for coherency
This commit is contained in:
parent
632fed891d
commit
6f5f21adfc
@ -44,7 +44,7 @@ impl<'a> Location<'a> {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```standalone-crate
|
||||
/// ```standalone_crate
|
||||
/// use std::panic::Location;
|
||||
///
|
||||
/// /// Returns the [`Location`] at which it is called.
|
||||
|
@ -414,11 +414,11 @@ In some cases, doctests cannot be merged. For example, if you have:
|
||||
The problem with this code is that, if you change any other doctests, it'll likely break when
|
||||
runing `rustdoc --test`, making it tricky to maintain.
|
||||
|
||||
This is where the `standalone-crate` attribute comes in: it tells `rustdoc` that a doctest
|
||||
This is where the `standalone_crate` attribute comes in: it tells `rustdoc` that a doctest
|
||||
should not be merged with the others. So the previous code should use it:
|
||||
|
||||
```rust
|
||||
//! ```standalone-crate
|
||||
//! ```standalone_crate
|
||||
//! let location = std::panic::Location::caller();
|
||||
//! assert_eq!(location.line(), 4);
|
||||
//! ```
|
||||
|
@ -1264,7 +1264,7 @@ fn parse(
|
||||
seen_rust_tags = !seen_other_tags || seen_rust_tags;
|
||||
data.no_run = true;
|
||||
}
|
||||
LangStringToken::LangToken("standalone-crate") => {
|
||||
LangStringToken::LangToken("standalone_crate") => {
|
||||
data.standalone_crate = true;
|
||||
seen_rust_tags = !seen_other_tags || seen_rust_tags;
|
||||
}
|
||||
@ -1315,12 +1315,12 @@ fn parse(
|
||||
"use `test_harness` to run functions marked `#[test]` instead of a \
|
||||
potentially-implicit `main` function",
|
||||
),
|
||||
"standalone" | "standalone_crate" => {
|
||||
"standalone" | "standalone_crate" | "standalone-crate" => {
|
||||
if let Some(extra) = extra
|
||||
&& extra.sp.at_least_rust_2024()
|
||||
{
|
||||
Some(
|
||||
"use `standalone-crate` to compile this code block \
|
||||
"use `standalone_crate` to compile this code block \
|
||||
separately",
|
||||
)
|
||||
} else {
|
||||
|
@ -1,11 +1,11 @@
|
||||
#![crate_name = "foo"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
//! ```standalone-crate
|
||||
//! ```standalone_crate
|
||||
//! foo::init();
|
||||
//! ```
|
||||
|
||||
/// ```standalone-crate
|
||||
/// ```standalone_crate
|
||||
/// foo::init();
|
||||
/// ```
|
||||
pub fn init() {
|
||||
|
@ -11,6 +11,6 @@
|
||||
//! bla
|
||||
//! ```
|
||||
//!
|
||||
//! ```standalone_crate
|
||||
//! ```standalone-crate
|
||||
//! bla
|
||||
//! ```
|
||||
|
@ -5,12 +5,12 @@ error: unknown attribute `standalone`
|
||||
11 | | //! bla
|
||||
12 | | //! ```
|
||||
13 | | //!
|
||||
14 | | //! ```standalone_crate
|
||||
14 | | //! ```standalone-crate
|
||||
15 | | //! bla
|
||||
16 | | //! ```
|
||||
| |_______^
|
||||
|
|
||||
= help: use `standalone-crate` to compile this code block separately
|
||||
= help: use `standalone_crate` to compile this code block separately
|
||||
= help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
|
||||
note: the lint level is defined here
|
||||
--> $DIR/standalone-warning-2024.rs:8:9
|
||||
@ -19,19 +19,19 @@ note: the lint level is defined here
|
||||
| ^^^^^^^^
|
||||
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]`
|
||||
|
||||
error: unknown attribute `standalone_crate`
|
||||
error: unknown attribute `standalone-crate`
|
||||
--> $DIR/standalone-warning-2024.rs:10:1
|
||||
|
|
||||
10 | / //! ```standalone
|
||||
11 | | //! bla
|
||||
12 | | //! ```
|
||||
13 | | //!
|
||||
14 | | //! ```standalone_crate
|
||||
14 | | //! ```standalone-crate
|
||||
15 | | //! bla
|
||||
16 | | //! ```
|
||||
| |_______^
|
||||
|
|
||||
= help: use `standalone-crate` to compile this code block separately
|
||||
= help: use `standalone_crate` to compile this code block separately
|
||||
= help: this code block may be skipped during testing, because unknown attributes are treated as markers for code samples written in other programming languages, unless it is also explicitly marked as `rust`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -5,6 +5,6 @@
|
||||
//! bla
|
||||
//! ```
|
||||
//!
|
||||
//! ```standalone_crate
|
||||
//! ```standalone-crate
|
||||
//! bla
|
||||
//! ```
|
||||
|
Loading…
Reference in New Issue
Block a user