]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoUse Place directly on remove_never_initialized_mut_locals, it's Copy
Santiago Pastorino [Mon, 30 Mar 2020 22:18:54 +0000 (19:18 -0300)]
Use Place directly on remove_never_initialized_mut_locals, it's Copy

4 years agoUse Place directly on borrow_of_local_data, it's Copy
Santiago Pastorino [Mon, 30 Mar 2020 21:51:48 +0000 (18:51 -0300)]
Use Place directly on borrow_of_local_data, it's Copy

4 years agoUse Place directly on propagate_closure_used_mut_place, it's Copy
Santiago Pastorino [Mon, 30 Mar 2020 20:55:22 +0000 (17:55 -0300)]
Use Place directly on propagate_closure_used_mut_place, it's Copy

4 years agoUse Place directly, it's Copy
Santiago Pastorino [Mon, 30 Mar 2020 20:49:33 +0000 (17:49 -0300)]
Use Place directly, it's Copy

4 years agoAuto merge of #70617 - Centril:rollup-063ycso, r=Centril
bors [Tue, 31 Mar 2020 14:00:55 +0000 (14:00 +0000)]
Auto merge of #70617 - Centril:rollup-063ycso, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #69784 (Optimize strip_prefix and strip_suffix with str patterns)
 - #70548 (Add long error code for error E0226)
 - #70555 (resolve, `try_resolve_as_non_binding`: use `delay_span_bug` due to parser recovery)
 - #70561 (remove obsolete comment)
 - #70562 (infer array len from pattern)
 - #70585 (std: Fix over-aligned allocations on wasm32-wasi)
 - #70587 (Add `Rust` to the code snippet)
 - #70588 (Fix incorrect documentation for `str::{split_at, split_at_mut}`)
 - #70613 (more clippy fixes)

Failed merges:

r? @ghost

4 years agoRollup merge of #70613 - matthiaskrgr:cl5ppy_squashed, r=Centril
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:52 +0000 (15:59 +0200)]
Rollup merge of #70613 - matthiaskrgr:cl5ppy_squashed, r=Centril

more clippy fixes

* use is_empty() instead of len comparison (clippy::len_zero)
* use if let instead of while let loop that never loops (clippy::never_loop)
* remove redundant returns (clippy::needless_return)
* remove redundant closures (clippy::redundant_closure)
* use if let instead of match and wildcard pattern (clippy::single_match)
* don't repeat field names redundantly (clippy::redundant_field_names)

r? @Centril

4 years agoRollup merge of #70588 - Coder-256:str-split-at-docs, r=Dylan-DPC
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:50 +0000 (15:59 +0200)]
Rollup merge of #70588 - Coder-256:str-split-at-docs, r=Dylan-DPC

Fix incorrect documentation for `str::{split_at, split_at_mut}`

The documentation for each method currently states:

> Panics if `mid` is not on a UTF-8 code point boundary, or if it is beyond the last code point of the string slice.

However, this is not consistent with the real behavior, or that of the corresponding methods for `[T]` slices. A comment inside each of the `str` methods states:

> is_char_boundary checks that the index is in [0, .len()]

That is what I would expect the behavior to be, and in fact this seems to be the real behavior. For example ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=8e03dcc209d4dd176df2297523f9fee1)):

```rust
fn main() {
    // Prints ("abc", "") and doesn't panic
    println!("{:?}", "abc".split_at(3));
}
```

In this case, I would interpret "the last code point of the string slice" to mean the byte at index 2 in UTF-8. However, it is possible to pass an index of 3, which is definitely "beyond the last code point of the string slice".

I think that this is much clearer, but feel free to bikeshed.

4 years agoRollup merge of #70587 - DutchGhost:patch-1, r=Dylan-DPC
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:49 +0000 (15:59 +0200)]
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.

4 years agoRollup merge of #70585 - alexcrichton:fix-wasi-align-alloc, r=Mark-Simulacrum
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:47 +0000 (15:59 +0200)]
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.

4 years agoRollup merge of #70562 - lcnr:const-arr_len, r=Centril
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:46 +0000 (15:59 +0200)]
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.

