Commit Graph

898 Commits

Author SHA1 Message Date
bors
56ee85274e Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstrieb
Remove some `ref` patterns from the compiler

Previous PR: https://github.com/rust-lang/rust/pull/105368

r? `@Nilstrieb`
2023-01-20 04:52:28 +00:00
Scott McMurray
7d57685682 Also remove #![feature(control_flow_enum)] where possible 2023-01-18 10:22:21 -08:00
Scott McMurray
925dc37313 Stop using BREAK & CONTINUE in compiler
Switching them to `Break(())` and `Continue(())` instead.

libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
2023-01-17 23:17:51 -08:00
Matthias Krüger
68f12338af
Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726
Remove double spaces after dots in comments

Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17 20:21:25 +01:00
Maybe Waffle
6a28fb42a8 Remove double spaces after dots in comments 2023-01-17 08:09:33 +00:00
Maybe Waffle
c21b1f742e Self review suggestions
- add back accidentally removed new lines
- try to deref in patterns, rather than in expressions
  (maybe this was the reason of perf regression?...)
2023-01-17 07:48:20 +00:00
Maybe Waffle
8d3c90ae13 Review suggestions 2023-01-17 07:48:20 +00:00
Maybe Waffle
98f30e833a Undo questionable changes 2023-01-17 07:48:19 +00:00
Waffle Maybe
66751ea73e tidy
rustfmt, pleaaaaase, start supporting rust

Co-authored-by: nils <48135649+Nilstrieb@users.noreply.github.com>
2023-01-17 07:48:19 +00:00
Maybe Waffle
3dca58e249 rustc_const_eval: remove ref patterns (+some pattern matching imps) 2023-01-17 07:48:19 +00:00
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