Commit Graph

94874 Commits

Author SHA1 Message Date
bors
4edff843dd Auto merge of #61347 - Centril:stabilize-underscore_const_names, r=petrochenkov
Stabilize underscore_const_names in 1.37.0

You are now permitted to write:

```rust
const _: $type_expression = $term_expression;
```

That is, we change the [grammar of items](9d1984d7ae/grammar/item.lyg (L3-L42)), as written in [the *`.lyg`* notation](263bf161da (grammar)), from:

```java
Item = attrs:OuterAttr* vis:Vis? kind:ItemKind;
ItemKind =
  | ...
  | Const:{ "const" name:IDENT ":" ty:Type "=" value:Expr ";" }
  | ...
  ;
```

into:

```java
Item = attrs:OuterAttr* vis:Vis? kind:ItemKind;
ItemKind =
  | ...
  | Const:{ "const" name:IdentOrUnderscore ":" ty:Type "=" value:Expr ";" }
  | ...
  ;

IdentOrUnderscore =
  | Named:IDENT
  | NoName:"_"
  ;
```

r? @petrochenkov
2019-06-16 20:33:55 +00:00
bors
799cf3f603 Auto merge of #61881 - glaubitz:sparc64-ffi-abi, r=petrochenkov
librustc_codegen_llvm: Use repr(transparent) for bitflags over repr(C…

…) (#61306)

In order to make sure that Rust's bitflags types are passed the same way in the Rust ABI as they are in the C ABI, we need to use the attribute repr(transparent) over the repr(C) attribute for the single-field bitflags structs in in order to prevent ABI mismatches. Thanks to Michael Karcher for finding this bug.
2019-06-16 17:48:24 +00:00
bors
e3175c34b4 Auto merge of #61754 - nikomatsakis:trait-caching-perf-3, r=pnkfelix
create a "provisional cache" to restore performance in the case of cycles

Introduce a "provisional cache" that caches the results of auto trait resolutions but keeps them from entering the *main* cache until everything is ready. This turned out a bit more complex than I hoped, but I don't see another short term fix -- happy to take suggestions! In the meantime, it's very clear we need to rework the trait solver. This resolves the extreme performance slowdown experienced in #60846 -- I plan to add a perf.rust-lang.org regression test to track this.

Caveat: I've not run `x.py test` in full yet.

r? @pnkfelix
cc @arielb1

Fixes #60846
2019-06-16 14:58:05 +00:00
bors
37b6a5e5e8 Auto merge of #61739 - chansuke:separate-unit-tests, r=petrochenkov
Separate unit tests

I'm working on #61097.

About half of the modules are done but dozens of modules are still remaining. I will rebase and squash the commits later.
2019-06-16 12:15:01 +00:00
Vadim Petrochenkov
5a9643c95b Fix tidy 2019-06-16 14:17:21 +03:00
chansuke
ce51e653c7 Separate libsyntax_ext module 2019-06-16 14:17:01 +03:00
chansuke
f0c7857704 Separate libfmt_macros module 2019-06-16 14:17:01 +03:00
chansuke
c77d3ae9f2 Separate bootstrap module 2019-06-16 14:17:01 +03:00
chansuke
c2a57c88ea Separate libtest module 2019-06-16 14:17:01 +03:00
chansuke
db55aafd72 Separate libserialize module 2019-06-16 14:17:01 +03:00
chansuke
46e622beb9 Separate librustcdoc module 2019-06-16 14:17:01 +03:00
chansuke
638f63b6e4 Separate librustc module 2019-06-16 14:17:01 +03:00
chansuke
b8bc007729 Separate librustc_metadata module 2019-06-16 14:17:01 +03:00
chansuke
b9266794da Separate librustc_lint module 2019-06-16 14:17:01 +03:00
chansuke
0d77084eff Separate librustc_data_structures module 2019-06-16 14:17:01 +03:00
chansuke
7e35995042 Separate librustc_codegen_ssa module 2019-06-16 14:16:55 +03:00
chansuke
ed54d10de6 Separate libgraphviz module 2019-06-16 13:08:09 +03:00
chansuke
40a0c835b5 Separate libarena::lib module 2019-06-16 13:08:09 +03:00
chansuke
89292beedb Separate liballoc module 2019-06-16 13:08:09 +03:00
bors
68655029d4 Auto merge of #60730 - matthewjasper:optimize-false-edges, r=pnkfelix
Optimize matches

Attempt to fix or improve #60571

This is breaking some diagnostics because the MIR for match arms isn't in source order any more.

cc @centril
2019-06-16 09:30:34 +00:00
bors
374c63e0fc Auto merge of #61886 - Centril:rollup-3p3m2fu, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #61447 (Add some Vec <-> VecDeque documentation)
 - #61704 (Pass LLVM linker flags to librustc_llvm build)
 - #61829 (rustbuild: include llvm-libunwind in dist tarball)
 - #61832 (update miri)
 - #61866 (Remove redundant `clone()`s)
 - #61869 (Cleanup some new active feature gates)

Failed merges:

r? @ghost
2019-06-16 04:46:14 +00:00
Mazdak Farrokhzad
cd9bb48f7f
Rollup merge of #61869 - Centril:cleanup-feature-gates, r=alexreg
Cleanup some new active feature gates

r? @alexreg
2019-06-16 06:05:19 +02:00
Mazdak Farrokhzad
2ba1d94f7a
Rollup merge of #61866 - sinkuu:redundant_clone, r=petrochenkov
Remove redundant `clone()`s
2019-06-16 06:05:18 +02:00
Mazdak Farrokhzad
af56111651
Rollup merge of #61832 - RalfJung:miri, r=oli-obk
update miri

Fixes https://github.com/rust-lang/rust/issues/61830
Fixes https://github.com/rust-lang/rust/issues/61848

r? @oli-obk
2019-06-16 06:05:17 +02:00
Mazdak Farrokhzad
4d528197a0
Rollup merge of #61829 - Keruspe:libunwind-src, r=alexcrichton
rustbuild: include llvm-libunwind in dist tarball

Without this we cannot build with llvm-libunwind enabled from a release tarball.

Could it be backported in a beta rollup somehow so that this gets fixed before 1.36 is released?
2019-06-16 06:05:15 +02:00
Mazdak Farrokhzad
7d99652783
Rollup merge of #61704 - petrhosek:llvm-linker-flags, r=alexcrichton
Pass LLVM linker flags to librustc_llvm build

Some -L and -l flags may be needed even when building librustc_llvm,
for example when using static libc++ on Linux we may need to manually
specify the library search path and -ldl -lpthread as additional link
dependencies. We pass LLVM linker flags from config to librustc_llvm
build to make sure these cases are handled.
2019-06-16 06:05:14 +02:00
Mazdak Farrokhzad
006440a7fe
Rollup merge of #61447 - scottmcm:vec-vecdeque, r=sfackler
Add some Vec <-> VecDeque documentation

These are more than just `.into_iter().collect()`, so talk about some of their nuances.

For VecDeque -> Vec I'm trying to intentionally not write a guarantee for people making their own `Vec`s, since the rules are more complicated than I think we want to commit to forever.

The "Vec -> VecDeque doesn't reallocate" guarantee seems reasonable, though.  (And I'm intentionally ambiguous about when it's O(1) instead of O(n).)
2019-06-16 06:05:12 +02:00
John Paul Adrian Glaubitz
3fa7411050 librustc_codegen_llvm: Use repr(transparent) for bitflags over repr(C) (#61306)
In order to make sure that Rust's bitflags types are passed the same
way in the Rust ABI as they are in the C ABI, we need to use the attribute
repr(transparent) over the repr(C) attribute for the single-field bitflags
structs in in order to prevent ABI mismatches. Thanks to Michael Karcher
for finding this bug.
2019-06-16 02:53:33 +02:00
bors
0dc9e9c10c Auto merge of #61828 - RalfJung:cfg-if, r=alexcrichton
make sure we use cfg-if as a std dependency

xargo currently fails to build libstd because this feature is missing. My guess is that it works in rustc because the feature is enabled elsewhere, but that does not help for a libstd-only build.

Miri is currently in a state where it is shipped but broken, which makes CI fail for projects that are tested in Miri. So this is kind of urgent.

Cc @alexcrichton  https://github.com/rust-lang/rust/pull/61720
2019-06-15 21:15:28 +00:00
bors
bb16e72954 Auto merge of #61868 - Centril:rollup-gglsecp, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #61785 (note some safety concerns of raw-ptr-to-ref casts)
 - #61805 (typeck: Fix ICE for blocks in repeat expr count.)
 - #61813 (Remove some unnecessary symbol interner ops)
 - #61824 (in which we decline to lint single-use lifetimes in `derive`d impls)
 - #61844 (Change `...` to `..=` where applicable)
 - #61854 (Minor cosmetic improvements to accompany PR 61825)

Failed merges:

r? @ghost
2019-06-15 18:24:18 +00:00
Mazdak Farrokhzad
281d787f6b cleanup some new active feature gates. 2019-06-15 19:00:49 +02:00
Mazdak Farrokhzad
ab2d2f90c4
Rollup merge of #61854 - alexreg:fix-type-alias-enum-patterns, r=Centril
Minor cosmetic improvements to accompany PR 61825

r? @Centril
2019-06-15 17:45:07 +02:00
Mazdak Farrokhzad
145abd88ca
Rollup merge of #61844 - AaronKutch:master, r=Centril
Change `...` to `..=` where applicable

This is mainly to fix #61816, but I decided to manually check a few thousand `...` throughout the code base to check for any other cases. I think I found a documentation bug in `src\libsyntax\ast.rs` where both `1..` and `1...` where mentioned. If there is internal support for both `1..` and `1..=` (that can exist before error handling gets to it), then I can add that back.
There were some other cases that look like `// struct Closure<'l0...'li, T0...Tj, CK, CS, U0...Uk> {`, `// <P0 as Trait<P1...Pn>>::Foo: 'a`, and `assert!(min <= max, "discriminant range is {}...{}", min, max);`, but I am not sure if I should change those.
There are a bunch of cases in the `/test/` directory that could be changed, but I presume I should just leave those be.
2019-06-15 17:45:06 +02:00
Mazdak Farrokhzad
eb188f1317
Rollup merge of #61824 - rust-lang:single_derive, r=eddyb
in which we decline to lint single-use lifetimes in `derive`d impls

Resolves #53738.

r? @eddyb
2019-06-15 17:45:04 +02:00
Mazdak Farrokhzad
be09427b11
Rollup merge of #61813 - matthewjasper:remove-unnecessary-symbol-ops, r=petrochenkov
Remove some unnecessary symbol interner ops

* Don't gensym symbols that don't need to worry about colliding with other symbols
* Use symbol constants instead of interning string literals in a few places.
* Don't generate a module in `__register_diagnostic`

r? @petrochenkov
2019-06-15 17:45:02 +02:00
Mazdak Farrokhzad
9e810a2775
Rollup merge of #61805 - davidtwco:ice-const-generic-repeat-expr-count-sequel, r=varkor
typeck: Fix ICE for blocks in repeat expr count.

Fixes #61336 (again). This PR fixes an ICE that occured when a block expression resolving to a const generic was used for the count of an array repeat expression.

r? @varkor
2019-06-15 17:45:01 +02:00
Mazdak Farrokhzad
1b95e029f9
Rollup merge of #61785 - RalfJung:as-ref, r=rkruppe
note some safety concerns of raw-ptr-to-ref casts
2019-06-15 17:44:59 +02:00
bors
9f06855064 Auto merge of #61143 - estebank:issue-61106, r=eddyb
When suggesting borrow, remove useless clones

Fix #61106.
2019-06-15 13:12:13 +00:00
Shotaro Yamada
6a0abd6048 Remove unnecessary .clone() 2019-06-15 20:46:00 +09:00
Shotaro Yamada
165842ba1f Use slice::from_ref instead of cloning 2019-06-15 20:46:00 +09:00
bors
dbebcee8d0 Auto merge of #59752 - Zoxc:dylib-fix, r=alexcrichton
Limit dylib symbols

This makes `windows-gnu` match the behavior of `windows-msvc`. It probably doesn't make sense to export these symbols on other platforms either.
2019-06-15 10:18:09 +00:00
bors
9f8cd9da7b Auto merge of #61825 - Centril:tauv-infer-fix, r=petrochenkov
type_alias_enum_variants: fix #61801; allow a path pattern to infer

Fix #61801.

Given a type-relative path pattern referring to an enum variant through a type alias, allow inferring the generic argument applied in the expectation set by the scrutinee of a `match` expression.

Similar issues may exist for `let` statements but I don't know how to test for that since `PhantomData<T>` is necessary...)

The gist of the problem here was that `resolve_ty_and_res_ufcs` was called twice which is apparently no good... It is possible that this PR is papering over some deeper problem, but that is beyond my knowledge of the compiler.

r? @petrochenkov
cc @eddyb @alexreg
cc https://github.com/rust-lang/rust/pull/61682
cc https://github.com/rust-lang/rust/issues/49683
2019-06-15 03:47:55 +00:00
Alexander Regueiro
926408cdbd Minor cosmetic improvements to accompany PR 61825 2019-06-14 23:44:55 +01:00
Ralf Jung
d54b27d33a update miri 2019-06-14 21:58:33 +02:00
Esteban Küber
34c4117f5f review comment: do not rely on path str to identify std::clone::Clone 2019-06-14 11:44:20 -07:00
Matthew Jasper
5c84cd37cb Use sym constansts for PrimitiveTypeTable keys 2019-06-14 18:54:58 +01:00
Matthew Jasper
4e212c6ddc Avoid some unnecessary symbol interner operations 2019-06-14 18:54:58 +01:00
Esteban Küber
ae8d6a82fe review comments: avoid string modification 2019-06-14 10:45:13 -07:00
Aaron Kutch
363940bbe1 Change ... to ..= where applicable 2019-06-14 12:24:38 -05:00
bors
9606f6fa64 Auto merge of #61817 - eddyb:begone-gcx-attempt-2, r=oli-obk
Unify all uses of 'gcx and 'tcx.

This is made possible by @Zoxc landing #57214 (see https://github.com/rust-lang/rust/pull/57214#issuecomment-465036053 for the decision).

A bit of context for the approach: just like #61722, this is *not* how I originally intended to go about this, but @Zoxc and my own experimentation independently resulted in the same conclusion:
The interim alias `type TyCx<'tcx> = TyCtxt<'tcx, 'tcx>;` attempt required more work (adding `use`s), even only for handling the `TyCtxt<'tcx, 'tcx>` case and not the general `TyCtxt<'gcx, 'tcx>` one.

What this PR is based on is the realization that `'gcx` is a special-enough name that it can be replaced, without caring for context, with `'tcx`, and then repetitions of the name `'tcx` be compacted away.
After that, only a small number of error categories remained, each category easily dealt with with either more mass replacements (e.g. `TyCtxt<'tcx, '_>` -> `TyCtxt<'tcx>`) or by hand.

For the `rustfmt` commit, I used https://github.com/rust-lang/rustfmt/issues/1324#issuecomment-482109952, and manually filtered out some noise, like in #61735 and #61722, and like the latter, there was also a weird bug to work around.
It should be reviewed separately, and dropped if unwanted (in this PR it's pretty significant).

cc @rust-lang/compiler r? @nikomatsakis
2019-06-14 16:20:35 +00:00