Commit Graph

1066 Commits

Author SHA1 Message Date
Ben Boeckel
126bf3b1dd typo: fix typo in E0392
See #64931.
2019-10-03 09:22:29 -04:00
Niko Matsakis
4396a1ccd4 add regression test for #60218 2019-10-03 05:59:18 -04:00
Mazdak Farrokhzad
17b1fd1a8f
Rollup merge of #64931 - estebank:missing-param-ref, r=matthewjasper,Centril
Reword E0392 slightly

Make it clearer that a type or lifetime argument not being used can be
fixed by referencing it in a struct's fields, not just using `PhathomData`.

CC #53589.
2019-10-03 04:08:12 +02:00
Esteban Küber
a180294f8b review comment 2019-10-02 14:34:29 -07:00
Esteban Küber
e8796cada9 Do not ICE when dereferencing non-Copy raw pointer 2019-10-02 11:23:24 -07:00
Mazdak Farrokhzad
10b0fe9c5c
Rollup merge of #64973 - ecstatic-morse:fix-debuginfo-test, r=alexcrichton
Fix typo while setting `compile-flags` in test

This test is meant to check for an ICE when generating debug info, but didn't actually pass `-g` due to the typo.

I also removed the `FIXME`, since this needs to actually be built (not just checked) to trigger the ICE.
2019-10-02 18:24:39 +02:00
Tyler Mandry
c11cb25262
Rollup merge of #64649 - estebank:returnator, r=varkor
Avoid ICE on return outside of fn with literal array

Do not ICE when encountering `enum E { A = return [0][0] }`.

Fix #64638.
2019-10-01 23:06:09 -07:00
Dylan MacKenzie
cf984d22d6 This needs to be build-pass since it involves debuginfo 2019-10-01 15:10:29 -07:00
Dylan MacKenzie
242702965b Fix typo passing flags to rustc 2019-10-01 15:09:53 -07:00
Mazdak Farrokhzad
dc1c1fe456
Rollup merge of #64928 - JohnTitor:add-some-tests, r=Centril
Add tests for some issues

Closes #50571
Closes #58022
Closes #58344
2019-10-01 09:55:35 +02:00
Esteban Küber
2ae87ff59d Avoid ICE on return outside of fn with literal array
Do not ICE when encountering `enum E { A = return [0][0] }`.
2019-09-30 15:11:19 -07:00
Esteban Küber
5cbe6aa6ca Reword E0392 slightly
Make it clearer that a type or lifetime argument not being used can be
fixed by referencing it in a struct's fields, not just using `PhathomData`.
2019-09-30 13:35:26 -07:00
Yuki Okushi
9c73131fd0 Add test for #58344 2019-10-01 04:55:46 +09:00
Yuki Okushi
bc25746d48 Add test for #58022 2019-10-01 04:55:29 +09:00
Yuki Okushi
576c215ab9 Add test for #50571 2019-10-01 04:55:12 +09:00
Matthew Jasper
455945f24b Remove HIR based const qualification 2019-09-30 19:56:49 +01:00
Alexander Regueiro
49c6c86faf Fixed stylistic convention for one diagnostic and blessed tests. 2019-09-30 01:15:25 +01:00
Alexander Regueiro
13b61b50d9 Fixed grammar in one diagnostic and blessed tests. 2019-09-30 01:15:25 +01:00
Mazdak Farrokhzad
0a2ddcc346
Rollup merge of #64691 - estebank:unexpected-variant, r=Centril
Point at definition when misusing ADT

When given `struct Foo(usize)` and using it as `Foo {}` or `Foo`, point at `Foo`'s definition in the error.
2019-09-29 20:34:12 +02:00
Mazdak Farrokhzad
6145757a26
Rollup merge of #64852 - Baranowski:param_note_52082, r=estebank
Print ParamTy span when accessing a field (#52082)
2019-09-28 22:12:07 +02:00
Mazdak Farrokhzad
d9168e4cfa
Rollup merge of #64793 - immunant:format_spans, r=matthewjasper
Fix format macro expansions spans to be macro-generated

New Exprs generated as part of the format macro expansion should get the macro
expansion span with an expansion context, rather than the span of the format string
which does not.
2019-09-28 22:12:04 +02:00
bors
18f00b9496 Auto merge of #64455 - GuillaumeGomez:long-error-explanation-E0531, r=Centril
Add Long error explanation for E0531

Part of #61137.
2019-09-28 12:06:44 +00:00
Wojciech Baranowski
f3744a1b3d Implement CRs 2019-09-28 14:39:19 +03:00
Mazdak Farrokhzad
001357f971 --bless --compare-mode=nll 2019-09-27 20:14:47 +02:00
Mazdak Farrokhzad
95ea4a1a8a
Rollup merge of #64783 - onehr:onehrxn, r=varkor
Fix issue #64732

Based on issue #64732, when creating a byte literal with single quotes,
the suggestion message would indicate that you meant to write a `str` literal,
but we actually meant to write a byte string literal.

So I changed the unescape_error_reporting.rs to decide whether to print out
"if you meant to write a `str` literal, use double quotes",
or "if you meant to write a byte string literal, use double quotes".

Fixes #64732.
2019-09-26 17:55:15 +02:00
Mazdak Farrokhzad
5a0e4613ce issue-#45696: remove ignore-compare-mode-nll 2019-09-26 17:19:03 +02:00
Mazdak Farrokhzad
ce8c5d2749 issue-#45696-scribble...: remove outdated comment. 2019-09-26 06:44:58 +02:00
Mazdak Farrokhzad
dfdd4d79d4 rm "src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr" 2019-09-26 06:44:57 +02:00
Mazdak Farrokhzad
2b80ed99db remove feature(nll) in more cases. 2019-09-26 06:44:57 +02:00
Mazdak Farrokhzad
2fb0bba5b5 remove feature(nll) from #45157 test. 2019-09-26 06:44:57 +02:00
Mazdak Farrokhzad
6ec9b3a0b6 Adjust & --bless tests due to no longer downgrading NLL errors on 2015. 2019-09-26 06:44:57 +02:00
Haoran Wang
a048447ff4 Add test case for issue #64732 2019-09-25 23:11:09 -04:00
Stephen Crane
0ec4513d5f Fix format macro expansions spans to be macro-generated
New Exprs generated as part of the format macro expansion should get the macro
expansion span which has an expansion context, not the span of the format string
which does not.
2019-09-25 17:45:15 -07:00
Guillaume Gomez
2fd3811509 update ui tests 2019-09-25 16:41:05 +02:00
Esteban Küber
b7ca1c5a1e fix rebase 2019-09-24 11:55:53 -07:00
Esteban Küber
d9ab4ff9a3 Remove blanket silencing of "type annotation needed" errors
Remove blanket check for existence of other errors before emitting
"type annotation needed" errors, and add some eager checks to avoid
adding obligations when they refer to types that reference
`[type error]` in order to reduce unneded errors.
2019-09-24 11:31:14 -07:00
Oliver Scherer
7767e7fb16 Stabilize str::len, [T]::len, is_empty and str::as_bytes as const fn 2019-09-24 12:56:44 +02:00
Simon Sapin
0797712e29 Stabilize Option::deref and Option::deref_mut
The tracking issue https://github.com/rust-lang/rust/issues/50264
still has unresolved question for the corresponding `Result` methods.
2019-09-23 17:14:26 +02:00
bors
b6716a1cdd Auto merge of #64695 - Centril:rollup-t1xnl2c, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #64294 (Fix `Stdio::piped` example code and lint)
 - #64670 (Cleanup syntax::ext::build)
 - #64674 (Propagate `types.err` in locals further to avoid spurious knock-down errors)
 - #64676 (Parse assoc type bounds in generic params and provide custom diagnostic)
 - #64677 (remove outdated comment)
 - #64679 (Infer consts more consistently)
 - #64688 (Clarify the "since" tidy check)

Failed merges:

r? @ghost
2019-09-23 02:25:10 +00:00
Mazdak Farrokhzad
b66e7323e6
Rollup merge of #64674 - estebank:knock-down-the-wall, r=Centril
Propagate `types.err` in locals further to avoid spurious knock-down errors

Fix #33575, fix #44504.
2019-09-23 00:36:36 +02:00
Esteban Küber
7cef8b3495 ignore-x86 instead of ignore-musl 2019-09-22 11:33:13 -07:00
Esteban Küber
4be51c879e Point at type param when it's cause of unfulfilled obligation 2019-09-22 11:33:13 -07:00
Esteban Küber
f81734bcaa ignore musl target in tests to avoid issues with output differences 2019-09-22 11:33:13 -07:00
Esteban Küber
c9d05aa9ce Point at correct span for parenthesized types 2019-09-22 11:33:12 -07:00
Esteban Küber
b370c111fd On obligation errors point at the unfulfilled binding when possible 2019-09-22 11:33:12 -07:00
Esteban Küber
2ae9016553 Point at definition when misusing ADT
When given `struct Foo(usize)` and using it as `Foo {}` or `Foo`, point at
`Foo`'s definition in the error.
2019-09-22 11:27:55 -07:00
bors
4ff32c07da Auto merge of #64669 - estebank:unreachable, r=Centril
Use span label instead of note in unreachable lint

Fix #64636.
2019-09-22 06:33:01 +00:00
Esteban Küber
daed674815 review comments 2019-09-21 17:28:07 -07:00
Esteban Küber
3e6b84474d Propagate types.err in locals further to avoid spurious knock-down errors 2019-09-21 16:31:27 -07:00
Esteban Küber
ea70fb7567 Do not trigger unreachable lint in async body and Use span labels 2019-09-21 13:04:04 -07:00
Mazdak Farrokhzad
7eac55518a
Rollup merge of #64660 - guanqun:unify-errors-for-tuple-struct, r=estebank
unify errors for tuple/struct variants

fix #63983
2019-09-21 21:24:20 +02:00
Mazdak Farrokhzad
13fee423c8
Rollup merge of #63907 - estebank:assoc-type-mismatch, r=oli-obk
Add explanation to type mismatch involving type params and assoc types

CC #63711
2019-09-21 21:24:11 +02:00
Guanqun Lu
e001c5f9d8 unify errors for tuple/struct variants
fix #63983
2019-09-21 23:38:35 +08:00
Mazdak Farrokhzad
97ca0737c6
Rollup merge of #64642 - cuviper:move-for-loop-snippet, r=varkor
Fix the span used to suggest avoiding for-loop moves

It was using the snippet from the "use" span, which often renders the
same, but with closures that snippet is on the start of the closure
where the value is captured. We should be using the snippet from the
span where it was moved into the `for` loop, which is `move_span`.

Fixes #64559.
2019-09-21 16:01:35 +02:00
Mazdak Farrokhzad
1486b7f91c
Rollup merge of #64641 - cuviper:extern-rust-ctypes, r=estebank
Exempt extern "Rust" from improper_ctypes

It should be fine for Rust ABIs to involve any Rust type.

Fixes #64593.
2019-09-21 16:01:34 +02:00
Mazdak Farrokhzad
a93c0da8d2
Rollup merge of #64347 - GuillaumeGomez:E0312, r=oli-obk
Add long error explanation for E0312

Part of #61137.
2019-09-21 16:01:28 +02:00
Josh Stone
c3f72d1c09 Fix the span used to suggest avoiding for-loop moves
It was using the snippet from the "use" span, which often renders the
same, but with closures that snippet is on the start of the closure
where the value is captured. We should be using the snippet from the
span where it was moved into the `for` loop, which is `move_span`.
2019-09-20 16:06:32 -07:00
Josh Stone
9f374da467 Exempt extern "Rust" from improper_ctypes
It should be fine for Rust ABIs to involve any Rust type.
2019-09-20 15:39:34 -07:00
bors
72252646a8 Auto merge of #64498 - estebank:point-at-arg, r=Centril
When possible point at argument causing item obligation failure

Fix https://github.com/rust-lang/rust/issues/41781, fix https://github.com/rust-lang/rust/issues/42855, fix https://github.com/rust-lang/rust/issues/46658, fix https://github.com/rust-lang/rust/issues/48099, fix https://github.com/rust-lang/rust/issues/63143.
2019-09-20 07:53:23 +00:00
Esteban Küber
02e3fb89a7 When possible point at argument causing item obligation failure 2019-09-19 12:10:23 -07:00
Mazdak Farrokhzad
3c286826aa
Rollup merge of #64592 - Aaron1011:feature/unreachable-span, r=Centril
Point at original span when emitting unreachable lint

Fixes #64590

When we emit an 'unreachable' lint, we now add a note pointing at the
expression that actually causes the code to be unreachable (e.g.
`return`, `break`, `panic`).

This is especially useful when macros are involved, since a diverging
expression might be hidden inside of a macro invocation.
2019-09-19 18:31:39 +02:00
Esteban Küber
479ce39939 Add explanation to type mismatch involving type params and assoc types 2019-09-18 17:30:35 -07:00
Aaron Hill
822393d690
Point at original span when emitting unreachable lint
Fixes #64590

When we emit an 'unreachable' lint, we now add a note pointing at the
expression that actually causes the code to be unreachable (e.g.
`return`, `break`, `panic`).

This is especially useful when macros are involved, since a diverging
expression might be hidden inside of a macro invocation.
2019-09-18 18:35:10 -04:00
James Munns
f233a4c18b Fix a minor grammar nit, update UI tests 2019-09-19 00:16:16 +02:00
Oliver Scherer
0de9485038 Get rid of special const intrinsic query in favour of const_eval 2019-09-17 16:31:55 +02:00
Esteban Küber
0a985f2c86 Tweak unsatisfied HRTB errors 2019-09-16 15:34:33 -07:00
Vadim Petrochenkov
f7f8d6584b resolve: Remove ! from "cannot find" diagnostics for macros 2019-09-15 13:22:07 +03:00
Vadim Petrochenkov
42a19dde82 resolve: Tweak "cannot find" wording for attributes 2019-09-15 13:10:12 +03:00
Mazdak Farrokhzad
3e4c7786e9
Rollup merge of #64471 - Mark-Simulacrum:warn-depr-attr, r=Centril
Warn on no_start, crate_id attribute use

These attributes are now deprecated; they don't have any use anymore.

`no_start` stopped being applicable in 3ee916e50b as part of #18967. Ideally we would've removed it pre-1.0, but since that didn't happen let's at least mark it deprecated.

`crate_id` was renamed to `crate_name` in 50ee1ec1b4 as part of #15319. Ideally we would've followed that up with a removal of crate_id itself as well, but that didn't happen; this PR finally marks it as deprecated at least.

Fixes https://github.com/rust-lang/rust/issues/43142 and resolves https://github.com/rust-lang/rust/issues/43144.
2019-09-15 02:29:46 +02:00
Mazdak Farrokhzad
17798939f2
Rollup merge of #64463 - petrochenkov:expectattr, r=Centril
resolve: Tweak some expected/found wording
2019-09-15 02:29:44 +02:00
Mark Rousskov
a0e48b6d25 Warn on no_start, crate_id attribute use
These attributes are now deprecated; they don't have any use anymore.
2019-09-14 19:43:39 -04:00
Mazdak Farrokhzad
d29df01b08
Rollup merge of #64290 - Mark-Simulacrum:span-no-main, r=estebank
Provide a span if main function is not present in crate

Unfortunately, the diagnostic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.

Tests are already updated for this change, so a dedicated test is not added.

Resolves #36561.
2019-09-14 22:16:05 +02:00
Vadim Petrochenkov
f6a5b29d19 resolve: Tweak some expected/found wording 2019-09-14 22:36:58 +03:00
Mark Rousskov
b7f20d06ea Provide a span if main function is not present in crate
Unfortunately, the diagnotic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.
2019-09-14 11:27:45 -04:00
Mazdak Farrokhzad
1c7959bb5d
Rollup merge of #64439 - 12101111:fix-owned-box, r=Centril
fix #64430, confusing `owned_box` error message in no_std build

Fixes #64430
2019-09-14 16:42:42 +02:00
12101111
e484f213ee add trailing newline 2019-09-14 03:23:58 +08:00
12101111
b98a844cf3 add ui test for #64430 2019-09-14 03:13:51 +08:00
bors
eb48d6bdee Auto merge of #64359 - varkor:opaque-ty-in-extern, r=estebank
Forbid opaque types in `extern "C"` blocks

Fixes #64338.
2019-09-12 12:40:31 +00:00
Guillaume Gomez
cf6a1feda6 update ui tests 2019-09-12 13:25:42 +02:00
bors
f0b58fcf03 Auto merge of #64271 - Centril:non-exhaustive-peel-refs, r=estebank
check_match: refactor + improve non-exhaustive diagnostics for default binding modes

Refactor `check_match` a bit with more code-reuse and improve the diagnostics for a non-exhaustive pattern match by peeling off any references from the scrutinee type so that the "defined here" label is added in more cases. For example:

```rust
error[E0004]: non-exhaustive patterns: `&mut &B` not covered
 --> foo.rs:4:11
  |
1 | enum E { A, B }
  | ---------------
  | |           |
  | |           not covered
  | `E` defined here
...
4 |     match x {
  |           ^ pattern `&mut &B` not covered
  |
  = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
```

Moreover, wrt. "defined here", we give irrefutable pattern matching (i.e. in `let`, `for`, and `fn` parameters) a more consistent treatment in line with `match`.

r? @estebank
2019-09-11 18:46:18 +00:00
varkor
9d712177a3 Refactor "not FFI-safe" diagnostic 2019-09-10 22:29:31 +01:00
bors
0b36e9dea3 Auto merge of #64313 - Centril:rollup-7w8b67g, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #63468 (Resolve attributes in several places)
 - #64121 (Override `StepBy::{try_fold, try_rfold}`)
 - #64278 (check git in bootstrap.py)
 - #64306 (Fix typo in config.toml.example)
 - #64312 (Unify escape usage)

Failed merges:

r? @ghost
2019-09-09 16:33:43 +00:00
Mazdak Farrokhzad
457a23fabe
Rollup merge of #63468 - c410-f3r:attrs, r=petrochenkov
Resolve attributes in several places

Resolve attributes for Arm, Field, FieldPat, GenericParam, Param, StructField and Variant.

This PR is based on @petrochenkov work located at 83fdb8d598.
2019-09-09 17:42:23 +02:00
Mazdak Farrokhzad
7d4665b097 check_match: unify check_irrefutable & check_exhaustive more. 2019-09-09 16:44:23 +02:00
bors
45859b7ca7 Auto merge of #63118 - Centril:stabilize-bind-by-move, r=matthewjasper
Stabilize `bind_by_move_pattern_guards` in Rust 1.39.0

Closes https://github.com/rust-lang/rust/issues/15287.

After stabilizing `#![feature(bind_by_move_pattern_guards)]`, you can now use bind-by-move bindings in patterns and take references to those bindings in `if` guards of `match` expressions. For example, the following now becomes legal:

```rust
fn main() {
    let array: Box<[u8; 4]> = Box::new([1, 2, 3, 4]);

    match array {
        nums
//      ---- `nums` is bound by move.
            if nums.iter().sum::<u8>() == 10
//                 ^------ `.iter()` implicitly takes a reference to `nums`.
        => {
            drop(nums);
//          --------- Legal as `nums` was bound by move and so we have ownership.
        }
        _ => unreachable!(),
    }
}
```

r? @matthewjasper
2019-09-09 12:46:59 +00:00
Caio
63a5f399ae Resolve attributes in several places
Arm, Field, FieldPat, GenericParam, Param, StructField and Variant
2019-09-09 09:27:15 -03:00
bors
824383d4ab Auto merge of #64237 - estebank:tweak-method-not-found, r=Centril
Give method not found a primary span label
2019-09-09 08:39:59 +00:00
Esteban Küber
5799fb419c Give method not found a primary span label 2019-09-08 18:27:02 -07:00
bors
7eb65dfe66 Auto merge of #64108 - estebank:issue-36836, r=Centril
Do not complain about unconstrained params when Self is Ty Error

Fix #36836.
2019-09-09 00:58:38 +00:00
Mark Rousskov
6fdbece55f Update test stderr with results of enabling unused lints 2019-09-08 11:32:28 -04:00
Mazdak Farrokhzad
642993e6dc Update tests wrt. bind_by_by_move_pattern_guards stabilization. 2019-09-08 01:39:24 +02:00
Mazdak Farrokhzad
d5caeac096
Rollup merge of #64233 - varkor:correct-pluralisation, r=estebank
Correct pluralisation of various diagnostic messages
2019-09-07 08:06:11 +02:00
varkor
0b97726e6c Update ui tests 2019-09-06 19:21:26 +01:00
Alexander Regueiro
022d9c8eb5 Fixed grammar/style in error messages and reblessed tests. 2019-09-06 03:46:08 +01:00
Mazdak Farrokhzad
2238d19515
Rollup merge of #64063 - JohnTitor:fix-const-err, r=oli-obk
Fix const_err with `-(-0.0)`

Fixes #64059

r? @oli-obk
2019-09-05 12:11:14 +02:00
Mazdak Farrokhzad
8ef11fcf4b
Rollup merge of #64110 - estebank:receiver-type, r=Centril
Refer to "`self` type" instead of "receiver type"

Fix https://github.com/rust-lang/rust/issues/42603.
2019-09-05 03:59:44 +02:00
Yuki Okushi
41deb83549 Add compile flag 2019-09-04 18:32:00 +09:00
Mazdak Farrokhzad
4245be7fb3
Rollup merge of #64049 - estebank:if-else-type-err, r=Centril
Emit a single error on if expr with expectation and no else clause

Fix https://github.com/rust-lang/rust/issues/60254.

r? @Centril
2019-09-03 14:26:58 +02:00
Esteban Küber
3cb1ed4279 review comments 2019-09-02 20:51:31 -07:00
Esteban Küber
c1e5e5c567 On object safety violation, point at source when possible 2019-09-02 20:22:22 -07:00
Esteban Küber
3ea932ab0e Refer to "self type" instead of "receiver type" 2019-09-02 19:07:04 -07:00
Esteban Küber
37f5cc2239 Do not complain about unconstrained params when Self is Ty Error 2019-09-02 18:03:54 -07:00
Yuki Okushi
a937d8cdeb Fix tests again 2019-09-02 05:01:39 +09:00
Yuki Okushi
0cd9c1623f Fix condition and tests' flags 2019-09-02 03:40:35 +09:00
Yuki Okushi
8e9825aeb9 Fix overflow_check 2019-09-02 03:06:11 +09:00
Yuki Okushi
4a0872b37e Add overflow_check check 2019-09-02 02:18:16 +09:00
Yuki Okushi
3a6aadaa8c Add opt-level check 2019-09-02 01:05:38 +09:00
Esteban Küber
cab607edcf Emit a single error on if expr with expectation and no else clause 2019-08-31 18:34:50 -07:00
Esteban Küber
444bc3ca66 Use span label instead of note for cause in E0631 2019-08-31 00:14:23 -07:00
Mazdak Farrokhzad
e4e6b01ca1
Rollup merge of #63867 - petrochenkov:dhelpers, r=matthewjasper
resolve: Block expansion of a derive container until all its derives are resolved

So, it turns out there's one more reason to block expansion of a `#[derive]` container until all the derives inside it are resolved, beside `Copy` (https://github.com/rust-lang/rust/pull/63248).

The set of derive helper attributes registered by derives in the container also has to be known before the derives themselves are expanded, otherwise it may be too late (see https://github.com/rust-lang/rust/pull/63468#issuecomment-524550872 and the `#[stable_hasher]`-related test failures in https://github.com/rust-lang/rust/pull/63468).

So, we stop our attempts to unblock the container earlier, as soon as the `Copy` status is known, and just block until all its derives are resolved.
After all the derives are resolved we immediately go and process their helper attributes in the item, without delaying it until expansion of the individual derives.

Unblocks https://github.com/rust-lang/rust/pull/63468
r? @matthewjasper (as a reviewer of https://github.com/rust-lang/rust/pull/63248)
cc @c410-f3r
2019-08-29 13:17:52 +02:00
Vadim Petrochenkov
ec45b87957 resolve: Block expansion of a derive container until all its derives are resolved
Also mark derive helpers as known as a part of the derive container's expansion instead of expansion of the derives themselves which may happen too late.
2019-08-27 00:31:55 +03:00
Oliver Scherer
181ed55e96 Simplify eager normalization of constants 2019-08-23 00:48:52 +02:00
Artem Varaksa
600a64bdb5 more --blessing + test error annotations fixes 2019-08-21 15:13:13 +03:00
Artem Varaksa
a8d7ea74a4 improve diagnostics: break/continue wrong context 2019-08-21 13:17:59 +03:00
sd234678
4eec03d33e Cherry-pick src/test changes with Centril's changes 2019-08-19 22:31:46 +01:00
Mazdak Farrokhzad
a396434136
Rollup merge of #63487 - sd234678:remove-meaningless-comments-in-src/test-2, r=Centril
Remove meaningless comments in src/test

Moved from #63411
2019-08-17 22:57:30 +02:00
sd234678
b7b4c3a9aa Update stderr files with --bless 2019-08-16 10:54:20 +01:00
sd234678
56ebd57960 Remove meaningless comments in src/test 2019-08-16 10:54:20 +01:00
Vadim Petrochenkov
23b82c3229 resolve: Move macro resolution traces from Modules to Resolver
Traces already contain module info without that.
It's easy to forget to call `finalize_*` on a module.
In particular, macros enum and trait modules weren't finalized.
By happy accident macros weren't placed into those modules until now.
2019-08-15 20:39:27 +03:00
Mazdak Farrokhzad
77f2694fdc
Rollup merge of #63577 - meffij:test-hrtb, r=alexcrichton
Test HRTB issue accepted by compiler

Hi! First Rust PR, so if anything needs changing just let me know and I'll take care of it right away.

Closes #50301 which was marked E-needstest
2019-08-15 14:34:07 +02:00
nivlac
e5017dec58 Test HRTB issue accepted by compiler 2019-08-14 14:31:54 -07:00
Mazdak Farrokhzad
d2d49d238f
Rollup merge of #63507 - estebank:type-inference-error, r=Centril
When needing type annotations in local bindings, account for impl Trait and closures

Fix https://github.com/rust-lang/rust/issues/46680, fix https://github.com/rust-lang/rust/issues/63504, fix https://github.com/rust-lang/rust/issues/63506, fix #40014, cc https://github.com/rust-lang/rust/issues/63502.
2019-08-14 22:56:22 +02:00
Esteban Küber
806476c840 Suggest giving return type to closures on E0282 2019-08-13 16:41:43 -07:00
Eric Huss
643ddfaaa8
Apply Centril's suggestion
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-08-13 15:09:11 -07:00
Eric Huss
ea1a9a0e2b Fix typo in error message. 2019-08-13 11:21:09 -07:00
Adrian Budau
75d2db97fe
Regression test for #56870 2019-08-11 23:02:47 +03:00
Mazdak Farrokhzad
52f9e80e5f
Rollup merge of #63337 - estebank:break-ee0308, r=Centril
Tweak mismatched types error

- Change expected/found for type mismatches in `break`
- Be more accurate when talking about diverging match arms
- Tweak wording of function without a return value
- Suggest calling bare functions when their return value can be coerced to the expected type
- Give more parsing errors when encountering `foo(_, _, _)`

Fix #51767, fix #62677, fix #63136, cc #37384, cc #35241, cc #51669.
2019-08-10 08:13:17 +02:00
Esteban Küber
bc1a4f52e3 review comments: typo and rewording 2019-08-09 07:18:05 -07:00
Esteban Küber
33d1082d6e review comment: review wording or missing return error 2019-08-09 07:18:05 -07:00
Esteban Küber
efa62d66e3 Tweak wording of fn without explicit return 2019-08-09 07:18:05 -07:00
Esteban Küber
b7f7756566 Recover parser from foo(_, _) 2019-08-09 07:18:05 -07:00
Esteban Küber
195d837f18 When suggesting fn call use an appropriate number of placeholder arguments 2019-08-09 07:18:05 -07:00
Esteban Küber
94fe8a3c17 Suggest calling function on type error when finding bare fn 2019-08-09 07:18:05 -07:00
Esteban Küber
01a61394f8 Change wording for function without return value
Fix #62677
2019-08-09 07:18:05 -07:00
Esteban Küber
c076392143 Tweak mismatched types error on break expressions 2019-08-09 07:18:05 -07:00
Mazdak Farrokhzad
7a251629a2
Rollup merge of #63397 - JohnTitor:add-tests-for-ices, r=Centril
Add tests for some ICEs

Closes #43623
Closes #44405

r? @Centril
2019-08-09 14:07:31 +02:00
Mazdak Farrokhzad
74b22c9007
Rollup merge of #63289 - kornelski:missingcrate, r=zackmdavis
Don't recommend `extern crate` syntax

`extern crate` syntax is not a good recommendation any more, so I've changed it to just print a suggested crate name.
2019-08-09 01:38:30 +02:00
Yuki Okushi
55f15d7655 Add test for issue-44405 2019-08-09 08:37:55 +09:00
Yuki Okushi
642ee70942 Add test for issue-43623 2019-08-09 08:37:40 +09:00
Mazdak Farrokhzad
499887ffb9
Rollup merge of #63370 - JohnTitor:fix-ice-63364, r=varkor
Fix ICE #63364

Fixes #63364

r? @estebank cc @varkor
2019-08-08 16:33:41 +02:00
Mazdak Farrokhzad
5277c71e84
Rollup merge of #63259 - JohnTitor:add-tests-for-some-issues, r=Centril
Add tests for some issues

Closes #29265
Closes #37433
Closes #49544

r? @Centril
2019-08-08 07:35:32 +02:00
Mazdak Farrokhzad
3a84c9db5f
Rollup merge of #62994 - iluuu1994:test-for-43398, r=nikomatsakis
Add test for #43398

Closes #43398
2019-08-08 07:35:30 +02:00
Yuki Okushi
e2b3543eab Return early to avoid failing assertion 2019-08-08 13:38:23 +09:00
bors
5421d94960 Auto merge of #63152 - estebank:big-array, r=oli-obk
Always error on `SizeOverflow` during mir evaluation

Fix #55878, fix #25116.

r? @oli-obk
2019-08-07 04:28:08 +00:00
Esteban Küber
3144b0aa04 review comment: reword test comment 2019-08-06 16:51:17 -07:00
Esteban Küber
64469ac344 review comments 2019-08-06 11:23:32 -07:00
Yuki Okushi
418bf968f0 Ignore no support targets 2019-08-06 22:01:12 +09:00
Mazdak Farrokhzad
61da2f4d19
Rollup merge of #63264 - arielb1:revert-private-coherence-errors, r=estebank
Revert "Rollup merge of #62696 - chocol4te:fix_#62194, r=estebank"

This reverts commit df21a6f040 (#62696), reversing
changes made to cc16d04869.

That PR makes error messages worse than before, and we couldn't come up with a way of actually making them better, so revert it for now. Any idea for making this error message better is welcome!

Fixes #63145.

r? @estebank
2019-08-06 08:17:41 +02:00
Mazdak Farrokhzad
ab7155dd97
Rollup merge of #63230 - tmandry:disallow-possibly-uninitialized, r=Centril
Make use of possibly uninitialized data [E0381] a hard error

This is one of the behaviors we no longer allow in NLL. Since it can
lead to undefined behavior, I think it's definitely worth making it a
hard error without waiting to turn off migration mode (#58781).

Closes #60450.

My ulterior motive here is making it impossible to leave variables
partially initialized across a yield (see #60889, discussion at #63035), so
tests are included for that.

cc #54987

---

I'm not sure if bypassing the buffer is a good way of doing this. We could also make a `force_errors_buffer` or similar that gets recombined with all the errors as they are emitted. But this is simpler and seems fine to me.

r? @Centril
cc @cramertj @nikomatsakis @pnkfelix @RalfJung
2019-08-06 08:17:38 +02:00
Esteban Küber
ce8510a214 fix tests 2019-08-05 19:26:55 -07:00