Commit Graph

96872 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
ba835dffe6
Rollup merge of #62904 - nikic:arm-d32, r=alexcrichton
Disable d32 on armv6 hf targets

We already do this on armv7 targets. It seems that this now gets enabled by default if '+vfp2` is specified, so disable it explicitly.

Hopefully fixes #62841.

r? @alexcrichton
2019-07-26 18:56:48 +02:00
Mazdak Farrokhzad
ceea0be207
Rollup merge of #62862 - BaoshanPang:cleanup, r=alexcrichton
code cleanup

remove all codes that are not used by vxWorks
2019-07-26 18:56:47 +02:00
Mazdak Farrokhzad
5ffdca77c4
Rollup merge of #62828 - nikic:fadd-mul-reductions, r=eddyb
Remove vector fadd/fmul reduction workarounds

The bugs that this was working around have been fixed in LLVM 9.

r? @gnzlbg
2019-07-26 18:56:45 +02:00
Mazdak Farrokhzad
632ce7402f
Rollup merge of #62801 - bjorn3:remove_lower_128bit_ops, r=alexcrichton
Remove support for -Zlower-128bit-ops

It is broken and unused

cc https://github.com/rust-lang/rust/issues/58969

blocked https://github.com/rust-lang-nursery/compiler-builtins/pull/302 (removes definitions of the lang items removed in this PR)

r? @alexcrichton
2019-07-26 18:56:43 +02:00
Mazdak Farrokhzad
9d122670fd
Rollup merge of #62692 - eddyb:precompute-niches, r=oli-obk
rustc: precompute the largest Niche and store it in LayoutDetails.

