Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update src/librustc_mir_build/hair/pattern/_match.rs
Co-Authored-By: varkor <[email protected]>
  • Loading branch information
oli-obk and varkor authored Apr 2, 2020
commit 7c4984ffc63c3c1fd7a39b2a42d3f31d5034e32d
5 changes: 3 additions & 2 deletions src/librustc_mir_build/hair/pattern/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,9 @@ impl<'tcx> LiteralExpander<'tcx> {
}
}
}
// Unsize array to slice if pattern is array
// but match value or other patterns are slice.
// Unsize the array to a slice if we're matching on a slice,
// or other patterns are a slice (despite this pattern being
// an array).
(ConstValue::Scalar(s), ty::Array(t, n), ty::Slice(u)) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to avoid these one-letter variable names.

assert_eq!(t, u);
let n = n.eval_usize(self.tcx, ty::ParamEnv::empty()).try_into().unwrap();
Expand Down