mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
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 {
|
match assoc_item.kind {
|
||||||
ty::AssocKind::Fn => {
|
ty::AssocKind::Fn => {
|
||||||
let abi = tcx.fn_sig(assoc_item.def_id).skip_binder().abi();
|
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() => {
|
ty::AssocKind::Type if assoc_item.defaultness(tcx).has_value() => {
|
||||||
let trait_args = GenericArgs::identity_for_item(tcx, id.owner_id);
|
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,
|
/// Forbid defining intrinsics in Rust code,
|
||||||
/// as they must always be defined by the compiler.
|
/// as they must always be defined by the compiler.
|
||||||
// FIXME: Move this to a more appropriate place.
|
// 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 {
|
if let Abi::RustIntrinsic | Abi::PlatformIntrinsic = abi {
|
||||||
tcx.sess.span_err(sp, "intrinsic must be in `extern \"rust-intrinsic\" { ... }` block");
|
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::def::DefKind;
|
||||||
use rustc_hir::intravisit::Visitor;
|
use rustc_hir::intravisit::Visitor;
|
||||||
use rustc_hir::lang_items::LangItem;
|
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::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||||
use rustc_infer::infer::RegionVariableOrigin;
|
use rustc_infer::infer::RegionVariableOrigin;
|
||||||
use rustc_middle::ty::{self, Binder, Ty, TyCtxt};
|
use rustc_middle::ty::{self, Binder, Ty, TyCtxt};
|
||||||
@ -53,7 +53,7 @@ pub(super) fn check_fn<'a, 'tcx>(
|
|||||||
|
|
||||||
let span = body.value.span;
|
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
|
if let Some(kind) = body.coroutine_kind
|
||||||
&& can_be_coroutine.is_some()
|
&& can_be_coroutine.is_some()
|
||||||
|
@ -776,9 +776,7 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
|
|||||||
new_err: impl Fn(TyCtxt<'tcx>, ErrorGuaranteed) -> T,
|
new_err: impl Fn(TyCtxt<'tcx>, ErrorGuaranteed) -> T,
|
||||||
) -> T
|
) -> T
|
||||||
where
|
where
|
||||||
T: Into<ty::GenericArg<'tcx>> + Copy,
|
T: Into<ty::GenericArg<'tcx>> + TypeSuperFoldable<TyCtxt<'tcx>> + Copy,
|
||||||
T: TypeFoldable<TyCtxt<'tcx>>,
|
|
||||||
T: TypeSuperFoldable<TyCtxt<'tcx>>,
|
|
||||||
{
|
{
|
||||||
let tcx = self.fcx.tcx;
|
let tcx = self.fcx.tcx;
|
||||||
// We must deeply normalize in the new solver, since later lints
|
// We must deeply normalize in the new solver, since later lints
|
||||||
|
Loading…
Reference in New Issue
Block a user