Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 04b4b10

Browse filesBrowse files
committed
Stabilize extended_varargs_abi_support
1 parent eea6149 commit 04b4b10
Copy full SHA for 04b4b10

File tree

Expand file treeCollapse file tree

13 files changed

+11
-120
lines changed
Filter options
Expand file treeCollapse file tree

13 files changed

+11
-120
lines changed

‎compiler/rustc_feature/src/accepted.rs

Copy file name to clipboardExpand all lines: compiler/rustc_feature/src/accepted.rs
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ declare_features! (
160160
(accepted, explicit_generic_args_with_impl_trait, "1.63.0", Some(83701), None),
161161
/// Allows arbitrary expressions in key-value attributes at parse time.
162162
(accepted, extended_key_value_attributes, "1.54.0", Some(78835), None),
163+
/// Allows using `efiapi`, `aapcs`, `sysv64` and `win64` as calling
164+
/// convention for functions with varargs.
165+
(accepted, extended_varargs_abi_support, "1.65.0", Some(100189), None),
163166
/// Allows resolving absolute paths as paths from other crates.
164167
(accepted, extern_absolute_paths, "1.30.0", Some(44660), None),
165168
/// Allows `extern crate foo as bar;`. This puts `bar` into extern prelude.

‎compiler/rustc_feature/src/active.rs

Copy file name to clipboardExpand all lines: compiler/rustc_feature/src/active.rs
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,6 @@ declare_features! (
435435
(active, exhaustive_patterns, "1.13.0", Some(51085), None),
436436
/// Allows explicit tail calls via `become` expression.
437437
(incomplete, explicit_tail_calls, "1.72.0", Some(112788), None),
438-
/// Allows using `efiapi`, `sysv64` and `win64` as calling convention
439-
/// for functions with varargs.
440-
(active, extended_varargs_abi_support, "1.65.0", Some(100189), None),
441438
/// Allows defining `extern type`s.
442439
(active, extern_types, "1.23.0", Some(43467), None),
443440
/// Allows the use of `#[ffi_const]` on foreign functions.

‎compiler/rustc_hir_analysis/messages.ftl

Copy file name to clipboardExpand all lines: compiler/rustc_hir_analysis/messages.ftl
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ hir_analysis_value_of_associated_struct_already_specified =
310310
.label = re-bound here
311311
.previous_bound_label = `{$item_name}` bound here first
312312
313-
hir_analysis_variadic_function_compatible_convention = C-variadic function must have a compatible calling convention, like {$conventions}
313+
hir_analysis_variadic_function_compatible_convention = C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `aapcs`, `win64`, `sysv64` or `efiapi`
314314
.label = C-variadic function must have a compatible calling convention
315315
316316
hir_analysis_variances_of = {$variances_of}

‎compiler/rustc_hir_analysis/src/errors.rs

Copy file name to clipboardExpand all lines: compiler/rustc_hir_analysis/src/errors.rs
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,10 @@ pub(crate) struct MainFunctionGenericParameters {
422422

423423
#[derive(Diagnostic)]
424424
#[diag(hir_analysis_variadic_function_compatible_convention, code = "E0045")]
425-
pub(crate) struct VariadicFunctionCompatibleConvention<'a> {
425+
pub(crate) struct VariadicFunctionCompatibleConvention {
426426
#[primary_span]
427427
#[label]
428428
pub span: Span,
429-
pub conventions: &'a str,
430429
}
431430

432431
#[derive(Diagnostic)]

‎compiler/rustc_hir_analysis/src/lib.rs

Copy file name to clipboardExpand all lines: compiler/rustc_hir_analysis/src/lib.rs
+3-33Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ use rustc_middle::middle;
104104
use rustc_middle::query::Providers;
105105
use rustc_middle::ty::{self, Ty, TyCtxt};
106106
use rustc_middle::util;
107-
use rustc_session::parse::feature_err;
108-
use rustc_span::{symbol::sym, Span, DUMMY_SP};
107+
use rustc_span::{Span, DUMMY_SP};
109108
use rustc_target::spec::abi::Abi;
110109
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _;
111110
use rustc_trait_selection::traits::{self, ObligationCause, ObligationCtxt};
@@ -117,38 +116,9 @@ use rustc_hir::def::DefKind;
117116
fluent_messages! { "../messages.ftl" }
118117

119118
fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) {
120-
const CONVENTIONS_UNSTABLE: &str = "`C`, `cdecl`, `aapcs`, `win64`, `sysv64` or `efiapi`";
121-
const CONVENTIONS_STABLE: &str = "`C` or `cdecl`";
122-
const UNSTABLE_EXPLAIN: &str =
123-
"using calling conventions other than `C` or `cdecl` for varargs functions is unstable";
124-
125-
if !decl.c_variadic || matches!(abi, Abi::C { .. } | Abi::Cdecl { .. }) {
126-
return;
119+
if decl.c_variadic && !abi.supports_varargs() {
120+
tcx.sess.emit_err(errors::VariadicFunctionCompatibleConvention { span });
127121
}
128-
129-
let extended_abi_support = tcx.features().extended_varargs_abi_support;
130-
let conventions = match (extended_abi_support, abi.supports_varargs()) {
131-
// User enabled additional ABI support for varargs and function ABI matches those ones.
132-
(true, true) => return,
133-
134-
// Using this ABI would be ok, if the feature for additional ABI support was enabled.
135-
// Return CONVENTIONS_STABLE, because we want the other error to look the same.
136-
(false, true) => {
137-
feature_err(
138-
&tcx.sess.parse_sess,
139-
sym::extended_varargs_abi_support,
140-
span,
141-
UNSTABLE_EXPLAIN,
142-
)
143-
.emit();
144-
CONVENTIONS_STABLE
145-
}
146-
147-
(false, false) => CONVENTIONS_STABLE,
148-
(true, false) => CONVENTIONS_UNSTABLE,
149-
};
150-
151-
tcx.sess.emit_err(errors::VariadicFunctionCompatibleConvention { span, conventions });
152122
}
153123

154124
fn require_same_types<'tcx>(

‎compiler/rustc_span/src/symbol.rs

Copy file name to clipboardExpand all lines: compiler/rustc_span/src/symbol.rs
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,6 @@ symbols! {
708708
export_name,
709709
expr,
710710
extended_key_value_attributes,
711-
extended_varargs_abi_support,
712711
extern_absolute_paths,
713712
extern_crate_item_prelude,
714713
extern_crate_self,

‎src/doc/unstable-book/src/language-features/extended-varargs-abi-support.md

Copy file name to clipboardExpand all lines: src/doc/unstable-book/src/language-features/extended-varargs-abi-support.md
-10Lines changed: 0 additions & 10 deletions
This file was deleted.

‎tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs

Copy file name to clipboardExpand all lines: tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs
-17Lines changed: 0 additions & 17 deletions
This file was deleted.

‎tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr

Copy file name to clipboardExpand all lines: tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr
-49Lines changed: 0 additions & 49 deletions
This file was deleted.

‎tests/ui/c-variadic/variadic-ffi-1.stderr

Copy file name to clipboardExpand all lines: tests/ui/c-variadic/variadic-ffi-1.stderr
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
1+
error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `aapcs`, `win64`, `sysv64` or `efiapi`
22
--> $DIR/variadic-ffi-1.rs:9:5
33
|
44
LL | fn printf(_: *const u8, ...);

‎tests/ui/c-variadic/variadic-ffi-2.rs

Copy file name to clipboardExpand all lines: tests/ui/c-variadic/variadic-ffi-2.rs
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// ignore-arm stdcall isn't supported
2-
#![feature(extended_varargs_abi_support)]
32

43
fn baz(f: extern "stdcall" fn(usize, ...)) {
54
//~^ ERROR: C-variadic function must have a compatible calling convention,

‎tests/ui/c-variadic/variadic-ffi-2.stderr

Copy file name to clipboardExpand all lines: tests/ui/c-variadic/variadic-ffi-2.stderr
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `aapcs`, `win64`, `sysv64` or `efiapi`
2-
--> $DIR/variadic-ffi-2.rs:4:11
2+
--> $DIR/variadic-ffi-2.rs:3:11
33
|
44
LL | fn baz(f: extern "stdcall" fn(usize, ...)) {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention

‎tests/ui/error-codes/E0045.stderr

Copy file name to clipboardExpand all lines: tests/ui/error-codes/E0045.stderr
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
1+
error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `aapcs`, `win64`, `sysv64` or `efiapi`
22
--> $DIR/E0045.rs:1:17
33
|
44
LL | extern "Rust" { fn foo(x: u8, ...); }

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.