Commit Graph

89792 Commits

Author SHA1 Message Date
kennytm
0fecb6d97d
Rollup merge of #58433 - RalfJung:miri-mark-tests, r=TimNN
Update which libcore/liballoc tests Miri ignores, and document why
2019-02-16 14:11:44 +08:00
kennytm
13b055d5db
Rollup merge of #58429 - RalfJung:box, r=TimNN
fix Box::into_unique effecitvely transmuting to a raw ptr

Miri/Stacked Borrows treat `Box` specially: they assert that it is unique, and tag it appropriately. However, currently, `Box::into_inner` is not aware of that and returns a raw pointer (wrapped in a `Unique`) that carries the same tag as the box, meaning it carries a `Uniq` tag. This leads to all sorts of problems when people use the raw pointer they get out of the `Unique` type.

In the future, it'd be interesting to make `Unique` also carry some kind of uniqueness. In that case, something like this would instead be needed whenever a raw pointer is extracted from a `Unique`. However, that is out-of-scope for the current version of Stacked Borrows. So until then, this changes `into_unique` to perform a proper reference-to-raw-ptr-cast, which clears the tag.
2019-02-16 14:11:41 +08:00
kennytm
092d191965
Rollup merge of #58359 - taiki-e:impl_snapshot_for, r=oli-obk
librustc_mir: use ? in impl_snapshot_for! macro
2019-02-16 14:11:38 +08:00
kennytm
9a3e22e32f
Rollup merge of #58306 - GuillaumeGomez:crate-browser-history, r=QuietMisdreavus
Don't default on std crate when manipulating browser history

Fixes #58263.

r? @QuietMisdreavus
2019-02-16 14:11:35 +08:00
kennytm
9472f0cf6b
Rollup merge of #58293 - xfix:patch-16, r=Mark-Simulacrum
Remove code for updating copyright years in generate-deriving-span-tests

It's no longer necessary, as there is no license header anymore.
2019-02-16 14:11:33 +08:00
kennytm
49107c3398
Rollup merge of #58196 - varkor:const-fn-feature-gate-error, r=oli-obk
Add specific feature gate error for const-unstable features

Before:
```
error: `impl Trait` in const fn is unstable
 --> src/lib.rs:7:19
  |
7 | const fn foo() -> impl T {
  |                   ^^^^^^

error: aborting due to previous error
```

After:
```
error[E0723]: `impl Trait` in const fn is unstable (see issue #57563)
 --> src/lib.rs:7:19
  |
7 | const fn foo() -> impl T {
  |                   ^^^^^^
  = help: add #![feature(const_fn)] to the crate attributes to enable

error: aborting due to previous error
```

This improves the situation with https://github.com/rust-lang/rust/issues/57563. Fixes https://github.com/rust-lang/rust/issues/57544. Fixes https://github.com/rust-lang/rust/issues/54469.

r? @oli-obk
2019-02-16 14:11:30 +08:00
kennytm
f05e6bf708
Rollup merge of #58074 - scottmcm:stabilize-sort_by_cached_key, r=SimonSapin
Stabilize slice_sort_by_cached_key

