Commit Graph

105329 Commits

Author SHA1 Message Date
Santiago Pastorino
a59abfa450 Revert const_eval call to use const_eval_raw to avoid const validation cycles 2020-01-10 09:07:53 +01:00
Jethro Beekman
afced94155 Allow specifying LLVM args in target specifications 2020-01-10 08:12:55 +01:00
Mazdak Farrokhzad
8bd3d240e3 nix syntax::errors & prefer rustc_errors over errors 2020-01-10 07:41:30 +01:00
Mazdak Farrokhzad
d5598aa7a0 Introduce #![feature(half_open_range_patterns)].
This feature adds `X..`, `..X`, and `..=X` patterns.
2020-01-10 07:29:04 +01:00
Esteban Küber
fcd850fc5d Do not ICE on unicode next point
Use `shrink_to_hi` instead of `next_point`
Fix #68000.
2020-01-09 22:10:18 -08:00
bors
2d8d559bbe Auto merge of #68078 - Centril:rollup-qvq052k, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #66463 (Point at opaque and closure type definitions in type errors)
 - #67501 (Reduce special treatment for zsts)
 - #67820 (Parse the syntax described in RFC 2632)
 - #67922 (rustc_ast_lowering: misc cleanup & rustc dep reductions)
 - #68071 (Extend support of `_` in type parameters)
 - #68073 (expect `fn` after `const unsafe` / `const extern`)

Failed merges:

r? @ghost
2020-01-10 02:09:41 +00:00
Mazdak Farrokhzad
6f3f1c537b
Rollup merge of #68073 - Centril:fix-68062, r=estebank
expect `fn` after `const unsafe` / `const extern`

Fixes #68062

r? @estebank @petrochenkov
cc @Aaron1011
2020-01-10 02:47:36 +01:00
Mazdak Farrokhzad
2307f0c4ea
Rollup merge of #68071 - estebank:ice-67995, r=Centril
Extend support of `_` in type parameters

 - Account for `impl Trait<_>`.
 - Provide a reasonable `Span` for empty `Generics` in `impl`s.
 - Account for `fn foo<_>(_: _) {}` to suggest `fn foo<T>(_: T) {}`.
 - Fix #67995. Follow up to #67597.
2020-01-10 02:47:34 +01:00
Mazdak Farrokhzad
3bfa28c3a8
Rollup merge of #67922 - Centril:lowering-cleanup, r=petrochenkov
rustc_ast_lowering: misc cleanup & rustc dep reductions

- The first two commits do some code simplification.
- The next three do some file splitting (getting `lib.rs` below the 3kloc tidy lint).
- The remaining commits reduce the number of `rustc::` imports. This works towards making lowering independent of the `rustc` crate.

r? @oli-obk cc @Zoxc
2020-01-10 02:47:33 +01:00
Mazdak Farrokhzad
f3963873aa
Rollup merge of #67820 - ecstatic-morse:const-trait, r=oli-obk
Parse the syntax described in RFC 2632

This adds support for both `impl const Trait for Ty` and `?const Trait` bound syntax from rust-lang/rfcs#2632 to the parser. For now, both modifiers end up in a newly-added `constness` field on `ast::TraitRef`, although this may change once the implementation is fleshed out.

I was planning on using `delay_span_bug` when this syntax is encountered during lowering, but I can't write `should-ice` UI tests. I emit a normal error instead, which causes duplicates when the feature gate is not enabled (see the `.stderr` files for the feature gate tests). Not sure what the desired approach is; Maybe just do nothing when the syntax is encountered with the feature gate is enabled?

@oli-obk I went with `const_trait_impl` and `const_trait_bound_opt_out` for the names of these features. Are these to your liking?

cc #67792 #67794

r? @Centril
2020-01-10 02:47:32 +01:00
Mazdak Farrokhzad
e180d36d49
Rollup merge of #67501 - oli-obk:test-slice-patterns, r=RalfJung
Reduce special treatment for zsts

addresses https://github.com/rust-lang/rust/pull/67467#discussion_r360650846

cc @RalfJung
2020-01-10 02:47:30 +01:00
Mazdak Farrokhzad
aabb03763d
Rollup merge of #66463 - estebank:point-at-closure-and-opaque-types, r=Centril
Point at opaque and closure type definitions in type errors

