Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f043106

Browse files
committedFeb 19, 2023
fix build
Signed-off-by: Zhi Qi <[email protected]>
1 parent 17a7ccc commit f043106

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed
 

‎compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

+16-19
Original file line numberDiff line numberDiff line change
@@ -924,17 +924,16 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
924924
origin,
925925
..
926926
}) => {
927-
928927
let (bound_vars, binders): (FxIndexMap<LocalDefId, ResolvedArg>, Vec<_>) =
929928
bound_generic_params
930-
.iter()
931-
.enumerate()
932-
.map(|(late_bound_idx, param)| {
933-
let pair = ResolvedArg::late(late_bound_idx as u32, param);
934-
let r = late_arg_as_bound_arg(this.tcx, &pair.1, param);
935-
(pair, r)
936-
})
937-
.unzip();
929+
.iter()
930+
.enumerate()
931+
.map(|(late_bound_idx, param)| {
932+
let pair = ResolvedArg::late(late_bound_idx as u32, param);
933+
let r = late_arg_as_bound_arg(this.tcx, &pair.1, param);
934+
(pair, r)
935+
})
936+
.unzip();
938937
this.record_late_bound_vars(hir_id, binders.clone());
939938
// Even if there are no lifetimes defined here, we still wrap it in a binder
940939
// scope. If there happens to be a nested poly trait ref (an error), that
@@ -968,23 +967,21 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
968967
if lt.res != hir::LifetimeName::Static {
969968
continue;
970969
}
971-
this.insert_lifetime(lt, Region::Static);
970+
this.insert_lifetime(lt, ResolvedArg::StaticLifetime);
972971
this.tcx.struct_span_lint_hir(
973972
lint::builtin::NAMED_STATIC_LIFETIMES,
974973
lifetime.hir_id,
975-
lifetime.span,
974+
lifetime.ident.span,
975+
format!(
976+
"unnecessary lifetime parameter `{}`",
977+
lifetime.ident
978+
),
976979
|lint| {
977-
let msg = &format!(
978-
"unnecessary lifetime parameter `{}`",
979-
lifetime.name.ident(),
980-
);
981980
let help = &format!(
982981
"you can use the `'static` lifetime directly, in place of `{}`",
983-
lifetime.name.ident(),
982+
lifetime.ident,
984983
);
985-
lint.build(msg)
986-
.help(help)
987-
.emit();
984+
lint.note(help)
988985
},
989986
);
990987
}

0 commit comments

Comments
 (0)
Please sign in to comment.