Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #84679

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e8a143a
Ignore commented out lines when finding features
syvb Apr 24, 2021
43309f9
Build sanitizers for x86_64-unknown-linux-musl
12101111 Apr 25, 2021
9e722f7
Set `backtrace-on-ice` by default for compiler and codegen profiles
jyn514 Apr 25, 2021
a7e23f4
Add starting anchor
syvb Apr 25, 2021
5bd3187
Point out that behavior might be switched on 2015 and 2018 editions t…
est31 Apr 26, 2021
12642d9
Add a paragraph with possible alternatives on older editions
est31 Apr 27, 2021
eb753e8
Add a regression test for #75883
JohnTitor Apr 28, 2021
de92dfb
Add a regression test for #80779
JohnTitor Apr 28, 2021
8b806bc
Remove extra word in `rustc_mir` docs
pierwill Apr 28, 2021
1ac6326
Remove `DropGuard` in `sys::windows::process` and use `StaticMutex` i…
CDirkx Apr 28, 2021
153eb72
rustdoc: change aliases attribute to data-aliases
notriddle Apr 27, 2021
b57049a
rustdoc: update auto_aliases test case with data-aliases attribute
notriddle Apr 27, 2021
8dc09e1
Update books
ehuss Apr 28, 2021
b28754a
Add `x.py check src/librustdoc` as an alias for `x.py check src/tools…
jyn514 Apr 26, 2021
7c9f535
Rollup merge of #84531 - Smittyvb:foo-not-feature, r=Mark-Simulacrum
jackh726 Apr 28, 2021
e1243b1
Rollup merge of #84540 - 12101111:enable-sanitizers, r=Mark-Simulacrum
jackh726 Apr 28, 2021
9d5bc31
Rollup merge of #84555 - jyn514:ice-backtrace, r=Mark-Simulacrum
jackh726 Apr 28, 2021
1ecc464
Rollup merge of #84585 - jyn514:check-rustdoc, r=Mark-Simulacrum
jackh726 Apr 28, 2021
6ac4698
Rollup merge of #84590 - est31:array_into_iter, r=nikomatsakis
jackh726 Apr 28, 2021
12757c1
Rollup merge of #84636 - notriddle:data-aliases, r=jyn514,GuillaumeGomez
jackh726 Apr 28, 2021
fc081c4
Rollup merge of #84646 - JohnTitor:add-some-bad-placeholder-tests, r=…
jackh726 Apr 28, 2021
8f093ef
Rollup merge of #84661 - pierwill:patch-1, r=jackh726
jackh726 Apr 28, 2021
d16bac5
Rollup merge of #84663 - CDirkx:dropguard, r=Mark-Simulacrum
jackh726 Apr 28, 2021
fff2979
Rollup merge of #84668 - ehuss:update-books, r=ehuss
jackh726 Apr 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/borrow_check/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ mod relate_tys;

/// Type checks the given `mir` in the context of the inference
/// context `infcx`. Returns any region constraints that have yet to
/// be proven. This result is includes liveness constraints that
/// be proven. This result includes liveness constraints that
/// ensure that regions appearing in the types of all local variables
/// are live at all points where that local variable may later be
/// used.
Expand Down
48 changes: 46 additions & 2 deletions library/std/src/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,10 @@ mod prim_pointer {}
/// # Editions
///
/// Prior to Rust 1.53, arrays did not implement `IntoIterator` by value, so the method call
/// `array.into_iter()` auto-referenced into a slice iterator. That behavior is preserved in the
/// 2015 and 2018 editions of Rust for compatability, ignoring `IntoIterator` by value.
/// `array.into_iter()` auto-referenced into a slice iterator. Right now, the old behavior
/// is preserved in the 2015 and 2018 editions of Rust for compatibility, ignoring
/// `IntoIterator` by value. In the future, the behavior on the 2015 and 2018 edition
/// might be made consistent to the behavior of later editions.
///
#[cfg_attr(bootstrap, doc = "```rust,edition2018,ignore")]
#[cfg_attr(not(bootstrap), doc = "```rust,edition2018")]
Expand Down Expand Up @@ -601,6 +603,48 @@ mod prim_pointer {}
/// }
/// ```
///
/// Future language versions might start treating the `array.into_iter()`
/// syntax on editions 2015 and 2018 the same as on edition 2021. So code using
/// those older editions should still be written with this change in mind, to
/// prevent breakage in the future. The safest way to accomplish this is to
/// avoid the `into_iter` syntax on those editions. If an edition update is not
/// viable/desired, there are multiple alternatives:
/// * use `iter`, equivalent to the old behavior, creating references
/// * use [`array::IntoIter`], equivalent to the post-2021 behavior (Rust 1.51+)
/// * replace `for ... in array.into_iter() {` with `for ... in array {`,
/// equivalent to the post-2021 behavior (Rust 1.53+)
///
/// ```rust,edition2018
/// use std::array::IntoIter;
///
/// let array: [i32; 3] = [0; 3];
///
/// // This iterates by reference:
/// for item in array.iter() {
/// let x: &i32 = item;
/// println!("{}", x);
/// }
///
/// // This iterates by value:
/// for item in IntoIter::new(array) {
/// let x: i32 = item;
/// println!("{}", x);
/// }
///
/// // This iterates by value:
/// for item in array {
/// let x: i32 = item;
/// println!("{}", x);
/// }
///
/// // IntoIter can also start a chain.
/// // This iterates by value:
/// for item in IntoIter::new(array).enumerate() {
/// let (i, x): (usize, i32) = item;
/// println!("array[{}] = {}", i, x);
/// }
/// ```
///
/// [slice]: prim@slice
/// [`Debug`]: fmt::Debug
/// [`Hash`]: hash::Hash
Expand Down
28 changes: 4 additions & 24 deletions library/std/src/sys/windows/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ use crate::sys::c;
use crate::sys::cvt;
use crate::sys::fs::{File, OpenOptions};
use crate::sys::handle::Handle;
use crate::sys::mutex::Mutex;
use crate::sys::pipe::{self, AnonPipe};
use crate::sys::stdio;
use crate::sys_common::mutex::StaticMutex;
use crate::sys_common::process::{CommandEnv, CommandEnvs};
use crate::sys_common::AsInner;

