Skip to content

Commit f242874

Browse files
become more nightly-sensitive
1 parent da4a1e6 commit f242874

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

compiler/rustc_hir_analysis/src/lib.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ fn require_c_abi_if_c_variadic(
116116
abi: ExternAbi,
117117
span: Span,
118118
) {
119+
const CONVENTIONS_UNSTABLE: &str =
120+
"`C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`";
119121
const CONVENTIONS_STABLE: &str = "`C` or `cdecl`";
120122
const UNSTABLE_EXPLAIN: &str =
121123
"using calling conventions other than `C` or `cdecl` for varargs functions is unstable";
@@ -148,7 +150,11 @@ fn require_c_abi_if_c_variadic(
148150
}
149151
_ => tcx.dcx().create_err(errors::VariadicFunctionCompatibleConvention {
150152
span,
151-
conventions: CONVENTIONS_STABLE,
153+
conventions: if tcx.sess.opts.unstable_features.is_nightly_build() {
154+
CONVENTIONS_UNSTABLE
155+
} else {
156+
CONVENTIONS_STABLE
157+
},
152158
}),
153159
}
154160
.emit();

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

+1-1
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.stderr

+1-1
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-2.rs:5:11
33
|
44
LL | fn baz(f: extern "stdcall" fn(usize, ...)) {

0 commit comments

Comments
 (0)