Apply suggestions from code review

Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
This commit is contained in:
Folkert de Vries 2024-07-22 20:44:32 +02:00 committed by Amanieu d'Antras
parent 97738e1b86
commit c77b56901f
2 changed files with 3 additions and 3 deletions

View file

@ -466,7 +466,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
hir::InlineAsmOperand::SymFn { anon_const } => {
debug_assert!(matches!(
self.tcx.type_of(anon_const.def_id).instantiate_identity().kind(),
ty::Error(_) | ty::Never | ty::FnDef(..)
ty::Error(_) | ty::FnDef(..)
));
}
// AST lowering guarantees that SymStatic points to a static.

View file

@ -65,7 +65,7 @@ fn anon_const_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx> {
let ty = tcx.typeck(def_id).node_type(hir_id);
match ty.kind() {
ty::Never | ty::Error(_) => ty,
ty::Error(_) => ty,
ty::FnDef(..) => ty,
_ => {
tcx.dcx()
@ -80,7 +80,7 @@ fn anon_const_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx> {
Ty::new_error_with_message(
tcx,
span,
format!("invalid type for `const` operand"),
format!("invalid type for `sym` operand"),
)
}
}