4 years agoRollup merge of #70561 - tshepang:obsolete-comment, r=petrochenkov
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:44 +0000 (15:59 +0200)]
Rollup merge of #70561 - tshepang:obsolete-comment, r=petrochenkov

remove obsolete comment

Made obsolete by b5e35b128efeed4bfdb4b1ee9d0697389ec9f164

4 years agoRollup merge of #70555 - Centril:fix-70549, r=petrochenkov
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:43 +0000 (15:59 +0200)]
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

4 years agoRollup merge of #70548 - Ersikan:master, r=GuillaumeGomez
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:41 +0000 (15:59 +0200)]
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

4 years agoRollup merge of #69784 - benesch:fast-strip-prefix-suffix, r=kennytm
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:40 +0000 (15:59 +0200)]
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.

4 years agomore clippy fixes
Matthias Krüger [Sun, 29 Mar 2020 18:19:14 +0000 (20:19 +0200)]
more clippy fixes

use is_empty() instead of len comparison (clippy::len_zero)
use if let instead of while let loop that never loops (clippy::never_loop)
remove redundant returns (clippy::needless_return)
remove redundant closures (clippy::redundant_closure)
use if let instead of match and wildcard pattern (clippy::single_match)
don't repeat field names redundantly (clippy::redundant_field_names)

4 years agoFix incorrect documentation for `str::{split_at, split_at_mut}`
Jacob Greenfield [Mon, 30 Mar 2020 19:48:52 +0000 (15:48 -0400)]
Fix incorrect documentation for `str::{split_at, split_at_mut}`

4 years agoAdd `Rust` to the code snippet
DutchGhost [Mon, 30 Mar 2020 19:33:42 +0000 (21:33 +0200)]
Add `Rust` to the code snippet

4 years agostd: Fix over-aligned allocations on wasm32-wasi
Alex Crichton [Mon, 30 Mar 2020 19:30:06 +0000 (12:30 -0700)]
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.

4 years agoAuto merge of #70574 - matthiaskrgr:submodule_upd, r=Centril
bors [Mon, 30 Mar 2020 17:54:18 +0000 (17:54 +0000)]
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

4 years agoupdate tests, improve variable names
Bastian Kauschke [Mon, 30 Mar 2020 17:34:16 +0000 (19:34 +0200)]
update tests, improve variable names

4 years agoadd test for array len inference
Bastian Kauschke [Mon, 30 Mar 2020 17:13:20 +0000 (19:13 +0200)]
add test for array len inference

4 years agodedup docs
Bastian Kauschke [Mon, 30 Mar 2020 17:09:59 +0000 (19:09 +0200)]
dedup docs

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoCorrect long error message according to reviews
Julien Philippon [Mon, 30 Mar 2020 17:02:01 +0000 (19:02 +0200)]
Correct long error message according to reviews

4 years agoinfer arr len from pattern
Bastian Kauschke [Mon, 30 Mar 2020 16:13:14 +0000 (18:13 +0200)]
infer arr len from pattern

4 years agosubmodules: update clippy from 70b93aab to e170c849
Matthias Krüger [Mon, 30 Mar 2020 15:56:08 +0000 (17:56 +0200)]
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

4 years agoOptimize strip_prefix and strip_suffix with str patterns
Nikhil Benesch [Fri, 6 Mar 2020 20:11:24 +0000 (15:11 -0500)]
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.

4 years agoAuto merge of #70568 - Dylan-DPC:rollup-em6vnpx, r=Dylan-DPC
bors [Mon, 30 Mar 2020 14:25:34 +0000 (14:25 +0000)]
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

4 years agoRollup merge of #70567 - JOE1994:patch-3, r=Centril
Dylan DPC [Mon, 30 Mar 2020 14:24:52 +0000 (16:24 +0200)]
Rollup merge of #70567 - JOE1994:patch-3, r=Centril

Fix broken link in README

Fix broken link to `rustc-dev-guide` section for `codegen`

