Commit Graph

25504 Commits

Author SHA1 Message Date
Boxy
bb743f8635 allow caller to force proof tree generation 2023-06-19 09:08:03 +01:00
Boxy
51090b962f show normalizes-to hack and response instantiation goals 2023-06-19 09:06:16 +01:00
Boxy
e367c04dc6 introduce a separate set of types for finalized proof trees 2023-06-19 09:06:16 +01:00
Boxy
7a3665d016 dont use a trait 2023-06-19 09:01:37 +01:00
Boxy
3587d4ced8 say what kind of cache hit 2023-06-19 09:01:37 +01:00
Boxy
a2050ba12d add -Z flag 2023-06-19 09:01:37 +01:00
Boxy
3009b2c647 initial info dump 2023-06-19 09:01:37 +01:00
bors
c911e08514 Auto merge of #112617 - lqd:dump-mir-dataflow, r=tmiasko
make mir dataflow graphviz dumps opt-in

This should save some MIR traversals and allocations that are not really needed.

Small win but noticeable locally. Let's see what LTO/PGO say.

r? `@ghost`
2023-06-19 01:17:40 +00:00
Michael Goulet
3b059e0fdb
Rollup merge of #112758 - bvanjoi:clean-up-resolve, r=petrochenkov
refactor(resolve): delete update_resolution function

The `{ resolution.single_imports.remove(); }` code block does not modify the `binding` of this `resolution`. Therefore, the result of `resolution.binding()` before and after `let t = f(self, resolution)` will remain the same, and it will always satisfy the result: `_ if old_binding.is_some() => return t` or `None => return t`.

And then we delete the `update_resolution` function because it only called once.

r? ``@petrochenkov``
2023-06-18 13:17:08 -07:00
Michael Goulet
b598ea101c
Rollup merge of #112710 - oli-obk:const_to_pat_cleanups2, r=cjgillot
Re-use the deref-pattern recursion instead of duplicating the logic

This essentially just removes code duplication
2023-06-18 13:17:07 -07:00
Michael Goulet
90e51f110c
Rollup merge of #112537 - compiler-errors:dont-record-adjustments-twice, r=cjgillot
Don't record adjustments twice in `note_source_of_type_mismatch_constraint`

We call `lookup_method` a few times in `note_source_of_type_mismatch_constraint`, but that function has side-effects to the typeck results. Replace it with a less side-effect-y variant of the function for use in diagnostics.

Specifically the ICE in #112532 happens because we're recording deref adjustments twice for a call receiver, which causes `ExprUseVisitor` to be angry.

Fixes #112532
2023-06-18 13:17:05 -07:00
bors
939786223f Auto merge of #112636 - clubby789:no-capture-array-ref, r=cjgillot
Don't capture `&[T; N]` when contents isn't read

Fixes the check in #111831
Fixes #112607, although I decided to test the root cause rather than including the example in the issue as a test.
cc `@BoxyUwU`
2023-06-18 15:48:08 +00:00
bohan
894ab2ce7a refactor(resolve): delete update_resolution function 2023-06-18 21:03:59 +08:00
bors
677710eaf0 Auto merge of #112638 - lqd:rpo, r=cjgillot
Switch the BB CFG cache from postorder to RPO

The `BasicBlocks` CFG cache is interesting:
- it stores a postorder, but `traversal::postorder` doesn't use it
- `traversal::reverse_postorder` does traverse the postorder cache backwards
- we do more RPO traversals than postorder traversals (around 20x on the perf.rlo benchmarks IIRC) but it's not cached
- a couple places here and there were manually reversing the non-cached postorder traversal

This PR switches the order of the cache, and makes a bit more use of it. This is a tiny win locally, but it's also for consistency and aesthetics.

r? `@ghost`
2023-06-18 12:45:41 +00:00
Rémy Rakic
08a9f25245 remove redundant combinators between PO and RPO 2023-06-18 09:16:40 +00:00
Matthias Krüger
3436069c34
Rollup merge of #112734 - dswij:bounds-predicates-clause, r=compiler-errors
Make `Bound::predicates`  use `Clause`

Part of #107250

`Bound::predicates` returns an iterator over `Binder<_, Clause>` instead of `Predicate`.

I tried updating `explicit_predicates_of` as well, but it seems that it needs a lot more change than I thought. Will do it in a separate PR instead.
2023-06-18 08:06:43 +02:00
Matthias Krüger
8d3d3cc0ba
Rollup merge of #112667 - compiler-errors:wf-goal-is-clause, r=lcnr
Move WF/ConstEvaluatable goal to clause

It can show up in a param-env, so I think it needs to be a clause kind.

r? ```@lcnr``` or ```@oli-obk```
2023-06-18 08:06:41 +02:00
bors
0c2c243342 Auto merge of #112599 - saethlin:cleaner-panics, r=thomcc
Launch a non-unwinding panic for misaligned pointer deref

This panic already never unwinds, but that's only because it always hits the unwind guard that's created by our `UnwindAction::Terminate`. Hitting the unwind guard generates a huge double-panic backtrace. Now we generate a normal-looking panic message when this check is hit.

r? `@thomcc`
2023-06-18 01:58:51 +00:00
Michael Goulet
4343d36079 Move some bounds computation out of astconv into its own file 2023-06-17 21:27:13 +00:00
Michael Goulet
6594c75449 Move ConstEvaluatable to Clause 2023-06-17 21:27:13 +00:00
Michael Goulet
52d3fc93f2 Move WF goal to clause 2023-06-17 21:20:20 +00:00
bors
3b2073f076 Auto merge of #112746 - matthiaskrgr:rollup-se59bfd, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #110805 (Github action to periodically `cargo update` to keep dependencies current)
 - #112435 (Allow overwriting the sysroot compile flag via --rustc-args)
 - #112610 (Bump stdarch)
 - #112619 (Suggest bumping download-ci-llvm-stamp if the build config for llvm changes)
 - #112738 (make ice msg "Unknown runtime phase" a bit nicer)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-17 19:16:11 +00:00
Matthias Krüger
5518eb863f
Rollup merge of #112738 - matthiaskrgr:ice_msg, r=oli-obk
make ice msg "Unknown runtime phase" a bit nicer
2023-06-17 18:27:31 +02:00
bors
a8a29070f0 Auto merge of #100036 - DrMeepster:box_free_free_box, r=oli-obk
Remove `box_free` lang item

This PR removes the `box_free` lang item, replacing it with `Box`'s `Drop` impl. Box dropping is still slightly magic because the contained value is still dropped by the compiler.
2023-06-17 16:10:57 +00:00
Matthias Krüger
32aee06448 make ice msg "Unknown runtime phase" a bit nicer 2023-06-17 13:55:11 +02:00
Matthias Krüger
981a2a2c00
Rollup merge of #112728 - Zalathar:spanview-charset, r=Nilstrieb
Add `<meta charset="utf-8">` to `-Zdump-mir-spanview` output

Without an explicit `<meta charset>` declaration, some browsers (e.g. Safari) won't detect the page encoding as UTF-8, causing unicode characters in the dump output to display incorrectly.
2023-06-17 12:43:32 +02:00
Matthias Krüger
7051c84326
Rollup merge of #112683 - asquared31415:asm_clobber_ice, r=compiler-errors
fix ICE on specific malformed asm clobber_abi

fixes #112635
2023-06-17 12:43:30 +02:00
dswij
f874345784 Bound::predicates to return Clause 2023-06-17 17:16:30 +08:00
Zalathar
3eddb29555 Add <meta charset="utf-8"> to -Zdump-mir-spanview output 2023-06-17 18:31:35 +10:00
Michael Goulet
d97d4ebecc Remove even more redundant builtin candidates 2023-06-17 03:32:46 +00:00
Michael Goulet
2835d9d1d3 Simplify even more candidates 2023-06-17 03:32:46 +00:00
Michael Goulet
1311bb56f3 Simplify an ObjectData field 2023-06-17 03:32:45 +00:00
Michael Goulet
9e68b6f505 Simplify some impl source candidates 2023-06-17 03:32:45 +00:00
Michael Goulet
1704481bfa Remove some ImplSource candidates 2023-06-17 03:32:45 +00:00
bors
0cc541e4b2 Auto merge of #108860 - oli-obk:tait_alias, r=compiler-errors
Add `AliasKind::Weak` for type aliases.

`type Foo<T: Debug> = Bar<T>;` does not check `T: Debug` at use sites of `Foo<NotDebug>`, because in contrast to a

```rust
trait Identity {
    type Identity;
}
impl<T: Debug> Identity for T {
    type Identity = T;
}
<NotDebug as Identity>::Identity
```

type aliases do not exist in the type system, but are expanded to their aliased type immediately when going from HIR to the type layer.

Similarly:

* a private type alias for a public type is a completely fine thing, even though it makes it a bit hard to write out complex times sometimes
* rustdoc expands the type alias, even though often times users use them for documentation purposes
* diagnostics show the expanded type, which is confusing if the user wrote a type alias and the diagnostic talks about another type that they don't know about.

For type alias impl trait, these issues do not actually apply in most cases, but sometimes you have a type alias impl trait like `type Foo<T: Debug> = (impl Debug, Bar<T>);`, which only really checks it for `impl Debug`, but by accident prevents `Bar<T>` from only being instantiated after proving `T: Debug`. This PR makes sure that we always check these bounds explicitly and don't rely on an implementation accident.

To not break all the type aliases out there, we only use it when the type alias contains an opaque type. We can decide to do this for all type aliases over an edition.

Or we can later extend this to more types if we figure out the back-compat concerns with suddenly checking such bounds.

