summary refs log tree commit diff
path: root/compiler/rustc_infer/src
AgeCommit message (Collapse)AuthorLines
2022-10-29Rename some `OwnerId` fields.Nicholas Nethercote-1/+1
spastorino noticed some silly expressions like `item_id.def_id.def_id`. This commit renames several `def_id: OwnerId` fields as `owner_id`, so those expressions become `item_id.owner_id.def_id`. `item_id.owner_id.local_def_id` would be even clearer, but the use of `def_id` for values of type `LocalDefId` is *very* widespread, so I left that alone.
2022-10-28Rollup merge of #103641 - compiler-errors:issue-103624, r=cjgillotMatthias Krüger-6/+6
Don't carry MIR location in `ConstraintCategory::CallArgument` It turns out that `ConstraintCategory::CallArgument` cannot just carry a MIR location in it, since we may bubble them up to totally different MIR bodies. So instead, revert the commit a6b5f95fb028f9feb4a2957c06b35035be2c6155, and instead just erase regions from the original `Option<Ty<'tcx>>` that it carried, so that it doesn't ICE with the changes in #103220. Best reviewed in parts -- the first is just a revert, and the second is where the meaningful changes happen. Fixes #103624
2022-10-27Revert "Make ClosureOutlivesRequirement not rely on an unresolved type"Michael Goulet-6/+6
This reverts commit a6b5f95fb028f9feb4a2957c06b35035be2c6155.
2022-10-27Rollup merge of #103255 - oli-obk:opaque_wrong_eq_relation, r=compiler-errorsMatthias Krüger-52/+31
Clean up hidden type registration work on https://github.com/rust-lang/rust/issues/101186 Actually passing down the relation and using it instead of `eq` for the hidden type comparison has *no* effect whatsoever and allows for no further improvements at the call sites. I decided the increased complexity was not worth it and thus did not include that change in this PR. r? `@compiler-errors`
2022-10-26No need to probe when relating opaques in nll_relateMichael Goulet-1/+1
2022-10-26Remove unneeded sub-comparisonOli Scherer-31/+8
2022-10-26Rollup merge of #103416 - compiler-errors:rpit-named, r=cjgillotDylan DPC-11/+10
Name the `impl Trait` in region bound suggestions Slightly more descriptive message
2022-10-25Name impl trait in region bound suggestionMichael Goulet-11/+10
2022-10-25Bubble the opaque type ordering int opaque type handlingOli Scherer-5/+8
2022-10-25Pull opaque type handling out of the type relating delegateOli Scherer-16/+15
2022-10-24Assert if inference vars are leaking from fully_resolveMichael Goulet-1/+6
2022-10-23Auto merge of #103345 - Nilstrieb:diag-flat, r=compiler-errorsbors-47/+48
Flatten diagnostic slug modules This makes it easier to grep for the slugs in the code. See https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Localization.20infra.20interferes.20with.20grepping.20for.20error for more discussion about it. This was mostly done with a few regexes and a bunch of manual work. This also exposes a pretty annoying inconsistency for the extra labels. Some of the extra labels are defined as additional properties in the fluent message (which makes them not prefixed with the crate name) and some of them are new fluent messages themselves (which makes them prefixed with the crate name). I don't know whether we want to clean this up at some point but it's useful to know. r? `@davidtwco`
2022-10-23Migrate all diagnosticsNilstrieb-47/+48
2022-10-23Rollup merge of #103355 - compiler-errors:rpitit-default-check, r=oli-obkMatthias Krüger-1/+13
Handle return-position `impl Trait` in traits properly in `register_hidden_type` The bounds that we get by calling `bound_explicit_item_bounds` from an RPITIT have projections, not opaques, but when we're *registering* an opaque, we want to treat it like an opaque. Coincidentally fixes #102688 as well, which makes sense, since that was failing because we were inferring an opaque type to be equal to itself (opaque cycle error => "cannot resolve opaque type"). Fixes #103352 r? ```@oli-obk```
2022-10-23Rollup merge of #103354 - clubby789:escape-string-literals, r=compiler-errorsMatthias Krüger-2/+21
Escape string literals when fixing overlong char literal Fixes #103323 ````@rustbot```` label +A-diagnostics +A-suggestion-diagnostics
2022-10-22Introduce subst_iter and subst_iter_copied on EarlyBinderMichael Goulet-6/+2
2022-10-22Properly escape quotes when suggesting switching between char/string literalsclubby789-2/+21
2022-10-21Handle RPITITs properly in register_hidden_typeMichael Goulet-1/+13
2022-10-21Rollup merge of #103051 - davidtwco:translation-tidying-up, r=compiler-errorsDylan DPC-48/+41
translation: doc comments with derives, subdiagnostic-less enum variants, more derive use - Adds support for `doc` attributes in the diagnostic derives so that documentation comments don't result in the derive failing. - Adds support for enum variants in the subdiagnostic derive to not actually correspond to an addition to a diagnostic. - Made use of the derive in more places in the `rustc_ast_lowering`, `rustc_ast_passes`, `rustc_lint`, `rustc_session`, `rustc_infer` - taking advantage of recent additions like eager subdiagnostics, multispan suggestions, etc. cc #100717
2022-10-19Make ClosureOutlivesRequirement not rely on an unresolved typeMichael Goulet-6/+6
2022-10-17Auto merge of #102355 - lcnr:bye-bye-type-traversal, r=oli-obkbors-5/+0
remove type traversal for mir constants r? `@oli-obk` cc `@b-naber`
2022-10-17infer: use derive moreDavid Wood-48/+41
Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-17mir constants: type traversing bye byelcnr-5/+0
2022-10-16fix `own_substs` ICETakayuki Maeda-5/+12
2022-10-14more dupe word typosRageking8-2/+2
2022-10-13Rollup merge of #102974 - Rageking8:fix-small-word-dupe-typos, r=JohnTitorYuki Okushi-1/+1
Fix small word dupe typos
2022-10-13fix small word dupe typosRageking8-1/+1
2022-10-10errors: `AddToDiagnostic::add_to_diagnostic_with`David Wood-9/+33
`AddToDiagnostic::add_to_diagnostic_with` is similar to the previous `AddToDiagnostic::add_to_diagnostic` but takes a function that can be used by the caller to modify diagnostic messages originating from the subdiagnostic (such as performing translation eagerly). `add_to_diagnostic` now just calls `add_to_diagnostic_with` with an empty closure. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10Rollup merge of #102829 - compiler-errors:rename-impl-item-kind, r=TaKO8KiYuki Okushi-1/+1
rename `ImplItemKind::TyAlias` to `ImplItemKind::Type` The naming of this variant seems inconsistent given that this is not really a "type alias", and the associated type variant for `TraitItemKind` is just called `Type`.
2022-10-09ImplItemKind::TyAlias => ImplItemKind::TypeMichael Goulet-1/+1
2022-10-07Change InferCtxtBuilder from enter to buildCameron Steffen-11/+8
2022-10-07Remove TypeckResults from InferCtxtCameron Steffen-128/+92
2022-10-07Introduce TypeErrCtxtCameron Steffen-148/+190
TypeErrCtxt optionally has a TypeckResults so that InferCtxt doesn't need to.
2022-10-05Rollup merge of #102496 - compiler-errors:into-suggestion, r=davidtwcoDylan DPC-11/+18
Suggest `.into()` when all other coercion suggestions fail Also removes some bogus suggestions because we now short-circuit when offering coercion suggestions(instead of, for example, suggesting every one that could possibly apply) Fixes #102415
2022-10-05stop suggesting adding generic args for turbofishTakayuki Maeda-8/+32
2022-10-05Suggest `.into()` when all other coercion suggestions failMichael Goulet-11/+18
2022-10-04It's not about types or consts, but the lack of regionsOli Scherer-14/+10
2022-09-29Shrink `hir::def::Res`.Nicholas Nethercote-2/+3
`Res::SelfTy` currently has two `Option`s. When the second one is `Some` the first one is never consulted. So we can split it into two variants, `Res::SelfTyParam` and `Res::SelfTyAlias`, reducing the size of `Res` from 24 bytes to 12. This then shrinks `hir::Path` and `hir::PathSegment`, which are the HIR types that take up the most space.
2022-09-27rustc_typeck to rustc_hir_analysislcnr-3/+3
2022-09-26remove cfg(bootstrap)Pietro Albini-2/+0
2022-09-25Auto merge of #95474 - oli-obk:tait_ub, r=jackh726bors-117/+182
Neither require nor imply lifetime bounds on opaque type for well formedness The actual hidden type can live arbitrarily longer than any individual lifetime and arbitrarily shorter than all but one of the lifetimes. fixes #86218 fixes #84305 This is a **breaking change** but it is a necessary soundness fix
2022-09-25Rollup merge of #102016 - lcnr:given-OutlivesEnvironment, r=jackh726Matthias Krüger-0/+2
implied_bounds: deal with inference vars fixes #101951 while computing implied bounds for `<<T as ConstructionFirm>::Builder as BuilderFn<'_>>::Output` normalization replaces a projection with an inference var (adding a `Projection` obligation). Until we prove that obligation, this inference var remains unknown, which caused us to miss an implied bound necessary to prove that the unnormalized projection from the trait method signature is wf. r? types
2022-09-24separate definitions and `HIR` ownersTakayuki Maeda-8/+9
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
2022-09-23Auto merge of #102056 - b-naber:unevaluated, r=lcnrbors-14/+9
Introduce mir::Unevaluated Previously the distinction between unevaluated constants in the type-system and in mir was not explicit and a little confusing. Probably better to introduce its own type for that. r? `@lcnr`
2022-09-23rename Unevaluated to UnevaluatedConstb-naber-9/+9
2022-09-23Auto merge of #102165 - matthiaskrgr:rollup-n5oquhe, r=matthiaskrgrbors-4/+112
Rollup of 8 pull requests Successful merges: - #100734 (Split out async_fn_in_trait into a separate feature) - #101664 (Note if mismatched types have a similar name) - #101815 (Migrated the rustc_passes annotation without effect diagnostic infrastructure) - #102042 (Distribute rust-docs-json via rustup.) - #102066 (rustdoc: remove unnecessary `max-width` on headers) - #102095 (Deduplicate two functions that would soon have been three) - #102104 (Set 'exec-env:RUST_BACKTRACE=0' in const-eval-select tests) - #102112 (Allow full relro on powerpc64-unknown-linux-gnu) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-23Report diagnostics at the actually actionable siteOli Scherer-10/+5
2022-09-23Rollup merge of #101664 - mejrs:similarity, r=fee1-deadMatthias Krüger-4/+112
Note if mismatched types have a similar name If users get a type error between similarly named types, it will point out that these are actually different types, and where they were defined.
2022-09-22Rollup merge of #102128 - oli-obk:const_unification, r=lcnrMatthias Krüger-26/+11
Const unification is already infallible, remove the error handling logic r? `@lcnr` is this expected to be used in the future? Right now it is dead code.
2022-09-22Auto merge of #102139 - Dylan-DPC:rollup-ljlipt8, r=Dylan-DPCbors-10/+6
Rollup of 8 pull requests Successful merges: - #101598 (Update rustc's information on Android's sanitizers) - #102036 (Remove use of `io::ErrorKind::Other` in std) - #102037 (Make cycle errors recoverable) - #102069 (Skip `Equate` relation in `handle_opaque_type`) - #102076 (rustc_transmute: fix big-endian discriminants) - #102107 (Add missing space between notable trait tooltip and where clause) - #102119 (Fix a typo “pararmeter” in error message) - #102131 (Added which number is computed in compute_float.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup