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``
This commit is contained in:
commit
7e4f6082ce
8 changed files with 12 additions and 51 deletions
|
@ -26,9 +26,7 @@ pub fn renumber_mir<'tcx>(
|
||||||
renumberer.visit_body(body);
|
renumberer.visit_body(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME(@lcnr): A lot of these variants overlap and it seems like
|
// The fields are used only for debugging output in `sccs_info`.
|
||||||
// this type is only used to decide which region should be used
|
|
||||||
// as representative. This should be cleaned up.
|
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
||||||
pub(crate) enum RegionCtxt {
|
pub(crate) enum RegionCtxt {
|
||||||
Location(Location),
|
Location(Location),
|
||||||
|
|
|
@ -69,16 +69,8 @@ impl<'a> DescriptionCtx<'a> {
|
||||||
|
|
||||||
ty::RePlaceholder(_) | ty::ReError(_) => return None,
|
ty::RePlaceholder(_) | ty::ReError(_) => return None,
|
||||||
|
|
||||||
// FIXME(#13998) RePlaceholder should probably print like
|
|
||||||
// ReLateParam rather than dumping Debug output on the user.
|
|
||||||
//
|
|
||||||
// We shouldn't really be having unification failures with ReVar
|
|
||||||
// and ReBound though.
|
|
||||||
//
|
|
||||||
// FIXME(@lcnr): figure out why we have to handle `ReBound`
|
|
||||||
// here, this feels somewhat off.
|
|
||||||
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => {
|
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => {
|
||||||
(alt_span, "revar", format!("{region:?}"))
|
bug!("unexpected region for DescriptionCtx: {:?}", region);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Some(DescriptionCtx { span, kind, arg })
|
Some(DescriptionCtx { span, kind, arg })
|
||||||
|
|
|
@ -172,11 +172,9 @@ pub(super) fn note_and_explain_region<'tcx>(
|
||||||
|
|
||||||
ty::ReError(_) => return,
|
ty::ReError(_) => return,
|
||||||
|
|
||||||
// We shouldn't really be having unification failures with ReVar
|
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => {
|
||||||
// and ReBound though.
|
bug!("unexpected region for note_and_explain_region: {:?}", region);
|
||||||
//
|
}
|
||||||
// FIXME(@lcnr): Figure out whether this is reachable and if so, why.
|
|
||||||
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => (format!("lifetime `{region}`"), alt_span),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
emit_msg_span(err, prefix, description, span, suffix);
|
emit_msg_span(err, prefix, description, span, suffix);
|
||||||
|
|
|
@ -528,8 +528,8 @@ pub enum RegionVariableOrigin {
|
||||||
|
|
||||||
/// Region variables created as the values for early-bound regions.
|
/// Region variables created as the values for early-bound regions.
|
||||||
///
|
///
|
||||||
/// FIXME(@lcnr): This can also store a `DefId`, similar to
|
/// FIXME(@lcnr): This should also store a `DefId`, similar to
|
||||||
/// `TypeVariableOriginKind::TypeParameterDefinition`.
|
/// `TypeVariableOrigin`.
|
||||||
RegionParameterDefinition(Span, Symbol),
|
RegionParameterDefinition(Span, Symbol),
|
||||||
|
|
||||||
/// Region variables created when instantiating a binder with
|
/// Region variables created when instantiating a binder with
|
||||||
|
|
|
@ -100,8 +100,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
/// codegen, we need to normalize the contents.
|
/// codegen, we need to normalize the contents.
|
||||||
// FIXME(@lcnr): This method should not be necessary, we now normalize
|
// FIXME(@lcnr): This method should not be necessary, we now normalize
|
||||||
// inside of binders. We should be able to only use
|
// inside of binders. We should be able to only use
|
||||||
// `tcx.instantiate_bound_regions_with_erased`. Same for the `try_X`
|
// `tcx.instantiate_bound_regions_with_erased`.
|
||||||
// variant.
|
|
||||||
#[tracing::instrument(level = "debug", skip(self, param_env))]
|
#[tracing::instrument(level = "debug", skip(self, param_env))]
|
||||||
pub fn normalize_erasing_late_bound_regions<T>(
|
pub fn normalize_erasing_late_bound_regions<T>(
|
||||||
self,
|
self,
|
||||||
|
@ -115,26 +114,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
self.normalize_erasing_regions(param_env, value)
|
self.normalize_erasing_regions(param_env, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If you have a `Binder<'tcx, T>`, you can do this to strip out the
|
|
||||||
/// late-bound regions and then normalize the result, yielding up
|
|
||||||
/// a `T` (with regions erased). This is appropriate when the
|
|
||||||
/// binder is being instantiated at the call site.
|
|
||||||
///
|
|
||||||
/// N.B., currently, higher-ranked type bounds inhibit
|
|
||||||
/// normalization. Therefore, each time we erase them in
|
|
||||||
/// codegen, we need to normalize the contents.
|
|
||||||
pub fn try_normalize_erasing_late_bound_regions<T>(
|
|
||||||
self,
|
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
|
||||||
value: ty::Binder<'tcx, T>,
|
|
||||||
) -> Result<T, NormalizationError<'tcx>>
|
|
||||||
where
|
|
||||||
T: TypeFoldable<TyCtxt<'tcx>>,
|
|
||||||
{
|
|
||||||
let value = self.instantiate_bound_regions_with_erased(value);
|
|
||||||
self.try_normalize_erasing_regions(param_env, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Monomorphizes a type from the AST by first applying the
|
/// Monomorphizes a type from the AST by first applying the
|
||||||
/// in-scope instantiations and then normalizing any associated
|
/// in-scope instantiations and then normalizing any associated
|
||||||
/// types.
|
/// types.
|
||||||
|
|
|
@ -3443,8 +3443,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
self.dcx().try_steal_replace_and_emit_err(self.tcx.def_span(def_id), StashKey::Cycle, err)
|
self.dcx().try_steal_replace_and_emit_err(self.tcx.def_span(def_id), StashKey::Cycle, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME(@lcnr): This function could be changed to trait `TraitRef` directly
|
|
||||||
// instead of using a `Binder`.
|
|
||||||
fn report_signature_mismatch_error(
|
fn report_signature_mismatch_error(
|
||||||
&self,
|
&self,
|
||||||
obligation: &PredicateObligation<'tcx>,
|
obligation: &PredicateObligation<'tcx>,
|
||||||
|
|
|
@ -693,7 +693,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
let vtable_base = vtable_trait_first_method_offset(
|
let vtable_base = vtable_trait_first_method_offset(
|
||||||
tcx,
|
tcx,
|
||||||
(unnormalized_upcast_trait_ref, ty::Binder::dummy(object_trait_ref)),
|
unnormalized_upcast_trait_ref,
|
||||||
|
ty::Binder::dummy(object_trait_ref),
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(ImplSource::Builtin(BuiltinImplSource::Object { vtable_base: vtable_base }, nested))
|
Ok(ImplSource::Builtin(BuiltinImplSource::Object { vtable_base: vtable_base }, nested))
|
||||||
|
|
|
@ -320,16 +320,11 @@ fn vtable_entries<'tcx>(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find slot base for trait methods within vtable entries of another trait
|
/// Find slot base for trait methods within vtable entries of another trait
|
||||||
// FIXME(@lcnr): This isn't a query, so why does it take a tuple as its argument.
|
|
||||||
pub(super) fn vtable_trait_first_method_offset<'tcx>(
|
pub(super) fn vtable_trait_first_method_offset<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
key: (
|
trait_to_be_found: ty::PolyTraitRef<'tcx>,
|
||||||
ty::PolyTraitRef<'tcx>, // trait_to_be_found
|
trait_owning_vtable: ty::PolyTraitRef<'tcx>,
|
||||||
ty::PolyTraitRef<'tcx>, // trait_owning_vtable
|
|
||||||
),
|
|
||||||
) -> usize {
|
) -> usize {
|
||||||
let (trait_to_be_found, trait_owning_vtable) = key;
|
|
||||||
|
|
||||||
// #90177
|
// #90177
|
||||||
let trait_to_be_found_erased = tcx.erase_regions(trait_to_be_found);
|
let trait_to_be_found_erased = tcx.erase_regions(trait_to_be_found);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue