]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #70138 - RalfJung:throw-not-return, r=oli-obk
Mazdak Farrokhzad [Sat, 21 Mar 2020 07:51:21 +0000 (08:51 +0100)]
Rollup merge of #70138 - RalfJung:throw-not-return, r=oli-obk

do not 'return' in 'throw_' macros

In https://github.com/rust-lang/rust/pull/69839 we turned a closure into a `try` block, but it turns out that does not work with our `throw_` macros, which `return` so they skip the `try`.

Here we fix that. For some reason that means we also have to remove some `;`.

r? @oli-obk

4 years agoRollup merge of #70092 - eddyb:hir-items-are-just-nodes, r=Zoxc
Mazdak Farrokhzad [Sat, 21 Mar 2020 07:51:19 +0000 (08:51 +0100)]
Rollup merge of #70092 - eddyb:hir-items-are-just-nodes, r=Zoxc

hir: replace "items" terminology with "nodes" where appropriate.

The newly added `HirOwnerItems` confused me before I realized that "items" there actually referred to HIR nodes, not `hir:Item` or "item-like" (which we should IMO replace with "owner").

I suspect the naming had something to do with `ItemLocalId`'s use of "item".
That is, `ItemLocalId` could be interpreted to mean one of two things:
* `IntraItemNodeId` i.e. `IntraOwnerNodeId`
  * this is IMO correct, and I'd even like to rename it, but I didn't want to throw that into this PR
* `IntraOwnerItemId`
  * this is what `HirOwnerItems` would seem to imply

r? @Zoxc cc @michaelwoerister @nikomatsakis

4 years agoRollup merge of #70089 - eddyb:closure-sig-infer, r=nikomatsakis
Mazdak Farrokhzad [Sat, 21 Mar 2020 07:51:18 +0000 (08:51 +0100)]
Rollup merge of #70089 - eddyb:closure-sig-infer, r=nikomatsakis

rustc_infer: remove InferCtxt::closure_sig as the FnSig is always shallowly known.

That is, `ClosureSubsts` is always created (in `rustc_typeck::check::closure`) with a `FnSig`, as the number of inputs is known, even if they might all have inference types.
The only useful thing `InferCtxt::closure_sig` was doing is resolving an inference variable used just to get the `ty::FnPtr` containing that `FnSig` into `ClosureSubsts`.

The ideal way to solve this would be to add a constructor for `ClosureSubsts`, that combines the parent `Substs`, the closure kind, the signature, and capture types together, but for now I've went with resolving the inference types just after unifying them with the real types.

r? @nikomatsakis

4 years agoRollup merge of #70054 - rojamd:android-pgo, r=michaelwoerister
Mazdak Farrokhzad [Sat, 21 Mar 2020 07:51:15 +0000 (08:51 +0100)]
Rollup merge of #70054 - rojamd:android-pgo, r=michaelwoerister

Build dist-android with --enable-profiler

This will make the runtime available to enable PGO for Rust code in Firefox on Android.

r? @michaelwoerister

4 years agoRollup merge of #69965 - mark-i-m:codegen-utils, r=eddyb
Mazdak Farrokhzad [Sat, 21 Mar 2020 07:51:14 +0000 (08:51 +0100)]
Rollup merge of #69965 - mark-i-m:codegen-utils, r=eddyb

Refactorings to get rid of rustc_codegen_utils

r? @eddyb

cc #45276

After this, the only modules left in `rustc_codegen_utils` are
- `link`: a bunch of linking-related functions (many dealing with file names). These are mostly consumed by save analysis, rustc_driver, rustc_interface, and of course codegen. I assume they live here because we don't want a dependency of save analysis on codegen... Perhaps they can be moved to librustc?
- ~`symbol_names` and `symbol_names_test`: honestly it seems odd that `symbol_names_test` is not a submodule of `symbol_names`. It seems like these could honestly live in their own crate or move to librustc. Already name mangling is exported as the `symbol_name` query.~ (move it to its own crate)

I don't mind doing either of the above as part of this PR or a followup if you want.

4 years agoRollup merge of #69934 - andjo403:inlinecost, r=wesleywiser
Mazdak Farrokhzad [Sat, 21 Mar 2020 07:51:12 +0000 (08:51 +0100)]
Rollup merge of #69934 - andjo403:inlinecost, r=wesleywiser

Update the mir inline costs

handle that when mir is lowered to llvm-ir more code is generated.
Landingpads generates 10 llvm-ir instructions
and resume 9 llvm-ir instructions.

r? @wesleywiser

4 years agoRollup merge of #67888 - Zoxc:metadata-prefetch, r=matthewjasper
Mazdak Farrokhzad [Sat, 21 Mar 2020 07:51:10 +0000 (08:51 +0100)]
Rollup merge of #67888 - Zoxc:metadata-prefetch, r=matthewjasper

Prefetch some queries used by the metadata encoder

This brings the time for `metadata encoding and writing` for `syntex_syntax` from 1.338s to 0.997s with 6 threads in non-incremental debug mode.

r? @Mark-Simulacrum

4 years agoAuto merge of #70205 - Centril:rollup-0jq9k4s, r=Centril
bors [Sat, 21 Mar 2020 04:34:04 +0000 (04:34 +0000)]
Auto merge of #70205 - Centril:rollup-0jq9k4s, r=Centril

Rollup of 16 pull requests

Successful merges:

 - #65097 (Make std::sync::Arc compatible with ThreadSanitizer)
 - #69033 (Use generator resume arguments in the async/await lowering)
 - #69997 (add `Option::{zip,zip_with}` methods under "option_zip" gate)
 - #70038 (Remove the call that makes miri fail)
 - #70058 (can_begin_literal_maybe_minus: `true` on `"-"? lit` NTs.)
 - #70111 (BTreeMap: remove shared root)
 - #70139 (add delay_span_bug to TransmuteSizeDiff, just to be sure)
 - #70165 (Remove the erase regions MIR transform)
 - #70166 (Derive PartialEq, Eq and Hash for RangeInclusive)
 - #70176 (Add tests for #58319 and #65131)
 - #70177 (Fix oudated comment for NamedRegionMap)
 - #70184 (expand_include: set `.directory` to dir of included file.)
 - #70187 (more clippy fixes)
 - #70188 (Clean up E0439 explanation)
 - #70189 (Abi::is_signed: assert that we are a Scalar)
 - #70194 (#[must_use] on split_off())

