Commit Graph

109349 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
c55f5007b2
Rollup merge of #70587 - DutchGhost:patch-1, r=Dylan-DPC
Add `Rust` to the code snippet

Adds `Rust` to the snippet where the code causing the ICE should be placed, so github can render it as Rust code rather than plain code.
2020-03-31 15:59:49 +02:00
Mazdak Farrokhzad
cd4d1c7f6d
Rollup merge of #70585 - alexcrichton:fix-wasi-align-alloc, r=Mark-Simulacrum
std: Fix over-aligned allocations on wasm32-wasi

The wasm32-wasi target delegates its malloc implementation to the
functions in wasi-libc, but the invocation of `aligned_alloc` was
incorrect by passing the number of bytes requested first rather than the
alignment. This commit swaps the order of these two arguments to ensure
that we allocate over-aligned memory correctly.
2020-03-31 15:59:47 +02:00
Mazdak Farrokhzad
3ef70fe156
Rollup merge of #70562 - lcnr:const-arr_len, r=Centril
infer array len from pattern

closes #70529

This still errors in the following case

```rust
#![feature(const_generics)]
fn arr<const N: usize>() -> [u8; N] {
    todo!()
}

fn main() {
    match arr() {
        [5, ..] => (),
        //~^ ERROR cannot pattern-match on an array without a fixed length
        [_, _] => (),
    }
}
```
Considering that this should be rare and is harder to implement I would merge this PR without *fixing* the above.
2020-03-31 15:59:46 +02:00
Mazdak Farrokhzad
38cd294ed5
Rollup merge of #70561 - tshepang:obsolete-comment, r=petrochenkov
remove obsolete comment

Made obsolete by b5e35b128e
2020-03-31 15:59:44 +02:00
Mazdak Farrokhzad
65b85a571e
Rollup merge of #70555 - Centril:fix-70549, r=petrochenkov
resolve, `try_resolve_as_non_binding`: use `delay_span_bug` due to parser recovery

Fixes #70549

r? @petrochenkov
2020-03-31 15:59:43 +02:00
Mazdak Farrokhzad
cbe3266c65
Rollup merge of #70548 - Ersikan:master, r=GuillaumeGomez
Add long error code for error E0226

Added a long description message for error E0226, which previously did not exist.
As requested in issue #61137

r? @GuillaumeGomez
2020-03-31 15:59:41 +02:00
Mazdak Farrokhzad
9ee373fd94
Rollup merge of #69784 - benesch:fast-strip-prefix-suffix, r=kennytm
Optimize strip_prefix and strip_suffix with str patterns

As mentioned in https://github.com/rust-lang/rust/issues/67302#issuecomment-585639226.
I'm not sure whether adding these methods to `Pattern` is desirable—but they have default implementations so the change is backwards compatible. Plus it seems like they're slated for wholesale replacement soon anyway? #56345

----

Constructing a Searcher in strip_prefix and strip_suffix is
unnecessarily slow when the pattern is a fixed-length string. Add
strip_prefix and strip_suffix methods to the Pattern trait, and add
optimized implementations of these methods in the str implementation.
The old implementation is retained as the default for these methods.
2020-03-31 15:59:40 +02:00
DutchGhost
641409bd62
Add Rust to the code snippet 2020-03-30 21:33:42 +02:00
Alex Crichton
ab2998bac3 std: Fix over-aligned allocations on wasm32-wasi
The wasm32-wasi target delegates its malloc implementation to the
functions in wasi-libc, but the invocation of `aligned_alloc` was
incorrect by passing the number of bytes requested first rather than the
alignment. This commit swaps the order of these two arguments to ensure
that we allocate over-aligned memory correctly.
2020-03-30 12:30:06 -07:00
bors
2113659479 Auto merge of #70574 - matthiaskrgr:submodule_upd, r=Centril
submodules: update clippy from 70b93aab to e170c849

Changes:
````
rustup  https://github.com/rust-lang/rust/pull/70536
Rustup to https://github.com/rust-lang/rust/pull/70449
readme: move "how to run single lint" instructions to "Allowing/denying lints" section.
git attribute macros not allowed in submodules
Deprecate REPLACE_CONSTS lint
Bump itertools
````

Fixes #70554
2020-03-30 17:54:18 +00:00
Bastian Kauschke
a3df1db8ee update tests, improve variable names 2020-03-30 19:34:16 +02:00
Bastian Kauschke
40c5eefdcd add test for array len inference 2020-03-30 19:13:47 +02:00
Bastian Kauschke
7f12561135
dedup docs
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-03-30 19:09:59 +02:00
Julien Philippon
32103b127f Correct long error message according to reviews 2020-03-30 19:02:01 +02:00
Bastian Kauschke
50ab77384e infer arr len from pattern 2020-03-30 18:13:14 +02:00
Matthias Krüger
eef8e4814a submodules: update clippy from 70b93aab to e170c849
Changes:
````
rustup  https://github.com/rust-lang/rust/pull/70536
Rustup to https://github.com/rust-lang/rust/pull/70449
readme: move "how to run single lint" instructions to "Allowing/denying lints" section.
git attribute macros not allowed in submodules
Deprecate REPLACE_CONSTS lint
Bump itertools
````

