Commit Graph

102669 Commits

Author SHA1 Message Date
Dylan MacKenzie
25122d09eb Const-check the discriminant of a SwitchInt 2019-11-21 16:55:13 -08:00
Dylan MacKenzie
5c377f37e4 Reorganize, bless and add tests for const control flow
This creates a new test directory, `ui/consts/control-flow` to hold
tests related to control flow in a const context. It also blesses all
existing tests with the new error messages, and adds new tests for the
`const_if_match` feature.
2019-11-21 16:55:13 -08:00
Dylan MacKenzie
26d93f35f6 Add entry for const_if_match in unstable book 2019-11-21 15:23:51 -08:00
Dylan MacKenzie
ccb6e9884e Suggest const_if_match on nightly 2019-11-21 14:20:00 -08:00
Dylan MacKenzie
f4b9dc7d59 Make name work for MatchSource 2019-11-21 14:20:00 -08:00
Dylan MacKenzie
929ff68376 Hold a TyCtxt in the HIR const-checker 2019-11-21 14:20:00 -08:00
Dylan MacKenzie
a98d20a260 Allow Downcast projections if const_if_match enabled
These are generated when matching on enum variants to extract the value
within. We should have no problem evaluating these, but care should be
taken that we aren't accidentally allowing some other operation.
2019-11-21 14:20:00 -08:00
Dylan MacKenzie
e969fb2176 Don't transform short-circuiting logic if const_if_match enabled 2019-11-21 14:20:00 -08:00
Dylan MacKenzie
365d123689 Add feature gate for const if and match 2019-11-21 14:19:59 -08:00
Dylan MacKenzie
c537f22900 Give name to full regex capture 2019-11-21 14:13:42 -08:00
Dylan MacKenzie
ae2293837e Change some tests to use the shorter comment style 2019-11-21 14:09:18 -08:00
Dylan MacKenzie
701f6e51b2 Fix broken incremental test
This test does not actually emit any warnings, since
`#![allow(warnings)]` was specified. `compiletest` was erroneously
ignoring `//~` tests and looking only for `//[X]~` ones. As a result of
the changes in the previous commit, we now look for `//~` comments in
incremental tests and expect them to appear in *all* revisions.
2019-11-21 14:08:33 -08:00
Dylan MacKenzie
54d51bc483 Allow multiple cfgs per comment in "revisions:" tests
The `//[X]~` syntax filters errors for tests that are run across
multiple cfgs with  `// revisions:`. This commit extends that syntax to
accept `//[X,Y]~`, which will match multiple cfgs to the same error
annotation. This is functionally the same as writing two comments,
`//[X]~` and `//[Y]~`, but can fit on a single line.
2019-11-21 14:08:33 -08:00
bors
53712f8637 Auto merge of #66389 - estebank:type-err-labels, r=petrochenkov
Specific labels when referring to "expected" and "found" types
2019-11-21 17:53:19 +00:00
bors
35ef33a89d Auto merge of #66607 - Centril:rollup-yb7cl73, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #65355 (Stabilize `!` in Rust 1.41.0)
 - #65730 (Suggest to add lifetime constraint at explicit ouput of functions)
 - #66468 (Cleanup Miri SIMD intrinsics)
 - #66515 (Reduce size of `hir::Expr` by boxing more of `hir::InlineAsm`)
 - #66602 (Revert "Update Source Code Pro and include italics")

Failed merges:

r? @ghost
2019-11-21 14:30:02 +00:00
Mazdak Farrokhzad
5ab2bccbcd
Rollup merge of #66602 - GuillaumeGomez:revert-font, r=GuillaumeGomez
Revert "Update Source Code Pro and include italics"

This reverts commit ea9519bf16.
2019-11-21 15:29:08 +01:00
Mazdak Farrokhzad
d7bb37d663
Rollup merge of #66515 - Centril:cheaper-inline-asm, r=oli-obk
Reduce size of `hir::Expr` by boxing more of `hir::InlineAsm`

r? @oli-obk
2019-11-21 15:29:07 +01:00
Mazdak Farrokhzad
02b38ac0ff
Rollup merge of #66468 - RalfJung:simd-cleanup, r=oli-obk
Cleanup Miri SIMD intrinsics

r? @oli-obk @eddyb Cc @gnzlbg
2019-11-21 15:29:05 +01:00
Mazdak Farrokhzad
e4a634189e
Rollup merge of #65730 - csmoe:return-lifetime, r=nikomatsakis
Suggest to add lifetime constraint at explicit ouput of functions

