summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src
AgeCommit message (Collapse)AuthorLines
2023-07-08Rollup merge of #113217 - ericmarkmartin:lower-type-relative-ctor-to-adt, ↵Matthias Krüger-15/+32
r=cjgillot resolve typerelative ctors to adt Associated issue: #110508 r? ``@spastorino``
2023-07-07Rename `adjustment::PointerCast` and variants using it to `PointerCoercion`Nilstrieb-16/+25
It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a some enum variants. Make it clear there these are only coercion to make it clear why only some pointer related "casts" are in the enum.
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-23/+31
2023-07-04Replace `const_error` methods with `Const::new_error`Boxy-1/+1
2023-07-04Replace `mk_const` with `Const::new_x` methodsBoxy-8/+16
2023-07-02refactorEric Mark Martin-17/+19
2023-06-30resolve typerelative ctors to adtEric Mark Martin-12/+27
2023-06-28remove cruftEric Mark Martin-1/+0
2023-06-28use translatable subdiagnosticEric Mark Martin-1/+6
2023-06-28add note for non-exhaustive matches with guardsEric Mark Martin-0/+5
2023-06-27Rollup merge of #113093 - WaffleLapkin:become_unuwuable_in_thir, r=NilstriebMatthias Krüger-8/+24
`thir`: Add `Become` expression kind This PR is pretty small and just adds `thir::ExprKind::Become`. I didn't include the checks that will be done on thir, since they are much more complicated and can be done in parallel with with MIR (or, well, at least I believe they can). r? `@Nilstrieb`
2023-06-27`thir`: Add `Become` expression kindMaybe Waffle-8/+24
2023-06-27Rollup merge of #113039 - matthiaskrgr:custom_mir, r=compiler-errorsMatthias Krüger-1/+5
make custom mir ICE a bit nicer
2023-06-27Auto merge of #112693 - ericmarkmartin:use-more-placeref, r=spastorinobors-15/+4
Use PlaceRef abstractions more often Associated issue: https://github.com/rust-lang/rust/issues/80647 r? `@spastorino`
2023-06-26make custom mir ICE a bit nicerMatthias Krüger-1/+5
2023-06-26`hir`: Add `Become` expression kindMaybe Waffle-0/+5
2023-06-25use PlaceRef abstractions more consistentlyEric Mark Martin-15/+4
2023-06-21Rollup merge of #112759 - cjgillot:closure-names, r=oli-obkNilstrieb-0/+18
Make closure_saved_names_of_captured_variables a query. As we will start removing debuginfo during MIR optimizations, we need to keep them somewhere.
2023-06-20address most easy commentsZiru Niu-13/+7
2023-06-20merge `BorrowKind::Unique` into `BorrowKind::Mut`Ziru Niu-17/+27
2023-06-19Rollup merge of #112232 - fee1-dead-contrib:match-eq-const-msg, r=b-naberMichael Goulet-5/+11
Better error for non const `PartialEq` call generated by `match` Resolves #90237
2023-06-19Remove duplicated comment.Camille GILLOT-7/+0
2023-06-19Make closure_saved_names_of_captured_variables a query.Camille GILLOT-0/+25
2023-06-18Better error for non const `PartialEq` call generated by `match`Deadbeef-5/+11
2023-06-16Re-use the deref-pattern recursion instead of duplicating the logicOli Scherer-59/+26
2023-06-04Show note for type ascription interpreted as a constant pattern, not a new ↵许杰友 Jieyou Xu (Joe)-1/+6
variable Given the code ```rust pub fn main() { const y: i32 = 4; let y: i32 = 3; } ``` `y` in the let binding is actually interpreted as a constant pattern and is not a new variable, causing confusing diagnostics about refutable patterns in local binding. This commit extends the note for type ascription as a constant pattern to `AscribeUserType` patterns as well.
2023-06-02Separate AnonConst from ConstBlock in HIR.Camille GILLOT-12/+5
2023-05-31Inline from_inline_const into its sole call siteOli Scherer-32/+61
2023-05-31Explain and simplify valtree -> mir-const fallbackOli Scherer-7/+9
2023-05-31`bug!` message nitOli Scherer-1/+1
2023-05-31Simplify an `if let Some` to a `?`Oli Scherer-13/+10
2023-05-31Remove some dead codeOli Scherer-15/+2
2023-05-31Remove `lit_to_mir_constant` queryOli Scherer-12/+11
2023-05-31Remove `deref_mir_constant`Oli Scherer-3/+0
2023-05-31Only rewrite valtree-constants to patterns and keep other constants opaqueOli Scherer-156/+224
2023-05-30Remove a hack that has become obsolete after ↵Oli Scherer-13/+1
https://github.com/rust-lang/rust/pull/108080
2023-05-30Get `lit_to_const` in sync with `const_to_valtree_inner`Oli Scherer-0/+13
Without this, we'd have a discrepancy where float literals are not lowered to valtrees, but float constants are.
2023-05-29Rename `tcx.mk_re_*` => `Region::new_*`Maybe Waffle-1/+1
2023-05-27Rollup merge of #111952 - cjgillot:drop-replace, r=WaffleLapkinGuillaume Gomez-4/+6
Remove DesugaringKind::Replace. A simple boolean flag is enough.
2023-05-26Rollup merge of #111951 - cjgillot:uninh-comment, r=NadrierilMatthias Krüger-2/+2
Correct comment on privately uninhabited pattern. Follow-up to https://github.com/rust-lang/rust/pull/111624#discussion_r1204767933 r? `@Nadrieril`
2023-05-25Rollup merge of #111757 - lowr:fix/lint-attr-on-match-arm, r=eholkMichael Goulet-23/+35
Consider lint check attributes on match arms Currently, lint check attributes on match arms have no effect for some lints. This PR makes some lint passes to take those attributes into account. - `LateContextAndPass` for late lint doesn't update `last_node_with_lint_attrs` when it visits match arms. This leads to lint check attributes on match arms taking no effects on late lints that operate on the arms' pattern: ```rust match value { #[deny(non_snake_case)] PAT => {} // `non_snake_case` only warned due to default lint level } ``` To be honest, I'm not sure whether this is intentional or just an oversight. I've dug the implementation history and searched up issues/PRs but couldn't find any discussion on this. - `MatchVisitor` doesn't update its lint level when it visits match arms. This leads to check lint attributes on match arms taking no effect on some lints handled by this visitor, namely: `bindings_with_variant_name` and `irrefutable_let_patterns`. This seems to be a fallout from #108504. Before 05082f57afbf5d2e8fd7fb67719336d78b58e759, when the visitor operated on HIR rather than THIR, check lint attributes for the said lints were effective. [This playground][play] compiles successfully on current stable (1.69) but fails on current beta and nightly. I wasn't sure where best to place the test for this. Let me know if there's a better place. [play]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=38432b79e535cb175f8f7d6d236d29c3 [play-match]: https://play.rust-lang.org/?version=beta&mode=debug&edition=2021&gist=629aa71b7c84b269beadeba664e2221d
2023-05-25Remove DesugaringKind::Replace.Camille GILLOT-4/+6
2023-05-25Correct comment on privately uninhabited pattern.Camille GILLOT-2/+2
2023-05-25Rollup merge of #111624 - cjgillot:private-uninhabited-pattern, r=petrochenkovMatthias Krüger-0/+20
Emit diagnostic for privately uninhabited uncovered witnesses. Fixes https://github.com/rust-lang/rust/issues/104034 cc `@Nadrieril`
2023-05-25Auto merge of #111925 - Manishearth:rollup-z6z6l2v, r=Manishearthbors-7/+7
Rollup of 5 pull requests Successful merges: - #111741 (Use `ObligationCtxt` in custom type ops) - #111840 (Expose more information in `get_body_with_borrowck_facts`) - #111876 (Roll compiler_builtins to 0.1.92) - #111912 (Use `Option::is_some_and` and `Result::is_ok_and` in the compiler ) - #111915 (libtest: Improve error when missing `-Zunstable-options`) r? `@ghost` `@rustbot` modify labels: rollup
2023-05-24Rollup merge of #111841 - matthewjasper:validate-match-guards, r=compiler-errorsMatthias Krüger-2/+6
Run AST validation on match guards correctly AST validation was being skipped on match guards other than `if let` guards.
2023-05-24Emit diagnostic for privately uninhabited uncovered witnesses.Camille GILLOT-0/+20
2023-05-24Use `Option::is_some_and` and `Result::is_ok_and` in the compilerMaybe Waffle-7/+7
2023-05-23Rollup merge of #111579 - scottmcm:enum-as-signed, r=oli-obkDylan DPC-43/+58
Also assume wrap-around discriminants in `as` MIR building Resolves this FIXME: https://github.com/rust-lang/rust/blob/8d18c32b61476ed16dd15074e71be3970368d6d7/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs#L231 r? `@oli-obk`
2023-05-23Rollup merge of #111501 - WaffleLapkin:drivebycleanupuwu, r=oli-obkDylan DPC-12/+16
MIR drive-by cleanups Some random drive-by cleanups I did while working with MIR/THIR.