summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/astconv
AgeCommit message (Collapse)AuthorLines
2023-10-30Auto merge of #116405 - estebank:issue-103155, r=davidtwcobors-9/+40
Detect object safety errors when assoc type is missing When an associated type with GATs isn't specified in a `dyn Trait`, emit an object safety error instead of only complaining about the missing associated type, as it will lead the user down a path of three different errors before letting them know that what they were trying to do is impossible to begin with. Fix #103155.
2023-10-30Sort errorsEsteban Küber-4/+6
2023-10-30Detect object safety errors when assoc type is missingEsteban Küber-10/+39
When an associated type with GATs isn't specified in a `dyn Trait`, emit an object safety error instead of only complaining about the missing associated type, as it will lead the user down a path of three different errors before letting them know that what they were trying to do is impossible to begin with. Fix #103155.
2023-10-30Improve some diagnostics around `?Trait` boundsOli Scherer-26/+31
2023-10-26Deny providing explicit effect paramsDeadbeef-3/+13
2023-10-18AliasTy::new instead of tcx methodlcnr-4/+4
2023-10-17Unify suggestion wordingEsteban Küber-2/+2
2023-10-17Auto merge of #116756 - fee1-dead-contrib:dupe-those-bounds, r=oli-obkbors-1/+33
Duplicate `~const` bounds with a non-const one in effects desugaring This should unblock #116058. r? `@oli-obk`
2023-10-16Rollup merge of #116257 - estebank:issue-101351, r=b-naberMatthias Krüger-15/+63
Suggest trait bounds for used associated type on type param Fix #101351. When an associated type on a type parameter is used, and the type parameter isn't constrained by the correct trait, suggest the appropriate trait bound: ``` error[E0220]: associated type `Associated` not found for `T` --> file.rs:6:15 | 6 | field: T::Associated, | ^^^^^^^^^^ there is a similarly named associated type `Associated` in the trait `Foo` | help: consider restricting type parameter `T` | 5 | struct Generic<T: Foo> { | +++++ ``` When an associated type on a type parameter has a typo, suggest fixing it: ``` error[E0220]: associated type `Baa` not found for `T` --> $DIR/issue-55673.rs:9:8 | LL | T::Baa: std::fmt::Debug, | ^^^ there is a similarly named associated type `Bar` in the trait `Foo` | help: change the associated type name to use `Bar` from `Foo` | LL | T::Bar: std::fmt::Debug, | ~~~ ```
2023-10-15Duplicate `~const` bounds with a non-const one in effects desugaringDeadbeef-1/+33
2023-10-13Tweak wordingEsteban Küber-1/+2
2023-10-13Suggest trait bounds for used associated type on type paramEsteban Küber-15/+62
Fix #101351. When an associated type on a type parameter is used, and the type parameter isn't constrained by the correct trait, suggest the appropriate trait bound: ``` error[E0220]: associated type `Associated` not found for `T` --> file.rs:6:15 | 6 | field: T::Associated, | ^^^^^^^^^^ there is a similarly named associated type `Associated` in the trait `Foo` | help: consider restricting type parameter `T` | 5 | struct Generic<T: Foo> { | +++++ ``` When an associated type on a type parameter has a typo, suggest fixing it: ``` error[E0220]: associated type `Baa` not found for `T` --> $DIR/issue-55673.rs:9:8 | LL | T::Baa: std::fmt::Debug, | ^^^ there is a similarly named associated type `Bar` in the trait `Foo` | help: change the associated type name to use `Bar` from `Foo` | LL | T::Bar: std::fmt::Debug, | ~~~ ```
2023-10-13Format all the let chains in compilerMichael Goulet-22/+41
2023-10-09Fix suggestion span involving wrongly placed generic arg on enum variantsGurinder Singh-3/+5
When the variant and the (wrongly placed) args are at separate source locations such as being in different macos or one in a macro and the other somwhere outside of it, the arg spans we computed spanned the entire distance between such locations and were hence invalid. .
2023-09-27Auto merge of #116163 - compiler-errors:lazyness, r=oli-obkbors-12/+5
Don't store lazyness in `DefKind::TyAlias` 1. Don't store lazyness of a type alias in its `DefKind`, but instead via a query. 2. This allows us to treat type aliases as lazy if `#[feature(lazy_type_alias)]` *OR* if the alias contains a TAIT, rather than having checks for both in separate parts of the codebase. r? `@oli-obk` cc `@fmease`
2023-09-26subst -> instantiatelcnr-11/+12
2023-09-26Don't store lazyness in DefKindMichael Goulet-12/+5
2023-09-24Remove span from BrAnon.Camille GILLOT-2/+2
2023-09-20Auto merge of #115486 - compiler-errors:dont-capture-late-pls, r=cjgillotbors-3/+1
Correctly deny late-bound lifetimes from parent in anon consts and TAITs Reuse the `AnonConstBoundary` scope (introduced in #108553, renamed in this PR to `LateBoundary`) to deny late-bound vars of *all* kinds (ty/const/lifetime) in anon consts and TAITs. Side-note, but I would like to consolidate this with the error reporting for RPITs (E0657): https://github.com/rust-lang/rust/blob/c4f25777a08cd64b710e8a9a6159e67cbb35e6f5/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs#L733-L754 but the semantics about what we're allowed to capture there are slightly different, so I'm leaving that untouched. Fixes #115474
2023-09-11Rollup merge of #115727 - fee1-dead-contrib:effect-fallback, r=oli-obkMatthias Krüger-1/+1
Implement fallback for effect param r? `@oli-obk` or `@lcnr` tracking issue for this ongoing work: https://github.com/rust-lang/rust/issues/110395
2023-09-11add `is_host_effect` to `GenericParamDefKind::Const` and address reviewDeadbeef-1/+1
2023-09-08E0220: only suggests associated types if there's only one candidateLieselotte-25/+19
2023-09-08Improve "associated type not found" diagnosticsLieselotte-11/+42
2023-09-05Correctly deny late-bound lifetimes from parent in anon consts and TAITsMichael Goulet-3/+1
2023-09-01Don't manually walk through param indices when adding implicit Sized and ↵Michael Goulet-21/+52
ConstParamHasTy
2023-08-30Permit recursive weak type aliasesOli Scherer-7/+12
2023-08-22Do not emit invalid suggestion in E0191 when spans overlapEsteban Küber-1/+15
Fix #115019.
2023-08-11Don't add associated type bound for non-typesMichael Goulet-10/+19
2023-08-08Auto merge of #114545 - fee1-dead-contrib:lower-impl-effect, r=oli-obkbors-7/+5
correctly lower `impl const` to bind to host effect param r? `@oli-obk`
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-8/+10
2023-08-06lower impl const to bind to host effect paramDeadbeef-7/+5
2023-08-02Remove constness from `TraitPredicate`Deadbeef-11/+6
2023-08-01Fix a commentMichael Goulet-1/+1
2023-07-25inline format!() args from rustc_codegen_llvm to the end (4)Matthias Krüger-14/+14
r? @WaffleLapkin
2023-07-19Make it clearer that edition functions are >=, not ==Michael Goulet-1/+1
2023-07-14Rollup merge of #113698 - compiler-errors:rpitit-check, r=spastorinoMatthias Krüger-3/+3
Make it clearer that we're just checking for an RPITIT Tiny nit to use `is_impl_trait_in_trait` more, to make it clearer that we're just checking whether a def-id is an RPITIT, rather than doing something meaningful with the `opt_rpitit_info`. r? `@spastorino`
2023-07-14Make it clearer that we're just checking for an RPITITMichael Goulet-3/+3
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-124/+131
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-45/+61
2023-07-08Replace RPITIT current impl with new strategy that lowers as a GATSantiago Pastorino-2/+2
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-47/+48
2023-07-05Only use a single loop over the associated typesOli Scherer-5/+2
2023-07-05Prefer `retain` over hand-rolling an inefficient version of itOli Scherer-7/+3
2023-07-05tidy: move a large function out of an even larger fileOli Scherer-406/+418
2023-07-05Lint now-unnecessary associated type boundsOli Scherer-3/+21
2023-07-05Don't require associated types with `Self: Sized` bounds in `dyn Trait` objectsOli Scherer-0/+10
2023-07-04Replace `const_error` methods with `Const::new_error`Boxy-10/+10
2023-07-04Replace `mk_const` with `Const::new_x` methodsBoxy-6/+6
2023-07-03remove TypeWellFormedFromEnvMichael Goulet-2/+1
2023-07-03Don't perform selection if IATs are not enabledLeón Orell Valerian Liehr-5/+9