As a side effect, easily allows fixing https://github.com/rust-lang/rust/issues/108617, which I did.

fixes https://github.com/rust-lang/rust/issues/108617
2023-06-17 00:33:29 +00:00
asquared31415
3dc793e625 fix ICE on specific malformed asm clobber_abi 2023-06-16 19:51:01 -04:00
bors
670a0edaa9 Auto merge of #112716 - compiler-errors:rollup-h77daia, r=compiler-errors
Rollup of 7 pull requests

Successful merges:

 - #111074 (Relax implicit `T: Sized` bounds on `BufReader<T>`, `BufWriter<T>` and `LineWriter<T>`)
 - #112226 (std: available_parallelism using native netbsd api first)
 - #112474 (Support 128-bit enum variant in debuginfo codegen)
 - #112662 (`#[lang_item]` for `core::ptr::Unique`)
 - #112665 (Make assumption functions in new solver take `Binder<'tcx, Clause<'tcx>>`)
 - #112684 (Disable alignment checks on i686-pc-windows-msvc)
 - #112706 (Add `SyntaxContext::is_root`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-16 21:14:24 +00:00
DrMeepster
a5c6cb888e remove box_free and replace with drop impl 2023-06-16 13:41:06 -07:00
Michael Goulet
56c96d7552
Rollup merge of #112706 - WaffleLapkin:syntax_context_is_root, r=petrochenkov
Add `SyntaxContext::is_root`

Makes the code a tad nicer.
2023-06-16 12:53:24 -07:00
Michael Goulet
a5f8859937
Rollup merge of #112684 - saethlin:ignore-windows-alignment, r=wesleywiser
Disable alignment checks on i686-pc-windows-msvc

r? `@wesleywiser` Because you were in the Zulip discussion of this: https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202023-06-15

cc #112480
2023-06-16 12:53:23 -07:00
Michael Goulet
cef94ecedf
Rollup merge of #112665 - compiler-errors:assumption-takes-clause, r=lcnr
Make assumption functions in new solver take `Binder<'tcx, Clause<'tcx>>`

We just use an if-let to match on an optional clause at all the places where we transition from `Predicate` -> `Clause`, but I assume that when things like item-bounds and param-env start to only store `Clause`s then those can just be trivially dropped.

r? ``@lcnr``
2023-06-16 12:53:23 -07:00
Michael Goulet
38fc6be325
Rollup merge of #112662 - Vanille-N:symbol_unique, r=RalfJung
`#[lang_item]` for `core::ptr::Unique`

Tree Borrows is about to introduce experimental special handling of `core::ptr::Unique` in Miri to give it a semantics.
As of now there does not seem to be a clean way (i.e. other than `&format!("{adt:?}") == "std::ptr::Unique"`) to check if an `AdtDef` represents a `Unique`.

r? `@RalfJung`

Draft: making a lang item
2023-06-16 12:53:22 -07:00
Michael Goulet
3eb8c2ae10
Rollup merge of #112474 - ldm0:ldm_enum_debuginfo_128_support, r=compiler-errors
Support 128-bit enum variant in debuginfo codegen

fixes #111600
2023-06-16 12:53:22 -07:00
Oli Scherer
79c2c986a2 Pacify tidy 2023-06-16 19:39:48 +00:00
Oli Scherer
f3b7dd6388 Add AliasKind::Weak for type aliases.
Only use it when the type alias contains an opaque type.

Also does wf-checking on such type aliases.
2023-06-16 19:39:48 +00:00
bors
6bba061467 Auto merge of #112294 - saethlin:inline-me-maybe, r=oli-obk
Ignore the always part of #[inline(always)] in MIR inlining

`#[inline(always)]` is used in two cases: for functions that are so trivial it is always profitable to inline them, but also for functions which LLVM thinks are a bad inlining candidate, but which actually turn out to be profitable to inline. That second justification doesn't apply to the MIR inliner, so ignoring our cost estimation for these functions is not necessarily the right right thing to do.

This is basically a wash on non-check runs and a perf benefit in check runs. There are some notable regressions, and I think we might be able to claw those back by turning `#[inline(always)]` into a stronger hint. But I think this PR stands decently on its own as a tidy simplification.
2023-06-16 18:21:22 +00:00
Oli Scherer
4fdd07fe88 Merge the orphan logic for all alias kinds 2023-06-16 16:16:41 +00:00
Oli Scherer
0f7174a02a Re-use the deref-pattern recursion instead of duplicating the logic 2023-06-16 15:39:12 +00:00
Ben Kimock
c153f3a356 Ignore the always part of #[inline(always)] in MIR inlining 2023-06-16 11:36:02 -04:00
Wesley Wiser
4ef316f397
Update compiler/rustc_mir_transform/src/check_alignment.rs 2023-06-16 09:55:23 -04:00