i am free

This commit is contained in:
Boxy 2023-01-18 04:45:35 +00:00
parent a2a50f96f3
commit 1171fe5c45
7 changed files with 18 additions and 15 deletions

View File

@ -1290,15 +1290,18 @@ pub trait PrettyPrinter<'tcx>:
p!(print_value_path(def.did, substs))
}
DefKind::AnonConst => {
if def.is_local() {
let span = self.tcx().def_span(def.did);
if let Ok(snip) = self.tcx().sess.source_map().span_to_snippet(span) {
p!(write("{}", snip))
} else {
p!(print_value_path(def.did, substs))
}
if def.is_local()
&& let span = self.tcx().def_span(def.did)
&& let Ok(snip) = self.tcx().sess.source_map().span_to_snippet(span)
{
p!(write("{}", snip))
} else {
p!(print_value_path(def.did, substs))
// Do not call `print_value_path` as if a parent of this anon const is an impl it will
// attempt to print out the impl trait ref i.e. `<T as Trait>::{constant#0}`. This would
// cause printing to enter an infinite recursion if the anon const is in the self type i.e.
// `impl<T: Default> Default for [T; 32 - 1 - 1 - 1] {`
// where we would try to print `<[T; /* print `constant#0` again */] as Default>::{constant#0}`
p!(write("{}::{}", self.tcx().crate_name(def.did.krate), self.tcx().def_path(def.did).to_string_no_crate_verbose()))
}
}
defkind => bug!("`{:?}` has unexpcted defkind {:?}", ct, defkind),

View File

@ -22,7 +22,7 @@
|
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/region_subtyping_basic.rs:+0:11: +0:11
let mut _1: [usize; Const { ty: usize, kind: Value(Leaf(0x00000003)) }]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
let mut _1: [usize; Const(Value(Leaf(0x00000003)): usize)]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
let _3: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:16: +2:17
let mut _4: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
let mut _5: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18

View File

@ -22,7 +22,7 @@
|
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/region_subtyping_basic.rs:+0:11: +0:11
let mut _1: [usize; Const { ty: usize, kind: Value(Leaf(0x0000000000000003)) }]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
let mut _1: [usize; Const(Value(Leaf(0x0000000000000003)): usize)]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
let _3: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:16: +2:17
let mut _4: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
let mut _5: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18

View File

@ -2,10 +2,10 @@ error[E0308]: mismatched types
--> $DIR/non_local_anon_const_diagnostics.rs:12:43
|
LL | let _: anon_const_non_local::Foo<2> = anon_const_non_local::foo::<M>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2`, found `foo::<M>::{constant#0}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2`, found `anon_const_non_local::::foo::{constant#0}`
|
= note: expected constant `2`
found constant `foo::<M>::{constant#0}`
found constant `anon_const_non_local::::foo::{constant#0}`
error: aborting due to previous error

View File

@ -1,4 +1,4 @@
error: values of the type `[usize; 4294967295]` are too big for the current architecture
error: values of the type `[usize; usize::MAX]` are too big for the current architecture
--> $DIR/issue-15919-32.rs:9:9
|
LL | let x = [0usize; 0xffff_ffff];

View File

@ -1,5 +1,5 @@
// build-fail
// normalize-stderr-test "\[&usize; \d+\]" -> "[&usize; N]"
// normalize-stderr-test "\[&usize; \d+\]" -> "[&usize; usize::MAX]"
// error-pattern: too big for the current architecture
// FIXME https://github.com/rust-lang/rust/issues/59774

View File

@ -1,4 +1,4 @@
error: values of the type `[&usize; N]` are too big for the current architecture
error: values of the type `[&usize; usize::MAX]` are too big for the current architecture
error: aborting due to previous error