Expand Down Expand Up @@ -94,10 +94,6 @@ pub struct StdioPipes {
pub stderr: Option<AnonPipe>,
}

struct DropGuard<'a> {
lock: &'a Mutex,
}

impl Command {
pub fn new(program: &OsStr) -> Command {
Command {
Expand Down Expand Up @@ -209,8 +205,9 @@ impl Command {
//
// For more information, msdn also has an article about this race:
// http://support.microsoft.com/kb/315939
static CREATE_PROCESS_LOCK: Mutex = Mutex::new();
let _guard = DropGuard::new(&CREATE_PROCESS_LOCK);
static CREATE_PROCESS_LOCK: StaticMutex = StaticMutex::new();

let _guard = unsafe { CREATE_PROCESS_LOCK.lock() };

let mut pipes = StdioPipes { stdin: None, stdout: None, stderr: None };
let null = Stdio::Null;
Expand Down Expand Up @@ -259,23 +256,6 @@ impl fmt::Debug for Command {
}
}

impl<'a> DropGuard<'a> {
fn new(lock: &'a Mutex) -> DropGuard<'a> {
unsafe {
lock.lock();
DropGuard { lock }
}
}
}

impl<'a> Drop for DropGuard<'a> {
fn drop(&mut self) {
unsafe {
self.lock.unlock();
}
}
}

impl Stdio {
fn to_handle(&self, stdio_id: c::DWORD, pipe: &mut Option<AnonPipe>) -> io::Result<Handle> {
match *self {
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ impl Step for CodegenBackend {
}

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

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

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -363,7 +363,7 @@ macro_rules! tool_check_step {
};
}

tool_check_step!(Rustdoc, "src/tools/rustdoc", SourceType::InTree);
tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InTree);
// Clippy is a hybrid. It is an external tool, but uses a git subtree instead
// of a submodule. Since the SourceType only drives the deny-warnings
// behavior, treat it as in-tree so that any new warnings in clippy will be
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/defaults/config.codegen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ assertions = true
debug-logging = true
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
incremental = true
# Print backtrace on internal compiler errors during bootstrap
backtrace-on-ice = true
2 changes: 2 additions & 0 deletions src/bootstrap/defaults/config.compiler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
debug-logging = true
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
incremental = true
# Print backtrace on internal compiler errors during bootstrap
backtrace-on-ice = true

[llvm]
# Will download LLVM from CI if available on your platform.
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ENV HOSTS=x86_64-unknown-linux-musl
ENV RUST_CONFIGURE_ARGS \
--musl-root-x86_64=/usr/local/x86_64-linux-musl \
--enable-extended \
--enable-sanitizers \
--enable-profiler \
--enable-lld \
--set target.x86_64-unknown-linux-musl.crt-static=false \
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book
Submodule book updated 1 files
+4 −4 COPYRIGHT
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ fn render_impl(
let aliases = if aliases.is_empty() {
String::new()
} else {
format!(" aliases=\"{}\"", aliases.join(","))
format!(" data-aliases=\"{}\"", aliases.join(","))
};
if let Some(use_absolute) = use_absolute {
write!(
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ function hideThemeButtonState() {
// (like "Send" and "Sync").
var inlined_types = new Set();
onEachLazy(synthetic_implementors.getElementsByClassName("impl"), function(el) {
var aliases = el.getAttribute("aliases");
var aliases = el.getAttribute("data-aliases");
if (!aliases) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc/auto_aliases.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![feature(auto_traits)]

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

pub auto trait Bar {}
22 changes: 22 additions & 0 deletions src/test/ui/typeck/issue-75883.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Regression test for #75883.

pub struct UI {}

impl UI {
pub fn run() -> Result<_> {
//~^ ERROR: this enum takes 2 type arguments but only 1 type argument was supplied
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures
let mut ui = UI {};
ui.interact();

unimplemented!();
}

pub fn interact(&mut self) -> Result<_> {
//~^ ERROR: this enum takes 2 type arguments but only 1 type argument was supplied
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures
unimplemented!();
}
}

fn main() {}
52 changes: 52 additions & 0 deletions src/test/ui/typeck/issue-75883.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied
--> $DIR/issue-75883.rs:6:21
|
LL | pub fn run() -> Result<_> {
| ^^^^^^ - supplied 1 type argument
| |
| expected 2 type arguments
|
note: enum defined here, with 2 type parameters: `T`, `E`
--> $SRC_DIR/core/src/result.rs:LL:COL
|
LL | pub enum Result<T, E> {
| ^^^^^^ - -
help: add missing type argument
|
LL | pub fn run() -> Result<_, E> {
| ^^^

error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied
--> $DIR/issue-75883.rs:15:35
|
LL | pub fn interact(&mut self) -> Result<_> {
| ^^^^^^ - supplied 1 type argument
| |
| expected 2 type arguments
|
note: enum defined here, with 2 type parameters: `T`, `E`
--> $SRC_DIR/core/src/result.rs:LL:COL
|
LL | pub enum Result<T, E> {
| ^^^^^^ - -
help: add missing type argument
|
LL | pub fn interact(&mut self) -> Result<_, E> {
| ^^^

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/issue-75883.rs:15:42
|
LL | pub fn interact(&mut self) -> Result<_> {
| ^ not allowed in type signatures

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/issue-75883.rs:6:28
|
LL | pub fn run() -> Result<_> {
| ^ not allowed in type signatures

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0107, E0121.
For more information about an error, try `rustc --explain E0107`.
13 changes: 13 additions & 0 deletions src/test/ui/typeck/issue-80779.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Regression test for #80779.

pub struct T<'a>(&'a str);

pub fn f<'a>(val: T<'a>) -> _ {
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures
g(val)
}

pub fn g(_: T<'static>) -> _ {}
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures

fn main() {}
21 changes: 21 additions & 0 deletions src/test/ui/typeck/issue-80779.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/issue-80779.rs:10:28
|
LL | pub fn g(_: T<'static>) -> _ {}
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `()`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/issue-80779.rs:5:29
|
LL | pub fn f<'a>(val: T<'a>) -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `()`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0121`.
9 changes: 9 additions & 0 deletions src/tools/tidy/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,15 @@ fn map_lib_features(
continue;
}};
}

lazy_static::lazy_static! {
static ref COMMENT_LINE: Regex = Regex::new(r"^\s*//").unwrap();
}
// exclude commented out lines
if COMMENT_LINE.is_match(line) {
continue;
}

if let Some((ref name, ref mut f)) = becoming_feature {
if f.tracking_issue.is_none() {
f.tracking_issue = find_attr_val(line, "issue").and_then(handle_issue_none);
Expand Down