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 14 pull requests #81355

Merged
merged 46 commits into from
Jan 25, 2021
Merged

Rollup of 14 pull requests #81355

merged 46 commits into from
Jan 25, 2021

Conversation

jonas-schievink
Copy link
Contributor

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

KodrAus and others added 30 commits August 5, 2020 16:49
Split long lines over 100 char line limit

Fix tidy complaints
Before 2021, this was a breaking change, as std::panic and core::panic
are different. In edition 2021 they will be identical, making it
possible again to apply proper hygiene here.
Change link_sanitizer_runtime() to check if the sanitizer library exists
in the specified/session sysroot, and if it doesn't exist, use the
default sysroot.
Record that we are processing a pattern so that code responsible for
handling path resolution can correctly decide whether to mark it as
used or not.
This option will allow splitting the compile-time from the run-time
directory of doctest invocations and is one step to solve
rust-lang/cargo#8993 (comment)
This gives compiler maintainers a better degree of control
over how the version gets parsed and is a good way to ensure
that there are no changes of behaviour in the future.

Also, issue a warning if the version is invalid instead of erroring
so that we stay forwards compatible with possible future changes
of the versioning scheme.

Last, this improves the present test a little.
bugadani and others added 16 commits January 24, 2021 13:32
Implement Error for &(impl Error)

Opening this up just to see what it breaks. It's unfortunate that `&(impl Error)` doesn't actually implement `Error`. If this direct approach doesn't work out then I'll try something different, like an `Error::by_ref` method.

**EDIT:** This is a super low-priority experiment so feel free to cancel it for more important crater runs! 🙂

-----

# Stabilization Report

## Why?

We've been working for the last few years to try "fix" the `Error` trait, which is probably one of the most fundamental in the whole standard library. One of its issues is that we commonly expect you to work with abstract errors through `dyn Trait`, but references and smart pointers over `dyn Trait` don't actually implement the `Error` trait. If you have a `&dyn Error` or a `Box<dyn Error>` you simply can't pass it to a method that wants a `impl Error`.

## What does this do?

This stabilizes the following trait impl:

```rust
impl<'a, T: Error + ?Sized + 'static> Error for &'a T;
```

This means that `&dyn Error` will now satisfy a `impl Error` bound.

It doesn't do anything with `Box<dyn Error>` directly. We discussed how we could do `Box<dyn Error>` in the thread here (and elsewhere in the past), but it seems like we need something like lattice-based specialization or a sprinkling of snowflake compiler magic to make that work. Having said that, with this new impl you _can_ now get a `impl Error` from a `Box<dyn Error>`  by dereferencing it.

## What breaks?

A crater run revealed a few crates broke with something like the following:

```rust
// where e: &'short &'long dyn Error
err.source()
```

previously we'd auto-deref that `&'short &'long dyn Error` to return a `Option<&'long dyn Error>` from `source`, but now will call directly on `&'short impl Error`, so will return a `Option<&'short dyn Error>`. The fix is to manually deref:

```rust
// where e: &'short &'long dyn Error
(*err).source()
```

In the recent Libs meeting we considered this acceptable breakage.
Permit mutable references in all const contexts

fixes #71212

cc `@rust-lang/wg-const-eval` `@christianpoveda`
Make std::future a re-export of core::future

After 1a764a7, there are no `std::future`-specific items (except for `cfg(bootstrap)` items removed in 93eed40). So, instead of defining `std` own module, we can re-export the `core::future` directly.
Replace magic numbers with existing constants

Replaced magic numbers in `library/core/src/time.rs` with predefined constants.
Expand assert!(expr, args..) to include $crate for hygiene on 2021.

This makes `assert!(expr, args..)` properly hygienic in Rust 2021.

This is part of rust-lang/rfcs#3007, see #80162.

Before edition 2021, this was a breaking change, as `std::panic` and `core::panic` are different. In edition 2021 they will be identical, making it possible to apply proper hygiene here.
Fix sysroot option not being honored across rustc

Change link_sanitizer_runtime() to check if the sanitizer library exists in the specified/session sysroot, and if it doesn't exist, use the default sysroot. (See #79253.)
Replace version_check dependency with own version parsing code

This gives compiler maintainers a better degree of control
over how the version gets parsed and is a good way to ensure
that there are no changes of behaviour in the future.

Also, issue a warning if the version is invalid instead of erroring
so that we stay forwards compatible with possible future changes
of the versioning scheme.

Last, this improves the present test a little.

Fixes #79436

r? `@petrochenkov`
Add unstable option to control doctest run directory

This option will allow splitting the compile-time from the run-time
directory of doctest invocations and is one step to solve
rust-lang/cargo#8993 (comment)

r? `@jyn514`
Small refactor in typeck

 - `check_impl_items_against_trait` only queries and walks through associated items once
 - extracted function that reports errors
 - don't check specialization validity when trait item does not match
 - small additional cleanups
…query_provider, r=cjgillot

Don't provide backend_optimization_level query for extern crates

Fixes #71291
Fix rendering of stabilization version for trait implementors

Rustdoc compares an item's stabilization version with its parent's to not render it if they are the same. Here, the implementor was compared with itself, resulting in the stabilization version never getting shown.

This probably needs a test.

Fixes #80777.
r? `@jyn514`
Do not mark unit variants as used when in path pattern

Record that we are processing a pattern so that code responsible for
handling path resolution can correctly decide whether to mark it as
used or not.

Closes #76788.
Make bad shlex parsing a pretty error

Closes #81319

Old Output:
<details><summary>Backtrace</summary>
<p>

```
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src\too
ls\jsondocck\src\main.rs:152:81
stack backtrace:
   0:     0x7ff79a011405 - std::backtrace_rs::backtrace::dbghelp::trace
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
   1:     0x7ff79a011405 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff79a011405 - std::sys_common::backtrace::_print_fmt
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\sys_common\backtrace.rs:67
   3:     0x7ff79a011405 - std::sys_common::backtrace::_print::{{impl}}::fmt
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\sys_common\backtrace.rs:46
   4:     0x7ff79a026c7b - core::fmt::write
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\core\src\fmt\mod.rs:1078
   5:     0x7ff79a00e74d - std::io::Write::write_fmt<std::sys::windows::stdio::S
