Skip to content

Commit

Permalink
use array explicitly instead of vec for const content (even if optimi…
Browse files Browse the repository at this point in the history
…zer smart enought to remove allocation)
  • Loading branch information
klensy committed Oct 20, 2021
1 parent aad48f7 commit f3fb821
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_typeck/src/check/upvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.tcx.get_diagnostic_item(sym::unwind_safe_trait),
self.tcx.get_diagnostic_item(sym::ref_unwind_safe_trait),
];
let auto_traits =
vec!["`Clone`", "`Sync`", "`Send`", "`Unpin`", "`UnwindSafe`", "`RefUnwindSafe`"];
const AUTO_TRAITS: [&str; 6] =
["`Clone`", "`Sync`", "`Send`", "`Unpin`", "`UnwindSafe`", "`RefUnwindSafe`"];

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

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

Expand Down

0 comments on commit f3fb821

Please sign in to comment.