Since we only ever can use at most one niche, it makes sense to just store that in the layout, for the simplest caching (especially as it's almost trivial to compute).

There might be a speedup from this, but even if it's marginal now, the caching would be a more significant benefit for future optimization attempts.
2019-07-26 18:56:41 +02:00
Mazdak Farrokhzad
d1f86c13e4
Rollup merge of #62583 - sfackler:unpin-raw, r=cramertj
Implement Unpin for all raw pointers

Like references and boxes, moving the pointer doesn't move the
pointed-to value, so this is safe.

r? @cramertj
2019-07-26 18:56:40 +02:00
Mazdak Farrokhzad
625aa60b3a
Rollup merge of #62421 - JohnTitor:U007D-master, r=alexcrichton
Introduce `as_deref` to Option

This is re-submission for #59628.
Renames `deref()` to `as_deref()` and adds `deref_mut()` impls and tests.

CC #50264

r? @Kimundi
(I picked you as you're the previous reviewer.)
2019-07-26 18:56:38 +02:00
Mazdak Farrokhzad
67009d3677
Rollup merge of #62310 - GuillaumeGomez:add-missing-doc-links-boxed, r=Centril
Add missing doc links in boxed module

r? @rust-lang/docs
2019-07-26 18:56:36 +02:00
Mazdak Farrokhzad
58b53d1add
Rollup merge of #62120 - GuillaumeGomez:add-missing-type-links, r=Centril
Add missing type links in documentation

r? @rust-lang/docs
2019-07-26 18:56:34 +02:00
Mazdak Farrokhzad
68d94bd741
Rollup merge of #62084 - euclio:unicode-table-tweak, r=kennytm
allow clippy::unreadable_literal in unicode tables

Also modifies the generation script to emit 2018 edition paths.
2019-07-26 18:56:33 +02:00
Pietro Albini
fb9f3e6dec
ci: add debug checks for pypi network outages 2019-07-26 18:51:01 +02:00
David Wood
cae8680544
lowering: Omit bare trait lint on macro call sites
This commit implements a hacky fix for detecting when a span is pointing
at a macro call site so that bare trait lints are not made incorrectly.
2019-07-26 17:31:39 +01:00
Niv Kaminer
d7b211025e add repr(transparent) to IoSliceMut where missing 2019-07-26 18:56:47 +03:00
Oliver Scherer
0cd71678e1
Update src/librustc_mir/interpret/memory.rs
Co-Authored-By: Ralf Jung <post@ralfj.de>
2019-07-26 17:44:11 +02:00
Oliver Scherer
6e04ca7fb6
Update src/librustc_mir/interpret/memory.rs
Co-Authored-By: Ralf Jung <post@ralfj.de>
2019-07-26 17:43:49 +02:00
Oliver Scherer
796e7a8d7c Address review comments 2019-07-26 17:12:10 +02:00
Alex Crichton
17312337a9 rustc: Stabilize options for pipelined compilation
This commit stabilizes options in the compiler necessary for Cargo to
enable "pipelined compilation" by default. The concept of pipelined
compilation, how it's implemented, and what it means for rustc are
documented in #60988. This PR is coupled with a PR against Cargo
(rust-lang/cargo#7143) which updates Cargo's support for pipelined
compliation to rustc, and also enables support by default in Cargo.
(note that the Cargo PR cannot land until this one against rustc lands).

The technical changes performed here were to stabilize the functionality
proposed in #60419 and #60987, the underlying pieces to enable pipelined
compilation support in Cargo. The issues have had some discussion during
stabilization, but the newly stabilized surface area here is:

* A new `--json` flag was added to the compiler.
* The `--json` flag can be passed multiple times.
* The value of the `--json` flag is a comma-separated list of
  directives.
* The `--json` flag cannot be combined with `--color`
* The `--json` flag must be combined with `--error-format=json`
* The acceptable list of directives to `--json` are:
  * `diagnostic-short` - the `rendered` field of diagnostics will have a
    "short" rendering matching `--error-format=short`
  * `diagnostic-rendered-ansi` - the `rendered` field of diagnostics
    will be colorized with ansi color codes embedded in the string field
  * `artifacts` - JSON blobs will be emitted for artifacts being emitted
    by the compiler

The unstable `-Z emit-artifact-notifications` and `--json-rendered`
flags have also been removed during this commit as well.

Closes #60419
Closes #60987
Closes #60988
2019-07-26 07:46:35 -07:00
Alex Crichton
c69f367baf std: Add more accessors for Metadata on Windows
This commit adds accessors for more fields in `fs::Metadata` on Windows
which weren't previously exposed. There's two sources of `fs::Metadata`
on Windows currently, one from `DirEntry` and one from a file itself.
These two sources of information don't actually have the same set of
fields exposed in their stat information, however. To handle this the
platform-specific accessors of Windows-specific information all return
`Option` to return `None` in the case a metadata comes from a
`DirEntry`, but they're guaranteed to return `Some` if it comes from a
file itself.

This is motivated by some changes in CraneStation/wasi-common#42, and
I'm curious how others feel about this platform-specific functionality!
2019-07-26 07:35:59 -07:00
Tomasz Różański
4a2f9b6d62 Remove redundant mut from variable declaration. 2019-07-26 15:07:55 +02:00
Vadim Petrochenkov
8eaf17bca2 Introduce built-in macros through libcore 2019-07-26 13:09:54 +03:00
bors
1a56336286 Auto merge of #62914 - ehuss:update-cargo, r=alexcrichton
Update cargo

11 commits in e3563dbdcd2e370bc4f11d080f739d82d25773fd..d0f828419d6ce6be21a90866964f58eb2c07cd56
2019-07-16 19:22:44 +0000 to 2019-07-23 21:58:59 +0000
- Remove include/exclude glob warning. (rust-lang/cargo#7170)
- Optimize lock file format for git merge conflicts (rust-lang/cargo#7070)
- Set up CI with Azure Pipelines (rust-lang/cargo#7139)
- Force clippy to run. (rust-lang/cargo#7157)
- Work around rust-lang/rust#61440 (rust-lang/cargo#7158)
- initial working version of cargo fix --clippy (rust-lang/cargo#7069)
- Optimize runtime of `#[cargo_test_macro]` (rust-lang/cargo#7146)
- Don't fail if we can't acquire readonly lock (rust-lang/cargo#7149)
- Add support for multiple --features options (rust-lang/cargo#7084)
- Fix a typo in an env var name (rust-lang/cargo#7145)
- Add a way to disable all nightly tests (rust-lang/cargo#7142)
2019-07-26 08:57:13 +00:00
Yuki Okushi
328447279d Add test for issue-54062 2019-07-26 17:39:58 +09:00
Oliver Scherer
3bc1d01bb9 Clear up get_size_and_align 2019-07-26 10:34:54 +02:00
Ralf Jung
057606264f clarify and unify some type test names 2019-07-26 08:50:15 +02:00
Oliver Scherer
34e7a3cc4d Fix tidy 2019-07-26 08:10:09 +02:00
Giles Cope
9d796ebb5b run_quiet outputs stdout/stderr when things go wrong.
(was `run` uses `run_silent` under the covers.)
2019-07-26 06:16:40 +01:00
Eric Huss
78f25e308c Update cargo 2019-07-25 19:49:18 -07:00
bors
4268e7ee22 Auto merge of #60260 - videolabs:rust_uwp2, r=alexcrichton
Add support for UWP targets

Hi,

This pull request aims at adding support for UWP (Universal Windows Apps) platform.
A few notes:
- This requires a very recent mingw-w64 version (containing this commit and the previous related ones: e8c433c871 (diff-eefdfbfe9cec5f4ebab88c9a64d423a9))
- This was tested using LLVM/clang rather than gcc, and so far it assumes that LLVM/clang will be the native compiler. This is mostly due to the fact that the support for exceptions/stack unwinding for UWP got much more attention in libunwind
- The "uwp" part of the target needs support for it in the `cc-rs` & `backtrace-rs` crates. I'll create the MR there right after I submit this one and will link everything together, but I'm not sure what's the correct way of dealing with external dependencies in the context of rust
- Enabling import libraries and copying them across stages requires a change in cargo, for which I'll open a MR right after I submit this one as well
- The i686 stack unwinding is unsupported for now, because LLVM assumes SjLj, while rust seems to assume SEH will be used. I'm unsure how to fix this

Also, this is my first encounter with rust, so please bear with my code, it might not feel so idiomatic or even correct :)

I'm pretty sure there's a way of doing things in a cleaner way when it comes to win/c.rs, maybe having a UWP & desktop specific modules, and import those conditionally? It doesn't feel right to sprinkle `#[cfg(...)]` all over the place

Off course, I'll gladly update anything you see fit (to the extent of my abilities/knowledge :) )!

Thanks,
2019-07-26 02:18:12 +00:00
Esteban Küber
eeb1bd18dc Avoid ICE when suggestion span is at Eof 2019-07-25 16:06:24 -07:00
bors
18630677cf Auto merge of #62990 - Centril:rollup-k9n0hvs, r=Centril
Rollup of 15 pull requests

Successful merges:

 - #60066 (Stabilize the type_name intrinsic in core::any)
 - #60938 (rustdoc: make #[doc(include)] relative to the containing file)
 - #61884 (Stablize Euclidean Modulo (feature euclidean_division))
 - #61890 (Fix some sanity checks)
 - #62528 (Add joining slices of slices with a slice separator, not just a single item)
 - #62707 (Add tests for overlapping explicitly dropped locals in generators)
 - #62735 (Turn `#[global_allocator]` into a regular attribute macro)
 - #62822 (Improve some pointer-related documentation)
 - #62887 (Make the parser TokenStream more resilient after mismatched delimiter recovery)
 - #62921 (Add method disambiguation help for trait implementation)
 - #62930 (Add test for #51559)
 - #62942 (Use match ergonomics in Condvar documentation)
 - #62977 (Fix inconsistent highlight blocks.)
 - #62978 (Remove `cfg(bootstrap)` code for array implementations)
 - #62981 (Add note suggesting to borrow a String argument to find)

Failed merges:

 - #62964 (clarify and unify some type test names)

r? @ghost
2019-07-25 22:34:23 +00:00
Oliver Scherer
d9ac0c67ed Rewrite get_size_and_align so it doesn't duplicate work 2019-07-25 23:53:05 +02:00
Julien Cretin
df4b23e721 Implement slow-path for FirstSets::first
When 2 or more sequences share the same span, we can't use the precomputed map
for their first set. So we compute it recursively.

Fixes #62831.
2019-07-25 23:28:47 +02:00
Mazdak Farrokhzad
1a775b3b55
Rollup merge of #62981 - estebank:issue-62843, r=Centril
Add note suggesting to borrow a String argument to find

Fix #62843.
2019-07-25 23:21:13 +02:00
Mazdak Farrokhzad
f87f3db3a2
Rollup merge of #62978 - LukasKalbertodt:remove-array-impl-bootstrap-cfg, r=Mark-Simulacrum
Remove `cfg(bootstrap)` code for array implementations

In https://github.com/rust-lang/rust/pull/62435 ("Use const generics for array impls [part 1]") the old macro-based implementations were not removed but still used with `cfg(bootstrap)` since the bootstrap compiler had some problems with const generics at the time. This does not seem to be the case anymore, so there is no reason to keep the old code.

Unfortunately, the diff is pretty ugly because much of the code was indented by one level before. The change is pretty trivial, though.

PS: I did not run the full test suite locally. There are 40°C outside and 31°C inside my room. I don't want my notebook to melt. I hope that CI is green.

r? @scottmcm
2019-07-25 23:21:11 +02:00
Mazdak Farrokhzad
ca26d2e513
Rollup merge of #62977 - Rosto75:master, r=shepmaster
Fix inconsistent highlight blocks.
2019-07-25 23:21:09 +02:00
Mazdak Farrokhzad
42d924dd3e
Rollup merge of #62942 - KevinWMatthews:condvar_docs_match_ergo, r=sfackler
Use match ergonomics in Condvar documentation

Documentation was written before match ergonomics was merged. See #62857.

In short, replaces

```rust
let &(ref lock, ref cvar) = &*pair;
```

with

```rust
let (lock, cvar) = &*pair
```

in the docs of `std::sync::Condvar`.
2019-07-25 23:21:07 +02:00
Mazdak Farrokhzad
6e8d7b6e48
Rollup merge of #62930 - iluuu1994:test-for-51559, r=oli-obk
Add test for #51559

Closes #51559
2019-07-25 23:21:06 +02:00
Mazdak Farrokhzad
fe07132c80
Rollup merge of #62921 - iluuu1994:improve-help-for-method-disambiguation, r=estebank
Add method disambiguation help for trait implementation

Closes #51046
Closes #40471
2019-07-25 23:21:04 +02:00
Mazdak Farrokhzad
c9a766ab47
Rollup merge of #62887 - estebank:issue-62881, r=petrochenkov
Make the parser TokenStream more resilient after mismatched delimiter recovery

Fix #62881, fix #62895.
2019-07-25 23:21:03 +02:00
Mazdak Farrokhzad
a534c37b37
Rollup merge of #62822 - RalfJung:pointers, r=Centril
Improve some pointer-related documentation
2019-07-25 23:21:01 +02:00
Mazdak Farrokhzad
e1de70b045
Rollup merge of #62735 - petrochenkov:galloc, r=alexcrichton
Turn `#[global_allocator]` into a regular attribute macro

It was a 99% macro with exception of some diagnostic details.

As a result of the change, `#[global_allocator]` now works in nested modules and even in nameless blocks.

Fixes https://github.com/rust-lang/rust/issues/44113
Fixes https://github.com/rust-lang/rust/issues/58072
2019-07-25 23:21:00 +02:00
Mazdak Farrokhzad
6f0e57fb1d
Rollup merge of #62707 - JohnTitor:add-test-for-61922, r=tmandry
Add tests for overlapping explicitly dropped locals in generators

Closes #62686

r? @tmandry
2019-07-25 23:20:58 +02:00
Mazdak Farrokhzad
008d9d0fea
Rollup merge of #62528 - SimonSapin:concat, r=alexcrichton
Add joining slices of slices with a slice separator, not just a single item

https://github.com/rust-lang/rust/issues/27747#issuecomment-294525391
> It's kinda annoying to be able to join strings with a str (which can have multiple chars), but joining a slice of slices, you can only join with a single element.

This turns out to be fixable, with some possible inference regressions.

# TL;DR

Related trait(s) are unstable and tracked at https://github.com/rust-lang/rust/issues/27747, but the `[T]::join` method that is being extended here is already stable.

Example use of the new insta-stable functionality:

```rust
let nested: Vec<Vec<Foo>> = /* … */;
let separator: &[Foo] = /* … */;  // Previously: could only be a single &Foo
nested.join(separator)
```

Complete API affected by this PR, after changes:

```rust
impl<T> [T] {
    pub fn concat<Item: ?Sized>(&self) -> <Self as Concat<Item>>::Output
        where Self: Concat<Item>
    {
        Concat::concat(self)
    }
    pub fn join<Separator>(&self, sep: Separator) -> <Self as Join<Separator>>::Output
        where Self: Join<Separator>
    {
        Join::join(self, sep)
    }
}

// The `Item` parameter is only useful for the the slice-of-slices impl.
pub trait Concat<Item: ?Sized> {
    type Output;
    fn concat(slice: &Self) -> Self::Output;
}

pub trait Join<Separator> {
    type Output;
    fn join(slice: &Self, sep: Separator) -> Self::Output;
}

impl<T: Clone, V: Borrow<[T]>> Concat<T> for [V] {
    type Output = Vec<T>;
}

impl<T: Clone, V: Borrow<[T]>> Join<&'_ T> for [V] {
    type Output = Vec<T>;
}

// New functionality here!
impl<T: Clone, V: Borrow<[T]>> Join<&'_ [T]> for [V] {
    type Output = Vec<T>;
}

impl<S: Borrow<str>> Concat<str> for [S] {
    type Output = String;
}

impl<S: Borrow<str>> Join<&'_ str> for [S] {
    type Output = String;
}
```

# Details

After https://github.com/rust-lang/rust/pull/62403 but before this PR, the API is:

```rust
impl<T> [T] {
    pub fn concat<Separator: ?Sized>(&self) -> T::Output
        where T: SliceConcat<Separator>
    {
        SliceConcat::concat(self)
    }

    pub fn join<Separator: ?Sized>(&self, sep: &Separator) -> T::Output
        where T: SliceConcat<Separator>
    {
        SliceConcat::join(self, sep)
    }
}

pub trait SliceConcat<Separator: ?Sized>: Sized {
    type Output;
    fn concat(slice: &[Self]) -> Self::Output;
    fn join(slice: &[Self], sep: &Separator) -> Self::Output;
}

impl<T: Clone, V: Borrow<[T]>> SliceConcat<T> for V {
    type Output = Vec<T>;
}

impl<S: Borrow<str>> SliceConcat<str> for S {
    type Output = String;
}
```

By adding a trait impl we should be able to accept a slice of `T` as the separator, as an alternative to a single `T` value.

In a `some_slice.join(some_separator)` call, trait resolution will pick an impl or the other based on the type of `some_separator`. In `some_slice.concat()` however there is no separator, so this call would become ambiguous. Some regression in type inference or trait resolution may be acceptable on principle, but requiring a turbofish for every single call to `concat` isn’t great.

The solution to that is splitting the `SliceConcat` trait into two `Concat` and `Join` traits, one for each eponymous method. Only `Join` would gain a new impl, so that `some_slice.concat()` would not become ambiguous.

Now, at the trait level the `Concat` trait does not need a `Separator` parameter anymore. However, simply removing it causes one of the impls not to be accepted anymore:

```rust
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
  --> src/liballoc/slice.rs:608:6
    |
608 | impl<T: Clone, V: Borrow<[T]>> Concat for [V] {
    |      ^ unconstrained type parameter
```

This makes sense: if `[V]::concat` is a method that is itself not generic, then its return type (which is the `Concat::Output` associated type) needs to be determined based on solely `V`. And although there is no such type in the standard library, there is nothing stopping another crate from defining a `V` type that implements both `Borrow<[Foo]>` and `Borrow<[Bar]>`. It might not be a good idea, but it’s possible. Both would apply here, and there would be no way to determine `T`.

This could be a warning sign that this API is too generic. Perhaps we’d be better off having one less type variable, and only implement `Concat for [&'_ [T]]` and `Concat for [Vec<T>]` etc. However this aspect of `[V]::concat` is already stable, so we’re stuck with it.

The solution is to keep a dummy type parameter on the `Concat` trait. That way, if a type has multiple `Borrow<[_]>` impls, it’ll end up with multiple corresponding `Concat<_>` impls.

In `impl<S: Borrow<str>> Concat<str> for [S]`, the second occurrence of `str` is not meaningful. It could be any type. As long as there is only once such type with an applicable impl, trait resolution will be appeased without demanding turbofishes.

# Joining strings with `char`

For symmetry I also tried adding this impl (because why not):

```rust
impl<S: Borrow<str>> Join<char> for [S] {
    type Output = String;
}
```

This immediately caused an inference regression in a dependency of rustc:

```rust
error[E0277]: the trait bound `std::string::String: std::borrow::Borrow<[std::string::String]>` is not satisfied
   --> /home/simon/.cargo/registry/src/github.com-1ecc6299db9ec823/getopts-0.2.19/src/lib.rs:595:37
    |
595 |             row.push_str(&desc_rows.join(&desc_sep));
    |                                     ^^^^ the trait `std::borrow::Borrow<[std::string::String]>` is not implemented for `std::string::String`
    |
    = help: the following implementations were found:
              <std::string::String as std::borrow::Borrow<str>>
    = note: required because of the requirements on the impl of `std::slice::Join<&std::string::String>` for `[std::string::String]`
```

In the context of this code, two facts are known:

* `desc_rows` is a `Vec<String>`
* `desc_sep` is a `String`

Previously the first fact alone reduces the resolution of `join` to only one solution, where its argument it expected to be `&str`. Then, `&String` is coerced to `&str`.

With the new `Join` impl, the first fact leavs two applicable impls where the separator can be either `&str` or `char`. But `&String` is neither of these things. It appears that possible coercions are not accounted for, in the search for a solution in trait resolution.

I have not included this new impl in this PR. It’s still possible to add later, but the `getopts` breakage does not need to block the rest of the PR. And the functionality easy for end-user to duplicate: `slice_of_strings.join(&*char_separator.encode_utf8(&mut [0_u8, 4]))`

The `&*` part of that last code snippet is another case of the same issue: `encode_utf8` returns `&mut str` which can be coerced to `&str`, but isn’t when trait resolution is ambiguous.
2019-07-25 23:20:56 +02:00
Mazdak Farrokhzad
dbd0028dcc
Rollup merge of #61890 - golddranks:fix_sanity_check_llvm, r=Dylan-DPC
Fix some sanity checks

Update: Changes that made it not to work dropped.

* Fix `building_llvm` in sanity check
  * This was subtly broken: we build LLVM if any of the hosts builds LLVM, and not setting the config meant that LLVM is built for that target. Because of filtering away the targets not configured and the semantics of `Iterator::any`, it currently didn't set the `building_llvm` flag even if we indeed build it.
* Add `swig` sanity check
  * This checks whether there is a `swig` executable needed for LLDB.
2019-07-25 23:20:54 +02:00
Mazdak Farrokhzad
a57c4f6297
Rollup merge of #61884 - crlf0710:stablize_euc, r=dtolnay,Centril
Stablize Euclidean Modulo (feature euclidean_division)

Closes #49048
2019-07-25 23:20:53 +02:00
Mazdak Farrokhzad
845e146d04
Rollup merge of #60938 - jonas-schievink:doc-include-paths, r=petrochenkov
rustdoc: make #[doc(include)] relative to the containing file

This matches the behavior of other in-source paths like `#[path]` and the `include_X!` macros.

Fixes https://github.com/rust-lang/rust/pull/58373#issuecomment-462349380
Also addresses https://github.com/rust-lang/rust/issues/44732#issuecomment-467660239

cc #44732

This is still missing a stdsimd change (42ed30e0b5), so CI will currently fail. I'll land that change once I get initial feedback for this PR.
2019-07-25 23:20:51 +02:00
Mazdak Farrokhzad
3b19dc96fc
Rollup merge of #60066 - sfackler:type-name, r=Centril
Stabilize the type_name intrinsic in core::any

Stabilize `type_name` in `core::any`.

Closes rust-lang/rfcs#1428

FCP completed over there.

`RELEASES.md`: Prefer T-libs for categorization.
2019-07-25 23:20:49 +02:00
Esteban Küber
684497648a review comments: add FIXME comments and formatting 2019-07-25 12:36:51 -07:00
Hugo Beauzée-Luyssen
7ed5c36934 Add UWP mingw targets 2019-07-25 21:30:08 +02:00
Hugo Beauzée-Luyssen
e88a4cee52 std: win: Disable stack overflow handling on UWP
The required functions are not available, so hope for the best
2019-07-25 21:30:08 +02:00