Commit Graph

31 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 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
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05: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
Guillaume Gomez 798e389e57 Update to use new librustc_error_codes library 2019-11-14 13:05:42 +01:00
Nicholas Nethercote 7f0637da51 Shrink `SubregionOrigin`.
It's currently 120 bytes on x86-64, due to one oversized variant
(`Subtype`). This commit boxes `Subtype`'s contents, reducing the size
of `SubregionOrigin` to 32 bytes.

The change speeds things up by avoiding lots of `memcpy` calls, mostly
relating to `RegionConstraintData::constraints`, which is a `BTreeMap`
with `SubregionOrigin` values.
2019-09-12 13:36:01 +10:00
ljedrz 98cc18a5db rename hir::map::name_by_hir_id to ::name 2019-06-20 12:47:26 +02:00
ljedrz f6eb39203b replace NodeId with HirId in infer::SubregionOrigin 2019-06-20 12:47:25 +02:00
Eduard-Mihai Burtescu f3f9d6dfd9 Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
Eduard-Mihai Burtescu 8d9f4a128c rustc: rename all occurences of "freevar" to "upvar". 2019-05-05 18:49:32 +03:00
Taiki Endo 3216c7656a Rename rustc_errors dependency in rust 2018 crates 2019-02-13 00:28:52 +09:00
bors c3d2490433 Auto merge of #58151 - ljedrz:HirIdify_rustc, r=Zoxc
Partially HirId-ify rustc

Another step towards https://github.com/rust-lang/rust/pull/57578.
2019-02-10 14:30:37 +00:00
ljedrz 8d6e5fc20f rustc: partially HirIdify 2019-02-05 20:26:24 +01:00
Mark Mansi e957ed9d10 move librustc to 2018 2019-02-05 12:45:47 -06:00
Niko Matsakis bc4404c0b5 improve handling for subtype
Still not great, but good enough to land this PR.
2019-01-02 17:35:06 -05:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
John Kåre Alsaker a70babed03 Use a function to access the Hir map to be able to turn it into a query later 2018-12-06 17:24:36 +01:00
Blitzerr 6779bb485c capture_disjoint_fields(rust-lang#53488)
Refactoring out the HirId of the UpvarId in another struct.
2018-11-14 21:18:48 -08:00
Zack M. Davis 5b22d9b2ca don't elide lifetimes in paths in librustc/
This seemed like a good way to kick the tires on the
elided-lifetimes-in-paths lint (#52069)—seems to work! This was also
pretty tedious—it sure would be nice if `cargo fix` worked on this
codebase (#53896)!
2018-09-29 21:48:29 -07:00
Esteban Küber ee06559576 Tweak presentation on lifetime trait mismatch 2018-01-26 16:38:07 -08:00
Niko Matsakis 0d78e40e88 convert EXTRA_REQUIREMENT_IN_IMPL into a hard error
cc #37166
2017-11-15 16:49:21 -05:00
Eduard-Mihai Burtescu da0a47a081 Use NodeId/HirId instead of DefId for local variables. 2017-09-08 22:00:59 +03:00
Eduard-Mihai Burtescu 8bdfd8a003 rustc: rename CodeExtent to Scope and RegionMaps to ScopeTree. 2017-09-01 23:27:48 +03:00
Eduard-Mihai Burtescu ea6aca7726 rustc: take TyCtxt and RegionMaps in CodeMap::span. 2017-09-01 11:17:03 +03:00
Michael Woerister 4dcc3a4aae Use DefIndex instead of NodeId in UpvarId. 2017-08-11 12:11:38 +02:00
Guillaume Gomez cc4afe0f65 Improve E0477 error message 2017-05-09 20:51:18 +02:00
Niko Matsakis c7dc39dbf0 intern CodeExtents
Make a `CodeExtent<'tcx>` be something allocated in an arena
instead of an index into the `RegionMaps`.
2017-04-30 17:02:59 -04:00
Esteban Küber 2389830dea Highlight and simplify mismatched types
Shorten mismatched types errors by replacing subtypes that are not
different with `_`, and highlighting only the subtypes that are
different.

Given a file

```rust
struct X<T1, T2> {
    x: T1,
    y: T2,
}

fn foo() -> X<X<String, String>, String> {
    X { x: X {x: "".to_string(), y: 2}, y: "".to_string()}
}

fn bar() -> Option<String> {
    "".to_string()
}
```

provide the following output

```rust
error[E0308]: mismatched types
  --> file.rs:6:5
   |
 6 |     X { x: X {x: "".to_string(), y: 2}, y: "".to_string()}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found {integer}
   |
   = note: expected type `X<X<_, std::string::String>, _>`
                                 ^^^^^^^^^^^^^^^^^^^   // < highlighted
              found type `X<X<_, {integer}>, _>`
                                 ^^^^^^^^^             // < highlighted

error[E0308]: mismatched types
  --> file.rs:6:5
   |
10 |     "".to_string()
   |     ^^^^^^^^^^^^^^ expected struct `std::option::Option`, found `std::string::String`
   |
   = note: expected type `Option<std::string::String>`
                          ^^^^^^^                   ^  // < highlighted
              found type `std::string::String`
```
2017-04-11 15:45:00 -07:00
Cengiz Can e136bf6a4c Format note.rs with rustfmt 2017-02-27 22:30:47 +03:00
Cengiz Can 2f8ef50f7d Lower moved fn's visibility to supermodule 2017-02-27 22:23:00 +03:00
Cengiz Can d21b0e35e7 Move two large error_reporting fn's to a separate file 2017-02-27 22:09:13 +03:00