]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoresolve: `ImportDirective` -> `Import`
Vadim Petrochenkov [Sat, 7 Mar 2020 15:49:13 +0000 (18:49 +0300)]
resolve: `ImportDirective` -> `Import`

`ImportDirectiveSubclass` -> `ImportKind`
`ImportKind::SingleImport` -> `ImportKind::Single`
`ImportKind::GlobImport` -> `ImportKind::Glob`

4 years agoAuto merge of #69796 - Centril:rollup-xg85jmx, r=Centril
bors [Sat, 7 Mar 2020 08:07:10 +0000 (08:07 +0000)]
Auto merge of #69796 - Centril:rollup-xg85jmx, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #67741 (When encountering an Item in a pat context, point at the item def)
 - #68985 (Parse & reject postfix operators after casts)
 - #69656 (Use .next() instead of .nth(0) on iterators.)
 - #69680 (rustc_expand: Factor out `Annotatable::into_tokens` to a separate method)
 - #69690 (test(pattern): add tests for combinations of pattern features)
 - #69706 (Use subslice patterns in slice methods)
 - #69727 (Avoid using `unwrap()` in suggestions)
 - #69754 (Update deprecation version to 1.42 for Error::description)
 - #69782 (Don't redundantly repeat field names (clippy::redundant_field_names))

Failed merges:

r? @ghost

4 years agoRollup merge of #69782 - matthiaskrgr:redundant_field_name_rep, r=cramertj
Mazdak Farrokhzad [Sat, 7 Mar 2020 07:15:33 +0000 (08:15 +0100)]
Rollup merge of #69782 - matthiaskrgr:redundant_field_name_rep, r=cramertj

Don't redundantly repeat field names (clippy::redundant_field_names)

4 years agoRollup merge of #69754 - Dylnuge:dylnuge/dep-version, r=Mark-Simulacrum
Mazdak Farrokhzad [Sat, 7 Mar 2020 07:15:32 +0000 (08:15 +0100)]
Rollup merge of #69754 - Dylnuge:dylnuge/dep-version, r=Mark-Simulacrum

Update deprecation version to 1.42 for Error::description

Error::description is deprecated as of version 1.42, as the commit was
not in the release for 1.41.

Fixes #69751

4 years agoRollup merge of #69727 - JohnTitor:sugg-unwrap, r=estebank
Mazdak Farrokhzad [Sat, 7 Mar 2020 07:15:30 +0000 (08:15 +0100)]
Rollup merge of #69727 - JohnTitor:sugg-unwrap, r=estebank

Avoid using `unwrap()` in suggestions

Fixes #69725

r? @estebank

4 years agoRollup merge of #69706 - cuviper:subslice-methods, r=Centril
Mazdak Farrokhzad [Sat, 7 Mar 2020 07:15:29 +0000 (08:15 +0100)]
Rollup merge of #69706 - cuviper:subslice-methods, r=Centril

Use subslice patterns in slice methods

For all of the methods that pick off the first or last element, we can
use subslice patterns to implement them directly, rather than relying on
deeper indexing function calls. At a minimum, this means the generated
code will rely less on inlining for performance, but in some cases it
also optimizes better.

4 years agoRollup merge of #69690 - thekuom:test/67311-extend-bindings-after-at-tests, r=Centril
Mazdak Farrokhzad [Sat, 7 Mar 2020 07:15:28 +0000 (08:15 +0100)]
Rollup merge of #69690 - thekuom:test/67311-extend-bindings-after-at-tests, r=Centril

test(pattern): add tests for combinations of pattern features

Reference issue #67311

Tests combinations of the following pattern features:
- bindings_after_at
- or_patterns
- slice_patterns
- box_patterns

r? @Centril

4 years agoRollup merge of #69680 - petrochenkov:nont4, r=Centril
Mazdak Farrokhzad [Sat, 7 Mar 2020 07:15:26 +0000 (08:15 +0100)]
Rollup merge of #69680 - petrochenkov:nont4, r=Centril

rustc_expand: Factor out `Annotatable::into_tokens` to a separate method

Minor refactoring salvaged from https://github.com/rust-lang/rust/pull/69594.
r? @Centril

4 years agoRollup merge of #69656 - matthiaskrgr:iter_nth_zero, r=oli-obk
Mazdak Farrokhzad [Sat, 7 Mar 2020 07:15:24 +0000 (08:15 +0100)]
Rollup merge of #69656 - matthiaskrgr:iter_nth_zero, r=oli-obk

Use .next() instead of .nth(0) on iterators.

4 years agoRollup merge of #68985 - daboross:fix-35813, r=Centril
Mazdak Farrokhzad [Sat, 7 Mar 2020 07:15:21 +0000 (08:15 +0100)]
Rollup merge of #68985 - daboross:fix-35813, r=Centril

Parse & reject postfix operators after casts

This adds an explicit error messages for when parsing `x as Type[0]` or similar expressions. Our add an extra parse case for parsing any postfix operator (dot, indexing, method calls, await) that triggers directly after parsing `as` expressions.

My friend and I worked on this together, but they're still deciding on a github username and thus I'm submitting this for both of us.

It will immediately error out, but will also provide the rest of the parser with a useful parse tree to deal with.

There's one decision we made in how this produces the parse tree. In the situation `&x as T[0]`, one could imagine this parsing as either `&((x as T)[0])` or `((&x) as T)[0]`. We chose the latter for ease of implementation, and as it seemed the most intuitive.