Failed merges:

r? @ghost

4 years agoRollup merge of #70194 - kornelski:must_split, r=joshtriplett
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:36 +0000 (05:33 +0100)]
Rollup merge of #70194 - kornelski:must_split, r=joshtriplett

#[must_use] on split_off()

I've noticed this function used for truncation in the wild. `must_use` will clear that up.

4 years agoRollup merge of #70189 - RalfJung:is_signed, r=eddyb
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:35 +0000 (05:33 +0100)]
Rollup merge of #70189 - RalfJung:is_signed, r=eddyb

Abi::is_signed: assert that we are a Scalar

A bit more sanity checking, suggested by @eddyb. This makes this method actually "safer" than `TyS::is_signed`, so I made sure Miri consistently uses the `Abi` version.

Though I am not sure if this would have caught the mistake where the layout of a zero-sized enum was asked for its sign.

r? @eddyb

4 years agoRollup merge of #70188 - GuillaumeGomez:cleanup-e0439, r=Dylan-DPC
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:33 +0000 (05:33 +0100)]
Rollup merge of #70188 - GuillaumeGomez:cleanup-e0439, r=Dylan-DPC

Clean up E0439 explanation

r? @Dylan-DPC

4 years agoRollup merge of #70187 - matthiaskrgr:cl2ppy, r=Mark-Simulacrum
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:31 +0000 (05:33 +0100)]
Rollup merge of #70187 - matthiaskrgr:cl2ppy, r=Mark-Simulacrum

more clippy fixes

    * remove redundant returns (clippy::needless_return)
    * remove redundant import (clippy::single_component_path_imports)
    * remove redundant format!() call (clippy::useless_format)
    * don't use ok() before calling expect() (clippy::ok_expect)

4 years agoRollup merge of #70184 - Centril:include-mod-relativism, r=petrochenkov
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:30 +0000 (05:33 +0100)]
Rollup merge of #70184 - Centril:include-mod-relativism, r=petrochenkov

expand_include: set `.directory` to dir of included file.

Resolves the regression noted in https://github.com/rust-lang/rust/pull/69838/#discussion_r395217057.

r? @petrochenkov
cc @eddyb @Mark-Simulacrum

4 years agoRollup merge of #70177 - bjorn3:patch-2, r=Dylan-DPC
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:28 +0000 (05:33 +0100)]
Rollup merge of #70177 - bjorn3:patch-2, r=Dylan-DPC

Fix oudated comment for NamedRegionMap

`ResolveLifetimes` uses a `LocalDefId` since #66131.

4 years agoRollup merge of #70176 - rylev:ice-tests, r=Centril
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:27 +0000 (05:33 +0100)]
Rollup merge of #70176 - rylev:ice-tests, r=Centril

Add tests for #58319 and #65131

Fixes #58319 and fixes #65131

4 years agoRollup merge of #70166 - CDirkx:range-inclusive-derives, r=cramertj
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:26 +0000 (05:33 +0100)]
Rollup merge of #70166 - CDirkx:range-inclusive-derives, r=cramertj

Derive PartialEq, Eq and Hash for RangeInclusive

The manual implementation of `PartialEq`, `Eq` and `Hash` for `RangeInclusive` was functionally equivalent to a derived implementation.

This change removes the manual implementation and adds the respective derives.
A side effect of this change is that the derives also add implementations for `StructuralPartialEq` and `StructuralEq`, which enables `RangeInclusive` to be used in const generics, closing #70155.

This change is enabled by #68835, which changed the field `is_empty: Option<bool>` to `exhausted: bool` removing the need for *semantic* equality instead of *structural* equality.

## PartialEq
original [`PartialEq`](https://github.com/rust-lang/rust/blob/f4c675c476c18b1a11041193f2f59d695b126bc8/src/libcore/ops/range.rs#L353-L359) implementation:
```rust
#[stable(feature = "inclusive_range", since = "1.26.0")]
impl<Idx: PartialEq> PartialEq for RangeInclusive<Idx> {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        self.start == other.start && self.end == other.end && self.exhausted == other.exhausted
    }
}
```
expanded derive implementation (using `cargo expand ops::range`):
```rust
#[stable(feature = "inclusive_range", since = "1.26.0")]
impl<Idx> crate::marker::StructuralPartialEq for RangeInclusive<Idx> {}

#[automatically_derived]
#[allow(unused_qualifications)]
#[stable(feature = "inclusive_range", since = "1.26.0")]
impl<Idx: crate::cmp::PartialEq> crate::cmp::PartialEq for RangeInclusive<Idx> {
    #[inline]
    fn eq(&self, other: &RangeInclusive<Idx>) -> bool {
        match *other {
            RangeInclusive { start: ref __self_1_0,end: ref __self_1_1, exhausted: ref __self_1_2 } => match *self {
                RangeInclusive { start: ref __self_0_0, end: ref __self_0_1, exhausted: ref __self_0_2 } => {
                    (*__self_0_0) == (*__self_1_0) && (*__self_0_1) == (*__self_1_1) && (*__self_0_2) == (*__self_1_2)
                }
            },
        }
    }
    #[inline]
    fn ne(&self, other: &RangeInclusive<Idx>) -> bool {
        match *other {
            RangeInclusive { start: ref __self_1_0, end: ref __self_1_1, exhausted: ref __self_1_2 } => match *self {
                RangeInclusive { start: ref __self_0_0, end: ref __self_0_1exhausted: ref __self_0_2 } => {
                    (*__self_0_0) != (*__self_1_0) || (*__self_0_1) != (*__self_1_1) || (*__self_0_2) != (*__self_1_2)
                }
            },
        }
    }
}
```

These implementations both test for *structural* equality, with the same order of field comparisons, and the bound `Idx: PartialEq` is the same.
## Eq
original [`Eq`](https://github.com/rust-lang/rust/blob/f4c675c476c18b1a11041193f2f59d695b126bc8/src/libcore/ops/range.rs#L361-L362) implementation:
```rust
#[stable(feature = "inclusive_range", since = "1.26.0")]
impl<Idx: Eq> Eq for RangeInclusive<Idx> {}
```
expanded derive implementation (using `cargo expand ops::range`):
```rust
#[stable(feature = "inclusive_range", since = "1.26.0")]
impl<Idx> crate::marker::StructuralEq for RangeInclusive<Idx> {}

#[automatically_derived]
#[allow(unused_qualifications)]
#[stable(feature = "inclusive_range", since = "1.26.0")]
impl<Idx: crate::cmp::Eq> crate::cmp::Eq for RangeInclusive<Idx> {
    #[inline]
    #[doc(hidden)]
    fn assert_receiver_is_total_eq(&self) -> () {
        {
            let _: crate::cmp::AssertParamIsEq<Idx>;
            let _: crate::cmp::AssertParamIsEq<Idx>;
            let _: crate::cmp::AssertParamIsEq<bool>;
        }
    }
}
```
These implementations are equivalent since `Eq` is just a marker trait and the bound `Idx: Eq` is the same.

## Hash
original [`Hash`](https://github.com/rust-lang/rust/blob/f4c675c476c18b1a11041193f2f59d695b126bc8/src/libcore/ops/range.rs#L364-L371) implementation:
```rust
#[stable(feature = "inclusive_range", since = "1.26.0")]
impl<Idx: Hash> Hash for RangeInclusive<Idx> {
    fn hash<H: Hasher>(&self, state: &mut H) {
        self.start.hash(state);
        self.end.hash(state);
        self.exhausted.hash(state);
    }
}
```
expanded derive implementation (using `cargo expand ops::range`):
```rust
#[automatically_derived]
#[allow(unused_qualifications)]
#[stable(feature = "inclusive_range", since = "1.26.0")]
impl<Idx: crate::hash::Hash> crate::hash::Hash for RangeInclusive<Idx> {
    fn hash<__H: crate::hash::Hasher>(&self, state: &mut __H) -> () {
        match *self { RangeInclusive { start: ref __self_0_0, end: ref __self_0_1, exhausted: ref __self_0_2 } => {
                crate::hash::Hash::hash(&(*__self_0_0), state);
                crate::hash::Hash::hash(&(*__self_0_1), state);
                crate::hash::Hash::hash(&(*__self_0_2), state)
            }
        }
    }
}
```
These implementations are functionally equivalent, with the same order of field hashing, and the bound `Idx: Hash` is the same.

4 years agoRollup merge of #70165 - matthewjasper:erase-more, r=nikomatsakis
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:24 +0000 (05:33 +0100)]
Rollup merge of #70165 - matthewjasper:erase-more, r=nikomatsakis

Remove the erase regions MIR transform

We now ensure that MIR never contains unerased regions in the first place.

4 years agoRollup merge of #70139 - RalfJung:delay, r=eddyb
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:23 +0000 (05:33 +0100)]
Rollup merge of #70139 - RalfJung:delay, r=eddyb

add delay_span_bug to TransmuteSizeDiff, just to be sure

See https://github.com/rust-lang/rust/pull/69839#discussion_r394858464.

r? @eddyb

4 years agoRollup merge of #70111 - Mark-Simulacrum:btree-no-shared, r=cuviper
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:21 +0000 (05:33 +0100)]
Rollup merge of #70111 - Mark-Simulacrum:btree-no-shared, r=cuviper

BTreeMap: remove shared root

This replaces the shared root with `Option`s in the BTreeMap code, and then slightly cleans up the node manipulation code taking advantage of the removal of the shared root. I expect that further simplification is possible, but wanted to get this posted for initial review.

Note that `BTreeMap::new()` continues to not allocate.

Benchmarks seem within the margin of error/unaffected, as expected for an entirely predictable branch.

```
 name                                 alloc-bench-a ns/iter  alloc-bench-b ns/iter  diff ns/iter  diff %  speedup
 btree::map::iter_mut_20              20                     21                                1   5.00%   x 0.95
 btree::set::clone_100                1,360                  1,439                            79   5.81%   x 0.95
 btree::set::clone_100_and_into_iter  1,319                  1,434                           115   8.72%   x 0.92
 btree::set::clone_10k                143,515                150,991                       7,476   5.21%   x 0.95
 btree::set::clone_10k_and_clear      142,792                152,916                      10,124   7.09%   x 0.93
 btree::set::clone_10k_and_into_iter  146,019                154,561                       8,542   5.85%   x 0.94
```

4 years agoRollup merge of #70058 - Centril:fix-70050, r=petrochenkov
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:20 +0000 (05:33 +0100)]
Rollup merge of #70058 - Centril:fix-70050, r=petrochenkov

can_begin_literal_maybe_minus: `true` on `"-"? lit` NTs.

Make `can_begin_literal_or_bool` (renamed to `can_begin_literal_maybe_minus`) accept `NtLiteral(e) | NtExpr(e)` where `e` is either a literal or a negated literal.

Fixes https://github.com/rust-lang/rust/issues/70050.

r? @petrochenkov

4 years agoRollup merge of #70038 - DutchGhost:const-forget-tests, r=RalfJung
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:18 +0000 (05:33 +0100)]
Rollup merge of #70038 - DutchGhost:const-forget-tests, r=RalfJung

Remove the call that makes miri fail

Fixes the concern raised in https://github.com/rust-lang/rust/pull/69645/files#r392884274

cc @RalfJung

4 years agoRollup merge of #69997 - WaffleLapkin:option_zip, r=LukasKalbertodt
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:16 +0000 (05:33 +0100)]
Rollup merge of #69997 - WaffleLapkin:option_zip, r=LukasKalbertodt

add `Option::{zip,zip_with}` methods under "option_zip" gate

This PR introduces 2 methods - `Option::zip` and `Option::zip_with` with
respective signatures:
- zip: `(Option<T>, Option<U>) -> Option<(T, U)>`
- zip_with: `(Option<T>, Option<U>, (T, U) -> R) -> Option<R>`
Both are under the feature gate "option_zip".

I'm not sure about the name "zip", maybe we can find a better name for this.
(I would prefer `union` for example, but this is a keyword :( )

--------------------------------------------------------------------------------

Recently in a russian rust begginers telegram chat a newbie asked (translated):
> Are there any methods for these conversions:
>
> 1. `(Option<A>, Option<B>) -> Option<(A, B)>`
> 2. `Vec<Option<T>> -> Option<Vec<T>>`
>
> ?

While second (2.) is clearly `vec.into_iter().collect::<Option<Vec<_>>()`, the
first one isn't that clear.

I couldn't find anything similar in the `core` and I've come to this solution:
```rust
let tuple: (Option<A>, Option<B>) = ...;
let res: Option<(A, B)> = tuple.0.and_then(|a| tuple.1.map(|b| (a, b)));
```

However this solution isn't "nice" (same for just `match`/`if let`), so I thought
that this functionality should be in `core`.

4 years agoRollup merge of #69033 - jonas-schievink:resume-with-context, r=tmandry
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:15 +0000 (05:33 +0100)]
Rollup merge of #69033 - jonas-schievink:resume-with-context, r=tmandry

Use generator resume arguments in the async/await lowering

This removes the TLS requirement from async/await and enables it in `#![no_std]` crates.

Closes https://github.com/rust-lang/rust/issues/56974

I'm not confident the HIR lowering is completely correct, there seem to be quite a few undocumented invariants in there. The `async-std` and tokio test suites are passing with these changes though.

4 years agoRollup merge of #65097 - tmiasko:arc, r=Amanieu
Mazdak Farrokhzad [Sat, 21 Mar 2020 04:33:13 +0000 (05:33 +0100)]
Rollup merge of #65097 - tmiasko:arc, r=Amanieu

Make std::sync::Arc compatible with ThreadSanitizer

The memory fences used previously in Arc implementation are not properly
understood by thread sanitizer as synchronization primitives. This had
unfortunate effect where running any non-trivial program compiled with
`-Z sanitizer=thread` would result in numerous false positives.

Replace acquire fences with acquire loads to address the issue.

Fixes #39608.

4 years agomore type annotations to help inference
Ralf Jung [Fri, 20 Mar 2020 22:28:01 +0000 (23:28 +0100)]
more type annotations to help inference

4 years agoremove redundant returns (clippy::needless_return)
Matthias Krüger [Fri, 20 Mar 2020 14:03:11 +0000 (15:03 +0100)]
remove redundant returns (clippy::needless_return)

4 years agoremove redundant import (clippy::single_component_path_imports)
Matthias Krüger [Thu, 19 Mar 2020 21:09:26 +0000 (22:09 +0100)]
remove redundant import (clippy::single_component_path_imports)
remove redundant format!() call (clippy::useless_format)
don't use ok() before calling expect() (clippy::ok_expect)

4 years agoAuto merge of #69509 - RalfJung:debug-assert-write, r=eddyb
bors [Fri, 20 Mar 2020 19:02:32 +0000 (19:02 +0000)]
Auto merge of #69509 - RalfJung:debug-assert-write, r=eddyb

debug-assert ptr sanity in ptr::write

This is a re-submission of the parts that we removed from https://github.com/rust-lang/rust/pull/69208 due to ["interesting" test failures](https://github.com/rust-lang/rust/pull/69208#issuecomment-591310437).

Fixes https://github.com/rust-lang/rust/issues/53871
r? @Mark-Simulacrum @eddyb

4 years agoexpand_include: set `.directory` to dir of included file.
Mazdak Farrokhzad [Fri, 20 Mar 2020 15:02:46 +0000 (16:02 +0100)]
expand_include: set `.directory` to dir of included file.

4 years agoAbi::is_signed: assert that we are a Scalar
Ralf Jung [Fri, 20 Mar 2020 16:05:00 +0000 (17:05 +0100)]
Abi::is_signed: assert that we are a Scalar

4 years agoClean up E0439 explanation
Guillaume Gomez [Fri, 20 Mar 2020 16:03:04 +0000 (17:03 +0100)]
Clean up E0439 explanation

4 years agoFix debugger pretty printing of BTrees
Mark Rousskov [Wed, 18 Mar 2020 19:29:05 +0000 (15:29 -0400)]
Fix debugger pretty printing of BTrees

4 years agoAuto merge of #70174 - JohnTitor:rollup-0lum0jh, r=JohnTitor
bors [Fri, 20 Mar 2020 15:58:34 +0000 (15:58 +0000)]
Auto merge of #70174 - JohnTitor:rollup-0lum0jh, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #69618 (Clarify the relationship between `forget()` and `ManuallyDrop`.)
 - #69768 (Compute the correct layout for variants of uninhabited enums)
 - #69935 (codegen/mir: support polymorphic `InstanceDef`s)
 - #70103 (Clean up E0437 explanation)
 - #70131 (Add regression test for TAIT lifetime inference (issue #55099))
 - #70133 (remove unused imports)
 - #70145 (doc: Add quote to .init_array)
 - #70146 (Clean up e0438 explanation)
 - #70150 (triagebot.toml: accept cleanup-crew)

Failed merges:

r? @ghost

4 years agocan_begin_literal_maybe_minus: `true` on `"-"? lit` NTs.
Mazdak Farrokhzad [Mon, 16 Mar 2020 22:36:14 +0000 (23:36 +0100)]
can_begin_literal_maybe_minus: `true` on `"-"? lit` NTs.

4 years agomust_use on split_off
Kornel [Fri, 20 Mar 2020 14:40:35 +0000 (14:40 +0000)]
must_use on split_off

4 years agoUpdate test commentary for shared root removal
Mark Rousskov [Fri, 20 Mar 2020 13:40:57 +0000 (09:40 -0400)]
Update test commentary for shared root removal

4 years agoSimplify ensure_root_is_owned callers
Mark Rousskov [Wed, 18 Mar 2020 23:00:15 +0000 (19:00 -0400)]
Simplify ensure_root_is_owned callers

This makes ensure_root_is_owned return a reference to the (now guaranteed to
exist) root, allowing callers to operate on it without going through another
unwrap.

Unfortunately this is only rarely useful as it's frequently the case that both
the length and the root need to be accessed and field-level borrows in methods
don't yet exist.

4 years agoDrop NodeHeader type from BTree code
Mark Rousskov [Wed, 18 Mar 2020 15:10:21 +0000 (11:10 -0400)]
Drop NodeHeader type from BTree code

We no longer have a separate header because the shared root is gone; all code
can work solely with leafs now.

