Skip to content

Commit

Permalink
Rollup merge of rust-lang#134010 - RalfJung:promoted-type-error-ice, …
Browse files Browse the repository at this point in the history
…r=oli-obk

fix ICE on type error in promoted

Fixes rust-lang#133968

Ensure that when we turn a type error into a "this promoted failed to evaluate" error, we do record this as something that may happen even in "infallible" promoteds.
  • Loading branch information
fmease authored Dec 10, 2024
2 parents 59392be + a9594c1 commit 6450014
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions clippy_lints/src/non_copy_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_hir::{
BodyId, Expr, ExprKind, HirId, Impl, ImplItem, ImplItemKind, Item, ItemKind, Node, TraitItem, TraitItemKind, UnOp,
};
use rustc_lint::{LateContext, LateLintPass, Lint};
use rustc_middle::mir::interpret::{ErrorHandled, EvalToValTreeResult, GlobalId};
use rustc_middle::mir::interpret::{ErrorHandled, EvalToValTreeResult, GlobalId, ReportedErrorInfo};
use rustc_middle::ty::adjustment::Adjust;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_session::impl_lint_pass;
Expand Down Expand Up @@ -302,7 +302,10 @@ impl<'tcx> NonCopyConst<'tcx> {
tcx.const_eval_global_id_for_typeck(typing_env, cid, span)
},
Ok(None) => Err(ErrorHandled::TooGeneric(span)),
Err(err) => Err(ErrorHandled::Reported(err.into(), span)),
Err(err) => Err(ErrorHandled::Reported(
ReportedErrorInfo::non_const_eval_error(err),
span,
)),
}
}
}
Expand Down

0 comments on commit 6450014

Please sign in to comment.