about summary refs log tree commit diff
path: root/compiler/rustc_mir/src
AgeCommit message (Collapse)AuthorLines
2021-08-23Rename to WrappingRangeAndreas Liljeqvist-4/+4
2021-08-23Use refAndreas Liljeqvist-1/+1
2021-08-22Use custom wrap-around type instead of RangeAndreas Liljeqvist-19/+8
2021-08-22Fix typos “an”→“a” and a few different ones that appeared in the ↵Frank Steffahn-3/+3
same search
2021-08-22Fix more “a”/“an” typosFrank Steffahn-5/+5
2021-08-22Fix more “a”/“an” typosFrank Steffahn-1/+1
2021-08-22Fix typos “a”→“an”Frank Steffahn-14/+14
2021-08-21Auto merge of #88135 - crlf0710:trait_upcasting_part_3, r=nikomatsakisbors-9/+2
Trait upcasting coercion (part 3) By using separate candidates for each possible choice, this fixes type-checking issues in previous commits. r? `@nikomatsakis`
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-8/+4
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-21Auto merge of #88149 - Mark-Simulacrum:prep-never-type, r=jackh726bors-2/+2
Refactor fallback code to prepare for never type This PR contains cherry-picks of some of `@nikomatsakis's` work from #79366, and shouldn't (AFAICT) represent any change in behavior. However, the refactoring is good regardless of the never type work being landed, and will reduce the size of those eventual PR(s) (and rebase pain). I am not personally an expert on this code, and the commits are essentially 100% `@nikomatsakis's,` but they do seem reasonable to me by my understanding. Happy to edit with review, of course. Commits are best reviewed in sequence rather than all together. r? `@jackh726` perhaps?
2021-08-20Auto merge of #88087 - jesyspa:issue-87935-box, r=jackh726bors-3/+1
Check that a box expression's type is Sized This resolves [issue 87935](https://github.com/rust-lang/rust/issues/87935). This makes E0161 (move from an unsized rvalue) much less common. I've replaced the test to use [this case](https://github.com/rust-lang/rust/blob/master/src/test/ui/object-safety/object-safety-by-value-self-use.rs), when a boxed `dyn` trait is passed by value, but that isn't an error when `unsized_locals` is enabled. I think it may be possible to get rid of E0161 entirely by checking that case earlier, but I'm not sure if that's desirable?
2021-08-20Auto merge of #88176 - erikdesjardins:rezst, r=oli-obkbors-3/+0
Reenable RemoveZsts Now that the underlying issue has been fixed by #88124, we can reland #83417. r? `@oli-obk`
2021-08-20Require a box expression's type to be SizedAnton Golov-3/+1
2021-08-20Auto merge of #87686 - matthiaskrgr:clippy_august_21_perf, r=jackh726bors-2/+2
clippy::perf fixes
2021-08-19Revert "Revert "Auto merge of #83417 - erikdesjardins:enableremovezsts, ↵Erik Desjardins-3/+0
r=oli-obk"" This reverts commit 8e11199a153218c13a419df37a9bb675181cccb7.
2021-08-19introduce a Coerce predicateNiko Matsakis-2/+2
2021-08-19Auto merge of #88124 - tmiasko:start-block-critical-edge, r=oli-obkbors-1/+3
Split critical edge targeting the start block Fixes #88043.
2021-08-19Auto merge of #88143 - GuillaumeGomez:rollup-sgh318f, r=GuillaumeGomezbors-4/+4
Rollup of 10 pull requests Successful merges: - #87818 (Fix anchors display in rustdoc) - #87983 (Use more accurate spans when proposing adding lifetime to item) - #88012 (Change WASI's `RawFd` from `u32` to `c_int` (`i32`).) - #88031 (Make `BuildHasher` object safe) - #88036 (Fix dead code warning when inline const is used in pattern) - #88082 (Take into account jobs number for rustdoc GUI tests) - #88109 (Fix environment variable getter docs) - #88111 (Add background-color on clickable definitions in source code) - #88129 (Fix dataflow graphviz bug, make dataflow graphviz modules public) - #88136 (Move private_unused.rs test to impl-trait) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-08-18Rollup merge of #88129 - willcrichton:expose-graphviz-modules, r=ecstatic-morseGuillaume Gomez-4/+4
Fix dataflow graphviz bug, make dataflow graphviz modules public I'm working on a rustc plugin that uses the dataflow framework for MIR analysis. I've found the graphviz utilities extremely helpful for debugging. However, I had to fork the compiler to expose them since they're currently private. I would appreciate if they could be made public so I can build against a nightly instead of a custom fork. Specifically, this PR: * Makes public the `rustc_mir::dataflow::framework::graphviz` module. * Makes public the `rustc_mir::util::pretty::write_mir_fn` function. Here's a concrete example of how I'm using the graphviz module: https://github.com/willcrichton/flowistry/blob/97b843b8b06b4004fbb79b5fcfca3e33c7143bc0/src/slicing/mod.rs#L186-L203 Additionally, this PR fixes a small bug in the diff code that incorrectly shows the updated object as the old object. r? `@ecstatic-morse`
2021-08-18Auto merge of #86700 - lqd:matthews-nll-hrtb-errors, r=nikomatsakisbors-174/+607
Matthew's work on improving NLL's "higher-ranked subtype error"s This PR rebases `@matthewjasper's` [branch](https://github.com/matthewjasper/rust/tree/nll-hrtb-errors) which has great work to fix the obscure higher-ranked subtype errors that are tracked in #57374. These are a blocker to turning full NLLs on, and doing some internal cleanups to remove some of the old region code. The goal is so `@nikomatsakis` can take a look at this early, and I'll then do my best to help do the changes and followup work to land this work, and move closer to turning off the migration mode. I've only updated the branch and made it compile, removed a warning or two. r? `@nikomatsakis` (Here's the [zulip topic to discuss this](https://rust-lang.zulipchat.com/#narrow/stream/122657-t-compiler.2Fwg-nll/topic/.2357374.3A.20improving.20higher-ranked.20subtype.20errors.20via.20.2386700) that Niko wanted)
2021-08-18Auto merge of #87781 - est31:remove_box, r=oli-obkbors-101/+119
Remove box syntax from compiler and tools Removes box syntax from the compiler and tools. In #49733, the future of box syntax is uncertain and the use in the compiler was listed as one of the reasons to keep it. Removal of box syntax [might affect the code generated](https://github.com/rust-lang/rust/pull/49646#issuecomment-379219615) and slow down the compiler so I'd recommend doing a perf run on this.
2021-08-18add fixme about the `type_op_normalize` query in NLL HRTB diagnosticsRémy Rakic-1/+7
2021-08-18Remove box syntax from rustc_mirest31-101/+119
2021-08-18Auto merge of #87738 - lqd:polonius-master, r=nikomatsakisbors-23/+24
Update `polonius-engine` to 0.13.0 This PR updates the use of `polonius-engine` to the recently released 0.13.0: - this version renamed a lot of relations to match the current terminology - "illegal subset relationships errors" (AKA "subset errors" or "universal region errors" in rustc parlance) have been implemented in all variants, and therefore the `Hybrid` variant can be the rustc default once again - some of the blessed expectations were updated: new tests have been added since the last time I updated the tests, diagnostics have changed, etc. In particular: - a few tests had trivial expectations changes such as basic diagnostics changes for the migrate-mode and full NLLs - others were recursion and lengths limits which emits a file, and under the polonius compare-mode, the folder has a different name - a few tests were ignored in the NLL compare-mode for reasons that obviously also apply to Polonius - some diagnostics were unified so that older expectations no longer made sense: the NLL and Polonius outputs were identical. - in a few cases Polonius gets a chance to emit more errors than NLLs A few tests in the compare-mode still are super slow and trigger the 60s warning, or OOM rustc during fact generation, and I've detailed these [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60): - `src/test/ui/numbers-arithmetic/saturating-float-casts.rs` -> OOM during rustc fact generation - `src/test/ui/numbers-arithmetic/num-wrapping.rs` - `src/test/ui/issues/issue-72933-match-stack-overflow.rs` - `src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs` - `src/test/ui/repr/repr-no-niche.rs` In addition, 2 tests don't currently pass and I didn't want to bless them now: they deal with HRTBs and miss errors that NLLs emit. We're currently trying to see if we need chalk to deal with HRTB errors (as we thought we would have to) but during the recent sprint, we discovered that we may be able to detect some of these errors in a way that resembles subset errors: - `ui/hrtb/hrtb-just-for-static.rs` -> 3 errors in NLL, 2 in polonius: a missing error about HRTB + needing to outlive 'static - `ui/issues/issue-26217.rs` -> missing HRTB that makes the test compile instead of emitting an error We'll keep talking about this at the next sprint as well. cc `@rust-lang/wg-polonius` r? `@nikomatsakis`
2021-08-18Fold `vtable_trait_upcasting_coercion_new_vptr_slot` logic into obligation ↵Charles Lew-9/+2
processing.
2021-08-17Fix bug in fmt_diff_withWill Crichton-1/+1
2021-08-17Expose graphviz modulesWill Crichton-3/+3
2021-08-17Auto merge of #86977 - vakaras:body_with_borrowck_facts, r=nikomatsakisbors-17/+105
Enable compiler consumers to obtain mir::Body with Polonius facts. This PR adds a function (``get_body_with_borrowck_facts``) that can be used by compiler consumers to obtain ``mir::Body`` with accompanying borrow checker information. The most important borrow checker information that [our verifier called Prusti](https://github.com/viperproject/prusti-dev) needs is lifetime constraints. I have not found a reasonable way to compute the lifetime constraints on the Prusti side. In the compiler, the constraints are computed during the borrow checking phase and then dropped. This PR adds an additional parameter to the `do_mir_borrowck` function that tells it to return the computed information instead of dropping it. The additionally returned information by `do_mir_borrowck` contains a ``mir::Body`` with non-erased lifetime regions and Polonius facts. I have decided to reuse the Polonius facts because this way I needed fewer changes to the compiler and Polonius facts contains other useful information that we otherwise would need to recompute. Just FYI: up to now, Prusti was obtaining this information by [parsing the compiler logs](https://github.com/viperproject/prusti-dev/blob/b58ced8dfd14ef30582b503d517167ccd771eaff/prusti-interface/src/environment/borrowck/regions.rs#L25-L39). This is not only a hacky approach, but we also reached its limits. r? `@nikomatsakis`
2021-08-17Auto merge of #88056 - erikdesjardins:revertzst, r=oli-obkbors-0/+3
Revert "Auto merge of #83417 - erikdesjardins:enableremovezsts, r=oli-obk" This reverts commit 8007b506ac5da629f223b755f5a5391edd5f6d01, reversing changes made to e55c13e1099b78b1a485202fabc9c1b10b1f1d15. Fixes #88043 r? `@oli-obk`
2021-08-17Split critical edge targeting the start blockTomasz Miąsko-1/+3
2021-08-16Skip assert ICE with default_method_body_is_constDeadbeef-1/+8
functions marked with #[default_method_body_is_const] would ICE when being const checked due to it not being a const function: `tcx.is_const_fn_raw(did)` returns false. We should skip this assert when it is marked with that attribute.
2021-08-16fix typo in bound_region_errors.rsRémy Rakic-1/+1
Co-authored-by: matthewjasper <20113453+matthewjasper@users.noreply.github.com>
2021-08-15Revert "Auto merge of #83417 - erikdesjardins:enableremovezsts, r=oli-obk"Erik Desjardins-0/+3
This reverts commit 8007b506ac5da629f223b755f5a5391edd5f6d01, reversing changes made to e55c13e1099b78b1a485202fabc9c1b10b1f1d15.
2021-08-15De-dupe NLL HRTB diagnostics' use of `type_op_prove_predicate`Rémy Rakic-12/+3
2021-08-15don't derive `Copy` for `RegionElement`Rémy Rakic-4/+8
2021-08-15Slight cleanupRémy Rakic-4/+1
2021-08-15Fix dyn trait warningRémy Rakic-2/+2
2021-08-15Report nicer errors for HRTB NLL errors from queriesMatthew Jasper-18/+234
2021-08-15Report mismatched type errors for bound region errors in NLLMatthew Jasper-12/+35
2021-08-15Track causes for universes created during borrowckMatthew Jasper-128/+328
2021-08-15Simplify BoundUniversalRegionErrorMatthew Jasper-8/+8
2021-08-15Return the canonicalized query from type opsMatthew Jasper-9/+15
2021-08-15Remove unused Option from NllTypeRelatingDelegateMatthew Jasper-26/+16
2021-08-14Auto merge of #83417 - erikdesjardins:enableremovezsts, r=oli-obkbors-3/+0
Run RemoveZsts pass at mir-opt-level=1 per https://github.com/rust-lang/rust/pull/83177#issuecomment-803942217 This pass removes assignments to ZST places. Perf (from https://github.com/rust-lang/rust/pull/83177#issuecomment-803442557): https://perf.rust-lang.org/compare.html?start=41b315a470d583f6446599984ff9ad3bd61012b2&end=bd5d1b96f0c64c9938feea831789e1b5bb2cd4a2 r? `@oli-obk`
2021-08-14Auto merge of #87375 - fee1-dead:move-constness-to-traitpred, r=oli-obkbors-9/+13
Try filtering out non-const impls when we expect const impls **TL;DR**: Associated types on const impls are now bounded; we now disallow calling a const function with bounds when the specified type param only has a non-const impl. r? `@oli-obk`
2021-08-13Rollup merge of #87795 - estebank:erase-lifetimes-in-suggestion, r=oli-obkGuillaume Gomez-7/+12
Avoid ICE caused by suggestion When suggesting dereferencing something that can be iterable in a `for` loop, erase lifetimes and use a fresh `ty::ParamEnv` to avoid 'region constraints already solved' panic. Fix #87657, fix #87709, fix #87651.
2021-08-13Try to fix problemDeadbeef-2/+3
2021-08-13move Constness into TraitPredicateDeadbeef-7/+10
2021-08-12Auto merge of #87916 - nbdd0121:black_box, r=nagisabors-1/+1
Implement `black_box` using intrinsic Introduce `black_box` intrinsic, as suggested in https://github.com/rust-lang/rust/pull/87590#discussion_r680468700. This is still codegenned as empty inline assembly for LLVM. For MIR interpretation and cranelift it's treated as identity. cc `@Amanieu` as this is related to inline assembly cc `@bjorn3` for rustc_codegen_cranelift changes cc `@RalfJung` as this affects MIRI r? `@nagisa` I suppose
2021-08-12Implement `black_box` using intrinsicGary Guo-1/+1
The new implementation allows some `memcpy`s to be optimized away, so the uninit value in ui/sanitize/memory.rs is constructed directly onto the return place. Therefore the sanitizer now says that the value is allocated by `main` rather than `random`.