about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/diagnostics
AgeCommit message (Collapse)AuthorLines
2023-02-27Auto merge of #108487 - cjgillot:no-typeck-mir, r=oli-obkbors-40/+12
Avoid invoking typeck from borrowck This PR attempts to reduce direct dependencies between typeck and MIR-related queries. The goal is to have all the information transit either through THIR or through dedicated queries that avoid depending on the whole `TypeckResults`. In a first commit, we store the type information that MIR building requires into THIR. This avoids edges between mir_built and typeck. In the second and third commit, we wrap informations around closures (upvars, kind origin and user-provided signature) to avoid borrowck depending on typeck information. There should be a single remaining borrowck -> typeck edge in the good path, due to inline consts.
2023-02-27avoid `&str` to `String` conversionsTakayuki Maeda-2/+2
2023-02-26Wrap more into into closure_typeinfo query.Camille GILLOT-40/+12
2023-02-24Rename many interner functions.Nicholas Nethercote-1/+1
(This is a large commit. The changes to `compiler/rustc_middle/src/ty/context.rs` are the most important ones.) The current naming scheme is a mess, with a mix of `_intern_`, `intern_` and `mk_` prefixes, with little consistency. In particular, in many cases it's easy to use an iterator interner when a (preferable) slice interner is available. The guiding principles of the new naming system: - No `_intern_` prefixes. - The `intern_` prefix is for internal operations. - The `mk_` prefix is for external operations. - For cases where there is a slice interner and an iterator interner, the former is `mk_foo` and the latter is `mk_foo_from_iter`. Also, `slice_interners!` and `direct_interners!` can now be `pub` or non-`pub`, which helps enforce the internal/external operations division. It's not perfect, but I think it's a clear improvement. The following lists show everything that was renamed. slice_interners - const_list - mk_const_list -> mk_const_list_from_iter - intern_const_list -> mk_const_list - substs - mk_substs -> mk_substs_from_iter - intern_substs -> mk_substs - check_substs -> check_and_mk_substs (this is a weird one) - canonical_var_infos - intern_canonical_var_infos -> mk_canonical_var_infos - poly_existential_predicates - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter - intern_poly_existential_predicates -> mk_poly_existential_predicates - _intern_poly_existential_predicates -> intern_poly_existential_predicates - predicates - mk_predicates -> mk_predicates_from_iter - intern_predicates -> mk_predicates - _intern_predicates -> intern_predicates - projs - intern_projs -> mk_projs - place_elems - mk_place_elems -> mk_place_elems_from_iter - intern_place_elems -> mk_place_elems - bound_variable_kinds - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter - intern_bound_variable_kinds -> mk_bound_variable_kinds direct_interners - region - intern_region (unchanged) - const - mk_const_internal -> intern_const - const_allocation - intern_const_alloc -> mk_const_alloc - layout - intern_layout -> mk_layout - adt_def - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid) - alloc_adt_def(!) -> mk_adt_def - external_constraints - intern_external_constraints -> mk_external_constraints Other - type_list - mk_type_list -> mk_type_list_from_iter - intern_type_list -> mk_type_list - tup - mk_tup -> mk_tup_from_iter - intern_tup -> mk_tup
2023-02-23Auto merge of #108324 - notriddle:notriddle/assoc-fn-method, ↵bors-7/+4
r=compiler-errors,davidtwco,estebank,oli-obk diagnostics: if AssocFn has self argument, describe as method Discussed in https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515 This commit also changes the tooltips on rustdoc intra-doc links targeting methods. For anyone not sure why this is being done, see the Reference definitions of these terms in <https://doc.rust-lang.org/1.67.1/reference/items/associated-items.html#methods> > Associated functions whose first parameter is named `self` are called methods and may be invoked using the [method call operator](https://doc.rust-lang.org/1.67.1/reference/expressions/method-call-expr.html), for example, `x.foo()`, as well as the usual function call notation. In particular, while this means it's technically correct for rustc to refer to a method as an associated function (and there are a few cases where it'll still do so), rustc *must never* use the term "method" to refer to an associated function that does not have a `self` parameter.
2023-02-22Remove type-traversal trait aliasesAlan Egerton-2/+2
2023-02-22diagnostics: if AssocFn has self argument, describe as methodMichael Howell-7/+4
Discussed in https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515 This commit also changes the tooltips on rustdoc intra-doc links targeting methods.
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-8/+7
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-5/+7
2023-02-16Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgrbors-16/+5
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-16Auto merge of #108020 - nnethercote:opt-mk_region, r=compiler-errorsbors-6/+6
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-16Replace some `then`s with some `then_some`sMaybe Waffle-1/+1
2023-02-16`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`Maybe Waffle-16/+5
2023-02-15Rollup merge of #108010 - compiler-errors:can_eq-returns-bool, r=lcnrMatthias Krüger-1/+1
Make `InferCtxt::can_eq` and `InferCtxt::can_sub` return booleans Nobody matches on the result, nor does the result return anything useful...
2023-02-15Add specialized variants of `mk_region`.Nicholas Nethercote-6/+6
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-14Add `of_trait` to DefKind::Impl.Camille GILLOT-9/+9
2023-02-13Make can_eq and can_sub return booleansMichael Goulet-1/+1
2023-02-09Change to `ReError(ErrorGuaranteed)`Esteban Küber-1/+1
2023-02-09Introduce `ReError`Esteban Küber-3/+7
CC #69314
2023-02-07Replacing bound vars is actually instantiating a binderMichael Goulet-1/+1
2023-02-06Modify existing bounds if they existEdward Shen-0/+1
2023-02-04Rollup merge of #107646 - estebank:specific-span, r=compiler-errorsMatthias Krüger-6/+57
Provide structured suggestion for binding needing type on E0594 Partially address #45405.
2023-02-04Auto merge of #107267 - cjgillot:keep-aggregate, r=oli-obkbors-1/+4
Do not deaggregate MIR This turns out to simplify a lot of things. I haven't checked the consequences for miri yet. cc `@JakobDegen` r? `@oli-obk`
2023-02-03review commentsEsteban Küber-14/+17
2023-02-03Provide structured suggestion for binding needing type on E0594Esteban Küber-6/+54
Partially address #45405.
2023-02-02Put a DefId in AggregateKind.Camille GILLOT-1/+4
2023-02-02Suggest `move` in nested closure when appropriateEsteban Küber-16/+12
Fix #64008.
2023-01-31Rollup merge of #107467 - WaffleLapkin:uneq, r=oli-obkGuillaume Gomez-1/+1
Improve enum checks Some light refactoring.
2023-01-30errors: implement `IntoDiagnosticArg` for `&T`David Wood-0/+6
Implement `IntoDiagnosticArg` for `&'a T` when `T` implements `IntoDiagnosticArg` and `Clone`. Makes it easier to write diagnostic structs that borrow something which implements `IntoDiagnosticArg`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30Use `Mutability::{is_mut, is_not}`Maybe Waffle-1/+1
2023-01-28Also erase substs for new infcx in pin move errorNilstrieb-0/+4
The code originally correctly erased the regions of the type it passed to the newly created infcx. But after the `fn_sig` query was made to return an `EarlyBinder<T>`, some substs that were around were substituted there without erasing their regions. They were then passed into the newly cerated infcx, which caused the ICE.
2023-01-26add method_substs to CallKindKyle Matsuda-4/+2
2023-01-26fix up subst_identity vs skip_binder; add some FIXMEs as identified in reviewKyle Matsuda-1/+3
2023-01-26change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add ↵Kyle Matsuda-2/+2
EarlyBinder to fn_sig in metadata
2023-01-26replace usages of fn_sig query with bound_fn_sigKyle Matsuda-2/+2
2023-01-25Rollup merge of #106897 - estebank:issue-99430, r=davidtwcoMatthias Krüger-2/+35
Tweak E0597 CC #99430
2023-01-25Rollup merge of #105345 - yanchen4791:issue-103582-fix, r=jackh726Matthias Krüger-19/+40
Add hint for missing lifetime bound on trait object when type alias is used Fix issue #103582. The problem: When a type alias is used to specify the return type of the method in a trait impl, the suggestion for fixing the problem of "missing lifetime bound on trait object" of the trait impl will not be created. The issue caused by the code which searches for the return trait objects when constructing the hint suggestion is not able to find the trait objects since they are specified in the type alias path instead of the return path of the trait impl. The solution: Trace the trait objects in the type alias path and provide them along with the alias span to generate the suggestion in case the type alias is used in return type of the method in the trait impl.
2023-01-23Add hint for missing lifetime bound on trait object when type alias is usedyanchen4791-19/+40
2023-01-23fix: use LocalDefId instead of HirId in trait resVincenzo Palazzo-1/+1
use LocalDefId instead of HirId in trait resolution to simplify the obligation clause resolution Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-01-21Auto merge of #106976 - tmiasko:borrowck-lazy-dominators, r=cjgillotbors-2/+2
Lazy dominator tree construction in borrowck Motivated by the observation that sometimes constructed dominator tree was never queried.
2023-01-17Lazy dominator tree construction in borrowckTomasz Miąsko-2/+2
Motivated by the observation that sometimes constructed dominator tree was never queried.
2023-01-17Add 'static lifetime suggestion when GAT implied 'static requirement from HRTByanchen4791-4/+113
2023-01-17Account for method call and indexing when looking for inner-most path in ↵Esteban Küber-1/+3
expression
2023-01-17Account for field access when looking for inner-most path in expressionEsteban Küber-1/+2
2023-01-17Account for `*` when looking for inner-most path in expressionEsteban Küber-1/+3
2023-01-15Tweak E0597Esteban Küber-2/+30
CC #99430
2023-01-15Remove bound_{explicit,}_item_boundsMichael Goulet-27/+21
2023-01-13Rollup merge of #106641 - chenyukang:yukang/fix-105761-segguest-this, r=estebankMatthias Krüger-5/+145
Provide help on closures capturing self causing borrow checker errors Fixes #105761 r? ````@estebank````
2023-01-12Fix ICE formattingEsteban Küber-1/+1
2023-01-12take care when there is no args in method callyukang-14/+12