4 years agoRollup merge of #70559 - RalfJung:btree-test-miri, r=Mark-Simulacrum
Dylan DPC [Mon, 30 Mar 2020 14:24:51 +0000 (16:24 +0200)]
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

4 years agoRollup merge of #70546 - lqd:polonius_update, r=nikomatsakis
Dylan DPC [Mon, 30 Mar 2020 14:24:49 +0000 (16:24 +0200)]
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

4 years agoRollup merge of #70479 - RalfJung:win-env, r=Mark-Simulacrum
Dylan DPC [Mon, 30 Mar 2020 14:24:44 +0000 (16:24 +0200)]
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

4 years agoFix broken link in README
Youngsuk Kim [Mon, 30 Mar 2020 14:09:51 +0000 (10:09 -0400)]
Fix broken link in README

4 years agoremove obsolete comment
Tshepang Lekhonkhobe [Mon, 30 Mar 2020 11:38:17 +0000 (13:38 +0200)]
remove obsolete comment

Made obsolete by b5e35b128efeed4bfdb4b1ee9d0697389ec9f164

4 years agotry_resolve_as_non_binding: span_bug -> delay_span_bug
Mazdak Farrokhzad [Mon, 30 Mar 2020 06:40:23 +0000 (08:40 +0200)]
try_resolve_as_non_binding: span_bug -> delay_span_bug

4 years agofix BTreeMap test compilation with Miri
Ralf Jung [Mon, 30 Mar 2020 10:03:55 +0000 (12:03 +0200)]
fix BTreeMap test compilation with Miri

4 years agoAuto merge of #70326 - matthiaskrgr:cl1ppy_single_match, r=Centril
bors [Mon, 30 Mar 2020 09:16:21 +0000 (09:16 +0000)]
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.

4 years agoUse if let instead of match when only matching a single variant (clippy::single_match)
Matthias Krüger [Sun, 22 Mar 2020 12:36:56 +0000 (13:36 +0100)]
Use if let instead of match when only matching a single variant (clippy::single_match)

Makes code more compact and reduces nestig.

4 years agoAuto merge of #70536 - Centril:rustc-middle, r=eddyb
bors [Mon, 30 Mar 2020 05:26:27 +0000 (05:26 +0000)]
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

4 years agorustc -> rustc_middle part 5 -- fix tests
Mazdak Farrokhzad [Sun, 29 Mar 2020 16:08:01 +0000 (18:08 +0200)]
rustc -> rustc_middle part 5 -- fix tests

4 years agorustc -> rustc_middle part 4 -- pacify tidy
Mazdak Farrokhzad [Sun, 29 Mar 2020 15:29:12 +0000 (17:29 +0200)]
rustc -> rustc_middle part 4 -- pacify tidy

4 years agorustc -> rustc_middle part 3 (rustfmt)
Mazdak Farrokhzad [Sun, 29 Mar 2020 15:19:48 +0000 (17:19 +0200)]
rustc -> rustc_middle part 3 (rustfmt)

4 years agorustc -> rustc_middle part 2
Mazdak Farrokhzad [Sun, 29 Mar 2020 14:41:09 +0000 (16:41 +0200)]
rustc -> rustc_middle part 2

4 years agorustc -> rustc_middle part 1
Mazdak Farrokhzad [Sun, 29 Mar 2020 13:24:45 +0000 (15:24 +0200)]
rustc -> rustc_middle part 1

4 years agoAuto merge of #70449 - ecstatic-morse:visit-body, r=oli-obk
bors [Mon, 30 Mar 2020 02:04:00 +0000 (02:04 +0000)]
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

4 years agoAdd long error code for error E0226
Julien Philippon [Mon, 30 Mar 2020 00:50:53 +0000 (02:50 +0200)]
Add long error code for error E0226

4 years agobless output of ui test nll/user-annotations/closure-substs.rs
Remy Rakic [Sun, 29 Mar 2020 23:30:26 +0000 (01:30 +0200)]
bless output of ui test nll/user-annotations/closure-substs.rs

Trivial diagnostics grammar change

4 years agobless output of ui test impl-trait/multiple-lifetimes/error-handling.rs
Remy Rakic [Sun, 29 Mar 2020 23:28:27 +0000 (01:28 +0200)]
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

