Commit Graph

90470 Commits

Author SHA1 Message Date
Oliver Scherer
235a6b7d06 Expose const -> op functions that don't allow violiting const eval invariants 2019-02-16 12:32:22 +01:00
Philipp Hansch
d6a98f4b3a
Notify myself when Clippy toolstate changes 2019-02-16 11:59:25 +01:00
kennytm
9a2437c0dc
Rollup merge of #58468 - RalfJung:maybe-uninit-split, r=Centril
split MaybeUninit into several features, expand docs a bit

This splits the `maybe_uninit` feature gate into several:

* `maybe_uninit` for what we will hopefully stabilize soon-ish.
* `maybe_uninit_ref` for creating references into `MaybeUninit`, for which the rules are not yet clear.
* `maybe_uninit_slice` for handling slices of `MaybeUninit`, which needs more API design work.
* `maybe_uninit_array` for creating arrays of `MaybeUninit` using a macro (because we don't have https://github.com/rust-lang/rust/issues/49147 yet).

Is that an okay thing to do? The goal is to help people avoid APIs we do not want to stabilize yet. I used this to make sure rustc itself does not use `get_ref` and `get_mut`.

I also extended the docs to advise against uninitialized integers -- again this is something for which the rules are still being discussed.
2019-02-16 14:11:55 +08:00
kennytm
762b988a0a
Rollup merge of #58448 - euclio:missing-summaries, r=QuietMisdreavus
rustdoc: mask `compiler_builtins` docs

Fixes #46783.

I wasn't able to fully confirm the underlying cause, but my theory is that functions in `compiler_builtins` were overwriting functions with the same names in libcore in the search index. Since the functions in `compiler_builtins` didn't have docs, that's why they weren't appearing in the results.

Masking the `compiler_builtins` crate fixes the search results. It appears that this crate was accidentally unmasked in #49503.
2019-02-16 14:11:52 +08:00
kennytm
30019ed413
Rollup merge of #58440 - gnzlbg:v6, r=japaric
Whitelist the ARM v6 target-feature
2019-02-16 14:11:50 +08:00
kennytm
50f3c81c0e
Rollup merge of #58438 - cuviper:posix_spawn_file_actions_addchdir_np, r=alexcrichton
Use posix_spawn_file_actions_addchdir_np when possible

This is a non-POSIX extension implemented in Solaris and in glibc 2.29.
With this we can still use `posix_spawn()` when `Command::current_dir()`
has been set, otherwise we fallback to `fork(); chdir(); exec()`.
2019-02-16 14:11:47 +08:00
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
Lucas Molas
ae5f7224b5 nll: remove IdentityMap and LiveVariableMap
With `NllLivenessMap` and `LiveVar` removed, the `IdentityMap` (remaining
structure implementing the `LiveVariableMap` trait) loses its meaning.

Specialize the `LiveVarSet` to a `BitSet<Local>` removing the `V` and related
parameters. The `LiveVarSet<V>` was only being used as `LiveVarSet<Local>` so
this commit doesn't bring any change to the logic, it just removes an unused
parameter (that without `LiveVar` now, it couldn't have been specialized to
anything but `Local`).
2019-02-15 21:46:17 -03:00
Lucas Molas
d6ede9192d nll: remove NllLivenessMap and LiveVar
Extract the `compute` logic (now renamed `compute_live_locals`) from
`NllLivenessMap` to the `liveness` module. Remove the unused structures.
2019-02-15 21:40:24 -03:00
Lucas Molas
4ae4e0501b nll: remove NllLivenessMap from LocalUseMap
Extend `LocalUseMap`'s `IndexVec`s that track def/use/drop data to store the
original `Local` indexes and not the compacted `LiveVar` ones (favoring speed
and code simplicity over space). Remove the `NllLivenessMap` embedded inside it
since it's no longer needed to perform the `LiveVar`/`Local` conversion.
2019-02-15 21:09:53 -03:00
Lucas Molas
200bc02a5e nll: remove NllLivenessMap from LivenessContext
It was used in `compute_for_all_locals` to iterate only the `Local`s that need
liveness analysis (filtered through `compute`). Instead, explicitly extract that
reduced set (as `live_locals`) in `trace` and pass it to
`compute_for_all_locals`.

Change the variable type used in `compute_for_all_locals` from `LiveVar` to
`Local` and do the same for its helper functions (and the functions in
`LocalUseMap` they rely on):

* `add_defs_for`                 -> `LocalUseMap::defs`
* `compute_use_live_points_for`  -> `LocalUseMap::uses`
* `compute_drop_live_points_for` -> `LocalUseMap::drops`

Push back the use of `LiveVar` to the `LocalUseMap` (where the other
`NllLivenessMap` remains embedded) functions which internally do the
`from_local` conversion.
2019-02-15 20:54:46 -03:00
varkor
18ce997e51 Fix rebase issue 2019-02-15 23:34:04 +00:00
varkor
9cfdb80085 Update tests
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-15 22:29:24 +00:00
varkor
2279907fd2 Take Const into account with nonstandard style lint
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-15 22:29:24 +00:00
varkor
10602f1dbf Drive-by cleanup
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-15 22:29:24 +00:00
varkor
7f3c6d7c04 Take Const into account in HIR
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-15 22:29:24 +00:00
varkor
ddf881110d Add E0111
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-15 22:28:49 +00:00
varkor
475f20c73d Add Const kind to rustdoc
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-15 22:28:49 +00:00
varkor
9a5f7b1eae Move const generic error from lowering to collect
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-15 22:28:48 +00:00
varkor
d44030d8ec Add pretty-printing for const generics
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-15 22:28:48 +00:00
varkor
725ba9625e Add Const kind to HIR
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-15 22:28:48 +00:00
bors
eac09088e1 Auto merge of #57880 - Zoxc:error-on-cycle, r=michaelwoerister
Always emit an error for a query cycle

r? @michaelwoerister

cc @nikomatsakis @wesleywiser
2019-02-15 22:22:10 +00:00
Nathan
4ad8770b26 Fix documentation for std::path::PathBuf::pop
Closes #58474.
2019-02-15 12:20:46 -05:00
bors
a9410cd1af Auto merge of #58406 - Disasm:rv64-support, r=nagisa
Add riscv64{imac,gc}-unknown-none-elf targets

Previous attempt by @fintelia: https://github.com/rust-lang/rust/pull/58012

Related: https://github.com/rust-embedded/wg/issues/218
2019-02-15 16:20:12 +00:00
Felix S. Klock II
9661ee6af4 fix tests post-rebase 2019-02-15 15:52:29 +01:00
Konrad Borowski
14001e8a7b Fix runtime error in generate-keyword-tests
The script was made unusable after removing license headers.
2019-02-15 14:48:21 +01:00
Niko Matsakis
4db6a9b82f make generalization code create new variables in correct universe
In our type inference system, when we "generalize" a type T to become
a suitable value for a type variable V, we sometimes wind up creating
new inference variables. So, for example, if we are making V be some
subtype of `&'X u32`, then we might instantiate V with `&'Y u32`.
This generalized type is then related `&'Y u32 <: &'X u32`, resulting
in a region constriant `'Y: 'X`. Previously, however, we were making
these fresh variables like `'Y` in the "current universe", but they
should be created in the universe of V. Moreover, we sometimes cheat
in an invariant context and avoid creating fresh variables if we know
the result must be equal -- we can only do that when the universes
work out.
2019-02-15 14:38:26 +01:00
Niko Matsakis
a49c9fb8c3 include more universe information in debug! printouts 2019-02-15 14:27:10 +01:00
Niko Matsakis
378741b703 print more information for closures when -Zverbose is given
Ideally, we'd probably print the closure substs themselves actually.
2019-02-15 14:27:10 +01: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
Paul Dicker
503e74e969 Fix SECURITY_SQOS_PRESENT missing
if security_qos_flags(SECURITY_ANONYMOUS) is set
2019-02-15 10:07:03 +01:00
Saleem Jaffer
2c8e7082f1 compile-pass test for #53606 2019-02-15 14:28:24 +05:30
kennytm
d21026e3e0
Fix the syntax error in publish_toolstate.py 2019-02-15 14:26:27 +08:00
John Kåre Alsaker
82d7e33972 Remove stolen 2019-02-15 03:51:48 +01:00
John Kåre Alsaker
82ec72391f Always emit an error for a query cycle 2019-02-15 03:51:47 +01:00
Ralf Jung
95ef9b4fc2 make Centril happy 2019-02-14 22:31:06 +01:00
gnzlbg
1d6ce5228e Whitelist the ARM v8 target-feature 2019-02-14 22:00:33 +01:00
Ralf Jung
b5ab2c7f1c split MaybeUninit into several features, expand docs a bit 2019-02-14 20:07:57 +01: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
Ralf Jung
c35a18ec2d remove MaybeUninit::into_inner 2019-02-14 16:21:21 +01:00
Ralf Jung
1e4ab1eca6 update stdsimd 2019-02-14 16:20:58 +01:00
Ralf Jung
a707a85530 fixed for libstd build 2019-02-14 16:20:58 +01:00