]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #69829 - Centril:rollup-lm5lzsq, r=Centril
bors [Sun, 8 Mar 2020 15:54:09 +0000 (15:54 +0000)]
Auto merge of #69829 - Centril:rollup-lm5lzsq, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #69631 (remove non-sysroot sources from rust-src component)
 - #69646 (Miri visitor: detect primitive types based on type, not layout (also, more tests))
 - #69651 (Try to ensure usize marker does not get merged)
 - #69668 (More documentation and simplification of BTreeMap's internals)
 - #69771 (Cleanup E0390 explanation)
 - #69777 (Add missing ` in doc for File::with_options())
 - #69812 (Refactorings to method/probe.rs and CrateId)

Failed merges:

r? @ghost

4 years agoRollup merge of #69812 - Marwes:refactor, r=petrochenkov
Mazdak Farrokhzad [Sun, 8 Mar 2020 15:53:44 +0000 (16:53 +0100)]
Rollup merge of #69812 - Marwes:refactor, r=petrochenkov

Refactorings to method/probe.rs and CrateId

A couple of refactorings done while looking into performance improvements in method resolution.

4 years agoRollup merge of #69777 - lukas-code:patch-1, r=jonas-schievink
Mazdak Farrokhzad [Sun, 8 Mar 2020 15:53:43 +0000 (16:53 +0100)]
Rollup merge of #69777 - lukas-code:patch-1, r=jonas-schievink