4 years agobless output of ui test closures/closure-expected-type/expect-region-supply-region.rs
Remy Rakic [Sun, 29 Mar 2020 23:24:52 +0000 (01:24 +0200)]
bless output of ui test closures/closure-expected-type/expect-region-supply-region.rs

trivial diagnostics grammar change

4 years agobless output of ui test nll/outlives-suggestion-simple.rs
Remy Rakic [Sun, 29 Mar 2020 23:22:59 +0000 (01:22 +0200)]
bless output of ui test nll/outlives-suggestion-simple.rs

trivial diagnostics wording change

4 years agobless output of ui test hrtb/hrtb-perfect-forwarding.rs
Remy Rakic [Sun, 29 Mar 2020 23:18:27 +0000 (01:18 +0200)]
bless output of ui test hrtb/hrtb-perfect-forwarding.rs

trivial formatting changes

4 years agoPolonius fact generation: fix path access fact location
Remy Rakic [Sun, 29 Mar 2020 23:13:03 +0000 (01:13 +0200)]
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.

4 years agoupdate polonius-engine to 0.12.1
Remy Rakic [Sun, 29 Mar 2020 23:11:44 +0000 (01:11 +0200)]
update polonius-engine to 0.12.1

This will fix some move errors false positives

4 years agoAuto merge of #70009 - estebank:sugg-bound, r=Centril
bors [Sun, 29 Mar 2020 22:50:59 +0000 (22:50 +0000)]
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.

4 years agoUse `&` to do deref coercion for `ReadOnlyBodyAndCache`
Dylan MacKenzie [Sat, 28 Mar 2020 21:54:41 +0000 (14:54 -0700)]
Use `&` to do deref coercion for `ReadOnlyBodyAndCache`

4 years agoTweak `suggest_constraining_type_param`
Esteban Küber [Sat, 14 Mar 2020 02:28:14 +0000 (19:28 -0700)]
Tweak `suggest_constraining_type_param`

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

4 years agoAuto merge of #70544 - Dylan-DPC:rollup-pj86j17, r=Dylan-DPC
bors [Sun, 29 Mar 2020 19:43:24 +0000 (19:43 +0000)]
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

4 years agoRollup merge of #70541 - lcnr:patch-1, r=varkor
Dylan DPC [Sun, 29 Mar 2020 19:23:55 +0000 (21:23 +0200)]
Rollup merge of #70541 - lcnr:patch-1, r=varkor

prohibit_generics: update has_err for consts

r? @eddyb

4 years agoRollup merge of #70540 - jonas-schievink:link-attr-template, r=varkor
Dylan DPC [Sun, 29 Mar 2020 19:23:53 +0000 (21:23 +0200)]
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).

4 years agoRollup merge of #70539 - DutchGhost:test-62220, r=Dylan-DPC
Dylan DPC [Sun, 29 Mar 2020 19:23:52 +0000 (21:23 +0200)]
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.

4 years agoRollup merge of #69702 - anyska:tylayout-rename, r=oli-obk
Dylan DPC [Sun, 29 Mar 2020 19:23:50 +0000 (21:23 +0200)]
Rollup merge of #69702 - anyska:tylayout-rename, r=oli-obk

Rename TyLayout to TyAndLayout.

4 years agoMake `Visitor::visit_body` take a simple `Body`
Dylan MacKenzie [Thu, 26 Mar 2020 23:02:10 +0000 (16:02 -0700)]
Make `Visitor::visit_body` take a simple `Body`

4 years agoprohibit_generics: update has_err for consts
Bastian Kauschke [Sun, 29 Mar 2020 16:34:42 +0000 (18:34 +0200)]
prohibit_generics: update has_err for consts

4 years agoadd a build-pass test for issue 62220
Dodo [Sun, 29 Mar 2020 16:27:54 +0000 (18:27 +0200)]
add a build-pass test for issue 62220

