Mazdak Farrokhzad
403bb097fc
Rollup merge of #67285 - ohadravid:indicate-origin-of-where-type-parameter, r=estebank
...
Indicate origin of where type parameter for uninferred types
Based on #65951 (which is not merge yet), fixes #67277 .
This PR improves a little the diagnostic for code like:
```
async fn foo() {
bar().await;
}
async fn bar<T>() -> () {}
```
by showing:
```
error[E0698]: type inside `async fn` body must be known in this context
--> unresolved_type_param.rs:9:5
|
9 | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
...
```
(The
```
declared on the function `bar`
```
part is new)
A small side note: `Vec` and `slice` seem to resist this change, because querying `item_name()` panics, and `get_opt_name()` returns `None`.
r? @estebank
2019-12-20 12:17:23 +01:00
Mazdak Farrokhzad
f0eb4b4752
Rollup merge of #67127 - estebank:disambiguate-suggestion, r=varkor
...
Use structured suggestion for disambiguating method calls
Fix #65635 .
2019-12-20 12:17:20 +01:00
Ohad Ravid
8a4632dec6
Indicate origin of where type parameter for uninferred types
2019-12-14 11:10:21 +01:00
bors
8843b28e64
Auto merge of #65951 - estebank:type-inference-error, r=nikomatsakis
...
Point at method call when type annotations are needed
- Point at method call instead of whole expression when type annotations are needed.
- Suggest use of turbofish on function and methods.
Fix #49391 , fix #46333 , fix #48089 . CC #58517 , #63502 , #63082 .
Fixes https://github.com/rust-lang/rust/issues/40015
r? @nikomatsakis
2019-12-13 22:56:27 +00:00
Mazdak Farrokhzad
df9e491fb2
Rollup merge of #67026 - Nadrieril:improve-usefulness-empty, r=varkor,Centril,estebank
...
Improve diagnostics and code for exhaustiveness of empty matches
There was a completely separate check and diagnostics for the case of an empty match. This led to slightly different error messages and duplicated code.
This improves code reuse and generally clarifies what happens for empty matches. This also clarifies the action of the `exhaustive_patterns` feature, and ensures that this feature doesn't change diagnostics in places it doesn't need to.
2019-12-13 20:35:28 +01:00
Esteban Küber
8c4f1d5f87
review comments
2019-12-11 18:21:52 -08:00
Esteban Küber
3980342f31
Use structured suggestion for disambiguating method calls
...
Fix #65635 .
2019-12-11 17:42:28 -08:00
Esteban Küber
da023c0c6f
Add more context for type parameters
2019-12-11 17:18:43 -08:00
Esteban Küber
252773af8b
Deduplicate logic
2019-12-10 12:02:18 -08:00
Nadrieril
d44774d72c
Forgot to update some test outputs
2019-12-04 16:43:25 +00:00
Christian Poveda
416b439ffb
Correct other tests related to const_mut_refs
2019-12-02 09:46:26 -05:00
Dylan MacKenzie
846be82277
Update test for mutably borrowed statics in a const
...
This checks `static mut` as well for E0017, and blesses tests now that
we emit an error for a mut deref.
2019-11-27 16:14:37 -08:00
Dylan MacKenzie
5b1e10b2f6
Remove test for unused error code
...
This error code is never emitted, and the contents of this test are
identical to that of `E0017.rs`.
2019-11-27 14:37:06 -08:00
Dylan MacKenzie
ae2293837e
Change some tests to use the shorter comment style
2019-11-21 14:09:18 -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
Esteban Küber
6f8f70624b
Surround types with backticks in type errors
2019-11-18 11:03:04 -08:00
Esteban Küber
94c6425464
Remove E0308 note when primary label has all info
2019-11-18 11:03:03 -08:00
Esteban Küber
b2e6aef073
review comments: tweak prefix strings
2019-11-18 11:02:44 -08:00
Esteban Küber
83ffda5216
Specific labels when referring to "expected" and "found" types
2019-11-18 11:02:22 -08:00
Guillaume Gomez
cd13335ae2
Update ui tests
2019-11-18 19:00:10 +01:00
Yuki Okushi
41fb84e444
Rollup merge of #66306 - spastorino:remove-error-handled-by-miri, r=oli-obk
...
Remove cannot mutate statics in initializer of another static error
r? @oli-obk
This is just a refactoring. As the removed code itself said, it only a heuristic catching a few cases early instead of leaving it all to const eval. It's easy to work around the static check and then run into the miri-engine check.
2019-11-15 18:36:22 +09:00
Guillaume Gomez
cfd4e9722e
Fix ui tests with better error code usage
2019-11-14 13:05:56 +01:00
Yuki Okushi
20c356263d
Rollup merge of #66351 - JohnTitor:tweak-range-err-msg, r=Centril
...
Tweak non-char/numeric in range pattern diagnostic
Fixes #66283
r? @estebank
2019-11-14 14:16:20 +09:00
Yuki Okushi
302cf6db74
Tweak non-char/numeric in range pattern diagnostic
2019-11-13 08:27:53 +09:00
Santiago Pastorino
695e91a1d5
check-consts remove cannot mutate statics in initializer of another static error
2019-11-12 13:20:52 +01:00
Ohad Ravid
2db744ca9d
Improve coherence errors for wrong type order
2019-11-10 16:26:38 +01:00
bors
98c173afe4
Auto merge of #65879 - ohadravid:stabilize-re-rebalance-coherence, r=nikomatsakis
...
Stabilize the `re_rebalance_coherence` feature
This PR stabilizes [RFC 2451](https://rust-lang.github.io/rfcs/2451-re-rebalancing-coherence.html ), re-rebalance coherence.
Changes include removing the attribute from tests which tested both the old and new behavior, moving the feature to `accepted` and removing the old logic.
I'll also open a [PR](https://github.com/rust-lang-nursery/reference/pull/703 ) against the reference, updating it with the content of the RFC.
Closes #63599
r? @nikomatsakis
2019-11-09 05:57:14 +00:00
Ohad Ravid
026aee62ac
Stabilize the re_rebalance_coherence feature
2019-10-31 17:11:21 +01:00
Ohad Ravid
8bb5450128
Fix incorrect diagnostics for expected type in E0271 with an associated type
2019-10-31 09:30:14 +01:00
Mazdak Farrokhzad
9c5b6b2201
Rollup merge of #65562 - Patryk27:master, r=estebank
...
Improve the "try using a variant of the expected type" hint.
Fix https://github.com/rust-lang/rust/issues/65494 .
- Change type-printing output.
- Use `span_to_snippet` when possible.
- Change the message to `try using a variant of the expected enum`
2019-10-29 04:08:21 +01:00
Mazdak Farrokhzad
b07e8ed825
Rollup merge of #65318 - estebank:coherence, r=varkor
...
Call out the types that are non local on E0117
CC #24745 .
2019-10-29 04:08:19 +01:00
Patryk Wychowaniec
273ee611f0
Improve the "try using a variant of the expected type" hint.
2019-10-28 18:43:51 +01:00
Esteban Küber
95364df6bc
Do not display ADT type arguments and fix rebase
2019-10-28 09:57:36 -07:00
Esteban Küber
db1bfbdbc0
Account for tuples in explanation
2019-10-28 09:57:36 -07:00
Esteban Küber
daeafd895d
Talk about specific types and remove lifetimes from output
2019-10-28 09:57:36 -07:00
Esteban Küber
9b4f811b7f
Use more targeted spans for orphan rule errors
2019-10-28 09:57:36 -07:00
Esteban Küber
adfe9a45d6
Call out the types that are non local on E0117
2019-10-28 09:56:53 -07:00
Esteban Küber
b26ddb8af3
Point at local similarly named element and tweak references to variants
...
Point at the span for the definition of ADTs internal to the current
crate.
Look at the leading char of the ident to determine whether we're
expecting a likely fn or any of a fn, a tuple struct or a tuple variant.
Turn fn `add_typo_suggestion` into a `Resolver` method.
2019-10-27 11:50:43 -07:00
Esteban Küber
0baf61bfdb
Increase spacing for suggestions in diagnostics
...
Make the spacing between the code snippet and verbose structured
suggestions consistent with note and help messages.
2019-10-24 12:26:01 -07:00
Esteban Küber
f65a492afc
Point at enclosing function without self receiver
2019-10-17 20:26:21 -07:00
Esteban Küber
11011013f2
Refer to "associated functions" instead of "static methods"
2019-10-17 19:03:36 -07:00
Tyler Mandry
a14e35f382
Rollup merge of #65398 - estebank:capitalization-only, r=varkor
...
Bring attention to suggestions when the only difference is capitalization
CC #65386 .
2019-10-14 17:52:41 -07:00
Mazdak Farrokhzad
c2ae4ded4d
Rollup merge of #65292 - JohnTitor:add-backticks, r=varkor,Centril
...
Print lifetimes with backticks
Fixes #65287
r? @varkor
2019-10-14 07:36:54 +02:00
Esteban Küber
4bb771615e
Bring attention to suggestions when the only difference is capitalization
2019-10-13 21:48:39 -07:00
Mazdak Farrokhzad
963e4bc756
Rollup merge of #65248 - estebank:mention-if-let, r=cramertj
...
Suggest `if let` on `let` refutable binding
Fix #58385 .
2019-10-13 13:34:32 +02:00
Yuki Okushi
2ae5e3421d
Print lifetimes with backticks
2019-10-11 16:08:53 +09:00
Esteban Küber
4bb1592402
Suggest if let on let refutable binding
2019-10-09 12:25:48 -07:00
Guillaume Gomez
96efaad342
update ui tests
2019-10-07 17:12:54 +02:00
Ben Boeckel
126bf3b1dd
typo: fix typo in E0392
...
See #64931 .
2019-10-03 09:22:29 -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