Commit Graph

297 Commits

Author SHA1 Message Date
bors
f8caa321c7 Auto merge of #56999 - petrochenkov:macrecov2, r=estebank
AST/HIR: Introduce `ExprKind::Err` for better error recovery in the front-end

This way we can avoid aborting compilation if expansion produces errors and generate `ExprKind::Err`s instead.
2018-12-27 22:27:27 +00:00
scalexm
993d213fda Set a def_id in ParamEnv only with -Z chalk 2018-12-27 19:21:17 +01:00
Vadim Petrochenkov
bc16edeb28 Fix rebase and more CI failures 2018-12-27 15:51:37 +03:00
Vadim Petrochenkov
37af04ff8d Address review comments and CI failures 2018-12-27 15:51:37 +03:00
Vadim Petrochenkov
4ac592516f Get rid of Block::recovered 2018-12-27 15:51:36 +03:00
Vadim Petrochenkov
fff01ccfa8 Do not abort compilation if expansion produces errors
Fix a number of uncovered deficiencies in diagnostics
2018-12-27 15:51:36 +03:00
Esteban Küber
862ebc4c38 Various changes to string format diagnostics
- Point at opening mismatched formatting brace
- Account for differences between raw and regular strings
- Account for differences between the code snippet and `InternedString`
- Add more tests
2018-12-26 14:29:43 -08:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
bors
14b96659e4 Auto merge of #57088 - euclio:non-camel-case-early-lint, r=estebank
make non_camel_case_types an early lint

This allows us to catch these kinds of style violations much earlier, as evidenced by the large number of tests that had to be updated for this change.
2018-12-25 16:12:24 +00:00
bors
27a25df2e2 Auto merge of #56962 - nivkner:fixme_fixup4, r=pnkfelix
address some FIXME whose associated issues were marked as closed

part of #44366
2018-12-25 13:32:31 +00:00
Andy Russell
6474de904c
make non_camel_case_types an early lint 2018-12-24 12:58:52 -05:00
Mazdak Farrokhzad
eb24b33b66
Rollup merge of #56966 - varkor:raw-pointer-deref-parens, r=zackmdavis
Correct strings for raw pointer deref and array access suggestions

Fixes https://github.com/rust-lang/rust/issues/56714.
Fixes https://github.com/rust-lang/rust/issues/56963.

r? @zackmdavis
2018-12-23 23:09:08 +01:00
Mazdak Farrokhzad
4c971620e4
Rollup merge of #56188 - zackmdavis:if_i_may_suggest, r=davidtwco
enum type instead of variant suggestion unification

Fixes #56028.

Weirdly, we were deciding between a help note and a structured suggestion based on whether the import candidate span was a dummy—but we weren't using that span in any case! The dummy-ness of the span (which appears to be a matter of this-crate vs. other-crate definition) isn't the right criterion by which we should decide whether it's germane to mention that "there is an enum variant"; instead, let's use the someness of `def` (which is used as the `has_unexpected_resolution` argument to `error_code`).

Since `import_candidate_to_paths` has no other callers, we are free to stop returning the span and rename the function. By using `span_suggestions_`, we leverage the max-suggestions output limit already built in to the emitter, thus resolving #56028.

In the matter of message wording, "you can" is redundant (and perhaps too informal); prefer the imperative.

In a second commit, we do some unprincipled special-casing to correct and beautify suggestions for `Option` and `Result` (where the existing code was being confused by their being reexported in the prelude).

r? @davidtwco
2018-12-23 23:08:59 +01:00
Niv Kaminer
e32c63eedc bless ui tests in compare mode 2018-12-23 09:23:50 +02:00
Zack M. Davis
64ad3e2c42 adjust enum type instead of variant suggestions for prelude enums
The present author regrets not thinking of a more eloquent way to do
this.
2018-12-22 19:04:29 -08:00
Zack M. Davis
3986c96448 enum type instead of variant suggestion unification
Weirdly, we were deciding between a help note and a structured
suggestion based on whether the import candidate span was a dummy—but
we weren't using that span in any case! The dummy-ness of the span
(which appears to be a matter of this-crate vs. other-crate
definition) isn't the right criterion by which we should decide
whether it's germane to mention that "there is an enum variant";
instead, let's use the someness of `def` (which is used as the
`has_unexpected_resolution` argument to `error_code`).

Since `import_candidate_to_paths` has no other callers, we are free to
stop returning the span and rename the function. By using
`span_suggestions_`, we leverage the max-suggestions output limit
already built in to the emitter, thus resolving #56028.