4 years ago#[link]: mention wasm_import_module instead of cfg
Jonas Schievink [Sun, 29 Mar 2020 15:40:04 +0000 (17:40 +0200)]
#[link]: mention wasm_import_module instead of cfg

4 years agoAuto merge of #70534 - Centril:rollup-t59tcx2, r=Centril
bors [Sun, 29 Mar 2020 14:48:58 +0000 (14:48 +0000)]
Auto merge of #70534 - Centril:rollup-t59tcx2, r=Centril

Rollup of 3 pull requests

Successful merges:

 - #70140 (Add Result<Result<T, E>, E>::flatten -> Result<T, E>)
 - #70526 (reduce `rustc_attr` usage in places)
 - #70527 (Update LLVM submodule)

Failed merges:

r? @ghost

4 years agoRollup merge of #70527 - Amanieu:fix_fastisel, r=Mark-Simulacrum
Mazdak Farrokhzad [Sun, 29 Mar 2020 14:48:24 +0000 (16:48 +0200)]
Rollup merge of #70527 - Amanieu:fix_fastisel, r=Mark-Simulacrum

Update LLVM submodule

Fixes #70148

4 years agoRollup merge of #70526 - Centril:less-attr, r=eddyb
Mazdak Farrokhzad [Sun, 29 Mar 2020 14:48:23 +0000 (16:48 +0200)]
Rollup merge of #70526 - Centril:less-attr, r=eddyb

reduce `rustc_attr` usage in places

This cleans up some unused `rustc_attr` dependencies.

4 years agoRollup merge of #70140 - Nemo157:result-flatten, r=Amanieu
Mazdak Farrokhzad [Sun, 29 Mar 2020 14:48:21 +0000 (16:48 +0200)]
Rollup merge of #70140 - Nemo157:result-flatten, r=Amanieu

Add Result<Result<T, E>, E>::flatten -> Result<T, E>

This PR makes this possible (modulo type inference):

```rust
assert_eq!(Ok(6), Ok(Ok(6)).flatten());
```

Tracking issue: #70142

<sub>largely cribbed directly from <https://github.com/rust-lang/rust/pull/60256></sub>

4 years agoUpdate LLVM submodule
Amanieu d'Antras [Sun, 29 Mar 2020 10:12:55 +0000 (11:12 +0100)]
Update LLVM submodule

4 years agoreduce rustc_attr usage in places
Mazdak Farrokhzad [Sun, 29 Mar 2020 10:01:11 +0000 (12:01 +0200)]
reduce rustc_attr usage in places

4 years agoAuto merge of #70525 - Centril:rollup-vj3esv3, r=Centril
bors [Sun, 29 Mar 2020 09:50:52 +0000 (09:50 +0000)]
Auto merge of #70525 - Centril:rollup-vj3esv3, r=Centril

Rollup of 3 pull requests

Successful merges:

 - #68692 (impl From<[T; N]> for Vec<T>)
 - #70101 (Add copy bound to atomic & numeric intrinsics)
 - #70506 (BTreeMap testing: introduce symbolic constants and use height consistently)

Failed merges:

r? @ghost

4 years agoRollup merge of #70506 - ssomers:btreemap_testing_consts, r=RalfJung
Mazdak Farrokhzad [Sun, 29 Mar 2020 09:50:13 +0000 (11:50 +0200)]
Rollup merge of #70506 - ssomers:btreemap_testing_consts, r=RalfJung

BTreeMap testing: introduce symbolic constants and use height consistently

Doesn't change what or how much is tested, except for some exact integer types, just for convenience and because `node::CAPACITY` is a usize.

r? @RalfJung

4 years agoRollup merge of #70101 - tmiasko:intrinsics-copy, r=eddyb
Mazdak Farrokhzad [Sun, 29 Mar 2020 09:50:12 +0000 (11:50 +0200)]
Rollup merge of #70101 - tmiasko:intrinsics-copy, r=eddyb

Add copy bound to atomic & numeric intrinsics

4 years agoRollup merge of #68692 - jyn514:vec-from-array, r=LukasKalbertodt
Mazdak Farrokhzad [Sun, 29 Mar 2020 09:50:10 +0000 (11:50 +0200)]
Rollup merge of #68692 - jyn514:vec-from-array, r=LukasKalbertodt

impl From<[T; N]> for Vec<T>

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

4 years agoAuto merge of #70370 - petrochenkov:nosmatch, r=Centril
bors [Sun, 29 Mar 2020 06:33:42 +0000 (06:33 +0000)]
Auto merge of #70370 - petrochenkov:nosmatch, r=Centril

Remove attribute `#[structural_match]` and any references to it

A small remaining part of https://github.com/rust-lang/rust/issues/63438.

4 years agoAuto merge of #70518 - Dylan-DPC:rollup-n2gkh3a, r=Dylan-DPC
bors [Sun, 29 Mar 2020 00:56:47 +0000 (00:56 +0000)]
Auto merge of #70518 - Dylan-DPC:rollup-n2gkh3a, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #69937 (ASCII methods on OsStr)
 - #70235 (Validate git setup before accessing functionality)
 - #70503 (rename Scalar::{ptr_null -> null_ptr} and add "machine_" prefix like elsewhere)
 - #70508 (Miri: use more specialized Scalar::from_ constructors where appropriate)
 - #70510 (fix TryEnterCriticalSection return type)

Failed merges:

r? @ghost

4 years agoRollup merge of #70510 - RalfJung:bool-vs-boolean, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Mar 2020 00:32:23 +0000 (01:32 +0100)]
Rollup merge of #70510 - RalfJung:bool-vs-boolean, r=Mark-Simulacrum

fix TryEnterCriticalSection return type

Source: https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-tryentercriticalsection
Fixes https://github.com/rust-lang/rust/issues/70504

4 years agoRollup merge of #70508 - RalfJung:scalar-from, r=eddyb
Dylan DPC [Sun, 29 Mar 2020 00:32:22 +0000 (01:32 +0100)]
Rollup merge of #70508 - RalfJung:scalar-from, r=eddyb

Miri: use more specialized Scalar::from_ constructors where appropriate

4 years agoRollup merge of #70503 - RalfJung:null, r=varkor
Dylan DPC [Sun, 29 Mar 2020 00:32:21 +0000 (01:32 +0100)]
Rollup merge of #70503 - RalfJung:null, r=varkor

rename Scalar::{ptr_null -> null_ptr} and add "machine_" prefix like elsewhere

"NULL pointer" is just much more common terminology than "pointer-null".
Also I forgot two methods when renaming all the `Scalar` things to `(to|from)_machine_(u|i)size`.

4 years agoRollup merge of #70235 - dillona:70182-check-before-using-git, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Mar 2020 00:32:19 +0000 (01:32 +0100)]
Rollup merge of #70235 - dillona:70182-check-before-using-git, r=Mark-Simulacrum

Validate git setup before accessing functionality

Closes #70182

4 years agoRollup merge of #69937 - TyPR124:osstr_ascii, r=dtolnay
Dylan DPC [Sun, 29 Mar 2020 00:32:17 +0000 (01:32 +0100)]
Rollup merge of #69937 - TyPR124:osstr_ascii, r=dtolnay

ASCII methods on OsStr

Would close #69566

I don't know enough about encodings to know if this is a valid change, however the comment on the issue suggests it could be.

This does two things:

1. Makes ASCII methods available on OsStr

2. Makes it possible to obtain a `&mut OsStr`. This is necessary to actually use `OsStr::make_ascii_*case` methods since they modify the underlying value. As far as I can tell, the only way to modify a `&mut OsStr` is via the methods I just added.

My original hope was to have these methods on `OsStrExt` for Windows, since the standard library already assumes `make_ascii_uppercase` is valid in Windows (see the change I made to windows/process.rs). If it is found these are not valid changes on non-Windows platforms, I can move the methods to the ext trait instead.

4 years agoadd tracking issue
TyPR124 [Sat, 28 Mar 2020 23:23:49 +0000 (19:23 -0400)]
add tracking issue

4 years agomove doc links for consistency
TyPR124 [Thu, 12 Mar 2020 16:40:57 +0000 (12:40 -0400)]
move doc links for consistency

