Skip to content

Commit ab14f94

Browse files
committed
Auto merge of #125086 - matthiaskrgr:rollup-xob4lof, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #119515 (style-guide: Format single associated type `where` clauses on the same line) - #119959 ([meta] Clarify prioritization alert) - #123817 (Stabilize `seek_seek_relative`) - #125063 (Don't call `env::set_var` in `rustc_driver::install_ice_hook`) - #125071 (Migrate rustdoc target spec json path) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 030a12c + ed2c2c0 commit ab14f94

File tree

9 files changed

+60
-19
lines changed

9 files changed

+60
-19
lines changed

compiler/rustc_driver_impl/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#![allow(internal_features)]
1212
#![feature(decl_macro)]
1313
#![feature(let_chains)]
14+
#![feature(panic_backtrace_config)]
1415
#![feature(panic_update_hook)]
1516
#![feature(result_flattening)]
1617

@@ -1317,8 +1318,8 @@ pub fn install_ice_hook(
13171318
// by the user. Compiler developers and other rustc users can
13181319
// opt in to less-verbose backtraces by manually setting "RUST_BACKTRACE"
13191320
// (e.g. `RUST_BACKTRACE=1`)
1320-
if std::env::var_os("RUST_BACKTRACE").is_none() {
1321-
std::env::set_var("RUST_BACKTRACE", "full");
1321+
if env::var_os("RUST_BACKTRACE").is_none() {
1322+
panic::set_backtrace_style(panic::BacktraceStyle::Full);
13221323
}
13231324

13241325
let using_internal_features = Arc::new(std::sync::atomic::AtomicBool::default());

library/std/src/io/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2044,7 +2044,6 @@ pub trait Seek {
20442044
/// # Example
20452045
///
20462046
/// ```no_run
2047-
/// #![feature(seek_seek_relative)]
20482047
/// use std::{
20492048
/// io::{self, Seek},
20502049
/// fs::File,
@@ -2059,7 +2058,7 @@ pub trait Seek {
20592058
/// ```
20602059
///
20612060
/// [`BufReader`]: crate::io::BufReader
2062-
#[unstable(feature = "seek_seek_relative", issue = "117374")]
2061+
#[stable(feature = "seek_seek_relative", since = "CURRENT_RUSTC_VERSION")]
20632062
fn seek_relative(&mut self, offset: i64) -> Result<()> {
20642063
self.seek(SeekFrom::Current(offset))?;
20652064
Ok(())

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

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ include:
4343
- Miscellaneous `rustfmt` bugfixes.
4444
- Use version-sort (sort `x8`, `x16`, `x32`, `x64`, `x128` in that order).
4545
- Change "ASCIIbetical" sort to Unicode-aware "non-lowercase before lowercase".
46+
- Format single associated type `where` clauses on the same line if they fit.
4647

4748
## Rust 2015/2018/2021 style edition
4849

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

+26-4
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,18 @@ Prefer to use single-letter names for generic parameters.
295295

296296
These rules apply for `where` clauses on any item.
297297

298-
If immediately following a closing bracket of any kind, write the keyword
299-
`where` on the same line, with a space before it.
298+
If a where clause is short, and appears on a short one-line function
299+
declaration with no body or on a short type with no `=`, format it on
300+
the same line as the declaration:
301+
302+
```rust
303+
fn new(&self) -> Self where Self: Sized;
304+
305+
type Item<'a>: SomeTrait where Self: 'a;
306+
```
307+
308+
Otherwise, if immediately following a closing bracket of any kind, write the
309+
keyword `where` on the same line, with a space before it.
300310

301311
Otherwise, put `where` on a new line at the same indentation level. Put each
302312
component of a `where` clause on its own line, block-indented. Use a trailing
@@ -347,7 +357,7 @@ where
347357
```
348358

349359
If a `where` clause is very short, prefer using an inline bound on the type
350-
parameter.
360+
parameter if possible.
351361

352362
If a component of a `where` clause does not fit and contains `+`, break it
353363
before each `+` and block-indent the continuation lines. Put each bound on its
@@ -421,9 +431,21 @@ Format associated types like type aliases. Where an associated type has a
421431
bound, put a space after the colon but not before:
422432

423433
```rust
424-
pub type Foo: Bar;
434+
type Foo: Bar;
425435
```
426436

437+
If an associated type is short, has no `=`, and has a `where` clause with only
438+
one entry, format the entire type declaration including the `where` clause on
439+
the same line if it fits:
440+
441+
```rust
442+
type Item<'a> where Self: 'a;
443+
type Item<'a>: PartialEq + Send where Self: 'a;
444+
```
445+
446+
If the associated type has a `=`, or if the `where` clause contains multiple
447+
entries, format it across multiple lines as with a type alias.
448+
427449
## extern items
428450

429451
When writing extern items (such as `extern "C" fn`), always specify the ABI.

src/tools/run-make-support/src/rustdoc.rs

+14
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ impl Rustdoc {
123123
self
124124
}
125125

126+
/// Specify the target triple, or a path to a custom target json spec file.
127+
pub fn target(&mut self, target: &str) -> &mut Self {
128+
self.cmd.arg(format!("--target={target}"));
129+
self
130+
}
131+
126132
/// Specify the crate type.
127133
pub fn crate_type(&mut self, crate_type: &str) -> &mut Self {
128134
self.cmd.arg("--crate-type");
@@ -137,6 +143,14 @@ impl Rustdoc {
137143
self
138144
}
139145

146+
/// Add a directory to the library search path. It corresponds to the `-L`
147+
/// rustdoc option.
148+
pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
149+
self.cmd.arg("-L");
150+
self.cmd.arg(path.as_ref());
151+
self
152+
}
153+
140154
#[track_caller]
141155
pub fn run_fail_assert_exit_code(&mut self, code: i32) -> Output {
142156
let caller_location = std::panic::Location::caller();

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ run-make/rustdoc-scrape-examples-multiple/Makefile
248248
run-make/rustdoc-scrape-examples-remap/Makefile
249249
run-make/rustdoc-scrape-examples-test/Makefile
250250
run-make/rustdoc-scrape-examples-whitespace/Makefile
251-
run-make/rustdoc-target-spec-json-path/Makefile
252251
run-make/rustdoc-themes/Makefile
253252
run-make/rustdoc-verify-output-files/Makefile
254253
run-make/rustdoc-with-out-dir-option/Makefile

tests/run-make/rustdoc-target-spec-json-path/Makefile

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Test that rustdoc will properly canonicalize the target spec json path just like rustc.
2+
3+
use run_make_support::{rustc, rustdoc, tmp_dir};
4+
5+
fn main() {
6+
let out_dir = tmp_dir().join("rustdoc-target-spec-json-path");
7+
rustc().crate_type("lib").input("dummy_core.rs").target("target.json").run();
8+
rustdoc()
9+
.input("my_crate.rs")
10+
.output(out_dir)
11+
.library_search_path(tmp_dir())
12+
.target("target.json")
13+
.run();
14+
}

triagebot.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ message_on_add = """\
419419
- Priority?
420420
- Regression?
421421
- Notify people/groups?
422-
- Needs `I-nominated`?
422+
- Needs `I-{team}-nominated`?
423423
"""
424424
message_on_remove = "Issue #{number}'s prioritization request has been removed."
425425
message_on_close = "Issue #{number} has been closed while requested for prioritization."

0 commit comments

Comments
 (0)