Skip to content

Commit d337cec

Browse files
committed
Auto merge of rust-lang#84684 - jackh726:rollup-qxc5cos, r=jackh726
Rollup of 11 pull requests Successful merges: - rust-lang#84484 (Don't rebuild rustdoc and clippy after checking bootstrap) - rust-lang#84530 (`test tidy` should ignore alternative `build` dir patterns) - rust-lang#84531 (Ignore commented out lines when finding features) - rust-lang#84540 (Build sanitizers for x86_64-unknown-linux-musl) - rust-lang#84555 (Set `backtrace-on-ice` by default for compiler and codegen profiles) - rust-lang#84585 (Add `x.py check src/librustdoc` as an alias for `x.py check src/tools/rustdoc`) - rust-lang#84636 (rustdoc: change aliases attribute to data-aliases) - rust-lang#84646 (Add some regression tests related to rust-lang#82494) - rust-lang#84661 (Remove extra word in `rustc_mir` docs) - rust-lang#84663 (Remove `DropGuard` in `sys::windows::process` and use `StaticMutex` instead) - rust-lang#84668 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents ada1024 + 5d2ac6f commit d337cec

File tree

22 files changed

+145
-43
lines changed

22 files changed

+145
-43
lines changed

compiler/rustc_mir/src/borrow_check/type_check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ mod relate_tys;
9797

9898
/// Type checks the given `mir` in the context of the inference
9999
/// context `infcx`. Returns any region constraints that have yet to
100-
/// be proven. This result is includes liveness constraints that
100+
/// be proven. This result includes liveness constraints that
101101
/// ensure that regions appearing in the types of all local variables
102102
/// are live at all points where that local variable may later be
103103
/// used.

library/std/src/sys/windows/process.rs

+4-24
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ use crate::sys::c;
1919
use crate::sys::cvt;
2020
use crate::sys::fs::{File, OpenOptions};
2121
use crate::sys::handle::Handle;
22-
use crate::sys::mutex::Mutex;
2322
use crate::sys::pipe::{self, AnonPipe};
2423
use crate::sys::stdio;
24+
use crate::sys_common::mutex::StaticMutex;
2525
use crate::sys_common::process::{CommandEnv, CommandEnvs};
2626
use crate::sys_common::AsInner;
2727

@@ -94,10 +94,6 @@ pub struct StdioPipes {
9494
pub stderr: Option<AnonPipe>,
9595
}
9696