4 years agoremove unnecessary comments
TyPR124 [Wed, 11 Mar 2020 20:15:16 +0000 (16:15 -0400)]
remove unnecessary comments

4 years agouse make_ascii_uppercase in windows/process.rs
TyPR124 [Wed, 11 Mar 2020 20:05:11 +0000 (16:05 -0400)]
use make_ascii_uppercase in windows/process.rs

4 years agoascii methods on osstr
TyPR124 [Wed, 11 Mar 2020 19:53:55 +0000 (15:53 -0400)]
ascii methods on osstr

4 years agoBTreeMap testing: introduce symbolic constants and refer to height consistently.
Stein Somers [Sat, 8 Feb 2020 10:52:14 +0000 (11:52 +0100)]
BTreeMap testing: introduce symbolic constants and refer to height consistently.

4 years agoAuto merge of #66938 - GuillaumeGomez:lint-for-no-crate-level-doc, r=Dylan-DPC
bors [Sat, 28 Mar 2020 20:11:01 +0000 (20:11 +0000)]
Auto merge of #66938 - GuillaumeGomez:lint-for-no-crate-level-doc, r=Dylan-DPC

Add lint when no doc is present at the crate-level

Follow-up of #66267.

r? @kinnison

4 years agofix TryEnterCriticalSection return type
Ralf Jung [Sat, 28 Mar 2020 20:10:11 +0000 (21:10 +0100)]
fix TryEnterCriticalSection return type

4 years agorefmt
Ralf Jung [Sat, 28 Mar 2020 18:51:54 +0000 (19:51 +0100)]
refmt

4 years agoget rid of useless back-and-forth cast
Ralf Jung [Sat, 28 Mar 2020 18:40:58 +0000 (19:40 +0100)]
get rid of useless back-and-forth cast

4 years agouse more specialized Scalar::from_ constructors where appropriate
Ralf Jung [Sat, 28 Mar 2020 18:29:46 +0000 (19:29 +0100)]
use more specialized Scalar::from_ constructors where appropriate

4 years agoAuto merge of #70499 - Dylan-DPC:rollup-f9je1l8, r=Dylan-DPC
bors [Sat, 28 Mar 2020 17:15:32 +0000 (17:15 +0000)]
Auto merge of #70499 - Dylan-DPC:rollup-f9je1l8, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #70418 (Add long error explanation for E0703)
 - #70448 (Create output dir in rustdoc markdown render)
 - #70486 (Shrink Unicode tables (even more))
 - #70493 (Fix rustdoc.css CSS tab-size property)
 - #70495 (Replace last mention of IRC with Discord)

Failed merges:

r? @ghost

4 years agouse machine_ prefix for target usize/isize
Ralf Jung [Sat, 28 Mar 2020 16:51:11 +0000 (17:51 +0100)]
use machine_ prefix for target usize/isize

4 years agorename Scalar::{ptr_null -> null_ptr}
Ralf Jung [Sat, 28 Mar 2020 15:57:33 +0000 (16:57 +0100)]
rename Scalar::{ptr_null -> null_ptr}

4 years agoRollup merge of #70495 - bkaestner:master, r=Mark-Simulacrum
Dylan DPC [Sat, 28 Mar 2020 14:22:03 +0000 (15:22 +0100)]
Rollup merge of #70495 - bkaestner:master, r=Mark-Simulacrum

Replace last mention of IRC with Discord

Mozilla's IRC service was shut down in March 2020. The official instant messaging variant has been Discord for a while, and most of the links were already replaced by #61524.

This was the last line that came up with `irc.mozilla.org` or any combination of "irc.*#[a-z]+" in a `git grep`:

    git grep -i -E "irc.*#[a-z]+"

As there is only one other link directly to Rust's discord, I used the same Markdown link `[rust-discord]` as in `bootstrap/README.md` to stay consistent. This might come in handy if the chat platform changes at a later point again.

