Skip to content

Commit

Permalink
Auto merge of #125086 - matthiaskrgr:rollup-xob4lof, r=matthiaskrgr
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed May 13, 2024
2 parents 030a12c + ed2c2c0 commit ab14f94
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 19 deletions.
5 changes: 3 additions & 2 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#![allow(internal_features)]
#![feature(decl_macro)]
#![feature(let_chains)]
#![feature(panic_backtrace_config)]
#![feature(panic_update_hook)]
#![feature(result_flattening)]

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

let using_internal_features = Arc::new(std::sync::atomic::AtomicBool::default());
Expand Down
3 changes: 1 addition & 2 deletions library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,6 @@ pub trait Seek {
/// # Example
///
/// ```no_run
/// #![feature(seek_seek_relative)]
/// use std::{
/// io::{self, Seek},
/// fs::File,
Expand All @@ -2059,7 +2058,7 @@ pub trait Seek {
/// ```
///
/// [`BufReader`]: crate::io::BufReader
#[unstable(feature = "seek_seek_relative", issue = "117374")]
#[stable(feature = "seek_seek_relative", since = "CURRENT_RUSTC_VERSION")]
fn seek_relative(&mut self, offset: i64) -> Result<()> {
self.seek(SeekFrom::Current(offset))?;
Ok(())
Expand Down
1 change: 1 addition & 0 deletions src/doc/style-guide/src/editions.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ include:
- Miscellaneous `rustfmt` bugfixes.
- Use version-sort (sort `x8`, `x16`, `x32`, `x64`, `x128` in that order).
- Change "ASCIIbetical" sort to Unicode-aware "non-lowercase before lowercase".
- Format single associated type `where` clauses on the same line if they fit.

## Rust 2015/2018/2021 style edition

Expand Down
30 changes: 26 additions & 4 deletions src/doc/style-guide/src/items.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,18 @@ Prefer to use single-letter names for generic parameters.

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

If immediately following a closing bracket of any kind, write the keyword
`where` on the same line, with a space before it.
If a where clause is short, and appears on a short one-line function
declaration with no body or on a short type with no `=`, format it on
the same line as the declaration:

```rust
fn new(&self) -> Self where Self: Sized;

type Item<'a>: SomeTrait where Self: 'a;
```

Otherwise, if immediately following a closing bracket of any kind, write the
keyword `where` on the same line, with a space before it.

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

If a `where` clause is very short, prefer using an inline bound on the type
parameter.
parameter if possible.

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

```rust
pub type Foo: Bar;
type Foo: Bar;
```

If an associated type is short, has no `=`, and has a `where` clause with only
one entry, format the entire type declaration including the `where` clause on
the same line if it fits:

```rust
type Item<'a> where Self: 'a;
type Item<'a>: PartialEq + Send where Self: 'a;
```

If the associated type has a `=`, or if the `where` clause contains multiple
entries, format it across multiple lines as with a type alias.

## extern items

When writing extern items (such as `extern "C" fn`), always specify the ABI.
Expand Down
14 changes: 14 additions & 0 deletions src/tools/run-make-support/src/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ impl Rustdoc {
self
}

/// Specify the target triple, or a path to a custom target json spec file.
pub fn target(&mut self, target: &str) -> &mut Self {
self.cmd.arg(format!("--target={target}"));
self
}

/// Specify the crate type.
pub fn crate_type(&mut self, crate_type: &str) -> &mut Self {
self.cmd.arg("--crate-type");
Expand All @@ -137,6 +143,14 @@ impl Rustdoc {
self
}

/// Add a directory to the library search path. It corresponds to the `-L`
/// rustdoc option.
pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
self.cmd.arg("-L");
self.cmd.arg(path.as_ref());
self
}

#[track_caller]
pub fn run_fail_assert_exit_code(&mut self, code: i32) -> Output {
let caller_location = std::panic::Location::caller();
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ run-make/rustdoc-scrape-examples-multiple/Makefile
run-make/rustdoc-scrape-examples-remap/Makefile
run-make/rustdoc-scrape-examples-test/Makefile
run-make/rustdoc-scrape-examples-whitespace/Makefile
run-make/rustdoc-target-spec-json-path/Makefile
run-make/rustdoc-themes/Makefile
run-make/rustdoc-verify-output-files/Makefile
run-make/rustdoc-with-out-dir-option/Makefile
Expand Down
9 changes: 0 additions & 9 deletions tests/run-make/rustdoc-target-spec-json-path/Makefile

This file was deleted.

14 changes: 14 additions & 0 deletions tests/run-make/rustdoc-target-spec-json-path/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Test that rustdoc will properly canonicalize the target spec json path just like rustc.

use run_make_support::{rustc, rustdoc, tmp_dir};

fn main() {
let out_dir = tmp_dir().join("rustdoc-target-spec-json-path");
rustc().crate_type("lib").input("dummy_core.rs").target("target.json").run();
rustdoc()
.input("my_crate.rs")
.output(out_dir)
.library_search_path(tmp_dir())
.target("target.json")
.run();
}
2 changes: 1 addition & 1 deletion triagebot.toml
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ message_on_add = """\
- Priority?
- Regression?
- Notify people/groups?
- Needs `I-nominated`?
- Needs `I-{team}-nominated`?
"""
message_on_remove = "Issue #{number}'s prioritization request has been removed."
message_on_close = "Issue #{number} has been closed while requested for prioritization."
Expand Down

0 comments on commit ab14f94

Please sign in to comment.