about summary refs log tree commit diff
path: root/compiler/rustc_middle
AgeCommit message (Collapse)AuthorLines
2023-06-19change binders from tuple structs to named fieldslcnr-55/+60
2023-06-19Promote unchecked_add/sub/mul/shl/shr to mir::BinOpScott McMurray-2/+29
2023-06-19move to nested moduleBoxy-130/+134
2023-06-19show normalizes-to hack and response instantiation goalsBoxy-2/+28
2023-06-19introduce a separate set of types for finalized proof treesBoxy-28/+39
2023-06-19say what kind of cache hitBoxy-3/+10
2023-06-19initial info dumpBoxy-11/+181
2023-06-19fix docDeadbeef-1/+1
2023-06-18Auto merge of #112638 - lqd:rpo, r=cjgillotbors-38/+26
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-18remove redundant combinators between PO and RPORémy Rakic-30/+6
2023-06-18Rollup merge of #112734 - dswij:bounds-predicates-clause, r=compiler-errorsMatthias Krüger-0/+7
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-18Rollup merge of #112667 - compiler-errors:wf-goal-is-clause, r=lcnrMatthias Krüger-25/+23
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-18Better error for non const `PartialEq` call generated by `match`Deadbeef-5/+29
2023-06-17Move ConstEvaluatable to ClauseMichael Goulet-14/+12
2023-06-17Move WF goal to clauseMichael Goulet-11/+11
2023-06-17Rollup merge of #112738 - matthiaskrgr:ice_msg, r=oli-obkMatthias Krüger-3/+3
make ice msg "Unknown runtime phase" a bit nicer
2023-06-17make ice msg "Unknown runtime phase" a bit nicerMatthias Krüger-3/+3
2023-06-17Rollup merge of #112728 - Zalathar:spanview-charset, r=NilstriebMatthias Krüger-2/+3
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`Bound::predicates` to return `Clause`dswij-0/+7
2023-06-17Add `<meta charset="utf-8">` to `-Zdump-mir-spanview` outputZalathar-2/+3
2023-06-17Remove even more redundant builtin candidatesMichael Goulet-45/+4
2023-06-17Simplify even more candidatesMichael Goulet-111/+26
2023-06-17Simplify an ObjectData fieldMichael Goulet-6/+6
2023-06-17Simplify some impl source candidatesMichael Goulet-57/+0
2023-06-17Remove some ImplSource candidatesMichael Goulet-31/+10
2023-06-17Auto merge of #108860 - oli-obk:tait_alias, r=compiler-errorsbors-3/+19
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-16Rollup merge of #112706 - WaffleLapkin:syntax_context_is_root, r=petrochenkovMichael Goulet-2/+2
Add `SyntaxContext::is_root` Makes the code a tad nicer.
2023-06-16Rollup merge of #112665 - compiler-errors:assumption-takes-clause, r=lcnrMichael Goulet-0/+66
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-16Add `AliasKind::Weak` for type aliases.Oli Scherer-3/+19
Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases.
2023-06-16Add `SyntaxContext::is_root`Maybe Waffle-2/+2
2023-06-16Rollup merge of #112443 - ↵Dylan DPC-8/+33
compiler-errors:next-solver-opportunistically-resolve-regions, r=lcnr Opportunistically resolve regions in new solver Use `opportunistic_resolve_var` during canonicalization to collapse some regions. We have to start using `CanonicalVarValues::is_identity_modulo_regions`. We also have to modify that function to consider responses like `['static, ^0, '^1, ^2]` to be an "identity" response, since because we opportunistically resolve regions, there's no longer a 1:1 mapping between canonical var values and bound var indices in the response... There's one nasty side-effect -- one test (`tests/ui/dyn-star/param-env-infer.rs`) starts to ICE because the certainty goes from `Yes` to `Maybe(Overflow)`... Not exactly sure why, though? Putting this up for discussion/investigation. r? ```@lcnr```
2023-06-16Auto merge of #112346 - saethlin:no-comment, r=oli-obkbors-50/+71
Remove comments from mir-opt MIR dumps See https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Line.20numbers.20in.20mir-opt.20tests/near/363849874 In https://github.com/rust-lang/rust/pull/99780 there is mention that "there has been a zulip conversation about disabling line numbers with mixed opinions" which to me means that some people opposed this. I can't find the referenced conversation so... here we go. The current situation is quite chaotic. It's not hard to find MIR diffs which contain * Absolute line numbers * Relative line numbers * Substituted line numbers (LL) For example: https://github.com/rust-lang/rust/blob/408bbd040613f6776e0a7d05d582c81f4ddc189a/tests/mir-opt/inline/inline_shims.drop.Inline.diff#L10-L17 And sometimes adding a comment at the top of a mir-opt test generates a diff in the test because a line number changed: https://github.com/rust-lang/rust/pull/98112/files#diff-b8cf4bcce95078e6a3faf075e9abf6864872fb28a64d95c04f04513b9e3bbd81 And irrelevant changes to the standard library can generate diffs in mir-opt tests: https://github.com/rust-lang/rust/pull/110694/files#diff-bf96b0e7c67b8b272814536888fd9428c314991e155beae1f0a2a67f0ac47b2c https://github.com/rust-lang/rust/commit/769886cc35ce08b76839f4cf72b8af1161c432e1 I think we should, specifically in mir-opt tests, completely remove the comments, or insert placeholders for all line and column numbers.
2023-06-15Rollup merge of #112614 - lukas-code:apit-unsized-suggestion, r=compiler-errorsGuillaume Gomez-17/+31
tweak suggestion for argument-position `impl ?Sized` fixes this invalid suggestion: ```text help: consider removing the `?Sized` bound to make the type parameter `Sized` | 1 - fn foo(_: impl ?Sized) {} 1 + fn foo(_: impl ) {} | ```
2023-06-15Remove comments from mir-opt MIR dumpsBen Kimock-50/+71
2023-06-15privacy: Rename some variables for clarityVadim Petrochenkov-3/+3
2023-06-15privacy: Do not mark items reachable farther than their nominal visibilityVadim Petrochenkov-13/+16
This commit reverts a change made in #111425. It was believed that this change was necessary for implementing type privacy lints, but #111801 showed that it was not necessary. Quite opposite, the revert fixes some issues.
2023-06-15Make assumption functions in new solver take clauseMichael Goulet-0/+66
2023-06-15Rollup merge of #112634 - mj10021:issue-112438-fix, r=compiler-errorsMatthias Krüger-1/+4
add InlineConst check add check to close #112438
2023-06-15change `std::marker::Sized` to just `Sized`Lukas Markeffsky-5/+2
2023-06-15tweak suggestion for argument-position `impl ?Sized`Lukas Markeffsky-12/+29
2023-06-14remove unused postorder CFG cacheRémy Rakic-9/+0
2023-06-14make `traversal::postorder` traverse RPO cache backwardsRémy Rakic-4/+36
2023-06-14add InlineConst checkJames Dietz-1/+4
2023-06-14make `traversal::reverse_postorder` use RPO cacheRémy Rakic-29/+6
2023-06-14add RPO to BB CFG cacheRémy Rakic-0/+12
2023-06-14s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedListThe 8472-2/+2
2023-06-13opportunistically resolve regionsMichael Goulet-8/+33
2023-06-08Rollup merge of #109953 - thomcc:thomcc/typeid128, r=WaffleLapkinMatthias Krüger-2/+11
Use 128 bits for TypeId hash Preliminary/Draft impl of https://github.com/rust-lang/compiler-team/issues/608 Prior art (probably incomplete list) - https://github.com/rust-lang/rust/pull/75923 - https://github.com/rust-lang/rust/pull/95845
2023-06-07Auto merge of #109005 - Nilstrieb:dont-forgor-too-much-from-cfg, r=petrochenkovbors-1/+12
Remember names of `cfg`-ed out items to mention them in diagnostics # Examples ## `serde::Deserialize` without the `derive` feature (a classic beginner mistake) I had to slightly modify serde so that it uses explicit re-exports instead of a glob re-export. (Update: a serde PR was merged that adds the manual re-exports) ``` error[E0433]: failed to resolve: could not find `Serialize` in `serde` --> src/main.rs:1:17 | 1 | #[derive(serde::Serialize)] | ^^^^^^^^^ could not find `Serialize` in `serde` | note: crate `serde` has an item named `Serialize` but it is inactive because its cfg predicate evaluated to false --> /home/gh-Nilstrieb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.160/src/lib.rs:343:1 | 343 | #[cfg(feature = "serde_derive")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 344 | pub use serde_derive::{Deserialize, Serialize}; | ^^^^^^^^^ = note: the item is gated behind the `serde_derive` feature = note: see https://doc.rust-lang.org/cargo/reference/features.html for how to activate a crate's feature ``` (the suggestion is not ideal but that's serde's fault) I already tested the metadata size impact locally by compiling the `windows` crate without any features. `800k` -> `809k` r? `@ghost`
2023-06-07Rollup merge of #112122 - compiler-errors:next-coherence, r=lcnrDylan DPC-1/+9
Add `-Ztrait-solver=next-coherence` Flag that conditionally uses the trait solver *only* during coherence, for more testing and/or eventual partial-migration onto the trait solver (in the medium- to long-term). * This still uses the selection context in some of the coherence methods I think, so it's not "complete". Putting this up for review and/or for further work in-tree. * I probably need to spend a bit more time making sure that we don't sneakily create any other infcx's during coherence that also need the new solver enabled. r? `@lcnr`