In the matter of message wording, "you can" is redundant (and perhaps
too informal); prefer the imperative.
2018-12-22 17:40:48 -08:00
kennytm
26842aeac6
Rollup merge of #57039 - davidtwco:migrate-warning-wording, r=pnkfelix
Update migrate warning wording.

This PR modifies the wording of the warning for backwards-incompatible changes in migrate mode. The warning messages are changed to be lowercase and not include line-breaks in order to be consistent with other compiler diagnostics.
2018-12-23 02:12:28 +08:00
kennytm
a92e21c215
Rollup merge of #56909 - dlrobertson:fix_56762, r=estebank
static eval: Do not ICE on layout size overflow

Layout size overflow and typeck eval errors are reported. Trigger a bug
only when the eval error is strictly labeled as TooGeneric.

Fixes: #56762
2018-12-23 02:11:47 +08:00
David Wood
22b2bd8657
Update migrate warning wording.
This commit modifies the wording of the warning for
backwards-incompatible changes in migrate mode. The warning messages are
changed to be lowercase and not include line-breaks in order to be
consistent with other compiler diagnostics.
2018-12-22 14:54:30 +01:00
Niv Kaminer
cf329d5978 FIXME(49821) remove fixme since a tip about let binding is given 2018-12-19 10:51:47 +02:00
varkor
d6969ac2fb Fix string for raw pointer deref suggestion 2018-12-18 23:42:42 +00:00
varkor
c2402dca85 Replace "native pointer" in error message with "raw pointer" 2018-12-18 22:58:49 +00:00
bors
cb84844e83 Auto merge of #56160 - oli-obk:const_fn_let, r=nikomatsakis
Fix various aspects around `let` bindings inside const functions

* forbid `let` bindings in const contexts that use short circuiting operators
* harden analysis code against derefs of mutable references

Initially this PR was about stabilizing `let` bindings, but too many flaws were exposed that need some more testing on nightly
2018-12-18 14:21:07 +00:00
bors
041254b814 Auto merge of #56481 - arielb1:dynamic-order, r=nikomatsakis
add coherence future-compat warnings for marker-only trait objects

The future-compat warnings break code that assumes that `dyn Send + Sync !=
dyn Sync + Send`, and are the first step in making them equal. cc #33140.

Note: this lint should be made to default-warn before we merge. It is deny only for the crater run.

r? @nikomatsakis / @scalexm . cc @Centril & @alexreg.
2018-12-18 06:50:11 +00:00
Dan Robertson
e7e17f9d1b
static eval: Do not ICE on layout size overflow
Layout size overflow and typeck eval errors are reported. Trigger a bug
only when the eval error is strictly labeled as TooGeneric.
2018-12-17 17:45:14 +00:00
Alexander Regueiro
0211856c0e Corrected expected test err messages. 2018-12-15 20:54:05 +00:00
Alexander Regueiro
5656c96c71 Added test for issue #56835. 2018-12-15 19:11:44 +00:00
Alexander Regueiro
3199bef055 Fixed issue #56199. 2018-12-15 19:11:42 +00:00
Ariel Ben-Yehuda
c2ba2a7b65 use tracking issue instead of original issue 2018-12-14 19:14:22 +02:00
Ariel Ben-Yehuda
760639635f add coherence future-compat warnings for marker-only trait objects
The future-compat warnings break code that assumes that `dyn Send + Sync !=
dyn Sync + Send`, and are the first step in making them equal. cc #33140.

It should be possible to revert this commit when we're done with the
warnings.
2018-12-14 19:14:22 +02:00
Esteban Küber
bec5b664fe Deduplicate unsatisfied trait bounds 2018-12-12 15:58:27 -08:00
Alex Crichton
4c21a3bc2a std: Depend directly on crates.io crates
Ever since we added a Cargo-based build system for the compiler the
standard library has always been a little special, it's never been able
to depend on crates.io crates for runtime dependencies. This has been a
result of various limitations, namely that Cargo doesn't understand that
crates from crates.io depend on libcore, so Cargo tries to build crates
before libcore is finished.

I had an idea this afternoon, however, which lifts the strategy
from #52919 to directly depend on crates.io crates from the standard
library. After all is said and done this removes a whopping three
submodules that we need to manage!

The basic idea here is that for any crate `std` depends on it adds an
*optional* dependency on an empty crate on crates.io, in this case named
`rustc-std-workspace-core`. This crate is overridden via `[patch]` in
this repository to point to a local crate we write, and *that* has a
`path` dependency on libcore.

