Skip to content

Rollup of 9 pull requests #142929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Jun 24, 2025
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
669564d
std: sys: random: uefi: Provide rdrand based fallback
Ayush1325 May 21, 2025
f3d4278
Fix `core::iter::Fuse`'s `Default` impl to do what it's docs say it d…
zachs18 May 14, 2025
188023a
Don't suggest changing a method inside a expansion
Urgau Jun 22, 2025
332ae3b
Add codegen timing section
Kobzol Jun 20, 2025
66060e6
Create new `CiInfo` type in tidy checks to centralize CI related checks
GuillaumeGomez Jun 21, 2025
4780f21
Move error code explanation removal check into tidy
GuillaumeGomez Jun 21, 2025
c7bfb11
Fix install-template.sh for Solaris tr
psumbera Jun 23, 2025
2f4a55b
compiler: plug unsupported ABI leakage from the AST
workingjubilee Jun 1, 2025
e93a99b
hir_analysis: Avoid repeating unsupported ABI errors
workingjubilee Jun 13, 2025
b34c520
compiler: Remove unsupported_fn_ptr_calling_conventions lint
workingjubilee Jun 6, 2025
267ecd1
Clarify note in rustc_ast_lowering still applies
workingjubilee Jun 12, 2025
7c6b50c
unsupported_calling_conventions: print which ABI this is about
RalfJung Jun 13, 2025
a69aeaf
tests: Bless abi_gpu_kernel feature gate test
workingjubilee Jun 1, 2025
7e35b28
tests: Enhance unsupported ABI tests
workingjubilee Jun 13, 2025
a3a6d9b
tests: Update raw-dylib unsupported ABI test
workingjubilee Jun 13, 2025
0dd29e1
tests: Update and bless cmse-nonsecure ABI tests
workingjubilee Jun 1, 2025
7632fab
tests: Adopt ABI transmute tests from crashtests
workingjubilee Jun 1, 2025
78528bc
tests: Verify varargs with unsupported fn ptr ABIs must error
workingjubilee Jun 6, 2025
aa25b9b
tests: Bless cannot-be-called and dedup with unsupported ABI test
workingjubilee Jun 21, 2025
6ea79a1
Fix comment on NoMangle
JonathanBrouwer Jun 23, 2025
8147646
fix `-Zmin-function-alignment` without attributes
folkertdev Jun 23, 2025
f50da06
Rollup merge of #140985 - zachs18:fuse-default-some, r=tgross35
workingjubilee Jun 23, 2025
fc3d7ee
Rollup merge of #141324 - Ayush1325:uefi-rand-fallback, r=joboet
workingjubilee Jun 23, 2025
ff1636b
Rollup merge of #142134 - workingjubilee:reject-unsupported-abi, r=jd…
workingjubilee Jun 23, 2025
8ba69d0
Rollup merge of #142784 - Kobzol:timings-codegen, r=nnethercote
workingjubilee Jun 23, 2025
b942c6d
Rollup merge of #142827 - GuillaumeGomez:tidy-error-code-removal, r=K…
workingjubilee Jun 23, 2025
8ba8f1e
Rollup merge of #142873 - Urgau:issue-139830, r=BoxyUwU
workingjubilee Jun 23, 2025
64cfd5b
Rollup merge of #142908 - psumbera:solaris-tr, r=jieyouxu
workingjubilee Jun 23, 2025
1569f14
Rollup merge of #142922 - JonathanBrouwer:fix-rustdoc-comment, r=jdon…
workingjubilee Jun 23, 2025
b7a9cd8
Rollup merge of #142923 - folkertdev:min-function-alignment-no-attrib…
workingjubilee Jun 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ use rustc_abi::ExternAbi;
use rustc_ast::ptr::P;
use rustc_ast::visit::AssocCtxt;
use rustc_ast::*;
use rustc_errors::ErrorGuaranteed;
use rustc_errors::{E0570, ErrorGuaranteed, struct_span_code_err};
use rustc_hir::def::{DefKind, PerNS, Res};
use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
use rustc_hir::{self as hir, HirId, LifetimeSource, PredicateOrigin};
@@ -1644,9 +1644,29 @@ impl<'hir> LoweringContext<'_, 'hir> {
self.error_on_invalid_abi(abi_str);
ExternAbi::Rust
});
let sess = self.tcx.sess;
let features = self.tcx.features();
gate_unstable_abi(sess, features, span, extern_abi);
let tcx = self.tcx;

// we can't do codegen for unsupported ABIs, so error now so we won't get farther
if !tcx.sess.target.is_abi_supported(extern_abi) {
let mut err = struct_span_code_err!(
tcx.dcx(),
span,
E0570,
"{extern_abi} is not a supported ABI for the current target",
);

if let ExternAbi::Stdcall { unwind } = extern_abi {
let c_abi = ExternAbi::C { unwind };
let system_abi = ExternAbi::System { unwind };
err.help(format!("if you need `extern {extern_abi}` on win32 and `extern {c_abi}` everywhere else, \
use `extern {system_abi}`"
));
}
err.emit();
}
// Show required feature gate even if we already errored, as the user is likely to build the code
// for the actually intended target next and then they will need the feature gate.
gate_unstable_abi(tcx.sess, tcx.features(), span, extern_abi);
extern_abi
}

10 changes: 4 additions & 6 deletions compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Original file line number Diff line number Diff line change
@@ -146,12 +146,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
}
}

// Apply the minimum function alignment here, so that individual backends don't have to.
codegen_fn_attrs.alignment = Ord::max(
codegen_fn_attrs.alignment,
tcx.sess.opts.unstable_opts.min_function_alignment,
);

let Some(Ident { name, .. }) = attr.ident() else {
continue;
};
@@ -454,6 +448,10 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {

mixed_export_name_no_mangle_lint_state.lint_if_mixed(tcx);

// Apply the minimum function alignment here, so that individual backends don't have to.
codegen_fn_attrs.alignment =
Ord::max(codegen_fn_attrs.alignment, tcx.sess.opts.unstable_opts.min_function_alignment);

let inline_span;
(codegen_fn_attrs.inline, inline_span) = if let Some((inline_attr, span)) =
find_attr!(attrs, AttributeKind::Inline(i, span) => (*i, *span))
1 change: 1 addition & 0 deletions compiler/rustc_errors/src/json.rs
Original file line number Diff line number Diff line change
@@ -129,6 +129,7 @@ impl Emitter for JsonEmitter {
};
let name = match record.section {
TimingSection::Linking => "link",
TimingSection::Codegen => "codegen",
};
let data = SectionTimestamp { name, event, timestamp: record.timestamp };
let result = self.emit(EmitTyped::SectionTiming(data));
47 changes: 44 additions & 3 deletions compiler/rustc_errors/src/timings.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
use std::time::Instant;

use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::sync::Lock;

use crate::DiagCtxtHandle;

/// A high-level section of the compilation process.
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum TimingSection {
/// Time spent doing codegen.
Codegen,
/// Time spent linking.
Linking,
}
@@ -36,23 +41,59 @@ pub struct TimingSectionHandler {
/// Time when the compilation session started.
/// If `None`, timing is disabled.
origin: Option<Instant>,
/// Sanity check to ensure that we open and close sections correctly.
opened_sections: Lock<FxHashSet<TimingSection>>,
}

impl TimingSectionHandler {
pub fn new(enabled: bool) -> Self {
let origin = if enabled { Some(Instant::now()) } else { None };
Self { origin }
Self { origin, opened_sections: Lock::new(FxHashSet::default()) }
}

/// Returns a RAII guard that will immediately emit a start the provided section, and then emit
/// its end when it is dropped.
pub fn start_section<'a>(
pub fn section_guard<'a>(
&self,
diag_ctxt: DiagCtxtHandle<'a>,
section: TimingSection,
) -> TimingSectionGuard<'a> {
if self.is_enabled() && self.opened_sections.borrow().contains(&section) {
diag_ctxt
.bug(format!("Section `{section:?}` was started again before it was finished"));
}

TimingSectionGuard::create(diag_ctxt, section, self.origin)
}

