We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#![allow(warnings)] fn needs_slice(s: &[u8]) {} fn gives_array(a: u8) { needs_slice(&[a]) } fn main() {}
(Playground)
Mir from tcx.optimized_mir:
tcx.optimized_mir
fn gives_array(_1: u8) -> (){ let mut _0: (); // return place let mut _2: &[u8]; let mut _3: &[u8; 1]; let mut _4: &[u8; 1]; let mut _5: [u8; 1]; let mut _6: u8; bb0: { StorageLive(_2); // bb0[0]: scope 0 at src/main.rs:6:17: 6:21 StorageLive(_3); // bb0[1]: scope 0 at src/main.rs:6:17: 6:21 StorageLive(_4); // bb0[2]: scope 0 at src/main.rs:6:17: 6:21 StorageLive(_5); // bb0[3]: scope 0 at src/main.rs:6:18: 6:21 StorageLive(_6); // bb0[4]: scope 0 at src/main.rs:6:19: 6:20 _6 = _1; // bb0[5]: scope 0 at src/main.rs:6:19: 6:20 _5 = [move _6]; // bb0[6]: scope 0 at src/main.rs:6:18: 6:21 StorageDead(_6); // bb0[7]: scope 0 at src/main.rs:6:20: 6:21 _4 = &_5; // bb0[8]: scope 0 at src/main.rs:6:17: 6:21 _3 = _4; // bb0[9]: scope 0 at src/main.rs:6:17: 6:21 _2 = move _3 as &[u8] (Unsize); // bb0[10]: scope 0 at src/main.rs:6:17: 6:21 StorageDead(_3); // bb0[11]: scope 0 at src/main.rs:6:20: 6:21 _0 = const needs_slice(move _2) -> bb1; // bb0[12]: scope 0 at src/main.rs:6:5: 6:22 // ty::Const // + ty: for<'r> fn(&'r [u8]) {needs_slice} // + val: Value(ByVal(Undef)) // mir::Constant // + span: src/main.rs:6:5: 6:16 // + ty: for<'r> fn(&'r [u8]) {needs_slice} // + literal: const needs_slice } bb1: { StorageDead(_2); // bb1[0]: scope 0 at src/main.rs:6:21: 6:22 StorageDead(_4); // bb1[1]: scope 0 at src/main.rs:7:1: 7:2 StorageDead(_5); // bb1[2]: scope 0 at src/main.rs:7:1: 7:2 return; // bb1[3]: scope 0 at src/main.rs:7:2: 7:2 } }
This contains an aggregate (_5 = [move _6];), while the docs of Rvalue::Aggregate seem to imply that it shouldn't exist after optimizations:
_5 = [move _6];
Rvalue::Aggregate
These rvalues can be optimized away after type-checking and before lowering.
The text was updated successfully, but these errors were encountered:
This is a dupe of #48193
Sorry, something went wrong.
No branches or pull requests
(Playground)
Mir from
tcx.optimized_mir
:This contains an aggregate (
_5 = [move _6];
), while the docs ofRvalue::Aggregate
seem to imply that it shouldn't exist after optimizations:The text was updated successfully, but these errors were encountered: