diff options
| author | Michael Goulet <michael@errs.io> | 2023-06-24 18:03:20 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-06-24 18:04:14 +0000 |
| commit | 28f39862a8a673d5d162121b8c432a5b82883d3d (patch) | |
| tree | 40475ed32bf819f9666ea9b8c30c9c996ee8d7cb /tests/ui/consts | |
| parent | 1d67eba6873b1d551a259a0bbc1e2651b4443e12 (diff) | |
| download | rust-28f39862a8a673d5d162121b8c432a5b82883d3d.tar.gz rust-28f39862a8a673d5d162121b8c432a5b82883d3d.zip | |
use Const::eval instead of QueryNormalize in error reporting
Diffstat (limited to 'tests/ui/consts')
| -rw-r--r-- | tests/ui/consts/missing-larger-array-impl.rs | 9 | ||||
| -rw-r--r-- | tests/ui/consts/missing-larger-array-impl.stderr | 20 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/consts/missing-larger-array-impl.rs b/tests/ui/consts/missing-larger-array-impl.rs new file mode 100644 index 00000000000..e6c879c8ebd --- /dev/null +++ b/tests/ui/consts/missing-larger-array-impl.rs @@ -0,0 +1,9 @@ +struct X; + +// Make sure that we show the impl trait refs in the help message with +// their evaluated constants, rather than `core::::array::{impl#30}::{constant#0}` + +fn main() { + <[X; 35] as Default>::default(); + //~^ ERROR the trait bound `[X; 35]: Default` is not satisfied +} diff --git a/tests/ui/consts/missing-larger-array-impl.stderr b/tests/ui/consts/missing-larger-array-impl.stderr new file mode 100644 index 00000000000..fad5c53f712 --- /dev/null +++ b/tests/ui/consts/missing-larger-array-impl.stderr @@ -0,0 +1,20 @@ +error[E0277]: the trait bound `[X; 35]: Default` is not satisfied + --> $DIR/missing-larger-array-impl.rs:7:5 + | +LL | <[X; 35] as Default>::default(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `[X; 35]` + | + = help: the following other types implement trait `Default`: + &[T] + &mut [T] + [T; 0] + [T; 10] + [T; 11] + [T; 12] + [T; 13] + [T; 14] + and 27 others + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. |