4 years agoMake functions dependent only on shared root avoidance safe
Mark Rousskov [Wed, 18 Mar 2020 14:45:35 +0000 (10:45 -0400)]
Make functions dependent only on shared root avoidance safe

4 years agoRemove shared root code and assertions from BTree nodes
Mark Rousskov [Wed, 18 Mar 2020 14:28:33 +0000 (10:28 -0400)]
Remove shared root code and assertions from BTree nodes

4 years agoReplace shared root with optional root
Mark Rousskov [Wed, 18 Mar 2020 14:25:46 +0000 (10:25 -0400)]
Replace shared root with optional root

This simplifies the node manipulation, as we can (in later commits) always know
when traversing nodes that we are not in a shared root.

4 years agoAdd tests for #58319 and #65131
Ryan Levick [Fri, 20 Mar 2020 12:24:35 +0000 (13:24 +0100)]
Add tests for #58319 and #65131

4 years agoFix oudated comment for NamedRegionMap
bjorn3 [Fri, 20 Mar 2020 12:23:24 +0000 (13:23 +0100)]
Fix oudated comment for NamedRegionMap

4 years agoUpdate const_forget.rs
DutchGhost [Fri, 20 Mar 2020 09:36:40 +0000 (10:36 +0100)]
Update const_forget.rs

4 years agoRollup merge of #70150 - rust-lang:accept-felixes-typo, r=Mark-Simulacrum
Yuki Okushi [Fri, 20 Mar 2020 08:02:14 +0000 (17:02 +0900)]
Rollup merge of #70150 - rust-lang:accept-felixes-typo, r=Mark-Simulacrum

triagebot.toml: accept cleanup-crew

r? @Mark-Simulacrum

4 years agoRollup merge of #70146 - GuillaumeGomez:cleanup-e0438, r=Dylan-DPC
Yuki Okushi [Fri, 20 Mar 2020 08:02:12 +0000 (17:02 +0900)]
Rollup merge of #70146 - GuillaumeGomez:cleanup-e0438, r=Dylan-DPC

Clean up e0438 explanation

r? @Dylan-DPC

4 years agoRollup merge of #70145 - lzutao:patch-1, r=Dylan-DPC
Yuki Okushi [Fri, 20 Mar 2020 08:02:11 +0000 (17:02 +0900)]
Rollup merge of #70145 - lzutao:patch-1, r=Dylan-DPC

doc: Add quote to .init_array

