Commit Graph

510 Commits

Author SHA1 Message Date
Mazdak Farrokhzad 2c3e5d3de0 - remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}
- remove syntax::{help!, span_help!, span_note!}
- remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!}
- lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints
- inline syntax::{struct_span_warn!, diagnostic_used!}
- stringify_error_code! -> error_code! & use it more.
- find_plugin_registrar: de-fatalize an error
- de-fatalize metadata errors
- move type_error_struct! to rustc_typeck
- struct_span_err! -> rustc_errors
2020-01-08 04:25:33 +01:00
Camille GILLOT 7770bce178 Make rustc::traits::object_safety::{astconv_object_safety_violations,is_vtable_safe_method,object_safety_violations} free functions. 2020-01-07 17:44:53 +01:00
Camille GILLOT 0b1521e6d3 Make rustc::traits::error_reporting::{recursive_type_with_infinite_size_error, report_object_safety_error} free functions. 2020-01-07 17:43:55 +01:00
bors ebbb2bf37a Auto merge of #67886 - Centril:rustc_hir_canon_imports, r=nagisa
Nix `rustc_hir` reexports in rustc::hir

r? @Zoxc cc @Mark-Simulacrum
2020-01-06 12:55:40 +00:00
Dylan DPC c79034ed47
Rollup merge of #67906 - varkor:silence-toogeneric, r=nagisa
Silence `TooGeneric` error

This error may be produced during intermediate failed attempts at evaluation of a generic const, which may nevertheless succeed later.

Fixes https://github.com/rust-lang/rust/issues/66962.

r? @eddyb
2020-01-06 12:00:20 +05:30
varkor adb46fd0a4 Silence `TooGeneric` error
This error may be produced during intermediate failed attempts at evaluation of a generic const, which may nevertheless succeed later.
2020-01-05 23:00:47 +00:00
Mazdak Farrokhzad ebfd8673a7 Remove rustc_hir reexports in rustc::hir. 2020-01-05 12:49:22 +01:00
Mazdak Farrokhzad 7901c7f707 canonicalize FxHash{Map,Set} imports 2020-01-04 18:57:22 +01:00
Mazdak Farrokhzad 4ff12ce4c1 Normalize `syntax::symbol` imports. 2020-01-02 13:57:04 +01:00
Vadim Petrochenkov 70f1d57048 Rename `syntax_pos` to `rustc_span` in source code 2020-01-01 09:15:18 +03:00
Mazdak Farrokhzad e952377ddc MatchExpressionArmPattern -> Pattern
Current name is too specific for incoming changes.
2019-12-30 13:50:20 +01:00
Camille GILLOT 6b87d5cdf1 Syntax for hir::Ty. 2019-12-27 19:20:28 +01:00
Camille GILLOT 2b1cfe5b5b Syntax for hir::Expr. 2019-12-26 23:36:12 +01:00
Mazdak Farrokhzad 07effe18b0
Rollup merge of #67543 - JohnTitor:regression-tests, r=Centril
Add regression tests for fixed ICEs

Closes #61747 (fixed from 1.41.0-nightly (4007d4ef2 2019-12-01))
Closes #66205 (fixed from 1.41.0-nightly (4007d4ef2 2019-12-01))
Closes #66270 (fixed by #66246)
Closes #67424 (fixed by #67160)

Also picking a minor nit up from #67071 with 101dd7bad9

r? @Centril
2019-12-24 04:39:55 +01:00
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Yuki Okushi 101dd7bad9 Use `is_none` instead of `if let` 2019-12-23 07:42:26 +09:00
Mazdak Farrokhzad b50c3b7ddf
Rollup merge of #67160 - matthewjasper:gat-generics, r=nikomatsakis
Make GATs less ICE-prone.

After this PR simple lifetime-generic associated types can now be used in a compiling program. There are two big limitations:

* #30472 has not been addressed in any way (see src/test/ui/generic-associated-types/iterable.rs)
* Using type- and const-generic associated types errors because bound types and constants aren't handled by trait solving.
    * The errors are technically non-fatal, but they happen in a [part of the compiler](4abb0ad273/src/librustc_typeck/lib.rs (L298)) that fairly aggressively stops compiling on errors.

closes #47206
closes #49362
closes #62521
closes #63300
closes #64755
closes #67089
2019-12-21 19:07:31 +01:00
Mazdak Farrokhzad a7aec3f207 1. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.
2. mir::Mutability -> ast::Mutability.
2019-12-20 22:22:44 +01:00
Matthew Jasper db6d0b1638 Check associated type implementations for generic mismatches 2019-12-20 20:10:07 +00:00
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 8e2689c42e
Rollup merge of #67289 - estebank:unnamed-closure, r=Centril
Do not ICE on unnamed future