Fixes #70554
2020-03-30 17:58:14 +02:00
Nikhil Benesch
ac478f2f61
Optimize strip_prefix and strip_suffix with str patterns
Constructing a Searcher in strip_prefix and strip_suffix is
unnecessarily slow when the pattern is a fixed-length string. Add
strip_prefix and strip_suffix methods to the Pattern trait, and add
optimized implementations of these methods in the str implementation.
The old implementation is retained as the default for these methods.
2020-03-30 11:10:21 -04:00
bors
9a12971da5 Auto merge of #70568 - Dylan-DPC:rollup-em6vnpx, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #70479 (avoid creating unnecessary reference in Windows Env iterator)
 - #70546 (Polonius: update to 0.12.1, fix more move errors false positives, update test expectations)
 - #70559 (fix BTreeMap test compilation with Miri)
 - #70567 (Fix broken link in README)

Failed merges:

r? @ghost
2020-03-30 14:25:34 +00:00
Dylan DPC
aaa8aa3181
Rollup merge of #70567 - JOE1994:patch-3, r=Centril
Fix broken link in README

Fix broken link to `rustc-dev-guide` section for `codegen`
2020-03-30 16:24:52 +02:00
Dylan DPC
298a89bff3
Rollup merge of #70559 - RalfJung:btree-test-miri, r=Mark-Simulacrum
fix BTreeMap test compilation with Miri

This got broken by https://github.com/rust-lang/rust/pull/70506
2020-03-30 16:24:51 +02:00
Dylan DPC
b99db6ee10
Rollup merge of #70546 - lqd:polonius_update, r=nikomatsakis
Polonius: update to 0.12.1, fix more move errors false positives, update test expectations

This PR:
- updates `polonius-engine` to version 0.12.1 to fix some move errors false positives
- fixes a fact generation mistake creating the other move errors false positives
- updates the test expectations for the polonius compare-mode so that all (minus the 2 OOMs) ui tests pass again (matching the [analysis doc](https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg?view) starting at case 34)

In my opinion, this is safe to rollup.

r? @nikomatsakis
2020-03-30 16:24:49 +02:00
Dylan DPC
47ffca296a
Rollup merge of #70479 - RalfJung:win-env, r=Mark-Simulacrum
avoid creating unnecessary reference in Windows Env iterator

Discovered in https://github.com/rust-lang/miri/pull/1225: the Windows `Env` iterator violates Stacked Borrows by creating an `&u16`, turning it into a raw pointer, and then accessing memory outside the range of that type.

There is no need to create a reference here in the first place, so the fix is trivial.
Cc @JOE1994
Cc https://github.com/rust-lang/unsafe-code-guidelines/issues/134
2020-03-30 16:24:44 +02:00
Youngsuk Kim
60e7473bdf
Fix broken link in README 2020-03-30 10:09:51 -04:00
Tshepang Lekhonkhobe
d6f71f0c9a remove obsolete comment
Made obsolete by b5e35b128e
2020-03-30 13:38:17 +02:00
Mazdak Farrokhzad
9f86d28537 try_resolve_as_non_binding: span_bug -> delay_span_bug 2020-03-30 13:23:26 +02:00
Ralf Jung
032d3cd553 fix BTreeMap test compilation with Miri 2020-03-30 12:04:05 +02:00
bors
a80ec3b3b1 Auto merge of #70326 - matthiaskrgr:cl1ppy_single_match, r=Centril
Use if let instead of match when only matching a single variant (clippy::single_match)

Makes code more compact and reduces nesting.
2020-03-30 09:16:21 +00:00
Matthias Krüger
9bba047c2e Use if let instead of match when only matching a single variant (clippy::single_match)
Makes code more compact and reduces nestig.
2020-03-30 10:52:29 +02:00
bors
8926bb497d Auto merge of #70536 - Centril:rustc-middle, r=eddyb
Rename `librustc` to `librustc_middle`

Here we rename `librustc` to `librustc_middle`.

This crate is not nearly as large or central as it was previously and so it doesn't make much sense to give it such a central name as `librustc` ("the entry point to the compiler"). Moreover, there is already a `rustc` crate which is has the actual `fn main` of `rustc`, so having `librustc` is confusing relative to that.

