about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-06-20yeet ImplSource::TraitAlias tooMichael Goulet-31/+0
2023-06-20Auto merge of #112835 - lcnr:proof-tree-nits, r=BoxyUwUbors-8/+12
proof tree nits r? `@BoxyUwU`
2023-06-20update comment on `MutBorrowKind::ClosureCapture`Ziru Niu-4/+7
2023-06-20address most easy commentsZiru Niu-10/+6
2023-06-20merge `BorrowKind::Unique` into `BorrowKind::Mut`Ziru Niu-26/+18
2023-06-20Rollup merge of #112786 - lcnr:early-binder, r=NilstriebGuillaume Gomez-55/+60
change binders from tuple structs to named fields
2023-06-20cleanup importslcnr-8/+12
2023-06-20Auto merge of #112320 - compiler-errors:do-not-impl-via-obj, r=lcnrbors-0/+10
Add `implement_via_object` to `rustc_deny_explicit_impl` to control object candidate assembly Some built-in traits are special, since they are used to prove facts about the program that are important for later phases of compilation such as codegen and CTFE. For example, the `Unsize` trait is used to assert to the compiler that we are able to unsize a type into another type. It doesn't have any methods because it doesn't actually *instruct* the compiler how to do this unsizing, but this is later used (alongside an exhaustive match of combinations of unsizeable types) during codegen to generate unsize coercion code. Due to this, these built-in traits are incompatible with the type erasure provided by object types. For example, the existence of `dyn Unsize<T>` does not mean that the compiler is able to unsize `Box<dyn Unsize<T>>` into `Box<T>`, since `Unsize` is a *witness* to the fact that a type can be unsized, and it doesn't actually encode that unsizing operation in its vtable as mentioned above. The old trait solver gets around this fact by having complex control flow that never considers object bounds for certain built-in traits: https://github.com/rust-lang/rust/blob/2f896da247e0ee8f0bef7cd7c54cfbea255b9f68/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs#L61-L132 However, candidate assembly in the new solver is much more lovely, and I'd hate to add this list of opt-out cases into the new solver. Instead of maintaining this complex and hard-coded control flow, instead we can make this a property of the trait via a built-in attribute. We already have such a build attribute that's applied to every single trait that we care about: `rustc_deny_explicit_impl`. This PR adds `implement_via_object` as a meta-item to that attribute that allows us to opt a trait out of object-bound candidate assembly as well. r? `@lcnr`
2023-06-20Merge attrs, better validationMichael Goulet-4/+6
2023-06-20Make rustc_deny_explicit_impl only local as wellMichael Goulet-0/+3
2023-06-20Add rustc_do_not_implement_via_objectMichael Goulet-0/+5
2023-06-19Rollup merge of #112232 - fee1-dead-contrib:match-eq-const-msg, r=b-naberMichael Goulet-5/+29
Better error for non const `PartialEq` call generated by `match` Resolves #90237
2023-06-19Don't ICE on unnormalized struct tail in layout computationMichael Goulet-1/+7
2023-06-19Auto merge of #112238 - scottmcm:mir-add-unchecked, r=cjgillotbors-2/+29
Promote unchecked integer math to MIR `BinOp`s So slice indexing by a range gets down to one basic block, for example. r? cjgillot
2023-06-19Store generator field names in GeneratorLayout.Camille GILLOT-44/+4
2023-06-19Make closure_saved_names_of_captured_variables a query.Camille GILLOT-32/+22
2023-06-19docMichael Goulet-1/+11
2023-06-19Fully fledged Clause typeMichael Goulet-45/+93
2023-06-19s/Clause/ClauseKindMichael Goulet-93/+99
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```