The current formatting is not good without quotes:
![without-quote](https://i.imgur.com/RkIm4cr.png)

4 years agoRollup merge of #70133 - hermitcore:libpanic_unwind, r=nikomatsakis
Yuki Okushi [Fri, 20 Mar 2020 08:02:09 +0000 (17:02 +0900)]
Rollup merge of #70133 - hermitcore:libpanic_unwind, r=nikomatsakis

remove unused imports

patch is required to avoid compiler errors by building src/libpanic_unwind/hermit.rs

4 years agoRollup merge of #70131 - Aaron1011:fix/issue-55099-test, r=nikomatsakis
Yuki Okushi [Fri, 20 Mar 2020 08:02:08 +0000 (17:02 +0900)]
Rollup merge of #70131 - Aaron1011:fix/issue-55099-test, r=nikomatsakis

Add regression test for TAIT lifetime inference (issue #55099)

Fixes #55099

The minimized reproducer in issue #55099 now compiles successfully.
This commit adds a regression test for it.

4 years agoRollup merge of #70103 - GuillaumeGomez:cleanup-e0437, r=Dylan-DPC
Yuki Okushi [Fri, 20 Mar 2020 08:02:06 +0000 (17:02 +0900)]
Rollup merge of #70103 - GuillaumeGomez:cleanup-e0437, r=Dylan-DPC

Clean up E0437 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69935 - davidtwco:issue-69925, r=eddyb
Yuki Okushi [Fri, 20 Mar 2020 08:02:05 +0000 (17:02 +0900)]
Rollup merge of #69935 - davidtwco:issue-69925, r=eddyb

codegen/mir: support polymorphic `InstanceDef`s

cc #69925

This PR modifies the use of `subst_and_normalize_erasing_regions` on parts of the MIR bodies returned from `instance_mir`, so that `InstanceDef::CloneShim` and `InstanceDef::DropGlue` (where there is a type) do not perform substitutions. This avoids double substitutions and enables polymorphic `InstanceDef`s.

r? @eddyb
cc @nikomatsakis

4 years agoRollup merge of #69768 - oli-obk:union_field_ice, r=eddyb,RalfJung
Yuki Okushi [Fri, 20 Mar 2020 08:02:03 +0000 (17:02 +0900)]
Rollup merge of #69768 - oli-obk:union_field_ice, r=eddyb,RalfJung

Compute the correct layout for variants of uninhabited enums

r? @eddyb
cc @RalfJung

fixes #69191
cc #69763

4 years agoRollup merge of #69618 - hniksic:mem-forget-doc-fix, r=RalfJung
Yuki Okushi [Fri, 20 Mar 2020 08:02:01 +0000 (17:02 +0900)]
Rollup merge of #69618 - hniksic:mem-forget-doc-fix, r=RalfJung

Clarify the relationship between `forget()` and `ManuallyDrop`.

As discussed on reddit, this commit addresses two issues with the
documentation of `mem::forget()`:

* The documentation of `mem::forget()` can confuse the reader because of the
  discrepancy between usage examples that show correct usage and the
  accompanying text which speaks of the possibility of double-free.  The
  text that says "if the panic occurs before `mem::forget` was called"
  refers to a variant of the second example that was never shown, modified
  to use `mem::forget` instead of `ManuallyDrop`.  Ideally the documentation
  should show both variants, so it's clear what it's talking about.

  Also, the double free could be fixed just by placing `mem::forget(v)`
  before the construction of `s`.  Since the lifetimes of `s` and `v`
  wouldn't overlap, there would be no point where panic could cause a double
  free.  This could be mentioned, and contrasted against the more robust fix
  of using `ManuallyDrop`.

* This sentence seems unjustified: "For some types, operations such as
  passing ownership (to a funcion like `mem::forget`) requires them to
  actually be fully owned right now [...]".  Unlike C++, Rust has no move
  constructors, its moves are (possibly elided) bitwise copies.  Even if you
  pass an invalid object to `mem::forget`, no harm should come to pass
  because `mem::forget` consumes the object and exists solely to prevent
  drop, so there no one left to observe the invalid state state.

4 years agoRefactorings to begin getting rid of rustc_codegen_utils
Mark Mansi [Thu, 12 Mar 2020 23:07:58 +0000 (18:07 -0500)]
Refactorings to begin getting rid of rustc_codegen_utils

4 years agoMake std::sync::Arc compatible with ThreadSanitizer
Tomasz Miąsko [Fri, 20 Mar 2020 00:00:00 +0000 (00:00 +0000)]
Make std::sync::Arc compatible with ThreadSanitizer

The memory fences used previously in Arc implementation are not properly
understood by ThreadSanitizer as synchronization primitives. This had
unfortunate effect where running any non-trivial program compiled with
`-Z sanitizer=thread` would result in numerous false positives.

Replace acquire fences with acquire loads when using ThreadSanitizer to
address the issue.

4 years agoRemoved unused `Hasher` import.
CDirkx [Thu, 19 Mar 2020 20:58:11 +0000 (21:58 +0100)]
Removed unused `Hasher` import.

4 years agoUse erased regions in MIR
Matthew Jasper [Thu, 19 Mar 2020 11:40:38 +0000 (11:40 +0000)]
Use erased regions in MIR

4 years agoDerive PartialEq, Eq and Hash for RangeInclusive
CDirkx [Thu, 19 Mar 2020 19:45:47 +0000 (20:45 +0100)]
Derive PartialEq, Eq and Hash for RangeInclusive

The manual implementation of PartialEq, Eq and Hash for RangeInclusive was functionally equivalent to a derived implementation.

This change removes the manual implementation and adds the respective derives.
A side effect of this change is that the derives also add implementations for StructuralPartialEq and StructuralEq, which enables RangeInclusive to be used in const generics.

4 years agomake "other" in docs of `Option::{zip,zip_with}` monofont
Waffle [Thu, 19 Mar 2020 19:19:37 +0000 (22:19 +0300)]
make "other" in docs of `Option::{zip,zip_with}` monofont

4 years agorustc/query: tweak comments on hir_owner{,_nodes}.
Eduard-Mihai Burtescu [Wed, 18 Mar 2020 20:46:57 +0000 (22:46 +0200)]
rustc/query: tweak comments on hir_owner{,_nodes}.

4 years agoAuto merge of #69402 - GuillaumeGomez:extend-search, r=kinnison
bors [Thu, 19 Mar 2020 16:07:59 +0000 (16:07 +0000)]
Auto merge of #69402 - GuillaumeGomez:extend-search, r=kinnison

Extend search

I realized that when looking for "struct:String" in the rustdoc search for example, the "in arguments" and "returned" tabs were always empty. After some investigation, I realized it was because we only provided the name, and not the type, making it impossible to pass the "type filtering" check.

To resolve this, I added the type alongside the name. Note for the future: we could improve this by instead only registering the path id and use the path dictionary directly. The only problem with that solution (which I already tested) is that it becomes complicated for types in other crates. It'd force us to handle both case with an id and a case with `(name, type)`. I found the current PR big enough to not want to provide it directly. However, I think this is definitely worth it to make it work this way in the future.

About the two tests I added: they don't have much interest except checking that we actually have something returned in the search in the cases of a type filtering with and without literal search.

I also had to update a bit the test script to add the new locally global (haha) variable I created (`NO_TYPE_FILTER`). I added this variable to make the code easier to read than just "-1".

r? @kinnison

cc @ollie27

4 years agotriagebot.toml: accept typo due to pnkfelix
Mazdak Farrokhzad [Thu, 19 Mar 2020 14:38:31 +0000 (15:38 +0100)]
triagebot.toml: accept typo due to pnkfelix

4 years agoUse `assert_ignored` when encoding metadata
John Kåre Alsaker [Sat, 14 Mar 2020 12:41:38 +0000 (13:41 +0100)]
Use `assert_ignored` when encoding metadata

4 years agoAdd some comments
John Kåre Alsaker [Sat, 14 Mar 2020 12:39:33 +0000 (13:39 +0100)]
Add some comments

4 years agoMake metadata prefetching more accurate
John Kåre Alsaker [Mon, 13 Jan 2020 15:23:42 +0000 (16:23 +0100)]
Make metadata prefetching more accurate

4 years agoMake the timer more verbose
John Kåre Alsaker [Sat, 11 Jan 2020 03:47:20 +0000 (04:47 +0100)]
Make the timer more verbose

4 years agoPrefetch exported symbols
John Kåre Alsaker [Sat, 11 Jan 2020 03:02:22 +0000 (04:02 +0100)]
Prefetch exported symbols

4 years agoEncode exported symbols last
John Kåre Alsaker [Sat, 11 Jan 2020 02:42:40 +0000 (03:42 +0100)]
Encode exported symbols last

4 years agoPrefetch queries used by the metadata encoder
John Kåre Alsaker [Sat, 4 Jan 2020 20:42:28 +0000 (21:42 +0100)]
Prefetch queries used by the metadata encoder

4 years agoDon't hard-code the vector length in the examples.
Hrvoje Nikšić [Thu, 19 Mar 2020 12:56:48 +0000 (13:56 +0100)]
Don't hard-code the vector length in the examples.

Co-Authored-By: lzutao <taolzu@gmail.com>
4 years agoMinor re-wordings and typo fixes.
Hrvoje Nikšić [Wed, 18 Mar 2020 10:30:39 +0000 (11:30 +0100)]
Minor re-wordings and typo fixes.

Co-Authored-By: Ralf Jung <post@ralfj.de>
4 years agoRestore (and reword) the warning against passing invalid values to mem::forget.
Hrvoje Niksic [Wed, 4 Mar 2020 21:12:53 +0000 (22:12 +0100)]
Restore (and reword) the warning against passing invalid values to mem::forget.

As pointed out by Ralf Jung, dangling references and boxes are
undefined behavior as per
https://doc.rust-lang.org/reference/behavior-considered-undefined.html
and the Miri checker.

4 years agoClarify the relationship between `forget()` and `ManuallyDrop`.
Hrvoje Niksic [Sun, 1 Mar 2020 20:31:08 +0000 (21:31 +0100)]
Clarify the relationship between `forget()` and `ManuallyDrop`.

As discussed on reddit, this commit addresses two issues with the
documentation of `mem::forget()`:

* The documentation of `mem::forget()` can confuse the reader because of the
  discrepancy between usage examples that show correct usage and the
  accompanying text which speaks of the possibility of double-free.  The
  text that says "if the panic occurs before `mem::forget` was called"
  refers to a variant of the second example that was never shown, modified
  to use `mem::forget` instead of `ManuallyDrop`.  Ideally the documentation
  should show both variants, so it's clear what it's talking about.

  Also, the double free could be fixed just by placing `mem::forget(v)`
  before the construction of `s`.  Since the lifetimes of `s` and `v`
  wouldn't overlap, there would be no point where panic could cause a double
  free.  This could be mentioned, and contrasted against the more robust fix
  of using `ManuallyDrop`.

* This sentence seems unjustified: "For some types, operations such as
  passing ownership (to a funcion like `mem::forget`) requires them to
  actually be fully owned right now [...]".  Unlike C++, Rust has no move
  constructors, its moves are (possibly elided) bitwise copies.  Even if you
  pass an invalid object to `mem::forget`, no harm should come to pass
  because `mem::forget` consumes the object and exists solely to prevent
  drop, so there no one left to observe the invalid state state.

4 years agoClean up e0438 explanation
Guillaume Gomez [Thu, 19 Mar 2020 13:11:27 +0000 (14:11 +0100)]
Clean up e0438 explanation

4 years agoClean up E0437 explanation
Guillaume Gomez [Wed, 18 Mar 2020 13:13:48 +0000 (14:13 +0100)]
Clean up E0437 explanation

4 years agoAuto merge of #70137 - RalfJung:miri, r=RalfJung
bors [Thu, 19 Mar 2020 12:59:10 +0000 (12:59 +0000)]
Auto merge of #70137 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/70055
r? @ghost
Cc @oli-obk @Amanieu

4 years agohir: replace "items" terminology with "nodes" where appropriate.
Eduard-Mihai Burtescu [Wed, 18 Mar 2020 01:48:17 +0000 (03:48 +0200)]
hir: replace "items" terminology with "nodes" where appropriate.

4 years agodoc: Add quote to .init_array
lzutao [Thu, 19 Mar 2020 10:35:28 +0000 (17:35 +0700)]
doc: Add quote to .init_array

4 years agoadd delay_span_bug to TransmuteSizeDiff, just to be sure
Ralf Jung [Thu, 19 Mar 2020 08:47:48 +0000 (09:47 +0100)]
add delay_span_bug to TransmuteSizeDiff, just to be sure

4 years agoAuto merge of #66131 - eddyb:local-def-id, r=petrochenkov
bors [Thu, 19 Mar 2020 09:18:49 +0000 (09:18 +0000)]
Auto merge of #66131 - eddyb:local-def-id, r=petrochenkov

rustc: use LocalDefId instead of DefIndex where possible.

That is, wherever `DefIndex` always referred to a "def" in the local crate, I replaced it with `LocalDefId`.
While `LocalDefId` already existed, it wasn't used a lot, but I hope I'm on the right track.

Unresolved questions:
* [x] ~~should `LocalDefId` implement `rustc_index::Idx`?~~
  * ~~this would get rid of a couple more `DefIndex` uses~~
* [x] ~~should `LocalDefId` be encoded/decoded as just a `DefIndex`?~~
  * ~~right now it's a bit messy, `LocalDefId` encodes/decodes like `DefId`~~
* [x] ~~should `DefId::assert_local` be named something else, like `expect_local`?~~

A future PR should change `tcx.hir().local_def_id(...)` to return `LocalDefId` instead of `DefId`, as changing it in this PR would be too noisy.

r? @michaelwoerister cc @nikomatsakis @petrochenkov @Zoxc

4 years agorustc: use LocalDefId instead of DefIndex in hir::map::definitions.
Eduard-Mihai Burtescu [Sun, 3 Nov 2019 12:36:59 +0000 (14:36 +0200)]
rustc: use LocalDefId instead of DefIndex in hir::map::definitions.

4 years agorustc: use LocalDefId instead of DefIndex in ich.
Eduard-Mihai Burtescu [Tue, 5 Nov 2019 16:44:07 +0000 (18:44 +0200)]
rustc: use LocalDefId instead of DefIndex in ich.

4 years agorustc: use LocalDefId instead of DefIndex in HirId.
Eduard-Mihai Burtescu [Wed, 18 Mar 2020 18:27:59 +0000 (20:27 +0200)]
rustc: use LocalDefId instead of DefIndex in HirId.

4 years agorustc: use LocalDefId instead of DefIndex in hir::lowering.
Eduard-Mihai Burtescu [Sun, 3 Nov 2019 19:29:40 +0000 (21:29 +0200)]
rustc: use LocalDefId instead of DefIndex in hir::lowering.

4 years agorustc: introduce DefId::as_local(self) -> Option<LocalDefId> and use it.
Eduard-Mihai Burtescu [Sun, 3 Nov 2019 18:48:08 +0000 (20:48 +0200)]
rustc: introduce DefId::as_local(self) -> Option<LocalDefId> and use it.

4 years agorustc: rename DefId::to_local to expect_local and use it instead of LocalDefId::from_...
Eduard-Mihai Burtescu [Sun, 3 Nov 2019 12:48:52 +0000 (14:48 +0200)]
rustc: rename DefId::to_local to expect_local and use it instead of LocalDefId::from_def_id.

4 years agorustc: make LocalDefId's index field public like DefId's is.
Eduard-Mihai Burtescu [Thu, 31 Oct 2019 18:48:13 +0000 (20:48 +0200)]
rustc: make LocalDefId's index field public like DefId's is.

4 years agorustc_typeck: remove dead impl for `DefIndex`.
Eduard-Mihai Burtescu [Thu, 31 Oct 2019 14:27:44 +0000 (16:27 +0200)]
rustc_typeck: remove dead impl for `DefIndex`.

4 years agorustc: use LocalDefId instead of DefIndex for query keys.
Eduard-Mihai Burtescu [Thu, 31 Oct 2019 13:32:07 +0000 (15:32 +0200)]
rustc: use LocalDefId instead of DefIndex for query keys.

4 years agoupdate miri
Ralf Jung [Thu, 19 Mar 2020 08:08:13 +0000 (09:08 +0100)]
update miri

4 years agodo not 'return' in 'throw_' macros
Ralf Jung [Thu, 19 Mar 2020 08:07:43 +0000 (09:07 +0100)]
do not 'return' in 'throw_' macros

4 years agoremove unused imports
Stefan Lankes [Thu, 19 Mar 2020 06:43:16 +0000 (07:43 +0100)]
remove unused imports

patch is required to avoid compiler errors by building src/libpanic_unwind/hermit.rs

4 years agoAuto merge of #70132 - Centril:rollup-oe8unsn, r=Centril
bors [Thu, 19 Mar 2020 05:57:57 +0000 (05:57 +0000)]
Auto merge of #70132 - Centril:rollup-oe8unsn, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #68941 (Properly handle Spans that reference imported SourceFiles)
 - #69036 (rustc: don't resolve Instances which would produce malformed shims.)
 - #69443 (tidy: Better license checks.)
 - #69814 (Smaller and more correct generator codegen)
 - #69929 (Regenerate tables for Unicode 13.0.0)
 - #69959 (std: Don't abort process when printing panics in tests)
 - #69969 (unix: Set a guard page at the end of signal stacks)
 - #70005 ([rustdoc] Improve visibility for code blocks warnings)
 - #70088 (Use copy bound in atomic operations to generate simpler MIR)

Failed merges:

r? @ghost

4 years agoRollup merge of #70088 - tmiasko:atomic-copy, r=eddyb
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:41 +0000 (06:57 +0100)]
Rollup merge of #70088 - tmiasko:atomic-copy, r=eddyb

Use copy bound in atomic operations to generate simpler MIR

4 years agoRollup merge of #70005 - GuillaumeGomez:code-block-signs, r=kinnison
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:39 +0000 (06:57 +0100)]
Rollup merge of #70005 - GuillaumeGomez:code-block-signs, r=kinnison

