about summary refs log tree commit diff
path: root/src/test/ui/const-generics/array-impls
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-06-26 14:08:46 +0000
committerbors <bors@rust-lang.org>2020-06-26 14:08:46 +0000
commit7750c3d46bc19784adb1ee6e37a5ec7e4cd7e772 (patch)
treee395669f205e3b46ff20c3eaa11b02b07f52528d /src/test/ui/const-generics/array-impls
parent9672b5e95c520774cc17bffc7031c80a1bcf4b4c (diff)
parent819cde5dabd90dab1fb462cd713457421d0ebd36 (diff)
downloadrust-7750c3d46bc19784adb1ee6e37a5ec7e4cd7e772.tar.gz
rust-7750c3d46bc19784adb1ee6e37a5ec7e4cd7e772.zip
Auto merge of #73513 - oli-obk:const_binop_overflow, r=estebank
Show the values and computation that would overflow a const evaluation or propagation

Fixes #71134

In contrast to the example in the issue it doesn't use individual spans for each operand. The effort required to implement that is quite high compared to the little (if at all) benefit it would bring to diagnostics.

cc @shepmaster

The way this is implemented it is also fairly easy to do the same for overflow panics at runtime, but that should be done in a separate PR since it may have runtime performance implications.
Diffstat (limited to 'src/test/ui/const-generics/array-impls')
-rw-r--r--src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr b/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr
index b39a160b529..ceda31550ff 100644
--- a/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr
+++ b/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr
@@ -13,9 +13,9 @@ LL | pub fn no_iterator() -> impl Iterator<Item = i32> {
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
 LL |
 LL |     IntoIter::new([0i32; 33])
-   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
+   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>`
    |
-   = note: required because of the requirements on the impl of `std::iter::Iterator` for `std::array::IntoIter<i32, 33usize>`
+   = note: required because of the requirements on the impl of `std::iter::Iterator` for `std::array::IntoIter<i32, 33_usize>`
    = note: the return type of a function must have a statically known size
 
 error[E0277]: arrays only have std trait implementations for lengths 0..=32
@@ -33,9 +33,9 @@ LL | pub fn no_double_ended_iterator() -> impl DoubleEndedIterator {
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
 LL |
 LL |     IntoIter::new([0i32; 33])
-   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
+   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>`
    |
-   = note: required because of the requirements on the impl of `std::iter::DoubleEndedIterator` for `std::array::IntoIter<i32, 33usize>`
+   = note: required because of the requirements on the impl of `std::iter::DoubleEndedIterator` for `std::array::IntoIter<i32, 33_usize>`
    = note: the return type of a function must have a statically known size
 
 error[E0277]: arrays only have std trait implementations for lengths 0..=32
@@ -53,9 +53,9 @@ LL | pub fn no_exact_size_iterator() -> impl ExactSizeIterator {
    |                                    ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
 LL |
 LL |     IntoIter::new([0i32; 33])
-   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
+   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>`
    |
-   = note: required because of the requirements on the impl of `std::iter::ExactSizeIterator` for `std::array::IntoIter<i32, 33usize>`
+   = note: required because of the requirements on the impl of `std::iter::ExactSizeIterator` for `std::array::IntoIter<i32, 33_usize>`
    = note: the return type of a function must have a statically known size
 
 error[E0277]: arrays only have std trait implementations for lengths 0..=32
@@ -73,9 +73,9 @@ LL | pub fn no_fused_iterator() -> impl FusedIterator {
    |                               ^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
 LL |
 LL |     IntoIter::new([0i32; 33])
-   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
+   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>`
    |
-   = note: required because of the requirements on the impl of `std::iter::FusedIterator` for `std::array::IntoIter<i32, 33usize>`
+   = note: required because of the requirements on the impl of `std::iter::FusedIterator` for `std::array::IntoIter<i32, 33_usize>`
    = note: the return type of a function must have a statically known size
 
 error[E0277]: arrays only have std trait implementations for lengths 0..=32
@@ -93,9 +93,9 @@ LL | pub fn no_trusted_len() -> impl TrustedLen {
    |                            ^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
 LL |
 LL |     IntoIter::new([0i32; 33])
-   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
+   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>`
    |
-   = note: required because of the requirements on the impl of `std::iter::TrustedLen` for `std::array::IntoIter<i32, 33usize>`
+   = note: required because of the requirements on the impl of `std::iter::TrustedLen` for `std::array::IntoIter<i32, 33_usize>`
    = note: the return type of a function must have a statically known size
 
 error[E0277]: arrays only have std trait implementations for lengths 0..=32
@@ -113,9 +113,9 @@ LL | pub fn no_clone() -> impl Clone {
    |                      ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
 LL |
 LL |     IntoIter::new([0i32; 33])
-   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
+   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>`
    |
-   = note: required because of the requirements on the impl of `std::clone::Clone` for `std::array::IntoIter<i32, 33usize>`
+   = note: required because of the requirements on the impl of `std::clone::Clone` for `std::array::IntoIter<i32, 33_usize>`
    = note: the return type of a function must have a statically known size
 
 error[E0277]: arrays only have std trait implementations for lengths 0..=32
@@ -133,9 +133,9 @@ LL | pub fn no_debug() -> impl Debug {
    |                      ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]`
 LL |
 LL |     IntoIter::new([0i32; 33])
-   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>`
+   |     ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>`
    |
-   = note: required because of the requirements on the impl of `std::fmt::Debug` for `std::array::IntoIter<i32, 33usize>`
+   = note: required because of the requirements on the impl of `std::fmt::Debug` for `std::array::IntoIter<i32, 33_usize>`
    = note: the return type of a function must have a statically known size
 
 error: aborting due to 14 previous errors