/// Start the provided section.
pub fn start_section(&self, diag_ctxt: DiagCtxtHandle<'_>, section: TimingSection) {
if let Some(origin) = self.origin {
let mut opened = self.opened_sections.borrow_mut();
if !opened.insert(section) {
diag_ctxt
.bug(format!("Section `{section:?}` was started again before it was finished"));
}

diag_ctxt.emit_timing_section_start(TimingRecord::from_origin(origin, section));
}
}

/// End the provided section.
pub fn end_section(&self, diag_ctxt: DiagCtxtHandle<'_>, section: TimingSection) {
if let Some(origin) = self.origin {
let mut opened = self.opened_sections.borrow_mut();
if !opened.remove(&section) {
diag_ctxt.bug(format!("Section `{section:?}` was ended before being started"));
}

diag_ctxt.emit_timing_section_end(TimingRecord::from_origin(origin, section));
}
}

fn is_enabled(&self) -> bool {
self.origin.is_some()
}
}

/// RAII wrapper for starting and ending section timings.
45 changes: 9 additions & 36 deletions compiler/rustc_hir_analysis/src/check/check.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::cell::LazyCell;
use std::ops::ControlFlow;

use rustc_abi::FieldIdx;
use rustc_abi::{ExternAbi, FieldIdx};
use rustc_attr_data_structures::ReprAttr::ReprPacked;
use rustc_attr_data_structures::{AttributeKind, find_attr};
use rustc_data_structures::unord::{UnordMap, UnordSet};
@@ -13,7 +13,6 @@ use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt};
use rustc_infer::traits::{Obligation, ObligationCauseCode};
use rustc_lint_defs::builtin::{
REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS, UNSUPPORTED_CALLING_CONVENTIONS,
UNSUPPORTED_FN_PTR_CALLING_CONVENTIONS,
};
use rustc_middle::hir::nested_filter;
use rustc_middle::middle::resolve_bound_vars::ResolvedArg;
@@ -53,49 +52,22 @@ fn add_abi_diag_help<T: EmissionGuarantee>(abi: ExternAbi, diag: &mut Diag<'_, T
}

pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: ExternAbi) {
// FIXME: this should be checked earlier, e.g. in `rustc_ast_lowering`, to fix
// things like #86232.
// FIXME: This should be checked earlier, e.g. in `rustc_ast_lowering`, as this
// currently only guards function imports, function definitions, and function pointer types.
// Functions in trait declarations can still use "deprecated" ABIs without any warning.

match AbiMap::from_target(&tcx.sess.target).canonize_abi(abi, false) {
AbiMapping::Direct(..) => (),
// already erred in rustc_ast_lowering
AbiMapping::Invalid => {
let mut err = struct_span_code_err!(
tcx.dcx(),
span,
E0570,
"`{abi}` is not a supported ABI for the current target",
);
add_abi_diag_help(abi, &mut err);
err.emit();
tcx.dcx().span_delayed_bug(span, format!("{abi} should be rejected in ast_lowering"));
}
AbiMapping::Deprecated(..) => {
tcx.node_span_lint(UNSUPPORTED_CALLING_CONVENTIONS, hir_id, span, |lint| {
lint.primary_message("use of calling convention not supported on this target");
add_abi_diag_help(abi, lint);
});
}
}
}

