Commit Graph

286 Commits

Author SHA1 Message Date
Mazdak Farrokhzad 8bd3d240e3 nix syntax::errors & prefer rustc_errors over errors 2020-01-10 07:41:30 +01:00
Esteban Küber 33ae3220b6 remove unnecessary `Debug` 2020-01-08 09:30:27 -08:00
Esteban Küber 705e0874de reduce code duplication 2020-01-08 09:30:27 -08:00
Esteban Küber ffcdbad263 review comments 2020-01-08 09:30:27 -08:00
Esteban Küber b522ba0237 review comments 2020-01-08 09:30:27 -08:00
Esteban Küber 542be6fb6c review comment: wording 2020-01-08 09:30:27 -08:00
Esteban Küber 0dcdbaec0b Point at the def span of trait refs E0277 2020-01-08 09:30:27 -08:00
Esteban Küber c55615155d review comments 2020-01-08 09:29:47 -08:00
Esteban Küber 9c0000caca Point at opaque and closure type definitions in type errors 2020-01-08 09:29:47 -08:00
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
Camille GILLOT d53bf7a676 Make rustc::infer::error_reporting::{note_and_explain_free_region, note_and_explain_region} free functions. 2020-01-07 17:43:03 +01:00
Camille GILLOT 47256b8b7c Remove private methods from TyCtxt impl block: rustc::infer::error_reporting. 2020-01-07 17:37:01 +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
Mazdak Farrokhzad ebfd8673a7 Remove rustc_hir reexports in rustc::hir. 2020-01-05 12:49:22 +01:00
varkor 0c2cf07d6e Add backticks to various diagnostics 2020-01-05 00:17:46 +00:00
Vadim Petrochenkov 70f1d57048 Rename `syntax_pos` to `rustc_span` in source code 2020-01-01 09:15:18 +03:00
Mazdak Farrokhzad 63dc0e41db discriminant -> scrutinee 2019-12-30 14:28:40 +01:00
Mazdak Farrokhzad f8d2cce0ce Blame user type in pat type error. 2019-12-30 14:28:40 +01:00
Mazdak Farrokhzad d7e2f3aee5 refactor and fix this-expression-has-type note 2019-12-30 14:05:17 +01:00
Mazdak Farrokhzad e952377ddc MatchExpressionArmPattern -> Pattern
Current name is too specific for incoming changes.
2019-12-30 13:50:20 +01:00
Mazdak Farrokhzad ab050d6a83 MatchExpressionArmPattern: Use more generic wording.
The existing wording was inappropriate for e.g.
`if let Ok(_) = expr { .. }`. The diagnostic would
leak the fact that we desugar to a `match`.
2019-12-30 13:50:20 +01:00
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
bors 26286c7ad0 Auto merge of #66931 - cjgillot:hirene-preamble, r=eddyb
Allocate HIR on an arena 1/4

This PR is the first in a series of 4, aiming at allocating the HIR on an arena, as a memory optimisation.

1. This first PR lays the groundwork and migrates some low-hanging fruits.
2. The second PR will migrate `hir::Expr`, `hir::Pat` and related.
3. The third PR will migrate `hir::Ty` and related.
4. The final PR will be dedicated to eventual cleanups.

In order to make the transition as gradual as possible, some lowering routines receive `Box`-allocated data and move it into the arena. This is a bit wasteful, but hopefully temporary.
Nonetheless, special care should be taken to avoid double arena allocations.

Work mentored by @Zoxc.
2019-12-22 10:30:51 +00:00
Camille GILLOT 5fec1ca0ff Use Arena inside hir::ImplItem. 2019-12-21 23:31:47 +01:00
Camille GILLOT 0f7d77363b Use Arena inside hir::TraitItem. 2019-12-21 23:30:52 +01:00
Camille GILLOT 084e6722f9 Use Arena inside hir::Item. 2019-12-21 23:17:29 +01:00
Matthew Jasper db6d0b1638 Check associated type implementations for generic mismatches 2019-12-20 20:10:07 +00:00
Esteban Küber 252773af8b Deduplicate logic 2019-12-10 12:02:18 -08:00
Aaron Hill 168e35d569
Include a span in more `expected...found` notes
In most places, we use a span when emitting `expected...found` errors.
However, there were a couple of places where we didn't use any span,
resulting in hard-to-interpret error messages.