I was going to ask on the tracking issue (https://github.com/rust-lang/rust/issues/34447), but decided to just send this and hope for an FCP here.  The method was added last March by https://github.com/rust-lang/rust/pull/48639.

Signature: https://doc.rust-lang.org/std/primitive.slice.html#method.sort_by_cached_key
```rust
impl [T] {
    pub fn sort_by_cached_key<K, F>(&mut self, f: F)
        where F: FnMut(&T) -> K, K: Ord;
}
```

That's an identical signature to the existing `sort_by_key`, so I think the questions are just naming, implementation, and the usual "do we want this?".

The implementation seems to have proven its use in rustc at least, which many uses: https://github.com/rust-lang/rust/search?l=Rust&q=sort_by_cached_key

(I'm asking because it's exactly what I just needed the other day:
```rust
    all_positions.sort_by_cached_key(|&n|
        data::CITIES.iter()
            .map(|x| *metric_closure.get_edge(n, x.pos).unwrap())
            .sum::<usize>()
    );
```
since caching that key is a pretty obviously good idea.)

Closes #34447
2019-02-16 14:11:28 +08:00
kennytm
84e88da431
Rollup merge of #57981 - Zoxc:fix-57979, r=nikomatsakis
Fix #57730

cc https://github.com/rust-lang/rust/pull/57730

r? @cramertj
2019-02-16 14:11:20 +08:00
bors
f058741a67 Auto merge of #58403 - eddyb:requalify, r=oli-obk
rustc_mir: split qualify_consts' "value qualification" bitflags into separate computations.

Prerequisite for computing those bits through a dataflow algorithm ~~(which I might do in this PR later)~~.

This PR should not change behavior overall, other than treating `simd_shuffle*` identically to `#[rustc_args_required_const]` (maybe we should just have `#[rustc_args_required_const]` on the intrinsic imports of `simd_shuffle*`? cc @gnzlbg)

cc @oli-obk @alexreg
2019-02-15 12:15:17 +00:00
varkor
8ca44069bb Add updated NLL tests 2019-02-14 15:47:37 +00:00
Niko Matsakis
cce2c89e3b add .stderr file 2019-02-14 10:26:02 -05:00
varkor
519783adb3 Fix documentation typo 2019-02-14 15:04:37 +00:00
varkor
feb3408f11 Update const fn tests 2019-02-14 15:04:37 +00:00
varkor
2c339aeb7b Add specific error for unstable const fn features 2019-02-14 15:04:37 +00:00
Eduard-Mihai Burtescu
f04424acd1 rustc_mir: compute all the qualification bits separately in qualify_consts. 2019-02-14 13:36:51 +02:00
Eduard-Mihai Burtescu
81648a0a6e rustc_mir: rename qualify_consts::Qualifier to ConstCx and keep in Checker as a field. 2019-02-14 13:36:51 +02:00
Eduard-Mihai Burtescu
99fc3eff57 rustc_mir: do not treat NEEDS_DROP as unexpected in qualify_consts. 2019-02-14 13:36:51 +02:00
Eduard-Mihai Burtescu
1d6332def3 rustc_mir: avoid having an Option around each local qualification in qualify_consts. 2019-02-14 13:36:51 +02:00
Eduard-Mihai Burtescu
2de5b38943 rustc_mir: rename Qualif::for_ty to Qualif::any_value_of_ty`. 2019-02-14 13:36:51 +02:00
Eduard-Mihai Burtescu
af131d55b6 rustc_mir: remove qualify_consts::Qualif::FN_ARGUMENT. 2019-02-14 13:36:51 +02:00
Eduard-Mihai Burtescu
b4fbebb636 rustc_mir: remove outdated const fn stability diagnostic. 2019-02-14 13:36:51 +02:00
Eduard-Mihai Burtescu
f6d1e9790c rustc_mir: split qualify_consts' checking and value qualification. 2019-02-14 13:36:51 +02:00
Eduard-Mihai Burtescu
732a2dc095 rustc_mir: split off some qualify_consts::Checker fields into a State struct. 2019-02-14 13:36:51 +02:00
Eduard-Mihai Burtescu
a5e4d1ad7d rustc_mir: rename qualify_consts::Qualifier to Checker. 2019-02-14 13:36:51 +02:00
bors
f47ec2ad5b Auto merge of #58455 - Centril:rollup, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #58309 (Add more profiler events)
 - #58347 (Closure bounds fixes)
 - #58365 (Add an option to print the status of incremental tasks / dep nodes after running them)
 - #58371 (Check user type annotations for range patterns.)
 - #58378 (rustc: Implement incremental "fat" LTO)
 - #58407 (specify "upper camel case" in style lint)
 - #58449 (Notify @topecongiro when the state of rustfmt has changed)

Failed merges:

r? @ghost
2019-02-14 10:32:25 +00:00
Mazdak Farrokhzad
410b4456ca
Rollup merge of #58449 - topecongiro:rustfmt-toolstate, r=Centril
Notify @topecongiro when the state of rustfmt has changed

I would like to get notified when the state of rustfmt has changed.
Context: I am currently a leader of the rustfmt working group.

cc @nrc do you still want to get notified?
2019-02-14 08:24:18 +01:00
Mazdak Farrokhzad
a115fea884
Rollup merge of #58407 - euclio:upper-camel-case, r=estebank
specify "upper camel case" in style lint

Also, fix an issue where internal upper case letters were converted to
lower case.

Fixes #57319.
2019-02-14 08:24:17 +01:00
Mazdak Farrokhzad
2a539a1b91
Rollup merge of #58378 - alexcrichton:incremental-lto, r=michaelwoerister
rustc: Implement incremental "fat" LTO

Currently the compiler will produce an error if both incremental
compilation and full fat LTO is requested. With recent changes and the
advent of incremental ThinLTO, however, all the hard work is already
done for us and it's actually not too bad to remove this error!

This commit updates the codegen backend to allow incremental full fat
LTO. The semantics are that the input modules to LTO are all produce
incrementally, but the final LTO step is always done unconditionally
regardless of whether the inputs changed or not. The only real
incremental win we could have here is if zero of the input modules
changed, but that's so rare it's unlikely to be worthwhile to implement
such a code path.

cc #57968
cc rust-lang/cargo#6643
2019-02-14 08:24:15 +01:00
Mazdak Farrokhzad
0dbb867beb
Rollup merge of #58371 - davidtwco:issue-58299, r=arielb1
Check user type annotations for range patterns.

Fixes #58299.

This PR builds on the fix from #58161 (which fixed miscompilation
caused by the introduction of `AscribeUserType` patterns for associated
constants) to start checking these patterns are well-formed for ranges
(previous fix just ignored them so that miscompilation wouldn't occur).

r? @arielb1
2019-02-14 08:24:14 +01:00
Mazdak Farrokhzad
0431857770
Rollup merge of #58365 - Zoxc:task-status, r=michaelwoerister
Add an option to print the status of incremental tasks / dep nodes after running them

r? @michaelwoerister
2019-02-14 08:24:13 +01:00
Mazdak Farrokhzad
975cdb57d0
Rollup merge of #58347 - matthewjasper:closure-bounds-fixes, r=pnkfelix
Closure bounds fixes

* Ensures that "nice region errors" are buffered so that they are sorted and migrated correctly.
* Propagates fewer constraints for closures (cc #58178)
* Propagate constraints from closures more precisely (#58127)

Closes #58127

r? @nikomatsakis
2019-02-14 08:24:12 +01:00
Mazdak Farrokhzad
f9c9512628
Rollup merge of #58309 - wesleywiser:add_more_profiler_events, r=michaelwoerister
Add more profiler events

- Adds Start\Stop events for time spent loading incremental query results from disk.

- Adds Start\Stop events for time spent blocked waiting for queries to complete (when parallel queries are enabled).

r? @michaelwoerister
2019-02-14 08:24:10 +01:00
bors
c67d4749a5 Auto merge of #58446 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #57451 (suggestion-diagnostics: as_ref improve snippet)
 - #57856 (Convert old first edition links to current edition one)
 - #57992 (Update the future/task API)
 - #58258 (Reduce the size of `hir::Expr`.)
 - #58267 (Tweak "incompatible match arms" error)
 - #58296 (Hidden suggestion support)
 - #58301 (Enable comparing fat pointers)
 - #58308 (Extract block to insert an intrinsic into its own function)

Failed merges:

r? @ghost
2019-02-14 04:22:35 +00:00
topecongiro
be121a0cd1 Notify @topecongiro when the state of rustfmt has changed 2019-02-14 11:11:05 +09:00
Mazdak Farrokhzad
a0767d6096
Rollup merge of #58308 - gnzlbg:context_insert_intr, r=eddyb
Extract block to insert an intrinsic into its own function

r? @eddyb
2019-02-14 02:41:24 +01:00
Mazdak Farrokhzad
fab0f9be32
Rollup merge of #58301 - RalfJung:fat-ptr-eq, r=oli-obk
Enable comparing fat pointers

Also refactor our binops a bit to make that happen more easily.

r? @oli-obk
2019-02-14 02:41:23 +01:00
Mazdak Farrokhzad
56e19160af
Rollup merge of #58296 - estebank:hidden-suggestion, r=oli-obk
Hidden suggestion support

Add way to hide suggestion snippet window from cli output to avoid cluttered spans that don't enhance understanding.

r? @pietroalbini CC @zackmdavis
2019-02-14 02:41:21 +01:00
Mazdak Farrokhzad
4ad3cf2533
Rollup merge of #58267 - estebank:match-arms, r=matthewjasper
Tweak "incompatible match arms" error

- Point at the body expression of the match arm with the type error.
- Point at the prior match arms explicitly stating the evaluated type.
- Point at the entire match expr in a secondary span, instead of primary.
- For type errors in the first match arm, the cause is outside of the
  match, treat as implicit block error to give a more appropriate error.

Fix #46776, fix #57206.
CC #24157, #38234.
2019-02-14 02:41:20 +01:00
Mazdak Farrokhzad
b6ed206484
Rollup merge of #58258 - nnethercote:shrink-hir-Expr, r=michaelwoerister
Reduce the size of `hir::Expr`.

From 104 bytes to 72 bytes on x86-64. This slightly reduces instruction
counts.

Also add an assertion about the size.
2019-02-14 02:41:19 +01:00
Mazdak Farrokhzad
919cf42feb
Rollup merge of #57992 - Matthias247:waker4, r=cramertj
Update the future/task API

This change updates the future and task API as discussed in the stabilization RFC at https://github.com/rust-lang/rfcs/pull/2592.

Changes:
- Replacing UnsafeWake with RawWaker and RawWakerVtable
- Removal of LocalWaker
- Removal of Arc-based Wake trait
2019-02-14 02:41:17 +01:00
Mazdak Farrokhzad
aa896f30bb
Rollup merge of #57856 - lzutao:fix-old-first-edition, r=steveklabnik
Convert old first edition links to current edition one

r? @steveklabnik
2019-02-14 02:41:16 +01:00
Mazdak Farrokhzad
93ecae63d8
Rollup merge of #57451 - dlrobertson:can_use_as_ref_nit, r=estebank
suggestion-diagnostics: as_ref improve snippet

Improve the code snippet suggested in suggestion-diagnostics when
suggesting the use of as_ref.

Given:

```rust
fn test(x: &usize) {}
fn main() {
    Some(42).map(|x| test(x));
}
```

Suggest

```
  help: consider using `as_ref` instead: `as_ref().map`
```

Instead of

```
  help: consider using `as_ref` instead: `as_ref().`
```
2019-02-14 02:41:15 +01:00
Nicholas Nethercote
5d65e8cc7a Reduce the size of hir::Expr.
From 104 bytes to 72 bytes on x86-64. This slightly reduces instruction
counts.

Also add an assertion about the size.
2019-02-14 11:52:03 +11:00
bors
4772dc8087 Auto merge of #58432 - Centril:rollup, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #58110 (libpanic_unwind => 2018)
 - #58167 (HirId-ify hir::BodyId)
 - #58202 (Ignore future deprecations in #[deprecated])
 - #58272 (Cut down on number formating code size)
 - #58276 (Improve the error messages for missing stability attributes)
 - #58354 (Fix ICE and invalid filenames in MIR printing code)
 - #58381 (Only suggest imports if not imported.)
 - #58386 (Fix #54242)
 - #58400 (Fix rustc_driver swallowing errors when compilation is stopped)
 - #58420 (target/uefi: clarify documentation)

Failed merges:

r? @ghost
2019-02-13 22:23:09 +00:00
Matthew Jasper
79e8c31176 Propagate region constraints more precisely from closures 2019-02-13 19:41:31 +00:00
Matthew Jasper
ea613f30d9 Buffer and migrate nice region errors 2019-02-13 19:41:31 +00:00
Matthew Jasper
168c14a1a5 Avoid propagating redundant outlives constraints from closures 2019-02-13 18:50:46 +00:00
Andy Russell
2f95299f6b
specify "upper camel case" in style lint
Also, fix an issue where internal upper case letters were converted to
lower case.
2019-02-13 13:41:32 -05:00
Dan Robertson
285d4a7eb6
suggestion-diagnostics: as_ref improve snippet
Improve the code snippet suggested in suggestion-diagnostics when
suggesting the use of as_ref.
2019-02-13 17:52:22 +00:00
Ralf Jung
c154bf7db4 miri: test with slightly larger BTrees 2019-02-13 18:21:13 +01:00