97-
struct DropGuard<'a> {
98-
lock: &'a Mutex,
99-
}
100-
10197
impl Command {
10298
pub fn new(program: &OsStr) -> Command {
10399
Command {
@@ -209,8 +205,9 @@ impl Command {
209205
//
210206
// For more information, msdn also has an article about this race:
211207
// http://support.microsoft.com/kb/315939
212-
static CREATE_PROCESS_LOCK: Mutex = Mutex::new();
213-
let _guard = DropGuard::new(&CREATE_PROCESS_LOCK);
208+
static CREATE_PROCESS_LOCK: StaticMutex = StaticMutex::new();
209+
210+
let _guard = unsafe { CREATE_PROCESS_LOCK.lock() };
214211

215212
let mut pipes = StdioPipes { stdin: None, stdout: None, stderr: None };
216213
let null = Stdio::Null;
@@ -259,23 +256,6 @@ impl fmt::Debug for Command {
259256
}
260257
}
261258

262-
impl<'a> DropGuard<'a> {
263-
fn new(lock: &'a Mutex) -> DropGuard<'a> {
264-
unsafe {
265-
lock.lock();
266-
DropGuard { lock }
267-
}
268-
}
269-
}
270-
271-
impl<'a> Drop for DropGuard<'a> {
272-
fn drop(&mut self) {
273-
unsafe {
274-
self.lock.unlock();
275-
}
276-
}
277-
}
278-
279259
impl Stdio {
280260
fn to_handle(&self, stdio_id: c::DWORD, pipe: &mut Option<AnonPipe>) -> io::Result<Handle> {
281261
match *self {

rustfmt.toml

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ merge_derives = false
77
# tidy only checks files which are not ignored, each entry follows gitignore style
88
ignore = [
99
"/build/",
10+
"/*-build/",
11+
"/build-*/",
1012
"/vendor/",
1113

1214
# tests for now are not formatted, as they are sometimes pretty-printing constrained

src/bootstrap/check.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl Step for CodegenBackend {
280280
}
281281

282282
macro_rules! tool_check_step {
283-
($name:ident, $path:expr, $source_type:expr) => {
283+
($name:ident, $path:literal, $($alias:literal, )* $source_type:path) => {
284284
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
285285
pub struct $name {
286286
pub target: TargetSelection,
@@ -292,7 +292,7 @@ macro_rules! tool_check_step {
292292
const DEFAULT: bool = true;
293293

294294
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
295-
run.path($path)
295+
run.paths(&[ $path, $($alias),* ])
296296
}
297297

298298
fn make_run(run: RunConfig<'_>) {
@@ -321,11 +321,9 @@ macro_rules! tool_check_step {
321321
}
322322

323323
// Enable internal lints for clippy and rustdoc
324-
// NOTE: this intentionally doesn't enable lints for any other tools,
325-
// see https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776
326-
if $path == "src/tools/rustdoc" || $path == "src/tools/clippy" {
327-
cargo.rustflag("-Zunstable-options");
328-
}
324+
// NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]`
325+
// See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776
326+
cargo.rustflag("-Zunstable-options");
329327

330328
builder.info(&format!(
331329
"Checking stage{} {} artifacts ({} -> {})",
@@ -363,7 +361,7 @@ macro_rules! tool_check_step {
363361
};
364362
}
365363

366-
tool_check_step!(Rustdoc, "src/tools/rustdoc", SourceType::InTree);
364+
tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InTree);
367365
// Clippy is a hybrid. It is an external tool, but uses a git subtree instead
368366
// of a submodule. Since the SourceType only drives the deny-warnings
369367
// behavior, treat it as in-tree so that any new warnings in clippy will be

src/bootstrap/defaults/config.codegen.toml

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ assertions = true
1111
debug-logging = true
1212
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
1313
incremental = true
14+
# Print backtrace on internal compiler errors during bootstrap
15+
backtrace-on-ice = true

src/bootstrap/defaults/config.compiler.toml

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
debug-logging = true
77
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
88
incremental = true
9+
# Print backtrace on internal compiler errors during bootstrap
10+
backtrace-on-ice = true
911

1012
[llvm]
1113
# Will download LLVM from CI if available on your platform.

src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ ENV HOSTS=x86_64-unknown-linux-musl
3838
ENV RUST_CONFIGURE_ARGS \
3939
--musl-root-x86_64=/usr/local/x86_64-linux-musl \
4040
--enable-extended \
41+
--enable-sanitizers \
4142
--enable-profiler \
4243
--enable-lld \
4344
--set target.x86_64-unknown-linux-musl.crt-static=false \

src/doc/book

Submodule book updated 1 file

src/librustdoc/html/render/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,7 @@ fn render_impl(
15461546
let aliases = if aliases.is_empty() {
15471547
String::new()
15481548
} else {
1549-
format!(" aliases=\"{}\"", aliases.join(","))
1549+
format!(" data-aliases=\"{}\"", aliases.join(","))
15501550
};
15511551
if let Some(use_absolute) = use_absolute {
15521552
write!(

src/librustdoc/html/static/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ function hideThemeButtonState() {
834834
// (like "Send" and "Sync").
835835
var inlined_types = new Set();
836836
onEachLazy(synthetic_implementors.getElementsByClassName("impl"), function(el) {
837-
var aliases = el.getAttribute("aliases");
837+
var aliases = el.getAttribute("data-aliases");
838838
if (!aliases) {
839839
return;
840840
}

src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#![feature(type_ascription)]
1717
#![feature(iter_intersperse)]
1818
#![recursion_limit = "256"]
19-
#![deny(rustc::internal)]
19+
#![warn(rustc::internal)]
2020

2121
#[macro_use]
2222
extern crate lazy_static;

src/test/rustdoc/auto_aliases.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(auto_traits)]
22

3-
// @has auto_aliases/trait.Bar.html '//h3[@aliases="auto_aliases::Foo"]' 'impl Bar for Foo'
3+
// @has auto_aliases/trait.Bar.html '//h3[@data-aliases="auto_aliases::Foo"]' 'impl Bar for Foo'
44
pub struct Foo;
55

66
pub auto trait Bar {}

src/test/ui/typeck/issue-75883.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Regression test for #75883.
2+
3+
pub struct UI {}
4+
5+
impl UI {
6+
pub fn run() -> Result<_> {
7+
//~^ ERROR: this enum takes 2 type arguments but only 1 type argument was supplied
8+
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures
9+
let mut ui = UI {};
10+
ui.interact();
11+
12+
unimplemented!();
13+
}
14+
15+
pub fn interact(&mut self) -> Result<_> {
16+
//~^ ERROR: this enum takes 2 type arguments but only 1 type argument was supplied
17+
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures
18+
unimplemented!();
19+
}
20+
}
21+
22+
fn main() {}

src/test/ui/typeck/issue-75883.stderr

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied
2+
--> $DIR/issue-75883.rs:6:21
3+
|
4+
LL | pub fn run() -> Result<_> {
5+
| ^^^^^^ - supplied 1 type argument
6+
| |
7+
| expected 2 type arguments
8+
|
9+
note: enum defined here, with 2 type parameters: `T`, `E`
10+
--> $SRC_DIR/core/src/result.rs:LL:COL
11+
|
12+
LL | pub enum Result<T, E> {
13+
| ^^^^^^ - -
14+
help: add missing type argument
15+
|
16+
LL | pub fn run() -> Result<_, E> {
17+
| ^^^
18+
19+
error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied
20+
--> $DIR/issue-75883.rs:15:35
21+
|
22+
LL | pub fn interact(&mut self) -> Result<_> {
23+
| ^^^^^^ - supplied 1 type argument
24+
| |
25+
| expected 2 type arguments
26+
|
27+
note: enum defined here, with 2 type parameters: `T`, `E`
28+
--> $SRC_DIR/core/src/result.rs:LL:COL
29+
|
30+
LL | pub enum Result<T, E> {
31+
| ^^^^^^ - -
32+
help: add missing type argument
33+
|
34+
LL | pub fn interact(&mut self) -> Result<_, E> {
35+
| ^^^
36+
37+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
38+
--> $DIR/issue-75883.rs:15:42
39+
|
40+
LL | pub fn interact(&mut self) -> Result<_> {
41+
| ^ not allowed in type signatures
42+
43+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
44+
--> $DIR/issue-75883.rs:6:28
45+
|
46+
LL | pub fn run() -> Result<_> {
47+
| ^ not allowed in type signatures
48+
49+
error: aborting due to 4 previous errors
50+
51+
Some errors have detailed explanations: E0107, E0121.
52+
For more information about an error, try `rustc --explain E0107`.

src/test/ui/typeck/issue-80779.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Regression test for #80779.
2+
3+
pub struct T<'a>(&'a str);
4+
5+
pub fn f<'a>(val: T<'a>) -> _ {
6+
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
7+
g(val)
8+
}
9+
10+
pub fn g(_: T<'static>) -> _ {}
11+
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
12+
13+
fn main() {}

src/test/ui/typeck/issue-80779.stderr

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
2+
--> $DIR/issue-80779.rs:10:28
3+
|
4+
LL | pub fn g(_: T<'static>) -> _ {}
5+
| ^
6+
| |
7+
| not allowed in type signatures
8+
| help: replace with the correct return type: `()`
9+
10+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
11+
--> $DIR/issue-80779.rs:5:29
12+
|
13+
LL | pub fn f<'a>(val: T<'a>) -> _ {
14+
| ^
15+
| |
16+
| not allowed in type signatures
17+
| help: replace with the correct return type: `()`
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0121`.

src/tools/clippy/clippy_lints/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// warn on lints, that are included in `rust-lang/rust`s bootstrap
1818
#![warn(rust_2018_idioms, unused_lifetimes)]
1919
// warn on rustc internal lints
20-
#![deny(rustc::internal)]
20+
#![warn(rustc::internal)]
2121

2222
// FIXME: switch to something more ergonomic here, once available.
2323
// (Currently there is no way to opt into sysroot crates without `extern crate`.)

src/tools/clippy/src/driver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// warn on lints, that are included in `rust-lang/rust`s bootstrap
55
#![warn(rust_2018_idioms, unused_lifetimes)]
66
// warn on rustc internal lints
7-
#![deny(rustc::internal)]
7+
#![warn(rustc::internal)]
88

99
// FIXME: switch to something more ergonomic here, once available.
1010
// (Currently there is no way to opt into sysroot crates without `extern crate`.)

src/tools/tidy/src/features.rs

+9
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,15 @@ fn map_lib_features(
423423
continue;
424424
}};
425425
}
426+
427+
lazy_static::lazy_static! {
428+
static ref COMMENT_LINE: Regex = Regex::new(r"^\s*//").unwrap();
429+
}
430+
// exclude commented out lines
431+
if COMMENT_LINE.is_match(line) {
432+
continue;
433+
}
434+
426435
if let Some((ref name, ref mut f)) = becoming_feature {
427436
if f.tracking_issue.is_none() {
428437
f.tracking_issue = find_attr_val(line, "issue").and_then(handle_issue_none);

0 commit comments

Comments
 (0)