This commit attaches the relevant span to these notes, and additionally
switches over to using `note_expected_found` instead of manually
formatting the message
2019-12-03 23:13:10 -05: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
Tyler Mandry bb6236cd74
Rollup merge of #66754 - estebank:rustdoc-capitalization, r=Dylan-DPC
Various tweaks to diagnostic output
2019-11-26 17:56:19 -06:00
Esteban Küber 00fe97ad0e Fix capitalization when mentioning different crate versions in E0308 2019-11-25 12:38:45 -08:00
Esteban Küber 9d7774c64f review comments: remove unnecessary `&str` to `String` conversions 2019-11-23 18:45:18 -08:00
Esteban Küber d92355c1db Highlight parts of fn in type errors
When a type error arises between two fn items, fn pointers or tuples,
highlight only the differing parts of each.
2019-11-23 16:50:28 -08:00
bors f11759d38c Auto merge of #66610 - alexreg:trait-upcasting-cosmetic, r=Centril
Aggregation of drive-by cosmetic changes for trait-upcasting PR

Cherry-picked from #60900.

As requested by @Centril (and @nikomatsakis, I believe).

r? @Centril
2019-11-21 21:01:14 +00:00
Alexander Regueiro 51cb60cd3f Aggregation of drive-by cosmetic changes. 2019-11-21 18:50:38 +00:00
Esteban Küber b3517cdee7 review comments 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 83ffda5216 Specific labels when referring to "expected" and "found" types 2019-11-18 11:02:22 -08:00
Guillaume Gomez 798e389e57 Update to use new librustc_error_codes library 2019-11-14 13:05:42 +01:00
Esteban Küber a12a32ab65 review comments 2019-11-06 10:04:23 -08:00
Mazdak Farrokhzad f746d99f68
Rollup merge of #66014 - dkadashev:47319-type-param-def-location, r=estebank
Show type parameter name and definition in type mismatch error messages

Fixes #47319

r? estebank
2019-11-06 03:28:06 +01:00
bors aa51f04073 Auto merge of #65779 - kevgrasso:E0308highlight, r=estebank
Highlight only relevant parts of type path in type errors

Resolves #57413.

Unfortunately the current Rust UI testing setup can't test that the correct colors are being used in a given output, so here's a screenshot of a small test program I wrote:
![image](https://user-images.githubusercontent.com/480789/67530063-f272af00-f68b-11e9-9f96-a211fc7666d4.png)
2019-11-03 08:01:29 +00:00
Dmitry Kadashev 774e60b0c1 Prettify mismatched types error message in a special case
Type parameters are referenced in the error message after the previous
few commits (using span label). But when the main error message already
references the very same type parameter it becomes clumsy. Do not show
the additional label in this case as per code review comment by
@estebank.

Also this contains a small style fix.
2019-11-02 14:55:03 +07:00
Dmitry Kadashev 036f182804 Show type param definitions in type mismatch errors
Fixes #47319.

Shows the type parameter definition(s) on type mismatch errors so the
context is clearer. Pretty much changes the following:

```
LL |     bar1(t);
   |          ^
   |          |
   |          expected enum `std::option::Option`, found type parameter `T`
```

into:

```
LL | fn foo1<T>(t: T) {
   |         - this type parameter
LL |     bar1(t);
   |          ^
   |          |
   |          expected enum `std::option::Option`, found type parameter `T`
```
2019-11-02 12:48:24 +07:00
Kevyn Grasso 2337bbb8a4 only relevant parts of type paths highlighted in E0308 type mismatch error message 2019-10-25 10:20:09 -04:00
Mazdak Farrokhzad a649b1666c
Rollup merge of #65657 - nnethercote:rm-InternedString-properly, r=eddyb
Remove `InternedString`

This PR removes `InternedString` by converting all occurrences to `Symbol`. There are a handful of places that need to use the symbol chars instead of the symbol index, e.g. for stable sorting; local conversions `LocalInternedString` is used in those places.

r? @eddyb
2019-10-23 22:19:19 +02:00
Kevyn Grasso fedefeca6d debug messages added 2019-10-23 12:42:45 -04:00