Closes #62097
2019-11-21 15:29:02 +01:00
Mazdak Farrokhzad
0828d5327b
Rollup merge of #65355 - Centril:almost-is-never-enough, r=oli-obk
Stabilize `!` in Rust 1.41.0

This PR stabilizes the `never_type` (written `!`). The type represents computations that we know diverge in the type system and therefore has no values / inhabitants / elements / members.

The current nightly version is 1.40.0 which will become stable on 2019-12-19.

Tracking issue: https://github.com/rust-lang/rust/issues/35121.
Closes https://github.com/rust-lang/rust/issues/57012.
Closes https://github.com/rust-lang/rust/issues/58184.
Original stabilization report: https://github.com/rust-lang/rust/issues/57012#issuecomment-452398538

Additional notes:

- In #62661 we reserved `impl<T> From<!> for T` so this concern should be resolved.
- The type inference fallback change is moved to `#![feature(never_type_fallback)]` (https://github.com/rust-lang/rust/issues/65992).
- You can find all of the tests referencing `never_type` in this PR which also reorganizes these tests whereas they were more scattered before.

r? @nikomatsakis
2019-11-21 15:29:00 +01:00
Mazdak Farrokhzad
238d03b3a3 never_type: test interaction with auto traits 2019-11-21 15:09:18 +01:00
Mazdak Farrokhzad
089229a193 Redefine core::convert::Infallible as !. 2019-11-21 14:55:33 +01:00
Mazdak Farrokhzad
6eb0627b49 Gate fallback via #![feature(never_type_fallback)]. 2019-11-21 14:55:33 +01:00
Mazdak Farrokhzad
8f6197f39f Remove #![feature(never_type)] from tests.
Also remove `never_type` the feature-gate test.
2019-11-21 14:55:32 +01:00
Mazdak Farrokhzad
15c30ddd69 Stabilize the never_type, written !. 2019-11-21 14:55:32 +01:00
Guillaume Gomez
d0b67ddc0f Revert "Update Source Code Pro and include italics"
This reverts commit ea9519bf16.
2019-11-21 11:18:23 +01:00
Mazdak Farrokhzad
44cebe5970 reduce size of hir::ExprKind 2019-11-21 01:23:29 +01:00
bors
f1b882b558 Auto merge of #66578 - Centril:rollup-pgz1v7t, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #66060 (Making ICEs and test them in incremental)
 - #66298 (rustdoc: fixes #64305: disable search field instead of hidding it)
 - #66457 (Just derive Hashstable in librustc)
 - #66496 (rustc_metadata: Privatize more things)
 - #66514 (Fix selected crate search filter)
 - #66535 (Avoid ICE when `break`ing to an unreachable label)
 - #66573 (Ignore run-make reproducible-build-2 on Mac)

Failed merges:

r? @ghost
2019-11-20 19:15:41 +00:00
Mazdak Farrokhzad
8754409159
Rollup merge of #66573 - pnkfelix:issue-66568-ignore-reproducible-build-2-on-macos, r=alexcrichton
Ignore run-make reproducible-build-2 on Mac

Ignore run-make reproducible-build-2 on Mac (we already ignore it on Windows).

Until we can dedicate resources to fixing this properly, I think we are best off just ignoring this test on platforms/contexts where it does not matter as much.

cc #66568
2019-11-20 18:32:13 +01:00
Mazdak Farrokhzad
52ed2c6dea
Rollup merge of #66535 - estebank:issue-62480, r=matthewjasper
Avoid ICE when `break`ing to an unreachable label

Fix #62480.
2019-11-20 18:32:12 +01:00
Mazdak Farrokhzad
4bd9168d7f
Rollup merge of #66514 - GuillaumeGomez:fix-search-filter-save, r=kinnison
Fix selected crate search filter

Fixes #62929.

r? @kinnison
2019-11-20 18:32:10 +01:00
Mazdak Farrokhzad
5a84f9b86e
Rollup merge of #66496 - petrochenkov:metapriv2, r=eddyb
rustc_metadata: Privatize more things

Continuation of https://github.com/rust-lang/rust/pull/66056.

The most notable change here is that `CrateMetadata` is moved from `cstore.rs` to `decoder.rs`.
Most of uses of `CrateMetadata` fields are in the decoder and uses of `root: CrateRoot` and other fields are so intertwined with each other that it would be hard to move a part of them into `cstore.rs` to privatize `CrateMetadata` fields, so we are going the other way round.

`cstore.rs` can probably be dismantled now, but I'll leave this to some other day.
Similarly, remaining `CrateMetadata` fields can be privatized by introducing some getter/setter methods, but not today.

r? @eddyb
2019-11-20 18:32:09 +01:00
Mazdak Farrokhzad
647eda17e8
Rollup merge of #66457 - cjgillot:just_hashstable, r=Zoxc
Just derive Hashstable in librustc

Split out of #66279

r? @Zoxc
2019-11-20 18:32:07 +01:00
Mazdak Farrokhzad
00cbc75c74
Rollup merge of #66298 - Ppjet6:disable-search-field, r=GuillaumeGomez
rustdoc: fixes #64305: disable search field instead of hidding it

The result seems to be ok but I wasn't entirely sure how to get there. I tried to stay generic a bit but maybe it's not required at all.

@GuillaumeGomez

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-11-20 18:32:06 +01:00
Mazdak Farrokhzad
e32397a754
Rollup merge of #66060 - traxys:test_65401, r=michaelwoerister
Making ICEs and test them in incremental

This adds:
 - A way to make the compiler ICE
 - A way to check for ICE in `cfail` tests with `should-ice`
 - A regression test for issue #65401

I am not sure the attribute added `should-ice` is the best for this job
2019-11-20 18:32:04 +01:00
bors
b9cf541789 Auto merge of #66571 - Centril:rollup-41tn2fw, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #65665 (Update Source Code Pro and include italics)
 - #66478 (rustc_plugin: Remove the compatibility shim)
 - #66497 (Fix #53820)
 - #66526 (Add more context to `async fn` trait error)
 - #66532 (Generate DWARF address ranges for faster lookups)
 - #66546 (Remove duplicate function)
 - #66548 ([RISCV] Disable Atomics on all Non-A RISC-V targets)
 - #66553 (remove HermitCore leftovers from sys/unix)

Failed merges:

r? @ghost
2019-11-20 14:04:12 +00:00
Felix S. Klock II
6ab28b50da Ignore run-make reproducible-build-2 on Mac (we already ignore it on Windows).
Until we can dedicate resources to fixing this properly, I think we are
best off just ignoring this test on platforms/contexts where it does not
matter as much.
2019-11-20 14:07:01 +01:00
Mazdak Farrokhzad
ebd0ef9a39
Rollup merge of #66553 - hermitcore:hermit, r=rkruppe
remove HermitCore leftovers from sys/unix

HermitCore support is already moved to the directory "sys/hermit". => remove leftovers
2019-11-20 12:58:37 +01:00
Mazdak Farrokhzad
fff8ae1aa8
Rollup merge of #66548 - lenary:riscv/disable-atomics-non-a, r=alexcrichton
[RISCV] Disable Atomics on all Non-A RISC-V targets

In a `TargetOptions` configuration, `max_atomic_width: None` causes `max_atomic_width()` to return `Some(target_pointer_width)`. So, contrary to assumptions, `max_atomic_width: None` means you do have atomic support!

RISC-V's rv32i and rv32imc do not have architectural support for atomic memory accesses of any size, because they do not include the `A` architecture extension. This means the values in the target definition should be `Some(0)`.

This bug has been observed via a build failure with oreboot/oreboot#191, where LLVM was still generating libcalls for atomic operations. According to rust-lang/compiler-builtins, "Rust only exposes atomic types on platforms that support them, and therefore does not need to fall back to software implementations." - so this PR tries to bring rustc inline with this decision.

This commit also removes the outdated bug link, which references a now irrelevant GCC bug.

I will likely also have to revisit the `min_atomic_width` of all the RISC-V targets so they are correct and match what the hardware is capable of (which is more restricted than one might imagine).

r? @alexcrichton
2019-11-20 12:58:35 +01:00
Mazdak Farrokhzad
4997604503
Rollup merge of #66546 - aradzie:remove_duplicate_function, r=Dylan-DPC
Remove duplicate function

Function `source_name` declared in file

[src/librustc_driver/lib.rs](https://github.com/rust-lang/rust/blob/master/src/librustc_driver/lib.rs#L87)

is a duplicate of the function by the same name declared in file

[src/librustc/session/config.rs](https://github.com/rust-lang/rust/blob/master/src/librustc/session/config.rs#L511)
2019-11-20 12:58:33 +01:00
Mazdak Farrokhzad
1346557ba1
Rollup merge of #66532 - cuviper:dwarf-aranges, r=michaelwoerister
Generate DWARF address ranges for faster lookups

This adds a new option `-Zgenerate-arange-section`, enabled by default,
corresponding to LLVM's `-generate-arange-section`. This creates a
`.debug_aranges` section with DWARF address ranges, which some tools
depend on to optimize address lookups (elfutils [22288], [25173]).

This only has effect when debuginfo is enabled, and the additional data
is small compared to the other debug sections. For example, libstd.so
with full debuginfo is about 11MB, with just 61kB in aranges.

[22288]: https://sourceware.org/bugzilla/show_bug.cgi?id=22288
[25173]: https://sourceware.org/bugzilla/show_bug.cgi?id=25173

Closes #45246.
r? @michaelwoerister
2019-11-20 12:58:32 +01:00
Mazdak Farrokhzad
0a0d07a1fc
Rollup merge of #66526 - estebank:async-fn-trait-information, r=Centril
Add more context to `async fn` trait error

Follow up to #65937. Fix #65899.
2019-11-20 12:58:30 +01:00
Mazdak Farrokhzad
2d6e3764b4
Rollup merge of #66497 - Nadrieril:fix-53820, r=varkor
Fix #53820

This fixes ICE #53820 by being more clever when matching large arrays with slice patterns.
In particular, it avoids treating large arrays like large tuples, and instead reuses the `VarLenSlice` constructor behaviour to only consider as little values as needed.
As a side-effect, such matches also get improved diagnostics, by reporting `[true, ..]` missing instead of `[true, _, _, _, _, _, _, _]`.
2019-11-20 12:58:29 +01:00
Mazdak Farrokhzad
3ef2384e50
Rollup merge of #66478 - petrochenkov:rmplugin, r=davidtwco
rustc_plugin: Remove the compatibility shim

The compatibility crate was introduced in https://github.com/rust-lang/rust/pull/62727 to migrate Cargo and some other tools, but now it's no longer necessary.
2019-11-20 12:58:27 +01:00
Mazdak Farrokhzad
423137b779
Rollup merge of #65665 - tspiteri:italic-and-update-SourceCodePro, r=GuillaumeGomez
Update Source Code Pro and include italics

Fixes #65502.

A few notes:
  * As stated in #65502, this does increase the download size.
  * Since this PR changes the font set, I think docs.rs would have to be updated if this PR is merged.
  * The fonts have a double extension (.ttf.woff); this is to keep the names consistent with the upstream font release which does that to distinguish these from the .otf.woff files ([Source Code Pro otf renders poorly on older Windows system apps](https://github.com/adobe-fonts/source-code-pro/issues/25#issuecomment-9019600)).
2019-11-20 12:58:26 +01:00
Guillaume Gomez
572133845a Change background-color of search input if disabled 2019-11-20 12:57:47 +01:00
bors
ea540b0892 Auto merge of #66392 - estebank:trait-alias-ice, r=eddyb
Do not ICE on trait aliases with missing obligations

Fix #65673.
2019-11-20 10:51:26 +00:00
Maxime “pep” Buquet
5cbd406a14 rustdoc: fixes #64305: disable search field instead of hidding it
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-11-20 11:32:58 +01:00
bors
f50d6ea348 Auto merge of #66104 - yodaldevoid:generic-arg-disambiguation, r=petrochenkov
Generic arg disambiguation

Using the tactic suggested by @petrochenkov in https://github.com/rust-lang/rust/issues/60804#issuecomment-516769465 and on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/generic.20argument.20disambiguation), this change checks type arguments to see if they are really incorrectly-parsed const arguments.

it should be noted that `segments.len() == 1 && segments[0].arg.is_none()` was reduced to `segments.len() == 1` as suggested by @petrochenkov in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/generic.20argument.20disambiguation/near/177848002). This change allowed a few more existing tests to have their braces removed.

There are a couple of "problems" with these changes that I should note. First, there was a regression in the error messages found in "src/test/ui/privacy-ns1.rs" and "src/test/ui/privacy-ns1.rs". Second, some braces were unable to be removed from "src/test/ui/const-generics/fn-const-param-infer.rs". Those on line 24 caused the statement to stop equating when removed, and those on line 20 cause a statement that should not equate to produce no error when removed.

I have not looked further into any of these issues yet, though I would be willing to look into them before landing this. I simply wanted to get some other eyes on this before going further.

Fixes #60804

cc @varkor @jplatte
2019-11-20 03:07:39 +00:00
Camille GILLOT
579625b9e7 Revert expansion of impl HashStable for Frame. 2019-11-19 20:48:11 +01:00