summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2022-03-07backport fix for #94502lcnr-1/+10
2022-02-11rework borrowck errors so that it's harder to not set taintedMichael Goulet-52/+107
2022-02-11implement tainted_by_errors in mir borrowckMichael Goulet-11/+29
2022-02-11Revert "Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis"Oli Scherer-3/+2
This reverts commit e7cc3bddbe0d0e374d05e7003e662bba1742dbae, reversing changes made to 734368a200904ef9c21db86c595dc04263c87be0.
2022-02-11Revert "Auto merge of #92306 - Aaron1011:opaque-type-op, r=oli-obk"Oli Scherer-1/+0
This reverts commit 1f0a96862ac9d4c6ca3e4bb500c8b9eac4d83049, reversing changes made to bf242bb1199e25ca2274df5c4114e0c9436b74e9.
2022-02-08Improve opaque type higher-ranked region error message under NLLAaron Hill-0/+1
Currently, any higher-ranked region errors involving opaque types fall back to a generic "higher-ranked subtype error" message when run under NLL. This PR adds better error message handling for this case, giving us the same kinds of error messages that we currently get without NLL: ``` error: implementation of `MyTrait` is not general enough --> $DIR/opaque-hrtb.rs:12:13 | LL | fn foo() -> impl for<'a> MyTrait<&'a str> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `MyTrait` is not general enough | = note: `impl MyTrait<&'2 str>` must implement `MyTrait<&'1 str>`, for any lifetime `'1`... = note: ...but it actually implements `MyTrait<&'2 str>`, for some specific lifetime `'2` error: aborting due to previous error ``` To accomplish this, several different refactoring needed to be made: * We now have a dedicated `InstantiateOpaqueType` struct which implements `TypeOp`. This is used to invoke `instantiate_opaque_types` during MIR type checking. * `TypeOp` is refactored to pass around a `MirBorrowckCtxt`, which is needed to report opaque type region errors. * We no longer assume that all `TypeOp`s correspond to canonicalized queries. This allows us to properly handle opaque type instantiation (which does not occur in a query) as a `TypeOp`. A new `ErrorInfo` associated type is used to determine what additional information is used during higher-ranked region error handling. * The body of `try_extract_error_from_fulfill_cx` has been moved out to a new function `try_extract_error_from_region_constraints`. This allows us to re-use the same error reporting code between canonicalized queries (which can extract region constraints directly from a fresh `InferCtxt`) and opaque type handling (which needs to take region constraints from the pre-existing `InferCtxt` that we use throughout MIR borrow checking).
2022-02-07Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakisbors-2/+3
Lazy type-alias-impl-trait Previously opaque types were processed by 1. replacing all mentions of them with inference variables 2. memorizing these inference variables in a side-table 3. at the end of typeck, resolve the inference variables in the side table and use the resolved type as the hidden type of the opaque type This worked okayish for `impl Trait` in return position, but required lots of roundabout type inference hacks and processing. This PR instead stops this process of replacing opaque types with inference variables, and just keeps the opaque types around. Whenever an opaque type `O` is compared with another type `T`, we make the comparison succeed and record `T` as the hidden type. If `O` is compared to `U` while there is a recorded hidden type for it, we grab the recorded type (`T`) and compare that against `U`. This makes implementing * https://github.com/rust-lang/rfcs/pull/2515 much simpler (previous attempts on the inference based scheme were very prone to ICEs and general misbehaviour that was not explainable except by random implementation defined oddities). r? `@nikomatsakis` fixes #93411 fixes #88236
2022-02-02More let_else adoptionsest31-3/+2
2022-02-02Lazily resolve type-alias-impl-trait defining usesOli Scherer-2/+3
by using an opaque type obligation to bubble up comparisons between opaque types and other types Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
2022-02-01add a rustc::query_stability lintlcnr-0/+1
2022-01-17Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieubors-72/+8
Remove deprecated LLVM-style inline assembly The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it is time to remove `llvm_asm!` to avoid continued maintenance cost. Closes #70173. Closes #92794. Closes #87612. Closes #82065. cc `@rust-lang/wg-inline-asm` r? `@Amanieu`
2022-01-12Remove no longer used `MutateMode` enumTomasz Miąsko-38/+8
2022-01-12Remove deprecated LLVM-style inline assemblyTomasz Miąsko-35/+1
2022-01-07Remove span from UpvarCapture::ByValueGary Guo-1/+1
This span is unused and is superseded by capture_kind_expr_id in CaptureInfo
2022-01-03Rollup merge of #90102 - nbdd0121:box3, r=jonas-schievinkMatthias Krüger-4/+0
Remove `NullOp::Box` Follow up of #89030 and MCP rust-lang/compiler-team#460. ~1 month later nothing seems to be broken, apart from a small regression that #89332 (1aac85bb716c09304b313d69d30d74fe7e8e1a8e) shows could be regained by remvoing the diverging path, so it shall be safe to continue and remove `NullOp::Box` completely. r? `@jonas-schievink` `@rustbot` label T-compiler
2021-12-15Remove in_band_lifetimes from borrowckDániel Buga-1/+0
2021-12-14Stabilize iter::zip.PFPoitras-1/+0
2021-12-03Add initial AST and MIR support for unwinding from inline assemblyAmanieu d'Antras-0/+1
2021-11-30Apply cfg-bootstrap switchMark Rousskov-1/+0
2021-11-15Stabilize format_args_captureJosh Triplett-1/+1
Works as expected, and there are widespread reports of success with it, as well as interest in it.
2021-10-29Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnrbors-1/+0
Revert "Add rustc lint, warning when iterating over hashmaps" Fixes perf regressions introduced in https://github.com/rust-lang/rust/pull/90235 by temporarily reverting the relevant PR.
2021-10-28Auto merge of #90281 - xldenis:public-borrow-set, r=nikomatsakisbors-1/+1
Add BorrowSet to public api This PR adds `BorrowSet` to the public api so that verification tools can obtain the activation and reservation points of two phase borrows without having to redo calculations themselves (and thus potentially differently from rustc). Turns out we already can obtain `MoveData` thanks to the public `HasMoveData` trait, so constructing a `BorrowSet` should not provide much of an issue. However, I can't speak to the soundness of this approach, is it safe to take an under-approximation of `MoveData`? r? `@nikomatsakis`
2021-10-28Revert "Add rustc lint, warning when iterating over hashmaps"Mark Rousskov-1/+0
2021-10-25Add BorrowSet to public apiXavier Denis-1/+1
2021-10-25Auto merge of #90042 - pietroalbini:1.56-master, r=Mark-Simulacrumbors-1/+0
Bump bootstrap compiler to 1.57 Fixes https://github.com/rust-lang/rust/issues/90152 r? `@Mark-Simulacrum`
2021-10-24Rollup merge of #89558 - lcnr:query-stable-lint, r=estebankMatthias Krüger-0/+1
Add rustc lint, warning when iterating over hashmaps r? rust-lang/wg-incr-comp
2021-10-23update cfg(bootstrap)Pietro Albini-1/+0
2021-10-20Remove NullOp::BoxGary Guo-4/+0
2021-10-16Adopt let_else across the compilerest31-0/+1
This performs a substitution of code following the pattern: let <id> = if let <pat> = ... { identity } else { ... : ! }; To simplify it to: let <pat> = ... { identity } else { ... : ! }; By adopting the let_else feature.
2021-10-15allow `potential_query_instability` everywherelcnr-0/+1
2021-10-04Stabilize `const_panic`Jacob Pratt-1/+1
2021-10-01Fix clippy lintsGuillaume Gomez-12/+12
2021-09-28More tracing instrumentationOli Scherer-1/+2
2021-09-25Introduce `Rvalue::ShallowInitBox`Gary Guo-1/+2
2021-09-15Allow call to get_body_with_borrowck_facts without -Z poloniusWill Crichton-5/+3
2021-09-08Rebase fallout.Camille GILLOT-0/+1
2021-09-07Move the dataflow framework to its own crate.Camille GILLOT-7/+7
2021-09-07Move rustc_mir::borrow_check to new crate rustc_borrowck.Camille GILLOT-0/+2389