Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ab1d67f

Browse files
committedJun 1, 2024
Auto merge of rust-lang#125848 - GuillaumeGomez:rollup-jfjee06, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - rust-lang#124577 (Stabilize `custom_code_classes_in_docs` feature) - rust-lang#125683 (Rewrite `suspicious-library`, `resolve-rename` and `incr-prev-body-beyond-eof` `run-make` tests in `rmake.rs` format) - rust-lang#125773 (Migrate run make cdylib) - rust-lang#125808 (Migrate `run-make/c-link-to-rust-dylib` to `rmake.rs`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 466be51 + a93557f commit ab1d67f

38 files changed

+248
-610
lines changed
 

‎compiler/rustc_feature/src/accepted.rs

+2
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ declare_features! (
138138
(accepted, copy_closures, "1.26.0", Some(44490)),
139139
/// Allows `crate` in paths.
140140
(accepted, crate_in_paths, "1.30.0", Some(45477)),
141+
/// Allows users to provide classes for fenced code block using `class:classname`.
142+
(accepted, custom_code_classes_in_docs, "CURRENT_RUSTC_VERSION", Some(79483)),
141143
/// Allows using `#[debugger_visualizer]` attribute.
142144
(accepted, debugger_visualizer, "1.71.0", Some(95939)),
143145
/// Allows rustc to inject a default alloc_error_handler

‎compiler/rustc_feature/src/unstable.rs

-2
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,6 @@ declare_features! (
424424
/// Allows function attribute `#[coverage(on/off)]`, to control coverage
425425
/// instrumentation of that function.
426426
(unstable, coverage_attribute, "1.74.0", Some(84605)),
427-
/// Allows users to provide classes for fenced code block using `class:classname`.
428-
(unstable, custom_code_classes_in_docs, "1.74.0", Some(79483)),
429427
/// Allows non-builtin attributes in inner attribute position.
430428
(unstable, custom_inner_attributes, "1.30.0", Some(54726)),
431429
/// Allows custom test frameworks with `#![test_runner]` and `#[test_case]`.

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

-44
Original file line numberDiff line numberDiff line change
@@ -624,47 +624,3 @@ add the `--scrape-tests` flag.
624624

625625
This flag enables the generation of links in the source code pages which allow the reader
626626
to jump to a type definition.
627-
628-
### Custom CSS classes for code blocks
629-
630-
```rust
631-
#![feature(custom_code_classes_in_docs)]
632-
633-
/// ```custom,{class=language-c}
634-
/// int main(void) { return 0; }
635-
/// ```
636-
pub struct Bar;
637-
```
638-
639-
The text `int main(void) { return 0; }` is rendered without highlighting in a code block
640-
with the class `language-c`. This can be used to highlight other languages through JavaScript
641-
libraries for example.
642-
643-
Without the `custom` attribute, it would be generated as a Rust code example with an additional
644-
`language-C` CSS class. Therefore, if you specifically don't want it to be a Rust code example,
645-
don't forget to add the `custom` attribute.
646-
647-
To be noted that you can replace `class=` with `.` to achieve the same result:
648-
649-
```rust
650-
#![feature(custom_code_classes_in_docs)]
651-
652-
/// ```custom,{.language-c}
653-
/// int main(void) { return 0; }
654-
/// ```
655-
pub struct Bar;
656-
```
657-
658-
To be noted, `rust` and `.rust`/`class=rust` have different effects: `rust` indicates that this is
659-
a Rust code block whereas the two others add a "rust" CSS class on the code block.
660-
661-
You can also use double quotes:
662-
663-
```rust
664-
#![feature(custom_code_classes_in_docs)]
665-
666-
/// ```"not rust" {."hello everyone"}
667-
/// int main(void) { return 0; }
668-
/// ```
669-
pub struct Bar;
670-
```

‎src/doc/rustdoc/src/write-documentation/documentation-tests.md

+38
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,44 @@ that the code sample should be compiled using the respective edition of Rust.
376376
# fn foo() {}
377377
```
378378

379+
### Custom CSS classes for code blocks
380+
381+
```rust
382+
/// ```custom,{class=language-c}
383+
/// int main(void) { return 0; }
384+
/// ```
385+
pub struct Bar;
386+
```
387+
388+
The text `int main(void) { return 0; }` is rendered without highlighting in a code block
389+
with the class `language-c`. This can be used to highlight other languages through JavaScript
390+
libraries for example.
391+
392+
Without the `custom` attribute, it would be generated as a Rust code example with an additional
393+
`language-C` CSS class. Therefore, if you specifically don't want it to be a Rust code example,
394+
don't forget to add the `custom` attribute.
395+
396+
To be noted that you can replace `class=` with `.` to achieve the same result:
397+
398+
```rust
399+
/// ```custom,{.language-c}
400+
/// int main(void) { return 0; }
401+
/// ```
402+
pub struct Bar;
403+
```
404+
405+
To be noted, `rust` and `.rust`/`class=rust` have different effects: `rust` indicates that this is
406+
a Rust code block whereas the two others add a "rust" CSS class on the code block.
407+
408+
You can also use double quotes:
409+
410+
```rust
411+
/// ```"not rust" {."hello everyone"}
412+
/// int main(void) { return 0; }
413+
/// ```
414+
pub struct Bar;
415+
```
416+
379417
## Syntax reference
380418

381419
The *exact* syntax for code blocks, including the edge cases, can be found

‎src/librustdoc/doctest.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,6 @@ impl<'a, 'hir, 'tcx> HirCollector<'a, 'hir, 'tcx> {
13431343
def_id.to_def_id(),
13441344
span_of_fragments(&attrs.doc_strings).unwrap_or(sp),
13451345
)),
1346-
self.tcx.features().custom_code_classes_in_docs,
13471346
);
13481347
}
13491348

‎src/librustdoc/externalfiles.rs

-4
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ impl ExternalHtml {
4646
edition,
4747
playground,
4848
heading_offset: HeadingOffset::H2,
49-
// For external files, it'll be disabled until the feature is enabled by default.
50-
custom_code_classes_in_docs: false,
5149
}
5250
.into_string()
5351
);
@@ -63,8 +61,6 @@ impl ExternalHtml {
6361
edition,
6462
playground,
6563
heading_offset: HeadingOffset::H2,
66-
// For external files, it'll be disabled until the feature is enabled by default.
67-
custom_code_classes_in_docs: false,
6864
}
6965
.into_string()
7066
);
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.