about summary refs log tree commit diff
path: root/src/librustc/infer/error_reporting.rs
AgeCommit message (Collapse)AuthorLines
2017-02-27Move two large error_reporting fn's to a separate fileCengiz Can-1147/+0
2017-02-25Rollup merge of #39905 - estebank:useless-error, r=arielb1Eduard-Mihai Burtescu-26/+27
Properly display note/expected details Given a file ```rust fn takes_cb(f: fn(i8)) {} fn main() { fn callback(x: i32) {} takes_cb(callback) } ``` output ```rust error[E0308]: mismatched types --> file2.rs:5:22 | 5 | takes_cb(callback) | ^^^^^^^^ expected i8, found i32 | = note: expected type `fn(i8)` found type `fn(i32) {main::callback}` ``` Fix #39343.
2017-02-17remove vestiges of the old suggestion machineryNiko Matsakis-221/+24
2017-02-17Properly display note/expected detailsEsteban Küber-26/+27
2017-02-05make lifetimes that only appear in return type early-boundNiko Matsakis-24/+36
This is the full and proper fix for #32330. This also makes some effort to give a nice error message (as evidenced by the `ui` test), sending users over to the tracking issue for a full explanation.
2017-01-26rustc: Remove all "consider using an explicit lifetime parameter" suggestionsBrian Anderson-714/+4
These give so many incorrect suggestions that having them is detrimental to the user experience. The compiler should not be suggesting changes to the code that are wrong - it is infuriating: not only is the compiler telling you that _you don't understand_ borrowing, _the compiler itself_ appears to not understand borrowing. It does not inspire confidence.
2017-01-26Auto merge of #39309 - eddyb:map-shmap, r=nikomatsakisbors-37/+37
Rename tcx.map to the far more descriptive tcx.hir. Also a bit more renaming because `ast_map` and `'ast` were still used with HIR. Main motivation is to "free up" `tcx.map`, or rather, `tcx.maps`, to consolidate `ty::maps` there. r? @nikomatsakis
2017-01-26rustc: don't call the HIR AST.Eduard-Mihai Burtescu-22/+22
2017-01-26rustc: rename TyCtxt's `map` field to `hir`.Eduard-Mihai Burtescu-16/+16
2017-01-26Update error code numberGuillaume Gomez-1/+1
2017-01-26Add a distinct error code and description for "main function has wrong type"Guillaume Gomez-2/+5
2017-01-04Update for changes to TraitItem on master.Eduard-Mihai Burtescu-3/+3
2017-01-04Don't leak the compiler's internal representation of scopes in error messages.Eduard-Mihai Burtescu-15/+41
2016-12-28rustc: always print nested nodes where a HIR map is available.Eduard-Mihai Burtescu-8/+17
2016-12-28rustc: move function arguments into hir::Body.Eduard-Mihai Burtescu-26/+25
2016-12-28rustc: separate TraitItem from their parent Item, just like ImplItem.Eduard-Mihai Burtescu-1/+1
2016-12-22Refactor how global paths are represented (for both ast and hir).Jeffrey Seyfried-1/+0
2016-11-28rustc: embed path resolutions into the HIR instead of keeping DefMap.Eduard-Mihai Burtescu-1/+2
2016-11-28rustc: desugar UFCS as much as possible during HIR lowering.Eduard Burtescu-7/+4
2016-11-28rustc: encode the optionality of type parameters in HIR paths.Eduard Burtescu-0/+1
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-3/+3
2016-11-15remove TypeOrigin and use ObligationCause insteadNiko Matsakis-16/+59
In general having all these different structs for "origins" is not great, since equating types can cause obligations and vice-versa. I think we should gradually collapse these things. We almost certainly also need to invest a big more energy into the `error_reporting` code to rationalize it: this PR does kind of the minimal effort in that direction.
2016-11-12Rollup merge of #37688 - eddyb:lazy-8, r=petrochenkovEduard-Mihai Burtescu-1/+1
[8/n] rustc: clean up lookup_item_type and remove TypeScheme. _This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37676) | [next]()) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well. If any motivation is unclear, please ask for additional PR description clarifications or code comments._ <hr> * `tcx.tcache` -> `tcx.item_types` * `TypeScheme` (grouping `Ty` and `ty::Generics`) is removed * `tcx.item_types` entries no longer duplicated in `tcx.tables.node_types` * `tcx.lookup_item_type(def_id).ty` -> `tcx.item_type(def_id)` * `tcx.lookup_item_type(def_id).generics` -> `tcx.item_generics(def_id)` * `tcx.lookup_generics(def_id)` -> `tcx.item_generics(def_id)` * `tcx.lookup_{super_,}predicates(def_id)` -> `tcx.item_{super_,}predicates(def_id)`
2016-11-10Don't hint to add lifetime on trait implEsteban Küber-14/+21
Don't provide hint to add lifetime on impl items that implement a trait. ```rust use std::str::FromStr; pub struct Foo<'a> { field: &'a str, } impl<'a> FromStr for Foo<'a> { type Err = (); fn from_str(path: &str) -> Result<Self, ()> { Ok(Foo { field: path }) } } ``` would give the following hint: ```nocode help: consider using an explicit lifetime parameter as shown: fn from_str(path: &'a str) -> Result<Self, ()> --> <anon>:9:5 | 9 | fn from_str(path: &str) -> Result<Self, ()> { | ^ ``` which is never correct, since then there will be a lifetime mismatch between the impl and the trait. Remove this hint for impl items that implement a trait.
2016-11-10rustc: clean up lookup_item_type and remove TypeScheme.Eduard Burtescu-1/+1
2016-11-01pacify the mercilous tidyNiko Matsakis-12/+18
2016-11-01compare-method lintNiko Matsakis-4/+7
2016-11-01cleanup error reporting and add `ui` testsNiko Matsakis-24/+66
2016-10-31Changed most vec! invocations to use square bracesiirelu-2/+2
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-10-19Rollup merge of #37117 - pnkfelix:may-dangle-attr, r=nikomatsakisEduard-Mihai Burtescu-5/+9
`#[may_dangle]` attribute `#[may_dangle]` attribute Second step of #34761. Last big hurdle before we can work in earnest towards Allocator integration (#32838) Note: I am not clear if this is *also* a syntax-breaking change that needs to be part of a breaking-batch.
2016-10-17Review feedback: add linebreak and reindent to make braces match better.Felix S. Klock II-3/+4
2016-10-15Remove FIXMEJohn Firebaugh-1/+0
2016-10-11Thread `pure_wrt_drop` field through lifetime and type parameters.Felix S. Klock II-4/+7
2016-10-03Continue to use struct_span_err! macroJohn Firebaugh-5/+11
2016-10-02Use a distinct error code for "if may be missing an else clause"John Firebaugh-4/+4
Introduce the possibility of assigning distinct error codes to the various origin types of E0308. Start by assigning E0317 for the "IfExpressionWithNoElse" case, and write a long diagnostic specific to this case. Fixes #36596
2016-09-28Call arrays "arrays" instead of "vecs" internallyJonas Schievink-5/+5
2016-09-15Specify when type parameter shadows primitive typeEsteban Küber-1/+12
When a type parameter shadows a primitive type, the error message was non obvious. For example, given the file `file.rs`: ```rust trait Parser<T> { fn parse(text: &str) -> Option<T>; } impl<bool> Parser<bool> for bool { fn parse(text: &str) -> Option<bool> { Some(true) } } fn main() { println!("{}", bool::parse("ok").unwrap_or(false)); } ``` The output was: ```bash % rustc file.rs error[E0308]: mismatched types --> file.rs:7:14 | 7 | Some(true) | ^^^^ expected type parameter, found bool | = note: expected type `bool` = note: found type `bool` error: aborting due to previous error ``` We now show extra information about the type: ```bash % rustc file.rs error[E0308]: mismatched types --> file.rs:7:14 | 7 | Some(true) | ^^^^ expected type parameter, found bool | = note: expected type `bool` (type parameter) = note: found type `bool` (bool) error: aborting due to previous error ``` Fixes #35030
2016-09-08Refactor `TyStruct`/`TyEnum`/`TyUnion` into `TyAdt`Vadim Petrochenkov-4/+1
2016-09-04Replace `_, _` with `..`Vadim Petrochenkov-3/+3
2016-09-04Replace `_, _, _` with `..`Vadim Petrochenkov-2/+2
2016-09-03Some better support for unions through the compilerVadim Petrochenkov-1/+3
2016-08-28Rollup merge of #35480 - KiChjang:e0379-bonus, r=nikomatsakisJeffrey Seyfried-1/+2
Move E0379 check from typeck to ast validation Part of #35233. Extension of #35338, #35364. Fixes #35404.
2016-08-28Rollup merge of #35591 - GuillaumeGomez:generics_span, r=jntrmrJeffrey Seyfried-0/+1
Add Span field for Generics structs
2016-08-27Change Constness to Spanned<Constness>Keith Yeung-1/+2
2016-08-27rustc: pass ty::Region behind an interned 'tcx reference.Eduard Burtescu-11/+11
2016-08-18Add Span field for Generics structsGuillaume Gomez-0/+1
2016-08-17Display secondary span for E0053 for Sort TypeErrorsKeith Yeung-1/+5
2016-08-17rustc: split Generics of a method from its parent Generics.Eduard Burtescu-2/+1
2016-08-17rustc: reduce Substs and Generics to a simple immutable API.Eduard Burtescu-1/+1
2016-08-13Remove obsolete divergence related stuffAndrew Cann-1/+0
Replace FnOutput with Ty Replace FnConverging(ty) with ty Purge FnDiverging, FunctionRetTy::NoReturn and FunctionRetTy::None