mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 05:26:47 +00:00
Rollup merge of #139455 - Skgland:remove_rust-intrinsic_ABI, r=oli-obk
Remove support for `extern "rust-intrinsic"` blocks Part of rust-lang/rust#132735 Looked manageable and there didn't appear to have been progress in the last two weeks, so decided to give it a try.
This commit is contained in:
commit
9209c5eb60
@ -60,7 +60,6 @@ pub enum ExternAbi {
|
||||
System {
|
||||
unwind: bool,
|
||||
},
|
||||
RustIntrinsic,
|
||||
RustCall,
|
||||
/// *Not* a stable ABI, just directly use the Rust types to describe the ABI for LLVM. Even
|
||||
/// normally ABI-compatible Rust types can become ABI-incompatible with this ABI!
|
||||
@ -128,7 +127,6 @@ abi_impls! {
|
||||
RiscvInterruptS =><= "riscv-interrupt-s",
|
||||
RustCall =><= "rust-call",
|
||||
RustCold =><= "rust-cold",
|
||||
RustIntrinsic =><= "rust-intrinsic",
|
||||
Stdcall { unwind: false } =><= "stdcall",
|
||||
Stdcall { unwind: true } =><= "stdcall-unwind",
|
||||
System { unwind: false } =><= "system",
|
||||
@ -199,7 +197,7 @@ impl ExternAbi {
|
||||
/// - are subject to change between compiler versions
|
||||
pub fn is_rustic_abi(self) -> bool {
|
||||
use ExternAbi::*;
|
||||
matches!(self, Rust | RustCall | RustIntrinsic | RustCold)
|
||||
matches!(self, Rust | RustCall | RustCold)
|
||||
}
|
||||
|
||||
pub fn supports_varargs(self) -> bool {
|
||||
|
@ -79,10 +79,6 @@ pub fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> {
|
||||
| ExternAbi::SysV64 { .. }
|
||||
| ExternAbi::System { .. }
|
||||
| ExternAbi::EfiApi => Ok(()),
|
||||
// implementation details
|
||||
ExternAbi::RustIntrinsic => {
|
||||
Err(UnstableAbi { abi, feature: sym::intrinsics, explain: GateReason::ImplDetail })
|
||||
}
|
||||
ExternAbi::Unadjusted => {
|
||||
Err(UnstableAbi { abi, feature: sym::abi_unadjusted, explain: GateReason::ImplDetail })
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
//! Codegen of intrinsics. This includes `extern "rust-intrinsic"`,
|
||||
//! functions marked with the `#[rustc_intrinsic]` attribute
|
||||
//! Codegen of intrinsics. This includes functions marked with the `#[rustc_intrinsic]` attribute
|
||||
//! and LLVM intrinsics that have symbol names starting with `llvm.`.
|
||||
|
||||
macro_rules! intrinsic_args {
|
||||
|
@ -6,8 +6,9 @@ Erroneous code example:
|
||||
#![feature(intrinsics)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
pub static atomic_singlethreadfence_seqcst: fn();
|
||||
extern "C" {
|
||||
#[rustc_intrinsic]
|
||||
pub static atomic_singlethreadfence_seqcst: unsafe fn();
|
||||
// error: intrinsic must be a function
|
||||
}
|
||||
|
||||
@ -22,9 +23,8 @@ error, just declare a function. Example:
|
||||
#![feature(intrinsics)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
pub fn atomic_singlethreadfence_seqcst(); // ok!
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_singlethreadfence_seqcst(); // ok!
|
||||
|
||||
fn main() { unsafe { atomic_singlethreadfence_seqcst(); } }
|
||||
```
|
||||
|
@ -211,7 +211,7 @@ declare_features! (
|
||||
(internal, custom_mir, "1.65.0", None),
|
||||
/// Outputs useful `assert!` messages
|
||||
(unstable, generic_assert, "1.63.0", None),
|
||||
/// Allows using the `rust-intrinsic`'s "ABI".
|
||||
/// Allows using the #[rustc_intrinsic] attribute.
|
||||
(internal, intrinsics, "1.0.0", None),
|
||||
/// Allows using `#[lang = ".."]` attribute for linking items to special compiler logic.
|
||||
(internal, lang_items, "1.0.0", None),
|
||||
|
@ -741,10 +741,6 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
|
||||
for &assoc_item in assoc_items.in_definition_order() {
|
||||
match assoc_item.kind {
|
||||
ty::AssocKind::Fn => {
|
||||
let abi = tcx.fn_sig(assoc_item.def_id).skip_binder().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, def_id);
|
||||
let _: Result<_, rustc_errors::ErrorGuaranteed> = check_type_bounds(
|
||||
@ -788,65 +784,59 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
};
|
||||
check_abi(tcx, it.span, abi);
|
||||
|
||||
match abi {
|
||||
ExternAbi::RustIntrinsic => {
|
||||
for item in items {
|
||||
intrinsic::check_intrinsic_type(
|
||||
tcx,
|
||||
item.id.owner_id.def_id,
|
||||
item.span,
|
||||
item.ident.name,
|
||||
abi,
|
||||
);
|
||||
}
|
||||
for item in items {
|
||||
let def_id = item.id.owner_id.def_id;
|
||||
|
||||
if tcx.has_attr(def_id, sym::rustc_intrinsic) {
|
||||
intrinsic::check_intrinsic_type(
|
||||
tcx,
|
||||
item.id.owner_id.def_id,
|
||||
item.span,
|
||||
item.ident.name,
|
||||
abi,
|
||||
);
|
||||
}
|
||||
|
||||
_ => {
|
||||
for item in items {
|
||||
let def_id = item.id.owner_id.def_id;
|
||||
let generics = tcx.generics_of(def_id);
|
||||
let own_counts = generics.own_counts();
|
||||
if generics.own_params.len() - own_counts.lifetimes != 0 {
|
||||
let (kinds, kinds_pl, egs) = match (own_counts.types, own_counts.consts)
|
||||
{
|
||||
(_, 0) => ("type", "types", Some("u32")),
|
||||
// We don't specify an example value, because we can't generate
|
||||
// a valid value for any type.
|
||||
(0, _) => ("const", "consts", None),
|
||||
_ => ("type or const", "types or consts", None),
|
||||
};
|
||||
struct_span_code_err!(
|
||||
tcx.dcx(),
|
||||
item.span,
|
||||
E0044,
|
||||
"foreign items may not have {kinds} parameters",
|
||||
)
|
||||
.with_span_label(item.span, format!("can't have {kinds} parameters"))
|
||||
.with_help(
|
||||
// FIXME: once we start storing spans for type arguments, turn this
|
||||
// into a suggestion.
|
||||
format!(
|
||||
"replace the {} parameters with concrete {}{}",
|
||||
kinds,
|
||||
kinds_pl,
|
||||
egs.map(|egs| format!(" like `{egs}`")).unwrap_or_default(),
|
||||
),
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
let generics = tcx.generics_of(def_id);
|
||||
let own_counts = generics.own_counts();
|
||||
if generics.own_params.len() - own_counts.lifetimes != 0 {
|
||||
let (kinds, kinds_pl, egs) = match (own_counts.types, own_counts.consts) {
|
||||
(_, 0) => ("type", "types", Some("u32")),
|
||||
// We don't specify an example value, because we can't generate
|
||||
// a valid value for any type.
|
||||
(0, _) => ("const", "consts", None),
|
||||
_ => ("type or const", "types or consts", None),
|
||||
};
|
||||
struct_span_code_err!(
|
||||
tcx.dcx(),
|
||||
item.span,
|
||||
E0044,
|
||||
"foreign items may not have {kinds} parameters",
|
||||
)
|
||||
.with_span_label(item.span, format!("can't have {kinds} parameters"))
|
||||
.with_help(
|
||||
// FIXME: once we start storing spans for type arguments, turn this
|
||||
// into a suggestion.
|
||||
format!(
|
||||
"replace the {} parameters with concrete {}{}",
|
||||
kinds,
|
||||
kinds_pl,
|
||||
egs.map(|egs| format!(" like `{egs}`")).unwrap_or_default(),
|
||||
),
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
let item = tcx.hir_foreign_item(item.id);
|
||||
match &item.kind {
|
||||
hir::ForeignItemKind::Fn(sig, _, _) => {
|
||||
require_c_abi_if_c_variadic(tcx, sig.decl, abi, item.span);
|
||||
}
|
||||
hir::ForeignItemKind::Static(..) => {
|
||||
check_static_inhabited(tcx, def_id);
|
||||
check_static_linkage(tcx, def_id);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
let item = tcx.hir_foreign_item(item.id);
|
||||
match &item.kind {
|
||||
hir::ForeignItemKind::Fn(sig, _, _) => {
|
||||
require_c_abi_if_c_variadic(tcx, sig.decl, abi, item.span);
|
||||
}
|
||||
hir::ForeignItemKind::Static(..) => {
|
||||
check_static_inhabited(tcx, def_id);
|
||||
check_static_linkage(tcx, def_id);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
//! Type-checking for the rust-intrinsic intrinsics that the compiler exposes.
|
||||
//! Type-checking for the `#[rustc_intrinsic]` intrinsics that the compiler exposes.
|
||||
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_errors::codes::*;
|
||||
|
@ -137,15 +137,6 @@ 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 forbid_intrinsic_abi(tcx: TyCtxt<'_>, sp: Span, abi: ExternAbi) {
|
||||
if let ExternAbi::RustIntrinsic = abi {
|
||||
tcx.dcx().span_err(sp, "intrinsic must be in `extern \"rust-intrinsic\" { ... }` block");
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn maybe_check_static_with_link_section(tcx: TyCtxt<'_>, id: LocalDefId) {
|
||||
// Only restricted on wasm target for now
|
||||
if !tcx.sess.target.is_like_wasm {
|
||||
|
@ -42,7 +42,6 @@ use rustc_trait_selection::infer::InferCtxtExt;
|
||||
use rustc_trait_selection::traits::ObligationCtxt;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use crate::check::intrinsic::intrinsic_operation_unsafety;
|
||||
use crate::errors;
|
||||
use crate::hir_ty_lowering::errors::assoc_kind_str;
|
||||
use crate::hir_ty_lowering::{FeedConstTy, HirTyLowerer, RegionInferReason};
|
||||
@ -1704,18 +1703,13 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
|
||||
abi: ExternAbi,
|
||||
safety: hir::Safety,
|
||||
) -> ty::PolyFnSig<'tcx> {
|
||||
let safety = if abi == ExternAbi::RustIntrinsic {
|
||||
intrinsic_operation_unsafety(tcx, def_id)
|
||||
} else {
|
||||
safety
|
||||
};
|
||||
let hir_id = tcx.local_def_id_to_hir_id(def_id);
|
||||
let fty =
|
||||
ItemCtxt::new(tcx, def_id).lowerer().lower_fn_ty(hir_id, safety, abi, decl, None, None);
|
||||
|
||||
// Feature gate SIMD types in FFI, since I am not sure that the
|
||||
// ABIs are handled at all correctly. -huonw
|
||||
if abi != ExternAbi::RustIntrinsic && !tcx.features().simd_ffi() {
|
||||
if !tcx.features().simd_ffi() {
|
||||
let check = |hir_ty: &hir::Ty<'_>, ty: Ty<'_>| {
|
||||
if ty.is_simd() {
|
||||
let snip = tcx
|
||||
|
@ -5,7 +5,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, forbid_intrinsic_abi};
|
||||
use rustc_hir_analysis::check::check_function_signature;
|
||||
use rustc_infer::infer::RegionVariableOrigin;
|
||||
use rustc_infer::traits::WellFormedLoc;
|
||||
use rustc_middle::ty::{self, Binder, Ty, TyCtxt};
|
||||
@ -50,8 +50,6 @@ pub(super) fn check_fn<'a, 'tcx>(
|
||||
|
||||
let span = body.value.span;
|
||||
|
||||
forbid_intrinsic_abi(tcx, span, fn_sig.abi);
|
||||
|
||||
GatherLocalsVisitor::new(fcx).visit_body(body);
|
||||
|
||||
// C-variadic fns also have a `VaList` input that's not listed in `fn_sig`
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_attr_parsing::InlineAttr;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{Applicability, Diag, struct_span_code_err};
|
||||
@ -1240,10 +1239,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
};
|
||||
if let (Some(a_sig), Some(b_sig)) = (a_sig, b_sig) {
|
||||
// Intrinsics are not coercible to function pointers.
|
||||
if a_sig.abi() == ExternAbi::RustIntrinsic || b_sig.abi() == ExternAbi::RustIntrinsic {
|
||||
return Err(TypeError::IntrinsicCast);
|
||||
}
|
||||
// The signature must match.
|
||||
let (a_sig, b_sig) = self.normalize(new.span, (a_sig, b_sig));
|
||||
let sig = self
|
||||
|
@ -207,7 +207,7 @@ impl<'tcx> Collector<'tcx> {
|
||||
|
||||
let sess = self.tcx.sess;
|
||||
|
||||
if matches!(abi, ExternAbi::Rust | ExternAbi::RustIntrinsic) {
|
||||
if matches!(abi, ExternAbi::Rust) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ pub enum InstanceKind<'tcx> {
|
||||
/// - coroutines
|
||||
Item(DefId),
|
||||
|
||||
/// An intrinsic `fn` item (with `"rust-intrinsic"` ABI).
|
||||
/// An intrinsic `fn` item (with`#[rustc_instrinsic]`).
|
||||
///
|
||||
/// Alongside `Virtual`, this is the only `InstanceKind` that does not have its own callable MIR.
|
||||
/// Instead, codegen and const eval "magically" evaluate calls to intrinsics purely in the
|
||||
|
@ -1265,9 +1265,7 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: ExternAbi)
|
||||
| CCmseNonSecureCall
|
||||
| CCmseNonSecureEntry
|
||||
| Unadjusted => false,
|
||||
Rust | RustCall | RustCold | RustIntrinsic => {
|
||||
tcx.sess.panic_strategy() == PanicStrategy::Unwind
|
||||
}
|
||||
Rust | RustCall | RustCold => tcx.sess.panic_strategy() == PanicStrategy::Unwind,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use std::{fmt, iter};
|
||||
|
||||
use rustc_abi::{ExternAbi, Float, Integer, IntegerType, Size};
|
||||
use rustc_abi::{Float, Integer, IntegerType, Size};
|
||||
use rustc_apfloat::Float as _;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
@ -1719,10 +1719,7 @@ pub fn is_doc_notable_trait(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||
/// the compiler to make some assumptions about its shape; if the user doesn't use a feature gate, they may
|
||||
/// cause an ICE that we otherwise may want to prevent.
|
||||
pub fn intrinsic_raw(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::IntrinsicDef> {
|
||||
if tcx.features().intrinsics()
|
||||
&& (matches!(tcx.fn_sig(def_id).skip_binder().abi(), ExternAbi::RustIntrinsic)
|
||||
|| tcx.has_attr(def_id, sym::rustc_intrinsic))
|
||||
{
|
||||
if tcx.features().intrinsics() && tcx.has_attr(def_id, sym::rustc_intrinsic) {
|
||||
let must_be_overridden = match tcx.hir_node_by_def_id(def_id) {
|
||||
hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn { has_body, .. }, .. }) => {
|
||||
!has_body
|
||||
|
@ -1598,7 +1598,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
if target == Target::ForeignMod
|
||||
&& let hir::Node::Item(item) = self.tcx.hir_node(hir_id)
|
||||
&& let Item { kind: ItemKind::ForeignMod { abi, .. }, .. } = item
|
||||
&& !matches!(abi, ExternAbi::Rust | ExternAbi::RustIntrinsic)
|
||||
&& !matches!(abi, ExternAbi::Rust)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -491,7 +491,6 @@ impl RustcInternal for Abi {
|
||||
Abi::CCmseNonSecureCall => rustc_abi::ExternAbi::CCmseNonSecureCall,
|
||||
Abi::CCmseNonSecureEntry => rustc_abi::ExternAbi::CCmseNonSecureEntry,
|
||||
Abi::System { unwind } => rustc_abi::ExternAbi::System { unwind },
|
||||
Abi::RustIntrinsic => rustc_abi::ExternAbi::RustIntrinsic,
|
||||
Abi::RustCall => rustc_abi::ExternAbi::RustCall,
|
||||
Abi::Unadjusted => rustc_abi::ExternAbi::Unadjusted,
|
||||
Abi::RustCold => rustc_abi::ExternAbi::RustCold,
|
||||
|
@ -871,7 +871,6 @@ impl<'tcx> Stable<'tcx> for rustc_abi::ExternAbi {
|
||||
ExternAbi::CCmseNonSecureCall => Abi::CCmseNonSecureCall,
|
||||
ExternAbi::CCmseNonSecureEntry => Abi::CCmseNonSecureEntry,
|
||||
ExternAbi::System { unwind } => Abi::System { unwind },
|
||||
ExternAbi::RustIntrinsic => Abi::RustIntrinsic,
|
||||
ExternAbi::RustCall => Abi::RustCall,
|
||||
ExternAbi::Unadjusted => Abi::Unadjusted,
|
||||
ExternAbi::RustCold => Abi::RustCold,
|
||||
|
@ -1093,7 +1093,6 @@ pub enum Abi {
|
||||
CCmseNonSecureCall,
|
||||
CCmseNonSecureEntry,
|
||||
System { unwind: bool },
|
||||
RustIntrinsic,
|
||||
RustCall,
|
||||
Unadjusted,
|
||||
RustCold,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_abi::{
|
||||
BackendRepr, ExternAbi, FieldsShape, HasDataLayout, Primitive, Reg, RegKind, Size,
|
||||
TyAbiInterface, TyAndLayout, Variants,
|
||||
BackendRepr, FieldsShape, HasDataLayout, Primitive, Reg, RegKind, Size, TyAbiInterface,
|
||||
TyAndLayout, Variants,
|
||||
};
|
||||
|
||||
use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
|
||||
@ -364,15 +364,11 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rust_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, abi: ExternAbi)
|
||||
pub(crate) fn compute_rust_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
|
||||
where
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
C: HasDataLayout + HasTargetSpec,
|
||||
{
|
||||
if abi == ExternAbi::RustIntrinsic {
|
||||
return;
|
||||
}
|
||||
|
||||
let grlen = cx.data_layout().pointer_size.bits();
|
||||
|
||||
for arg in fn_abi.args.iter_mut() {
|
||||
|
@ -717,16 +717,16 @@ impl<'a, Ty> FnAbi<'a, Ty> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn adjust_for_rust_abi<C>(&mut self, cx: &C, abi: ExternAbi)
|
||||
pub fn adjust_for_rust_abi<C>(&mut self, cx: &C)
|
||||
where
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
C: HasDataLayout + HasTargetSpec,
|
||||
{
|
||||
let spec = cx.target_spec();
|
||||
match &*spec.arch {
|
||||
"x86" => x86::compute_rust_abi_info(cx, self, abi),
|
||||
"riscv32" | "riscv64" => riscv::compute_rust_abi_info(cx, self, abi),
|
||||
"loongarch64" => loongarch::compute_rust_abi_info(cx, self, abi),
|
||||
"x86" => x86::compute_rust_abi_info(cx, self),
|
||||
"riscv32" | "riscv64" => riscv::compute_rust_abi_info(cx, self),
|
||||
"loongarch64" => loongarch::compute_rust_abi_info(cx, self),
|
||||
"aarch64" => aarch64::compute_rust_abi_info(cx, self),
|
||||
_ => {}
|
||||
};
|
||||
@ -850,10 +850,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
|
||||
//
|
||||
// Note that the intrinsic ABI is exempt here as those are not
|
||||
// real functions anyway, and the backend expects very specific types.
|
||||
if abi != ExternAbi::RustIntrinsic
|
||||
&& spec.simd_types_indirect
|
||||
&& !can_pass_simd_directly(arg)
|
||||
{
|
||||
if spec.simd_types_indirect && !can_pass_simd_directly(arg) {
|
||||
arg.make_indirect();
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
// https://github.com/llvm/llvm-project/blob/8e780252a7284be45cf1ba224cabd884847e8e92/clang/lib/CodeGen/TargetInfo.cpp#L9311-L9773
|
||||
|
||||
use rustc_abi::{
|
||||
BackendRepr, ExternAbi, FieldsShape, HasDataLayout, Primitive, Reg, RegKind, Size,
|
||||
TyAbiInterface, TyAndLayout, Variants,
|
||||
BackendRepr, FieldsShape, HasDataLayout, Primitive, Reg, RegKind, Size, TyAbiInterface,
|
||||
TyAndLayout, Variants,
|
||||
};
|
||||
|
||||
use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
|
||||
@ -370,15 +370,11 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rust_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, abi: ExternAbi)
|
||||
pub(crate) fn compute_rust_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
|
||||
where
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
C: HasDataLayout + HasTargetSpec,
|
||||
{
|
||||
if abi == ExternAbi::RustIntrinsic {
|
||||
return;
|
||||
}
|
||||
|
||||
let xlen = cx.data_layout().pointer_size.bits();
|
||||
|
||||
for arg in fn_abi.args.iter_mut() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_abi::{
|
||||
AddressSpace, Align, BackendRepr, ExternAbi, HasDataLayout, Primitive, Reg, RegKind,
|
||||
TyAbiInterface, TyAndLayout,
|
||||
AddressSpace, Align, BackendRepr, HasDataLayout, Primitive, Reg, RegKind, TyAbiInterface,
|
||||
TyAndLayout,
|
||||
};
|
||||
|
||||
use crate::callconv::{ArgAttribute, FnAbi, PassMode};
|
||||
@ -193,7 +193,7 @@ pub(crate) fn fill_inregs<'a, Ty, C>(
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rust_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, abi: ExternAbi)
|
||||
pub(crate) fn compute_rust_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
|
||||
where
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
C: HasDataLayout + HasTargetSpec,
|
||||
@ -201,10 +201,7 @@ where
|
||||
// Avoid returning floats in x87 registers on x86 as loading and storing from x87
|
||||
// registers will quiet signalling NaNs. Also avoid using SSE registers since they
|
||||
// are not always available (depending on target features).
|
||||
if !fn_abi.ret.is_ignore()
|
||||
// Intrinsics themselves are not "real" functions, so theres no need to change their ABIs.
|
||||
&& abi != ExternAbi::RustIntrinsic
|
||||
{
|
||||
if !fn_abi.ret.is_ignore() {
|
||||
let has_float = match fn_abi.ret.layout.backend_repr {
|
||||
BackendRepr::Scalar(s) => matches!(s.primitive(), Primitive::Float(_)),
|
||||
BackendRepr::ScalarPair(s1, s2) => {
|
||||
|
@ -2962,14 +2962,9 @@ impl Target {
|
||||
pub fn is_abi_supported(&self, abi: ExternAbi) -> bool {
|
||||
use ExternAbi::*;
|
||||
match abi {
|
||||
Rust
|
||||
| C { .. }
|
||||
| System { .. }
|
||||
| RustIntrinsic
|
||||
| RustCall
|
||||
| Unadjusted
|
||||
| Cdecl { .. }
|
||||
| RustCold => true,
|
||||
Rust | C { .. } | System { .. } | RustCall | Unadjusted | Cdecl { .. } | RustCold => {
|
||||
true
|
||||
}
|
||||
EfiApi => {
|
||||
["arm", "aarch64", "riscv32", "riscv64", "x86", "x86_64"].contains(&&self.arch[..])
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ fn fn_sig_for_fn_abi<'tcx>(
|
||||
fn conv_from_spec_abi(tcx: TyCtxt<'_>, abi: ExternAbi, c_variadic: bool) -> Conv {
|
||||
use rustc_abi::ExternAbi::*;
|
||||
match tcx.sess.target.adjust_abi(abi, c_variadic) {
|
||||
RustIntrinsic | Rust | RustCall => Conv::Rust,
|
||||
Rust | RustCall => Conv::Rust,
|
||||
|
||||
// This is intentionally not using `Conv::Cold`, as that has to preserve
|
||||
// even SIMD registers, which is generally not a good trade-off.
|
||||
@ -660,7 +660,7 @@ fn fn_abi_adjust_for_abi<'tcx>(
|
||||
let tcx = cx.tcx();
|
||||
|
||||
if abi.is_rustic_abi() {
|
||||
fn_abi.adjust_for_rust_abi(cx, abi);
|
||||
fn_abi.adjust_for_rust_abi(cx);
|
||||
|
||||
// Look up the deduced parameter attributes for this function, if we have its def ID and
|
||||
// we're optimizing in non-incremental mode. We'll tag its parameters with those attributes
|
||||
|
@ -8,6 +8,7 @@
|
||||
//! Note: any changes to the constness of intrinsics should be discussed with the language team.
|
||||
//! This includes changes in the stability of the constness.
|
||||
//!
|
||||
//! //FIXME(#132735) "old" style intrinsics support has been removed
|
||||
//! In order to make an intrinsic usable at compile-time, it needs to be declared in the "new"
|
||||
//! style, i.e. as a `#[rustc_intrinsic]` function, not inside an `extern` block. Then copy the
|
||||
//! implementation from <https://github.com/rust-lang/miri/blob/master/src/intrinsics> to
|
||||
|
@ -52,9 +52,8 @@ with any regular function.
|
||||
Various intrinsics have native MIR operations that they correspond to. Instead of requiring
|
||||
backends to implement both the intrinsic and the MIR operation, the `lower_intrinsics` pass
|
||||
will convert the calls to the MIR operation. Backends do not need to know about these intrinsics
|
||||
at all. These intrinsics only make sense without a body, and can either be declared as a "rust-intrinsic"
|
||||
or as a `#[rustc_intrinsic]`. The body is never used, as calls to the intrinsic do not exist
|
||||
anymore after MIR analyses.
|
||||
at all. These intrinsics only make sense without a body, and can be declared as a `#[rustc_intrinsic]`.
|
||||
The body is never used, as calls to the intrinsic do not exist anymore after MIR analyses.
|
||||
|
||||
## Intrinsics without fallback logic
|
||||
|
||||
@ -70,28 +69,3 @@ These are written without a body:
|
||||
#[rustc_intrinsic]
|
||||
pub fn abort() -> !;
|
||||
```
|
||||
|
||||
### Legacy extern ABI based intrinsics
|
||||
|
||||
*This style is deprecated, always prefer the above form.*
|
||||
|
||||
These are imported as if they were FFI functions, with the special
|
||||
`rust-intrinsic` ABI. For example, if one was in a freestanding
|
||||
context, but wished to be able to `transmute` between types, and
|
||||
perform efficient pointer arithmetic, one would import those functions
|
||||
via a declaration like
|
||||
|
||||
```rust
|
||||
#![feature(intrinsics)]
|
||||
#![allow(internal_features)]
|
||||
# fn main() {}
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn transmute<T, U>(x: T) -> U;
|
||||
|
||||
fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;
|
||||
}
|
||||
```
|
||||
|
||||
As with any other FFI functions, these are by default always `unsafe` to call.
|
||||
You can add `#[rustc_safe_intrinsic]` to the intrinsic to make it safe to call.
|
||||
|
@ -11,7 +11,6 @@ use rustc_hir::def::{CtorKind, DefKind, Res};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId};
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_hir::{BodyId, Mutability};
|
||||
use rustc_hir_analysis::check::intrinsic::intrinsic_operation_unsafety;
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_metadata::rendered_const;
|
||||
use rustc_middle::span_bug;
|
||||
@ -687,8 +686,6 @@ impl Item {
|
||||
hir::FnHeader {
|
||||
safety: if tcx.codegen_fn_attrs(def_id).safe_target_features {
|
||||
hir::HeaderSafety::SafeTargetFeatures
|
||||
} else if abi == ExternAbi::RustIntrinsic {
|
||||
intrinsic_operation_unsafety(tcx, def_id.expect_local()).into()
|
||||
} else {
|
||||
safety.into()
|
||||
},
|
||||
|
@ -400,7 +400,6 @@ pub enum FnAbi {
|
||||
Rust,
|
||||
RustCall,
|
||||
RustCold,
|
||||
RustIntrinsic,
|
||||
Stdcall,
|
||||
StdcallUnwind,
|
||||
System,
|
||||
@ -457,7 +456,6 @@ impl FnAbi {
|
||||
s if *s == sym::riscv_dash_interrupt_dash_s => FnAbi::RiscvInterruptS,
|
||||
s if *s == sym::rust_dash_call => FnAbi::RustCall,
|
||||
s if *s == sym::rust_dash_cold => FnAbi::RustCold,
|
||||
s if *s == sym::rust_dash_intrinsic => FnAbi::RustIntrinsic,
|
||||
s if *s == sym::Rust => FnAbi::Rust,
|
||||
s if *s == sym::stdcall_dash_unwind => FnAbi::StdcallUnwind,
|
||||
s if *s == sym::stdcall => FnAbi::Stdcall,
|
||||
@ -500,7 +498,6 @@ impl FnAbi {
|
||||
FnAbi::Rust => "Rust",
|
||||
FnAbi::RustCall => "rust-call",
|
||||
FnAbi::RustCold => "rust-cold",
|
||||
FnAbi::RustIntrinsic => "rust-intrinsic",
|
||||
FnAbi::Stdcall => "stdcall",
|
||||
FnAbi::StdcallUnwind => "stdcall-unwind",
|
||||
FnAbi::System => "system",
|
||||
|
@ -59,19 +59,7 @@ impl Evaluator<'_> {
|
||||
|
||||
let function_data = self.db.function_data(def);
|
||||
let attrs = self.db.attrs(def.into());
|
||||
let is_intrinsic = attrs.by_key(&sym::rustc_intrinsic).exists()
|
||||
// Keep this around for a bit until extern "rustc-intrinsic" abis are no longer used
|
||||
|| (match &function_data.abi {
|
||||
Some(abi) => *abi == sym::rust_dash_intrinsic,
|
||||
None => match def.lookup(self.db.upcast()).container {
|
||||
hir_def::ItemContainerId::ExternBlockId(block) => {
|
||||
let id = block.lookup(self.db.upcast()).id;
|
||||
id.item_tree(self.db.upcast())[id.value].abi.as_ref()
|
||||
== Some(&sym::rust_dash_intrinsic)
|
||||
}
|
||||
_ => false,
|
||||
},
|
||||
});
|
||||
let is_intrinsic = attrs.by_key(&sym::rustc_intrinsic).exists();
|
||||
|
||||
if is_intrinsic {
|
||||
return self.exec_intrinsic(
|
||||
|
@ -18,7 +18,6 @@ use hir_def::{
|
||||
TypeOrConstParamId,
|
||||
};
|
||||
use hir_expand::name::Name;
|
||||
use intern::sym;
|
||||
use rustc_abi::TargetDataLayout;
|
||||
use rustc_hash::FxHashSet;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
@ -303,26 +302,13 @@ pub fn is_fn_unsafe_to_call(
|
||||
|
||||
let loc = func.lookup(db.upcast());
|
||||
match loc.container {
|
||||
hir_def::ItemContainerId::ExternBlockId(block) => {
|
||||
let id = block.lookup(db.upcast()).id;
|
||||
let is_intrinsic_block =
|
||||
id.item_tree(db.upcast())[id.value].abi.as_ref() == Some(&sym::rust_dash_intrinsic);
|
||||
if is_intrinsic_block {
|
||||
// legacy intrinsics
|
||||
// extern "rust-intrinsic" intrinsics are unsafe unless they have the rustc_safe_intrinsic attribute
|
||||
if db.attrs(func.into()).by_key(&sym::rustc_safe_intrinsic).exists() {
|
||||
Unsafety::Safe
|
||||
} else {
|
||||
Unsafety::Unsafe
|
||||
}
|
||||
hir_def::ItemContainerId::ExternBlockId(_block) => {
|
||||
// Function in an `extern` block are always unsafe to call, except when
|
||||
// it is marked as `safe`.
|
||||
if data.is_safe() {
|
||||
Unsafety::Safe
|
||||
} else {
|
||||
// Function in an `extern` block are always unsafe to call, except when
|
||||
// it is marked as `safe`.
|
||||
if data.is_safe() {
|
||||
Unsafety::Safe
|
||||
} else {
|
||||
Unsafety::Unsafe
|
||||
}
|
||||
Unsafety::Unsafe
|
||||
}
|
||||
}
|
||||
_ => Unsafety::Safe,
|
||||
|
@ -36,7 +36,6 @@ const SUPPORTED_CALLING_CONVENTIONS: &[&str] = &[
|
||||
"wasm",
|
||||
"system",
|
||||
"system-unwind",
|
||||
"rust-intrinsic",
|
||||
"rust-call",
|
||||
"unadjusted",
|
||||
];
|
||||
|
@ -6945,9 +6945,8 @@ fn hover_feature() {
|
||||
Various intrinsics have native MIR operations that they correspond to. Instead of requiring
|
||||
backends to implement both the intrinsic and the MIR operation, the `lower_intrinsics` pass
|
||||
will convert the calls to the MIR operation. Backends do not need to know about these intrinsics
|
||||
at all. These intrinsics only make sense without a body, and can either be declared as a "rust-intrinsic"
|
||||
or as a `#[rustc_intrinsic]`. The body is never used, as calls to the intrinsic do not exist
|
||||
anymore after MIR analyses.
|
||||
at all. These intrinsics only make sense without a body, and can be as a `#[rustc_intrinsic]`.
|
||||
The body is never used, as calls to the intrinsic do not exist anymore after MIR analyses.
|
||||
|
||||
## Intrinsics without fallback logic
|
||||
|
||||
@ -6960,29 +6959,6 @@ fn hover_feature() {
|
||||
`#[rustc_intrinsic_must_be_overridden]` to the function to ensure that backends don't
|
||||
invoke the body.
|
||||
|
||||
### Legacy extern ABI based intrinsics
|
||||
|
||||
These are imported as if they were FFI functions, with the special
|
||||
`rust-intrinsic` ABI. For example, if one was in a freestanding
|
||||
context, but wished to be able to `transmute` between types, and
|
||||
perform efficient pointer arithmetic, one would import those functions
|
||||
via a declaration like
|
||||
|
||||
```rust
|
||||
#![feature(intrinsics)]
|
||||
#![allow(internal_features)]
|
||||
# fn main() {}
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn transmute<T, U>(x: T) -> U;
|
||||
|
||||
fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;
|
||||
}
|
||||
```
|
||||
|
||||
As with any other FFI functions, these are by default always `unsafe` to call.
|
||||
You can add `#[rustc_safe_intrinsic]` to the intrinsic to make it safe to call.
|
||||
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
@ -125,7 +125,6 @@ define_symbols! {
|
||||
riscv_dash_interrupt_dash_s = "riscv-interrupt-s",
|
||||
rust_dash_call = "rust-call",
|
||||
rust_dash_cold = "rust-cold",
|
||||
rust_dash_intrinsic = "rust-intrinsic",
|
||||
stdcall_dash_unwind = "stdcall-unwind",
|
||||
system_dash_unwind = "system-unwind",
|
||||
sysv64_dash_unwind = "sysv64-unwind",
|
||||
|
@ -35,9 +35,8 @@ pub struct m64x2([i64; 2]);
|
||||
#[repr(simd)]
|
||||
pub struct m64x4([i64; 4]);
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn simd_bitmask<V, B>(mask: V) -> B;
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn simd_bitmask<V, B>(mask: V) -> B;
|
||||
|
||||
// CHECK-LABEL: bitmask_m8x16
|
||||
#[no_mangle]
|
||||
|
@ -22,9 +22,8 @@ pub struct m64x4([i64; 4]);
|
||||
#[repr(simd)]
|
||||
pub struct pf64x4([*const f64; 4]);
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn simd_gather<V, M, P>(values: V, mask: M, pointer: P) -> V;
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn simd_gather<V, M, P>(values: V, mask: M, pointer: P) -> V;
|
||||
|
||||
// CHECK-LABEL: gather_f64x4
|
||||
#[no_mangle]
|
||||
|
@ -34,9 +34,8 @@ pub struct f64x4([f64; 4]);
|
||||
#[repr(simd)]
|
||||
pub struct m64x4([i64; 4]);
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T;
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T;
|
||||
|
||||
// CHECK-LABEL: load_i8x16
|
||||
#[no_mangle]
|
||||
|
@ -20,10 +20,10 @@ use minicore::*;
|
||||
#[repr(simd)]
|
||||
pub struct mask8x16([i8; 16]);
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn simd_reduce_all<T>(x: T) -> bool;
|
||||
fn simd_reduce_any<T>(x: T) -> bool;
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn simd_reduce_all<T>(x: T) -> bool;
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn simd_reduce_any<T>(x: T) -> bool;
|
||||
|
||||
// CHECK-LABEL: mask_reduce_all:
|
||||
#[no_mangle]
|
||||
|
@ -34,9 +34,8 @@ pub struct f64x4([f64; 4]);
|
||||
#[repr(simd)]
|
||||
pub struct m64x4([i64; 4]);
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T);
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T);
|
||||
|
||||
// CHECK-LABEL: store_i8x16
|
||||
#[no_mangle]
|
||||
|
@ -22,9 +22,8 @@ pub struct m64x4([i64; 4]);
|
||||
#[repr(simd)]
|
||||
pub struct pf64x4([*mut f64; 4]);
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn simd_scatter<V, P, M>(values: V, pointer: P, mask: M);
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn simd_scatter<V, P, M>(values: V, pointer: P, mask: M);
|
||||
|
||||
// CHECK-LABEL: scatter_f64x4
|
||||
#[no_mangle]
|
||||
|
@ -48,9 +48,8 @@ pub struct f64x8([f64; 8]);
|
||||
#[repr(simd)]
|
||||
pub struct m64x8([i64; 8]);
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn simd_select<M, V>(mask: M, a: V, b: V) -> V;
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn simd_select<M, V>(mask: M, a: V, b: V) -> V;
|
||||
|
||||
// CHECK-LABEL: select_i8x16
|
||||
#[no_mangle]
|
||||
|
@ -17,9 +17,8 @@
|
||||
extern crate minicore;
|
||||
use minicore::*;
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
pub fn transmute<Src, Dst>(src: Src) -> Dst;
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn transmute<Src, Dst>(src: Src) -> Dst;
|
||||
|
||||
pub static mut STORAGE_FOO: fn(&usize, &mut u32) -> Result<(), ()> = arbitrary_black_box;
|
||||
pub static mut STORAGE_BAR: u32 = 12;
|
||||
|
@ -23,13 +23,12 @@ fn size_of<T>() -> usize {
|
||||
loop {}
|
||||
}
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn catch_unwind(
|
||||
try_fn: fn(_: *mut u8),
|
||||
data: *mut u8,
|
||||
catch_fn: fn(_: *mut u8, _: *mut u8),
|
||||
) -> i32;
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn catch_unwind(
|
||||
try_fn: fn(_: *mut u8),
|
||||
data: *mut u8,
|
||||
catch_fn: fn(_: *mut u8, _: *mut u8),
|
||||
) -> i32;
|
||||
|
||||
// CHECK-LABEL: @ptr_size
|
||||
#[no_mangle]
|
||||
|
@ -21,14 +21,12 @@ impl<T> Copy for *mut T {}
|
||||
fn size_of<T>() -> usize {
|
||||
loop {}
|
||||
}
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn catch_unwind(
|
||||
try_fn: fn(_: *mut u8),
|
||||
data: *mut u8,
|
||||
catch_fn: fn(_: *mut u8, _: *mut u8),
|
||||
) -> i32;
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn catch_unwind(
|
||||
try_fn: fn(_: *mut u8),
|
||||
data: *mut u8,
|
||||
catch_fn: fn(_: *mut u8, _: *mut u8),
|
||||
) -> i32;
|
||||
|
||||
// CHECK-LABEL: @ptr_size
|
||||
#[no_mangle]
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
#![feature(intrinsics)]
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn sqrtf32(x: f32) -> f32;
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn sqrtf32(x: f32) -> f32;
|
||||
|
||||
// CHECK: @llvm.sqrt.f32(float) #{{[0-9]*}}
|
||||
|
||||
fn main() {
|
||||
|
@ -18,9 +18,8 @@
|
||||
extern crate minicore;
|
||||
use minicore::*;
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
pub fn nontemporal_store<T>(ptr: *mut T, val: T);
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn nontemporal_store<T>(ptr: *mut T, val: T);
|
||||
|
||||
#[no_mangle]
|
||||
pub fn a(a: &mut u32, b: u32) {
|
||||
|
@ -153,11 +153,10 @@ pub fn discriminant<T>(t: T) {
|
||||
core::intrinsics::discriminant_value(&E::B);
|
||||
}
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
// Cannot use `std::intrinsics::copy_nonoverlapping` as that is a wrapper function
|
||||
#[rustc_nounwind]
|
||||
fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
|
||||
}
|
||||
// Cannot use `std::intrinsics::copy_nonoverlapping` as that is a wrapper function
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
|
||||
|
||||
// EMIT_MIR lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff
|
||||
pub fn f_copy_nonoverlapping() {
|
||||
|
@ -2,9 +2,8 @@
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
|
@ -37,10 +37,9 @@ mod minicore {
|
||||
#[inline]
|
||||
#[rustc_diagnostic_item = "ptr_write_volatile"]
|
||||
pub unsafe fn write_volatile<T>(dst: *mut T, src: T) {
|
||||
extern "rust-intrinsic" {
|
||||
#[rustc_nounwind]
|
||||
pub fn volatile_store<T>(dst: *mut T, val: T);
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn volatile_store<T>(dst: *mut T, val: T);
|
||||
|
||||
unsafe { volatile_store(dst, src) };
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0703]: invalid ABI: found `rust-intrinsec`
|
||||
--> $DIR/abi-typo-unstable.rs:2:8
|
||||
error[E0703]: invalid ABI: found `rust-cull`
|
||||
--> $DIR/abi-typo-unstable.rs:5:8
|
||||
|
|
||||
LL | extern "rust-intrinsec" fn rust_intrinsic() {}
|
||||
| ^^^^^^^^^^^^^^^^ invalid ABI
|
||||
LL | extern "rust-cull" fn rust_call(_: ()) {}
|
||||
| ^^^^^^^^^^^ invalid ABI
|
||||
|
|
||||
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
|
||||
|
16
tests/ui/abi/abi-typo-unstable.feature_enabled.stderr
Normal file
16
tests/ui/abi/abi-typo-unstable.feature_enabled.stderr
Normal file
@ -0,0 +1,16 @@
|
||||
error[E0703]: invalid ABI: found `rust-cull`
|
||||
--> $DIR/abi-typo-unstable.rs:5:8
|
||||
|
|
||||
LL | extern "rust-cull" fn rust_call(_: ()) {}
|
||||
| ^^^^^^^^^^^ invalid ABI
|
||||
|
|
||||
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
|
||||
help: there's a similarly named valid ABI `rust-call`
|
||||
|
|
||||
LL - extern "rust-cull" fn rust_call(_: ()) {}
|
||||
LL + extern "rust-call" fn rust_call(_: ()) {}
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0703`.
|
@ -1,6 +1,11 @@
|
||||
// rust-intrinsic is unstable and not enabled, so it should not be suggested as a fix
|
||||
extern "rust-intrinsec" fn rust_intrinsic() {} //~ ERROR invalid ABI
|
||||
//@ revisions: feature_disabled feature_enabled
|
||||
#![cfg_attr(feature_enabled, feature(unboxed_closures))]
|
||||
|
||||
// rust-call is unstable and not enabled, so it should not be suggested as a fix
|
||||
extern "rust-cull" fn rust_call(_: ()) {}
|
||||
//~^ ERROR invalid ABI
|
||||
//[feature_enabled]~| HELP there's a similarly named valid ABI
|
||||
|
||||
fn main() {
|
||||
rust_intrinsic();
|
||||
rust_call(());
|
||||
}
|
||||
|
@ -10,24 +10,6 @@ LL - fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {}
|
||||
LL + fn get<T:Get,U:Get>(x: T, y: U) -> <Example as Get>::Value {}
|
||||
|
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/associated-types-in-ambiguous-context.rs:13:23
|
||||
|
|
||||
LL | fn grab(&self) -> Grab::Value;
|
||||
| ^^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Grab>::Value`
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/associated-types-in-ambiguous-context.rs:16:22
|
||||
|
|
||||
LL | fn get(&self) -> Get::Value;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path
|
||||
|
|
||||
LL - fn get(&self) -> Get::Value;
|
||||
LL + fn get(&self) -> <Example as Get>::Value;
|
||||
|
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/associated-types-in-ambiguous-context.rs:22:17
|
||||
|
|
||||
@ -56,6 +38,24 @@ LL + type X = <IoSlice<'_> as Deref>::Target;
|
||||
|
|
||||
and N other candidates
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/associated-types-in-ambiguous-context.rs:13:23
|
||||
|
|
||||
LL | fn grab(&self) -> Grab::Value;
|
||||
| ^^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Grab>::Value`
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/associated-types-in-ambiguous-context.rs:16:22
|
||||
|
|
||||
LL | fn get(&self) -> Get::Value;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path
|
||||
|
|
||||
LL - fn get(&self) -> Get::Value;
|
||||
LL + fn get(&self) -> <Example as Get>::Value;
|
||||
|
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0223`.
|
||||
|
@ -23,12 +23,6 @@ LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16;
|
||||
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
|
||||
= note: `#[warn(anonymous_parameters)]` on by default
|
||||
|
||||
error[E0220]: associated type `Assoc` not found for `Self`
|
||||
--> $DIR/ice-mutability-error-slicing-121807.rs:7:36
|
||||
|
|
||||
LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16;
|
||||
| ^^^^^ associated type `Assoc` not found
|
||||
|
||||
error[E0185]: method `read_dword` has a `&self` declaration in the impl, but not in the trait
|
||||
--> $DIR/ice-mutability-error-slicing-121807.rs:17:5
|
||||
|
|
||||
@ -47,6 +41,12 @@ LL | extern "C" fn read_word(&mut self) -> u8;
|
||||
LL | impl MemoryUnit for ROM {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ missing `read_word` in implementation
|
||||
|
||||
error[E0220]: associated type `Assoc` not found for `Self`
|
||||
--> $DIR/ice-mutability-error-slicing-121807.rs:7:36
|
||||
|
|
||||
LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16;
|
||||
| ^^^^^ associated type `Assoc` not found
|
||||
|
||||
error: aborting due to 4 previous errors; 1 warning emitted
|
||||
|
||||
Some errors have detailed explanations: E0046, E0185, E0220, E0261.
|
||||
|
@ -8,12 +8,6 @@ LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16;
|
||||
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
|
||||
= note: `#[warn(anonymous_parameters)]` on by default
|
||||
|
||||
error[E0220]: associated type `Assoc` not found for `Self`
|
||||
--> $DIR/trait-impl-argument-difference-ice.rs:4:36
|
||||
|
|
||||
LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16;
|
||||
| ^^^^^ associated type `Assoc` not found
|
||||
|
||||
error[E0185]: method `read_dword` has a `&self` declaration in the impl, but not in the trait
|
||||
--> $DIR/trait-impl-argument-difference-ice.rs:14:5
|
||||
|
|
||||
@ -32,6 +26,12 @@ LL | extern "C" fn read_word(&mut self) -> u8;
|
||||
LL | impl MemoryUnit for ROM {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ missing `read_word` in implementation
|
||||
|
||||
error[E0220]: associated type `Assoc` not found for `Self`
|
||||
--> $DIR/trait-impl-argument-difference-ice.rs:4:36
|
||||
|
|
||||
LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16;
|
||||
| ^^^^^ associated type `Assoc` not found
|
||||
|
||||
error[E0596]: cannot borrow `*self` as mutable, as it is behind a `&` reference
|
||||
--> $DIR/trait-impl-argument-difference-ice.rs:16:19
|
||||
|
|
||||
|
@ -4,7 +4,6 @@
|
||||
// FIXME(fn_delegation): `recursive delegation` error should be emitted here
|
||||
trait Trait {
|
||||
reuse Trait::foo { &self.0 }
|
||||
//~^ ERROR recursive delegation is not supported yet
|
||||
}
|
||||
|
||||
reuse foo;
|
||||
|
@ -1,23 +1,17 @@
|
||||
error: recursive delegation is not supported yet
|
||||
--> $DIR/ice-issue-124347.rs:6:18
|
||||
|
|
||||
LL | reuse Trait::foo { &self.0 }
|
||||
| ^^^ callee defined here
|
||||
|
||||
error[E0391]: cycle detected when computing generics of `foo`
|
||||
--> $DIR/ice-issue-124347.rs:10:7
|
||||
--> $DIR/ice-issue-124347.rs:9:7
|
||||
|
|
||||
LL | reuse foo;
|
||||
| ^^^
|
||||
|
|
||||
= note: ...which immediately requires computing generics of `foo` again
|
||||
note: cycle used when checking that `foo` is well-formed
|
||||
--> $DIR/ice-issue-124347.rs:10:7
|
||||
--> $DIR/ice-issue-124347.rs:9:7
|
||||
|
|
||||
LL | reuse foo;
|
||||
| ^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0391`.
|
||||
|
@ -187,166 +187,6 @@ help: consider using the `'static` lifetime, but this is uncommon unless you're
|
||||
LL | fn parrot() -> &'static mut Trait {
|
||||
| +++++++
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:52:16
|
||||
|
|
||||
LL | fn foo(_: &Trait);
|
||||
| ^^^^^
|
||||
|
|
||||
help: use a new generic type parameter, constrained by `Trait`
|
||||
|
|
||||
LL - fn foo(_: &Trait);
|
||||
LL + fn foo<T: Trait>(_: &T);
|
||||
|
|
||||
help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
|
||||
|
|
||||
LL | fn foo(_: &impl Trait);
|
||||
| ++++
|
||||
help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch
|
||||
|
|
||||
LL | fn foo(_: &dyn Trait);
|
||||
| +++
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:55:19
|
||||
|
|
||||
LL | fn bar(_: &'a Trait);
|
||||
| ^^^^^
|
||||
|
|
||||
help: use a new generic type parameter, constrained by `Trait`
|
||||
|
|
||||
LL - fn bar(_: &'a Trait);
|
||||
LL + fn bar<T: Trait>(_: &'a T);
|
||||
|
|
||||
help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
|
||||
|
|
||||
LL | fn bar(_: &'a impl Trait);
|
||||
| ++++
|
||||
help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch
|
||||
|
|
||||
LL | fn bar(_: &'a dyn Trait);
|
||||
| +++
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:59:22
|
||||
|
|
||||
LL | fn alice<'a>(_: &Trait);
|
||||
| ^^^^^
|
||||
|
|
||||
help: use a new generic type parameter, constrained by `Trait`
|
||||
|
|
||||
LL - fn alice<'a>(_: &Trait);
|
||||
LL + fn alice<'a, T: Trait>(_: &T);
|
||||
|
|
||||
help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
|
||||
|
|
||||
LL | fn alice<'a>(_: &impl Trait);
|
||||
| ++++
|
||||
help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch
|
||||
|
|
||||
LL | fn alice<'a>(_: &dyn Trait);
|
||||
| +++
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:62:23
|
||||
|
|
||||
LL | fn bob<'a>(_: &'a Trait);
|
||||
| ^^^^^
|
||||
|
|
||||
help: use a new generic type parameter, constrained by `Trait`
|
||||
|
|
||||
LL - fn bob<'a>(_: &'a Trait);
|
||||
LL + fn bob<'a, T: Trait>(_: &'a T);
|
||||
|
|
||||
help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
|
||||
|
|
||||
LL | fn bob<'a>(_: &'a impl Trait);
|
||||
| ++++
|
||||
help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch
|
||||
|
|
||||
LL | fn bob<'a>(_: &'a dyn Trait);
|
||||
| +++
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:65:18
|
||||
|
|
||||
LL | fn cat() -> &Trait;
|
||||
| ^^^^^
|
||||
|
|
||||
help: use `impl Trait` to return an opaque type, as long as you return a single underlying type
|
||||
|
|
||||
LL | fn cat() -> &impl Trait;
|
||||
| ++++
|
||||
help: alternatively, you can return an owned trait object
|
||||
|
|
||||
LL - fn cat() -> &Trait;
|
||||
LL + fn cat() -> Box<dyn Trait>;
|
||||
|
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:69:22
|
||||
|
|
||||
LL | fn dog<'a>() -> &Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
help: use `impl Trait` to return an opaque type, as long as you return a single underlying type
|
||||
|
|
||||
LL | fn dog<'a>() -> &impl Trait {
|
||||
| ++++
|
||||
help: alternatively, you can return an owned trait object
|
||||
|
|
||||
LL - fn dog<'a>() -> &Trait {
|
||||
LL + fn dog<'a>() -> Box<dyn Trait> {
|
||||
|
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:75:24
|
||||
|
|
||||
LL | fn kitten() -> &'a Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
help: use `impl Trait` to return an opaque type, as long as you return a single underlying type
|
||||
|
|
||||
LL | fn kitten() -> &'a impl Trait {
|
||||
| ++++
|
||||
help: alternatively, you can return an owned trait object
|
||||
|
|
||||
LL - fn kitten() -> &'a Trait {
|
||||
LL + fn kitten() -> Box<dyn Trait> {
|
||||
|
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:81:27
|
||||
|
|
||||
LL | fn puppy<'a>() -> &'a Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
help: use `impl Trait` to return an opaque type, as long as you return a single underlying type
|
||||
|
|
||||
LL | fn puppy<'a>() -> &'a impl Trait {
|
||||
| ++++
|
||||
help: alternatively, you can return an owned trait object
|
||||
|
|
||||
LL - fn puppy<'a>() -> &'a Trait {
|
||||
LL + fn puppy<'a>() -> Box<dyn Trait> {
|
||||
|
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:86:25
|
||||
|
|
||||
LL | fn parrot() -> &mut Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
help: use `impl Trait` to return an opaque type, as long as you return a single underlying type
|
||||
|
|
||||
LL | fn parrot() -> &mut impl Trait {
|
||||
| ++++
|
||||
help: alternatively, you can return an owned trait object
|
||||
|
|
||||
LL - fn parrot() -> &mut Trait {
|
||||
LL + fn parrot() -> Box<dyn Trait> {
|
||||
|
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:93:12
|
||||
|
|
||||
@ -667,6 +507,166 @@ LL - fn parrot() -> &mut Trait {
|
||||
LL + fn parrot() -> Box<dyn Trait> {
|
||||
|
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:52:16
|
||||
|
|
||||
LL | fn foo(_: &Trait);
|
||||
| ^^^^^
|
||||
|
|
||||
help: use a new generic type parameter, constrained by `Trait`
|
||||
|
|
||||
LL - fn foo(_: &Trait);
|
||||
LL + fn foo<T: Trait>(_: &T);
|
||||
|
|
||||
help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
|
||||
|
|
||||
LL | fn foo(_: &impl Trait);
|
||||
| ++++
|
||||
help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch
|
||||
|
|
||||
LL | fn foo(_: &dyn Trait);
|
||||
| +++
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:55:19
|
||||
|
|
||||
LL | fn bar(_: &'a Trait);
|
||||
| ^^^^^
|
||||
|
|
||||
help: use a new generic type parameter, constrained by `Trait`
|
||||
|
|
||||
LL - fn bar(_: &'a Trait);
|
||||
LL + fn bar<T: Trait>(_: &'a T);
|
||||
|
|
||||
help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
|
||||
|
|
||||
LL | fn bar(_: &'a impl Trait);
|
||||
| ++++
|
||||
help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch
|
||||
|
|
||||
LL | fn bar(_: &'a dyn Trait);
|
||||
| +++
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:59:22
|
||||
|
|
||||
LL | fn alice<'a>(_: &Trait);
|
||||
| ^^^^^
|
||||
|
|
||||
help: use a new generic type parameter, constrained by `Trait`
|
||||
|
|
||||
LL - fn alice<'a>(_: &Trait);
|
||||
LL + fn alice<'a, T: Trait>(_: &T);
|
||||
|
|
||||
help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
|
||||
|
|
||||
LL | fn alice<'a>(_: &impl Trait);
|
||||
| ++++
|
||||
help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch
|
||||
|
|
||||
LL | fn alice<'a>(_: &dyn Trait);
|
||||
| +++
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:62:23
|
||||
|
|
||||
LL | fn bob<'a>(_: &'a Trait);
|
||||
| ^^^^^
|
||||
|
|
||||
help: use a new generic type parameter, constrained by `Trait`
|
||||
|
|
||||
LL - fn bob<'a>(_: &'a Trait);
|
||||
LL + fn bob<'a, T: Trait>(_: &'a T);
|
||||
|
|
||||
help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
|
||||
|
|
||||
LL | fn bob<'a>(_: &'a impl Trait);
|
||||
| ++++
|
||||
help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch
|
||||
|
|
||||
LL | fn bob<'a>(_: &'a dyn Trait);
|
||||
| +++
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:65:18
|
||||
|
|
||||
LL | fn cat() -> &Trait;
|
||||
| ^^^^^
|
||||
|
|
||||
help: use `impl Trait` to return an opaque type, as long as you return a single underlying type
|
||||
|
|
||||
LL | fn cat() -> &impl Trait;
|
||||
| ++++
|
||||
help: alternatively, you can return an owned trait object
|
||||
|
|
||||
LL - fn cat() -> &Trait;
|
||||
LL + fn cat() -> Box<dyn Trait>;
|
||||
|
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:69:22
|
||||
|
|
||||
LL | fn dog<'a>() -> &Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
help: use `impl Trait` to return an opaque type, as long as you return a single underlying type
|
||||
|
|
||||
LL | fn dog<'a>() -> &impl Trait {
|
||||
| ++++
|
||||
help: alternatively, you can return an owned trait object
|
||||
|
|
||||
LL - fn dog<'a>() -> &Trait {
|
||||
LL + fn dog<'a>() -> Box<dyn Trait> {
|
||||
|
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:75:24
|
||||
|
|
||||
LL | fn kitten() -> &'a Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
help: use `impl Trait` to return an opaque type, as long as you return a single underlying type
|
||||
|
|
||||
LL | fn kitten() -> &'a impl Trait {
|
||||
| ++++
|
||||
help: alternatively, you can return an owned trait object
|
||||
|
|
||||
LL - fn kitten() -> &'a Trait {
|
||||
LL + fn kitten() -> Box<dyn Trait> {
|
||||
|
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:81:27
|
||||
|
|
||||
LL | fn puppy<'a>() -> &'a Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
help: use `impl Trait` to return an opaque type, as long as you return a single underlying type
|
||||
|
|
||||
LL | fn puppy<'a>() -> &'a impl Trait {
|
||||
| ++++
|
||||
help: alternatively, you can return an owned trait object
|
||||
|
|
||||
LL - fn puppy<'a>() -> &'a Trait {
|
||||
LL + fn puppy<'a>() -> Box<dyn Trait> {
|
||||
|
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:86:25
|
||||
|
|
||||
LL | fn parrot() -> &mut Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
help: use `impl Trait` to return an opaque type, as long as you return a single underlying type
|
||||
|
|
||||
LL | fn parrot() -> &mut impl Trait {
|
||||
| ++++
|
||||
help: alternatively, you can return an owned trait object
|
||||
|
|
||||
LL - fn parrot() -> &mut Trait {
|
||||
LL + fn parrot() -> Box<dyn Trait> {
|
||||
|
|
||||
|
||||
error: aborting due to 42 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0106, E0261, E0782.
|
||||
|
@ -1,7 +1,6 @@
|
||||
#![feature(intrinsics)]
|
||||
extern "rust-intrinsic" {
|
||||
fn atomic_foo(); //~ ERROR E0092
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn atomic_foo(); //~ ERROR E0092
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0092]: unrecognized atomic operation function: `foo`
|
||||
--> $DIR/E0092.rs:3:5
|
||||
--> $DIR/E0092.rs:4:11
|
||||
|
|
||||
LL | fn atomic_foo();
|
||||
| ^^^^^^^^^^^^^^^^ unrecognized atomic operation
|
||||
LL | unsafe fn atomic_foo();
|
||||
| ^^^^^^^^^^ unrecognized atomic operation
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
#![feature(intrinsics)]
|
||||
extern "rust-intrinsic" {
|
||||
fn foo();
|
||||
//~^ ERROR E0093
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn foo();
|
||||
//~^ ERROR E0093
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0093]: unrecognized intrinsic function: `foo`
|
||||
--> $DIR/E0093.rs:3:5
|
||||
--> $DIR/E0093.rs:4:11
|
||||
|
|
||||
LL | fn foo();
|
||||
| ^^^^^^^^^ unrecognized intrinsic
|
||||
LL | unsafe fn foo();
|
||||
| ^^^ unrecognized intrinsic
|
||||
|
|
||||
= help: if you're adding an intrinsic, be sure to update `check_intrinsic_type`
|
||||
|
||||
|
@ -1,6 +1,14 @@
|
||||
#![feature(intrinsics)]
|
||||
extern "rust-intrinsic" {
|
||||
pub static atomic_singlethreadfence_seqcst : unsafe extern "rust-intrinsic" fn();
|
||||
|
||||
extern "C" {
|
||||
|
||||
#[rustc_intrinsic]
|
||||
pub static atomic_singlethreadfence_seqcst: unsafe extern "C" fn();
|
||||
//~^ ERROR intrinsic must be a function [E0622]
|
||||
}
|
||||
fn main() { unsafe { atomic_singlethreadfence_seqcst(); } }
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
atomic_singlethreadfence_seqcst();
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0622]: intrinsic must be a function
|
||||
--> $DIR/E0622.rs:3:5
|
||||
--> $DIR/E0622.rs:6:5
|
||||
|
|
||||
LL | pub static atomic_singlethreadfence_seqcst : unsafe extern "rust-intrinsic" fn();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected a function
|
||||
LL | pub static atomic_singlethreadfence_seqcst: unsafe extern "C" fn();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected a function
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
21
tests/ui/extern/extern-with-type-bounds.rs
vendored
21
tests/ui/extern/extern-with-type-bounds.rs
vendored
@ -1,21 +0,0 @@
|
||||
#![feature(intrinsics, rustc_attrs)]
|
||||
|
||||
// Intrinsics are the only (?) extern blocks supporting generics.
|
||||
// Once intrinsics have to be declared via `#[rustc_intrinsic]`,
|
||||
// the entire support for generics in extern fn can probably be removed.
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
// Silent bounds made explicit to make sure they are actually
|
||||
// resolved.
|
||||
fn transmute<T: Sized, U: Sized>(val: T) -> U;
|
||||
|
||||
// Bounds aren't checked right now, so this should work
|
||||
// even though it's incorrect.
|
||||
fn size_of_val<T: Clone>(x: *const T) -> usize;
|
||||
|
||||
// Unresolved bounds should still error.
|
||||
fn align_of<T: NoSuchTrait>() -> usize;
|
||||
//~^ ERROR cannot find trait `NoSuchTrait` in this scope
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -1,9 +0,0 @@
|
||||
error[E0405]: cannot find trait `NoSuchTrait` in this scope
|
||||
--> $DIR/extern-with-type-bounds.rs:17:20
|
||||
|
|
||||
LL | fn align_of<T: NoSuchTrait>() -> usize;
|
||||
| ^^^^^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0405`.
|
@ -8,19 +8,10 @@
|
||||
extern crate minicore;
|
||||
use minicore::*;
|
||||
|
||||
// Functions
|
||||
extern "rust-intrinsic" fn f1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail
|
||||
//~^ ERROR intrinsic must be in
|
||||
extern "rust-intrinsic" fn f2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail
|
||||
//~^ ERROR intrinsic must be in
|
||||
extern "rust-call" fn f4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change
|
||||
|
||||
// Methods in trait definition
|
||||
trait Tr {
|
||||
extern "rust-intrinsic" fn m1(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail
|
||||
//~^ ERROR intrinsic must be in
|
||||
extern "rust-intrinsic" fn m2(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail
|
||||
//~^ ERROR intrinsic must be in
|
||||
extern "rust-call" fn m4(_: ()); //~ ERROR extern "rust-call" ABI is experimental and subject to change
|
||||
|
||||
extern "rust-call" fn dm4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change
|
||||
@ -30,28 +21,16 @@ struct S;
|
||||
|
||||
// Methods in trait impl
|
||||
impl Tr for S {
|
||||
extern "rust-intrinsic" fn m1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail
|
||||
//~^ ERROR intrinsic must be in
|
||||
extern "rust-intrinsic" fn m2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail
|
||||
//~^ ERROR intrinsic must be in
|
||||
extern "rust-call" fn m4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change
|
||||
}
|
||||
|
||||
// Methods in inherent impl
|
||||
impl S {
|
||||
extern "rust-intrinsic" fn im1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail
|
||||
//~^ ERROR intrinsic must be in
|
||||
extern "rust-intrinsic" fn im2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail
|
||||
//~^ ERROR intrinsic must be in
|
||||
extern "rust-call" fn im4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change
|
||||
}
|
||||
|
||||
// Function pointer types
|
||||
type A1 = extern "rust-intrinsic" fn(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail
|
||||
type A2 = extern "rust-intrinsic" fn(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail
|
||||
type A4 = extern "rust-call" fn(_: ()); //~ ERROR extern "rust-call" ABI is experimental and subject to change
|
||||
|
||||
// Foreign modules
|
||||
extern "rust-intrinsic" {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail
|
||||
extern "rust-intrinsic" {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail
|
||||
extern "rust-call" {} //~ ERROR extern "rust-call" ABI is experimental and subject to change
|
||||
|
@ -1,23 +1,5 @@
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-abi.rs:12:8
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn f1() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-abi.rs:14:8
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn f2() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-call" ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-abi.rs:16:8
|
||||
--> $DIR/feature-gate-abi.rs:11:8
|
||||
|
|
||||
LL | extern "rust-call" fn f4(_: ()) {}
|
||||
| ^^^^^^^^^^^
|
||||
@ -26,26 +8,8 @@ LL | extern "rust-call" fn f4(_: ()) {}
|
||||
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-abi.rs:20:12
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn m1();
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-abi.rs:22:12
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn m2();
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-call" ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-abi.rs:24:12
|
||||
--> $DIR/feature-gate-abi.rs:15:12
|
||||
|
|
||||
LL | extern "rust-call" fn m4(_: ());
|
||||
| ^^^^^^^^^^^
|
||||
@ -55,7 +19,7 @@ LL | extern "rust-call" fn m4(_: ());
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-call" ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-abi.rs:26:12
|
||||
--> $DIR/feature-gate-abi.rs:17:12
|
||||
|
|
||||
LL | extern "rust-call" fn dm4(_: ()) {}
|
||||
| ^^^^^^^^^^^
|
||||
@ -64,26 +28,8 @@ LL | extern "rust-call" fn dm4(_: ()) {}
|
||||
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-abi.rs:33:12
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn m1() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-abi.rs:35:12
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn m2() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-call" ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-abi.rs:37:12
|
||||
--> $DIR/feature-gate-abi.rs:24:12
|
||||
|
|
||||
LL | extern "rust-call" fn m4(_: ()) {}
|
||||
| ^^^^^^^^^^^
|
||||
@ -92,26 +38,8 @@ LL | extern "rust-call" fn m4(_: ()) {}
|
||||
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-abi.rs:42:12
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn im1() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-abi.rs:44:12
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn im2() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-call" ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-abi.rs:46:12
|
||||
--> $DIR/feature-gate-abi.rs:29:12
|
||||
|
|
||||
LL | extern "rust-call" fn im4(_: ()) {}
|
||||
| ^^^^^^^^^^^
|
||||
@ -120,26 +48,8 @@ LL | extern "rust-call" fn im4(_: ()) {}
|
||||
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-abi.rs:50:18
|
||||
|
|
||||
LL | type A1 = extern "rust-intrinsic" fn();
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-abi.rs:51:18
|
||||
|
|
||||
LL | type A2 = extern "rust-intrinsic" fn();
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-call" ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-abi.rs:52:18
|
||||
--> $DIR/feature-gate-abi.rs:33:18
|
||||
|
|
||||
LL | type A4 = extern "rust-call" fn(_: ());
|
||||
| ^^^^^^^^^^^
|
||||
@ -148,26 +58,8 @@ LL | type A4 = extern "rust-call" fn(_: ());
|
||||
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-abi.rs:55:8
|
||||
|
|
||||
LL | extern "rust-intrinsic" {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-abi.rs:56:8
|
||||
|
|
||||
LL | extern "rust-intrinsic" {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-call" ABI is experimental and subject to change
|
||||
--> $DIR/feature-gate-abi.rs:57:8
|
||||
--> $DIR/feature-gate-abi.rs:36:8
|
||||
|
|
||||
LL | extern "rust-call" {}
|
||||
| ^^^^^^^^^^^
|
||||
@ -176,54 +68,6 @@ LL | extern "rust-call" {}
|
||||
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/feature-gate-abi.rs:20:32
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn m1();
|
||||
| ^^
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/feature-gate-abi.rs:22:32
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn m2();
|
||||
| ^^
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/feature-gate-abi.rs:12:33
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn f1() {}
|
||||
| ^^
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/feature-gate-abi.rs:14:33
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn f2() {}
|
||||
| ^^
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/feature-gate-abi.rs:33:37
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn m1() {}
|
||||
| ^^
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/feature-gate-abi.rs:35:37
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn m2() {}
|
||||
| ^^
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/feature-gate-abi.rs:42:38
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn im1() {}
|
||||
| ^^
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/feature-gate-abi.rs:44:38
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn im2() {}
|
||||
| ^^
|
||||
|
||||
error: aborting due to 27 previous errors
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
@ -1,8 +1,5 @@
|
||||
extern "rust-intrinsic" { //~ ERROR "rust-intrinsic" ABI is an implementation detail
|
||||
fn bar(); //~ ERROR unrecognized intrinsic function: `bar`
|
||||
}
|
||||
|
||||
extern "rust-intrinsic" fn baz() {} //~ ERROR "rust-intrinsic" ABI is an implementation detail
|
||||
//~^ ERROR intrinsic must be in
|
||||
#[rustc_intrinsic]
|
||||
//~^ ERROR the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
|
||||
fn bar();
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,36 +1,12 @@
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-intrinsics.rs:1:8
|
||||
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
|
||||
--> $DIR/feature-gate-intrinsics.rs:1:1
|
||||
|
|
||||
LL | extern "rust-intrinsic" {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
LL | #[rustc_intrinsic]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gate-intrinsics.rs:5:8
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn baz() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
error[E0093]: unrecognized intrinsic function: `bar`
|
||||
--> $DIR/feature-gate-intrinsics.rs:2:5
|
||||
|
|
||||
LL | fn bar();
|
||||
| ^^^^^^^^^ unrecognized intrinsic
|
||||
|
|
||||
= help: if you're adding an intrinsic, be sure to update `check_intrinsic_type`
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/feature-gate-intrinsics.rs:5:34
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn baz() {}
|
||||
| ^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0093, E0658.
|
||||
For more information about an error, try `rustc --explain E0093`.
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
@ -5,9 +5,9 @@
|
||||
fn main() {
|
||||
let a = &[1, 2, 3];
|
||||
println!("{}", {
|
||||
extern "rust-intrinsic" { //~ ERROR "rust-intrinsic" ABI is an implementation detail
|
||||
fn atomic_fence();
|
||||
}
|
||||
#[rustc_intrinsic] //~ ERROR the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
|
||||
unsafe fn atomic_fence();
|
||||
|
||||
atomic_fence(); //~ ERROR: is unsafe
|
||||
42
|
||||
});
|
||||
|
@ -1,13 +1,13 @@
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/feature-gated-feature-in-macro-arg.rs:8:16
|
||||
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
|
||||
--> $DIR/feature-gated-feature-in-macro-arg.rs:8:9
|
||||
|
|
||||
LL | extern "rust-intrinsic" {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
LL | #[rustc_intrinsic]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0133]: call to unsafe function `main::atomic_fence` is unsafe and requires unsafe function or block
|
||||
error[E0133]: call to unsafe function `atomic_fence` is unsafe and requires unsafe function or block
|
||||
--> $DIR/feature-gated-feature-in-macro-arg.rs:11:9
|
||||
|
|
||||
LL | atomic_fence();
|
||||
|
@ -1,17 +0,0 @@
|
||||
#![feature(intrinsics)]
|
||||
|
||||
trait Foo {
|
||||
extern "rust-intrinsic" fn foo(&self); //~ ERROR intrinsic must
|
||||
}
|
||||
|
||||
impl Foo for () {
|
||||
extern "rust-intrinsic" fn foo(&self) { //~ ERROR intrinsic must
|
||||
}
|
||||
}
|
||||
|
||||
extern "rust-intrinsic" fn hello() {//~ ERROR intrinsic must
|
||||
//~^ ERROR unrecognized intrinsic function: `hello`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/always-extern.rs:4:32
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn foo(&self);
|
||||
| ^^^
|
||||
|
||||
error[E0093]: unrecognized intrinsic function: `hello`
|
||||
--> $DIR/always-extern.rs:12:28
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn hello() {
|
||||
| ^^^^^ unrecognized intrinsic
|
||||
|
|
||||
= help: if you're adding an intrinsic, be sure to update `check_intrinsic_type`
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/always-extern.rs:8:43
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn foo(&self) {
|
||||
| ___________________________________________^
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/always-extern.rs:12:36
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn hello() {
|
||||
| ____________________________________^
|
||||
LL | |
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0093`.
|
@ -1,14 +1,11 @@
|
||||
#![feature(intrinsics)]
|
||||
|
||||
pub mod rusti {
|
||||
extern "rust-intrinsic" {
|
||||
pub fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn atomic_xchg_seqcst(dst: *mut isize, src: isize) -> isize {
|
||||
unsafe {
|
||||
rusti::atomic_xchg_seqcst(dst, src)
|
||||
}
|
||||
unsafe { rusti::atomic_xchg_seqcst(dst, src) }
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
fn main() {
|
||||
read_via_copy();
|
||||
//~^ ERROR call to unsafe function `read_via_copy` is unsafe and requires unsafe function or block
|
||||
}
|
||||
|
||||
extern "rust-intrinsic" fn read_via_copy() {}
|
||||
//~^ ERROR "rust-intrinsic" ABI is an implementation detail
|
||||
//~| ERROR intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
#[rustc_intrinsic]
|
||||
//~^ ERROR the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
|
||||
unsafe fn read_via_copy() {}
|
||||
|
@ -1,18 +1,21 @@
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/incorrect-read_via_copy-defn.rs:5:8
|
||||
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
|
||||
--> $DIR/incorrect-read_via_copy-defn.rs:6:1
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn read_via_copy() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
LL | #[rustc_intrinsic]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/incorrect-read_via_copy-defn.rs:5:44
|
||||
error[E0133]: call to unsafe function `read_via_copy` is unsafe and requires unsafe function or block
|
||||
--> $DIR/incorrect-read_via_copy-defn.rs:2:5
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn read_via_copy() {}
|
||||
| ^^
|
||||
LL | read_via_copy();
|
||||
| ^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
Some errors have detailed explanations: E0133, E0658.
|
||||
For more information about an error, try `rustc --explain E0133`.
|
||||
|
@ -1,7 +1,8 @@
|
||||
fn main() {
|
||||
transmute(); // does not ICE
|
||||
//~^ ERROR call to unsafe function `transmute` is unsafe and requires unsafe function or block
|
||||
}
|
||||
|
||||
extern "rust-intrinsic" fn transmute() {}
|
||||
//~^ ERROR "rust-intrinsic" ABI is an implementation detail
|
||||
//~| ERROR intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
#[rustc_intrinsic]
|
||||
//~^ ERROR the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
|
||||
unsafe fn transmute() {}
|
||||
|
@ -1,18 +1,21 @@
|
||||
error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable
|
||||
--> $DIR/incorrect-transmute.rs:5:8
|
||||
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items
|
||||
--> $DIR/incorrect-transmute.rs:6:1
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn transmute() {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
LL | #[rustc_intrinsic]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block
|
||||
--> $DIR/incorrect-transmute.rs:5:40
|
||||
error[E0133]: call to unsafe function `transmute` is unsafe and requires unsafe function or block
|
||||
--> $DIR/incorrect-transmute.rs:2:5
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn transmute() {}
|
||||
| ^^
|
||||
LL | transmute(); // does not ICE
|
||||
| ^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
Some errors have detailed explanations: E0133, E0658.
|
||||
For more information about an error, try `rustc --explain E0133`.
|
||||
|
@ -2,33 +2,51 @@
|
||||
#![feature(intrinsics)]
|
||||
|
||||
mod rusti {
|
||||
extern "rust-intrinsic" {
|
||||
pub fn atomic_cxchg_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
|
||||
pub fn atomic_cxchgweak_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_cxchg_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_cxchg_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_cxchg_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
|
||||
pub fn atomic_load_seqcst<T>(src: *const T) -> T;
|
||||
pub fn atomic_load_acquire<T>(src: *const T) -> T;
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_cxchgweak_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_cxchgweak_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_cxchgweak_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
|
||||
pub fn atomic_store_seqcst<T>(dst: *mut T, val: T);
|
||||
pub fn atomic_store_release<T>(dst: *mut T, val: T);
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_load_seqcst<T>(src: *const T) -> T;
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_load_acquire<T>(src: *const T) -> T;
|
||||
|
||||
pub fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_acquire<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_release<T>(dst: *mut T, src: T) -> T;
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_store_seqcst<T>(dst: *mut T, val: T);
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_store_release<T>(dst: *mut T, val: T);
|
||||
|
||||
pub fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_acquire<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_release<T>(dst: *mut T, src: T) -> T;
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_xchg_acquire<T>(dst: *mut T, src: T) -> T;
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_xchg_release<T>(dst: *mut T, src: T) -> T;
|
||||
|
||||
pub fn atomic_xsub_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_acquire<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_release<T>(dst: *mut T, src: T) -> T;
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_xadd_acquire<T>(dst: *mut T, src: T) -> T;
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_xadd_release<T>(dst: *mut T, src: T) -> T;
|
||||
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_xsub_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_xsub_acquire<T>(dst: *mut T, src: T) -> T;
|
||||
#[rustc_intrinsic]
|
||||
pub unsafe fn atomic_xsub_release<T>(dst: *mut T, src: T) -> T;
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
@ -39,9 +57,9 @@ pub fn main() {
|
||||
*x = 5;
|
||||
assert_eq!(rusti::atomic_load_acquire(&*x), 5);
|
||||
|
||||
rusti::atomic_store_seqcst(&mut *x,3);
|
||||
rusti::atomic_store_seqcst(&mut *x, 3);
|
||||
assert_eq!(*x, 3);
|
||||
rusti::atomic_store_release(&mut *x,1);
|
||||
rusti::atomic_store_release(&mut *x, 1);
|
||||
assert_eq!(*x, 1);
|
||||
|
||||
assert_eq!(rusti::atomic_cxchg_seqcst_seqcst(&mut *x, 1, 2), (1, true));
|
||||
|
19
tests/ui/intrinsics/invalid-ABI-rust-intrinsic.rs
Normal file
19
tests/ui/intrinsics/invalid-ABI-rust-intrinsic.rs
Normal file
@ -0,0 +1,19 @@
|
||||
#![feature(intrinsics)]
|
||||
|
||||
trait Foo {
|
||||
extern "rust-intrinsic" fn foo(&self); //~ ERROR invalid ABI
|
||||
}
|
||||
|
||||
impl Foo for () {
|
||||
extern "rust-intrinsic" fn foo(&self) { //~ ERROR invalid ABI
|
||||
}
|
||||
}
|
||||
|
||||
extern "rust-intrinsic" fn hello() { //~ ERROR invalid ABI
|
||||
}
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
//~^ ERROR invalid ABI
|
||||
}
|
||||
|
||||
fn main() {}
|
35
tests/ui/intrinsics/invalid-ABI-rust-intrinsic.stderr
Normal file
35
tests/ui/intrinsics/invalid-ABI-rust-intrinsic.stderr
Normal file
@ -0,0 +1,35 @@
|
||||
error[E0703]: invalid ABI: found `rust-intrinsic`
|
||||
--> $DIR/invalid-ABI-rust-intrinsic.rs:4:12
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn foo(&self);
|
||||
| ^^^^^^^^^^^^^^^^ invalid ABI
|
||||
|
|
||||
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
|
||||
|
||||
error[E0703]: invalid ABI: found `rust-intrinsic`
|
||||
--> $DIR/invalid-ABI-rust-intrinsic.rs:8:12
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn foo(&self) {
|
||||
| ^^^^^^^^^^^^^^^^ invalid ABI
|
||||
|
|
||||
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
|
||||
|
||||
error[E0703]: invalid ABI: found `rust-intrinsic`
|
||||
--> $DIR/invalid-ABI-rust-intrinsic.rs:12:8
|
||||
|
|
||||
LL | extern "rust-intrinsic" fn hello() {
|
||||
| ^^^^^^^^^^^^^^^^ invalid ABI
|
||||
|
|
||||
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
|
||||
|
||||
error[E0703]: invalid ABI: found `rust-intrinsic`
|
||||
--> $DIR/invalid-ABI-rust-intrinsic.rs:15:8
|
||||
|
|
||||
LL | extern "rust-intrinsic" {
|
||||
| ^^^^^^^^^^^^^^^^ invalid ABI
|
||||
|
|
||||
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0703`.
|
@ -2,6 +2,7 @@
|
||||
|
||||
extern "C" {
|
||||
pub static FOO: extern "rust-intrinsic" fn();
|
||||
//~^ ERROR invalid ABI
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -1,11 +1,20 @@
|
||||
error[E0703]: invalid ABI: found `rust-intrinsic`
|
||||
--> $DIR/issue-28575.rs:4:28
|
||||
|
|
||||
LL | pub static FOO: extern "rust-intrinsic" fn();
|
||||
| ^^^^^^^^^^^^^^^^ invalid ABI
|
||||
|
|
||||
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
|
||||
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-28575.rs:8:5
|
||||
--> $DIR/issue-28575.rs:9:5
|
||||
|
|
||||
LL | FOO()
|
||||
| ^^^ use of extern static
|
||||
|
|
||||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
Some errors have detailed explanations: E0133, E0703.
|
||||
For more information about an error, try `rustc --explain E0133`.
|
||||
|
@ -1,13 +1,14 @@
|
||||
#![feature(intrinsics)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn size_of<T>() -> usize; //~ ERROR intrinsic safety mismatch
|
||||
//~^ ERROR intrinsic safety mismatch
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn size_of<T>() -> usize;
|
||||
//~^ ERROR intrinsic safety mismatch
|
||||
//~| ERROR intrinsic has wrong type
|
||||
|
||||
#[rustc_intrinsic]
|
||||
const fn assume(_b: bool) {} //~ ERROR intrinsic safety mismatch
|
||||
const fn assume(_b: bool) {}
|
||||
//~^ ERROR intrinsic safety mismatch
|
||||
//~| ERROR intrinsic has wrong type
|
||||
|
||||
#[rustc_intrinsic]
|
||||
|
@ -1,16 +1,17 @@
|
||||
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of`
|
||||
--> $DIR/safe-intrinsic-mismatch.rs:5:5
|
||||
--> $DIR/safe-intrinsic-mismatch.rs:5:1
|
||||
|
|
||||
LL | fn size_of<T>() -> usize;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | unsafe fn size_of<T>() -> usize;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of`
|
||||
--> $DIR/safe-intrinsic-mismatch.rs:5:5
|
||||
error[E0308]: intrinsic has wrong type
|
||||
--> $DIR/safe-intrinsic-mismatch.rs:5:18
|
||||
|
|
||||
LL | fn size_of<T>() -> usize;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | unsafe fn size_of<T>() -> usize;
|
||||
| ^^^ expected safe fn, found unsafe fn
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
= note: expected signature `fn() -> _`
|
||||
found signature `unsafe fn() -> _`
|
||||
|
||||
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `assume`
|
||||
--> $DIR/safe-intrinsic-mismatch.rs:10:1
|
||||
@ -28,13 +29,13 @@ LL | const fn assume(_b: bool) {}
|
||||
found signature `fn(_)`
|
||||
|
||||
error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `const_deallocate`
|
||||
--> $DIR/safe-intrinsic-mismatch.rs:14:1
|
||||
--> $DIR/safe-intrinsic-mismatch.rs:15:1
|
||||
|
|
||||
LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0308]: intrinsic has wrong type
|
||||
--> $DIR/safe-intrinsic-mismatch.rs:14:26
|
||||
--> $DIR/safe-intrinsic-mismatch.rs:15:26
|
||||
|
|
||||
LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
|
||||
| ^ expected unsafe fn, found safe fn
|
||||
|
@ -4,8 +4,7 @@
|
||||
//~^ ERROR: internal
|
||||
//~| ERROR: internal
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
|
||||
}
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
|
||||
|
||||
fn main() {}
|
||||
|
@ -19,7 +19,6 @@ riscv-interrupt-m
|
||||
riscv-interrupt-s
|
||||
rust-call
|
||||
rust-cold
|
||||
rust-intrinsic
|
||||
stdcall
|
||||
stdcall-unwind
|
||||
system
|
||||
|
@ -26,6 +26,20 @@ help: `A` is dyn-incompatible, use `impl A` to return an opaque type, as long as
|
||||
LL | fn f(a: A) -> impl A;
|
||||
| ++++
|
||||
|
||||
error: associated item referring to unboxed trait object for its own trait
|
||||
--> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:4:13
|
||||
|
|
||||
LL | trait A: Sized {
|
||||
| - in this trait
|
||||
LL | fn f(a: A) -> A;
|
||||
| ^ ^
|
||||
|
|
||||
help: you might have meant to use `Self` to refer to the implementing type
|
||||
|
|
||||
LL - fn f(a: A) -> A;
|
||||
LL + fn f(a: Self) -> Self;
|
||||
|
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13
|
||||
|
|
||||
@ -54,6 +68,20 @@ help: `B` is dyn-incompatible, use `impl B` to return an opaque type, as long as
|
||||
LL | fn f(b: B) -> impl B;
|
||||
| ++++
|
||||
|
||||
error: associated item referring to unboxed trait object for its own trait
|
||||
--> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13
|
||||
|
|
||||
LL | trait B {
|
||||
| - in this trait
|
||||
LL | fn f(b: B) -> B;
|
||||
| ^ ^
|
||||
|
|
||||
help: you might have meant to use `Self` to refer to the implementing type
|
||||
|
|
||||
LL - fn f(b: B) -> B;
|
||||
LL + fn f(b: Self) -> Self;
|
||||
|
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:16:20
|
||||
|
|
||||
@ -82,34 +110,6 @@ help: `C` is dyn-incompatible, use `impl C` to return an opaque type, as long as
|
||||
LL | fn f(&self, c: C) -> impl C;
|
||||
| ++++
|
||||
|
||||
error: associated item referring to unboxed trait object for its own trait
|
||||
--> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:4:13
|
||||
|
|
||||
LL | trait A: Sized {
|
||||
| - in this trait
|
||||
LL | fn f(a: A) -> A;
|
||||
| ^ ^
|
||||
|
|
||||
help: you might have meant to use `Self` to refer to the implementing type
|
||||
|
|
||||
LL - fn f(a: A) -> A;
|
||||
LL + fn f(a: Self) -> Self;
|
||||
|
|
||||
|
||||
error: associated item referring to unboxed trait object for its own trait
|
||||
--> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13
|
||||
|
|
||||
LL | trait B {
|
||||
| - in this trait
|
||||
LL | fn f(b: B) -> B;
|
||||
| ^ ^
|
||||
|
|
||||
help: you might have meant to use `Self` to refer to the implementing type
|
||||
|
|
||||
LL - fn f(b: B) -> B;
|
||||
LL + fn f(b: Self) -> Self;
|
||||
|
|
||||
|
||||
error: associated item referring to unboxed trait object for its own trait
|
||||
--> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:16:20
|
||||
|
|
||||
|
@ -12,19 +12,6 @@ help: if this is a dyn-compatible trait, use `dyn`
|
||||
LL | fn foo() -> dyn Clone;
|
||||
| +++
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/issue-116434-2015.rs:18:20
|
||||
|
|
||||
LL | fn handle() -> DbHandle;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
|
||||
help: if this is a dyn-compatible trait, use `dyn`
|
||||
|
|
||||
LL | fn handle() -> dyn DbHandle;
|
||||
| +++
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/issue-116434-2015.rs:3:17
|
||||
|
|
||||
@ -53,6 +40,19 @@ help: there is an associated type with the same name
|
||||
LL | fn foo() -> Self::Clone;
|
||||
| ++++++
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/issue-116434-2015.rs:18:20
|
||||
|
|
||||
LL | fn handle() -> DbHandle;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
|
||||
help: if this is a dyn-compatible trait, use `dyn`
|
||||
|
|
||||
LL | fn handle() -> dyn DbHandle;
|
||||
| +++
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/issue-116434-2015.rs:18:20
|
||||
|
|
||||
|
@ -439,6 +439,18 @@ LL | fn fn_test13(x: _) -> (i32, _) { (x, x) }
|
||||
| | not allowed in type signatures
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:154:21
|
||||
|
|
||||
LL | struct BadStruct<_>(_);
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL - struct BadStruct<_>(_);
|
||||
LL + struct BadStruct<T>(T);
|
||||
|
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/typeck_type_placeholder_item.rs:140:31
|
||||
|
|
||||
@ -515,18 +527,6 @@ LL - fn assoc_fn_test3() -> _;
|
||||
LL + fn assoc_fn_test3<T>() -> T;
|
||||
|
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
|
||||
--> $DIR/typeck_type_placeholder_item.rs:154:21
|
||||
|
|
||||
LL | struct BadStruct<_>(_);
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL - struct BadStruct<_>(_);
|
||||
LL + struct BadStruct<T>(T);
|
||||
|
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for implementations
|
||||
--> $DIR/typeck_type_placeholder_item.rs:159:15
|
||||
|
|
||||
|
@ -53,6 +53,12 @@ LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||
|
||||
error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:12
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:44
|
||||
|
|
||||
@ -66,12 +72,6 @@ help: if this is a dyn-compatible trait, use `dyn`
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> dyn Trait {
|
||||
| +++
|
||||
|
||||
error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:12
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:21
|
||||
|
|
||||
|
Loading…
Reference in New Issue
Block a user