pub fn check_abi_fn_ptr(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: ExternAbi) {
// This is always an FCW, even for `AbiMapping::Invalid`, since we started linting later than
// in `check_abi` above.
match AbiMap::from_target(&tcx.sess.target).canonize_abi(abi, false) {
AbiMapping::Direct(..) => (),
// This is not a redundant match arm: these ABIs started linting after introducing
// UNSUPPORTED_FN_PTR_CALLING_CONVENTIONS already existed and we want to
// avoid expanding the scope of that lint so it can move to a hard error sooner.
AbiMapping::Deprecated(..) => {
tcx.node_span_lint(UNSUPPORTED_CALLING_CONVENTIONS, hir_id, span, |lint| {
lint.primary_message("use of calling convention not supported on this target");
add_abi_diag_help(abi, lint);
});
}
AbiMapping::Invalid => {
tcx.node_span_lint(UNSUPPORTED_FN_PTR_CALLING_CONVENTIONS, hir_id, span, |lint| {
lint.primary_message(format!(
"the calling convention {abi} is not supported on this target"
"{abi} is not a supported ABI for the current target"
));
add_abi_diag_help(abi, lint);
});
}
}
@@ -868,6 +840,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
let hir::ItemKind::ForeignMod { abi, items } = it.kind else {
return;
};

check_abi(tcx, it.hir_id(), it.span, abi);

for item in items {
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/src/check/mod.rs
Original file line number Diff line number Diff line change
@@ -72,8 +72,8 @@ pub mod wfcheck;

use std::num::NonZero;

pub use check::{check_abi, check_abi_fn_ptr, check_custom_abi};
use rustc_abi::{ExternAbi, VariantIdx};
pub use check::{check_abi, check_custom_abi};
use rustc_abi::VariantIdx;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
use rustc_errors::{Diag, ErrorGuaranteed, pluralize, struct_span_code_err};
use rustc_hir::LangItem;
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ use rustc_trait_selection::traits::wf::object_region_bounds;
use rustc_trait_selection::traits::{self, FulfillmentError};
use tracing::{debug, instrument};

use crate::check::check_abi_fn_ptr;
use crate::check::check_abi;
use crate::errors::{AmbiguousLifetimeBound, BadReturnTypeNotation};
use crate::hir_ty_lowering::errors::{GenericsArgsErrExtend, prohibit_assoc_item_constraint};
use crate::hir_ty_lowering::generics::{check_generic_arg_count, lower_generic_args};
@@ -2660,7 +2660,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
if let hir::Node::Ty(hir::Ty { kind: hir::TyKind::BareFn(bare_fn_ty), span, .. }) =
tcx.hir_node(hir_id)
{
check_abi_fn_ptr(tcx, hir_id, *span, bare_fn_ty.abi);
check_abi(tcx, hir_id, *span, bare_fn_ty.abi);
}

// reject function types that violate cmse ABI requirements
4 changes: 3 additions & 1 deletion compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
@@ -1723,8 +1723,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Don't emit a suggestion if we found an actual method
// that had unsatisfied trait bounds
if unsatisfied_predicates.is_empty()
// ...or if we already suggested that name because of `rustc_confusable` annotation.
// ...or if we already suggested that name because of `rustc_confusable` annotation
&& Some(similar_candidate.name()) != confusable_suggested
// and if the we aren't in an expansion.
&& !span.from_expansion()
{
self.find_likely_intended_associated_item(
&mut err,
3 changes: 3 additions & 0 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ use rustc_data_structures::jobserver::Proxy;
use rustc_data_structures::steal::Steal;
use rustc_data_structures::sync::{AppendOnlyIndexVec, FreezeLock, WorkerLocal};
use rustc_data_structures::{parallel, thousands};
use rustc_errors::timings::TimingSection;
use rustc_expand::base::{ExtCtxt, LintStoreExpand};
use rustc_feature::Features;
use rustc_fs_util::try_canonicalize;
@@ -1176,6 +1177,8 @@ pub(crate) fn start_codegen<'tcx>(
codegen_backend: &dyn CodegenBackend,
tcx: TyCtxt<'tcx>,
) -> (Box<dyn Any>, EncodedMetadata) {
tcx.sess.timings.start_section(tcx.sess.dcx(), TimingSection::Codegen);

// Hook for tests.
if let Some((def_id, _)) = tcx.entry_fn(())
&& tcx.has_attr(def_id, sym::rustc_delayed_bug_from_inside_query)
3 changes: 2 additions & 1 deletion compiler/rustc_interface/src/queries.rs
Original file line number Diff line number Diff line change
@@ -48,6 +48,7 @@ impl Linker {
let (codegen_results, work_products) = sess.time("finish_ongoing_codegen", || {
codegen_backend.join_codegen(self.ongoing_codegen, sess, &self.output_filenames)
});
sess.timings.end_section(sess.dcx(), TimingSection::Codegen);

sess.dcx().abort_if_errors();

@@ -89,7 +90,7 @@ impl Linker {
}

let _timer = sess.prof.verbose_generic_activity("link_crate");
let _timing = sess.timings.start_section(sess.dcx(), TimingSection::Linking);
let _timing = sess.timings.section_guard(sess.dcx(), TimingSection::Linking);
codegen_backend.link(sess, codegen_results, self.metadata, &self.output_filenames)
}
}
1 change: 1 addition & 0 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
@@ -608,6 +608,7 @@ fn register_builtins(store: &mut LintStore) {
"converted into hard error, see issue #127323 \
<https://github.com/rust-lang/rust/issues/127323> for more information",
);
store.register_removed("unsupported_fn_ptr_calling_conventions", "converted into hard error");
store.register_removed(
"undefined_naked_function_abi",
"converted into hard error, see PR #139001 \
1 change: 0 additions & 1 deletion compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
@@ -122,7 +122,6 @@ declare_lint_pass! {
UNSAFE_OP_IN_UNSAFE_FN,
UNSTABLE_NAME_COLLISIONS,
UNSTABLE_SYNTAX_PRE_EXPANSION,
UNSUPPORTED_FN_PTR_CALLING_CONVENTIONS,
UNUSED_ASSIGNMENTS,
UNUSED_ASSOCIATED_TYPE_BOUNDS,
UNUSED_ATTRIBUTES,
24 changes: 23 additions & 1 deletion library/core/src/iter/adapters/fuse.rs
Original file line number Diff line number Diff line change
@@ -198,8 +198,30 @@ impl<I: Default> Default for Fuse<I> {
/// let iter: Fuse<slice::Iter<'_, u8>> = Default::default();
/// assert_eq!(iter.len(), 0);
/// ```
///
/// This is equivalent to `I::default().fuse()`[^fuse_note]; e.g. if
/// `I::default()` is not an empty iterator, then this will not be
/// an empty iterator.
///
/// ```
/// # use std::iter::Fuse;
/// #[derive(Default)]
/// struct Fourever;
///
/// impl Iterator for Fourever {
/// type Item = u32;
/// fn next(&mut self) -> Option<u32> {
/// Some(4)
/// }
/// }
///
/// let mut iter: Fuse<Fourever> = Default::default();
/// assert_eq!(iter.next(), Some(4));
/// ```
///
/// [^fuse_note]: if `I` does not override `Iterator::fuse`'s default implementation
fn default() -> Self {
Fuse { iter: Default::default() }
Fuse { iter: Some(I::default()) }
}
}

169 changes: 150 additions & 19 deletions library/std/src/sys/random/uefi.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,158 @@
use r_efi::protocols::rng;
pub fn fill_bytes(bytes: &mut [u8]) {
// Handle zero-byte request
if bytes.is_empty() {
return;
}

// Try EFI_RNG_PROTOCOL
if rng_protocol::fill_bytes(bytes) {
return;
}

use crate::sys::pal::helpers;
// Fallback to rdrand if rng protocol missing.
//
// For real-world example, see [issue-13825](https://github.com/rust-lang/rust/issues/138252#issuecomment-2891270323)
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
if rdrand::fill_bytes(bytes) {
return;
}

pub fn fill_bytes(bytes: &mut [u8]) {
let handles =
helpers::locate_handles(rng::PROTOCOL_GUID).expect("failed to generate random data");
for handle in handles {
if let Ok(protocol) = helpers::open_protocol::<rng::Protocol>(handle, rng::PROTOCOL_GUID) {
let r = unsafe {
((*protocol.as_ptr()).get_rng)(
protocol.as_ptr(),
crate::ptr::null_mut(),
bytes.len(),
bytes.as_mut_ptr(),
)
panic!("failed to generate random data");
}

mod rng_protocol {
use r_efi::protocols::rng;

use crate::sys::pal::helpers;

pub(crate) fn fill_bytes(bytes: &mut [u8]) -> bool {
if let Ok(handles) = helpers::locate_handles(rng::PROTOCOL_GUID) {
for handle in handles {
if let Ok(protocol) =
helpers::open_protocol::<rng::Protocol>(handle, rng::PROTOCOL_GUID)
{
let r = unsafe {
((*protocol.as_ptr()).get_rng)(
protocol.as_ptr(),
crate::ptr::null_mut(),
bytes.len(),
bytes.as_mut_ptr(),
)
};
if r.is_error() {
continue;
} else {
return true;
}
}
}
}

false
}
}

/// Port from [getrandom](https://github.com/rust-random/getrandom/blob/master/src/backends/rdrand.rs)
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
mod rdrand {
cfg_if::cfg_if! {
if #[cfg(target_arch = "x86_64")] {
use crate::arch::x86_64 as arch;
use arch::_rdrand64_step as rdrand_step;
type Word = u64;
} else if #[cfg(target_arch = "x86")] {
use crate::arch::x86 as arch;
use arch::_rdrand32_step as rdrand_step;
type Word = u32;
}
}

static RDRAND_GOOD: crate::sync::LazyLock<bool> = crate::sync::LazyLock::new(is_rdrand_good);

// Recommendation from "Intel® Digital Random Number Generator (DRNG) Software
// Implementation Guide" - Section 5.2.1 and "Intel® 64 and IA-32 Architectures
// Software Developer’s Manual" - Volume 1 - Section 7.3.17.1.
const RETRY_LIMIT: usize = 10;

unsafe fn rdrand() -> Option<Word> {
for _ in 0..RETRY_LIMIT {
let mut val = 0;
if unsafe { rdrand_step(&mut val) } == 1 {
return Some(val);
}
}
None
}

// Run a small self-test to make sure we aren't repeating values
// Adapted from Linux's test in arch/x86/kernel/cpu/rdrand.c
// Fails with probability < 2^(-90) on 32-bit systems
unsafe fn self_test() -> bool {
// On AMD, RDRAND returns 0xFF...FF on failure, count it as a collision.
let mut prev = Word::MAX;
let mut fails = 0;
for _ in 0..8 {
match unsafe { rdrand() } {
Some(val) if val == prev => fails += 1,
Some(val) => prev = val,
None => return false,
};
if r.is_error() {
continue;
} else {
return;
}
fails <= 2
}

fn is_rdrand_good() -> bool {
#[cfg(not(target_feature = "rdrand"))]
{
// SAFETY: All Rust x86 targets are new enough to have CPUID, and we
// check that leaf 1 is supported before using it.
let cpuid0 = unsafe { arch::__cpuid(0) };
if cpuid0.eax < 1 {
return false;
}
let cpuid1 = unsafe { arch::__cpuid(1) };

let vendor_id =
[cpuid0.ebx.to_le_bytes(), cpuid0.edx.to_le_bytes(), cpuid0.ecx.to_le_bytes()];
if vendor_id == [*b"Auth", *b"enti", *b"cAMD"] {
let mut family = (cpuid1.eax >> 8) & 0xF;
if family == 0xF {
family += (cpuid1.eax >> 20) & 0xFF;
}
// AMD CPUs families before 17h (Zen) sometimes fail to set CF when
// RDRAND fails after suspend. Don't use RDRAND on those families.
// See https://bugzilla.redhat.com/show_bug.cgi?id=1150286
if family < 0x17 {
return false;
}
}

const RDRAND_FLAG: u32 = 1 << 30;
if cpuid1.ecx & RDRAND_FLAG == 0 {
return false;
}
}

// SAFETY: We have already checked that rdrand is available.
unsafe { self_test() }
}

panic!("failed to generate random data");
unsafe fn rdrand_exact(dest: &mut [u8]) -> Option<()> {
let mut chunks = dest.array_chunks_mut();
for chunk in &mut chunks {
*chunk = unsafe { rdrand() }?.to_ne_bytes();
}

let tail = chunks.into_remainder();
let n = tail.len();
if n > 0 {
let src = unsafe { rdrand() }?.to_ne_bytes();
tail.copy_from_slice(&src[..n]);
}
Some(())
}

pub(crate) fn fill_bytes(bytes: &mut [u8]) -> bool {
if *RDRAND_GOOD { unsafe { rdrand_exact(bytes).is_some() } } else { false }
}
}
2 changes: 0 additions & 2 deletions src/ci/docker/host-x86_64/mingw-check-1/Dockerfile
Original file line number Diff line number Diff line change
@@ -39,7 +39,6 @@ RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-require

COPY host-x86_64/mingw-check-1/check-default-config-profiles.sh /scripts/
COPY host-x86_64/mingw-check-1/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check-1/validate-error-codes.sh /scripts/

# Check library crates on all tier 1 targets.
# We disable optimized compiler built-ins because that requires a C toolchain for the target.
@@ -52,7 +51,6 @@ ENV SCRIPT \
python3 ../x.py check --stage 1 --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \
python3 ../x.py check --stage 1 --set build.optimized-compiler-builtins=false core alloc std --target=aarch64-unknown-linux-gnu,i686-pc-windows-msvc,i686-unknown-linux-gnu,x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc && \
/scripts/validate-toolstate.sh && \
/scripts/validate-error-codes.sh && \
reuse --include-submodules lint && \
python3 ../x.py test collect-license-metadata && \
# Runs checks to ensure that there are no issues in our JS code.
20 changes: 0 additions & 20 deletions src/ci/docker/host-x86_64/mingw-check-1/validate-error-codes.sh

This file was deleted.

1 change: 0 additions & 1 deletion src/ci/docker/host-x86_64/mingw-check-tidy/Dockerfile
Original file line number Diff line number Diff line change
@@ -39,7 +39,6 @@ RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-require
&& pip3 install virtualenv

COPY host-x86_64/mingw-check-1/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check-1/validate-error-codes.sh /scripts/

RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)'

3 changes: 2 additions & 1 deletion src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
@@ -753,7 +753,8 @@ impl Item {
.other_attrs
.iter()
.filter_map(|attr| {
// NoMangle is special-cased because cargo-semver-checks uses it
// NoMangle is special cased, as it appears in HTML output, and we want to show it in source form, not HIR printing.
// It is also used by cargo-semver-checks.
if matches!(attr, hir::Attribute::Parsed(AttributeKind::NoMangle(..))) {
Some("#[no_mangle]".to_string())
} else if is_json {
8 changes: 4 additions & 4 deletions src/tools/rust-installer/install-template.sh
Original file line number Diff line number Diff line change
@@ -160,7 +160,7 @@ valopt() {
local doc="$*"
if [ $HELP -eq 0 ]
then
local uop=$(echo $op | tr 'a-z-' 'A-Z_')
local uop=$(echo $op | tr '[a-z]-' '[A-Z]_')
local v="CFG_${uop}"
eval $v="$default"
for arg in $CFG_ARGS
@@ -206,8 +206,8 @@ opt() {
do
if [ "$arg" = "--${flag}-${op}" ]
then
op=$(echo $op | tr 'a-z-' 'A-Z_')
flag=$(echo $flag | tr 'a-z' 'A-Z')
op=$(echo $op | tr '[a-z]-' '[A-Z]_')
flag=$(echo $flag | tr '[a-z]' '[A-Z]')
local v="CFG_${flag}_${op}"
eval $v=1
putvar $v
@@ -235,7 +235,7 @@ flag() {
do
if [ "$arg" = "--${op}" ]
then
op=$(echo $op | tr 'a-z-' 'A-Z_')
op=$(echo $op | tr '[a-z]-' '[A-Z]_')
local v="CFG_${op}"
eval $v=1
putvar $v
32 changes: 31 additions & 1 deletion src/tools/tidy/src/error_codes.rs
Original file line number Diff line number Diff line change
@@ -43,9 +43,18 @@ macro_rules! verbose_print {
};
}

pub fn check(root_path: &Path, search_paths: &[&Path], verbose: bool, bad: &mut bool) {
pub fn check(
root_path: &Path,
search_paths: &[&Path],
verbose: bool,
ci_info: &crate::CiInfo,
bad: &mut bool,
) {
let mut errors = Vec::new();

// Check that no error code explanation was removed.
check_removed_error_code_explanation(ci_info, bad);

// Stage 1: create list
let error_codes = extract_error_codes(root_path, &mut errors);
if verbose {
@@ -68,6 +77,27 @@ pub fn check(root_path: &Path, search_paths: &[&Path], verbose: bool, bad: &mut
}
}

fn check_removed_error_code_explanation(ci_info: &crate::CiInfo, bad: &mut bool) {
let Some(base_commit) = &ci_info.base_commit else {
eprintln!("Skipping error code explanation removal check");
return;
};
let Some(diff) = crate::git_diff(base_commit, "--name-status") else {
*bad = true;
eprintln!("removed error code explanation tidy check: Failed to run git diff");
return;
};
if diff.lines().any(|line| {
line.starts_with('D') && line.contains("compiler/rustc_error_codes/src/error_codes/")
}) {
*bad = true;
eprintln!("tidy check error: Error code explanations should never be removed!");
eprintln!("Take a look at E0001 to see how to handle it.");
return;
}
println!("No error code explanation was removed!");
}

/// Stage 1: Parses a list of error codes from `error_codes.rs`.
fn extract_error_codes(root_path: &Path, errors: &mut Vec<String>) -> Vec<String> {
let path = root_path.join(Path::new(ERROR_CODES_PATH));
61 changes: 61 additions & 0 deletions src/tools/tidy/src/lib.rs
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@
//! This library contains the tidy lints and exposes it
//! to be used by tools.
use std::ffi::OsStr;
use std::process::Command;

use build_helper::ci::CiEnv;
use build_helper::git::{GitConfig, get_closest_upstream_commit};
use build_helper::stage0_parser::{Stage0Config, parse_stage0_file};
use termcolor::WriteColor;

macro_rules! static_regex {
@@ -63,6 +69,61 @@ fn tidy_error(args: &str) -> std::io::Result<()> {
Ok(())
}

pub struct CiInfo {
pub git_merge_commit_email: String,
pub nightly_branch: String,
pub base_commit: Option<String>,
pub ci_env: CiEnv,
}

impl CiInfo {
pub fn new(bad: &mut bool) -> Self {
let stage0 = parse_stage0_file();
let Stage0Config { nightly_branch, git_merge_commit_email, .. } = stage0.config;

let mut info = Self {
nightly_branch,
git_merge_commit_email,
ci_env: CiEnv::current(),
base_commit: None,
};
let base_commit = match get_closest_upstream_commit(None, &info.git_config(), info.ci_env) {
Ok(Some(commit)) => Some(commit),
Ok(None) => {
info.error_if_in_ci("no base commit found", bad);
None
}
Err(error) => {
info.error_if_in_ci(&format!("failed to retrieve base commit: {error}"), bad);
None
}
};
info.base_commit = base_commit;
info
}

pub fn git_config(&self) -> GitConfig<'_> {
GitConfig {
nightly_branch: &self.nightly_branch,
git_merge_commit_email: &self.git_merge_commit_email,
}
}

pub fn error_if_in_ci(&self, msg: &str, bad: &mut bool) {
if self.ci_env.is_running_in_ci() {
*bad = true;
eprintln!("tidy check error: {msg}");
} else {
eprintln!("tidy check warning: {msg}. Some checks will be skipped.");
}
}
}

pub fn git_diff<S: AsRef<OsStr>>(base_commit: &str, extra_arg: S) -> Option<String> {
let output = Command::new("git").arg("diff").arg(base_commit).arg(extra_arg).output().ok()?;
Some(String::from_utf8_lossy(&output.stdout).into())
}

pub mod alphabetical;
pub mod bins;
pub mod debug_artifacts;
8 changes: 5 additions & 3 deletions src/tools/tidy/src/main.rs
Original file line number Diff line number Diff line change
@@ -48,7 +48,9 @@ fn main() {
let extra_checks =
cfg_args.iter().find(|s| s.starts_with("--extra-checks=")).map(String::as_str);

let bad = std::sync::Arc::new(AtomicBool::new(false));
let mut bad = false;
let ci_info = CiInfo::new(&mut bad);
let bad = std::sync::Arc::new(AtomicBool::new(bad));

let drain_handles = |handles: &mut VecDeque<ScopedJoinHandle<'_, ()>>| {
// poll all threads for completion before awaiting the oldest one
@@ -110,12 +112,12 @@ fn main() {
check!(rustdoc_css_themes, &librustdoc_path);
check!(rustdoc_templates, &librustdoc_path);
check!(rustdoc_js, &librustdoc_path, &tools_path, &src_path);
check!(rustdoc_json, &src_path);
check!(rustdoc_json, &src_path, &ci_info);
check!(known_bug, &crashes_path);
check!(unknown_revision, &tests_path);

// Checks that only make sense for the compiler.
check!(error_codes, &root_path, &[&compiler_path, &librustdoc_path], verbose);
check!(error_codes, &root_path, &[&compiler_path, &librustdoc_path], verbose, &ci_info);
check!(fluent_alphabetical, &compiler_path, bless);
check!(fluent_period, &compiler_path);
check!(target_policy, &root_path);
48 changes: 6 additions & 42 deletions src/tools/tidy/src/rustdoc_json.rs
Original file line number Diff line number Diff line change
@@ -1,56 +1,20 @@
//! Tidy check to ensure that `FORMAT_VERSION` was correctly updated if `rustdoc-json-types` was
//! updated as well.
use std::ffi::OsStr;
use std::path::Path;
use std::process::Command;
use std::str::FromStr;

use build_helper::ci::CiEnv;
use build_helper::git::{GitConfig, get_closest_upstream_commit};
use build_helper::stage0_parser::parse_stage0_file;

const RUSTDOC_JSON_TYPES: &str = "src/rustdoc-json-types";

fn git_diff<S: AsRef<OsStr>>(base_commit: &str, extra_arg: S) -> Option<String> {
let output = Command::new("git").arg("diff").arg(base_commit).arg(extra_arg).output().ok()?;
Some(String::from_utf8_lossy(&output.stdout).into())
}

fn error_if_in_ci(ci_env: CiEnv, msg: &str, bad: &mut bool) {
if ci_env.is_running_in_ci() {
*bad = true;
eprintln!("error in `rustdoc_json` tidy check: {msg}");
} else {
eprintln!("{msg}. Skipping `rustdoc_json` tidy check");
}
}

pub fn check(src_path: &Path, bad: &mut bool) {
pub fn check(src_path: &Path, ci_info: &crate::CiInfo, bad: &mut bool) {
println!("Checking tidy rustdoc_json...");
let stage0 = parse_stage0_file();
let ci_env = CiEnv::current();
let base_commit = match get_closest_upstream_commit(
None,
&GitConfig {
nightly_branch: &stage0.config.nightly_branch,
git_merge_commit_email: &stage0.config.git_merge_commit_email,
},
ci_env,
) {
Ok(Some(commit)) => commit,
Ok(None) => {
error_if_in_ci(ci_env, "no base commit found", bad);
return;
}
Err(error) => {
error_if_in_ci(ci_env, &format!("failed to retrieve base commit: {error}"), bad);
return;
}
let Some(base_commit) = &ci_info.base_commit else {
eprintln!("No base commit, skipping rustdoc_json check");
return;
};

// First we check that `src/rustdoc-json-types` was modified.
match git_diff(&base_commit, "--name-status") {
match crate::git_diff(&base_commit, "--name-status") {
Some(output) => {
if !output
.lines()
@@ -68,7 +32,7 @@ pub fn check(src_path: &Path, bad: &mut bool) {
}
}
// Then we check that if `FORMAT_VERSION` was updated, the `Latest feature:` was also updated.
match git_diff(&base_commit, src_path.join("rustdoc-json-types")) {
match crate::git_diff(&base_commit, src_path.join("rustdoc-json-types")) {
Some(output) => {
let mut format_version_updated = false;
let mut latest_feature_comment_updated = false;
7 changes: 7 additions & 0 deletions tests/auxiliary/minicore.rs
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@

#![feature(
no_core,
intrinsics,
lang_items,
auto_traits,
freeze_impls,
@@ -196,3 +197,9 @@ impl<'a, 'b: 'a, T: PointeeSized + Unsize<U>, U: PointeeSized> CoerceUnsized<&'a
trait Drop {
fn drop(&mut self);
}

pub mod mem {
#[rustc_nounwind]
#[rustc_intrinsic]
pub unsafe fn transmute<Src, Dst>(src: Src) -> Dst;
}
10 changes: 6 additions & 4 deletions tests/codegen/min-function-alignment.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
//@ revisions: align16 align1024
//@ compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0
//@ compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0 -Clink-dead-code
//@ [align16] compile-flags: -Zmin-function-alignment=16
//@ [align1024] compile-flags: -Zmin-function-alignment=1024

#![crate_type = "lib"]
#![feature(fn_align)]

// functions without explicit alignment use the global minimum
// Functions without explicit alignment use the global minimum.
//
// CHECK-LABEL: @no_explicit_align
// NOTE: this function deliberately has zero (0) attributes! That is to make sure that
// `-Zmin-function-alignment` is applied regardless of whether attributes are used.
//
// CHECK-LABEL: no_explicit_align
// align16: align 16
// align1024: align 1024
#[no_mangle]
pub fn no_explicit_align() {}

// CHECK-LABEL: @lower_align
10 changes: 0 additions & 10 deletions tests/crashes/132430.rs

This file was deleted.

7 changes: 0 additions & 7 deletions tests/crashes/138738.rs

This file was deleted.

131 changes: 37 additions & 94 deletions tests/ui/abi/cannot-be-called.avr.stderr
Original file line number Diff line number Diff line change
@@ -1,132 +1,75 @@
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:60:18
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:38:8
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^

warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/cannot-be-called.rs:74:19
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:42:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "riscv-interrupt-m" fn riscv_m() {}
| ^^^^^^^^^^^^^^^^^^^

warning: the calling convention "riscv-interrupt-s" is not supported on this target
--> $DIR/cannot-be-called.rs:81:19
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:44:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^

warning: the calling convention "x86-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:88:15
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:46:8
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "x86-interrupt" fn x86() {}
| ^^^^^^^^^^^^^^^

error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:36:1
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:65:25
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^

error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:40:1
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:77:26
|
LL | extern "riscv-interrupt-m" fn riscv_m() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^

error[E0570]: `"riscv-interrupt-s"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:42:1
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:83:26
|
LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:44:1
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:89:22
|
LL | extern "x86-interrupt" fn x86() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^

error: functions with the "avr-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:50:5
--> $DIR/cannot-be-called.rs:53:5
|
LL | avr();
| ^^^^^
|
note: an `extern "avr-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:50:5
--> $DIR/cannot-be-called.rs:53:5
|
LL | avr();
| ^^^^^

error: functions with the "avr-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:70:5
--> $DIR/cannot-be-called.rs:73:5
|
LL | f()
| ^^^
|
note: an `extern "avr-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:70:5
--> $DIR/cannot-be-called.rs:73:5
|
LL | f()
| ^^^

error: aborting due to 6 previous errors; 4 warnings emitted
error: aborting due to 10 previous errors

For more information about this error, try `rustc --explain E0570`.
Future incompatibility report: Future breakage diagnostic:
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:60:18
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/cannot-be-called.rs:74:19
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "riscv-interrupt-s" is not supported on this target
--> $DIR/cannot-be-called.rs:81:19
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "x86-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:88:15
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

127 changes: 35 additions & 92 deletions tests/ui/abi/cannot-be-called.i686.stderr
Original file line number Diff line number Diff line change
@@ -1,72 +1,59 @@
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:60:18
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:38:8
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^

warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:67:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:40:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^

warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/cannot-be-called.rs:74:19
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:42:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "riscv-interrupt-m" fn riscv_m() {}
| ^^^^^^^^^^^^^^^^^^^

warning: the calling convention "riscv-interrupt-s" is not supported on this target
--> $DIR/cannot-be-called.rs:81:19
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:44:8
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^

error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:36:1
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:65:25
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^

error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:38:1
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:71:22
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^

error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:40:1
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:77:26
|
LL | extern "riscv-interrupt-m" fn riscv_m() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^

error[E0570]: `"riscv-interrupt-s"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:42:1
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:83:26
|
LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^

error: functions with the "x86-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:56:5
--> $DIR/cannot-be-called.rs:59:5
|
LL | x86();
| ^^^^^
|
note: an `extern "x86-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:56:5
--> $DIR/cannot-be-called.rs:59:5
|
LL | x86();
| ^^^^^
@@ -83,50 +70,6 @@ note: an `extern "x86-interrupt"` function can only be called using inline assem
LL | f()
| ^^^

error: aborting due to 6 previous errors; 4 warnings emitted
error: aborting due to 10 previous errors

For more information about this error, try `rustc --explain E0570`.
Future incompatibility report: Future breakage diagnostic:
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:60:18
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:67:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/cannot-be-called.rs:74:19
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "riscv-interrupt-s" is not supported on this target
--> $DIR/cannot-be-called.rs:81:19
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

131 changes: 37 additions & 94 deletions tests/ui/abi/cannot-be-called.msp430.stderr
Original file line number Diff line number Diff line change
@@ -1,132 +1,75 @@
warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:67:15
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:40:8
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^

warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/cannot-be-called.rs:74:19
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:42:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "riscv-interrupt-m" fn riscv_m() {}
| ^^^^^^^^^^^^^^^^^^^

warning: the calling convention "riscv-interrupt-s" is not supported on this target
--> $DIR/cannot-be-called.rs:81:19
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:44:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^

warning: the calling convention "x86-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:88:15
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:46:8
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "x86-interrupt" fn x86() {}
| ^^^^^^^^^^^^^^^

error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:38:1
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:71:22
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^

error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:40:1
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:77:26
|
LL | extern "riscv-interrupt-m" fn riscv_m() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^

error[E0570]: `"riscv-interrupt-s"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:42:1
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:83:26
|
LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:44:1
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:89:22
|
LL | extern "x86-interrupt" fn x86() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^

error: functions with the "msp430-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:48:5
--> $DIR/cannot-be-called.rs:51:5
|
LL | msp430();
| ^^^^^^^^
|
note: an `extern "msp430-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:48:5
--> $DIR/cannot-be-called.rs:51:5
|
LL | msp430();
| ^^^^^^^^

error: functions with the "msp430-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:63:5
--> $DIR/cannot-be-called.rs:67:5
|
LL | f()
| ^^^
|
note: an `extern "msp430-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:63:5
--> $DIR/cannot-be-called.rs:67:5
|
LL | f()
| ^^^

error: aborting due to 6 previous errors; 4 warnings emitted
error: aborting due to 10 previous errors

For more information about this error, try `rustc --explain E0570`.
Future incompatibility report: Future breakage diagnostic:
warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:67:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/cannot-be-called.rs:74:19
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "riscv-interrupt-s" is not supported on this target
--> $DIR/cannot-be-called.rs:81:19
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "x86-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:88:15
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

109 changes: 33 additions & 76 deletions tests/ui/abi/cannot-be-called.riscv32.stderr
Original file line number Diff line number Diff line change
@@ -1,130 +1,87 @@
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:60:18
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:38:8
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^

warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:67:15
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:40:8
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^

warning: the calling convention "x86-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:88:15
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:46:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "x86-interrupt" fn x86() {}
| ^^^^^^^^^^^^^^^

error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:36:1
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:65:25
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^

error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:38:1
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:71:22
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:44:1
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:89:22
|
LL | extern "x86-interrupt" fn x86() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^

error: functions with the "riscv-interrupt-m" ABI cannot be called
--> $DIR/cannot-be-called.rs:52:5
--> $DIR/cannot-be-called.rs:55:5
|
LL | riscv_m();
| ^^^^^^^^^
|
note: an `extern "riscv-interrupt-m"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:52:5
--> $DIR/cannot-be-called.rs:55:5
|
LL | riscv_m();
| ^^^^^^^^^

error: functions with the "riscv-interrupt-s" ABI cannot be called
--> $DIR/cannot-be-called.rs:54:5
--> $DIR/cannot-be-called.rs:57:5
|
LL | riscv_s();
| ^^^^^^^^^
|
note: an `extern "riscv-interrupt-s"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:54:5
--> $DIR/cannot-be-called.rs:57:5
|
LL | riscv_s();
| ^^^^^^^^^

error: functions with the "riscv-interrupt-m" ABI cannot be called
--> $DIR/cannot-be-called.rs:77:5
--> $DIR/cannot-be-called.rs:79:5
|
LL | f()
| ^^^
|
note: an `extern "riscv-interrupt-m"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:77:5
--> $DIR/cannot-be-called.rs:79:5
|
LL | f()
| ^^^

error: functions with the "riscv-interrupt-s" ABI cannot be called
--> $DIR/cannot-be-called.rs:84:5
--> $DIR/cannot-be-called.rs:85:5
|
LL | f()
| ^^^
|
note: an `extern "riscv-interrupt-s"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:84:5
--> $DIR/cannot-be-called.rs:85:5
|
LL | f()
| ^^^

error: aborting due to 7 previous errors; 3 warnings emitted
error: aborting due to 10 previous errors

For more information about this error, try `rustc --explain E0570`.
Future incompatibility report: Future breakage diagnostic:
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:60:18
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:67:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "x86-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:88:15
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

109 changes: 33 additions & 76 deletions tests/ui/abi/cannot-be-called.riscv64.stderr
Original file line number Diff line number Diff line change
@@ -1,130 +1,87 @@
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:60:18
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:38:8
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^

warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:67:15
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:40:8
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^

warning: the calling convention "x86-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:88:15
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:46:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "x86-interrupt" fn x86() {}
| ^^^^^^^^^^^^^^^

error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:36:1
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:65:25
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^

error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:38:1
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:71:22
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:44:1
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:89:22
|
LL | extern "x86-interrupt" fn x86() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^

error: functions with the "riscv-interrupt-m" ABI cannot be called
--> $DIR/cannot-be-called.rs:52:5
--> $DIR/cannot-be-called.rs:55:5
|
LL | riscv_m();
| ^^^^^^^^^
|
note: an `extern "riscv-interrupt-m"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:52:5
--> $DIR/cannot-be-called.rs:55:5
|
LL | riscv_m();
| ^^^^^^^^^

error: functions with the "riscv-interrupt-s" ABI cannot be called
--> $DIR/cannot-be-called.rs:54:5
--> $DIR/cannot-be-called.rs:57:5
|
LL | riscv_s();
| ^^^^^^^^^
|
note: an `extern "riscv-interrupt-s"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:54:5
--> $DIR/cannot-be-called.rs:57:5
|
LL | riscv_s();
| ^^^^^^^^^

error: functions with the "riscv-interrupt-m" ABI cannot be called
--> $DIR/cannot-be-called.rs:77:5
--> $DIR/cannot-be-called.rs:79:5
|
LL | f()
| ^^^
|
note: an `extern "riscv-interrupt-m"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:77:5
--> $DIR/cannot-be-called.rs:79:5
|
LL | f()
| ^^^

error: functions with the "riscv-interrupt-s" ABI cannot be called
--> $DIR/cannot-be-called.rs:84:5
--> $DIR/cannot-be-called.rs:85:5
|
LL | f()
| ^^^
|
note: an `extern "riscv-interrupt-s"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:84:5
--> $DIR/cannot-be-called.rs:85:5
|
LL | f()
| ^^^

error: aborting due to 7 previous errors; 3 warnings emitted
error: aborting due to 10 previous errors

For more information about this error, try `rustc --explain E0570`.
Future incompatibility report: Future breakage diagnostic:
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:60:18
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:67:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "x86-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:88:15
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

30 changes: 15 additions & 15 deletions tests/ui/abi/cannot-be-called.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*! Tests entry-point ABIs cannot be called
Interrupt ABIs share similar semantics, in that they are special entry-points unusable by Rust.
So we test that they error in essentially all of the same places.
*/
//@ add-core-stubs
//@ revisions: x64 x64_win i686 riscv32 riscv64 avr msp430
//
@@ -18,21 +23,18 @@
#![no_core]
#![feature(
no_core,
lang_items,
abi_ptx,
abi_msp430_interrupt,
abi_avr_interrupt,
abi_gpu_kernel,
abi_x86_interrupt,
abi_riscv_interrupt,
abi_c_cmse_nonsecure_call,
abi_vectorcall,
cmse_nonsecure_entry
)]

extern crate minicore;
use minicore::*;

/* extern "interrupt" definition */

extern "msp430-interrupt" fn msp430() {}
//[x64,x64_win,i686,riscv32,riscv64,avr]~^ ERROR is not a supported ABI
extern "avr-interrupt" fn avr() {}
@@ -44,6 +46,7 @@ extern "riscv-interrupt-s" fn riscv_s() {}
extern "x86-interrupt" fn x86() {}
//[riscv32,riscv64,avr,msp430]~^ ERROR is not a supported ABI

/* extern "interrupt" calls */
fn call_the_interrupts() {
msp430();
//[msp430]~^ ERROR functions with the "msp430-interrupt" ABI cannot be called
@@ -57,37 +60,34 @@ fn call_the_interrupts() {
//[x64,x64_win,i686]~^ ERROR functions with the "x86-interrupt" ABI cannot be called
}

/* extern "interrupt" fnptr calls */

fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
//[x64,x64_win,i686,riscv32,riscv64,avr]~^ WARN unsupported_fn_ptr_calling_conventions
//[x64,x64_win,i686,riscv32,riscv64,avr]~^^ WARN this was previously accepted
//[x64,x64_win,i686,riscv32,riscv64,avr]~^ ERROR is not a supported ABI
f()
//[msp430]~^ ERROR functions with the "msp430-interrupt" ABI cannot be called
}

fn avr_ptr(f: extern "avr-interrupt" fn()) {
//[x64,x64_win,i686,riscv32,riscv64,msp430]~^ WARN unsupported_fn_ptr_calling_conventions
//[x64,x64_win,i686,riscv32,riscv64,msp430]~^^ WARN this was previously accepted
//[x64,x64_win,i686,riscv32,riscv64,msp430]~^ ERROR is not a supported ABI
f()
//[avr]~^ ERROR functions with the "avr-interrupt" ABI cannot be called
}

fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
//[x64,x64_win,i686,avr,msp430]~^ WARN unsupported_fn_ptr_calling_conventions
//[x64,x64_win,i686,avr,msp430]~^^ WARN this was previously accepted
//[x64,x64_win,i686,avr,msp430]~^ ERROR is not a supported ABI
f()
//[riscv32,riscv64]~^ ERROR functions with the "riscv-interrupt-m" ABI cannot be called
}

fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
//[x64,x64_win,i686,avr,msp430]~^ WARN unsupported_fn_ptr_calling_conventions
//[x64,x64_win,i686,avr,msp430]~^^ WARN this was previously accepted
//[x64,x64_win,i686,avr,msp430]~^ ERROR is not a supported ABI
f()
//[riscv32,riscv64]~^ ERROR functions with the "riscv-interrupt-s" ABI cannot be called
}

fn x86_ptr(f: extern "x86-interrupt" fn()) {
//[riscv32,riscv64,avr,msp430]~^ WARN unsupported_fn_ptr_calling_conventions
//[riscv32,riscv64,avr,msp430]~^^ WARN this was previously accepted
//[riscv32,riscv64,avr,msp430]~^ ERROR is not a supported ABI
f()
//[x64,x64_win,i686]~^ ERROR functions with the "x86-interrupt" ABI cannot be called
}
127 changes: 35 additions & 92 deletions tests/ui/abi/cannot-be-called.x64.stderr
Original file line number Diff line number Diff line change
@@ -1,72 +1,59 @@
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:60:18
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:38:8
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^

warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:67:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:40:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^

warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/cannot-be-called.rs:74:19
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:42:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "riscv-interrupt-m" fn riscv_m() {}
| ^^^^^^^^^^^^^^^^^^^

warning: the calling convention "riscv-interrupt-s" is not supported on this target
--> $DIR/cannot-be-called.rs:81:19
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:44:8
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^

error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:36:1
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:65:25
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^

error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:38:1
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:71:22
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^

error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:40:1
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:77:26
|
LL | extern "riscv-interrupt-m" fn riscv_m() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^

error[E0570]: `"riscv-interrupt-s"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:42:1
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:83:26
|
LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^

error: functions with the "x86-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:56:5
--> $DIR/cannot-be-called.rs:59:5
|
LL | x86();
| ^^^^^
|
note: an `extern "x86-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:56:5
--> $DIR/cannot-be-called.rs:59:5
|
LL | x86();
| ^^^^^
@@ -83,50 +70,6 @@ note: an `extern "x86-interrupt"` function can only be called using inline assem
LL | f()
| ^^^

error: aborting due to 6 previous errors; 4 warnings emitted
error: aborting due to 10 previous errors

For more information about this error, try `rustc --explain E0570`.
Future incompatibility report: Future breakage diagnostic:
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:60:18
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:67:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/cannot-be-called.rs:74:19
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "riscv-interrupt-s" is not supported on this target
--> $DIR/cannot-be-called.rs:81:19
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

127 changes: 35 additions & 92 deletions tests/ui/abi/cannot-be-called.x64_win.stderr
Original file line number Diff line number Diff line change
@@ -1,72 +1,59 @@
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:60:18
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:38:8
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^

warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:67:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:40:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^

warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/cannot-be-called.rs:74:19
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:42:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "riscv-interrupt-m" fn riscv_m() {}
| ^^^^^^^^^^^^^^^^^^^

warning: the calling convention "riscv-interrupt-s" is not supported on this target
--> $DIR/cannot-be-called.rs:81:19
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:44:8
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^

error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:36:1
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:65:25
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^

error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:38:1
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:71:22
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^

error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:40:1
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:77:26
|
LL | extern "riscv-interrupt-m" fn riscv_m() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^

error[E0570]: `"riscv-interrupt-s"` is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:42:1
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:83:26
|
LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^

error: functions with the "x86-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:56:5
--> $DIR/cannot-be-called.rs:59:5
|
LL | x86();
| ^^^^^
|
note: an `extern "x86-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:56:5
--> $DIR/cannot-be-called.rs:59:5
|
LL | x86();
| ^^^^^
@@ -83,50 +70,6 @@ note: an `extern "x86-interrupt"` function can only be called using inline assem
LL | f()
| ^^^

error: aborting due to 6 previous errors; 4 warnings emitted
error: aborting due to 10 previous errors

For more information about this error, try `rustc --explain E0570`.
Future incompatibility report: Future breakage diagnostic:
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:60:18
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/cannot-be-called.rs:67:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/cannot-be-called.rs:74:19
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "riscv-interrupt-s" is not supported on this target
--> $DIR/cannot-be-called.rs:81:19
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

15 changes: 15 additions & 0 deletions tests/ui/abi/unsupported-abi-transmute.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//@ add-core-stubs
//@ compile-flags: --crate-type=lib --target x86_64-unknown-none
//@ needs-llvm-components: x86
//@ edition: 2018
#![no_core]
#![feature(no_core, lang_items)]
extern crate minicore;
use minicore::*;

// Check we error before unsupported ABIs reach codegen stages.

fn anything() {
let a = unsafe { mem::transmute::<usize, extern "thiscall" fn(i32)>(4) }(2);
//~^ ERROR: is not a supported ABI for the current target [E0570]
}
9 changes: 9 additions & 0 deletions tests/ui/abi/unsupported-abi-transmute.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0570]: "thiscall" is not a supported ABI for the current target
--> $DIR/unsupported-abi-transmute.rs:13:53
|
LL | let a = unsafe { mem::transmute::<usize, extern "thiscall" fn(i32)>(4) }(2);
| ^^^^^^^^^^

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0570`.
18 changes: 18 additions & 0 deletions tests/ui/abi/unsupported-varargs-fnptr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// FIXME(workingjubilee): add revisions and generalize to other platform-specific varargs ABIs,
// preferably after the only-arch directive is enhanced with an "or pattern" syntax
//@ only-x86_64

// We have to use this flag to force ABI computation of an invalid ABI
//@ compile-flags: -Clink-dead-code

#![feature(extended_varargs_abi_support)]

// sometimes fn ptrs with varargs make layout and ABI computation ICE
// as found in https://github.com/rust-lang/rust/issues/142107

fn aapcs(f: extern "aapcs" fn(usize, ...)) {
//~^ ERROR [E0570]
// Note we DO NOT have to actually make a call to trigger the ICE!
}

fn main() {}
9 changes: 9 additions & 0 deletions tests/ui/abi/unsupported-varargs-fnptr.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0570]: "aapcs" is not a supported ABI for the current target
--> $DIR/unsupported-varargs-fnptr.rs:13:20
|
LL | fn aapcs(f: extern "aapcs" fn(usize, ...)) {
| ^^^^^^^

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0570`.
447 changes: 135 additions & 312 deletions tests/ui/abi/unsupported.aarch64.stderr

Large diffs are not rendered by default.

407 changes: 122 additions & 285 deletions tests/ui/abi/unsupported.arm.stderr

Large diffs are not rendered by default.

253 changes: 53 additions & 200 deletions tests/ui/abi/unsupported.i686.stderr
Original file line number Diff line number Diff line change
@@ -1,234 +1,87 @@
warning: the calling convention "ptx-kernel" is not supported on this target
--> $DIR/unsupported.rs:38:15
error[E0570]: "ptx-kernel" is not a supported ABI for the current target
--> $DIR/unsupported.rs:36:8
|
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^
LL | extern "ptx-kernel" fn ptx() {}
| ^^^^^^^^^^^^

error[E0570]: "ptx-kernel" is not a supported ABI for the current target
--> $DIR/unsupported.rs:38:22
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
| ^^^^^^^^^^^^

error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:43:1
error[E0570]: "ptx-kernel" is not a supported ABI for the current target
--> $DIR/unsupported.rs:42:8
|
LL | extern "ptx-kernel" {}
| ^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^

warning: the calling convention "aapcs" is not supported on this target
--> $DIR/unsupported.rs:50:17
error[E0570]: "gpu-kernel" is not a supported ABI for the current target
--> $DIR/unsupported.rs:44:8
|
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
| ^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "gpu-kernel" fn gpu() {}
| ^^^^^^^^^^^^

error[E0570]: `"aapcs"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:55:1
error[E0570]: "aapcs" is not a supported ABI for the current target
--> $DIR/unsupported.rs:47:8
|
LL | extern "aapcs" {}
| ^^^^^^^^^^^^^^^^^
LL | extern "aapcs" fn aapcs() {}
| ^^^^^^^

warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/unsupported.rs:60:18
error[E0570]: "aapcs" is not a supported ABI for the current target
--> $DIR/unsupported.rs:49:24
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
| ^^^^^^^

error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:65:1
error[E0570]: "aapcs" is not a supported ABI for the current target
--> $DIR/unsupported.rs:53:8
|
LL | extern "msp430-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | extern "aapcs" {}
| ^^^^^^^

warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/unsupported.rs:70:15
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/unsupported.rs:56:8
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "msp430-interrupt" {}
| ^^^^^^^^^^^^^^^^^^

error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:75:1
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/unsupported.rs:59:8
|
LL | extern "avr-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/unsupported.rs:80:17
|
LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
| ^^^^^^^^^^^^^^^

error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:86:1
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/unsupported.rs:62:8
|
LL | extern "riscv-interrupt-m" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^

warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target
--> $DIR/unsupported.rs:155:21
error[E0570]: "C-cmse-nonsecure-call" is not a supported ABI for the current target
--> $DIR/unsupported.rs:120:28
|
LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: "C-cmse-nonsecure-entry" is not a supported ABI for the current target
--> $DIR/unsupported.rs:125:8
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^

warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target
--> $DIR/unsupported.rs:163:22
error[E0570]: "C-cmse-nonsecure-entry" is not a supported ABI for the current target
--> $DIR/unsupported.rs:127:29
|
LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
| ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:168:1
error[E0570]: "C-cmse-nonsecure-entry" is not a supported ABI for the current target
--> $DIR/unsupported.rs:131:8
|
LL | extern "C-cmse-nonsecure-entry" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:36:1
|
LL | extern "ptx-kernel" fn ptx() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:45:1
|
LL | extern "gpu-kernel" fn gpu() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"aapcs"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:48:1
|
LL | extern "aapcs" fn aapcs() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:58:1
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:68:1
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:78:1
|
LL | extern "riscv-interrupt-m" fn riscv() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: functions with the "x86-interrupt" ABI cannot be called
--> $DIR/unsupported.rs:94:5
|
LL | f()
| ^^^
|
note: an `extern "x86-interrupt"` function can only be called using inline assembly
--> $DIR/unsupported.rs:94:5
|
LL | f()
| ^^^

error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target
--> $DIR/unsupported.rs:161:1
|
LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 14 previous errors; 7 warnings emitted
error: aborting due to 14 previous errors

For more information about this error, try `rustc --explain E0570`.
Future incompatibility report: Future breakage diagnostic:
warning: the calling convention "ptx-kernel" is not supported on this target
--> $DIR/unsupported.rs:38:15
|
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "aapcs" is not supported on this target
--> $DIR/unsupported.rs:50:17
|
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
| ^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/unsupported.rs:60:18
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/unsupported.rs:70:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/unsupported.rs:80:17
|
LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target
--> $DIR/unsupported.rs:155:21
|
LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Future breakage diagnostic:
warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target
--> $DIR/unsupported.rs:163:22
|
LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default

Loading