about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
AgeCommit message (Collapse)AuthorLines
2022-12-08Move has_structural_eq_impls provider to rustc_ty_utilsMichael Goulet-49/+0
2022-12-07Rollup merge of #105400 - BoxyUwU:braced_param_evaluatability, r=oli-obkMatthias Krüger-1/+1
normalize before handling simple checks for evaluatability of `ty::Const` `{{{{{{{ N }}}}}}}` is desugared into a `ConstKind::Unevaluated` for an anonymous `const` item so when calling `is_const_evaluatable` on it we skip the `ConstKind::Param(_) => Ok(())` arm which is incorrect.
2022-12-06normalize before matching on `ConstKind`Boxy-1/+1
2022-12-06typo :(Boxy-1/+1
2022-12-06Rollup merge of #105342 - compiler-errors:note_cause_code-takes-predicate, ↵Matthias Krüger-50/+81
r=fee1-dead Make `note_obligation_cause_code` take a `impl ToPredicate` for predicate The only usecase that wasn't `impl ToPredicate` was noting overflow errors while revealing opaque types, which passed in an `Obligation<'tcx, Ty<'tcx>>`... Since this only happens in a `RevealAll` environment, which is after typeck (and probably primarily within `normalize_erasing_regions`) we're unlikely to display anything useful while noting this code, evidenced by the lack of UI test changes.
2022-12-06Rollup merge of #105340 - estebank:ice-ice-baby, r=compiler-errorsMatthias Krüger-1/+1
Avoid ICE by accounting for missing type Fix #105330
2022-12-06Rollup merge of #105339 - BoxyUwU:wf_ct_kind_expr, r=TaKO8KiMatthias Krüger-20/+57
support `ConstKind::Expr` in `is_const_evaluatable` and `WfPredicates::compute` Fixes #105205 Currently we haven't implemented a way to evaluate `ConstKind::Expr(Expr::Binop(Add, 1, 2))` so I just left that with a `FIXME` and a `delay_span_bug` since I have no idea how to do that and it would make this a much larger (and more complicated) PR :P
2022-12-05Avoid ICE by accounting for missing typeEsteban Küber-1/+1
Fix #105330
2022-12-06Rollup merge of #105338 - estebank:other-impls, r=compiler-errorsYuki Okushi-2/+10
Tweak "the following other types implement trait" When *any* of the suggested impls is an exact match, *only* show the exact matches. This is particularly relevant for integer types. r? `@compiler-errors`
2022-12-06Rollup merge of #105324 - compiler-errors:gat-where-clause-binding-obl, ↵Yuki Okushi-5/+25
r=jackh726 Point at GAT `where` clause when an obligation is unsatisfied Slightly helps with #105306
2022-12-06Avoid noting cause code (which is usually misc, b/c codegen) for opaque type ↵Michael Goulet-49/+80
reveal overflow
2022-12-06drive-by: Default param for ToPredicateMichael Goulet-1/+1
2022-12-05support `Expr` in `is_const_evaluatable` and `compute`Boxy-20/+57
2022-12-05Tweak "the following other types implement trait"Esteban Küber-2/+10
When *any* of the suggested impls is an exact match, *only* show the exact matches. This is particularly relevant for integer types. fix fmt
2022-12-05Point at GAT where clause when unsatisfiedMichael Goulet-5/+25
2022-12-05Don't call diagnostic_hir_wf_check query if we have infer variablesMichael Goulet-0/+1
2022-12-05Auto merge of #104920 - compiler-errors:avoid-infcx-build, r=jackh726bors-10/+6
Avoid some `InferCtxt::build` calls Either because we're inside of an `InferCtxt` already, or because we're not in a place where we'd ever see inference vars. r? types
2022-12-04Auto merge of #105094 - Swatinem:generator-not-future, r=compiler-errorsbors-1/+5
Make sure async constructs do not `impl Generator` Async lowering turns async functions and blocks into generators internally. Though these special kinds of generators should not `impl Generator` themselves. The other way around, normal generators should not `impl Future`. This was discovered in https://github.com/rust-lang/rust/pull/105082#issuecomment-1332210907 and is a regression from https://github.com/rust-lang/rust/pull/104321. r? `@compiler-errors`
2022-12-04Avoid InferCtxt::build in report_similar_impl_candidatesMichael Goulet-10/+6
2022-12-03Rollup merge of #104199 - SarthakSingh31:issue-97417-1, r=cjgillotMatthias Krüger-20/+15
Keep track of the start of the argument block of a closure This removes a call to `tcx.sess.source_map()` from [compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs](https://github.com/rust-lang/rust/compare/master...SarthakSingh31:issue-97417-1?expand=1#diff-8406bbc0d0b43d84c91b1933305df896ecdba0d1f9269e6744f13d87a2ab268a) as required by #97417. VsCode automatically applied `rustfmt` to the files I edited under `src/tools`. I can undo that if its a problem. r? `@cjgillot`
2022-12-03Rollup merge of #105181 - bhbs:skip-note, r=estebankYuki Okushi-15/+20
Don't add a note for implementing a trait if its inner type is erroneous Fix #105138
2022-12-03Rollup merge of #104903 - ↵Yuki Okushi-21/+48
spastorino:consolidate-normalize-in-report_projection_error, r=lcnr Use ocx.normalize in report_projection_error r? `@lcnr` cc `@compiler-errors`
2022-12-03Don't add a note for implementing a trait if its inner type is erroneousbhbs-15/+20
2022-12-02Define values and err as non mutableSantiago Pastorino-7/+7
2022-12-02Use ocx.normalize in report_projection_errorSantiago Pastorino-17/+44
2022-12-01Document normalization methods on AtMichael Goulet-38/+20
2022-11-30Make sure async constructs do not `impl Generator`Arpad Borsos-1/+5
Async lowering turns async functions and blocks into generators internally. Though these special kinds of generators should not `impl Generator` themselves. The other way around, normal generators should not `impl Future`.
2022-11-30Auto merge of #104905 - compiler-errors:normalization-changes, r=spastorinobors-73/+51
Some initial normalization method changes 1. Rename `AtExt::normalize` to `QueryNormalizeExt::query_normalize` (using the `QueryNormalizer`) 2. Introduce `NormalizeExt::normalize` to replace `partially_normalize_associated_types_in` (using the `AssocTypeNormalizer`) 3. Rename `FnCtxt::normalize_associated_types_in` to `FnCtxt::normalize` 4. Remove some unused other normalization fns in `Inherited` and `FnCtxt` Also includes one drive-by where we're no longer creating a `FnCtxt` inside of `check_fn`, but passing it in. This means we don't need such weird `FnCtxt` construction logic. Stacked on top of #104835 for convenience. r? types
2022-11-29Rollup merge of #105066 - lcnr:mv-candidate_from_obligation, r=compiler-errorsMatthias Krüger-210/+207
move `candidate_from_obligation` out of assembly it doesn't belong there as it also does winnowing r? `@compiler-errors`
2022-11-29move `candidate_from_obligation` out of assemblylcnr-210/+207
it doesn't belong there as it also does winnowing
2022-11-29Explain why rematch_impl fails to be infallibleMichael Goulet-0/+7
2022-11-29Auto merge of #105012 - WaffleLapkin:into, r=oli-obkbors-4/+2
Make `tcx.mk_const` more permissive wrt `kind` argument (`impl Into`) r? `@oli-obk` you've asked for this >:)
2022-11-29Rollup merge of #104959 - compiler-errors:revert-104269, r=lcnrMatthias Krüger-6/+4
Revert #104269 (to avoid spurious hang/test failure in CI) Causes hangs/memory overflows in the test suite apparently :cry: Reopens #104225 Fixes #104957 r? ``@lcnr``
2022-11-28Simplify checking for `GeneratorKind::Async`Arpad Borsos-12/+3
Adds a helper method around `generator_kind` that makes matching async constructs simpler.
2022-11-28Make ObligationCtxt::normalize take cause by borrowMichael Goulet-8/+7
2022-11-28Make normalize and normalize_to pub(crate)Michael Goulet-6/+8
2022-11-28partially_normalize_... -> At::normalizeMichael Goulet-59/+36
2022-11-28Rename At::normalize to At::query_normalizeMichael Goulet-3/+3
2022-11-28Remove `Const::from_value`Maybe Waffle-3/+1
...it's just `mk_const` but without the sparcles
2022-11-28Simplify calls to `tcx.mk_const`Maybe Waffle-1/+1
`mk_const(ty::ConstKind::X(...), ty)` can now be simplified to `mk_cosnt(..., ty)`. I searched with the following regex: \mk_const\([\n\s]*(ty::)?ConstKind\ I've left `ty::ConstKind::{Bound, Error}` as-is, they seem clearer this way.
2022-11-28Rollup merge of #104907 - compiler-errors:selcx-infcx, r=oli-obkDylan DPC-92/+75
Remove `SelectionContext::infcx()` in favor of field access Encapsulation doesn't seem particularly important here, and having two choices is always more confusing than having one. r? types
2022-11-28Rollup merge of #104732 - WaffleLapkin:from_def_idn't, r=compiler-errorsDylan DPC-15/+12
Refactor `ty::ClosureKind` related stuff I've tried to fix all duplication and weirdness, but if I missed something do tell :p r? `@compiler-errors`
2022-11-28Keep track of the start of the argument block of a closureSarthak Singh-20/+15
2022-11-27Rollup merge of #104976 - WaffleLapkin:move_comments, r=cjgillotMatthias Krüger-3/+3
Prefer doc comments over `//`-comments in compiler Doc comments are generally nicer: they show up in the documentation, they are shown in IDEs when you hover other mentions of items, etc. Thus it makes sense to use them instead of `//`-comments.
2022-11-27Rollup merge of #104931 - Swatinem:async-pretty, r=eholkMatthias Krüger-1/+1
Pretty-print generators with their `generator_kind` After removing `GenFuture`, I special-cased async generators to pretty-print as `impl Future<Output = X>` mainly to avoid too much diagnostics changes originally. This now reverses that change so that async fn/blocks are pretty-printed as `[$async-type@$source-position]` in various diagnostics, and updates the tests that this touches.
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-3/+3
2022-11-27Use `TyCtxt::is_fn_trait` is a couple more placesMaybe Waffle-2/+1
2022-11-27Add `TyCtxt::is_fn_trait`Maybe Waffle-9/+6
2022-11-27Remove `ty::ClosureKind::from_def_id`Maybe Waffle-6/+7
…in favour of `TyCtxt::fn_trait_kind_from_def_id`
2022-11-27Rename `fn_trait_kind_from_{from_lang=>def_id}` to better convey meaningMaybe Waffle-5/+5