Skip to content

Commit

Permalink
Update some outdated names and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
camelid committed Oct 21, 2024
1 parent 3ec4308 commit b6b6d99
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
7 changes: 0 additions & 7 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1988,13 +1988,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
}

/// Lower a type from the HIR to our internal notion of a type given some extra data for diagnostics.
///
/// Extra diagnostic data:
///
/// 1. `borrowed`: Whether trait object types are borrowed like in `&dyn Trait`.
/// Used to avoid emitting redundant errors.
/// 2. `in_path`: Whether the type appears inside of a path.
/// Used to provide correct diagnostics for bare trait object types.
#[instrument(level = "debug", skip(self), ret)]
pub fn lower_ty(&self, hir_ty: &hir::Ty<'tcx>) -> Ty<'tcx> {
let tcx = self.tcx();
Expand Down
10 changes: 3 additions & 7 deletions compiler/rustc_middle/src/ty/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl<'tcx> Const<'tcx> {

let ty = tcx.type_of(def).no_bound_vars().expect("const parameter types cannot be generic");

match Self::try_from_lit_or_param(tcx, ty, expr) {
match Self::try_from_lit(tcx, ty, expr) {
Some(v) => v,
None => ty::Const::new_unevaluated(tcx, ty::UnevaluatedConst {
def: def.to_def_id(),
Expand Down Expand Up @@ -278,11 +278,7 @@ impl<'tcx> Const<'tcx> {
}

#[instrument(skip(tcx), level = "debug")]
fn try_from_lit_or_param(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
expr: &'tcx hir::Expr<'tcx>,
) -> Option<Self> {
fn try_from_lit(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, expr: &'tcx hir::Expr<'tcx>) -> Option<Self> {
// Unwrap a block, so that e.g. `{ P }` is recognised as a parameter. Const arguments
// currently have to be wrapped in curly brackets, so it's necessary to special-case.
let expr = match &expr.kind {
Expand Down Expand Up @@ -321,7 +317,7 @@ impl<'tcx> Const<'tcx> {
Err(e) => {
tcx.dcx().span_delayed_bug(
expr.span,
format!("Const::from_anon_const: couldn't lit_to_const {e:?}"),
format!("Const::try_from_lit: couldn't lit_to_const {e:?}"),
);
}
}
Expand Down

0 comments on commit b6b6d99

Please sign in to comment.