about summary refs log tree commit diff
path: root/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 /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 'src')
-rw-r--r--src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs7
-rw-r--r--src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.stderr38
2 files changed, 2 insertions, 43 deletions
diff --git a/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs b/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs
index 18f33acaabb..5874625adff 100644
--- a/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs
+++ b/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs
@@ -1,3 +1,5 @@
+// check-pass
+
 #![feature(generic_const_exprs)]
 #![allow(incomplete_features)]
 
@@ -21,11 +23,6 @@ where
 }
 
 fn main() {
-    // FIXME(generic_const_exprs): We can't correctly infer `T` which requires
-    // evaluating `{ N + 1 }` which has substs containing an inference var
     let mut _q = Default::default();
-    //~^ ERROR type annotations needed
-
     _q = foo::<_, 2>(_q);
-    //~^ ERROR type annotations needed
 }
diff --git a/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.stderr b/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.stderr
deleted file mode 100644
index 9e8328d3701..00000000000
--- a/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.stderr
+++ /dev/null
@@ -1,38 +0,0 @@
-error[E0282]: type annotations needed
-  --> $DIR/const_eval_resolve_canonical.rs:26:9
-   |
-LL |     let mut _q = Default::default();
-   |         ^^^^^^
-   |
-help: consider giving `_q` an explicit type
-   |
-LL |     let mut _q: _ = Default::default();
-   |               +++
-
-error[E0283]: type annotations needed
-  --> $DIR/const_eval_resolve_canonical.rs:29:10
-   |
-LL |     _q = foo::<_, 2>(_q);
-   |          ^^^^^^^^^^^ cannot infer the value of the constant `{ N + 1 }`
-   |
-note: multiple `impl`s satisfying `(): Foo<{ N + 1 }>` found
-  --> $DIR/const_eval_resolve_canonical.rs:8:1
-   |
-LL | impl Foo<0> for () {
-   | ^^^^^^^^^^^^^^^^^^
-...
-LL | impl Foo<3> for () {
-   | ^^^^^^^^^^^^^^^^^^
-note: required by a bound in `foo`
-  --> $DIR/const_eval_resolve_canonical.rs:18:9
-   |
-LL | fn foo<T, const N: usize>(_: T) -> <() as Foo<{ N + 1 }>>::Assoc
-   |    --- required by a bound in this
-LL | where
-LL |     (): Foo<{ N + 1 }>,
-   |         ^^^^^^^^^^^^^^ required by this bound in `foo`
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.