[rustdoc] Improve visibility for code blocks warnings

It appeared that a lot of people didn't notice when a code block was meant to fail compilation or wasn't tested at all. The changes here make the colors less transparent and the icon bigger. So before it looked like this:

![old-light](https://user-images.githubusercontent.com/3050060/76687070-f1cdbb80-6620-11ea-9b73-0c787dc671f7.png)
![old-dark](https://user-images.githubusercontent.com/3050060/76687079-f4c8ac00-6620-11ea-90fb-e548329e01b4.png)

And now it looks like this:

![new-light](https://user-images.githubusercontent.com/3050060/76687092-fd20e700-6620-11ea-9ebb-2b6852f00899.png)
![new-dark](https://user-images.githubusercontent.com/3050060/76687091-fd20e700-6620-11ea-8fea-6854c8367b97.png)

cc @rust-lang/rustdoc
r? @kinnison

4 years agoRollup merge of #69969 - iximeow:sigstack-guard-page, r=cuviper
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:37 +0000 (06:57 +0100)]
Rollup merge of #69969 - iximeow:sigstack-guard-page, r=cuviper

unix: Set a guard page at the end of signal stacks

This mitigates possible issues when signal stacks overflow, which could
manifest as segfaults or in unlucky circumstances possible clobbering of
other memory values as stack overflows tend to enable.

I went ahead and made a PR for this because it's a pretty small change, though if I should open an issue/RFC for this and discuss there first I'll happily do so. I've also added some example programs that demonstrate the uncomfortably clobber-happy behavior we currently have, and the segfaults that could/should result instead, [here](https://github.com/iximeow/jubilant-train).

4 years agoRollup merge of #69959 - alexcrichton:fix-panic-in-print, r=Mark-Simulacrum
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:36 +0000 (06:57 +0100)]
Rollup merge of #69959 - alexcrichton:fix-panic-in-print, r=Mark-Simulacrum

std: Don't abort process when printing panics in tests

This commit fixes an issue when using `set_print` and friends, notably
used by libtest, to avoid aborting the process if printing panics. This
previously panicked due to borrowing a mutable `RefCell` twice, and this
is worked around by borrowing these cells for less time, instead
taking out and removing contents temporarily.

Closes #69558

4 years agoRollup merge of #69929 - cuviper:unicode-13.0.0, r=Mark-Simulacrum
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:34 +0000 (06:57 +0100)]
Rollup merge of #69929 - cuviper:unicode-13.0.0, r=Mark-Simulacrum

Regenerate tables for Unicode 13.0.0

4 years agoRollup merge of #69814 - jonas-schievink:gen-ret-unw, r=Zoxc
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:32 +0000 (06:57 +0100)]
Rollup merge of #69814 - jonas-schievink:gen-ret-unw, r=Zoxc

