about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-07-26 14:26:56 +0530
committerGitHub <noreply@github.com>2022-07-26 14:26:56 +0530
commita39c00ee8df9b2aa803c3a97fc0e0dcb04ede12c (patch)
tree06dfff884c5f46aa0e7c1588bf6908bf17c429c3 /compiler/rustc_trait_selection/src
parentb629c85bd74dfb730a3e9308312b007c0bf027cb (diff)
parentb248647ef0aed88dc8f3be29bec0b98d8be64c3c (diff)
downloadrust-a39c00ee8df9b2aa803c3a97fc0e0dcb04ede12c.tar.gz
rust-a39c00ee8df9b2aa803c3a97fc0e0dcb04ede12c.zip
Rollup merge of #99618 - compiler-errors:uhh-idk, r=lcnr
handle consts with param/infer in `const_eval_resolve` better

This PR addresses [this thread here](https://github.com/rust-lang/rust/pull/99449#discussion_r924141230). Was this the change you were looking for ``@lcnr?``

Interestingly, one test has begun to pass. Was that expected?

r? ``@lcnr``
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/const_evaluatable.rs17
1 files changed, 4 insertions, 13 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
index decbf013311..254bc4ab663 100644
--- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
+++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
@@ -185,21 +185,12 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
         }
         let concrete = infcx.const_eval_resolve(param_env, uv.expand(), Some(span));
         match concrete {
-            Err(ErrorHandled::TooGeneric) => Err(if uv.has_infer_types_or_consts() {
-                NotConstEvaluatable::MentionsInfer
-            } else if uv.has_param_types_or_consts() {
-                infcx
-                    .tcx
-                    .sess
-                    .delay_span_bug(span, &format!("unexpected `TooGeneric` for {:?}", uv));
-                NotConstEvaluatable::MentionsParam
-            } else {
-                let guar = infcx.tcx.sess.delay_span_bug(
+            Err(ErrorHandled::TooGeneric) => {
+                Err(NotConstEvaluatable::Error(infcx.tcx.sess.delay_span_bug(
                     span,
                     format!("Missing value for constant, but no error reported?"),
-                );
-                NotConstEvaluatable::Error(guar)
-            }),
+                )))
+            }
             Err(ErrorHandled::Linted) => {
                 let reported = infcx
                     .tcx