about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve
AgeCommit message (Collapse)AuthorLines
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-145/+136
2023-07-13Rollup merge of #113536 - lcnr:proof-tree-select, r=BoxyUwUMatthias Krüger-27/+21
avoid building proof trees in select otherwise we ICE because select isn't currently set up to print proof trees. r? `````@BoxyUwU`````
2023-07-13Auto merge of #113637 - Mark-Simulacrum:bootstrap-bump, r=ozkanonurbors-98/+89
Bump bootstrap to 1.72 beta
2023-07-13Rollup merge of #113353 - compiler-errors:select-better, r=lcnrMatthias Krüger-1/+144
Implement selection for `Unsize` for better coercion behavior In order for much of coercion to succeed, we need to be able to deal with partial ambiguity of `Unsize` traits during selection. However, I pessimistically implemented selection in the new trait solver to just bail out with ambiguity if it was a built-in impl: https://github.com/rust-lang/rust/blob/9227ff28aff55b252314076fcf21c9a66f10ac1e/compiler/rustc_trait_selection/src/solve/eval_ctxt/select.rs#L126 This implements a proper "rematch" procedure for dealing with built-in `Unsize` goals, so that even if the goal is ambiguous, we are able to get nested obligations which are used in the coercion selection-like loop: https://github.com/rust-lang/rust/blob/9227ff28aff55b252314076fcf21c9a66f10ac1e/compiler/rustc_hir_typeck/src/coercion.rs#L702 Second commit just moves a `resolve_vars_if_possible` call to fix a bug where we weren't detecting a trait upcasting to occur. r? ``@lcnr``
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-98/+89
2023-07-10avoid building proof trees in selectlcnr-27/+21
2023-07-08Rollup merge of #113335 - compiler-errors:reveal-opaques-in-new-solver, r=lcnrMatthias Krüger-3/+1
Reveal opaques in new solver We were testing against the wrong reveal mode :fearful: Also a couple of misc commits that I don't want to really put in separate prs r? ``@lcnr``
2023-07-08Implement selection for unsize for better coercion behaviorMichael Goulet-1/+144
2023-07-07Normalize opaques during codegen in new solverMichael Goulet-3/+1
2023-07-07Auto merge of #113245 - lukas-code:unsizing-sanity-check, r=the8472bors-7/+2
sanity check field offsets in unsizeable structs As promised in https://github.com/rust-lang/rust/pull/112062#issuecomment-1567494994, this PR extends the layout sanity checks to ensure that structs fields don't move around when unsizing and prevent issues like https://github.com/rust-lang/rust/issues/112048 in the future. Like most other layout sanity checks, this only runs on compilers with debug assertions enabled. Here is how it looks when it fails: ```text error: internal compiler error: compiler/rustc_ty_utils/src/layout.rs:533:21: unsizing GcNode<std::boxed::Box<i32>> changed field order! Layout { size: Size(32 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: Aggregate { sized: true }, fields: Arbitrary { offsets: [Size(0 bytes), Size(8 bytes), Size(24 bytes)], memory_index: [0, 1, 2] }, largest_niche: Some(Niche { offset: Size(24 bytes), value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), variants: Single { index: 0 } } Layout { size: Size(24 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: Aggregate { sized: false }, fields: Arbitrary { offsets: [Size(16 bytes), Size(0 bytes), Size(24 bytes)], memory_index: [1, 0, 2] }, largest_niche: None, variants: Single { index: 0 } } ``` r? `@the8472`
2023-07-07Auto merge of #113308 - compiler-errors:poly-select, r=lcnrbors-3/+3
Split `SelectionContext::select` into fns that take a binder and don't *most* usages of `SelectionContext::select` don't need to use a binder, but wrap them in a dummy because of the signature. Let's split this out into `SelectionContext::{select,poly_select}` and limit the usages of the latter. Right now, we only have 3 places where we're calling `poly_select` -- fulfillment, internally within the old solver, and the auto-trait finder. r? `@lcnr`
2023-07-06Rollup merge of #113397 - compiler-errors:new-select-prefer-obj, r=lcnrMichael Goulet-0/+8
Prefer object candidates in new selection `dyn Any` shouldn't be using [this implementation](https://doc.rust-lang.org/std/any/trait.Any.html#impl-Any-for-T) during codegen. Prefer object candidates over other candidates, except for other object candidates.
2023-07-06Don't call type_of on TAIT in defining scope in new solverMichael Goulet-1/+28
2023-07-06Separate select calls that don't need a binderMichael Goulet-1/+1
2023-07-06TraitObligation -> PolyTraitObligationMichael Goulet-3/+3
2023-07-06add helper methods for accessing struct tailLukas Markeffsky-7/+2
2023-07-06Auto merge of #113406 - matthiaskrgr:rollup-0rprs5k, r=matthiaskrgrbors-4/+6
Rollup of 4 pull requests Successful merges: - #112295 (Fix the tests-listing-format-json test on Windows) - #113246 (fix compiletest crash) - #113395 (Dont ICE for `dyn* Trait: Trait` (built-in object) goals during selection in new trait solver) - #113402 (Diagnose unsorted CGUs.) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-06Prefer object candidates over impl candidates in new selectionMichael Goulet-0/+8
2023-07-06Dont ICE for `dyn* Trait: Trait` goals during selection in new trait solverMichael Goulet-4/+6
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-10/+10
2023-07-05Rollup merge of #113337 - compiler-errors:next-solver-winnow-specializing, ↵Michael Goulet-2/+13
r=lcnr Winnow specialized impls during selection in new solver We need to be able to winnow impls that are specialized by more specific impls in order for codegen to be able to proceed. r? ``@lcnr``
2023-07-05Rollup merge of #113317 - lcnr:sketchy-new-select, r=oli-obkMichael Goulet-0/+2
-Ztrait-solver=next: stop depending on old solver removes the final dependencies on the old solver when `-Ztrait-solver=next` is enabled.
2023-07-05Winnow specializing implsMichael Goulet-2/+13
2023-07-05Auto merge of #113329 - lcnr:probe_candidate, r=BoxyUwUbors-298/+280
add `ecx.probe_candidate` Not yet changing the candidate source to an enum because that would be more involved, but this by itself should already be a significant improvement imo r? `@BoxyUwU`
2023-07-04Auto merge of #113330 - matthiaskrgr:rollup-zm3owin, r=matthiaskrgrbors-41/+161
Rollup of 5 pull requests Successful merges: - #113192 (`assemble_candidates_after_normalizing_self_ty` docs) - #113251 (Use scoped-tls for SMIR to map between TyCtxt and SMIR datastructures) - #113282 (Update platform-support.md to improve ARM target descriptions) - #113296 (add flag for enabling global cache usage for proof trees and printing proof trees on error) - #113324 (implement `ConstEvaluatable` goals in new solver) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-04Rollup merge of #113324 - lcnr:const-evaluatable-goal, r=BoxyUwUMatthias Krüger-6/+42
implement `ConstEvaluatable` goals in new solver this only supports stable const generics. `feature(generic_const_exprs)` needs to extend that function is non-trivial ways. Leaving this for someone else or some later date. r? `@BoxyUwU`
2023-07-04Rollup merge of #113296 - BoxyUwU:proof_trees_on_error, r=lcnrMatthias Krüger-31/+106
add flag for enabling global cache usage for proof trees and printing proof trees on error This adds a few new things: - `-Zdump-solver-proof-tree=always/never/on-error` - `always`/`never` were previosuly specifiable by whether the flag exists or not, th new flag is `on_error` which reruns obligations of fulfillment and selection errors with proof tree generation enabled and prints them out - `-Zdump-solver-proof-tree-uses-cache` - allows forcing global cache to be used or unused for all generated proof trees, global cache is enabled by default for `always` so that it accurately represents what happend. This flag currently would affect misc uses of `GenerateProofTree::Yes` which will be added in the future for things like diagnostics logic and rustdoc's auto_trait file. We can fix this when we start using proof tree generation for those use cases if it's desirable. I also changed the output to go straight to stdout instead of going through `debug!` so that `-Zdump-solver-proof-tree` can be adequately used on `nightly` not just a locally built toolchain. The idea for `on-error` is that it should hopefully make it easier to quickly figure out "why doesnt this code compile"- you just pass in `-Zdump-solver-proof-tree=on-error` and you'll only get proof trees you care about. --- r? `@lcnr` `@compiler-errors`
2023-07-04Rollup merge of #113192 - lcnr:add-comment, r=compiler-errorsMatthias Krüger-4/+13
`assemble_candidates_after_normalizing_self_ty` docs I already explained that in different places a few times, should have added that explanation as a doc comment the first time I did so :3 r? `@BoxyUwU`
2023-07-04add `ecx.probe_candidate`lcnr-298/+280
2023-07-04reviewsBoxy-83/+79
2023-07-04implement `ConstEvaluatable` goals in new solverlcnr-6/+42
we don't yet handle `generic_const_exprs`, someone else can do that :3
2023-07-04Replace `const_error` methods with `Const::new_error`Boxy-6/+5
2023-07-04Replace `mk_const` with `Const::new_x` methodsBoxy-4/+4
2023-07-04move logic for flags into separate functionBoxy-30/+35
2023-07-04change flag nameBoxy-1/+1
2023-07-04reviewsBoxy-3/+1
2023-07-04 -Ztrait-solver=next: stop depending on old solverlcnr-0/+2
2023-07-03remove TypeWellFormedFromEnvMichael Goulet-3/+0
2023-07-03add flag for disabling global cache and printing proof trees on errorBoxy-45/+121
2023-07-03Helpers for creating EvalCtxts, some commentsMichael Goulet-153/+174
2023-07-03Implement selection in new trait solverMichael Goulet-20/+346
2023-07-03rebaselcnr-2/+2
2023-07-03reviewlcnr-14/+12
2023-07-03add deep normalization via the new solverlcnr-0/+224
2023-07-03add instrument to `register_predicate_obligation`lcnr-0/+1
2023-07-01Auto merge of #113154 - lcnr:better-probe-check, r=compiler-errorsbors-3/+11
change snapshot tracking in fulfillment contexts use the exact snapshot number to prevent misuse even when created inside of a snapshot
2023-06-30assemble_candidates_after_normalizing_self_ty docslcnr-4/+13
2023-06-29change snapshot tracking in fulfillment contextslcnr-3/+11
2023-06-26TypeWellFormedInEnvMichael Goulet-3/+2
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-21/+11