review + rename fn
This commit is contained in:
parent
6ffe36b37d
commit
0bea818b29
@ -479,7 +479,7 @@ fn check_item_type(tcx: TyCtxt<'_>, id: hir::ItemId) {
|
||||
match assoc_item.kind {
|
||||
ty::AssocKind::Fn => {
|
||||
let abi = tcx.fn_sig(assoc_item.def_id).skip_binder().abi();
|
||||
fn_maybe_err(tcx, assoc_item.ident(tcx).span, abi);
|
||||
forbid_intrinsic_abi(tcx, assoc_item.ident(tcx).span, abi);
|
||||
}
|
||||
ty::AssocKind::Type if assoc_item.defaultness(tcx).has_value() => {
|
||||
let trait_args = GenericArgs::identity_for_item(tcx, id.owner_id);
|
||||
|
@ -141,7 +141,7 @@ fn get_owner_return_paths(
|
||||
/// Forbid defining intrinsics in Rust code,
|
||||
/// as they must always be defined by the compiler.
|
||||
// FIXME: Move this to a more appropriate place.
|
||||
pub fn fn_maybe_err(tcx: TyCtxt<'_>, sp: Span, abi: Abi) {
|
||||
pub fn forbid_intrinsic_abi(tcx: TyCtxt<'_>, sp: Span, abi: Abi) {
|
||||
if let Abi::RustIntrinsic | Abi::PlatformIntrinsic = abi {
|
||||
tcx.sess.span_err(sp, "intrinsic must be in `extern \"rust-intrinsic\" { ... }` block");
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_hir_analysis::check::{check_function_signature, fn_maybe_err};
|
||||
use rustc_hir_analysis::check::{check_function_signature, forbid_intrinsic_abi};
|
||||
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use rustc_infer::infer::RegionVariableOrigin;
|
||||
use rustc_middle::ty::{self, Binder, Ty, TyCtxt};
|
||||
@ -53,7 +53,7 @@ pub(super) fn check_fn<'a, 'tcx>(
|
||||
|
||||
let span = body.value.span;
|
||||
|
||||
fn_maybe_err(tcx, span, fn_sig.abi);
|
||||
forbid_intrinsic_abi(tcx, span, fn_sig.abi);
|
||||
|
||||
if let Some(kind) = body.coroutine_kind
|
||||
&& can_be_coroutine.is_some()
|
||||
|
@ -776,9 +776,7 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
|
||||
new_err: impl Fn(TyCtxt<'tcx>, ErrorGuaranteed) -> T,
|
||||
) -> T
|
||||
where
|
||||
T: Into<ty::GenericArg<'tcx>> + Copy,
|
||||
T: TypeFoldable<TyCtxt<'tcx>>,
|
||||
T: TypeSuperFoldable<TyCtxt<'tcx>>,
|
||||
T: Into<ty::GenericArg<'tcx>> + TypeSuperFoldable<TyCtxt<'tcx>> + Copy,
|
||||
{
|
||||
let tcx = self.fcx.tcx;
|
||||
// We must deeply normalize in the new solver, since later lints
|
||||
|
Loading…
x
Reference in New Issue
Block a user