Skip to content

Commit cf4ca02

Browse files
authored
Rollup merge of #124918 - nnethercote:FIXME-lcnr, r=lcnr
Eliminate some `FIXME(lcnr)` comments In some cases this involved changing code. In some cases the comment was able to removed or replaced. r? `@lcnr`
2 parents e8e04cd + df6f713 commit cf4ca02

File tree

8 files changed

+12
-51
lines changed

8 files changed

+12
-51
lines changed

compiler/rustc_borrowck/src/renumber.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ pub fn renumber_mir<'tcx>(
2626
renumberer.visit_body(body);
2727
}
2828

29-
// FIXME(@lcnr): A lot of these variants overlap and it seems like
30-
// this type is only used to decide which region should be used
31-
// as representative. This should be cleaned up.
29+
// The fields are used only for debugging output in `sccs_info`.
3230
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
3331
pub(crate) enum RegionCtxt {
3432
Location(Location),

compiler/rustc_infer/src/errors/note_and_explain.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,8 @@ impl<'a> DescriptionCtx<'a> {
6969

7070
ty::RePlaceholder(_) | ty::ReError(_) => return None,
7171

72-
// FIXME(#13998) RePlaceholder should probably print like
73-
// ReLateParam rather than dumping Debug output on the user.
74-
//
75-
// We shouldn't really be having unification failures with ReVar
76-
// and ReBound though.
77-
//
78-
// FIXME(@lcnr): figure out why we have to handle `ReBound`
79-
// here, this feels somewhat off.
8072
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => {
81-
(alt_span, "revar", format!("{region:?}"))
73+
bug!("unexpected region for DescriptionCtx: {:?}", region);
8274
}
8375
};
8476
Some(DescriptionCtx { span, kind, arg })

compiler/rustc_infer/src/infer/error_reporting/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,9 @@ pub(super) fn note_and_explain_region<'tcx>(
173173

174174
ty::ReError(_) => return,
175175

176-
// We shouldn't really be having unification failures with ReVar
177-
// and ReBound though.
178-
//
179-
// FIXME(@lcnr): Figure out whether this is reachable and if so, why.
180-
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => (format!("lifetime `{region}`"), alt_span),
176+
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => {
177+
bug!("unexpected region for note_and_explain_region: {:?}", region);
178+
}
181179
};
182180

183181
emit_msg_span(err, prefix, description, span, suffix);

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,8 @@ pub enum RegionVariableOrigin {
529529

530530
/// Region variables created as the values for early-bound regions.
531531
///
532-
/// FIXME(@lcnr): This can also store a `DefId`, similar to
533-
/// `TypeVariableOriginKind::TypeParameterDefinition`.
532+
/// FIXME(@lcnr): This should also store a `DefId`, similar to
533+
/// `TypeVariableOrigin`.
534534
RegionParameterDefinition(Span, Symbol),
535535

536536
/// Region variables created when instantiating a binder with

compiler/rustc_middle/src/ty/normalize_erasing_regions.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ impl<'tcx> TyCtxt<'tcx> {
100100
/// codegen, we need to normalize the contents.
101101
// FIXME(@lcnr): This method should not be necessary, we now normalize
102102
// inside of binders. We should be able to only use
103-
// `tcx.instantiate_bound_regions_with_erased`. Same for the `try_X`
104-
// variant.
103+
// `tcx.instantiate_bound_regions_with_erased`.
105104
#[tracing::instrument(level = "debug", skip(self, param_env))]
106105
pub fn normalize_erasing_late_bound_regions<T>(
107106
self,
@@ -115,26 +114,6 @@ impl<'tcx> TyCtxt<'tcx> {
115114
self.normalize_erasing_regions(param_env, value)
116115
}
117116

118-
/// If you have a `Binder<'tcx, T>`, you can do this to strip out the
119-
/// late-bound regions and then normalize the result, yielding up
120-
/// a `T` (with regions erased). This is appropriate when the
121-
/// binder is being instantiated at the call site.
122-
///
123-
/// N.B., currently, higher-ranked type bounds inhibit
124-
/// normalization. Therefore, each time we erase them in
125-
/// codegen, we need to normalize the contents.
126-
pub fn try_normalize_erasing_late_bound_regions<T>(
127-
self,
128-
param_env: ty::ParamEnv<'tcx>,
129-
value: ty::Binder<'tcx, T>,
130-
) -> Result<T, NormalizationError<'tcx>>
131-
where
132-
T: TypeFoldable<TyCtxt<'tcx>>,
133-
{
134-
let value = self.instantiate_bound_regions_with_erased(value);
135-
self.try_normalize_erasing_regions(param_env, value)
136-
}
137-
138117
/// Monomorphizes a type from the AST by first applying the
139118
/// in-scope instantiations and then normalizing any associated
140119
/// types.

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3444,8 +3444,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
34443444
self.dcx().try_steal_replace_and_emit_err(self.tcx.def_span(def_id), StashKey::Cycle, err)
34453445
}
34463446

3447-
// FIXME(@lcnr): This function could be changed to trait `TraitRef` directly
3448-
// instead of using a `Binder`.
34493447
fn report_signature_mismatch_error(
34503448
&self,
34513449
obligation: &PredicateObligation<'tcx>,

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
694694

695695
let vtable_base = vtable_trait_first_method_offset(
696696
tcx,
697-
(unnormalized_upcast_trait_ref, ty::Binder::dummy(object_trait_ref)),
697+
unnormalized_upcast_trait_ref,
698+
ty::Binder::dummy(object_trait_ref),
698699
);
699700

700701
Ok(ImplSource::Builtin(BuiltinImplSource::Object { vtable_base: vtable_base }, nested))

compiler/rustc_trait_selection/src/traits/vtable.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,11 @@ fn vtable_entries<'tcx>(
321321
}
322322

323323
/// Find slot base for trait methods within vtable entries of another trait
324-
// FIXME(@lcnr): This isn't a query, so why does it take a tuple as its argument.
325324
pub(super) fn vtable_trait_first_method_offset<'tcx>(
326325
tcx: TyCtxt<'tcx>,
327-
key: (
328-
ty::PolyTraitRef<'tcx>, // trait_to_be_found
329-
ty::PolyTraitRef<'tcx>, // trait_owning_vtable
330-
),
326+
trait_to_be_found: ty::PolyTraitRef<'tcx>,
327+
trait_owning_vtable: ty::PolyTraitRef<'tcx>,
331328
) -> usize {
332-
let (trait_to_be_found, trait_owning_vtable) = key;
333-
334329
// #90177
335330
let trait_to_be_found_erased = tcx.erase_regions(trait_to_be_found);
336331

0 commit comments

Comments
 (0)