Feedback welcome! This is our first change to the parser section, and it might be completely horrible.

Fixes #35813.

4 years agoRollup merge of #67741 - estebank:point-at-pat-def, r=Centril
Mazdak Farrokhzad [Sat, 7 Mar 2020 07:15:19 +0000 (08:15 +0100)]
Rollup merge of #67741 - estebank:point-at-pat-def, r=Centril

When encountering an Item in a pat context, point at the item def

```
error[E0308]: mismatched types
  --> $DIR/const-in-struct-pat.rs:8:17
   |
LL | struct foo;
   | ----------- `foo` defined here
...
LL |     let Thing { foo } = t;
   |                 ^^^ expected struct `std::string::String`, found struct `foo`
   |
   = note: `foo` is interpreted as a unit struct, not a new binding
help: you can bind the struct field to a different name
   |
LL |     let Thing { foo: other_foo } = t;
   |                 ^^^^^^^^^^^^^^
```
```
error[E0308]: mismatched types
  --> $DIR/const.rs:14:9
   |
LL | const FOO: Foo = Foo{bar: 5};
   | ----------------------------- constant defined here
...
LL |         FOO => {},
   |         ^^^
   |         |
   |         expected `&Foo`, found struct `Foo`
   |         `FOO` is interpreted as a constant, not a new binding
   |         help: use different name to introduce a new binding: `other_foo`
```

Fix #55631, fix #48062, cc #42876.

4 years agoWhen encountering an Item in a pat context, point at the item def
Esteban Küber [Mon, 30 Dec 2019 23:46:31 +0000 (15:46 -0800)]
When encountering an Item in a pat context, point at the item def

4 years agoAdd a regression test
Yuki Okushi [Fri, 6 Mar 2020 19:38:50 +0000 (04:38 +0900)]
Add a regression test

4 years agoAvoid using `unwrap()` in suggestions
Yuki Okushi [Thu, 5 Mar 2020 06:24:53 +0000 (15:24 +0900)]
Avoid using `unwrap()` in suggestions

4 years agoDon't redundantly repeat field names (clippy::redundant_field_names)
Matthias Krüger [Fri, 6 Mar 2020 18:28:44 +0000 (19:28 +0100)]
Don't redundantly repeat field names (clippy::redundant_field_names)

4 years agoAuto merge of #69753 - pnkfelix:issue-69191-ice-on-uninhabited-enum-field, r=oli
bors [Fri, 6 Mar 2020 17:52:52 +0000 (17:52 +0000)]
Auto merge of #69753 - pnkfelix:issue-69191-ice-on-uninhabited-enum-field, r=oli

Do not ICE when matching an uninhabited enum's field

Fix #69191

4 years agorustc_expand: Factor out `Annotatable::into_tokens` to a separate method
Vadim Petrochenkov [Tue, 3 Mar 2020 20:22:32 +0000 (23:22 +0300)]
rustc_expand: Factor out `Annotatable::into_tokens` to a separate method

4 years agoAdded oli's multivariant test case (alpha renaming the enum name itself).
Felix S. Klock II [Fri, 6 Mar 2020 11:43:11 +0000 (06:43 -0500)]
Added oli's multivariant test case (alpha renaming the enum name itself).

