Commit Graph

108038 Commits

Author SHA1 Message Date
Tim Diekmann
f77afc8f9c Allow ZSTs in AllocRef 2020-03-08 11:01:12 +01:00
Guillaume Gomez
2676afeca4 clean up E0392 explanation 2020-03-08 10:44:23 +01:00
Guillaume Gomez
4db15d89a0 Cleanup E0391 explanation 2020-03-08 10:41:14 +01:00
bors
f943349eaf 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
2020-03-08 05:27:21 +00:00
Markus Westerlind
6095fa146c refactor: Move a borrow_mut and unwrap out of a loop 2020-03-07 22:35:37 +01:00
Markus Westerlind
b1b558f1f0 refactor: Exhaustive matching in method/probe.rs 2020-03-07 22:35:37 +01:00
Matthew Kuo
2e88bec619 test(bindings_after_at): add dynamic drop tests for bindings_after_at 2020-03-07 14:18:22 -06:00
Vadim Petrochenkov
66d7a88c41 resolve: directive -> import 2020-03-07 19:30:57 +03:00
Mazdak Farrokhzad
8ee7278fca
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...
2020-03-07 17:27:37 +01:00
Mazdak Farrokhzad
963b0aa541
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
2020-03-07 17:27:35 +01:00
Mazdak Farrokhzad
f1f4864de3
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
2020-03-07 17:27:34 +01:00
Mazdak Farrokhzad
10f999b72d
Rollup merge of #69773 - matthiaskrgr:typos, r=petrochenkov
fix various typos
2020-03-07 17:27:32 +01:00
Mazdak Farrokhzad
e6d4996a43
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.
2020-03-07 17:27:30 +01:00
Mazdak Farrokhzad
1a1f948deb
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.
2020-03-07 17:27:29 +01:00
Mazdak Farrokhzad
289c3a5f6e
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
2020-03-07 17:27:27 +01:00
Mazdak Farrokhzad
614cd8dc47
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
2020-03-07 17:27:26 +01:00
Vadim Petrochenkov
1915bf122e resolve: ImportDirective -> Import
`ImportDirectiveSubclass` -> `ImportKind`
`ImportKind::SingleImport` -> `ImportKind::Single`
`ImportKind::GlobImport` -> `ImportKind::Glob`
2020-03-07 18:59:56 +03:00
bors
823ff8cf13 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
2020-03-07 13:47:46 +00:00
Tomasz Miąsko
adc422f3d5 Compile address sanitizer test with debuginfo
This makes error-pattern to match regardless of current
configuration of `rust.debuginfo-level-tests` in `config.toml`.
2020-03-07 13:33:40 +01:00
Jonathan Giddy
dffd18fafc Correct version that relaxed orphan rules 2020-03-07 08:21:27 +00:00
bors
a03921701c 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
2020-03-07 08:07:10 +00:00
Mazdak Farrokhzad
709325af67
Rollup merge of #69782 - matthiaskrgr:redundant_field_name_rep, r=cramertj
Don't redundantly repeat field names (clippy::redundant_field_names)
2020-03-07 08:15:33 +01:00
Mazdak Farrokhzad
ca90c3d0a7
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
2020-03-07 08:15:32 +01:00
Mazdak Farrokhzad
93a57cf3a8
Rollup merge of #69727 - JohnTitor:sugg-unwrap, r=estebank
Avoid using `unwrap()` in suggestions

Fixes #69725

r? @estebank
2020-03-07 08:15:30 +01:00
Mazdak Farrokhzad
b25fb9e79b
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.
2020-03-07 08:15:29 +01:00
Mazdak Farrokhzad
ba1f6cbb00
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
2020-03-07 08:15:28 +01:00
Mazdak Farrokhzad
e9c3ddc8df
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
2020-03-07 08:15:26 +01:00
Mazdak Farrokhzad
5d1433b1f4
Rollup merge of #69656 - matthiaskrgr:iter_nth_zero, r=oli-obk
Use .next() instead of .nth(0) on iterators.
2020-03-07 08:15:24 +01:00
Mazdak Farrokhzad
111724f5e2
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.
2020-03-07 08:15:21 +01:00
Mazdak Farrokhzad
e8bb6c05ab
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.
2020-03-07 08:15:19 +01:00
O01eg
dbd1514353
Add new option to the documentation. 2020-03-07 07:29:23 +03:00
Tim Diekmann
09d3ba13af
Update alloc.rs 2020-03-07 02:45:55 +01:00
Tim Diekmann
545ef9d83a Add Layout::dangling() to return a well-aligned NonNull<u8> 2020-03-07 02:40:54 +01:00
JOE1994
05f6482f43 mir-interpret: add method Memory::read wide_string 2020-03-06 19:14:51 -05:00
Esteban Küber
125159f30a When encountering an Item in a pat context, point at the item def 2020-03-06 15:29:26 -08:00
Ralf Jung
295c2d69bd bug on ty::GeneratorWitness 2020-03-06 22:41:50 +01:00
Ralf Jung
58f8cc2135 rename visit_primitive -> try_visit_primitive, and comments 2020-03-06 22:41:49 +01:00
Ralf Jung
f0586f9aea please tidy 2020-03-06 22:41:49 +01:00
Ralf Jung
4584e75c9b better error messages for invalid boxes (and a few more tests) 2020-03-06 22:41:49 +01:00
Ralf Jung
f481547622 test some more kinds of enums with uninhabited variants 2020-03-06 22:41:49 +01:00
Ralf Jung
4807e939cd test that we validate boxes 2020-03-06 22:41:49 +01:00
Ralf Jung
aa1435b0ae const validation ub tests: use transmute instead of unions 2020-03-06 22:41:49 +01:00
Ralf Jung
d47196b2ec miri value visitor: detect primitives by type, not layout 2020-03-06 22:41:49 +01:00
Ralf Jung
6548be2ba9 'fieldless enums' is not what I meant -- it's empty/uninhabited enums, really 2020-03-06 22:41:49 +01:00
Santiago Pastorino
0ed6e795fb
mir::Local is Copy we can pass it by value in these cases 2020-03-06 18:23:18 -03:00
LeSeulArtichaut
33ebc20513 Turn trailing tokens in assert!() into hard errors 2020-03-06 22:02:20 +01:00
Yuki Okushi
3d67649287
Add a regression test 2020-03-07 04:38:50 +09:00
Yuki Okushi
1631b4de1c
Avoid using unwrap() in suggestions 2020-03-07 04:24:13 +09:00
Matthias Krüger
83980aca20 Don't redundantly repeat field names (clippy::redundant_field_names) 2020-03-06 19:42:18 +01:00
Matthias Krüger
4c2b0f1631 bless tests 2020-03-06 19:37:22 +01:00