4 years agoRollup merge of #70493 - 0xd4d:rustdoc-tab-size, r=GuillaumeGomez
Dylan DPC [Sat, 28 Mar 2020 14:22:01 +0000 (15:22 +0100)]
Rollup merge of #70493 - 0xd4d:rustdoc-tab-size, r=GuillaumeGomez

Fix rustdoc.css CSS tab-size property

This fixes the CSS tab size property names which are called `tab-size` / `-moz-tab-size` and not `tab-width`

Old issue https://github.com/rust-lang/rust/issues/49155 and related PR https://github.com/rust-lang/rust/pull/50947

tab-size: https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size

4 years agoRollup merge of #70486 - Mark-Simulacrum:unicode-shrink, r=dtolnay
Dylan DPC [Sat, 28 Mar 2020 14:22:00 +0000 (15:22 +0100)]
Rollup merge of #70486 - Mark-Simulacrum:unicode-shrink, r=dtolnay

Shrink Unicode tables (even more)

This shrinks the Unicode tables further, building upon the wins in #68232 (the previous counts differ due to an interim Unicode version update, see #69929.

The new data structure is slower by around 3x, on the benchmark of looking up every Unicode scalar value in each data set sequentially in every data set included. Note that for ASCII, the exposed functions on `char` optimize with direct branches, so ASCII will retain the same performance regardless of internal optimizations (or the reverse). Also, note that the size reduction due to the skip list (from where the performance losses come) is around 40%, and, as a result, I believe the performance loss is acceptable, as the routines are still quite fast. Anywhere where this is hot, should probably be using a custom data structure anyway (e.g., a raw bitset) or something optimized for frequently seen values, etc.

This PR updates both the bitset data structure, and introduces a new data structure similar to a skip list. For more details, see the [main.rs] of the table generator, which describes both. The commits mostly work individually and document size wins.

As before, this is tested on all valid chars to have the same results as nightly (and the canonical Unicode data sets), happily, no bugs were found.

[main.rs]: https://github.com/rust-lang/rust/blob/fb4a715e18b/src/tools/unicode-table-generator/src/main.rs

Set             | Previous |  New  |  % of old  | Codepoints | Ranges |
----------------|---------:|------:|-----------:|-----------:|-------:|
Alphabetic      |     3055 |  1599 |        52% |     132875 |    695 |
Case Ignorable  |     2136 |   949 |        44% |       2413 |    410 |
Cased           |      934 |   359 |        38% |       4286 |    141 |
Cc              |       43 |     9 |        20% |         65 |      2 |
Grapheme Extend |     1774 |   813 |        46% |       1979 |    344 |
Lowercase       |      985 |   867 |        88% |       2344 |    652 |
N               |     1266 |   419 |        33% |       1781 |    133 |
Uppercase       |      934 |   777 |        83% |       1911 |    643 |
White_Space     |      140 |    37 |        26% |         25 |     10 |
----------------|----------|-------|------------|------------|--------|
Total           |    11267 |  5829 |        51% |     -      |   -    |

4 years agoRollup merge of #70448 - TimotheeGerber:rustdoc-create-output-dir, r=GuillaumeGomez
Dylan DPC [Sat, 28 Mar 2020 14:21:58 +0000 (15:21 +0100)]
Rollup merge of #70448 - TimotheeGerber:rustdoc-create-output-dir, r=GuillaumeGomez

Create output dir in rustdoc markdown render

`rustdoc` command on a standalone markdown document fails because the output directory (which default to `doc/`) is not created, even when specified with the `--output` argument.

This PR adds the creation of the output directory before the file creation to avoid an unexpected error which is unclear.

I am not sure about the returned error code. I did not find a table explaining them. So I simply put the same error code that is returned when `File::create` fails because they are both related to file-system errors.

Resolve #70431

4 years agoRollup merge of #70418 - PankajChaudhary5:master, r=Dylan-DPC
Dylan DPC [Sat, 28 Mar 2020 14:21:57 +0000 (15:21 +0100)]
Rollup merge of #70418 - PankajChaudhary5:master, r=Dylan-DPC

Add long error explanation for E0703

Add long explanation for the E0703 error code
Part of #61137

r? @GuillaumeGomez