tderr>
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\io\mod.rs:1519
   6:     0x7ff79a01413d - std::sys_common::backtrace::_print
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\sys_common\backtrace.rs:49
   7:     0x7ff79a01413d - std::sys_common::backtrace::print
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\sys_common\backtrace.rs:36
   8:     0x7ff79a01413d - std::panicking::default_hook::{{closure}}
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:208
   9:     0x7ff79a013c4a - std::panicking::default_hook
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:225
  10:     0x7ff79a014a7e - std::panicking::rust_panic_with_hook
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:591
  11:     0x7ff79a014573 - std::panicking::begin_panic_handler::{{closure}}
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:495
  12:     0x7ff79a011ddf - std::sys_common::backtrace::__rust_end_short_backtrac
e<closure-0,!>
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\sys_common\backtrace.rs:141
  13:     0x7ff79a0144f9 - std::panicking::begin_panic_handler
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:493
  14:     0x7ff79a025230 - core::panicking::panic_fmt
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\core\src\panicking.rs:92
  15:     0x7ff79a02517c - core::panicking::panic
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\core\src\panicking.rs:50
  16:     0x7ff799f5245f - indexmap::map::core::raw::<impl indexmap::map::core::
IndexMapCore<K,V>>::get_index_of::had34e726f99bd999
  17:     0x7ff799f48fea - std::sys_common::backtrace::__rust_begin_short_backtr
ace::h1ac92efa44350e74
  18:     0x7ff799f41015 - std::rt::lang_start::{{closure}}::hdfe733a6a1ad9a18
  19:     0x7ff79a014c34 - core::ops::function::impls::{{impl}}::call_once
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\library\core\src\ops\function.rs:280
  20:     0x7ff79a014c34 - std::panicking::try::do_call
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:379
  21:     0x7ff79a014c34 - std::panicking::try
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:343
  22:     0x7ff79a014c34 - std::panic::catch_unwind
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panic.rs:396
  23:     0x7ff79a014c34 - std::rt::lang_start_internal
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\rt.rs:51
  24:     0x7ff799f536a7 - main
  25:     0x7ff79a02d788 - invoke_main
                               at d:\A01\_work\6\s\src\vctools\crt\vcstartup\src
\startup\exe_common.inl:78
  26:     0x7ff79a02d788 - __scrt_common_main_seh
                               at d:\A01\_work\6\s\src\vctools\crt\vcstartup\src
\startup\exe_common.inl:288
  27:     0x7ffe6bf47034 - BaseThreadInitThunk
  28:     0x7ffe6c89d241 - RtlUserThreadStart
```

</p>
</details>

New Output:
```
Invalid command: Invalid arguments to shlex::split: ` - "$foo` on line 26
```

I've hit this a couple times, makes debugging a little nicer.
@rustbot rustbot added the rollup A PR which is a rollup label Jan 24, 2021
@jonas-schievink
Copy link
Contributor Author

@bors r+ rollup=never p=14

@bors
Copy link
Contributor

bors commented Jan 24, 2021

📌 Commit 529f15f has been approved by jonas-schievink

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 24, 2021
@bors
Copy link
Contributor

bors commented Jan 24, 2021

⌛ Testing commit 529f15f with merge d3163e9...

@bors
Copy link
Contributor

bors commented Jan 25, 2021

☀️ Test successful - checks-actions
Approved by: jonas-schievink
Pushing d3163e9 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 25, 2021
@bors bors merged commit d3163e9 into rust-lang:master Jan 25, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.