about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2022-07-19feat: omit suffixes in const generics (e.g. `1_i32`)Artur Sinila-1/+1
Closes #99255
2022-07-18Auto merge of #99232 - lcnr:no-bound-vars-check, r=jackh726bors-2/+5
`replace_bound_vars` fast path: check predicates, don't check consts split out from #98900 `ty::Const` doesn't have precomputed type flags, so computing `has_vars_bound_at_or_above` for constants requires us to visit the const and its contained types and constants. A noop fold should be pretty much equally as fast so removing it prevents us from walking the constant twice in case it contains bound vars. r? `@jackh726`
2022-07-18Use span_bug for unexpected field projection typeJordan McQueen-1/+5
Improves the compiler error backtrace information, as shown in #99363, by using `span_bug` instead of `bug`. New output: ``` build/aarch64-apple-darwin/stage1/bin/rustc /tmp/test.rs --edition=2021 error: internal compiler error: compiler/rustc_middle/src/ty/closure.rs:185:25: Unexpected type Opaque(DefId(0:5 ~ test[db0f]::main::T::{opaque#0}), []) for `Field` projection --> /tmp/test.rs:11:27 | 11 | let Foo((a, b)) = foo; | ^^^ thread 'rustc' panicked at 'Box<dyn Any>', /Users/jmq/src/forked/rust/compiler/rustc_errors/src/lib.rs:1331:9 stack backtrace: ``` (Remainder of output truncated.)
2022-07-18Auto merge of #99181 - lcnr:arenaGTrc, r=wesleywiserbors-0/+1
`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-17Auto merge of #99033 - 5225225:interpreter-validity-checks, r=oli-obkbors-0/+9
Use constant eval to do strict mem::uninit/zeroed validity checks I'm not sure about the code organisation here, I just dumped the check in rustc_const_eval at the root. Not hard to move it elsewhere, in any case. Also, this means cranelift codegen intrinsics lose the strict checks, since they don't seem to depend on rustc_const_eval, and I didn't see a point in keeping around two copies. I also left comments in the is_zero_valid methods about "uhhh help how do i do this", those apply to both methods equally. Also rustc_codegen_ssa now depends on rustc_const_eval... is this okay? Pinging `@RalfJung` since you were the one who mentioned this to me, so I'm assuming you're interested. Haven't had a chance to run full tests on this since it's really warm, and it's 1AM, I'll check out any failures/comments in the morning :)
2022-07-16Stabilize `let_chains`Caio-1/+1
2022-07-16Rollup merge of #99342 - TaKO8Ki:avoid-symbol-to-string-conversions, ↵Matthias Krüger-8/+8
r=compiler-errors Avoid some `Symbol` to `String` conversions This patch removes some Symbol to String conversions.
2022-07-16Rollup merge of #99290 - compiler-errors:revert-98794, r=lcnrMatthias Krüger-9/+1
Revert "Highlight conflicting param-env candidates" This reverts #98794, commit 08135254dcf22be0d5661ea8f75e703b29a83514. Seems to have caused an incremental compilation bug. The root cause of the incr comp bug is somewhat unrelated but is triggered by this PR, so I don't feel comfortable with having this PR in the codebase until it can be investigated further. Fixes #99233.
2022-07-16Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebankMatthias Krüger-3/+24
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-8/+8
2022-07-15Propagate Expectation around binop typeck code to construct more precise ↵Will Crichton-1/+20
trait obligations for binops.
2022-07-15Revert "Highlight conflicting param-env candidates"Michael Goulet-9/+1
This reverts commit 08135254dcf22be0d5661ea8f75e703b29a83514.
2022-07-15Introduce opaque type to hidden type projectionOli Scherer-3/+24
2022-07-15Auto merge of #99278 - Dylan-DPC:rollup-fcln6st, r=Dylan-DPCbors-6/+1
Rollup of 5 pull requests Successful merges: - #88991 (Add Nintendo Switch as tier 3 target) - #98869 (Remove some usages of `guess_head_span`) - #99119 (Refactor: remove a string matching about methods) - #99209 (Correctly handle crate level page on docs.rs as well) - #99246 (Update RLS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-15Rollup merge of #98869 - compiler-errors:stop_guessing_head_span, r=cjgillotDylan DPC-6/+1
Remove some usages of `guess_head_span` No need to pass things through `guess_head_span` if they already point to the head span. Only major change is that we point to the head span of `enum`s on some errors now, which I prefer. r? `@cjgillot`
2022-07-15Auto merge of #99013 - RalfJung:dont-poison-my-places, r=oli-obkbors-0/+2
interpret: get rid of MemPlaceMeta::Poison This is achieved by refactoring the projection code (`{mplace,place,operand}_{downcast,field,index,...}`) so that we no longer need to call `assert_mem_place` in the operand handling.
2022-07-15Rollup merge of #99131 - compiler-errors:label-fn, r=cjgillotDylan DPC-0/+8
Add label for generic arg (+ APIT) and RPIT callables in `label_fn_like` Fixes #98308
2022-07-15remove tcx from ObligationCauseCode::spanMichael Goulet-1/+1
2022-07-15Remove some more usages of guess_head_spanMichael Goulet-6/+1
2022-07-15Auto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, ↵bors-113/+105
r=cjgillot gather body owners Issue #96341
2022-07-14Point out custom Fn-family trait implMichael Goulet-0/+8
2022-07-14Use constant eval to do strict validity checks5225225-0/+9
2022-07-14Auto merge of #99242 - Dylan-DPC:rollup-34bqdh8, r=Dylan-DPCbors-69/+201
Rollup of 6 pull requests Successful merges: - #98072 (Add provider API to error trait) - #98580 (Emit warning when named arguments are used positionally in format) - #99000 (Move abstract const to middle) - #99192 (Fix spans for asm diagnostics) - #99222 (Better error message for generic_const_exprs inference failure) - #99236 (solaris: unbreak build on native platform) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-14Rollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnrDylan DPC-69/+201
Move abstract const to middle Moves AbstractConst (and all associated methods) to rustc middle for use in `rustc_infer`. This allows for const resolution in infer to use abstract consts to walk consts and check if they are resolvable. This attempts to resolve the issue where `Foo<{ concrete const }, generic T>` is incorrectly marked as conflicting, and is independent from the other issue where nested abstract consts must be resolved. r? `@lcnr`
2022-07-14Auto merge of #95956 - yaahc:stable-in-unstable, r=cjgillotbors-4/+15
Support unstable moves via stable in unstable items part of https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/moving.20items.20to.20core.20unstably and a blocker of https://github.com/rust-lang/rust/pull/90328. The libs-api team needs the ability to move an already stable item to a new location unstably, in this case for Error in core. Otherwise these changes are insta-stable making them much harder to merge. This PR attempts to solve the problem by checking the stability of path segments as well as the last item in the path itself, which is currently the only thing checked.
2022-07-14Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPCbors-5/+7
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-14eagerly check for bound vars of predicateslcnr-0/+4
2022-07-14remove `ct.has_vars_bound_at_or_above` callslcnr-2/+1
`ty::Const` doesn't have precomputed type flags, so computing `has_vars_bound_at_or_above` for constants requires us to visit the const and its contained types and constants. A noop fold should be pretty much equally as fast so removing it prevents us from walking the constant twice in case it contains bound vars.
2022-07-14Fix overlapping implskadmin-137/+29
2022-07-14Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillotDylan DPC-5/+7
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-14Auto merge of #98975 - jyn514:unstable_opts, r=wesleywiserbors-27/+27
Rename `debugging_opts` to `unstable_opts` This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear. cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Codegen.20options.20.2F.20debugging.20options r? `@Amanieu` cc `@nikic` `@joshtriplett`
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-27/+27
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-13assigning to a union field can never drop nowRalf Jung-6/+0
2022-07-13collect module item-likes in visit_itemsMiguel Guarniz-7/+10
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-13Auto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPCbors-22/+49
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-13merge visitors in queriesMiguel Guarniz-135/+75
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-13inline associated_bodyMiguel Guarniz-20/+5
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-13use gathered body_owners in par_body_ownersMiguel Guarniz-13/+2
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-13Auto merge of #98145 - ouz-a:some_branch, r=oli-obkbors-4/+39
Pull Derefer before ElaborateDrops _Follow up work to #97025 #96549 #96116 #95887 #95649_ This moves `Derefer` before `ElaborateDrops` and creates a new `Rvalue` called `VirtualRef` that allows us to bypass many constraints for `DerefTemp`. r? `@oli-obk`
2022-07-13get rid of MemPlaceMeta::PoisonRalf Jung-0/+2
MPlaceTy::dangling still exists, but now it is only called in places that actually conceptually allocate something new, so that's fine.
2022-07-13Rollup merge of #99011 - oli-obk:UnsoundCell, r=eddybDylan DPC-22/+42
`UnsafeCell` blocks niches inside its nested type from being available outside fixes #87341 This implements the plan by `@eddyb` in https://github.com/rust-lang/rust/issues/87341#issuecomment-886083646 Somewhat related PR (not strictly necessary, but that cleanup made this PR simpler): #94527
2022-07-13Rollup merge of #98574 - dingxiangfei2009:let-else-thir, r=oli-obkDylan DPC-0/+7
Lower let-else in MIR This MR will switch to lower let-else statements in MIR building instead. To lower let-else in MIR, we build a mini-switch two branches. One branch leads to the matching case, and the other leads to the `else` block. This arrangement will allow temporary lifetime analysis running as-is so that the temporaries are properly extended according to the same rule applied to regular `let` statements. cc https://github.com/rust-lang/rust/issues/87335 Fix #98672
2022-07-12Add an indirection for closures in `hir::ExprKind`Maybe Waffle-5/+7
This helps bring `hir::Expr` size down, `Closure` was the biggest variant, especially after `for<>` additions.
2022-07-12arena > Rc for query resultslcnr-0/+1
2022-07-12Rollup merge of #99154 - rosehuds:master, r=cjgillotDylan DPC-5/+3
use PlaceRef::iter_projections to fix old FIXME I added this function in 53481a5a8fde83ed1a5d7e8302be028a4c7d8da5
2022-07-12Rollup merge of #99038 - jackh726:earlybinder-cleanup, r=lcnrDylan DPC-2/+10
Some more `EarlyBinder` cleanups First commit has a couple unrelated cleanups, but otherwise each commit is self-explanatory r? rust-lang/types
2022-07-12add new rval, pull deref earlyouz-a-4/+39
2022-07-12Move abstract const to rustc_middle::tykadmin-69/+309
2022-07-11move else block into the `Local` structDing Xiang Fei-1/+1
2022-07-11lower let-else in MIR insteadDing Xiang Fei-1/+8