about summary refs log tree commit diff
path: root/compiler/rustc_borrowck
AgeCommit message (Collapse)AuthorLines
2023-02-09Cleanup free_region_relations a bitJack Huey-69/+86
2023-02-09Use 'static RegionVid for ReErrorEsteban Küber-3/+9
2023-02-09Change to `ReError(ErrorGuaranteed)`Esteban Küber-5/+4
2023-02-09Introduce `ReError`Esteban Küber-4/+10
CC #69314
2023-02-08Rollup merge of #107780 - compiler-errors:instantiate-binder, r=lcnrMatthias Krüger-2/+2
Rename `replace_bound_vars_with_*` to `instantiate_binder_with_*` Mentioning "binder" rather than "bound vars", imo, makes it clearer that we're doing something to the binder as a whole. Also, "instantiate" is the verb that I'm always reaching for when I'm looking for these functions, and the name that we use in the new solver anyways. r? types
2023-02-07Replacing bound vars is actually instantiating a binderMichael Goulet-2/+2
2023-02-07Auto merge of #107768 - matthiaskrgr:rollup-9u4cal4, r=matthiaskrgrbors-10/+2
Rollup of 8 pull requests Successful merges: - #107719 (Remove `arena_cache` modifier from `upstream_monomorphizations_for`) - #107740 (Avoid locking the global context across the `after_expansion` callback) - #107746 (Split fn_ctxt/adjust_fulfillment_errors from fn_ctxt/checks) - #107749 (allow quick-edit convenience) - #107750 (make more readable) - #107755 (remove binder from query constraints) - #107756 (miri: fix ICE when running out of address space) - #107764 (llvm-16: Use Triple.h from new header location.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-07remove binder from query constraintslcnr-10/+2
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-2/+6
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-03Rollup merge of #106575 - estebank:issue-64008, r=pnkfelixMatthias Krüger-16/+12
Suggest `move` in nested closure when appropriate Fix #64008.
2023-02-02Put a DefId in AggregateKind.Camille GILLOT-2/+6
2023-02-02Suggest `move` in nested closure when appropriateEsteban Küber-16/+12
Fix #64008.
2023-02-02Rollup merge of #107532 - compiler-errors:erase-regions-in-uninhabited, ↵Matthias Krüger-1/+4
r=jackh726 Erase regions before doing uninhabited check in borrowck ~Also, fingerprint query keys/values when debug assertions are enabled. This should make it easier to check for issues like this without `-Cincremental`, and make UI tests a bit cleaner.~ edit: moving that to a separate PR Fixes #107505
2023-02-01Erase regions before uninhabited checkMichael Goulet-1/+4
2023-01-31Rollup merge of #107467 - WaffleLapkin:uneq, r=oli-obkGuillaume Gomez-2/+2
Improve enum checks Some light refactoring.
2023-01-31Auto merge of #100754 - davidtwco:translation-incremental, r=compiler-errorsbors-13/+9
incremental: migrate diagnostics - Apply the diagnostic migration lints to more functions on `Session`, namely: `span_warn`, `span_warn_with_code`, `warn` `note_without_error`, `span_note_without_error`, `struct_note_without_error`. - Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path` and `std::path::PathBuf`. - Migrate the `rustc_incremental` crate's diagnostics to translatable diagnostic structs. r? `@compiler-errors` cc #100717
2023-01-30Auto merge of #107197 - aliemjay:patch-2, r=jackh726bors-3/+2
assume MIR types are fully normalized in ascribe_user_type This FIXME was introduced in c6a17bf8bcfa60c8b0436251d2cf70d8eca4d198 but it should've been restricted to `ascribe_user_type_skip_wf`.
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-0/+2
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30errors: implement `IntoDiagnosticArg` for `&T`David Wood-13/+7
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-2/+2
2023-01-29Auto merge of #107435 - matthiaskrgr:rollup-if5h6yu, r=matthiaskrgrbors-0/+4
Rollup of 8 pull requests Successful merges: - #106618 (Disable `linux_ext` in wasm32 and fortanix rustdoc builds.) - #107097 (Fix def-use dominance check) - #107154 (library/std/sys_common: Define MIN_ALIGN for m68k-unknown-linux-gnu) - #107397 (Gracefully exit if --keep-stage flag is used on a clean source tree) - #107401 (remove the usize field from CandidateSource::AliasBound) - #107413 (make more pleasant to read) - #107422 (Also erase substs for new infcx in pin move error) - #107425 (Check for missing space between fat arrow and range pattern) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-29Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obkbors-2/+6
Use stable metric for const eval limit instead of current terminator-based logic This patch adds a `MirPass` that inserts a new MIR instruction `ConstEvalCounter` to any loops and function calls in the CFG. This instruction is used during Const Eval to count against the `const_eval_limit`, and emit the `StepLimitReached` error, replacing the current logic which uses Terminators only. The new method of counting loops and function calls should be more stable across compiler versions (i.e., not cause crates that compiled successfully before, to no longer compile when changes to the MIR generation/optimization are made). Also see: #103877
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-4/+4
EarlyBinder to fn_sig in metadata
2023-01-26replace usages of fn_sig query with bound_fn_sigKyle Matsuda-4/+4
2023-01-26Rollup merge of #106971 - oli-obk:tait_error, r=davidtwcoMatthias Krüger-12/+0
Handle diagnostics customization on the fluent side (for one specific diagnostic) r? ```@davidtwco```
2023-01-25Rollup merge of #106897 - estebank:issue-99430, r=davidtwcoMatthias Krüger-5/+38
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-23During MirBorrowck, ignore ConstEvalCounterBryan Garza-3/+3
2023-01-23Revert "Move CtfeLimit to mir_const's set of passes"Bryan Garza-2/+2
This reverts commit 332542a92223b2800ed372d2d461921147f29477.
2023-01-23Move CtfeLimit to mir_const's set of passesBryan Garza-2/+2
2023-01-23Create stable metric to measure long computation in Const EvalBryan Garza-2/+6
This patch adds a `MirPass` that tracks the number of back-edges and function calls in the CFG, adds a new MIR instruction to increment a counter every time they are encountered during Const Eval, and emit a warning if a configured limit is breached.
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-7/+5
use LocalDefId instead of HirId in trait resolution to simplify the obligation clause resolution Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-01-22assume MIR types are fully normalizedAli MJ Al-Nasrawy-3/+2
2023-01-22Update universal_regions.rsSamuel Moelius-1/+1
2023-01-21Auto merge of #106976 - tmiasko:borrowck-lazy-dominators, r=cjgillotbors-8/+12
Lazy dominator tree construction in borrowck Motivated by the observation that sometimes constructed dominator tree was never queried.
2023-01-19even more unify Projection/Opaque in outlives codeAli MJ Al-Nasrawy-2/+2
2023-01-18Auto merge of #106503 - cjgillot:remap-nofilter, r=oli-obkbors-1/+1
Do not filter substs in `remap_generic_params_to_declaration_params`. The relevant filtering should have been performed by borrowck. Fixes https://github.com/rust-lang/rust/issues/105826 r? types
2023-01-18Rollup merge of #106747 - yanchen4791:issue-105507-fix, r=estebankMatthias Krüger-4/+121
Add 'static lifetime suggestion when GAT implied 'static requirement from HRTB Fix for issue #105507 The problem: When generic associated types (GATs) are from higher-ranked trait bounds (HRTB), they are implied 'static requirement (see [Implied 'static requirement from higher-ranked trait bounds](https://blog.rust-lang.org/2022/10/28/gats-stabilization.html#implied-static-requirement-from-higher-ranked-trait-bounds) for more details). If the user did not explicitly specify the `'static` lifetime when using the GAT, the current error message will only point out the type `does not live long enough` where the type is used, but not where the GAT is specified and how to fix the problem. The solution: Add notes at the span where the problematic GATs are specified and suggestions of how to fix the problem by adding `'static` lifetime at the right spans.
2023-01-17Lazy dominator tree construction in borrowckTomasz Miąsko-8/+12
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/+121
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-14/+14
Remove double spaces after dots in comments Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17rework min_choice algorithm of member constraintsAli MJ Al-Nasrawy-11/+24
See the inline comments for the description of the new algorithm.