mirror of
https://github.com/rust-lang/rust.git
synced 2026-03-19 10:59:30 +00:00
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:9227ff28af/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:9227ff28af/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``