summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2021-10-14Revert "Stabilize `arbitrary_enum_discriminant`"Mark Rousskov-5/+70
This reverts commit 7a62f29f3171767090949778ce0f161e930706b9.
2021-10-14Emit item no type error even if type inference failsGary Guo-21/+23
2021-10-14Use correct edition for panic in [debug_]assert!() etc.Mara Bos-4/+22
2021-10-13Explicit `PlaceAncestryRelation::SamePlace` and handle like `Descendant`Gary Guo-5/+8
(cherry picked from commit 7275cfa47cf3fdbf41c2ad859ac937bffe5923a4)
2021-10-13Ignore projection type when determining upvar ancestoryGary Guo-1/+1
(cherry picked from commit 54812011600a2c19f7076c438e6eabe6a8063774)
2021-10-13Turn tcx.vtable_allocation() into a query.Michael Woerister-68/+83
(cherry picked from commit b7cc99142ad0cfe47e2fe9f7a82eaf5b672c0573)
2021-10-13Remove untracked vtable-const-allocation cache from tcxMichael Woerister-14/+2
(cherry picked from commit a1e2c0f0ad9e787b5ff2844112fc2324511adf34)
2021-10-13Fix stabilization version for `bindings_after_at`Noah Lev-1/+1
According to the release notes and its PR milestone, it was stabilized in 1.56.0. (cherry picked from commit 6189d0a116c599804656d7befc3d4d35a49a8681)
2021-10-13Disable `SimplifyBranchSame` optimization for nowFabian Wolff-0/+6
(cherry picked from commit dd9b4763a4805e508cafd9aa49eebda27e5298c0)
2021-10-13Update commentsFabian Wolff-8/+18
(cherry picked from commit 20489eaca2ad541a35059d38e2b064c46d3bcc9f)
2021-10-13Fix unsound optimization with explicit variant discriminantsFabian Wolff-4/+14
(cherry picked from commit 529c35331bb3817e90b5099c33d97aa55ad2713d)
2021-10-132229: Consume IfLet exprRoxane-0/+2
(cherry picked from commit 87010206adc0123277d7e355893e83551a28814f)
2021-10-04Auto merge of #89285 - jackh726:issue-88862, r=nikomatsakisbors-8/+8
Don't normalize opaque types with escaping late-bound regions Fixes #88862 Turns out, this has some really bad perf implications in large types (issue #88862). While we technically can handle them fine, it doesn't change test output either way. For now, revert with an added benchmark. Future attempts to change this back will have to consider perf. Needs a perf run once https://github.com/rust-lang/rustc-perf/pull/1033 is merged r? `@nikomatsakis`
2021-10-04Rollup merge of #89208 - wesleywiser:rfc_2229_droporder, r=nikomatsakisJubilee-1/+72
[rfc 2229] Drop fully captured upvars in the same order as the regular drop code Currently, with the new 2021 edition, if a closure captures all of the fields of an upvar, we'll drop those fields in the order they are used within the closure instead of the normal drop order (the definition order of the fields in the type). This changes that so we sort the captured fields by the definition order which causes them to drop in that same order as well. Fixes rust-lang/project-rfc-2229#42 r? `@nikomatsakis`
2021-10-04Auto merge of #89144 - sexxi-goose:insig_stdlib, r=nikomatsakisbors-18/+58
2229: Mark insignificant dtor in stdlib I looked at all public [stdlib Drop implementations](https://doc.rust-lang.org/stable/std/ops/trait.Drop.html#implementors) and categorized them into Insigificant/Maybe/Significant Drop. Reasons are noted here: https://docs.google.com/spreadsheets/d/19edb9r5lo2UqMrCOVjV0fwcSdS-R7qvKNL76q7tO8VA/edit#gid=1838773501 One thing missing from this PR is tagging HashMap as insigificant destructor as that needs some discussion. r? `@Mark-Simulacrum` cc `@nikomatsakis`
2021-10-04Auto merge of #89125 - Aaron1011:remove-intercrate-cache, r=jackh726bors-6/+42
Don't use projection cache or candidate cache in intercrate mode Fixes #88969 It appears that *just* disabling the evaluation cache (in #88994) leads to other issues involving intercrate mode caching. I suspect that since we now always end up performing the full evaluation in intercrate mode, we end up 'polluting' the candidate and projection caches with results that depend on being in intercrate mode in some way. Previously, we might have hit a cached evaluation (stored during non-intercrate mode), and skipped doing this extra work in intercrate mode. The whole situation with intercrate mode caching is turning into a mess. Ideally, we would remove intercrate mode entirely - however, this might require waiting on Chalk.
2021-10-04Rollup merge of #88996 - Aaron1011:trailing-macro-semi, r=petrochenkovYuki Okushi-6/+9
Fix linting when trailing macro expands to a trailing semi When a macro is used in the trailing expression position of a block (e.g. `fn foo() { my_macro!() }`), we currently parse it as an expression, rather than a statement. As a result, we ended up using the `NodeId` of the containing statement as our `lint_node_id`, even though we don't normally do this for macro calls. If such a macro expands to an expression with a `#[cfg]` attribute, then the trailing statement can get removed entirely. This lead to an ICE, since we were usng the `NodeId` of the expression to emit a lint. Ths commit makes us skip updating `lint_node_id` when handling a macro in trailing expression position. This will cause us to lint at the closest parent of the macro call.
2021-10-04Auto merge of #88994 - Aaron1011:intercrate-caching, r=jackh726bors-0/+16
Disable the evaluation cache when in intercrate mode It's possible to use the same `InferCtxt` with both an intercrate and non-intercrate `SelectionContext`. However, the local (inferctxt) evaluation cache is not aware of this distinction, so this kind of `InferCtxt` re-use will pollute the cache wth bad results. This commit avoids the issue by disabling the evaluation cache entirely during intercrate mode.
2021-10-04Auto merge of #88979 - tmiasko:no-remove-zsts-in-generators, r=oli-obkbors-0/+4
Disable RemoveZsts in generators to avoid query cycles Querying layout of a generator requires its optimized MIR. Thus computing layout during MIR optimization of a generator might create a query cycle. Disable RemoveZsts in generators to avoid the issue (similar approach is used in ConstProp transform already). Fixes #88972.
2021-09-16Re-add 71a7f8f1884b2c83eeb4a545eef16df1f2ea6476 post-revert.Felix S. Klock II-1/+4
(cherry picked from commit f26f1ed9a7208c0d928f0413cdd5f0966fa2c399)
2021-09-16Revert "Implement Anonymous{Struct, Union} in the AST"Felix S. Klock II-71/+14
This reverts commit 059b68dd677808e14e560802d235ad40beeba71e. Note that this was manually adjusted to retain some of the refactoring introduced by commit 059b68dd677808e14e560802d235ad40beeba71e, so that it could likewise retain the correction introduced in commit 5b4bc05fa57be19bb5962f4b7c0f165e194e3151 (cherry picked from commit 91feb76d133952825e3eb32bed399ec6e4bd9219)
2021-09-16Manually crafted revert of d4ad050ce5778a09566f6f9ec172565815d54604 .Felix S. Klock II-68/+0
(cherry picked from commit b6aa7e3105a76d1dcb0c4d0e475657056a3885c5)
2021-09-16Revert "Fix ast expanded printing for anonymous types"Felix S. Klock II-6/+10
This reverts commit 5b4bc05fa57be19bb5962f4b7c0f165e194e3151. (cherry picked from commit 5560f6d90a6a15fdb52a30f97d28b439b72f6cf3)
2021-09-16Change scope of temporaries in match guardsMatthew Jasper-5/+5
Each pattern in a match arm has its own copy of the match guard in MIR, with its own temporary, so it has to be dropped before the the guards are joined to the single copy of the arm. (cherry picked from commit ad7f109bfaa92f84bbcdbb5d376edfd8e66812fd)
2021-09-14Fix 2021 `dyn` suggestion that used code as labelNoah Lev-4/+4
The arguments to `span_suggestion` were in the wrong order, so the error looked like this: error[E0783]: trait objects without an explicit `dyn` are deprecated --> src/test/ui/editions/dyn-trait-sugg-2021.rs:10:5 | 10 | Foo::hi(123); | ^^^ help: <dyn Foo>: `use `dyn`` Now the error looks like this, as expected: error[E0783]: trait objects without an explicit `dyn` are deprecated --> src/test/ui/editions/dyn-trait-sugg-2021.rs:10:5 | 10 | Foo::hi(123); | ^^^ help: use `dyn`: `<dyn Foo>` This issue was only present in the 2021 error; the 2018 lint was correct. (cherry picked from commit 486d79f1243135564931c574ce5cfff946ee3867)
2021-09-092229: Don't move out of drop typeAman Arora-1/+33
2021-09-04Auto merge of #88598 - estebank:type-ascription-can-die-in-a-fire, r=wesleywiserbors-5/+55
Detect bare blocks with type ascription that were meant to be a `struct` literal Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.
2021-09-03Auto merge of #88572 - matthewjasper:if-let-scoping-fix, r=oli-obkbors-115/+195
Fix drop handling for `if let` expressions MIR lowering for `if let` expressions is now more complicated now that `if let` exists in HIR. This PR adds a scope for the variables bound in an `if let` expression and then uses an approach similar to how we handle loops to ensure that we reliably drop the correct variables. Closes #88307 cc `@flip1995` `@richkadel` `@c410-f3r`
2021-09-03Auto merge of #88454 - devnexen:sunos_asan, r=wesleywiserbors-2/+4
sunos systems add sanitizer supported.
2021-09-03Auto merge of #88597 - cjgillot:lower-global, r=petrochenkovbors-151/+103
Move global analyses from lowering to resolution Split off https://github.com/rust-lang/rust/pull/87234 r? `@petrochenkov`
2021-09-03Detect bare blocks with type ascription that were meant to be a `struct` literalEsteban Kuber-5/+55
Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.
2021-09-03Auto merge of #88618 - m-ou-se:rollup-6tss5z6, r=m-ou-sebors-31/+6
Rollup of 7 pull requests Successful merges: - #88202 (Add an example for deriving PartialOrd on enums) - #88483 (Fix LLVM libunwind build for non-musl targets) - #88507 (Add test case for using `slice::fill` with MaybeUninit) - #88557 (small const generics cleanup) - #88579 (remove redundant / misplaced sentence from docs) - #88610 (Update outdated docs of array::IntoIter::new.) - #88613 (Update primitive docs for rust 2021.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-09-03Rollup merge of #88557 - lcnr:const-generics-cleanup, r=BoxyUwUMara Bos-31/+6
small const generics cleanup
2021-09-03Auto merge of #86454 - tlyu:refactor-unsized-suggestions, r=davidtwcobors-67/+112
Refactor unsized suggestions `@rustbot` label +A-diagnostics +A-traits +A-typesystem +C-cleanup +T-compiler
2021-09-03Auto merge of #88428 - petrochenkov:stmtid, r=Aaron1011bors-55/+83
expand: Treat more macro calls as statement macro calls This PR implements the suggestion from https://github.com/rust-lang/rust/pull/87981#issuecomment-906641052 and treats fn-like macro calls inside `StmtKind::Item` and `StmtKind::Semi` as statement macro calls, which is consistent with treatment of attribute invocations in the same positions and with token-based macro expansion model in general. This also allows to remove a special case in `NodeId` assignment (previously tried in #87779), and to use statement `NodeId`s for linting (`assign_id!`). r? `@Aaron1011`
2021-09-03Auto merge of #88386 - estebank:unmatched-delims, r=jackh726bors-3/+18
Point at unclosed delimiters as part of the primary MultiSpan Both the place where the parser encounters a needed closed delimiter and the unclosed opening delimiter are important, so they should get the same level of highlighting in the output. _Context: https://twitter.com/mwk4/status/1430631546432675840_
2021-09-03Auto merge of #88363 - michaelwoerister:remapped-diagnostics, r=estebankbors-36/+63
Path remapping: Make behavior of diagnostics output dependent on presence of --remap-path-prefix. This PR fixes a regression (#87745) with `--remap-path-prefix` where the flag stopped causing diagnostic messages to be remapped as well. The regression was introduced in https://github.com/rust-lang/rust/pull/83813 where we erroneously assumed that remapping of diagnostic messages was not desired anymore (because #70642 partially undid that functionality with nobody objecting). The issue is fixed by making `--remap-path-prefix` remap diagnostic messages again, including for paths that have been remapped in upstream crates (e.g. the standard library). This means that "sysroot-localization" (implemented in #70642) is also disabled if `rustc` is invoked with `--remap-path-prefix`. The assumption is that once someone starts explicitly remapping paths they also don't want paths to their local Rust installation in their build output. In the future we might want to give more fine-grained control over this behavior via compiler flags (see https://github.com/rust-lang/rfcs/pull/3127 for a related RFC). For now this PR is intended as a regression fix. This PR is an alternative to https://github.com/rust-lang/rust/pull/88191, which makes diagnostic messages be remapped unconditionally. That approach, however, would effectively revert #70642. Fixes https://github.com/rust-lang/rust/issues/87745. cc `@cbeuw` r? `@ghost`
2021-09-02Auto merge of #85868 - Aaron1011:projection-cache, r=jackh726bors-50/+29
Preserve most sub-obligations in the projection cache Fixes https://github.com/rust-lang/rust/issues/85360 When we evaluate a projection predicate, we may produce sub-obligations. During trait evaluation, evaluating these sub-obligations might cause us to produce `EvaluatedToOkModuloRegions`. When we cache the result of projection in our projection cache, we try to throw away some of the sub-obligations, so that we don't need to re-evaluate/process them the next time we need to perform this particular projection. However, we may end up throwing away predicates that will (recursively) evaluate to `EvaluatedToOkModuloRegions`. If we do, then the result of evaluating a predicate will depend on the state of the predicate cache - this is global untracked state, which interacts badly with incremental compilation. To fix this, we now only discard global predicates that evaluate to `EvaluatedToOk`. This ensures that any predicates that (may) evaluate to `EvaluatedToOkModuloRegions` are kept in the cache, and influence the results of any queries which perform this projection.
2021-09-02Rollup merge of #88592 - b-naber:region_substs, r=oli-obkMara Bos-17/+19
Fix ICE in const check Fixes https://github.com/rust-lang/rust/issues/88433
2021-09-02Rollup merge of #88589 - xFrednet:00000-correct-comment-to-doc, r=petrochenkovMara Bos-39/+39
Correct doc comments inside `use_expr_visitor.rs` Just a simple update. I haven't changed any content inside the comments, as they still seem correct. Have a wonderful rest of the day :upside_down_face:
2021-09-02Rollup merge of #88567 - camelid:query-job-info, r=cjgillotMara Bos-11/+8
Remove redundant `Span` in `QueryJobInfo` Previously, `QueryJobInfo` was composed of two parts: a `QueryInfo` and a `QueryJob`. However, both `QueryInfo` and `QueryJob` have a `span` field, which seem to be the same. So, the `span` was recorded twice. Now, `QueryJobInfo` is composed of a `QueryStackFrame` (the other field of `QueryInfo`) and a `QueryJob`. So, now, the `span` is only recorded once.
2021-09-02Rollup merge of #88543 - m-ou-se:closure-migration-macro-block-fragment, ↵Mara Bos-9/+26
r=estebank Improve closure dummy capture suggestion in macros. Fixes some cases of https://github.com/rust-lang/rust/issues/88440 Fixes https://crater-reports.s3.amazonaws.com/pr-87190-3/try%23a7a572ce3edd6d476191fbfe92c9c1986e009b34/reg/rcodec-1.0.1/log.txt
2021-09-02Rollup merge of #88532 - ptrojahn:single_use, r=davidtwcoMara Bos-5/+2
Remove single use variables
2021-09-02Rollup merge of #88512 - m-ou-se:array-into-iter-deref-stuff, r=estebankMara Bos-24/+30
Upgrade array_into_iter lint to include Deref-to-array types. Fixes https://github.com/rust-lang/rust/issues/88099 Fixes the issue mentioned here: https://github.com/rust-lang/rust/pull/84147#issuecomment-819000436
2021-09-02Report cycle error using 'deepest' obligation in the cycleAaron Hill-1/+3
2021-09-02Preserve most sub-obligations in the projection cacheAaron Hill-49/+26
2021-09-02do not resolve instances for trait fn idsb-naber-17/+19
2021-09-02Auto merge of #88530 - bjorn3:shrink_session, r=cjgillotbors-16/+8
Shrink Session a bit Remove a couple of unnecessary fields from `Session` and remove a `Lock<T>` for a field that is never mutated anyway.
2021-09-02Correct doc comments inside `use_expr_visitor.rs`xFrednet-39/+39
2021-09-02expand: Treat more macro calls as statement macro callsVadim Petrochenkov-55/+83