impl !PartialOrd for UpvarMigrationInfo
This commit is contained in:
parent
0795b3de9b
commit
5a4e7eb040
1 changed files with 8 additions and 3 deletions
|
|
@ -85,7 +85,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
/// Intermediate format to store the hir_id pointing to the use that resulted in the
|
||||
/// corresponding place being captured and a String which contains the captured value's
|
||||
/// name (i.e: a.b.c)
|
||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
enum UpvarMigrationInfo {
|
||||
/// We previously captured all of `x`, but now we capture some sub-path.
|
||||
CapturingPrecise { source_expr: Option<HirId>, var_name: String },
|
||||
|
|
@ -1396,14 +1396,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
FxIndexSet::default()
|
||||
};
|
||||
|
||||
// Combine all the captures responsible for needing migrations into one HashSet
|
||||
// Combine all the captures responsible for needing migrations into one IndexSet
|
||||
let mut capture_diagnostic = drop_reorder_diagnostic.clone();
|
||||
for key in auto_trait_diagnostic.keys() {
|
||||
capture_diagnostic.insert(key.clone());
|
||||
}
|
||||
|
||||
let mut capture_diagnostic = capture_diagnostic.into_iter().collect::<Vec<_>>();
|
||||
capture_diagnostic.sort();
|
||||
capture_diagnostic.sort_by_cached_key(|info| match info {
|
||||
UpvarMigrationInfo::CapturingPrecise { source_expr: _, var_name } => {
|
||||
(0, Some(var_name.clone()))
|
||||
}
|
||||
UpvarMigrationInfo::CapturingNothing { use_span: _ } => (1, None),
|
||||
});
|
||||
for captures_info in capture_diagnostic {
|
||||
// Get the auto trait reasons of why migration is needed because of that capture, if there are any
|
||||
let capture_trait_reasons =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue