summary refs log tree commit diff
path: root/src/librustc/ty/error.rs
AgeCommit message (Collapse)AuthorLines
2016-09-15Specify when type parameter shadows primitive typeEsteban Küber-1/+1
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-7/+1
2016-09-03Add union typesVadim Petrochenkov-0/+3
2016-08-27rustc: pass ty::Region behind an interned 'tcx reference.Eduard Burtescu-6/+6
2016-08-19wording fixes in error messagesJonathan Turner-2/+2
2016-08-17rustc: remove SelfSpace from ParamSpace.Eduard Burtescu-2/+1
2016-08-17rustc: move trait objects from TraitRef to ExistentialTraitRef.Eduard Burtescu-1/+1
2016-08-16Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakisbors-1/+1
Implement the `!` type This implements the never type (`!`) and hides it behind the feature gate `#[feature(never_type)]`. With the feature gate off, things should build as normal (although some error messages may be different). With the gate on, `!` is usable as a type and diverging type variables (ie. types that are unconstrained by anything in the code) will default to `!` instead of `()`.
2016-08-14Rollup merge of #35611 - jonathandturner:ptr-helper, r=nikomatsakisEduard-Mihai Burtescu-1/+18
Improve &-ptr printing This PR replaces printing `&-ptr` with a more readable description. To do so it uses a few heuristics. If the name of the type is unknown, too long (longer than just saying "reference"), or too complex (a type with explicit lifetime annotations), it will instead opt to print either "reference" or "mutable reference", depending on the mutability of the type. Before: ``` error[E0308]: mismatched types --> src/test/compile-fail/issue-7061.rs:14:46 | 14 | fn foo(&'a mut self) -> Box<BarStruct> { self } | ^^^^ expected box, found &-ptr | = note: expected type `Box<BarStruct>` = note: found type `&'a mut BarStruct` error: aborting due to previous error ``` After: ``` error[E0308]: mismatched types --> src/test/compile-fail/issue-7061.rs:14:46 | 14 | fn foo(&'a mut self) -> Box<BarStruct> { self } | ^^^^ expected box, found mutable reference | = note: expected type `Box<BarStruct>` = note: found type `&'a mut BarStruct` error: aborting due to previous error ```
2016-08-13Rename empty/bang to neverAndrew Cann-1/+1
Split Ty::is_empty method into is_never and is_uninhabited
2016-08-13Start implementation of RFC 1216 (make ! a type)Andrew Cann-1/+1
Add `TyKind::Empty` and fix resulting build errors.
2016-08-11Improve &-ptr printingJonathan Turner-1/+18
2016-08-12rustc: add TyAnon (impl Trait) to the typesystem.Eduard Burtescu-0/+1
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-2/+2
2016-05-11rustc: Generalize a minimum set of functions over 'tcx != 'gcx.Eduard Burtescu-3/+3
2016-05-11rustc: Split 'tcx into 'gcx and 'tcx for InferCtxt and its users.Eduard Burtescu-3/+3
2016-05-11rustc: Replace &'a TyCtxt<'tcx> with a TyCtxt<'a, 'tcx> wrapper.Eduard Burtescu-3/+3
2016-05-11rustc: Always refer to TyCtxt as tcx.Eduard Burtescu-4/+4
2016-04-06rustc: move middle::{def,def_id,pat_util} to hir.Eduard Burtescu-1/+1
2016-04-06rustc: move rustc_front to rustc::hir.Eduard Burtescu-1/+1
2016-03-27rustc: move cfg, infer, traits and ty from middle to top-level.Eduard Burtescu-0/+343