(And added Ralf's suggested test.)

Added my own three-variant multi-variant as well.

4 years agoAuto merge of #69614 - estebank:ice-age, r=davidtwco
bors [Fri, 6 Mar 2020 08:24:48 +0000 (08:24 +0000)]
Auto merge of #69614 - estebank:ice-age, r=davidtwco

`delay_span_bug` when codegen cannot select obligation

Fix #69602, introduced in #60126 by letting the compiler continue past
type checking after encountering errors.

4 years agoAdd FIXME
Oliver Scherer [Fri, 6 Mar 2020 07:48:58 +0000 (08:48 +0100)]
Add FIXME

4 years agoUpdate deprecation version to 1.42 for Error::description
Dylan Nugent [Fri, 6 Mar 2020 02:55:36 +0000 (21:55 -0500)]
Update deprecation version to 1.42 for Error::description

Error::description is deprecated as of version 1.42, as the commit was
not in the release for 1.41.

4 years agoFix #69191
Felix S. Klock II [Fri, 6 Mar 2020 02:53:26 +0000 (21:53 -0500)]
Fix #69191

4 years agoAuto merge of #69586 - petrochenkov:unmerge, r=Centril
bors [Fri, 6 Mar 2020 02:22:49 +0000 (02:22 +0000)]
Auto merge of #69586 - petrochenkov:unmerge, r=Centril

ast: Unmerge structures for associated items and foreign items

Follow-up to https://github.com/rust-lang/rust/pull/69194.
r? @Centril

4 years agoAuto merge of #69746 - Dylan-DPC:rollup-wr6dvdk, r=Dylan-DPC
bors [Thu, 5 Mar 2020 21:39:00 +0000 (21:39 +0000)]
Auto merge of #69746 - Dylan-DPC:rollup-wr6dvdk, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #69697 (Add explanation for E0380)
 - #69698 (Use associated constants of integer types)
 - #69711 (Update macros.rs: fix documentation typo.)
 - #69713 (more clippy cleanups)
 - #69728 (Make link to `std::str` active)
 - #69732 (Clean E0382 and E0384 explanations)
 - #69736 (even more clippy cleanups)
 - #69742 (Fixed a typo)

Failed merges:

r? @ghost

4 years agoRollup merge of #69742 - TrolledWoods:patch-1, r=jonas-schievink
Dylan DPC [Thu, 5 Mar 2020 21:04:12 +0000 (22:04 +0100)]
Rollup merge of #69742 - TrolledWoods:patch-1, r=jonas-schievink

Fixed a typo

"vector" was used instead of "string". I think this is a typo?

4 years agoRollup merge of #69736 - matthiaskrgr:even_more_clippy, r=Dylan-DPC
Dylan DPC [Thu, 5 Mar 2020 21:04:10 +0000 (22:04 +0100)]
Rollup merge of #69736 - matthiaskrgr:even_more_clippy, r=Dylan-DPC

even more clippy cleanups

* Don't pass &mut where immutable reference (&) is sufficient (clippy::unnecessary_mut_passed)
* Use more efficient &&str to String conversion (clippy::inefficient_to_string)
* Don't always eval arguments inside .expect(), use unwrap_or_else and closure. (clippy::expect_fun_call)
* Use righthand '&' instead of lefthand "ref". (clippy::toplevel_ref_arg)
* Use simple 'for i in x' loops instead of 'while let Some(i) = x.next()' loops on iterators. (clippy::while_let_on_iterator)
* Const items have by default a static lifetime, there's no need to annotate it. (clippy::redundant_static_lifetimes)
* Remove redundant patterns when matching ( x @ _  to  x) (clippy::redundant_pattern)

4 years agoRollup merge of #69732 - GuillaumeGomez:cleanup-e0382-e0384, r=Dylan-DPC
Dylan DPC [Thu, 5 Mar 2020 21:04:09 +0000 (22:04 +0100)]
Rollup merge of #69732 - GuillaumeGomez:cleanup-e0382-e0384, r=Dylan-DPC

Clean E0382 and E0384 explanations

r? @Dylan-DPC

4 years agoRollup merge of #69728 - LeSeulArtichaut:patch-1, r=steveklabnik
Dylan DPC [Thu, 5 Mar 2020 21:04:07 +0000 (22:04 +0100)]
Rollup merge of #69728 - LeSeulArtichaut:patch-1, r=steveklabnik

Make link to `std::str` active

Closes #69726.

r? @dtolnay

4 years agoRollup merge of #69713 - matthiaskrgr:more_cleanup, r=cramertj
Dylan DPC [Thu, 5 Mar 2020 21:04:05 +0000 (22:04 +0100)]
Rollup merge of #69713 - matthiaskrgr:more_cleanup, r=cramertj

more clippy cleanups

* Don't use .ok() before unwrapping via .expect() on a Result.
* Use .map() to modify data inside Options instead of using .and_then(|x| Some(y))
* Use .as_deref() instead of .as_ref().map(Deref::deref)
* Don't use "if let" bindings to only check a value and not actually bind anything.
* Use single-char patter on {ends,starts}_with and remove clone on copy type.

4 years agoRollup merge of #69711 - penelopezone:patch-1, r=steveklabnik
Dylan DPC [Thu, 5 Mar 2020 21:04:04 +0000 (22:04 +0100)]
Rollup merge of #69711 - penelopezone:patch-1, r=steveklabnik

Update macros.rs: fix documentation typo.

4 years agoRollup merge of #69698 - RalfJung:int_assoc, r=davidtwco
Dylan DPC [Thu, 5 Mar 2020 21:04:02 +0000 (22:04 +0100)]
Rollup merge of #69698 - RalfJung:int_assoc, r=davidtwco

Use associated constants of integer types

Take advantage of https://github.com/rust-lang/rust/pull/68952 in the interpreter and some nearby modules :)

4 years agoRollup merge of #69697 - GuillaumeGomez:explanation-e0380, r=Dylan-DPC
Dylan DPC [Thu, 5 Mar 2020 21:03:58 +0000 (22:03 +0100)]
Rollup merge of #69697 - GuillaumeGomez:explanation-e0380, r=Dylan-DPC

Add explanation for E0380

r? @Dylan-DPC

4 years agoFixed a typo
TrolledWoods [Thu, 5 Mar 2020 19:20:02 +0000 (20:20 +0100)]
Fixed a typo

"vector" was used instead of "string"

4 years agoAuto merge of #67260 - TheSamsa:const-limit, r=oli-obk
bors [Thu, 5 Mar 2020 17:46:58 +0000 (17:46 +0000)]
Auto merge of #67260 - TheSamsa:const-limit, r=oli-obk

const limit for CTFE

I tried to tackle the first steps for this issue.
The active feature flag does link to the issue below, I think this has to change, because there should be a tracking issue?
https://github.com/TheSamsa/rust/blob/1679a7647da0de672bac26b716db82d16f3896a8/src/librustc_feature/active.rs#L530

Also, I only put up the storage of the limit like "recursion_limit" but created a seperate file in the same place. Since I guess the invocation happens seperately.
https://github.com/TheSamsa/rust/blob/const-limit/src/librustc/middle/const_limit.rs

If this does not hold up for the issue and since there is a time pressure, just reject it.

hopefully this does not put more load on you than I expected...

4 years agoDon't pass &mut where immutable reference (&) is sufficient (clippy::unnecessary_mut_...
Matthias Krüger [Thu, 5 Mar 2020 13:54:19 +0000 (14:54 +0100)]
Don't pass &mut where immutable reference (&) is sufficient (clippy::unnecessary_mut_passed)

4 years agoUse more efficient &&str to String conversion (clippy::inefficient_to_string)
Matthias Krüger [Thu, 5 Mar 2020 13:29:58 +0000 (14:29 +0100)]
Use more efficient &&str to String conversion (clippy::inefficient_to_string)

4 years agoDon't always eval arguments inside .expect(), use unwrap_or_else and closure. (clippy...
Matthias Krüger [Thu, 5 Mar 2020 13:08:27 +0000 (14:08 +0100)]
Don't always eval arguments inside .expect(), use unwrap_or_else and closure. (clippy::expect_fun_call)

4 years agoUse righthand '&' instead of lefthand "ref". (clippy::toplevel_ref_arg)
Matthias Krüger [Thu, 5 Mar 2020 12:56:01 +0000 (13:56 +0100)]
Use righthand '&' instead of lefthand "ref". (clippy::toplevel_ref_arg)

4 years agoUse simple 'for i in x' loops instead of 'while let Some(x) = x.next()' loops on...
Matthias Krüger [Thu, 5 Mar 2020 12:20:04 +0000 (13:20 +0100)]
Use simple 'for i in x' loops instead of 'while let Some(x) = x.next()' loops on iterators. (clippy::while_let_on_iterator)

4 years agoConst items have by default a static lifetime, there's no need to annotate it. (clipp...
Matthias Krüger [Thu, 5 Mar 2020 10:33:05 +0000 (11:33 +0100)]
Const items have by default a static lifetime, there's no need to annotate it. (clippy::redundant_static_lifetimes)

4 years agoRemove redundant patterns when matching ( x @ _ to x) (clippy::redundant_pattern)
Matthias Krüger [Thu, 5 Mar 2020 10:26:51 +0000 (11:26 +0100)]
Remove redundant patterns when matching ( x @ _  to  x) (clippy::redundant_pattern)

4 years agoAuto merge of #69692 - matthiaskrgr:submodule_upd, r=oli-obk
bors [Thu, 5 Mar 2020 13:40:57 +0000 (13:40 +0000)]
Auto merge of #69692 - matthiaskrgr:submodule_upd, r=oli-obk

submodules: update clippy from 8b7f7e66 to 74eae9dc

Changes:
````
Rustup to rust-lang/rust#69506
Revive rls integration test
use question mark operator
Add regression test
Use `try_eval_usize` over `eval_usize`
Add path for display trait
Use lang items instead of get_trait_def_id where possible
Update stderr
Don't lint debug formatting in debug impl
Whitelist unused attribute for use items.
add test for #5238
````

Makes clippy tests pass again.

r? @oli-obk

4 years agoClean E0382 and E0384 explanations
Guillaume Gomez [Thu, 5 Mar 2020 12:05:08 +0000 (13:05 +0100)]
Clean E0382 and E0384 explanations

4 years agoMake link to `std::str` active
LeSeulArtichaut [Thu, 5 Mar 2020 07:52:46 +0000 (08:52 +0100)]
Make link to `std::str` active

4 years agoBumped version number for const_eval_limit in active.rs
Christoph Schmidler [Wed, 19 Feb 2020 09:24:16 +0000 (10:24 +0100)]
Bumped version number for const_eval_limit in active.rs

and renamed 'recursion_limit' in limits.rs to simple 'limit' because it does handle other limits too.

4 years agoOpt out of CTFE if the 'const_eval_limit' is set to 0
Christoph Schmidler [Tue, 21 Jan 2020 15:46:07 +0000 (16:46 +0100)]
Opt out of CTFE if the 'const_eval_limit' is set to 0

4 years agoAdd a new test to reach const_limit setting, although with wrong WARNINGs yet
Christoph Schmidler [Sat, 14 Dec 2019 17:51:56 +0000 (18:51 +0100)]
Add a new test to reach const_limit setting, although with wrong WARNINGs yet
rename feature to const_eval_limit

4 years agoDisable CTFE if const_limit was set to 0, otherwise use the value set, which defaults...
Christoph Schmidler [Fri, 13 Dec 2019 08:38:07 +0000 (09:38 +0100)]
Disable CTFE if const_limit was set to 0, otherwise use the value set, which defaults to 1_000_000

4 years agoPrepare const_limit feature gate and attribute
Christoph Schmidler [Thu, 12 Dec 2019 16:23:14 +0000 (17:23 +0100)]
Prepare const_limit feature gate and attribute

4 years agoAuto merge of #69717 - estebank:correctly-probe, r=varkor
bors [Thu, 5 Mar 2020 03:44:53 +0000 (03:44 +0000)]
Auto merge of #69717 - estebank:correctly-probe, r=varkor

Correctly reject `TraitCandidate` in all cases

Follow up to #69255, addresses #69629.

When `self.select_trait_candidate(trait_ref)` returned `Err(_)`, `result` wasn't being set to `NoMatch`, causing invalid methods to be selected.

4 years agoCorrectly reject `TraitCandidate` in all cases
Esteban Küber [Wed, 4 Mar 2020 21:59:51 +0000 (13:59 -0800)]
Correctly reject `TraitCandidate` in all cases

Follow up to #69255, fix #69629.

4 years agoUse single-char patter on {ends,starts}_with and remove clone on copy type.
Matthias Krüger [Wed, 4 Mar 2020 19:47:05 +0000 (20:47 +0100)]
Use single-char patter on {ends,starts}_with and remove clone on copy type.

These were introduced since I last fixed most of these occurences. (clippy::clone_on_copy, clippy::single_char_pattern)

4 years agoDon't use "if let" bindings to only check a value and not actually bind anything.
Matthias Krüger [Wed, 4 Mar 2020 14:53:14 +0000 (15:53 +0100)]
Don't use "if let" bindings to only check a value and not actually bind anything.

For example:  `if let Some(_) = foo() {}` can be reduced to `if foo().is_some() {}`   (clippy::redundant_pattern_matching)

4 years agoUse .as_deref() instead of .as_ref().map(Deref::deref) (clippy::option_as_ref_deref)
Matthias Krüger [Wed, 4 Mar 2020 14:16:27 +0000 (15:16 +0100)]
Use .as_deref() instead of .as_ref().map(Deref::deref) (clippy::option_as_ref_deref)

4 years agoUse .map() to modify data inside Options instead of using .and_then(|x| Some(y))...
Matthias Krüger [Wed, 4 Mar 2020 14:13:19 +0000 (15:13 +0100)]
Use .map() to modify data inside Options instead of using .and_then(|x| Some(y)) (clippy::option_and_then_some)

4 years agoDon't use .ok() before unwrapping via .expect() on a Result.
Matthias Krüger [Wed, 4 Mar 2020 12:36:49 +0000 (13:36 +0100)]
Don't use .ok() before unwrapping via .expect() on a Result.

The Result can be expect-unwrapped directly. (clippy::ok_expect)

4 years agoUpdate macros.rs: fix documentation typo.
Penelope Phippen [Wed, 4 Mar 2020 19:18:31 +0000 (14:18 -0500)]
Update macros.rs: fix documentation typo.

4 years agosubmodules: update clippy from 8b7f7e66 to 329923ed
Matthias Krüger [Wed, 4 Mar 2020 18:56:10 +0000 (19:56 +0100)]
submodules: update clippy from 8b7f7e66 to 329923ed

Changes:
````
Apply suggestions from code review
Simplify if_chain.
Move NumericLiteral to its own module.
Included binary and octal cases.
Resolve false positives for hex int cast.
Test for unnecessary_cast of hex int literal.
run-rustfix
Lint `if let Some` in question_mark lint
Add restrictive pat use in full binded struct
Update test case answers to match cargo dev fmt
Ran cargo dev fmt
Rustup to rust-lang/rust#69506
Recommended changes from flip1995
Revive rls integration test
use question mark operator
Add regression test
Use `try_eval_usize` over `eval_usize`
Add path for display trait
Use lang items instead of get_trait_def_id where possible
Update stderr
Don't lint debug formatting in debug impl
Whitelist unused attribute for use items.
Fix one last test issue
Refactor suggested by krishna-veerareddy
Fixed compile error from merging
Changed test output to reflect cargo fmt
Run cargo dev fmt
Finished checking for cases of absolute values
add test for #5238
Some bugfixing
Created floating point abs lint and test, but not yet run
````

4 years agoUse subslice patterns in slice methods
Josh Stone [Wed, 4 Mar 2020 18:34:24 +0000 (10:34 -0800)]
Use subslice patterns in slice methods

For all of the methods that pick off the first or last element, we can
use subslice patterns to implement them directly, rather than relying on
deeper indexing function calls. At a minimum, this means the generated
code will rely less on inlining for performance, but in some cases it
also optimizes better.

4 years agoAuto merge of #69576 - matthiaskrgr:nightly_bootstrap_from_beta, r=Centril
bors [Wed, 4 Mar 2020 18:34:21 +0000 (18:34 +0000)]
Auto merge of #69576 - matthiaskrgr:nightly_bootstrap_from_beta, r=Centril

nightly: bootstrap from 1.42.0-beta.5 (4e1c5f0e9 2020-02-28)

This beta snapshot has the llvm miscompilation fix included and is bootstrapped from a stable version that also has it included.

4 years agocover some more nearby cases
Ralf Jung [Wed, 4 Mar 2020 12:18:08 +0000 (13:18 +0100)]
cover some more nearby cases

4 years agouse integer assoc consts instead of methods
Ralf Jung [Wed, 4 Mar 2020 12:12:04 +0000 (13:12 +0100)]
use integer assoc consts instead of methods

4 years agoAdd explanation for E0380
Guillaume Gomez [Wed, 4 Mar 2020 12:01:19 +0000 (13:01 +0100)]
Add explanation for E0380

4 years agoAuto merge of #69636 - RalfJung:miri, r=nikomatsakis
bors [Wed, 4 Mar 2020 10:44:55 +0000 (10:44 +0000)]
Auto merge of #69636 - RalfJung:miri, r=nikomatsakis

update miri

Let's make that toolstate green again. :D

This bumps serde in the lockfile, so r? @oli-obk

Fixes https://github.com/rust-lang/rust/issues/69462

4 years agoupdate miri
Ralf Jung [Wed, 4 Mar 2020 10:03:08 +0000 (11:03 +0100)]
update miri

4 years agopoint cargo-miri to the right xargo binary
Ralf Jung [Mon, 2 Mar 2020 21:43:31 +0000 (22:43 +0100)]
point cargo-miri to the right xargo binary

4 years agofix tidy error
Matthew Kuo [Wed, 4 Mar 2020 08:05:23 +0000 (02:05 -0600)]
fix tidy error

4 years agotest(pattern): harden tests for or-patterns with slice-patterns
Matthew Kuo [Wed, 4 Mar 2020 07:33:32 +0000 (01:33 -0600)]
test(pattern): harden tests for or-patterns with slice-patterns

Some of the nested OR paths were being missed

4 years agoAuto merge of #68952 - faern:stabilize-assoc-int-consts, r=dtolnay
bors [Wed, 4 Mar 2020 07:29:32 +0000 (07:29 +0000)]
Auto merge of #68952 - faern:stabilize-assoc-int-consts, r=dtolnay

Stabilize assoc_int_consts associated int/float constants

The next step in RFC https://github.com/rust-lang/rfcs/pull/2700 (tracking issue #68490). Stabilizing the associated constants that were added in #68325.

* Stabilize all constants under the `assoc_int_consts` feature flag.
* Update documentation on old constants to say they are soft-deprecated and the new ones should be preferred.
* Update documentation examples to use new constants.
* Remove `uint_macro` and use `int_macro` for all integer types since the macros were identical anyway.

r? @LukasKalbertodt

4 years agotest(pattern): add tests for combinations of pattern features
Matthew Kuo [Wed, 4 Mar 2020 07:09:53 +0000 (01:09 -0600)]
test(pattern): add tests for combinations of pattern features

Reference issue #67311

Tests combinations of the following pattern features:
- bindings_after_at
- or_patterns
- slice_patterns
- box_patterns

4 years agoAuto merge of #69550 - RalfJung:scalar, r=oli-obk
bors [Wed, 4 Mar 2020 04:10:58 +0000 (04:10 +0000)]
Auto merge of #69550 - RalfJung:scalar, r=oli-obk

interpret engine: Scalar cleanup

* Remove `to_ptr`
* Make `to_bits` private

r? @oli-obk

4 years agoAuto merge of #69678 - Dylan-DPC:rollup-yoaueud, r=Dylan-DPC
bors [Tue, 3 Mar 2020 23:26:38 +0000 (23:26 +0000)]
Auto merge of #69678 - Dylan-DPC:rollup-yoaueud, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #69565 (miri engine: turn some debug_assert into assert)
 - #69621 (use question mark operator in a few places.)
 - #69650 (cleanup more iterator usages (and other things))
 - #69653 (use conditions directly)
 - #69665 (Invoke OptimizerLastEPCallbacks in PreLinkThinLTO)
 - #69670 (Add explanation for E0379)

Failed merges:

r? @ghost

4 years agoRollup merge of #69670 - GuillaumeGomez:explain-e0379, r=Dylan-DPC
Dylan DPC [Tue, 3 Mar 2020 20:26:18 +0000 (21:26 +0100)]
Rollup merge of #69670 - GuillaumeGomez:explain-e0379, r=Dylan-DPC

Add explanation for E0379

r? @Dylan-DPC

4 years agoRollup merge of #69665 - tmiasko:new-pass-manager-thin-lto-opt, r=nikic
Dylan DPC [Tue, 3 Mar 2020 20:26:16 +0000 (21:26 +0100)]
Rollup merge of #69665 - tmiasko:new-pass-manager-thin-lto-opt, r=nikic

Invoke OptimizerLastEPCallbacks in PreLinkThinLTO

The default ThinLTO pre-link pipeline does not include optimizer last
extension points. Thus, when using the new LLVM pass manager & ThinLTO
& sanitizers on any opt-level different from zero, the sanitizer
function passes would be omitted from the pipeline.

Add optimizer last extensions points manually to the pipeline, but guard
registration with stage check in the case this behaviour changes in the
future.

4 years agoRollup merge of #69653 - matthiaskrgr:needless_bool, r=Dylan-DPC
Dylan DPC [Tue, 3 Mar 2020 20:26:15 +0000 (21:26 +0100)]
Rollup merge of #69653 - matthiaskrgr:needless_bool, r=Dylan-DPC

use conditions directly

4 years agoRollup merge of #69650 - matthiaskrgr:clnp, r=varkor
Dylan DPC [Tue, 3 Mar 2020 20:26:13 +0000 (21:26 +0100)]
Rollup merge of #69650 - matthiaskrgr:clnp, r=varkor

cleanup more iterator usages (and other things)

* Improve weird formatting by moving comment inside else-code block.
* Use .any(x) instead of .find(x).is_some() on iterators.
* Use .nth(x) instead of .skip(x).next() on iterators.
* Simplify conditions like  x + 1 <= y   to   x < y
* Use let instead of match to get value of enum with single variant.

4 years agoRollup merge of #69621 - matthiaskrgr:q, r=petrochenkov
Dylan DPC [Tue, 3 Mar 2020 20:26:12 +0000 (21:26 +0100)]
Rollup merge of #69621 - matthiaskrgr:q, r=petrochenkov

use question mark operator in a few places.

4 years agoRollup merge of #69565 - RalfJung:assert, r=eddyb
Dylan DPC [Tue, 3 Mar 2020 20:26:10 +0000 (21:26 +0100)]
Rollup merge of #69565 - RalfJung:assert, r=eddyb

miri engine: turn some debug_assert into assert

@eddyb said to avoid debug assertions in rustc. These checks here look like they are probably not too expensive. Cc @oli-obk

4 years agoAuto merge of #69506 - Centril:stmt-semi-none, r=petrochenkov
bors [Tue, 3 Mar 2020 19:57:07 +0000 (19:57 +0000)]
Auto merge of #69506 - Centril:stmt-semi-none, r=petrochenkov

encode `;` stmt without expr as `StmtKind::Empty`

Instead of encoding `;` statements without a an expression as a tuple in AST, encode it as `ast::StmtKind::Empty`.

r? @petrochenkov

4 years agoAuto merge of #69371 - tmiasko:weak-lang-cycle, r=alexcrichton
bors [Tue, 3 Mar 2020 16:38:02 +0000 (16:38 +0000)]
Auto merge of #69371 - tmiasko:weak-lang-cycle, r=alexcrichton

Improve linking of crates with circular dependencies

Previously, the code responsible for handling the cycles between crates
introduces through weak lang items, would keep a set of missing language
items:

* extending it with items missing from the current crate,
* removing items provided by the current crate,
* grouping the crates when the set changed from non-empty back to empty.

This could produce incorrect results, if a lang item was missing from a
crate that comes after the crate that provides it (in the loop iteration
order). In that case the grouping would not take place.

The changes here address this specific failure scenario by keeping track
of two separate sets of crates. Those that are required to link successfully,
and those that are available for linking.

Verified using test case from #69368.

4 years agoAuto merge of #69482 - lqd:poloniusup, r=nikomatsakis
bors [Tue, 3 Mar 2020 13:27:52 +0000 (13:27 +0000)]
Auto merge of #69482 - lqd:poloniusup, r=nikomatsakis

Polonius: update `polonius-engine` to 0.12.0

Since @albins won't have the time to finish up #68993 for a while, I'll take care of the trivial remaining tasks (rebasing, taking care of tidy/rustfmt).

I'll r? @nikomatsakis since they're assigned to #68993, but have actually [already reviewed it pre-rebase](https://github.com/rust-lang/rust/pull/68993#issuecomment-586413089).

When CI passes: I'll notify bors and close #68993, since this PR supersedes it.

4 years agoAdd explanation for E0379
Guillaume Gomez [Tue, 3 Mar 2020 12:30:17 +0000 (13:30 +0100)]
Add explanation for E0379

4 years agoAdd regression test for linking issue with start-group / end-group
Tomasz Miąsko [Tue, 3 Mar 2020 00:00:00 +0000 (00:00 +0000)]
Add regression test for linking issue with start-group / end-group

4 years agoImprove linking of crates with circular dependencies
Tomasz Miąsko [Sat, 22 Feb 2020 00:00:00 +0000 (00:00 +0000)]
Improve linking of crates with circular dependencies

Previously, the code responsible for handling the cycles between crates
introduces through weak lang items, would keep a set of missing language
items:

* extending it with items missing from the current crate,
* removing items provided by the current crate,
* grouping the crates when the set changed from non-empty back to empty.

This could produce incorrect results, if a lang item was missing from a
crate that comes after the crate that provides it (in the loop iteration
order). In that case the grouping would not take place.

The changes here address this specific failure scenario by keeping track
of two separate sets of crates. Those that are required to link successfully,
and those that are available for linking.

Verified using test case from 69368.

4 years agouse question mark operator in a few places.
Matthias Krüger [Sun, 1 Mar 2020 21:04:42 +0000 (22:04 +0100)]
use question mark operator in a few places.

4 years agoAuto merge of #69666 - JohnTitor:rollup-6nt3op0, r=JohnTitor
bors [Tue, 3 Mar 2020 10:18:57 +0000 (10:18 +0000)]
Auto merge of #69666 - JohnTitor:rollup-6nt3op0, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #69213 (Improve documentation on iterators length)
 - #69609 (Remove `usable_size` APIs)
 - #69619 (more cleanups)
 - #69620 (doc(librustc_error_codes): add long error explanation for E0719)
 - #69626 (Toolstate: don't duplicate nightly tool list.)
 - #69628 (Fix a leak in `DiagnosticBuilder::into_diagnostic`.)
 - #69633 (Update my mailmap entry)
 - #69634 (clean up E0378 explanation)
 - #69637 (Don't convert Results to Options just for matching.)

Failed merges:

r? @ghost

4 years agoRollup merge of #69637 - matthiaskrgr:if_let_some_result, r=ecstatic-morse
Yuki Okushi [Tue, 3 Mar 2020 08:50:17 +0000 (17:50 +0900)]
Rollup merge of #69637 - matthiaskrgr:if_let_some_result, r=ecstatic-morse

Don't convert Results to Options just for matching.

4 years agoRollup merge of #69634 - GuillaumeGomez:clean-up-e0378, r=Dylan-DPC
Yuki Okushi [Tue, 3 Mar 2020 08:50:16 +0000 (17:50 +0900)]
Rollup merge of #69634 - GuillaumeGomez:clean-up-e0378, r=Dylan-DPC

clean up E0378 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69633 - XAMPPRocky:master, r=Dylan-DPC
Yuki Okushi [Tue, 3 Mar 2020 08:50:14 +0000 (17:50 +0900)]
Rollup merge of #69633 - XAMPPRocky:master, r=Dylan-DPC

Update my mailmap entry

superceding #68891

4 years agoRollup merge of #69628 - nnethercote:fix-DiagnosticBuilder-into_diagnostic-leak,...
Yuki Okushi [Tue, 3 Mar 2020 08:50:13 +0000 (17:50 +0900)]
Rollup merge of #69628 - nnethercote:fix-DiagnosticBuilder-into_diagnostic-leak, r=Centril

Fix a leak in `DiagnosticBuilder::into_diagnostic`.

Fixes #69600.

r? @Centril

4 years agoRollup merge of #69626 - ehuss:toolstate-nightly-cleanup, r=Mark-Simulacrum
Yuki Okushi [Tue, 3 Mar 2020 08:50:11 +0000 (17:50 +0900)]
Rollup merge of #69626 - ehuss:toolstate-nightly-cleanup, r=Mark-Simulacrum

Toolstate: don't duplicate nightly tool list.

Just some cleanup, seems good to avoid duplicating this list.

4 years agoRollup merge of #69620 - thekuom:doc/61137-add-long-error-code-e0719, r=davidtwco
Yuki Okushi [Tue, 3 Mar 2020 08:50:10 +0000 (17:50 +0900)]
Rollup merge of #69620 - thekuom:doc/61137-add-long-error-code-e0719, r=davidtwco

doc(librustc_error_codes): add long error explanation for E0719

Reference issue #61137

- Updated error_codes.rs
- Added E0719.md in error_codes
- Updated necessary test .stderr files

4 years agoRollup merge of #69619 - matthiaskrgr:misc, r=eddyb
Yuki Okushi [Tue, 3 Mar 2020 08:50:08 +0000 (17:50 +0900)]
Rollup merge of #69619 - matthiaskrgr:misc, r=eddyb

more cleanups

* use starts_with() instead of chars().next() == Some(x)
* use subsec_micros() instead of subsec_nanos() / 1000
* use for (idx, item) in iter.enumerate() instead of manually counting loop iterations with variables
* use values() or keys() respectively when iterating only over keys or values of maps.

4 years agoRollup merge of #69609 - TimDiekmann:excess, r=Amanieu
Yuki Okushi [Tue, 3 Mar 2020 08:50:06 +0000 (17:50 +0900)]
Rollup merge of #69609 - TimDiekmann:excess, r=Amanieu

Remove `usable_size` APIs

This removes the usable size APIs:
- remove `usable_size` (obv)
- change return type of allocating methods to include the allocated size
- remove `_excess` API

r? @Amanieu
closes rust-lang/wg-allocators#17

4 years agoRollup merge of #69213 - LeSeulArtichaut:improve-doc-iter, r=steveklabnik
Yuki Okushi [Tue, 3 Mar 2020 08:50:04 +0000 (17:50 +0900)]
Rollup merge of #69213 - LeSeulArtichaut:improve-doc-iter, r=steveklabnik

Improve documentation on iterators length

Attempts to resolve #66491. @the8472 does this help?

r? @steveklabnik

4 years agoFix check for __msan_keep_going in sanitizer-recover test
Tomasz Miąsko [Tue, 3 Mar 2020 00:00:00 +0000 (00:00 +0000)]
Fix check for __msan_keep_going in sanitizer-recover test

Match `@__msan_keep_going = weak_odr constant i32 1`.

4 years agoAdd test for -Znew-llvm-pass-manager -Clto=thin -Zsanitizer=...
Tomasz Miąsko [Tue, 3 Mar 2020 00:00:00 +0000 (00:00 +0000)]
Add test for -Znew-llvm-pass-manager -Clto=thin -Zsanitizer=...

Additionally verify that the current implementation of LLVM version
check (which uses lexicographic ordering) is good enough to exclude
versions before LLVM 9, where the new LLVM pass manager is unsupported.

4 years agoInvoke OptimizerLastEPCallbacks in PreLinkThinLTO
Tomasz Miąsko [Tue, 3 Mar 2020 00:00:00 +0000 (00:00 +0000)]
Invoke OptimizerLastEPCallbacks in PreLinkThinLTO

The default ThinLTO pre-link pipeline does not include optimizer last
extension points. Thus, when using the new LLVM pass manager & ThinLTO
& sanitizers on any opt-level different from zero, the sanitizer
function passes would be omitted from the pipeline.

Add optimizer last extensions points manually to the pipeline, but guard
registration with stage check in the case this behaviour changes in the
future.

4 years agoAuto merge of #69247 - CAD97:remove-chalk, r=nikomatsakis
bors [Tue, 3 Mar 2020 04:31:01 +0000 (04:31 +0000)]
Auto merge of #69247 - CAD97:remove-chalk, r=nikomatsakis

Remove experimental chalk option

As suggested by @nikomatsakis [here](https://github.com/rust-lang/rust/pull/68807#issuecomment-583339932).

The current version of chalk used by the experimental `-Zchalk` flag is [v0.9.0, which is over a year old](https://crates.io/crates/chalk-engine). Since v0.9.0, chalk has seen [a lot of further development](https://github.com/rust-lang/chalk/compare/41dfe13...master), and the intent is to eventually upgrade rustc to use a more recent chalk.

However, it will take a decent chunk of effort to upgrade the current experimental chalk support, and it is currently [blocking at least some PRs](https://github.com/rust-lang/rust/pull/68807) due to chalk:0.9.0's use of unstable features. So for the interim until the next chalk release and experimental rustc integration, we remove the chalk-specific code from rustc.

4 years agouse conditions directly
Matthias Krüger [Tue, 3 Mar 2020 01:07:15 +0000 (02:07 +0100)]
use conditions directly