Commit Graph

888 Commits

Author SHA1 Message Date
Jakob Degen
4bc963eba6 Avoid trivial checks on cleanup control flow in MIR validator 2023-01-16 15:01:16 -08:00
Jakob Degen
ec3d993410 Add cycle checking to cleanup control flow validation 2023-01-16 14:51:33 -08:00
Jakob Degen
f49126e3d6 Document wf constraints on control flow in cleanup blocks
Also fixes a bug in dominator computation
2023-01-16 14:51:33 -08:00
Deadbeef
b0aa859c24 fix fmt and bless 2023-01-12 02:28:38 +00:00
Deadbeef
f6725c0a98 fix fn_sig ice 2023-01-12 02:28:38 +00:00
Deadbeef
6e63f7be54 attempt to make a minimal example work 2023-01-12 02:28:37 +00:00
Deadbeef
23718a3cc2 suggest adding const_trait_impl if error because of that 2023-01-12 02:28:37 +00:00
nils
6e0c404f76
Rollup merge of #106648 - Nilstrieb:poly-cleanup, r=compiler-errors
Polymorphization cleanup

Split out of #106233

Use a newtype instead of a bitset directly. This makes the code way easier to read and easier to adapt for future changes.
2023-01-11 17:30:55 +01:00
Albert Larsan
40ba0e84d5
Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
Michael Goulet
f769d34291 Assert defining anchor is set in take_opaque_types 2023-01-09 18:14:28 +00:00
Nilstrieb
2855794257 Use newtype for unused generic parameters 2023-01-09 19:10:00 +01:00
Michael Goulet
6af339dbfa rename find_parent_node to opt_parent_id 2023-01-04 00:43:13 +00:00
bors
f5c3dfdbbf Auto merge of #105085 - oli-obk:stop_promoting_all_the_things, r=RalfJung
Stop promoting all the things

fixes #91009

r? `@RalfJung`
2022-12-24 14:00:37 +00:00
bors
8a97b4812a Auto merge of #106054 - matthiaskrgr:rollup-38epsfh, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #105567 (KCFI test: Also support LLVM 16 output)
 - #105847 (Ensure param-env is const before calling `eval_to_valtree`)
 - #105983 (Add a missing early return in drop tracking `handle_uninhabited_return`)
 - #106027 (rustdoc: simplify CSS and DOM for more-scraped-examples)
 - #106035 (Migrate search tab title color to CSS variable)
 - #106037 (Add regression test for #94293)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-22 20:48:33 +00:00
Matthias Krüger
548d49c789
Rollup merge of #105847 - compiler-errors:issue-104396, r=oli-obk
Ensure param-env is const before calling `eval_to_valtree`

Other queries call `ParamEnv::with_const` *inside* of the query itself (e.g. `const_eval_global_id_for_typeck`), so this could alternatively be moved into the provider of `eval_to_valtree` instead. I don't have a particularly strong opinion, though *theoretically* caching is better if we make the query keys more constrained.

I'm not exactly sure how this is an effect of the `-Zmir-opt-level=3` flag. Maybe something about the inliner causes us to inline an unevaluated const into a body where it can be evaluated, but where it has not yet been normalized.

This seems likely, since we're inlining `from_fn_1::<{ N / 2 }, _>` in `from_fn_2`, which means that we will need to evaluate that constant during the const prop pass after inlining.

Fixes #104396
2022-12-22 19:36:13 +01:00
bors
cca80b9a81 Auto merge of #103957 - JakobDegen:drop-retag, r=RalfJung
Retag as FnEntry on `drop_in_place`

This commit changes the mir drop shim to always retag its argument as if it were a `&mut`.

cc rust-lang/unsafe-code-guidelines#373
2022-12-22 17:48:43 +00:00
bors
75f4ee8b44 Auto merge of #106025 - matthiaskrgr:rollup-vz5rqah, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #105837 (Don't ICE in `check_must_not_suspend_ty` for mismatched tuple arity)
 - #105932 (Correct branch-protection ModFlagBehavior for Aarch64 on LLVM-15)
 - #105960 (Various cleanups)
 - #105985 (Method chain nitpicks)
 - #105996 (Test that async blocks are `UnwindSafe`)
 - #106012 (Clarify that raw retags are not permitted in Mir)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-22 05:30:00 +00:00
