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 dd99f11

Browse filesBrowse files
authored
Rollup merge of #116161 - Soveu:varargs2, r=cjgillot
Stabilize `extended_varargs_abi_support` I think that is everything? If there is any documentation regarding `extern` and/or varargs to correct, let me know, some quick greps suggest that there might be none. Tracking issue: #100189
2 parents 76f3ff6 + 685f189 commit dd99f11
Copy full SHA for dd99f11

File tree

Expand file treeCollapse file tree

16 files changed

+12
-124
lines changed
Filter options
Expand file treeCollapse file tree

16 files changed

+12
-124
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
@@ -193,6 +193,9 @@ declare_features! (
193193
(accepted, expr_fragment_specifier_2024, "1.83.0", Some(123742)),
194194
/// Allows arbitrary expressions in key-value attributes at parse time.
195195
(accepted, extended_key_value_attributes, "1.54.0", Some(78835)),
196+
/// Allows using `efiapi`, `aapcs`, `sysv64` and `win64` as calling
197+
/// convention for functions with varargs.
198+
(accepted, extended_varargs_abi_support, "CURRENT_RUSTC_VERSION", Some(100189)),
196199
/// Allows resolving absolute paths as paths from other crates.
197200
(accepted, extern_absolute_paths, "1.30.0", Some(44660)),
198201
/// Allows `extern crate foo as bar;`. This puts `bar` into extern prelude.

‎compiler/rustc_feature/src/unstable.rs

Copy file name to clipboardExpand all lines: compiler/rustc_feature/src/unstable.rs
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,6 @@ declare_features! (
475475
(unstable, exhaustive_patterns, "1.13.0", Some(51085)),
476476
/// Allows explicit tail calls via `become` expression.
477477
(incomplete, explicit_tail_calls, "1.72.0", Some(112788)),
478-
/// Allows using `efiapi`, `sysv64` and `win64` as calling convention
479-
/// for functions with varargs.
480-
(unstable, extended_varargs_abi_support, "1.65.0", Some(100189)),
481478
/// Allows defining `extern type`s.
482479
(unstable, extern_types, "1.23.0", Some(43467)),
483480
/// Allow using 128-bit (quad precision) floating point numbers.

‎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
@@ -590,7 +590,7 @@ hir_analysis_value_of_associated_struct_already_specified =
590590
.label = re-bound here
591591
.previous_bound_label = `{$item_name}` bound here first
592592
593-
hir_analysis_variadic_function_compatible_convention = C-variadic function must have a compatible calling convention, like {$conventions}
593+
hir_analysis_variadic_function_compatible_convention = C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`
594594
.label = C-variadic function must have a compatible calling convention
595595
596596
hir_analysis_variances_of = {$variances}

‎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
@@ -672,11 +672,10 @@ pub(crate) struct MainFunctionGenericParameters {
672672

673673
#[derive(Diagnostic)]
674674
#[diag(hir_analysis_variadic_function_compatible_convention, code = E0045)]
675-
pub(crate) struct VariadicFunctionCompatibleConvention<'a> {
675+
pub(crate) struct VariadicFunctionCompatibleConvention {
676676
#[primary_span]
677677
#[label]
678678
pub span: Span,
679-
pub conventions: &'a str,
680679
}
681680

682681
#[derive(Diagnostic)]

‎compiler/rustc_hir_analysis/src/lib.rs

Copy file name to clipboardExpand all lines: compiler/rustc_hir_analysis/src/lib.rs
+2-29Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ use rustc_middle::middle;
9898
use rustc_middle::mir::interpret::GlobalId;
9999
use rustc_middle::query::Providers;
100100
use rustc_middle::ty::{self, Const, Ty, TyCtxt};
101-
use rustc_session::parse::feature_err;
102101
use rustc_span::Span;
103-
use rustc_span::symbol::sym;
104102
use rustc_trait_selection::traits;
105103

106104
use self::hir_ty_lowering::{FeedConstTy, HirTyLowerer};
@@ -113,34 +111,9 @@ fn require_c_abi_if_c_variadic(
113111
abi: ExternAbi,
114112
span: Span,
115113
) {
116-
const CONVENTIONS_UNSTABLE: &str =
117-
"`C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`";
118-
const CONVENTIONS_STABLE: &str = "`C` or `cdecl`";
119-
const UNSTABLE_EXPLAIN: &str =
120-
"using calling conventions other than `C` or `cdecl` for varargs functions is unstable";
121-
122-
if !decl.c_variadic || matches!(abi, ExternAbi::C { .. } | ExternAbi::Cdecl { .. }) {
123-
return;
114+
if decl.c_variadic && !abi.supports_varargs() {
115+
tcx.dcx().emit_err(errors::VariadicFunctionCompatibleConvention { span });
124116
}
125-
126-
let extended_abi_support = tcx.features().extended_varargs_abi_support();
127-
let conventions = match (extended_abi_support, abi.supports_varargs()) {
128-
// User enabled additional ABI support for varargs and function ABI matches those ones.
129-
(true, true) => return,
130-
131-
// Using this ABI would be ok, if the feature for additional ABI support was enabled.
132-
// Return CONVENTIONS_STABLE, because we want the other error to look the same.
133-
(false, true) => {
134-
feature_err(&tcx.sess, sym::extended_varargs_abi_support, span, UNSTABLE_EXPLAIN)
135-
.emit();
136-
CONVENTIONS_STABLE
137-
}
138-
139-
(false, false) => CONVENTIONS_STABLE,
140-
(true, false) => CONVENTIONS_UNSTABLE,
141-
};
142-
143-
tcx.dcx().emit_err(errors::VariadicFunctionCompatibleConvention { span, conventions });
144117
}
145118

146119
pub fn provide(providers: &mut Providers) {

‎library/std/src/lib.rs

Copy file name to clipboardExpand all lines: library/std/src/lib.rs
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@
290290
#![feature(doc_masked)]
291291
#![feature(doc_notable_trait)]
292292
#![feature(dropck_eyepatch)]
293-
#![feature(extended_varargs_abi_support)]
294293
#![feature(f128)]
295294
#![feature(f16)]
296295
#![feature(if_let_guard)]

‎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
-19Lines changed: 0 additions & 19 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
-52Lines changed: 0 additions & 52 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`, `system`, `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-arm.rs

Copy file name to clipboardExpand all lines: tests/ui/c-variadic/variadic-ffi-2-arm.rs
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ only-arm
22
//@ build-pass
3-
#![feature(extended_varargs_abi_support)]
43

54
fn aapcs(f: extern "aapcs" fn(usize, ...)) {
65
f(22, 44);

‎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
#[allow(unsupported_fn_ptr_calling_conventions)]
54
fn baz(f: extern "stdcall" fn(usize, ...)) {

‎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`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`
2-
--> $DIR/variadic-ffi-2.rs:5:11
2+
--> $DIR/variadic-ffi-2.rs:4:11
33
|
44
LL | fn baz(f: extern "stdcall" fn(usize, ...)) {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention

‎tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs

Copy file name to clipboardExpand all lines: tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ type WithTransparentTraitObject =
3939
//~^ ERROR return value of `"C-cmse-nonsecure-call"` function too large to pass via registers [E0798]
4040

4141
type WithVarArgs = extern "C-cmse-nonsecure-call" fn(u32, ...);
42-
//~^ ERROR C-variadic function must have a compatible calling convention, like `C` or `cdecl` [E0045]
42+
//~^ ERROR C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi` [E0045]

‎tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr

Copy file name to clipboardExpand all lines: tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ LL | extern "C-cmse-nonsecure-call" fn(WrapperTransparent) -> WrapperTranspa
6868
= note: functions with the `"C-cmse-nonsecure-call"` ABI must pass their result via the available return registers
6969
= note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
7070

71-
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
71+
error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`
7272
--> $DIR/generics.rs:41:20
7373
|
7474
LL | type WithVarArgs = extern "C-cmse-nonsecure-call" fn(u32, ...);

‎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`, `system`, `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.