summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src
AgeCommit message (Collapse)AuthorLines
2022-07-15promote placeholder bounds to 'static obligationsNiko Matsakis-5/+33
In NLL, when we are promoting a bound out from a closure, if we have a requirement that `T: 'a` where `'a` is in a higher universe, we were previously ignoring that, which is totally wrong. We should be promoting those constraints to `'static`, since universes are not expressible across closure boundaries.
2022-06-24Auto merge of #98109 - nikomatsakis:issue-98095, r=jackh726bors-21/+82
fix universes in the NLL type tests In the NLL code, we were not accommodating universes in the `type_test` logic. Fixes #98095. r? `@compiler-errors` This breaks some tests, however, so the purpose of this branch is more explanatory and perhaps to do a crater run.
2022-06-23Rollup merge of #98184 - compiler-errors:elided-lifetime-in-impl-nll, r=cjgillotMichael Goulet-5/+56
Give name if anonymous region appears in impl signature Fixes #98170 We probably should remove the two unwraps in [`report_general_error`](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_borrowck/diagnostics/region_errors.rs.html#683-685), but I have no idea what to provide if those regions are missing, so I've kept those in. Let me know if I should try harder to remove those.
2022-06-23run `x.py fmt`Niko Matsakis-4/+1
2022-06-23apply suggestions from oli-obkNiko Matsakis-1/+1
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2022-06-23rename IfEqBound to IfEqNiko Matsakis-4/+4
2022-06-23remove VerifyBound::IfEq variantNiko Matsakis-23/+0
2022-06-22Auto merge of #98279 - cjgillot:all-fresh-nofn, r=petrochenkovbors-1/+8
Create elided lifetime parameters for function-like types Split from https://github.com/rust-lang/rust/pull/97720 This PR refactor lifetime generic parameters in bare function types and parenthesized traits to introduce the additional required lifetimes as fresh parameters in a `for<>` bound. This PR does the same to lifetimes appearing in closure signatures, and as-if introducing `for<>` bounds on closures (without the associated change in semantics). r? `@petrochenkov`
2022-06-21Rollup merge of #98022 - compiler-errors:erroneous-borrowck-span, r=oli-obkYuki Okushi-10/+14
Fix erroneous span for borrowck error I am not confident that this is the correct fix, but it does the job. Open to suggestions for a real fix instead. Fixes #97997 The issue is that we pass a [dummy location](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/mir/visit.rs.html#302) when type-checking the ["required consts"](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Body.html#structfield.required_consts) that are needed by the MIR body during borrowck. This means that when we fail to evaluate the constant, we use the span of `bb0[0]`, instead of the actual span of the constant. There are quite a few other places that use `START_BLOCK.start_location()`, `Location::START`, etc. when calling for a random/unspecified `Location` value. This is because, unlike (for example) `Span`, we don't have a dummy/miscellaneous value to use instead. I would appreciate guidance (either in this PR, or a follow-up) on what needs to be done to clean this up in general.
2022-06-20Give name if anonymous region appears in impl signatureMichael Goulet-5/+56
2022-06-19Only use special async fn case for actual async fns in borrowck diagnostics.Camille GILLOT-1/+8
2022-06-19Move RegionKind to rustc_type_irJack Huey-1/+1
2022-06-15fix universes in the NLL type testsNiko Matsakis-1/+24
In the NLL code, we were not accommodating universes in the `type_test` logic. This led to issue 98095.
2022-06-15implement (unused) matching solverNiko Matsakis-22/+81
2022-06-15simply the IfEq bound -- we only ever use a regionNiko Matsakis-3/+8
the excessive generality becomes annoying later because it wouldn't implement type folding etc
2022-06-15Rollup merge of #98110 - cjgillot:closure-brace, r=Aaron1011Yuki Okushi-13/+15
Make `ExprKind::Closure` a struct variant. Simple refactor since we both need it to introduce additional fields in `ExprKind::Closure`. r? ``@Aaron1011``
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-2/+2
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
2022-06-13remove unnecessary `to_string` and `String::new`Takayuki Maeda-16/+16
2022-06-12Fix erroneous span for borrowck errorMichael Goulet-10/+14
2022-06-12Make `ExprKind::Closure` a struct variant.Camille GILLOT-13/+15
2022-06-10bound_vars -> infer: don't return lt maplcnr-7/+5
2022-06-10only expect lb lt for fn calls in mir typecklcnr-6/+8
2022-06-07Auto merge of #97081 - oli-obk:outlives_query_fast_path, r=jackh726bors-1/+1
Re-use the type op instead of calling the implied_outlives_bounds query directly r? `@ghost`
2022-06-03Rollup merge of #97415 - cjgillot:is-late-bound-solo, r=estebankDylan DPC-4/+4
Compute `is_late_bound_map` query separately from lifetime resolution This query is actually very simple, and is only useful for functions and method. It can be computed directly by fetching the HIR, with no need to embed it within the lifetime resolution visitor. Based on https://github.com/rust-lang/rust/pull/96296
2022-06-03Compute `is_late_bound` in a separate query.Camille GILLOT-2/+2
The computation is actually much simpler, and can be done by directly fetching the HIR for the `FnDecl` and its generics.
2022-06-03Manipulate lifetimes by LocalDefId for region resolution.Camille GILLOT-2/+2
2022-06-03Rollup merge of #97653 - RalfJung:int-to-ptr, r=oli-obkDylan DPC-13/+37
add cast kind of from_exposed_addr (int-to-ptr casts) This is basically the dual to https://github.com/rust-lang/rust/pull/97582, for int2ptr casts. Cc `@tmiasko` https://github.com/rust-lang/rust/issues/97649
2022-06-02add cast kind of from_exposed_addr (int-to-ptr casts)Ralf Jung-13/+37
2022-06-02Rollup merge of #97023 - cjgillot:uniform-anon, r=estebankDylan DPC-4/+6
Diagnose anonymous lifetimes errors more uniformly between async and regular fns Async fns and regular fns are desugared differently. For the former, we create a generic parameter at HIR level. For the latter, we just create an anonymous region for typeck. I plan to migrate regular fns to the async fn desugaring. Before that, this PR attempts to merge the diagnostics for both cases. r? ```@estebank```
2022-06-01rename PointerAddress → PointerExposeAddressRalf Jung-1/+1
2022-05-31Add a pointer to address cast kindTomasz Miąsko-3/+17
A pointer to address cast are often special-cased. Introduce a dedicated cast kind to make them easy distinguishable.
2022-05-29Handle anonymous lifetimes properly in diagnostics.Camille GILLOT-4/+6
2022-05-28Fix TyKind lint, make consts no longer fn, etcMichael Goulet-3/+5
2022-05-28Initial fixes on top of type interner commitMichael Goulet-2/+4
2022-05-28Auto merge of #97284 - b-naber:constraint-dyn-impl-suggestion, r=estebankbors-64/+263
Add suggestion for relaxing static lifetime bounds on dyn trait impls in NLL This PR introduces suggestions for relaxing static lifetime bounds on impls of dyn trait items for NLL similar to what is already available in lexical region diagnostics. Fixes https://github.com/rust-lang/rust/issues/95701 r? `@estebank`
2022-05-26clippy::complexity fixesMatthias Krüger-3/+3
clone_on_copy useless_format bind_instead_of_map filter_map_identity useless_conversion map_flatten unnecessary_unwrap
2022-05-26rebase, use Ty in CallArgument and re-insert static_assert_size on ↵b-naber-21/+16
ConstraintCategory
2022-05-25suggest constraining dyn trait in impl in NLLb-naber-28/+197
2022-05-25add def_id and substs to ConstraintCategory::CallArgumentb-naber-36/+71
2022-05-23Refactor call terminator to always hold a destination placeJakob Degen-25/+24
2022-05-22Lifetime variance fixes for rustcMichael Goulet-14/+18
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-199/+217
2022-05-17Change `Successors` to `impl Iterator<Item = BasicBlock>`SparrowLii-6/+6
2022-05-16Some tracing cleanupsOli Scherer-1/+1
2022-05-14Auto merge of #96883 - jackh726:early-binder-2, r=oli-obkbors-4/+9
Add EarlyBinder Chalk has no concept of `Param` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L579) or `ReEarlyBound` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L1308). Everything is just "bound" - the equivalent of rustc's late-bound. It's not completely clear yet whether to move everything to the same time of binder in rustc or add `Param` and `ReEarlyBound` in Chalk. Either way, tracking when we have or haven't already substituted out these in rustc can be helpful. As a first step, I'm just adding a `EarlyBinder` newtype that is required to call `subst`. I also add a couple "transparent" `bound_*` wrappers around a couple query that are often immediately substituted. r? `@nikomatsakis`
2022-05-13Add bound_type_ofJack Huey-4/+5
2022-05-13For non-defining opaque type usage errors, don't try to also prove all trait ↵Oli Scherer-106/+1
bounds
2022-05-10Introduce EarlyBinderJack Huey-5/+9
2022-05-10Auto merge of #96736 - oli-obk:tait_missing_wf_check, r=davidtwcobors-0/+1
Check hidden types for well formedness at the definition site instead of only at the opaque type itself work towards #90409 . We'll need to look into closure and generator bodies of closures and generators nested inside the hidden type in order to fix that. In hindsight this PR is not necessary for that, but it may be a bit easier with it and we'll get better diagnostics from it on its own.
2022-05-10Check hidden types for well formedness at the definition site instead of ↵Oli Scherer-0/+1
only at the opaque type itself