Smaller and more correct generator codegen

This removes unnecessary panicking branches in the resume function when the generator can not return or unwind, respectively.

Closes https://github.com/rust-lang/rust/issues/66100

It also addresses the correctness concerns wrt poisoning on unwind. These are not currently a soundness issue because any operation *inside* a generator that could possibly unwind will result in a cleanup path for dropping it, ultimately reaching a `Resume` terminator, which we already handled correctly. Future MIR optimizations might optimize that out, though.

r? @Zoxc

4 years agoRollup merge of #69443 - ehuss:tidy-license, r=skade,Mark-Simulacrum
Mazdak Farrokhzad [Thu, 19 Mar 2020 05:57:30 +0000 (06:57 +0100)]
Rollup merge of #69443 - ehuss:tidy-license, r=skade,Mark-Simulacrum

tidy: Better license checks.

This implements some improvements to the license checks in tidy:

* Use `cargo_metadata` instead of parsing vendored crates. This allows license checks to run without vendoring enabled, and allows the checks to run on PR builds.
* Check for stale entries.
* Check that the licenses for exceptions are what we think they are.
* Verify exceptions do not leak into the runtime.

Closes #62618
Closes #62619
Closes #63238 (I think)

There are some substantive changes here. The follow licenses have changed from the original comments:

* openssl BSD+advertising clause to Apache-2.0
* pest MPL2 to MIT/Apache-2.0
* smallvec MPL2 to MIT/Apache-2.0
* clippy lints MPL2 to MIT OR Apache-2.0