about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/diagnostics.rs
AgeCommit message (Collapse)AuthorLines
2023-03-06Place binder correctly for arbitrary trait bound suggestionMichael Goulet-2/+2
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-3/+3
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-22Auto merge of #108340 - eggyal:remove_traversal_trait_aliases, r=oli-obkbors-5/+4
Remove type-traversal trait aliases #107924 moved the type traversal (folding and visiting) traits into the type library, but created trait aliases in `rustc_middle` to minimise both the API churn for trait consumers and the arising boilerplate. As mentioned in that PR, an alternative approach of defining subtraits with blanket implementations of the respective supertraits was also considered at that time but was ruled out as not adding much value. Unfortunately, it has since emerged that rust-analyzer has difficulty with these trait aliases at present, resulting in a degraded contributor experience (see the recent [r-a has become useless](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/r-a.20has.20become.20useless) topic on the #t-compiler/help Zulip stream). This PR removes the trait aliases, and accordingly the underlying type library traits are now used directly; they are parameterised by `TyCtxt<'tcx>` rather than just the `'tcx` lifetime, and imports have been updated to reflect the fact that the trait aliases' explicitly named traits are no longer automatically brought into scope. These changes also roll-back the (no-longer required) workarounds to #107747 that were made in b409329c624b9e3bbd7d8e07697e2e9f861a45b6. Since this PR is just a find+replace together with the changes necessary for compilation & tidy to pass, it's currently just one mega-commit. Let me know if you'd like it broken up. r? `@oli-obk`
2023-02-22Remove type-traversal trait aliasesAlan Egerton-5/+4
2023-02-22errors: generate typed identifiers in each crateDavid Wood-0/+8
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-2/+2
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-2/+4
2023-02-13Rename folder traits' `tcx` method to `interner`Alan Egerton-1/+1
2023-02-13Make folding traits generic over the InternerAlan Egerton-1/+1
2023-02-13Make visiting traits generic over the InternerAlan Egerton-1/+1
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-3/+4
2023-02-06Modify existing bounds if they existEdward Shen-1/+14
2023-02-03Make const/fn return params more suggestableMichael Goulet-4/+91
2023-01-18Rollup merge of #106753 - compiler-errors:rpitit-not-suggestable, r=spastorinoMichael Goulet-5/+12
Make sure that RPITITs are not considered suggestable Makes no sense to suggest `where impl Future<Output = ()>: Send`, for example.
2023-01-16Improve a TAIT error and add an error code plus documentationOli Scherer-1/+1
2023-01-12RPITITs are not suggestableMichael Goulet-5/+12
2022-12-15Rollup merge of #105627 - compiler-errors:dyn-auto-suggestable, r=davidtwcoMatthias Krüger-13/+2
Auto traits in `dyn Trait + Auto` are suggestable Not sure why I had made the `IsSuggestableVisitor` have that rule to not consider `dyn Trait + Auto` to be suggestable. It's possible that this was done because of the fact that we don't print the right parentheses for `&(dyn Trait + Auto)`, but that's a problem with printing these types in general that we probably have tracked somewhere else...
2022-12-14Auto traits in dyn are suggestableMichael Goulet-13/+2
2022-12-14Ensure no one constructs `AliasTy`s themselvesOli Scherer-2/+2
2022-12-13Combine projection and opaque into aliasMichael Goulet-3/+3
2022-12-13squash OpaqueTy and ProjectionTy into AliasTyMichael Goulet-4/+4
2022-12-13Use ty::OpaqueTy everywhereMichael Goulet-5/+5
2022-11-30Rollup merge of #104895 - chenyukang:yukang/fix-104884-serde, r=TaKO8KiMatthias Krüger-0/+6
Avoid Invalid code suggested when encountering unsatisfied trait bounds in derive macro code Fixes #104884
2022-11-29fix #104884, Avoid Invalid code suggested when encountering unsatisfied ↵yukang-0/+6
trait bounds in derive macro code
2022-11-23Separate lifetime ident from resolution in HIR.Camille GILLOT-4/+3
2022-11-21Match crate and slug namesmejrs-8/+0
2022-11-13Store a LocalDefId in hir::GenericParam.Camille GILLOT-7/+4
2022-10-23Migrate all diagnosticsNilstrieb-1/+1
2022-10-07Move ReverseMapper logic onto OpaqueHiddenTypeOli Scherer-0/+8
2022-09-12Plumb dyn trait representation through ty::DynamicEric Holk-1/+1
2022-09-09Handle generic parameters.Camille GILLOT-1/+1
2022-09-08Adjust spacing in suggestion, add a testMichael Goulet-2/+2
2022-09-08Add associated item binding to non-param-ty where clause suggestionsMichael Goulet-1/+13
2022-07-22Don't suggest unnameable generic argumentsLeón Orell Valerian Liehr-5/+13
2022-07-06Update TypeVisitor pathsAlan Egerton-2/+2
2022-07-05Relax constrained generics to TypeVisitableAlan Egerton-3/+3
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-1/+1
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
2022-06-11Address commentsMichael Goulet-17/+17
2022-06-11Make is_suggestable work on all TypeFoldableMichael Goulet-14/+47
2022-06-11Handle empty where-clause betterMichael Goulet-9/+4
2022-06-11Make Ty::is_suggestable use a visitorMichael Goulet-69/+69
2022-06-02On E0204 suggest missing type param boundsEsteban Küber-1/+4
``` error[E0204]: the trait `Copy` may not be implemented for this type --> f42.rs:9:17 | 9 | #[derive(Debug, Copy, Clone)] | ^^^^ 10 | pub struct AABB<K>{ 11 | pub loc: Vector2<K>, | ------------------- this field does not implement `Copy` 12 | pub size: Vector2<K> | -------------------- this field does not implement `Copy` | note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:11:5 | 11 | pub loc: Vector2<K>, | ^^^^^^^^^^^^^^^^^^^ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:12:5 | 12 | pub size: Vector2<K> | ^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `K` | 10 | pub struct AABB<K: Debug>{ | +++++++ ``` Fix #89137.
2022-05-28Move things to rustc_type_irWilco Kusee-1/+1
2022-05-02rustc: Panic by default in `DefIdTree::parent`Vadim Petrochenkov-1/+1
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root. So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root. Same applies to `local_parent`/`opt_local_parent`.
2022-04-30Save colon span to suggest bounds.Camille GILLOT-0/+13
2022-04-30Store all generic bounds as where predicates.Camille GILLOT-239/+95
2022-04-30Inline WhereClause into Generics.Camille GILLOT-23/+14
2022-04-26TAITs are suggestableMichael Goulet-14/+24
2022-04-12Fix wrong suggestions for `T:`Maybe Waffle-7/+28
This commit fixes a corner case in `suggest_constraining_type_params` that was causing incorrect suggestions. For the following functions: ```rust fn a<T:>(t: T) { [t, t]; } fn b<T>(t: T) where T: { [t, t]; } ``` We previously suggested the following: ```text ... help: consider restricting type parameter `T` | 1 | fn a<T: Copy:>(t: T) { [t, t]; } | ++++++ ... help: consider further restricting this bound | 2 | fn b<T>(t: T) where T: + Copy { [t, t]; } | ++++++ ``` Note that neither `T: Copy:` not `where T: + Copy` is a correct bound. With this commit the suggestions are correct: ```text ... help: consider restricting type parameter `T` | 1 | fn a<T: Copy>(t: T) { [t, t]; } | ++++ ... help: consider further restricting this bound | 2 | fn b<T>(t: T) where T: Copy { [t, t]; } | ++++ ```
2022-04-05macros: add args for non-subdiagnostic fieldsDavid Wood-1/+7
Non-subdiagnostic fields (i.e. those that don't have `#[label]` attributes or similar and are just additional context) have to be added as arguments for Fluent messages to refer them. This commit extends the `SessionDiagnostic` derive to do this for all fields that do not have attributes and introduces an `IntoDiagnosticArg` trait that is implemented on all types that can be converted to a argument for Fluent. Signed-off-by: David Wood <david.wood@huawei.com>