Add missing ` in doc for File::with_options()

4 years agoRollup merge of #69771 - GuillaumeGomez:cleanup-e0390, r=Dylan-DPC
Mazdak Farrokhzad [Sun, 8 Mar 2020 15:53:41 +0000 (16:53 +0100)]
Rollup merge of #69771 - GuillaumeGomez:cleanup-e0390, r=Dylan-DPC

Cleanup E0390 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69668 - ssomers:btreemap_even_more_comments, r=Mark-Simulacrum
Mazdak Farrokhzad [Sun, 8 Mar 2020 15:53:40 +0000 (16:53 +0100)]
Rollup merge of #69668 - ssomers:btreemap_even_more_comments, r=Mark-Simulacrum

More documentation and simplification of BTreeMap's internals

Salvage the documentation and simplification from #67980, without changing the type locked down by debuginfo.

r? @rkruppe

4 years agoRollup merge of #69651 - Mark-Simulacrum:black-box-marker, r=eddyb
Mazdak Farrokhzad [Sun, 8 Mar 2020 15:53:38 +0000 (16:53 +0100)]
Rollup merge of #69651 - Mark-Simulacrum:black-box-marker, r=eddyb

Try to ensure usize marker does not get merged

This follows up on [this conversation](https://github.com/rust-lang/rust/pull/69209#discussion_r379911282). However, I'm not confident this is quite correct, so feedback is appreciated, as always.

4 years agoRollup merge of #69646 - RalfJung:layout-visitor, r=eddyb
Mazdak Farrokhzad [Sun, 8 Mar 2020 15:53:36 +0000 (16:53 +0100)]
Rollup merge of #69646 - RalfJung:layout-visitor, r=eddyb

Miri visitor: detect primitive types based on type, not layout (also, more tests)

I also converted the union-based transmutes to use `mem::transmute` for increased readability.

r? @eddyb @oli-obk

4 years agoRollup merge of #69631 - RalfJung:rust-src, r=Mark-Simulacrum
Mazdak Farrokhzad [Sun, 8 Mar 2020 15:53:35 +0000 (16:53 +0100)]
Rollup merge of #69631 - RalfJung:rust-src, r=Mark-Simulacrum

remove non-sysroot sources from rust-src component

See https://github.com/rust-lang/rust/pull/69592#discussion_r386238725: these were likely added in https://github.com/rust-lang/rust/pull/58269 for the sake of compiler plugins, but those are being entirely phased out, so there is no good reason to ship these sources.

OTOH, @eddyb [wrote](https://github.com/rust-lang/rust/pull/58269#issuecomment-463408918)

> Yeah, my question is why librustc_plugin specifically? Everything else makes sense.

So maybe there is some good reason to keep these? Then we should have a comment explaining that reason.

Cc @eddyb @taeguk @Mark-Simulacrum

4 years agofix type size mismatch on 32bit
Ralf Jung [Sun, 8 Mar 2020 11:22:20 +0000 (12:22 +0100)]
fix type size mismatch on 32bit

4 years agoAuto merge of #69822 - Centril:rollup-360ca2j, r=Centril
bors [Sun, 8 Mar 2020 10:51:46 +0000 (10:51 +0000)]
Auto merge of #69822 - Centril:rollup-360ca2j, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #69422 (Remove use of `unwrap()` from save-analysis)
 - #69548 (Turn trailing tokens in `assert!()` into hard errors)
 - #69561 (Clean up unstable book)
 - #69599 (check_binding_alt_eq_ty: improve precision wrt. `if let`)
 - #69641 (Update books)
 - #69776 (Fix & test leak of some BTreeMap nodes on panic during `into_iter`)
 - #69805 (resolve: Modernize some naming)
 - #69810 (test(bindings_after_at): add dynamic drop tests for bindings_after_at)

Failed merges:

r? @ghost

4 years agoRollup merge of #69810 - thekuom:test/67523-dynamic-semantics-bindings-after-at,...
Mazdak Farrokhzad [Sun, 8 Mar 2020 10:51:20 +0000 (11:51 +0100)]
Rollup merge of #69810 - thekuom:test/67523-dynamic-semantics-bindings-after-at, r=Centril

test(bindings_after_at): add dynamic drop tests for bindings_after_at

Fixes https://github.com/rust-lang/rust/issues/67523.
Working towards https://github.com/rust-lang/rust/issues/65490.

4 years agoRollup merge of #69805 - petrochenkov:importname, r=Centril
Mazdak Farrokhzad [Sun, 8 Mar 2020 10:51:18 +0000 (11:51 +0100)]
Rollup merge of #69805 - petrochenkov:importname, r=Centril

resolve: Modernize some naming

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

4 years agoRollup merge of #69776 - ssomers:fix69769, r=Mark-Simulacrum
Mazdak Farrokhzad [Sun, 8 Mar 2020 10:51:17 +0000 (11:51 +0100)]
Rollup merge of #69776 - ssomers:fix69769, r=Mark-Simulacrum

Fix & test leak of some BTreeMap nodes on panic during `into_iter`

Fixes #69769

4 years agoRollup merge of #69641 - ehuss:update-books, r=ehuss
Mazdak Farrokhzad [Sun, 8 Mar 2020 10:51:15 +0000 (11:51 +0100)]
Rollup merge of #69641 - ehuss:update-books, r=ehuss

Update books

## nomicon

8 commits in 3e6e1001dc6e095dbd5c88005e80969f60e384e1..9f797e65e6bcc79419975b17aff8e21c9adc039f
2019-12-14 22:08:52 +0000 to 2020-03-04 03:45:13 +0100
- Rustup to latest rustc (rust-lang-nursery/nomicon#203)
- (minor) Add backticks around type names (rust-lang-nursery/nomicon#197)
- Add book.toml (rust-lang-nursery/nomicon#185)
- Rename `Alloc` to `AllocRef` (rust-lang-nursery/nomicon#188)
- Lifetimes: explain how to fix destructor example (rust-lang-nursery/nomicon#195)
- mention soundness (rust-lang-nursery/nomicon#194)
- Fix example in FFI section Calling Rust from C (rust-lang-nursery/nomicon#193)
- Removed repeated word (rust-lang-nursery/nomicon#191)

## reference

8 commits in 64239df6d173562b9deb4f012e4c3e6e960c4754..559e09caa9661043744cf7af7bd88432d966f743
2020-02-10 19:05:13 +0100 to 2020-03-02 01:17:14 +0100
- Syntax error fix (rust-lang-nursery/reference#769)
- Fix incorrect pseudocode for #[repr(C)] struct alignment (rust-lang-nursery/reference#766)
- Replace "Field-Less" with "Fieldless" (rust-lang-nursery/reference#768)
- Removed repeated word (rust-lang-nursery/reference#767)
- Update for change in const lint name. (rust-lang-nursery/reference#764)
- semantic type -> resolved type (rust-lang-nursery/reference#761)
- add behavior change of relative paths without `self` in 2018 edition (rust-lang-nursery/reference#757)
- assignment operator expressions -> compound assignment expressions (rust-lang-nursery/reference#759)

## rust-by-example

3 commits in 32facd5522ddbbf37baf01e4e4b6562bc55c071a..db57f899ea2a56a544c8d280cbf033438666273d
2020-02-11 09:25:06 -0300 to 2020-02-18 17:46:46 -0300
- Minor typo fix in src/mod/visibility (rust-lang/rust-by-example#1309)
- Don't suggest Into implements a reverse conversion (rust-lang/rust-by-example#1307)
- Improve grammar in example of 'in let' section (rust-lang/rust-by-example#1308)

## embedded-book

2 commits in b2e1092bf67bd4d7686c4553f186edbb7f5f92db..b81ffb7a6f4c5aaed92786e770e99db116aa4ebd
2020-01-30 08:45:46 +0000 to 2020-02-27 08:06:04 +0000
- Setting output to `high` needs a `true` argument  (rust-embedded/book#227)
- Add licence notes to index.md  (rust-embedded/book#226)

4 years agoRollup merge of #69599 - Centril:typeck-tweak-wording, r=davidtwco
Mazdak Farrokhzad [Sun, 8 Mar 2020 10:51:14 +0000 (11:51 +0100)]
Rollup merge of #69599 - Centril:typeck-tweak-wording, r=davidtwco

check_binding_alt_eq_ty: improve precision wrt. `if let`

Follow up to https://github.com/rust-lang/rust/pull/69452 -- this tweaks the `check_binding_alt_eq_ty` logic wrt. wording so that `if let` doesn't include "in this arm" (because there can only ever be one arm).

r? @estebank

4 years agoRollup merge of #69561 - JohnTitor:clean-up-unstable-book, r=Mark-Simulacrum
Mazdak Farrokhzad [Sun, 8 Mar 2020 10:51:12 +0000 (11:51 +0100)]
Rollup merge of #69561 - JohnTitor:clean-up-unstable-book, r=Mark-Simulacrum

Clean up unstable book

- #58402's feature was renamed to `tidy_test_never_used_anywhere_else` and it is now used for tidy only
- `read_initializer` link is wrong and the doc should be auto-generated so removed
- Add dummy doc for `link_cfg`
- Stop generating `compiler_builtins_lib` doc in favor of b8ccc0f8a60ac16fdc00f4b2e36e1a5db8b78295
- Make `rustc_attrs` tracking issue "None"

4 years agoRollup merge of #69548 - LeSeulArtichaut:assert-errors, r=petrochenkov
Mazdak Farrokhzad [Sun, 8 Mar 2020 10:51:09 +0000 (11:51 +0100)]
Rollup merge of #69548 - LeSeulArtichaut:assert-errors, r=petrochenkov

Turn trailing tokens in `assert!()` into hard errors

I didn't have time to build the compiler and thus edited the tests manually, I hope it will still pass.

Closes #69531
r? @Centril do you want to queue the Crater experiment?

4 years agoRollup merge of #69422 - JohnTitor:remove-unwrap, r=Xanewok
Mazdak Farrokhzad [Sun, 8 Mar 2020 10:51:04 +0000 (11:51 +0100)]
Rollup merge of #69422 - JohnTitor:remove-unwrap, r=Xanewok

Remove use of `unwrap()` from save-analysis

Fix #69409, fix #69416

4 years agoAuto merge of #69804 - Centril:rollup-u86dc1g, r=Centril
bors [Sun, 8 Mar 2020 05:27:21 +0000 (05:27 +0000)]
Auto merge of #69804 - Centril:rollup-u86dc1g, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #69667 (Remove the `no_debug` feature)
 - #69687 (resolve, inconsistent binding mode: tweak wording)
 - #69708 (On mismatched delimiters, only point at empty blocks that are in the same line)
 - #69765 (reduce test size for Miri)
 - #69773 (fix various typos)
 - #69787 (mir::Local is Copy we can pass it by value in these cases)
 - #69794 (Add `Layout::dangling()` to return a well-aligned `NonNull<u8>`)
 - #69797 (Correct version that relaxed orphan rules)

Failed merges:

r? @ghost

4 years agorefactor: Move a borrow_mut and unwrap out of a loop
Markus Westerlind [Sat, 7 Mar 2020 19:17:00 +0000 (20:17 +0100)]
refactor: Move a borrow_mut and unwrap out of a loop

4 years agorefactor: Exhaustive matching in method/probe.rs
Markus Westerlind [Sat, 7 Mar 2020 15:58:29 +0000 (16:58 +0100)]
refactor: Exhaustive matching in method/probe.rs

4 years agotest(bindings_after_at): add dynamic drop tests for bindings_after_at
Matthew Kuo [Sat, 7 Mar 2020 20:17:03 +0000 (14:17 -0600)]
test(bindings_after_at): add dynamic drop tests for bindings_after_at

4 years agoresolve: `directive` -> `import`
Vadim Petrochenkov [Sat, 7 Mar 2020 16:02:32 +0000 (19:02 +0300)]
resolve: `directive` -> `import`

4 years agoRollup merge of #69797 - jongiddy:convert-version, r=Mark-Simulacrum
Mazdak Farrokhzad [Sat, 7 Mar 2020 16:27:37 +0000 (17:27 +0100)]
Rollup merge of #69797 - jongiddy:convert-version, r=Mark-Simulacrum

Correct version that relaxed orphan rules

Docs say
> Prior to Rust 1.40, if the destination type was not part of the current crate then you couldn't implement From directly

Version 1.41 of Rust introduced the change to the orphan rules - https://blog.rust-lang.org/2020/01/30/Rust-1.41.0.html#relaxed-restrictions-when-implementing-traits - so this should say
> Prior to Rust 1.41...

4 years agoRollup merge of #69794 - TimDiekmann:dangling, r=Amanieu
Mazdak Farrokhzad [Sat, 7 Mar 2020 16:27:35 +0000 (17:27 +0100)]
Rollup merge of #69794 - TimDiekmann:dangling, r=Amanieu

Add `Layout::dangling()` to return a well-aligned `NonNull<u8>`

Adds a convenient function to `Layout` to create a `NonNull<u8>` out of a layout to be returned on ZST allocations.

This is the first item on the roadmap to support ZSTs in `AllocRef`: https://github.com/rust-lang/wg-allocators/issues/38#issuecomment-595861542

r? @Amanieu

4 years agoRollup merge of #69787 - spastorino:use-local-directly-its-copy, r=oli-obk
Mazdak Farrokhzad [Sat, 7 Mar 2020 16:27:34 +0000 (17:27 +0100)]
Rollup merge of #69787 - spastorino:use-local-directly-its-copy, r=oli-obk

mir::Local is Copy we can pass it by value in these cases

r? @oli-obk

4 years agoRollup merge of #69773 - matthiaskrgr:typos, r=petrochenkov
Mazdak Farrokhzad [Sat, 7 Mar 2020 16:27:32 +0000 (17:27 +0100)]
Rollup merge of #69773 - matthiaskrgr:typos, r=petrochenkov

fix various typos

4 years agoRollup merge of #69765 - RalfJung:miri-test, r=LukasKalbertodt
Mazdak Farrokhzad [Sat, 7 Mar 2020 16:27:30 +0000 (17:27 +0100)]
Rollup merge of #69765 - RalfJung:miri-test, r=LukasKalbertodt

reduce test size for Miri

The larger sizes take quite a while, and there is probably little point in repeating this quite so often.

4 years agoRollup merge of #69708 - estebank:tiny, r=petrochenkov
Mazdak Farrokhzad [Sat, 7 Mar 2020 16:27:29 +0000 (17:27 +0100)]
Rollup merge of #69708 - estebank:tiny, r=petrochenkov

On mismatched delimiters, only point at empty blocks that are in the same line

We point at empty blocks when we have mismatched braces to detect cases where editors auto insert `}` after writing `{`. Gate this to only the case where the entire span is in the same line so we never point at explicitly empty blocks.

4 years agoRollup merge of #69687 - Centril:bm-inconsistent-wording, r=estebank
Mazdak Farrokhzad [Sat, 7 Mar 2020 16:27:27 +0000 (17:27 +0100)]
Rollup merge of #69687 - Centril:bm-inconsistent-wording, r=estebank

resolve, inconsistent binding mode: tweak wording

Now that we can have e.g. `let Ok(x) | Err(x) = res;`, it's no longer appropriate to refer to "the same *match arm*", so let's tweak the wording.

r? @estebank

4 years agoRollup merge of #69667 - JohnTitor:no-debug, r=nikomatsakis
Mazdak Farrokhzad [Sat, 7 Mar 2020 16:27:26 +0000 (17:27 +0100)]
Rollup merge of #69667 - JohnTitor:no-debug, r=nikomatsakis

Remove the `no_debug` feature

Context: https://github.com/rust-lang/rust/issues/29721#issuecomment-367642779

r? @nikomatsakis

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 #69676 - ecstatic-morse:fix-enum-discr-effect, r=oli-obk
bors [Sat, 7 Mar 2020 13:47:46 +0000 (13:47 +0000)]
Auto merge of #69676 - ecstatic-morse:fix-enum-discr-effect, r=oli-obk

Pass correct place to `discriminant_switch_effect`

PR #69562, which fixed a bug that was causing clippy to ICE, mistakenly passed the place holding the *result* of `Rvalue::Discriminant` instead of the place holding its *operand* to `apply_discriminant_switch_effect` as the enum place. As a result, no effect was applied at all, and we lost the perf benefits from marking inactive enum variants as uninitialized.

**edit:** The regression test has been split into #69744.

r? @oli-obk

4 years agoCorrect version that relaxed orphan rules
Jonathan Giddy [Sat, 7 Mar 2020 08:21:27 +0000 (08:21 +0000)]
Correct version that relaxed orphan rules

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 agoUpdate alloc.rs
Tim Diekmann [Sat, 7 Mar 2020 01:45:55 +0000 (02:45 +0100)]
Update alloc.rs

4 years agoAdd `Layout::dangling()` to return a well-aligned `NonNull<u8>`
Tim Diekmann [Sat, 7 Mar 2020 01:40:54 +0000 (02:40 +0100)]
Add `Layout::dangling()` to return a well-aligned `NonNull<u8>`

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 agobug on ty::GeneratorWitness
Ralf Jung [Mon, 2 Mar 2020 21:47:28 +0000 (22:47 +0100)]
bug on ty::GeneratorWitness

4 years agorename visit_primitive -> try_visit_primitive, and comments
Ralf Jung [Mon, 2 Mar 2020 21:24:23 +0000 (22:24 +0100)]
rename visit_primitive -> try_visit_primitive, and comments

4 years agoplease tidy
Ralf Jung [Mon, 2 Mar 2020 20:53:58 +0000 (21:53 +0100)]
please tidy

4 years agobetter error messages for invalid boxes (and a few more tests)
Ralf Jung [Mon, 2 Mar 2020 20:17:34 +0000 (21:17 +0100)]
better error messages for invalid boxes (and a few more tests)

4 years agotest some more kinds of enums with uninhabited variants
Ralf Jung [Mon, 2 Mar 2020 20:03:40 +0000 (21:03 +0100)]
test some more kinds of enums with uninhabited variants

4 years agotest that we validate boxes
Ralf Jung [Mon, 2 Mar 2020 19:52:27 +0000 (20:52 +0100)]
test that we validate boxes

4 years agoconst validation ub tests: use transmute instead of unions
Ralf Jung [Mon, 2 Mar 2020 19:37:33 +0000 (20:37 +0100)]
const validation ub tests: use transmute instead of unions

4 years agomiri value visitor: detect primitives by type, not layout
Ralf Jung [Mon, 2 Mar 2020 12:09:13 +0000 (13:09 +0100)]
miri value visitor: detect primitives by type, not layout

4 years ago'fieldless enums' is not what I meant -- it's empty/uninhabited enums, really
Ralf Jung [Mon, 2 Mar 2020 10:45:02 +0000 (11:45 +0100)]
'fieldless enums' is not what I meant -- it's empty/uninhabited enums, really

4 years agomir::Local is Copy we can pass it by value in these cases
Santiago Pastorino [Fri, 6 Mar 2020 21:22:17 +0000 (18:22 -0300)]
mir::Local is Copy we can pass it by value in these cases

4 years agoTurn trailing tokens in `assert!()` into hard errors
LeSeulArtichaut [Fri, 28 Feb 2020 13:10:33 +0000 (14:10 +0100)]
Turn trailing tokens in `assert!()` into hard errors

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 agobless tests
Matthias Krüger [Fri, 6 Mar 2020 15:02:32 +0000 (16:02 +0100)]
bless tests

4 years agoRemove `NO_DEBUG` const
Yuki Okushi [Fri, 6 Mar 2020 18:32:01 +0000 (03:32 +0900)]
Remove `NO_DEBUG` const

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 agoFix missing ` in doc for File::with_options
Lukas [Fri, 6 Mar 2020 14:27:09 +0000 (14:27 +0000)]
Fix missing ` in doc for File::with_options

4 years agofix various typos
Matthias Krüger [Fri, 6 Mar 2020 11:13:55 +0000 (12:13 +0100)]
fix various typos

4 years agoFix & test leak of some BTreeMap nodes on panic during `into_iter`
Stein Somers [Fri, 6 Mar 2020 13:32:54 +0000 (14:32 +0100)]
Fix & test leak of some BTreeMap nodes on panic during `into_iter`

4 years agoCleanup E0390 explanation
Guillaume Gomez [Fri, 6 Mar 2020 11:52:16 +0000 (12:52 +0100)]
Cleanup E0390 explanation

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 agoreduce test size for Miri
Ralf Jung [Thu, 5 Mar 2020 22:38:48 +0000 (23:38 +0100)]
reduce test size for Miri

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