Fix #67252.
2019-12-15 05:57:25 +01:00
Esteban Küber e08944fdaf Do not ICE on unnamed future 2019-12-14 14:50:32 -08: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
Nicholas Matsakis 5cd9f22464 erase regions instead of using `builtin_deref`
The reason we were invoking `builtin_deref` was to enable comparisons
when the type was `&T`. For the reasons outlined in the comment, those
comparisons failed because the regions disagreed.
2019-12-11 13:23:07 -05:00
Esteban Küber 94ab9ec36b Avoid invalid suggestion by checking the snippet in const fn call 2019-12-10 14:15:38 -08:00
Esteban Küber cc1ab3db8b Suggest setting type param on function call 2019-12-10 12:02:18 -08:00
Esteban Küber cca4b6d42a Fix rebase 2019-12-10 12:02:18 -08:00
Esteban Küber 252773af8b Deduplicate logic 2019-12-10 12:02:18 -08:00
Esteban Küber 12af2561e9 Point at method call when type annotations are needed 2019-12-10 12:02:18 -08:00
David Wood f0b51145c5
async/await: correct diag note for `async move`
This commit corrects the diagnostic note for `async move {}` so that
`await` is mentioned, rather than `yield`.

Signed-off-by: David Wood <david@davidtw.co>
2019-12-08 16:29:11 +00:00
David Wood 438455d18b
async/await: more improvements to non-send errors
Signed-off-by: David Wood <david@davidtw.co>
2019-12-08 16:29:08 +00:00
Mazdak Farrokhzad 459398dc40
Rollup merge of #67071 - estebank:issue-66868, r=davidtwco
Do not ICE on closure typeck

Tackle #66868.

r? @davidtwco
2019-12-06 23:27:00 +01:00
varkor 9f1269f23c Rename to `then_some` and `then` 2019-12-06 12:24:54 +00:00
varkor e3a8ea4e18 Use `to_option` in various places 2019-12-06 12:23:23 +00:00
Esteban Küber 22c65f9242 Do not ICE on closure typeck
Tackle #66868.
2019-12-05 14:53:16 -08:00
Mazdak Farrokhzad 8dacfc2ada
Rollup merge of #66651 - Areredify:on-unimplemented-scope, r=davidtwco
Add `enclosing scope` parameter to `rustc_on_unimplemented`

Adds a new parameter to `#[rustc_on_unimplemented]`, `enclosing scope`, which highlights the function or closure scope with a message.

The wip part refers to adding this annotation to `Try` trait to improve ergonomics (which I don't know how to do since I change both std and librustc)

Closes #61709.
2019-12-03 11:07:01 +01:00
Mikhail Babenko f07bd06137 allow customising ty::TraitRef's printing behavior
fix clippy

allow customising ty::TraitRef's printing behavior

fix clippy

stylistic fix
2019-11-29 17:30:21 +03:00
Esteban Küber 0f530ecb68 review comments 2019-11-28 12:22:07 -08:00
Esteban Küber 9fb446d472 Deduplicate type param constraint suggestion code 2019-11-28 12:20:28 -08:00
Tyler Mandry 48b0fd2060
Rollup merge of #66700 - VirrageS:master, r=matthewjasper
Fix pointing at arg for fulfillment errors in function calls

Closes: https://github.com/rust-lang/rust/issues/66258
2019-11-27 15:28:37 -06:00
Mikhail Babenko 45aadf7ae6 add `enclosing_scope` param to `rustc_on_unimplmented`
add ui test

compute enclosing_scope_span on demand

add scope test

make tidy happy

stylistic and typo fixes
2019-11-25 18:05:56 +03:00
Janusz Marcinkiewicz 6f70803e7e Fix pointing at arg for fulfillment errors in function calls 2019-11-24 15:26:09 +01:00
Timo Freiberg 2a0292f9aa fixup! Lowercase diagnostic message label 2019-11-24 15:17:16 +01:00
Timo Freiberg dffdf378ee Add version mismatch help message for unimplemented trait
Issue #22750
The error reporting for E0277 (the trait `X` is not implemented for `Foo`)
now checks whether `Foo` implements a trait with the same path as `X`,
which probably means that the programmer wanted to actually use only one
version of the trait `X` instead of the two.
2019-11-24 15:17:16 +01:00
Mazdak Farrokhzad 0b0d683805
Rollup merge of #66239 - estebank:suggest-async-closure-call, r=Centril
Suggest calling async closure when needed

When using an async closure as a value in a place that expects a future,
suggest calling the closure.

Fix #65923.
2019-11-19 13:10:14 +01:00
Esteban Küber 614da98454 review comments 2019-11-18 11:46:14 -08:00
Esteban Küber d7efa5bd6a review comments 2019-11-16 17:10:13 -08:00
Esteban Küber 0487f0c0c3 Suggest calling async closure when needed
When using an async closure as a value in a place that expects a future,
suggest calling the closure.

Fix #65923.
2019-11-16 16:24:00 -08:00
Esteban Küber 2fe8371268 review comments and fix rebase 2019-11-16 16:12:22 -08:00