about summary refs log tree commit diff
path: root/compiler/rustc_infer
AgeCommit message (Collapse)AuthorLines
2023-02-21Name placeholder in some region errorsMichael Goulet-10/+17
2023-02-20remove cfg attributesb-naber-5/+1
2023-02-20small `opaque_type_origin` cleanuplcnr-24/+16
2023-02-19collect existentials and placeholdersb-naber-6/+18
2023-02-19collect region contexts during mir renumberingb-naber-0/+2
2023-02-18Make sure test_type_match doesn't ICE with late-bound typesMichael Goulet-1/+2
2023-02-18Collapse placeholders to root universe in canonicalizer if not preserving ↵Michael Goulet-4/+9
universes
2023-02-18Rollup merge of #108186 - ↵Matthias Krüger-2/+4
compiler-errors:closures-with-late-bound-types-r-bad, r=cjgillot Deny non-lifetime bound vars in `for<..> ||` closure binders Moves the check for illegal bound var types from astconv to resolve_bound_vars. If a binder is defined to have a type or const late-bound var that's not allowed, we'll resolve any usages to ty error or const error values, so we shouldn't ever see late-bound types or consts in places they aren't expected. Fixes #108184 Fixes #108181 Fixes #108192
2023-02-18Move late-bound arg type checks to resolve_bound_varsMichael Goulet-2/+4
2023-02-17Don't delay ReError bug during lexical region resolveMichael Goulet-1/+1
2023-02-17Auto merge of #108075 - WaffleLapkin:de-arena-allocates-you-OwO, r=Nilstriebbors-3/+3
Remove `arena_cache` modifier from `associated_item` query & copy `ty::AssocItem` instead of passing by ref r? `@ghost`
2023-02-17Add `Clause::ConstArgHasType` variantBoxy-0/+4
2023-02-17Auto merge of #107753 - kylematsuda:type-of, r=BoxyUwUbors-6/+14
Switch to `EarlyBinder` for `type_of` query Part of the work to finish #105779 and implement https://github.com/rust-lang/types-team/issues/78. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`. r? `@lcnr`
2023-02-16changes from reviewKyle Matsuda-1/+7
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-6/+6
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-3/+5
2023-02-17Rollup merge of #108136 - eggyal:unmet_trait_alias_bound_on_generic_impl, ↵Matthias Krüger-1/+1
r=compiler-errors Do not ICE on unmet trait alias impl bounds Fixes #108132 I've also added some documentation to the `impl_def_id` field of `DerivedObligationCause` to try and minimise the risk of such errors in future. r? `@compiler-errors`
2023-02-17Rollup merge of #108104 - matthiaskrgr:into, r=compiler-errorsMatthias Krüger-2/+2
don't into self don't into()-convert types to themselves
2023-02-17Rollup merge of #107489 - compiler-errors:non_lifetime_binders, r=cjgillotMatthias Krüger-15/+15
Implement partial support for non-lifetime binders This implements support for non-lifetime binders. It's pretty useless currently, but I wanted to put this up so the implementation can be discussed. Specifically, this piggybacks off of the late-bound lifetime collection code in `rustc_hir_typeck::collect::lifetimes`. This seems like a necessary step given the fact we don't resolve late-bound regions until this point, and binders are sometimes merged. Q: I'm not sure if I should go along this route, or try to modify the earlier nameres code to compute the right bound var indices for type and const binders eagerly... If so, I'll need to rename all these queries to something more appropriate (I've done this for `resolve_lifetime::Region` -> `resolve_lifetime::ResolvedArg`) cc rust-lang/types-team#81 r? `@ghost`
2023-02-16Clarify `DerivedObligationCause` may hold alias idAlan Egerton-1/+1
2023-02-16Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgrbors-6/+4
Rollup of 7 pull requests Successful merges: - #106347 (More accurate spans for arg removal suggestion) - #108057 (Prevent some attributes from being merged with others on reexports) - #108090 (`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`) - #108092 (note issue for feature(packed_bundled_libs)) - #108099 (use chars instead of strings where applicable) - #108115 (Do not ICE on unmet trait alias bounds) - #108125 (Add new people to the compiletest review rotation) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-16don't into selfMatthias Krüger-2/+2
don't into()-convert types to themselves
2023-02-16Auto merge of #108020 - nnethercote:opt-mk_region, r=compiler-errorsbors-31/+29
Optimize `mk_region` PR #107869 avoiding some interning under `mk_ty` by special-casing `Ty` variants with simple (integer) bodies. This PR does something similar for regions. r? `@compiler-errors`
2023-02-16`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`Maybe Waffle-6/+4
2023-02-16Rename some region-specific stuffMichael Goulet-15/+15
2023-02-15Rollup merge of #108049 - clubby789:dont-suggest-unstable, r=compiler-errorsMatthias Krüger-1/+3
Don't suggest `#[doc(hidden)]` trait methods with matching return type Fixes #107983, addressing the bad suggestion. The test can probably be made more specific to this case, but I'm unsure how. `@rustbot` label +A-diagnostics
2023-02-15Rollup merge of #108010 - compiler-errors:can_eq-returns-bool, r=lcnrMatthias Krüger-16/+6
Make `InferCtxt::can_eq` and `InferCtxt::can_sub` return booleans Nobody matches on the result, nor does the result return anything useful...
2023-02-15Rollup merge of #107034 - IntQuant:issue-100717-infer-5, r=oli-obkMatthias Krüger-230/+448
Migrating rustc_infer to session diagnostics (part 4) `@rustbot` label +A-translation r? rust-lang/diagnostics cc https://github.com/rust-lang/rust/issues/100717
2023-02-15Copy `ty::AssocItem` all other the placeMaybe Waffle-3/+3
2023-02-15Auto merge of #108006 - cjgillot:def-impl, r=oli-obkbors-1/+1
Avoid accessing HIR when it can be avoided Experiment to see if it helps some incremental cases. Will be rebased once https://github.com/rust-lang/rust/pull/107942 gets merged. r? `@ghost`
2023-02-15Don't suggest `#[doc(hidden)]` methodsclubby789-1/+3
2023-02-15Auto merge of #108070 - Dylan-DPC:rollup-v6xw7vk, r=Dylan-DPCbors-0/+65
Rollup of 7 pull requests Successful merges: - #105300 (rework min_choice algorithm of member constraints) - #107163 (Remove some superfluous type parameters from layout.rs.) - #107173 (Suggest the correct array length on mismatch) - #107411 (Handle discriminant in DataflowConstProp) - #107968 (Enable `#[thread_local]` on armv6k-nintendo-3ds) - #108032 (Un📦ing the Resolver) - #108060 (Revert to using `RtlGenRandom` as a fallback) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-15Rollup merge of #107173 - clubby789:suggest-array-length, r=compiler-errorsDylan DPC-0/+65
Suggest the correct array length on mismatch Fixes #107156 I wasn't able to find a way to get the `Span` for the actual array size unfortunately, so this suggestion can't be applied automatically. ``@rustbot`` label +A-diagnostics
2023-02-15Auto merge of #107940 - BoxyUwU:const_ty_assertion_use_semantic_equality, ↵bors-0/+30
r=compiler-errors use semantic equality for const param type equality assertion Fixes #107898 See added test for what caused this ICE --- The current in assertion in `relate.rs` is rather inadequate when keeping in mind future expansions to const generics: - it will ICE when there are infer vars in a projection in a const param ty - it will spurriously return false when either ty has infer vars because of using `==` instead of `infcx.at(..).eq` - i am also unsure if it would be possible with `adt_const_params` to craft a situation where the const param type is not wf causing `normalize_erasing_regions` to `bug!` when we would have emitted a diagnostic. This impl feels pretty Not Great to me although i am not sure what a better idea would be. - We have to have the logic behind a query because neither `relate.rs` or `combine.rs` have access to trait solving machinery (without evaluating nested obligations this assert will become _far_ less useful under lazy norm, which consts are already doing) - `relate.rs` does not have access to canonicalization machinery which is necessary in order to have types potentially containing infer vars in query arguments. We could possible add a method to `TypeRelation` to do this assertion rather than a query but to avoid implementing the same logic over and over we'd probably end up with the logic in a free function somewhere in `rustc_trait_selection` _anyway_ so I don't think that would be much better. We could also just remove this assertion, it should not actually be necessary for it to be present. It has caught some bugs in the past though so if possible I would like to keep it. r? `@compiler-errors`
2023-02-15Add specialized variants of `mk_region`.Nicholas Nethercote-31/+29
Much like there are specialized variants of `mk_ty`. This will enable some optimization in the next commit. Also rename the existing `re_error*` functions as `mk_re_error*`, for consistency.
2023-02-15Remove `reuse_or_mk_region`.Nicholas Nethercote-3/+3
It's not used on any hot paths, and so has little perf benefit, and it interferes with the optimizations in the following commits.
2023-02-14Specify correct spans in suggest_await_on_expect_foundIQuant-8/+6
2023-02-14Add `of_trait` to DefKind::Impl.Camille GILLOT-1/+1
2023-02-14Port PlaceholderRelationLfNotSatisfied diagnosticIQuant-29/+96
2023-02-14Port ConsiderAddingAwaitIQuant-38/+70
2023-02-14Port SuggestRemoveSemiOrReturnBindingIQuant-46/+92
2023-02-14Make sure tests passNikita Tomashevich-1/+1
2023-02-14Port WhereClauseSuggestionsNikita Tomashevich-17/+37
2023-02-14Resolve rebaseNikita Tomashevich-38/+2
2023-02-14Port another diagnosticNikita Tomashevich-15/+19
2023-02-14Port RefLongerThanDataNikita Tomashevich-17/+27
2023-02-14Port "BorrowedTooLong" diagnosticNikita Tomashevich-5/+41
2023-02-14Port OutlivesContent, OutlivesBound, FUllfillReqLifetime, ↵Nikita Tomashevich-76/+117
LfBoundNotSatisfied diagnostics
2023-02-13Rollup merge of #107902 - vincenzopalazzo:macros/async_fn_suggestion, ↵Matthias Krüger-27/+38
r=compiler-errors fix: improve the suggestion on future not awaited Considering the following code ```rust fn foo() -> u8 { async fn async_fn() -> u8 { 22 } async_fn() } fn main() {} ``` the error generated before this commit from the compiler is ``` ➜ rust git:(macros/async_fn_suggestion) ✗ rustc test.rs --edition 2021 error[E0308]: mismatched types --> test.rs:4:5 | 1 | fn foo() -> u8 { | -- expected `u8` because of return type ... 4 | async_fn() | ^^^^^^^^^^ expected `u8`, found opaque type | = note: expected type `u8` found opaque type `impl Future<Output = u8>` help: consider `await`ing on the `Future` | 4 | async_fn().await | ++++++ error: aborting due to previous error ``` In this case the error is nor perfect, and can confuse the user that do not know that the opaque type is the future. So this commit will propose (and conclude the work start in https://github.com/rust-lang/rust/issues/80658) to change the string `opaque type` to `future` when applicable and also remove the Expected vs Received note by adding a more specific one regarding the async function that return a future type. So the new error emitted by the compiler is ``` error[E0308]: mismatched types --> test.rs:4:5 | 1 | fn foo() -> u8 { | -- expected `u8` because of return type ... 4 | async_fn() | ^^^^^^^^^^ expected `u8`, found future | note: calling an async function returns a future --> test.rs:4:5 | 4 | async_fn() | ^^^^^^^^^^ help: consider `await`ing on the `Future` | 4 | async_fn().await | ++++++ error: aborting due to previous error ``` Fixes https://github.com/rust-lang/rust/issues/80658 It remains to rework the case described in the following issue https://github.com/rust-lang/rust/issues/107899 but I think this deserves its own PR after we discuss a little bit how to handle these kinds of cases. r? `@eholk` `@rustbot` label +I-async-nominated Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-13Make can_eq and can_sub return booleansMichael Goulet-16/+6