Fixes #57266, fixes #67117.
2020-01-10 02:47:29 +01:00
Dylan MacKenzie
fd1c00348b Add test for ?const in nested impl/dyn trait 2020-01-09 16:47:05 -08:00
Dylan MacKenzie
14730ed445 Make bound_context more like neighboring functions 2020-01-09 16:47:05 -08:00
Dylan MacKenzie
9950a1f3bd Add test for ?const and ? on the same bound 2020-01-09 16:47:05 -08:00
Dylan MacKenzie
b6b11f0f28 Call all visit methods on trait definitions 2020-01-09 16:47:05 -08:00
Dylan MacKenzie
343e1570a9 Add tests for RFC 2632 2020-01-09 16:47:05 -08:00
Dylan MacKenzie
d843e002bb Check for ?const in invalid contexts during AST validation 2020-01-09 16:47:05 -08:00
Dylan MacKenzie
31edbe9aca Reject const in inherent impls 2020-01-09 16:47:05 -08:00
Dylan MacKenzie
b390fc4cf1 Error when new syntax is lowered
This means the new syntax will always fail to compile, even when the
feature gate is enabled. These checks will be removed in a later PR
once the implementation is done.
2020-01-09 16:46:15 -08:00
Dylan MacKenzie
0cf52a7dd8 Parse ?const Trait bound syntax
The grammar also handles `?const ?Trait` even though this is
semantically redundant.
2020-01-09 16:46:15 -08:00
Dylan MacKenzie
1c3fe9de4e Parse impl const Trait for Ty syntax 2020-01-09 16:46:14 -08:00
Dylan MacKenzie
fd4a6a1213 Add a constness field to ast::TraitRef
This is used for both the `?const` syntax in bounds as well as the `impl
const Trait` syntax. I also considered handling these separately by
adding a variant of `TraitBoundModifier` and a field to
`ItemKind::Impl`, but this approach was less intrusive.
2020-01-09 16:46:14 -08:00
Dylan MacKenzie
6fc4158504 Add const_trait_bound_opt_out feature gate 2020-01-09 16:46:14 -08:00
Dylan MacKenzie
63e2e44eb9 Add const_trait_impl feature gate 2020-01-09 16:46:14 -08:00
Oliver Middleton
870ca31408 rustbuild: Cleanup book generation
The Cargo book can be generated the same way as the other books.
2020-01-09 23:57:01 +00:00
Esteban Küber
6e04cf062f review comments: more tests 2020-01-09 15:43:20 -08:00
Yuki Okushi
663f8b5cfd Update Clippy 2020-01-10 08:12:45 +09:00
Matthew Healy
1c9f999157 Add llvm-skip-rebuild to opts 2020-01-09 23:26:49 +01:00
Esteban Küber
c751961d29 Extend support of _ in type parameters
- Account for `impl Trait<_>`.
 - Provide a reasonable `Span` for empty `Generics` in `impl`s.
 - Account for `fn foo<_>(_: _) {}` to suggest `fn foo<T>(_: T) {}`.
 - Fix #67995.
2020-01-09 14:20:53 -08:00
John Kåre Alsaker
5918c18785 Tweak timers 2020-01-09 23:19:20 +01:00
Mazdak Farrokhzad
915db7ae64 expect fn after const unsafe / const extern 2020-01-09 23:02:34 +01:00
Yuki Okushi
54f860158b Fix ICE #68058 2020-01-10 06:52:22 +09:00
John Kåre Alsaker
b650e91cf4 Label unmarked time 2020-01-09 22:38:40 +01:00
John Kåre Alsaker
69bacd002b Precompile CGUs while the main thread has the implicit job server token 2020-01-09 22:37:05 +01:00
John Kåre Alsaker
f45758cddc Compile some CGUs in parallel at the start of codegen 2020-01-09 22:36:15 +01:00
Guillaume Gomez
f79ba857dd clean up E0185 explanation 2020-01-09 22:25:58 +01:00
bors
72b2bd55ed Auto merge of #68067 - JohnTitor:rollup-vsj5won, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #66254 (Make Layout::new const)
 - #67122 (Do not deduplicate diagnostics in UI tests)
 - #67358 (Add HashSet::get_or_insert_owned)
 - #67725 (Simplify into_key_slice_mut)
 - #67935 (Relax the Sized bounds on Pin::map_unchecked(_mut))
 - #67967 (Delay bug to prevent ICE in MIR borrowck)
 - #67975 (Export public scalar statics in wasm)
 - #68006 (Recognise riscv64 in compiletest)
 - #68040 (Cleanup)
 - #68054 (doc: add Null-unchecked version section to mut pointer as_mut method)

Failed merges:

 - #67258 (Introduce `X..`, `..X`, and `..=X` range patterns)

