From b10ae033c26546df8dac2ee9028c081aea32e076 Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Fri, 8 Dec 2023 07:27:47 +0000 Subject: [PATCH 1/3] temporarily revert "ice on ambguity in mir typeck" Reverts #116530 (cherry picked from commit 5fdb648fc3a672140f3fc8f98ee3268ed3fe5389) --- .../src/traits/query/type_op/mod.rs | 16 ++++--------- ...nnormalized-projection-guides-inference.rs | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 tests/ui/wf/unnormalized-projection-guides-inference.rs diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs index a5ccf62608edb..9d7933e23a8b2 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs @@ -157,18 +157,10 @@ where } let mut region_constraints = QueryRegionConstraints::default(); - let (output, error_info, mut obligations) = - Q::fully_perform_into(self, infcx, &mut region_constraints) - .map_err(|_| { - infcx.tcx.sess.delay_span_bug(span, format!("error performing {self:?}")) - }) - .and_then(|(output, error_info, obligations, certainty)| match certainty { - Certainty::Proven => Ok((output, error_info, obligations)), - Certainty::Ambiguous => Err(infcx - .tcx - .sess - .delay_span_bug(span, format!("ambiguity performing {self:?}"))), - })?; + let (output, error_info, mut obligations, _) = + Q::fully_perform_into(self, infcx, &mut region_constraints).map_err(|_| { + infcx.tcx.sess.delay_span_bug(span, format!("error performing {self:?}")) + })?; // Typically, instantiating NLL query results does not // create obligations. However, in some cases there diff --git a/tests/ui/wf/unnormalized-projection-guides-inference.rs b/tests/ui/wf/unnormalized-projection-guides-inference.rs new file mode 100644 index 0000000000000..ca2d6c2e882d0 --- /dev/null +++ b/tests/ui/wf/unnormalized-projection-guides-inference.rs @@ -0,0 +1,24 @@ +// The WF requirements of the *unnormalized* form of type annotations +// can guide inference. +// check-pass + +pub trait EqualTo { + type Ty; +} +impl EqualTo for X { + type Ty = X; +} + +trait MyTrait> { + type Out; +} +impl> MyTrait for T { + type Out = (); +} + +fn main() { + let _: <_ as MyTrait>::Out; + // We shoud be able to infer a value for the inference variable above. + // The WF of the unnormalized projection requires `u8: EqualTo`, + // which is sufficient to guide inference. +} From 737de5b51e65edbc747acd27ead1559ce6abdcc6 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 14 Dec 2023 09:54:14 +0100 Subject: [PATCH 2/3] Update to LLVM 17.0.6 (cherry picked from commit bb7c483e48ea992f3759fb643962e1e706c8c029) --- .gitmodules | 2 +- src/llvm-project | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index f5025097a18dc..9bb68b37081f5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -33,7 +33,7 @@ [submodule "src/llvm-project"] path = src/llvm-project url = https://github.com/rust-lang/llvm-project.git - branch = rustc/17.0-2023-09-19 + branch = rustc/17.0-2023-12-14 shallow = true [submodule "src/doc/embedded-book"] path = src/doc/embedded-book diff --git a/src/llvm-project b/src/llvm-project index 7738295178045..17a687b23d223 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 7738295178045041669876bf32b0543ec8319a5c +Subproject commit 17a687b23d22332fce6ba0aade180a30d06cfa62 From ff1c216bfa6dd00f3cd1cd03c9c20d7de783468b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 14 Dec 2023 16:05:39 +0100 Subject: [PATCH 3/3] Include an additional cherry-pick (cherry picked from commit 601d52a7031f0f57562b661c99d30b4035d7b4af) --- src/llvm-project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llvm-project b/src/llvm-project index 17a687b23d223..2c4de6c2492d5 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 17a687b23d22332fce6ba0aade180a30d06cfa62 +Subproject commit 2c4de6c2492d5530de3f19f41d8f88ba984c2fe2