Skip to content

Commit f3fb821

Browse files
committed
use array explicitly instead of vec for const content (even if optimizer smart enought to remove allocation)
1 parent aad48f7 commit f3fb821

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/rustc_typeck/src/check/upvar.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
883883
self.tcx.get_diagnostic_item(sym::unwind_safe_trait),
884884
self.tcx.get_diagnostic_item(sym::ref_unwind_safe_trait),
885885
];
886-
let auto_traits =
887-
vec!["`Clone`", "`Sync`", "`Send`", "`Unpin`", "`UnwindSafe`", "`RefUnwindSafe`"];
886+
const AUTO_TRAITS: [&str; 6] =
887+
["`Clone`", "`Sync`", "`Send`", "`Unpin`", "`UnwindSafe`", "`RefUnwindSafe`"];
888888

889889
let root_var_min_capture_list = min_captures.and_then(|m| m.get(&var_hir_id))?;
890890

@@ -957,7 +957,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
957957
// by the root variable but not by the capture
958958
for (idx, _) in obligations_should_hold.iter().enumerate() {
959959
if !obligations_holds_for_capture[idx] && obligations_should_hold[idx] {
960-
capture_problems.insert(auto_traits[idx]);
960+
capture_problems.insert(AUTO_TRAITS[idx]);
961961
}
962962
}
963963

0 commit comments

Comments
 (0)