bors
8574880108 Auto merge of #106023 - JohnTitor:rollup-k8mettz, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #105584 (add assert messages if chunks/windows are length 0)
 - #105602 (interpret: add read_machine_[ui]size convenience methods)
 - #105824 (str.lines() docstring: clarify that line endings are not returned)
 - #105980 (Refer to "Waker" rather than "RawWaker" in `drop` comment)
 - #105986 (Fix typo in reading_half_a_pointer.rs)
 - #105995 (Add regression test for #96530)
 - #106008 (Sort lint_groups in no_lint_suggestion)
 - #106014 (Add comment explaining what the scrape-examples-toggle.goml GUI test is about)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-22 02:16:59 +00:00
Jakob Degen
0229281d03 Don't run Drop terminators on types that do not have drop glue in const eval 2022-12-21 16:15:56 -08:00
Yuki Okushi
4f29ca386f
Rollup merge of #105602 - RalfJung:read-convenience, r=oli-obk
interpret: add read_machine_[ui]size convenience methods

We have `read_pointer`, so it felt inconsistent to not also have these.

r? ```@oli-obk```
2022-12-22 08:32:10 +09:00
bors
bdbe392a13 Auto merge of #105613 - Nilstrieb:rename-assert_uninit_valid, r=RalfJung
Rename `assert_uninit_valid` intrinsic

It's not about "uninit" anymore but about "filling with 0x01 bytes" so the name should at least try to reflect that.

This is actually not fully correct though, as it does still panic for all uninit with `-Zstrict-init-checks`. I'm not sure what the best way is to deal with that not causing confusion. I guess we could just remove the flag? I don't think having it makes a lot of sense anymore with the direction that we have chose to go. It could be relevant again if #100423 lands so removing it may be a bit over eager.

r? `@RalfJung`
2022-12-21 23:20:04 +00:00
Jakob Degen
7c4c620475 Forbid RetagKind::TwoPhase as well 2022-12-21 11:46:13 -08:00
Jakob Degen
cb2c7bb833 Clarify that raw retags are not permitted in Mir 2022-12-21 10:32:01 -08:00
Matthias Krüger
22379779b5
Rollup merge of #105875 - matthiaskrgr:needless_borrowed_reference, r=oli-obk
don't destuct references just to reborrow
2022-12-18 18:57:05 +01:00
Matthias Krüger
a108d55ce6 don't restuct references just to reborrow 2022-12-18 17:04:32 +01:00
Matthias Krüger
0aa4cde747 avoid .into() conversion to identical types 2022-12-18 16:20:32 +01:00
Michael Goulet
c1181e1224 Ensure param-env is const before calling eval_to_valtree 2022-12-17 22:33:06 +00:00
Ralf Jung
5a06b1e67c simplify alignment_check_failed a bit 2022-12-15 16:48:30 +00:00
Oli Scherer
b05c790fd6 Reuse the ctfe error emitting logic for the future incompat lint 2022-12-15 16:48:24 +00:00
Oli Scherer
dec05e9c73 Factor decorate closure out into a method 2022-12-15 16:25:50 +00:00
Oli Scherer
d9d92ed7da Move alignment failure error reporting to machine 2022-12-15 16:07:35 +00:00
Oli Scherer
d66824dbc4 Make alignment checks a future incompat lint 2022-12-15 16:07:28 +00:00
Oli Scherer
ed71e32e14 Always pass alignment and handle checking lazily 2022-12-15 15:51:43 +00:00
Ralf Jung
fa83763491 always check alignment during CTFE 2022-12-15 15:36:11 +00:00
Oli Scherer
a5cd3bde95 Ensure no one constructs AliasTys themselves 2022-12-14 15:36:39 +00:00
bors
918d0ac38e Auto merge of #104986 - compiler-errors:opaques, r=oli-obk
Combine `ty::Projection` and `ty::Opaque` into `ty::Alias`

Implements https://github.com/rust-lang/types-team/issues/79.

This PR consolidates `ty::Projection` and `ty::Opaque` into a single `ty::Alias`, with an `AliasKind` and `AliasTy` type (renamed from `ty::ProjectionTy`, which is the inner data of `ty::Projection`) defined as so:

```
enum AliasKind {
  Projection,
  Opaque,
}

struct AliasTy<'tcx> {
  def_id: DefId,
  substs: SubstsRef<'tcx>,
}
```

Since we don't have access to `TyCtxt` in type flags computation, and because repeatedly calling `DefKind` on the def-id is expensive, these two types are distinguished with `ty::AliasKind`, conveniently glob-imported into `ty::{Projection, Opaque}`. For example:

```diff
  match ty.kind() {
-   ty::Opaque(..) =>
+   ty::Alias(ty::Opaque, ..) => {}
    _ => {}
  }
```

This PR also consolidates match arms that treated `ty::Opaque` and `ty::Projection` identically.

r? `@ghost`
2022-12-14 01:19:24 +00:00
Matthias Krüger
e0e9f3a7b7
Rollup merge of #105659 - JakobDegen:storage-live-borrow, r=davidtwco
Don't require owned data in `MaybeStorageLive`

Small improvement that avoids a clone. I don't expect this to have any noticeable perf effects, but better to have it than not to.

r? ``@tmiasko``
2022-12-13 19:57:12 +01:00
Michael Goulet
96cb18e864 Combine identical alias arms 2022-12-13 17:48:55 +00:00
Michael Goulet
61adaf8187 Combine projection and opaque into alias 2022-12-13 17:48:55 +00:00
Michael Goulet
c13bd83528 squash OpaqueTy and ProjectionTy into AliasTy 2022-12-13 17:40:27 +00:00
Michael Goulet
5c6afb850c ProjectionTy.item_def_id -> ProjectionTy.def_id 2022-12-13 17:34:44 +00:00
Michael Goulet
7f3af72606 Use ty::OpaqueTy everywhere 2022-12-13 17:29:26 +00:00
Nilstrieb
8b2a7da3b0 Rename assert_uninit_valid intrinsic
It's not about "uninit" anymore but about "filling with 0x01 bytes" so
the name should at least try to reflect that.
2022-12-13 18:08:35 +01:00
Jakob Degen
3522d48112 Don't require owned data in MaybeStorageLive 2022-12-13 04:22:47 -08:00
Oli Scherer
063b1675b2 Clarify what "this" means 2022-12-13 09:51:03 +00:00
Ralf Jung
158894464c interpret: add read_machine_[ui]size convenience methods 2022-12-12 11:10:19 +01:00
Matthias Krüger
2daa3bcbc2
Rollup merge of #105537 - kadiwa4:remove_some_imports, r=fee1-dead
compiler: remove unnecessary imports and qualified paths

Some of these imports were necessary before Edition 2021, others were already in the prelude.

I hope it's fine that this PR is so spread-out across files :/
2022-12-11 09:51:57 +01:00
KaDiWa
9bc69925cb
compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
Jakob Degen
9fb8da8f8f Remove unneeded field from SwitchTargets 2022-12-09 04:53:10 -08:00
bors
14ca83a04b Auto merge of #105486 - matthiaskrgr:rollup-o7c4l1c, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #105216 (Remove unused GUI test)
 - #105245 (attempt to clarify align_to docs)
 - #105387 (Improve Rustdoc scrape-examples UI)
 - #105389 (Enable profiler in dist-powerpc64le-linux)
 - #105427 (Dont silently ignore rustdoc errors)
 - #105442 (rustdoc: clean up docblock table CSS)
 - #105443 (Move some queries and methods)
 - #105455 (use the correct `Reveal` during validation)
 - #105470 (Clippy: backport ICE fix before beta branch)
 - #105474 (lib docs: fix typo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-09 09:19:26 +00:00