r? @eddyb
2020-03-30 05:26:27 +00:00
Mazdak Farrokhzad
2a92839147 rustc -> rustc_middle part 5 -- fix tests 2020-03-30 07:21:44 +02:00
Mazdak Farrokhzad
39f06255d2 rustc -> rustc_middle part 4 -- pacify tidy 2020-03-30 07:19:55 +02:00
Mazdak Farrokhzad
1ccb0b4a02 rustc -> rustc_middle part 3 (rustfmt) 2020-03-30 07:19:55 +02:00
Mazdak Farrokhzad
0cb9e36090 rustc -> rustc_middle part 2 2020-03-30 07:16:56 +02:00
Mazdak Farrokhzad
7710f2dd5c rustc -> rustc_middle part 1 2020-03-30 07:02:56 +02:00
bors
0afdf43dc1 Auto merge of #70449 - ecstatic-morse:visit-body, r=oli-obk
Make `Visitor::visit_body` take a plain `&Body`

`ReadOnlyBodyAndCache` has replaced `&Body` in many parts of the code base that don't care about basic block predecessors. This includes the MIR `Visitor` trait, which I suspect resulted in many unnecessary changes in #64736. This reverts part of that PR to reduce the number of places where we need to pass a `ReadOnlyBodyAndCache`.

In the long term, we should either give `ReadOnlyBodyAndCache` more ergonomic name and replace all uses of `&mir::Body` with it at the cost of carrying an extra pointer everywhere, or use it only in places that actually need access to the predecessor cache. Perhaps there is an even nicer alternative.

r? @Nashenas88
2020-03-30 02:04:00 +00:00
Julien Philippon
8f7eb6229c Add long error code for error E0226 2020-03-30 02:51:25 +02:00
Remy Rakic
5af11d261d bless output of ui test nll/user-annotations/closure-substs.rs
Trivial diagnostics grammar change
2020-03-30 01:30:26 +02:00
Remy Rakic
82424634a3 bless output of ui test impl-trait/multiple-lifetimes/error-handling.rs
Some impl Trait fixes lead to locating more accurately the cause of
a universal region error with a user annotation
2020-03-30 01:28:27 +02:00
Remy Rakic
fcd12bd2f4 bless output of ui test closures/closure-expected-type/expect-region-supply-region.rs
trivial diagnostics grammar change
2020-03-30 01:24:52 +02:00
Remy Rakic
c73d5db21f bless output of ui test nll/outlives-suggestion-simple.rs
trivial diagnostics wording change
2020-03-30 01:22:59 +02:00
Remy Rakic
2a7644746b bless output of ui test hrtb/hrtb-perfect-forwarding.rs
trivial formatting changes
2020-03-30 01:18:27 +02:00
Remy Rakic
860f71f141 Polonius fact generation: fix path access fact location
This will fix the other move errors false positives:
emitting the fact at the start point caused accesses to be at the
same point as an initialization fact of the return place of a call
on the following block, which emitted an error.
2020-03-30 01:13:03 +02:00
Remy Rakic
df1ac67913 update polonius-engine to 0.12.1
This will fix some move errors false positives
2020-03-30 01:11:44 +02:00
bors
4911572b2d Auto merge of #70009 - estebank:sugg-bound, r=Centril
Tweak `suggest_constraining_type_param`

Some of the bound restriction structured suggestions were incorrect while others had subpar output.

The only issue left is a suggestion for an already present bound when dealing with `const`s that should be handled independently.

Fix #69983.
2020-03-29 22:50:59 +00:00
Dylan MacKenzie
538cdef64b Use & to do deref coercion for ReadOnlyBodyAndCache 2020-03-29 13:30:26 -07:00
Esteban Küber
2c71894657 Tweak suggest_constraining_type_param
Some of the bound restriction structured suggestions were incorrect
while others had subpar output.
2020-03-29 13:13:17 -07:00
bors
699f83f525 Auto merge of #70544 - Dylan-DPC:rollup-pj86j17, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #69702 (Rename TyLayout to TyAndLayout.)
 - #70539 (add test for 62220)
 - #70540 (#[link]: mention wasm_import_module instead of cfg)
 - #70541 (prohibit_generics: update has_err for consts)

Failed merges:

r? @ghost
2020-03-29 19:43:24 +00:00
Dylan DPC
800ed0cd5d
Rollup merge of #70541 - lcnr:patch-1, r=varkor
prohibit_generics: update has_err for consts

r? @eddyb
2020-03-29 21:23:55 +02:00
Dylan DPC
1bf4873aac
Rollup merge of #70540 - jonas-schievink:link-attr-template, r=varkor
#[link]: mention wasm_import_module instead of cfg

`#[link(cfg)]` is perma-unstable and is not documented anywhere else. It makes more sense to mention `wasm_import_module` here since it's stable.

This makes it harder to hit https://github.com/rust-lang/rust/issues/70538 (if it weren't for this text, I wouldn't even know this feature existed).
2020-03-29 21:23:53 +02:00
Dylan DPC
5a7b377b6f
Rollup merge of #70539 - DutchGhost:test-62220, r=Dylan-DPC
add test for 62220

Closes #62220

Adds a test for https://github.com/rust-lang/rust/issues/62220.

Im not sure whether `check-pass` is sufficient here. I didn't put `run-pass` in, as I'm afraid that'll fail due to the `unimplemented!()` return in the code.
2020-03-29 21:23:52 +02:00