Note that all `no_std` crates also depend on `compiler_builtins`, but if
we're not using submodules we can publish `compiler_builtins` to
crates.io and all crates can depend on it anyway! The basic strategy
then looks like:

* The standard library (or some transitive dep) decides to depend on a
  crate `foo`.
* The standard library adds

  ```toml
  [dependencies]
  foo = { version = "0.1", features = ['rustc-dep-of-std'] }
  ```
* The crate `foo` has an optional dependency on `rustc-std-workspace-core`
* The crate `foo` has an optional dependency on `compiler_builtins`
* The crate `foo` has a feature `rustc-dep-of-std` which activates these
  crates and any other necessary infrastructure in the crate.

A sample commit for `dlmalloc` [turns out to be quite simple][commit].
After that all `no_std` crates should largely build "as is" and still be
publishable on crates.io! Notably they should be able to continue to use
stable Rust if necessary, since the `rename-dependency` feature of Cargo
is soon stabilizing.

As a proof of concept, this commit removes the `dlmalloc`,
`libcompiler_builtins`, and `libc` submodules from this repository. Long
thorns in our side these are now gone for good and we can directly
depend on crates.io! It's hoped that in the long term we can bring in
other crates as necessary, but for now this is largely intended to
simply make it easier to manage these crates and remove submodules.

This should be a transparent non-breaking change for all users, but one
possible stickler is that this almost for sure breaks out-of-tree
`std`-building tools like `xargo` and `cargo-xbuild`. I think it should
be relatively easy to get them working, however, as all that's needed is
an entry in the `[patch]` section used to build the standard library.
Hopefully we can work with these tools to solve this problem!

[commit]: 28ee12db81
2018-12-11 21:08:22 -08:00
Alexander Regueiro
4d95f5b46d Fixed test stderr files. 2018-12-07 23:53:34 +00:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
Vadim Petrochenkov
8ab115c21d Unsupport #[derive(Trait)] sugar for #[derive_Trait] legacy plugin attributes 2018-12-07 03:30:01 +03:00
Oliver Scherer
61efc3b71b Update tests 2018-12-04 10:06:05 +01:00
kennytm
bf96a7bbed
Rollup merge of #56366 - alexreg:stabilise-self_in_typedefs, r=Centril
Stabilize self_in_typedefs feature

[**Tracking Issue**](https://github.com/rust-lang/rust/issues/49303)

r? @centril
2018-12-03 18:07:07 +08:00
bors
b817d0b651 Auto merge of #56110 - varkor:inhabitedness-union-enum, r=cramertj
Consider references and unions potentially inhabited during privacy-respecting inhabitedness checks

It isn't settled exactly how references to uninhabited types and unions of uninhabited types should act, but we should be more conservative here, as it's likely it will be permitted to soundly have values of such types.

This will also be more important in light of the changes at https://github.com/rust-lang/rust/pull/54125.

cc @RalfJung
2018-12-02 22:22:12 +00:00
Alexander Regueiro
d609fdf775 Updated ui tests. 2018-11-30 22:12:39 +00:00
Alexander Regueiro
d49a8d558f Removed feature gate. 2018-11-30 15:42:43 +00:00
Oliver Scherer
42e5317f1d Add trailing newline 2018-11-30 09:44:16 +01:00
Oliver Scherer
172b428881 Re-add accidentally deleted test 2018-11-30 09:44:16 +01:00
Oliver Scherer
8937faa837 Reenable const_let feature gate 2018-11-30 09:44:15 +01:00
Oliver Scherer
d62bcad38d Allow let bindings everywhere 2018-11-30 09:44:06 +01:00
Oliver Scherer
52b67b1766 Remove a bunch of now-unnecessary const_let feature gates 2018-11-30 09:43:41 +01:00
Oliver Scherer
dba5ba02f7 Update a test's diagnostics 2018-11-30 09:43:41 +01:00
Alexander Regueiro
5f19cdc4f8 Changed test for issue 56202 to compile-pass. 2018-11-30 03:12:10 +00:00
Esteban Küber
c144dc07e3 Fix ICE with feature self_struct_ctor 2018-11-30 03:12:10 +00:00
varkor
46ef9f820c Fix broken tests 2018-11-29 20:58:38 +00:00
Guillaume Gomez
3b64f86beb
Rollup merge of #56330 - estebank:cleanup-span, r=zackmdavis
Clean up span in non-trailing `..` suggestion
2018-11-29 13:10:54 +01:00