about summary refs log tree commit diff
path: root/tests/ui/const-generics/generic_const_exprs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/const-generics/generic_const_exprs')
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr33
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr33
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-62504.rs1
-rw-r--r--tests/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.rs1
-rw-r--r--tests/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.stderr27
5 files changed, 82 insertions, 13 deletions
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr b/tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr
index 5cda4681b5c..27411646cb7 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr
@@ -18,18 +18,41 @@ help: try adding a `where` bound
 LL |     pub const fn new() -> Self where [(); Self::SIZE]: {
    |                                +++++++++++++++++++++++
 
-error[E0282]: type annotations needed for `ArrayHolder<_>`
+error[E0284]: type annotations needed for `ArrayHolder<_>`
   --> $DIR/issue-62504.rs:26:9
    |
 LL |     let mut array = ArrayHolder::new();
-   |         ^^^^^^^^^
+   |         ^^^^^^^^^   ------------------ type must be known at this point
    |
+note: required by a bound in `ArrayHolder::<X>::new`
+  --> $DIR/issue-62504.rs:16:6
+   |
+LL | impl<const X: usize> ArrayHolder<X> {
+   |      ^^^^^^^^^^^^^^ required by this bound in `ArrayHolder::<X>::new`
+LL |     pub const fn new() -> Self {
+   |                  --- required by a bound in this associated function
+help: consider giving `array` an explicit type, where the value of const parameter `X` is specified
+   |
+LL |     let mut array: ArrayHolder<X> = ArrayHolder::new();
+   |                  ++++++++++++++++
+
+error[E0284]: type annotations needed for `ArrayHolder<_>`
+  --> $DIR/issue-62504.rs:26:9
+   |
+LL |     let mut array = ArrayHolder::new();
+   |         ^^^^^^^^^   ----------- type must be known at this point
+   |
+note: required by a bound in `ArrayHolder`
+  --> $DIR/issue-62504.rs:14:20
+   |
+LL | struct ArrayHolder<const X: usize>([u32; X]);
+   |                    ^^^^^^^^^^^^^^ required by this bound in `ArrayHolder`
 help: consider giving `array` an explicit type, where the value of const parameter `X` is specified
    |
 LL |     let mut array: ArrayHolder<X> = ArrayHolder::new();
    |                  ++++++++++++++++
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0282, E0308.
-For more information about an error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0284, E0308.
+For more information about an error, try `rustc --explain E0284`.
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr b/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr
index beb159779ff..036b9001c03 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr
@@ -22,18 +22,41 @@ note: tuple struct defined here
 LL | struct ArrayHolder<const X: usize>([u32; X]);
    |        ^^^^^^^^^^^
 
-error[E0282]: type annotations needed for `ArrayHolder<_>`
+error[E0284]: type annotations needed for `ArrayHolder<_>`
   --> $DIR/issue-62504.rs:26:9
    |
 LL |     let mut array = ArrayHolder::new();
-   |         ^^^^^^^^^
+   |         ^^^^^^^^^   ------------------ type must be known at this point
    |
+note: required by a bound in `ArrayHolder::<X>::new`
+  --> $DIR/issue-62504.rs:16:6
+   |
+LL | impl<const X: usize> ArrayHolder<X> {
+   |      ^^^^^^^^^^^^^^ required by this bound in `ArrayHolder::<X>::new`
+LL |     pub const fn new() -> Self {
+   |                  --- required by a bound in this associated function
+help: consider giving `array` an explicit type, where the value of const parameter `X` is specified
+   |
+LL |     let mut array: ArrayHolder<X> = ArrayHolder::new();
+   |                  ++++++++++++++++
+
+error[E0284]: type annotations needed for `ArrayHolder<_>`
+  --> $DIR/issue-62504.rs:26:9
+   |
+LL |     let mut array = ArrayHolder::new();
+   |         ^^^^^^^^^   ----------- type must be known at this point
+   |
+note: required by a bound in `ArrayHolder`
+  --> $DIR/issue-62504.rs:14:20
+   |
+LL | struct ArrayHolder<const X: usize>([u32; X]);
+   |                    ^^^^^^^^^^^^^^ required by this bound in `ArrayHolder`
 help: consider giving `array` an explicit type, where the value of const parameter `X` is specified
    |
 LL |     let mut array: ArrayHolder<X> = ArrayHolder::new();
    |                  ++++++++++++++++
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0282, E0308.
-For more information about an error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0284, E0308.
+For more information about an error, try `rustc --explain E0284`.
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-62504.rs b/tests/ui/const-generics/generic_const_exprs/issue-62504.rs
index b6a6a277843..f021e103614 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-62504.rs
+++ b/tests/ui/const-generics/generic_const_exprs/issue-62504.rs
@@ -25,4 +25,5 @@ impl<const X: usize> ArrayHolder<X> {
 fn main() {
     let mut array = ArrayHolder::new();
     //~^ ERROR: type annotations needed
+    //~| ERROR type annotations needed
 }
diff --git a/tests/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.rs b/tests/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.rs
index 79e9834b54e..298cfb512e4 100644
--- a/tests/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.rs
+++ b/tests/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.rs
@@ -18,4 +18,5 @@ fn use_dyn<const N: usize>(v: &dyn Foo<N>) where [u8; N + 1]: Sized {
 fn main() {
     use_dyn(&());
     //~^ ERROR type annotations needed
+    //~| ERROR type annotations needed
 }
diff --git a/tests/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.stderr b/tests/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.stderr
index e800c5d059f..0c290448fc5 100644
--- a/tests/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.stderr
@@ -5,15 +5,36 @@ LL |     use_dyn(&());
    |     ^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `use_dyn`
    |
 note: required by a bound in `use_dyn`
-  --> $DIR/object-safety-ok-infer-err.rs:14:55
+  --> $DIR/object-safety-ok-infer-err.rs:14:12
    |
 LL | fn use_dyn<const N: usize>(v: &dyn Foo<N>) where [u8; N + 1]: Sized {
-   |                                                       ^^^^^ required by this bound in `use_dyn`
+   |            ^^^^^^^^^^^^^^ required by this bound in `use_dyn`
 help: consider specifying the generic argument
    |
 LL |     use_dyn::<N>(&());
    |            +++++
 
-error: aborting due to 1 previous error
+error[E0284]: type annotations needed
+  --> $DIR/object-safety-ok-infer-err.rs:19:5
+   |
+LL |     use_dyn(&());
+   |     ^^^^^^^ --- type must be known at this point
+   |     |
+   |     cannot infer the value of the const parameter `N` declared on the function `use_dyn`
+   |
+note: required for `()` to implement `Foo<_>`
+  --> $DIR/object-safety-ok-infer-err.rs:8:22
+   |
+LL | impl<const N: usize> Foo<N> for () {
+   |      --------------  ^^^^^^     ^^
+   |      |
+   |      unsatisfied trait bound introduced here
+   = note: required for the cast from `&()` to `&dyn Foo<_>`
+help: consider specifying the generic argument
+   |
+LL |     use_dyn::<N>(&());
+   |            +++++
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0284`.