r? @ghost
2020-01-09 19:21:58 +00:00
Yuki Okushi
9e83df0f69
Rollup merge of #68054 - tspiteri:null-unchecked-as_mut, r=cramertj
doc: add Null-unchecked version section to mut pointer as_mut method

The [`as_ref`](https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref-1) method already has a *Null-unchecked version* section, its example is a modification of the example in the main `as_ref` section. Similarly the example in this PR is a modification of the example in main [`as_mut`](https://doc.rust-lang.org/std/primitive.pointer.html#method.as_mut) section.

Fixes #68032.
2020-01-10 04:18:43 +09:00
Yuki Okushi
a366aa6249
Rollup merge of #68040 - sinkuu:unused, r=petrochenkov
Cleanup
2020-01-10 04:18:42 +09:00
Yuki Okushi
2bade5dd7d
Rollup merge of #68006 - infinity0:master, r=nikomatsakis
Recognise riscv64 in compiletest

Otherwise tests can't run, fails with "Cannot determine Architecture from triple"
2020-01-10 04:18:40 +09:00
Yuki Okushi
8de73bc10c
Rollup merge of #67975 - EmbarkStudios:export-statics-wasm, r=alexcrichton
Export public scalar statics in wasm

Fixes #67453

I am not sure which export level statics should get when exporting them in wasm. This small change fixes the issue that I had, but this might not be the correct way to implement this.
2020-01-10 04:18:39 +09:00
Yuki Okushi
08c5999dc4
Rollup merge of #67967 - JohnTitor:fix-ice-0107, r=matthewjasper
Delay bug to prevent ICE in MIR borrowck

Fixes #67947

r? @matthewjasper
2020-01-10 04:18:37 +09:00
Yuki Okushi
ee90f09ea0
Rollup merge of #67935 - Thomasdezeeuw:issue_67669, r=withoutboats
Relax the Sized bounds on Pin::map_unchecked(_mut)

Fixes #67669.
2020-01-10 04:18:36 +09:00
Yuki Okushi
78db333f9d
Rollup merge of #67725 - ssomers:into_key_slice_mut, r=RalfJung
Simplify into_key_slice_mut

Remove a rare and tiny but superfluous run-time check from into_key_slice_mut.

In #67459, I wrote that "`get_mut` [...] does visit `into_key_slice_mut`" and that was wrong. No function that operates on a map that (still) has a shared root ever dives into `into_key_slice_mut`.  So it's more clear to remove the (previously existing, and always incomplete) code it has for dealing with shared roots, as well as a petty performance improvement for those using exotically aligned key types.

~~Also, some testing of the `range` function initially added to #67686 but hardly related.~~

r? @RalfJung
2020-01-10 04:18:34 +09:00
Yuki Okushi
02ef0dcf69
Rollup merge of #67358 - cuviper:get_or_insert_owned, r=LukasKalbertodt
Add HashSet::get_or_insert_owned

This is an extension for tracking issue #60896. The more-general `get_or_insert_with` has potential for misuse, so we might remove it, but I think `get_or_insert_owned` covers most use cases.
2020-01-10 04:18:32 +09:00
Yuki Okushi
68ae55bfac
Rollup merge of #67122 - petrochenkov:nodedup, r=estebank
Do not deduplicate diagnostics in UI tests

Error reporting infrastructure deduplicates identical diagnostics with identical spans.

While it's preferable to do this in "release"/"user-facing" mode, it sometimes brings [confusion](https://github.com/rust-lang/rust/pull/50682#issuecomment-390949878) and hides details that may be important during development.

Do we run some passes multiple times when we could do it once?
How many times we run them exactly? Can this number be large? Can the multiplied error construction be expensive? Can speculative checks be made cheaper if they don't report errors?

*Relying* on this mechanism to deduplicate some specific error never looks like a proper solution to me personally.

In this PR I attempt to disable this deduplication by applying `-Z deduplicate-diagnostics=no` to UI tests.
2020-01-10 04:18:30 +09:00
Yuki Okushi
92bd267ba8
Rollup merge of #66254 - CAD97:patch-1, r=KodrAus
Make Layout::new const

This seems like a reasonable change to make. If we don't provide `Layout:🆕:<T>` as `const`, then users can just instead do the more error prone `Layout::from_size_align_unchecked(mem::size_of::<T>(), mem::align_of::<T>())` for the same effect and an extra `unsafe { }` incantation.
2020-01-10 04:18:29 +09:00
Vadim Petrochenkov
b82cd9f639 Address review comments + Update NLL tests 2020-01-09 21:49:32 +03:00
CAD97
d860def8e2 Mark Layout::new as const stable 2020-01-09 13:41:43 -05:00