mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
display ConstKind::Param
This commit is contained in:
parent
a51e004e1b
commit
0db2aec14a
@ -701,12 +701,14 @@ pub trait PrettyPrinter<'tcx>:
|
||||
if self.tcx().sess.verbose() {
|
||||
p!(write("{:?}", sz));
|
||||
} else if let ty::ConstKind::Unevaluated(..) = sz.val {
|
||||
// do not try to evaluate unevaluated constants. If we are const evaluating an
|
||||
// Do not try to evaluate unevaluated constants. If we are const evaluating an
|
||||
// array length anon const, rustc will (with debug assertions) print the
|
||||
// constant's path. Which will end up here again.
|
||||
p!(write("_"));
|
||||
} else if let Some(n) = sz.val.try_to_bits(self.tcx().data_layout.pointer_size) {
|
||||
p!(write("{}", n));
|
||||
} else if let ty::ConstKind::Param(param) = sz.val {
|
||||
p!(write("{}", param));
|
||||
} else {
|
||||
p!(write("_"));
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ LL | [1, 2] => true,
|
||||
| ^^^^^^ expected `2usize`, found `N`
|
||||
|
|
||||
= note: expected array `[u32; 2]`
|
||||
found array `[u32; _]`
|
||||
found array `[u32; N]`
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
|
@ -29,7 +29,7 @@ LL | let boxed_array = <Box<[i32; 33]>>::try_from(boxed_slice);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::TryFrom<std::boxed::Box<[i32]>>` is not implemented for `std::boxed::Box<[i32; 33]>`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<std::boxed::Box<[T; _]> as std::convert::TryFrom<std::boxed::Box<[T]>>>
|
||||
<std::boxed::Box<[T; N]> as std::convert::TryFrom<std::boxed::Box<[T]>>>
|
||||
|
||||
error[E0277]: the trait bound `std::rc::Rc<[i32; 33]>: std::convert::From<std::rc::Rc<[i32]>>` is not satisfied
|
||||
--> $DIR/alloc-types-no-impls-length-33.rs:19:23
|
||||
@ -53,7 +53,7 @@ LL | let boxed_array = <Rc<[i32; 33]>>::try_from(boxed_slice);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::TryFrom<std::rc::Rc<[i32]>>` is not implemented for `std::rc::Rc<[i32; 33]>`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<std::rc::Rc<[T; _]> as std::convert::TryFrom<std::rc::Rc<[T]>>>
|
||||
<std::rc::Rc<[T; N]> as std::convert::TryFrom<std::rc::Rc<[T]>>>
|
||||
|
||||
error[E0277]: the trait bound `std::sync::Arc<[i32; 33]>: std::convert::From<std::sync::Arc<[i32]>>` is not satisfied
|
||||
--> $DIR/alloc-types-no-impls-length-33.rs:26:23
|
||||
@ -77,7 +77,7 @@ LL | let boxed_array = <Arc<[i32; 33]>>::try_from(boxed_slice);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::TryFrom<std::sync::Arc<[i32]>>` is not implemented for `std::sync::Arc<[i32; 33]>`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<std::sync::Arc<[T; _]> as std::convert::TryFrom<std::sync::Arc<[T]>>>
|
||||
<std::sync::Arc<[T; N]> as std::convert::TryFrom<std::sync::Arc<[T]>>>
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
@ -39,9 +39,9 @@ LL | for _ in &[0_usize; 33] {
|
||||
| ^^^^^^^^^^^^^^ the trait `std::iter::IntoIterator` is not implemented for `&[usize; 33]`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<&'a [T; _] as std::iter::IntoIterator>
|
||||
<&'a [T; N] as std::iter::IntoIterator>
|
||||
<&'a [T] as std::iter::IntoIterator>
|
||||
<&'a mut [T; _] as std::iter::IntoIterator>
|
||||
<&'a mut [T; N] as std::iter::IntoIterator>
|
||||
<&'a mut [T] as std::iter::IntoIterator>
|
||||
= note: required by `std::iter::IntoIterator::into_iter`
|
||||
|
||||
|
@ -10,10 +10,10 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
||||
--> $DIR/broken-mir-2.rs:7:36
|
||||
|
|
||||
LL | struct S<T: Debug, const N: usize>([T; N]);
|
||||
| ^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[T; _]`
|
||||
| ^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[T; N]`
|
||||
|
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `[T; _]`
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&[T; _]`
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `[T; N]`
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&[T; N]`
|
||||
= note: required for the cast to the object type `dyn std::fmt::Debug`
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
@ -10,10 +10,10 @@ error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
||||
--> $DIR/derive-debug-array-wrapper.rs:6:5
|
||||
|
|
||||
LL | a: [u32; N],
|
||||
| ^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[u32; _]`
|
||||
| ^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[u32; N]`
|
||||
|
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `[u32; _]`
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&[u32; _]`
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `[u32; N]`
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&[u32; N]`
|
||||
= note: required for the cast to the object type `dyn std::fmt::Debug`
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | ArrayHolder([0; Self::SIZE])
|
||||
| ^^^^^^^^^^^^^^^ expected `X`, found `Self::SIZE`
|
||||
|
|
||||
= note: expected array `[u32; _]`
|
||||
= note: expected array `[u32; X]`
|
||||
found array `[u32; _]`
|
||||
|
||||
error: constant expression depends on a generic parameter
|
||||
|
Loading…
Reference in New Issue
Block a user