about summary refs log tree commit diff
path: root/compiler/rustc_borrowck
AgeCommit message (Collapse)AuthorLines
2022-11-09Make span_suggestions take IntoIteratorMichael Goulet-1/+1
2022-11-09DiagnosticBuilder -> DiagnosticMichael Goulet-13/+6
2022-11-09struct error E0505AndyJado-6/+31
2022-11-09var_subdiag refinementAndyJado-57/+64
trim old
2022-11-09remove old var_span_path_onlyAndyJado-17/+75
doc comment
2022-11-09lint auto passAndyJado-0/+57
Revert "lint auto pass" This reverts commit e58e4466384924c491a932d3f18ef50ffa5a5065.
2022-11-08Add support for custom MIR parsingJakob Degen-0/+14
2022-11-09Auto merge of #104179 - Manishearth:rollup-yvsx5hh, r=Manishearthbors-4/+60
Rollup of 7 pull requests Successful merges: - #100508 (avoid making substs of type aliases late bound when used as fn args) - #101381 (Test that target feature mix up with homogeneous floats is sound) - #103353 (Fix Access Violation when using lld & ThinLTO on windows-msvc) - #103521 (Avoid possible infinite loop when next_point reaching the end of file) - #103559 (first move on a nested span_label) - #103778 (Update several crates for improved support of the new targets) - #103827 (Properly remap and check for substs compatibility in `confirm_impl_trait_in_trait_candidate`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-08Rollup merge of #103559 - AndyJado:var_span_label, r=davidtwcoManish Goregaokar-4/+60
first move on a nested span_label trying not to be smart this time.
2022-11-09Auto merge of #103171 - jackh726:gen-interior-hrtb-error, r=cjgillotbors-1/+4
Better error for HRTB error from generator interior cc #100013 This is just a first pass at an error. It could be better, and shouldn't really be emitted in the first place. But this is better than what was being emitted before.
2022-11-08add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed'yukang-6/+7
2022-11-08Rollup merge of #103865 - compiler-errors:fallback-has-occurred-tracking, ↵Dylan DPC-1/+1
r=eholk Move `fallback_has_occurred` state tracking to `FnCtxt` Removes a ton of callsites that defaulted to `false`
2022-11-07Add an optional Span to BrAnon and use it to print better error for HRTB ↵Jack Huey-1/+4
error from generator interior
2022-11-07Auto merge of #103218 - CastilloDel:infer, r=jackh726bors-4/+4
Remove #![allow(rustc::potential_query_instability)] from rustc_infer Related to #84447 This PR probably needs to be benchmarked to check for regressions.
2022-11-06Auto merge of #102618 - aliemjay:simplify-closure-promote, r=compiler-errorsbors-258/+103
rework applying closure requirements in borrowck Previously the promoted closure constraints were registered under the category `ConstraintCategory::ClosureBounds` in `type_check::prove_closure_bounds()` and then mapped back their original category in `regions_infer::best_blame_constraint` using the complicated map `closure_bounds_mapping`. Now we're registering promoted constraints under their original category and span earlier in `type_check::prove_closure_bounds`. See commit messages. Fixes #99245
2022-11-06Move fallback_has_occurred to FnCtxtMichael Goulet-1/+1
2022-11-05first move on a nested span_labelAndyJado-4/+60
Apply suggestions from code review Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
2022-11-05use spans in TypeTest rather than mir::LocationAli MJ Al-Nasrawy-23/+11
Spans are independent of the body being borrow-checked, so they don't need remapping when promoting type-tests and they yield more specific error spans inside bodies of closures/inline consts.
2022-11-05simplify applying closure requirementsAli MJ Al-Nasrawy-235/+92
Don't use `ConstraintCategory::ClosureBounds`! Set the category and the span for the promoted constraints to that of the original constraint earlier than before. This eliminates the need for `closure_bounds_mapping`.
2022-11-05Rollup merge of #103868 - compiler-errors:trait-engine-less, r=jackh726Matthias Krüger-35/+27
Use `TraitEngine` (by itself) less Replace `TraitEngine` in favor of `ObligationCtxt` or `fully_solve_*`, improving code readability.
2022-11-04Rollup merge of #103780 - compiler-errors:bound-closure-lifetimes, r=jackh726Matthias Krüger-35/+94
Fix late-bound lifetime closure ICEs in HIR typeck and MIR borrowck During HIR typeck, we need to teach astconv to treat late-bound regions within a closure body as free, fixing escaping bound vars ICEs in both of the issues below. However, this then gets us to MIR borrowck, which itself needs to be taught how to instantiate free region vids for late-bound regions that come from items that _aren't_ the typeck root (for now, just closures). Fixes #103771 Fixes #103736
2022-11-02Use TraitEngine lessMichael Goulet-35/+27
2022-11-01Rollup merge of #103575 - Xiretza:suggestions-style-attr, r=davidtwcoManish Goregaokar-1/+1
Change #[suggestion_*] attributes to use style="..." As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20tool_only_span_suggestion), this changes `#[(multipart_)suggestion_{short,verbose,hidden}(...)]` attributes to plain `#[(multipart_)suggestion(...)]` attributes with a `style = "{short,verbose,hidden}"` parameter. It also adds a new style, `tool-only`, that corresponds to `tool_only_span_suggestion`/`tool_only_multipart_suggestion` and causes the suggestion to not be shown in human-readable output at all. Best reviewed commit-by-commit, there's a bit of noise in there. cc #100717 `@compiler-errors` r? `@davidtwco`
2022-11-01Auto merge of #103590 - compiler-errors:ocx-more, r=lcnrbors-23/+18
(almost) Always use `ObligationCtxt` when dealing with canonical queries Hope this is a step in the right direction. cc rust-lang/types-team#50. r? `@lcnr`
2022-10-31Add bug! back to late_bound_vars queryMichael Goulet-0/+4
2022-10-31Make external/local late-bound region registration more explicitMichael Goulet-25/+68
2022-10-31Collect late-bound regions from all closure parents in `closure_mapping`Michael Goulet-40/+44
2022-10-31Create NLL infer vars for late-bound regions from closuresMichael Goulet-27/+35
2022-10-29Rollup merge of #103625 - WaffleLapkin:no_tyctxt_dogs_allowed, r=compiler-errorsGuillaume Gomez-1/+1
Accept `TyCtxt` instead of `TyCtxtAt` in `Ty::is_*` functions Functions in answer: - `Ty::is_freeze` - `Ty::is_sized` - `Ty::is_unpin` - `Ty::is_copy_modulo_regions` This allows to remove a lot of useless `.at(DUMMY_SP)`, making the code a bit nicer :3 r? `@compiler-errors`
2022-10-28Remove #![allow(rustc::potential_query_instability)] from rustc_inferCastilloDel-4/+4
Change reported_violations to use IndexSet It is being used to iterate and to insert, without a lot of lookups so hopefully it won't be a perf hit Change MiniGraph.nodes to use IndexSet It is being used to iterate and to insert, without performing lookups so hopefully it won't be a perf hit Change RegionConstraintData.givens to a FxIndexSet This might result in a perf hit. Remove was being used in `givens`, and `FxIndexSet` doesn't allow calling remove without losing the fixed iteration order. So it was necessary to change remove to `shift_remove`, but this method is slower. Change OpaqueTypesVisitor to use stable sets and maps This could also be a perf hit. Make TraitObject visitor use a stable set
2022-10-28Rollup merge of #103641 - compiler-errors:issue-103624, r=cjgillotMatthias Krüger-52/+53
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-27Erase regions from CallArgument, add test + blessMichael Goulet-1/+1
2022-10-27Revert "Make ClosureOutlivesRequirement not rely on an unresolved type"Michael Goulet-52/+53
This reverts commit a6b5f95fb028f9feb4a2957c06b35035be2c6155.
2022-10-27(almost) Always use ObligationCtxt when dealing with canonical queriesMichael Goulet-23/+18
2022-10-27Rollup merge of #103255 - oli-obk:opaque_wrong_eq_relation, r=compiler-errorsMatthias Krüger-23/+10
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-27Accept `TyCtxt` instead of `TyCtxtAt` in `Ty::is_*` functionsMaybe Waffle-1/+1
Functions in answer: - `Ty::is_freeze` - `Ty::is_sized` - `Ty::is_unpin` - `Ty::is_copy_modulo_regions`
2022-10-26Convert all #[suggestion_*] attributes to #[suggestion(style = "...")]Xiretza-1/+1
Using the following command: find compiler/ -type f -name '*.rs' -exec perl -i -gpe \ 's/(#\[\w*suggestion)_(short|verbose|hidden)\(\s*(\S+,)?/\1(\3style = "\2",/g' \ '{}' +
2022-10-25Use the general type API instead of directly accessing register_hidden_typeOli Scherer-8/+6
2022-10-25Pull opaque type handling out of the type relating delegateOli Scherer-15/+4
2022-10-25Rollup merge of #103382 - compiler-errors:anon-apit-lt-region-ice, r=cjgillotYuki Okushi-8/+92
Don't ICE when reporting borrowck errors involving regions from `anonymous_lifetime_in_impl_trait` The issue here is that when we have: ``` trait Trait<'a> { .. } fn foo(arg: impl Trait) { .. } ``` The anonymous lifetime `'_` that we generate for `arg: impl Trait` doesn't end up in the argument type (which is a param) but in a where-clause of the function, in a predicate whose self type is that param ty. Fixes #101660 r? ``@cjgillot``
2022-10-23Migrate all diagnosticsNilstrieb-19/+19
2022-10-22Don't ICE on regions from anonymous_lifetime_in_impl_traitMichael Goulet-8/+92
2022-10-20Add context to compiler error messageb4den-1/+1
Changed `creates a temporary which is freed while still in use` to `creates a temporary value which is freed while still in use`
2022-10-20Auto merge of #103290 - matthiaskrgr:rollup-ngozai3, r=matthiaskrgrbors-2/+9
Rollup of 6 pull requests Successful merges: - #103197 (Stabilize proc_macro::Span::source_text) - #103251 (Fix item declaration highlighting) - #103262 (Adjusting test to needs-unwind, with linking issue) - #103268 (rustdoc: remove no-op CSS `nav.sub { font-size: 1rem }`) - #103272 (Remove extra spaces in docs) - #103276 (Erase regions before checking for `Default` in uninitialized binding error) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-20Rollup merge of #103276 - compiler-errors:default-on-uninit-ice, r=TaKO8KiMatthias Krüger-2/+9
Erase regions before checking for `Default` in uninitialized binding error Fixes #103250
2022-10-20Auto merge of #103220 - compiler-errors:deny-infers, r=lcnrbors-53/+52
Deny hashing ty/re/ct inference variables cc `@cjgillot` and https://github.com/rust-lang/rust/pull/102695#issuecomment-1275706528 r? `@lcnr` best reviewed one commit at a time, mostly because the second commit that fixes `ClosureOutlivesRequirement` is mostly noise because of losing its `<'tcx>` lifetime parameter.
2022-10-20Auto merge of #102417 - oli-obk:opaque_lifetimes2, r=jackh726bors-1/+1
Require lifetime bounds for opaque types in order to allow hidden types to capture said lifetimes fixes #96996 cc `@aliemjay`
2022-10-19Erase regions before checking for default in uninitialized binding errorMichael Goulet-2/+9
2022-10-19Make ClosureOutlivesRequirement not rely on an unresolved typeMichael Goulet-53/+52
2022-10-17mir constants: type traversing bye byelcnr-24/+2