about summary refs log tree commit diff
path: root/compiler/rustc_borrowck
AgeCommit message (Collapse)AuthorLines
2022-07-24optimize un_dereferouz-a-1/+1
2022-07-20Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisabors-1/+1
Remove the unused StableSet and StableMap types from rustc_data_structures. The current implementation is not "stable" in the same sense that `HashStable` and `StableHasher` are stable, i.e. across compilation sessions. So, in my opinion, it's better to remove those types (which are basically unused anyway) than to give the wrong impression that these are safe for incr. comp. I plan to provide new "stable" collection types soon that can be used to replace `FxHashMap` and `FxHashSet` in query results (see [draft](https://github.com/michaelwoerister/rust/commit/69d03ac7a7d651a397ab793e9d78f8fce3edf7a6)). It's unsound that `HashMap` and `HashSet` implement `HashStable` (see https://github.com/rust-lang/rust/issues/98890 for a recent P-critical bug caused by this) -- so we should make some progress there.
2022-07-20Auto merge of #99506 - Dylan-DPC:rollup-q3msucx, r=Dylan-DPCbors-56/+86
Rollup of 7 pull requests Successful merges: - #98101 (stdlib support for Apple WatchOS) - #99345 (Do not allow typeck children items to constrain outer RPITs) - #99383 (Formalize defining_use_anchor) - #99436 (Add flag to configure `noalias` on `Box<T>`) - #99483 (Fix a numerical underflow in tuple wrap suggestion) - #99485 (Stop injecting `#[allow(unused_qualifications)]` in generated `derive` implementations) - #99486 (Refactor: remove a string comparison between types in `check_str_addition`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-20Remove unused StableMap and StableSet types from rustc_data_structuresMichael Woerister-1/+1
2022-07-20Rollup merge of #99383 - ouz-a:issue_57961, r=oli-obkDylan DPC-56/+65
Formalize defining_use_anchor This tackles issue #57961 Introduces new enum called `DefiningAnchor` that replaces `Option<LocalDefId>` of `defining_use_anchor`. Now every use of it is explicit and exhaustively matched, catching errors like one in the linked issue. This is not a perfect fix but it's a step in the right direction. r? `@oli-obk`
2022-07-20use def_idouz-a-1/+1
2022-07-20take opaq typesouz-a-56/+65
2022-07-20Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"Oli Scherer-38/+2
This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.
2022-07-19use opaque_ty_origin_unchecked instead of destructuring HIRMichael Goulet-12/+4
2022-07-19Do not allow typeck children items to constrain outer RPITsMichael Goulet-0/+29
2022-07-19Use LocalDefId in OpaqueTypeKeyMichael Goulet-11/+11
2022-07-18Auto merge of #99181 - lcnr:arenaGTrc, r=wesleywiserbors-4/+4
`arena > Rc` for query results The `Rc`s have to live for the whole duration as their count cannot go below 1 while stored as part of the query results. By storing them in an arena we should save a bit of memory because we don't have as many independent allocations and also don't have to clone the `Rc` anymore.
2022-07-16Stabilize `let_chains`Caio-1/+1
2022-07-16Rollup merge of #99342 - TaKO8Ki:avoid-symbol-to-string-conversions, ↵Matthias Krüger-20/+15
r=compiler-errors Avoid some `Symbol` to `String` conversions This patch removes some Symbol to String conversions.
2022-07-16Rollup merge of #99258 - estebank:suggest-let, r=wesleywiserMatthias Krüger-2/+65
Provide structured suggestion for dropped temp value
2022-07-16Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebankMatthias Krüger-2/+38
Allow destructuring opaque types in their defining scopes fixes #96572 Before this PR, the following code snippet failed with an incomprehensible error, and similar code just ICEd in mir borrowck. ```rust type T = impl Copy; let foo: T = (1u32, 2u32); let (a, b) = foo; ``` The problem was that the last line created MIR projections of the form `foo.0` and `foo.1`, but `foo`'s type is `T`, which doesn't have fields (only its hidden type does). But the pattern supplies enough type information (a tuple of two different inference types) to bind a hidden type.
2022-07-17avoid some `Symbol` to `String` conversionsTakayuki Maeda-20/+15
2022-07-15Fix rebaseEsteban Küber-5/+3
2022-07-15Avoid incorrect suggestionEsteban Küber-3/+37
We check that there's a single level of block nesting to ensure always correct suggestions. If we don't, then we only provide a free-form message to avoid misleading users in cases like `src/test/ui/nll/borrowed-temporary-error.rs`. We could expand the analysis to suggest hoising all of the relevant parts of the users' code to make the code compile, but that could be too much.
2022-07-15Provide structured suggestion for dropped temp valueEsteban Küber-1/+32
2022-07-15Make destructuring a defining useOli Scherer-0/+8
2022-07-15Introduce opaque type to hidden type projectionOli Scherer-2/+30
2022-07-15provide `generic_param_scope` for region errorslcnr-1/+1
2022-07-14Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPCbors-9/+9
Rollup of 5 pull requests Successful merges: - #97720 (Always create elided lifetime parameters for functions) - #98315 (Stabilize `core::ffi:c_*` and rexport in `std::ffi`) - #98705 (Implement `for<>` lifetime binder for closures) - #99126 (remove allow(rustc::potential_query_instability) in rustc_span) - #99139 (Give a better error when `x dist` fails for an optional tool) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-14Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillotDylan DPC-9/+9
Implement `for<>` lifetime binder for closures This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362)) and allows code like the following: ```rust let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) }; // ^^^^^^^^^^^--- new! ``` cc ``@Aaron1011`` ``@cjgillot``
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-5/+5
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-13Auto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPCbors-12/+9
Rollup of 5 pull requests Successful merges: - #98574 (Lower let-else in MIR) - #99011 (`UnsafeCell` blocks niches inside its nested type from being available outside) - #99030 (diagnostics: error messages when struct literals fail to parse) - #99155 (Keep unstable target features for asm feature checking) - #99199 (Refactor: remove an unnecessary `span_to_snippet`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-13remove an unnecessary `span_to_snippet`Takayuki Maeda-12/+9
2022-07-12Add an indirection for closures in `hir::ExprKind`Maybe Waffle-9/+9
This helps bring `hir::Expr` size down, `Closure` was the biggest variant, especially after `for<>` additions.
2022-07-12arena > Rc for query resultslcnr-4/+4
2022-07-12add new rval, pull deref earlyouz-a-0/+26
2022-07-11Rollup merge of #99140 - TaKO8Ki:implement-is-accessible-span, r=fee1-deadDylan DPC-9/+2
Implement `SourceMap::is_span_accessible` This patch adds `SourceMap::is_span_accessible` and replaces `span_to_snippet(span).is_ok()` and `span_to_snippet(span).is_err()` with it. This removes a `&str` to `String` conversion.
2022-07-11rename a methodTakayuki Maeda-2/+2
2022-07-11implement `is_accessible_span`Takayuki Maeda-9/+2
2022-07-11Rollup merge of #98713 - nikomatsakis:issue-98693, r=jackh726Matthias Krüger-5/+33
promote placeholder bounds to 'static obligations 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. Fixes #98693 ~~(Marking as WIP because I'm still running tests, haven't add the new test, etc)~~ r? ``@jackh726``
2022-07-10Rollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obkMatthias Krüger-4/+4
Avoid some `&str` to `String` conversions This patch removes some `&str` to `String` conversions.
2022-07-10avoid some `&str` to `String` conversionsTakayuki Maeda-4/+4
2022-07-08Rollup merge of #98795 - jackh726:lexical_region_resolve_cleanup, ↵Matthias Krüger-14/+490
r=compiler-errors A few cleanups Each commit is (mostly) self-explanatory. These changes have come as I try to remove `ReEmpty` (#98559).
2022-07-08Auto merge of #98482 - cjgillot:short-struct-span-closure, r=estebankbors-4/+2
Shorten def_span of closures to just their header Continuation of https://github.com/rust-lang/rust/pull/93967.
2022-07-07Move code from rustc_trait_selection/opaque_types to better placesJack Huey-2/+482
2022-07-07Move is_free and is_free_or_static to Region, change resolve_var to ↵Jack Huey-12/+8
resolve_region, and remove RootEmptyRegion
2022-07-07Wording tweakEsteban Küber-8/+21
2022-07-07Fix label on uninit binding field assignmentEsteban Küber-24/+25
2022-07-07Avoid misleading message/label in `match-cfg-fake-edges.rs` testEsteban Küber-23/+41
2022-07-07Review comments: wordingEsteban Küber-29/+40
2022-07-07Tweak wording and spansEsteban Küber-24/+68
2022-07-07On partial uninit error point at where we need initEsteban Küber-44/+204
When a binding is declared without a value, borrowck verifies that all codepaths have *one* assignment to them to initialize them fully. If there are any cases where a condition can be met that leaves the binding uninitialized or we attempt to initialize a field of an unitialized binding, we emit E0381. We now look at all the statements that initialize the binding, and use them to explore branching code paths that *don't* and point at them. If we find *no* potential places where an assignment to the binding might be missing, we display the spans of all the existing initializers to provide some context.
2022-07-07Fix borrowck closure span.Camille GILLOT-3/+1
2022-07-07Shorten span for closures.Camille GILLOT-1/+1
2022-07-07Move `dominators` from Body to BasicBlocksTomasz Miąsko-2/+2