Skip to content

Commit a49a8eb

Browse files
committed
review comments
1 parent 2906469 commit a49a8eb

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
301301
ccx.tcx.disabled_nightly_feature(
302302
&mut err,
303303
body.source.def_id().as_local().map(|local| ccx.tcx.local_def_id_to_hir_id(local)),
304-
vec![(String::new(), feature)].into_iter(),
304+
[(String::new(), feature)],
305305
);
306306
}
307307

compiler/rustc_hir_analysis/src/astconv/generics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn generic_arg_mismatch_err(
4444
tcx.disabled_nightly_feature(
4545
&mut err,
4646
param.def_id.as_local().map(|local| tcx.local_def_id_to_hir_id(local)),
47-
vec![(String::new(), sym::generic_arg_infer)].into_iter(),
47+
[(String::new(), sym::generic_arg_infer)],
4848
);
4949
}
5050
}

compiler/rustc_hir_analysis/src/check/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,9 @@ fn default_body_is_unstable(
291291
reason: reason_str,
292292
});
293293

294-
let inject_span =
295-
item_did.as_local().and_then(|id| tcx.crate_inject_span(tcx.local_def_id_to_hir_id(id)));
294+
let inject_span = item_did
295+
.as_local()
296+
.and_then(|id| tcx.crate_level_attribute_injection_span(tcx.local_def_id_to_hir_id(id)));
296297
rustc_session::parse::add_feature_diagnostics_for_issue(
297298
&mut err,
298299
&tcx.sess,

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1002,11 +1002,10 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) -> Result<(),
10021002
tcx.disabled_nightly_feature(
10031003
&mut diag,
10041004
Some(param.hir_id),
1005-
vec![(
1005+
[(
10061006
" more complex and user defined types".to_string(),
10071007
sym::adt_const_params,
1008-
)]
1009-
.into_iter(),
1008+
)],
10101009
);
10111010
}
10121011

compiler/rustc_middle/src/ty/context.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,7 @@ impl<'tcx> TyCtxt<'tcx> {
21752175

21762176
/// Find the crate root and the appropriate span where `use` and outer attributes can be
21772177
/// inserted at.
2178-
pub fn crate_inject_span(self, hir_id: HirId) -> Option<Span> {
2178+
pub fn crate_level_attribute_injection_span(self, hir_id: HirId) -> Option<Span> {
21792179
for (_hir_id, node) in self.hir().parent_iter(hir_id) {
21802180
if let hir::Node::Crate(m) = node {
21812181
return Some(m.spans.inject_use_span.shrink_to_lo());
@@ -2188,14 +2188,15 @@ impl<'tcx> TyCtxt<'tcx> {
21882188
self,
21892189
diag: &mut Diag<'_, E>,
21902190
hir_id: Option<HirId>,
2191-
features: impl Iterator<Item = (String, Symbol)>,
2191+
features: impl IntoIterator<Item = (String, Symbol)>,
21922192
) {
21932193
if !self.sess.is_nightly_build() {
21942194
return;
21952195
}
21962196

2197-
let span = hir_id.and_then(|id| self.crate_inject_span(id));
2197+
let span = hir_id.and_then(|id| self.crate_level_attribute_injection_span(id));
21982198
for (desc, feature) in features {
2199+
// FIXME: make this string translatable
21992200
let msg =
22002201
format!("add `#![feature({feature})]` to the crate attributes to enable{desc}");
22012202
if let Some(span) = span {

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3474,7 +3474,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
34743474
tcx.disabled_nightly_feature(
34753475
err,
34763476
Some(tcx.local_def_id_to_hir_id(body_id)),
3477-
vec![(String::new(), sym::trivial_bounds)].into_iter(),
3477+
[(String::new(), sym::trivial_bounds)],
34783478
);
34793479
}
34803480
ObligationCauseCode::OpaqueReturnType(expr_info) => {

0 commit comments

Comments
 (0)