Box in ValTreeKind::Branch(Box<[I::Const]>) changed to List#152593
Box in ValTreeKind::Branch(Box<[I::Const]>) changed to List#152593rust-bors[bot] merged 4 commits intorust-lang:mainfrom
ValTreeKind::Branch(Box<[I::Const]>) changed to List#152593Conversation
|
Some changes occurred in match lowering cc @Nadrieril |
721e973 to
0f786b9
Compare
This comment has been minimized.
This comment has been minimized.
| let ValTreeKind::Branch(branch) = *valtree else { | ||
| bug!("malformed valtree for an enum") | ||
| }; | ||
| let Some(actual_variant_idx) = branch.get(0) else { |
There was a problem hiding this comment.
we stop asserting that the len is 1 here
| @@ -179,7 +179,7 @@ impl<I: Interner> ValTreeKind<I> { | |||
| #[inline] | |||
| pub fn to_branch(&self) -> &[I::Const] { | |||
There was a problem hiding this comment.
| pub fn to_branch(&self) -> &[I::Const] { | |
| pub fn to_branch(&self) -> I::Consts { |
| @@ -195,7 +195,7 @@ impl<I: Interner> ValTreeKind<I> { | |||
| /// Attempts to convert to a `ValTreeKind::Branch` value. | |||
| pub fn try_to_branch(&self) -> Option<&[I::Const]> { | |||
| } | ||
| // Otherwise, print the array separated by commas (or if it's a tuple) | ||
| (ty::ValTreeKind::Branch(fields), ty::Array(..) | ty::Tuple(..)) => { | ||
| let fields_iter = fields.iter().copied(); |
There was a problem hiding this comment.
Consts should implement SliceLike so we can just do .iter() here now
There was a problem hiding this comment.
Consts implements SliceLike, but .iter() on fields returns &Const and the following code works only for iterator over Const:
error[E0277]: the trait bound `&ty::consts::Const<'_>: print::Print<'tcx, Self>` is not satisfied
--> compiler/rustc_middle/src/ty/print/pretty.rs:1964:34
|
1964 | ... self.comma_sep(fields)?;
| ^^^^^^^^^ the nightly-only, unstable trait `print::Print<'tcx, Self>` is not implemented for `&ty::consts::Const<'_>`
|
help: the trait `Print<'tcx, _>` is not implemented for `&ty::consts::Const<'_>`
but trait `Print<'_, _>` is implemented for `ty::consts::Const<'_>
There was a problem hiding this comment.
I do think the as_slice should not be needed 🤔
Though given that we're in rustc_middle i guess this is the inherent impl for List or via deref?
There was a problem hiding this comment.
still relevant, can you try removing the as_slice?
There was a problem hiding this comment.
Ah, sorry, I have overlooked your original reply. It is fixed now.
compiler/rustc_type_ir/src/relate.rs
Outdated
| .as_slice() | ||
| .iter() | ||
| .zip(branches_b.as_slice().iter()) | ||
| .all(|(a, b)| relation.relate(*a, *b).is_ok()) |
There was a problem hiding this comment.
| .as_slice() | |
| .iter() | |
| .zip(branches_b.as_slice().iter()) | |
| .all(|(a, b)| relation.relate(*a, *b).is_ok()) | |
| .iter() | |
| .zip(branches_b.iter()) | |
| .all(|(a, b)| relation.relate(a, b).is_ok()) |
When If I try to fix it through adding explicit type: I get: I do not understand what is the problem here. |
|
Can you try removing the rust/compiler/rustc_middle/src/arena.rs Line 95 in ce0bf0b dropless arena.
I don't 100% know how to do here and you could look at how e.g. |
Thank you, it is fixed now.
With this change, it is safe to update the test to a new hash value or I would just cover a deeper problem? |
This comment has been minimized.
This comment has been minimized.
I think this is fine, but not 100% sure 🤔 feel free to bless it and I then look at the change before merge @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (7e95d4f): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -0.4%, secondary 0.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 483.037s -> 480.952s (-0.43%) |
| //@ gdb-command:info functions -q function_names::const_generic_fn.* | ||
| //@ gdb-check:[...]static fn function_names::const_generic_fn_bool<false>(); | ||
| //@ gdb-check:[...]static fn function_names::const_generic_fn_non_int<{CONST#ffa3db4ca1d52dce}>(); | ||
| //@ gdb-check:[...]static fn function_names::const_generic_fn_non_int<{CONST#6dd80cc0c950c171}>(); |
There was a problem hiding this comment.
that's fine, different HashStable impl between List and boxed slices 🤷
There was a problem hiding this comment.
Thanks. Does it need some additional work from my side? All comments above should be resolved
| } | ||
| // Otherwise, print the array separated by commas (or if it's a tuple) | ||
| (ty::ValTreeKind::Branch(fields), ty::Array(..) | ty::Tuple(..)) => { | ||
| let fields_iter = fields.iter().copied(); |
|
@bors delegate |
|
@bors r=lcnr |
|
The perf. result was neutral on the last perf. run, so: @bors rollup=maybe |
Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`
This is related to trait system refactoring. It fixes the FIXME in `ValTreeKind`
```
// FIXME(mgca): Use a `List` here instead of a boxed slice
Branch(Box<[I::Const]>),
```
It introduces `Internator::Consts`, changes `Branch(Box<[I::Const]>)` to `Branch(I::Consts)`, and updates all relevant places.
r? lcnr
Rollup of 7 pull requests Successful merges: - #153466 (`rust-analyzer` subtree update) - #151280 (Fix incorrect trailing comma suggested in no_accessible_fields) - #152593 (Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`) - #153189 (refactor: move `check_align` to `parse_alignment`) - #153230 (Roll rustfmt reviewers for in-tree rustfmt) - #153321 (Add high-priority ICEs to tests/crashes) - #153445 (Consider try blocks as block-like for overflowed expr)
Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`
This is related to trait system refactoring. It fixes the FIXME in `ValTreeKind`
```
// FIXME(mgca): Use a `List` here instead of a boxed slice
Branch(Box<[I::Const]>),
```
It introduces `Interner::Consts`, changes `Branch(Box<[I::Const]>)` to `Branch(I::Consts)`, and updates all relevant places.
r? lcnr
…uwer Rollup of 9 pull requests Successful merges: - #153466 (`rust-analyzer` subtree update) - #151280 (Fix incorrect trailing comma suggested in no_accessible_fields) - #152593 (Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`) - #153174 (std: add wasm64 to sync::Once and thread_parking atomics cfg guards) - #153189 (refactor: move `check_align` to `parse_alignment`) - #153230 (Roll rustfmt reviewers for in-tree rustfmt) - #153445 (Consider try blocks as block-like for overflowed expr) - #153476 (bootstrap.py: fix typo "parallle") - #153483 (Preserve parentheses around `Fn` trait bounds in pretty printer)
Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`
This is related to trait system refactoring. It fixes the FIXME in `ValTreeKind`
```
// FIXME(mgca): Use a `List` here instead of a boxed slice
Branch(Box<[I::Const]>),
```
It introduces `Interner::Consts`, changes `Branch(Box<[I::Const]>)` to `Branch(I::Consts)`, and updates all relevant places.
r? lcnr
…uwer Rollup of 14 pull requests Successful merges: - #153466 (`rust-analyzer` subtree update) - #151280 (Fix incorrect trailing comma suggested in no_accessible_fields) - #152593 (Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`) - #153174 (std: add wasm64 to sync::Once and thread_parking atomics cfg guards) - #153485 (libcore float tests: replace macro shadowing by const-compatible macro) - #153495 (Fix ICE in `offset_of!` error recovery) - #152040 (Do not emit ConstEvaluatable goals if type-const) - #152741 (Suppress invalid suggestions in destructuring assignment) - #153189 (refactor: move `check_align` to `parse_alignment`) - #153230 (Roll rustfmt reviewers for in-tree rustfmt) - #153445 (Consider try blocks as block-like for overflowed expr) - #153452 (Cleanup unused diagnostic emission methods) - #153476 (bootstrap.py: fix typo "parallle") - #153483 (Preserve parentheses around `Fn` trait bounds in pretty printer)
Rollup merge of #152593 - spirali:valtreekind-list, r=lcnr Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List` This is related to trait system refactoring. It fixes the FIXME in `ValTreeKind` ``` // FIXME(mgca): Use a `List` here instead of a boxed slice Branch(Box<[I::Const]>), ``` It introduces `Interner::Consts`, changes `Branch(Box<[I::Const]>)` to `Branch(I::Consts)`, and updates all relevant places. r? lcnr
…uwer Rollup of 14 pull requests Successful merges: - rust-lang/rust#153466 (`rust-analyzer` subtree update) - rust-lang/rust#151280 (Fix incorrect trailing comma suggested in no_accessible_fields) - rust-lang/rust#152593 (Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`) - rust-lang/rust#153174 (std: add wasm64 to sync::Once and thread_parking atomics cfg guards) - rust-lang/rust#153485 (libcore float tests: replace macro shadowing by const-compatible macro) - rust-lang/rust#153495 (Fix ICE in `offset_of!` error recovery) - rust-lang/rust#152040 (Do not emit ConstEvaluatable goals if type-const) - rust-lang/rust#152741 (Suppress invalid suggestions in destructuring assignment) - rust-lang/rust#153189 (refactor: move `check_align` to `parse_alignment`) - rust-lang/rust#153230 (Roll rustfmt reviewers for in-tree rustfmt) - rust-lang/rust#153445 (Consider try blocks as block-like for overflowed expr) - rust-lang/rust#153452 (Cleanup unused diagnostic emission methods) - rust-lang/rust#153476 (bootstrap.py: fix typo "parallle") - rust-lang/rust#153483 (Preserve parentheses around `Fn` trait bounds in pretty printer)
…uwer Rollup of 14 pull requests Successful merges: - rust-lang/rust#153466 (`rust-analyzer` subtree update) - rust-lang/rust#151280 (Fix incorrect trailing comma suggested in no_accessible_fields) - rust-lang/rust#152593 (Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`) - rust-lang/rust#153174 (std: add wasm64 to sync::Once and thread_parking atomics cfg guards) - rust-lang/rust#153485 (libcore float tests: replace macro shadowing by const-compatible macro) - rust-lang/rust#153495 (Fix ICE in `offset_of!` error recovery) - rust-lang/rust#152040 (Do not emit ConstEvaluatable goals if type-const) - rust-lang/rust#152741 (Suppress invalid suggestions in destructuring assignment) - rust-lang/rust#153189 (refactor: move `check_align` to `parse_alignment`) - rust-lang/rust#153230 (Roll rustfmt reviewers for in-tree rustfmt) - rust-lang/rust#153445 (Consider try blocks as block-like for overflowed expr) - rust-lang/rust#153452 (Cleanup unused diagnostic emission methods) - rust-lang/rust#153476 (bootstrap.py: fix typo "parallle") - rust-lang/rust#153483 (Preserve parentheses around `Fn` trait bounds in pretty printer)
This is related to trait system refactoring. It fixes the FIXME in
ValTreeKindIt introduces
Interner::Consts, changesBranch(Box<[I::Const]>)toBranch(I::Consts), and updates all relevant places.r? lcnr