about summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-09-29 04:35:58 +0200
committerGitHub <noreply@github.com>2019-09-29 04:35:58 +0200
commit37333b5131ba867007964dfd9b20fe59a5c191ef (patch)
tree72b8bffece74edb60ba1a63398bff3bd28b8cbaf /src/test/ui/error-codes
parentb61e69433951e31f7bd746e22f516a48ad41623b (diff)
parent057f23d3ddabf8c89e5da371d724d1995e9655da (diff)
downloadrust-37333b5131ba867007964dfd9b20fe59a5c191ef.tar.gz
rust-37333b5131ba867007964dfd9b20fe59a5c191ef.zip
Rollup merge of #63492 - eddyb:cvarargs, r=nagisa,matthewjasper
Remove redundancy from the implementation of C variadics.

This cleanup was first described in https://github.com/rust-lang/rust/issues/44930#issuecomment-497163539:

* AST doesn't track `c_variadic: bool` anymore, relying solely on a trailing `CVarArgs` type in fn signatures
* HIR doesn't have a `CVarArgs` anymore, relying solely on `c_variadic: bool`
  * same for `ty::FnSig` (see tests for diagnostics improvements from that)
  * `{hir,mir}::Body` have one extra argument than the signature when `c_variadic == true`
  * `rustc_typeck` and `rustc_mir::{build,borrowck}` need to give that argument the right type (which no longer uses a lifetime parameter, but a function-internal scope)
* `rustc_target::abi::call` doesn't need special hacks anymore (since it never sees the `VaListImpl` now, it's all inside the body)

r? @nagisa / @rkruppe cc @dlrobertson @oli-obk
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0617.rs6
-rw-r--r--src/test/ui/error-codes/E0617.stderr20
2 files changed, 12 insertions, 14 deletions
diff --git a/src/test/ui/error-codes/E0617.rs b/src/test/ui/error-codes/E0617.rs
index 439c3db5768..c832e09ac11 100644
--- a/src/test/ui/error-codes/E0617.rs
+++ b/src/test/ui/error-codes/E0617.rs
@@ -1,5 +1,3 @@
-// ignore-tidy-linelength
-
 extern {
     fn printf(c: *const i8, ...);
 }
@@ -22,7 +20,7 @@ fn main() {
         //~^ ERROR can't pass `u16` to variadic function
         //~| HELP cast the value to `c_uint`
         printf(::std::ptr::null(), printf);
-        //~^ ERROR can't pass `for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaListImpl<'r>, ...) {printf}` to variadic function
-        //~| HELP cast the value to `for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaListImpl<'r>, ...)`
+        //~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function
+        //~| HELP cast the value to `unsafe extern "C" fn(*const i8, ...)`
     }
 }
diff --git a/src/test/ui/error-codes/E0617.stderr b/src/test/ui/error-codes/E0617.stderr
index d866320bbcd..7c4df099d0d 100644
--- a/src/test/ui/error-codes/E0617.stderr
+++ b/src/test/ui/error-codes/E0617.stderr
@@ -1,42 +1,42 @@
 error[E0617]: can't pass `f32` to variadic function
-  --> $DIR/E0617.rs:9:36
+  --> $DIR/E0617.rs:7:36
    |
 LL |         printf(::std::ptr::null(), 0f32);
    |                                    ^^^^ help: cast the value to `c_double`: `0f32 as c_double`
 
 error[E0617]: can't pass `i8` to variadic function
-  --> $DIR/E0617.rs:12:36
+  --> $DIR/E0617.rs:10:36
    |
 LL |         printf(::std::ptr::null(), 0i8);
    |                                    ^^^ help: cast the value to `c_int`: `0i8 as c_int`
 
 error[E0617]: can't pass `i16` to variadic function
-  --> $DIR/E0617.rs:15:36
+  --> $DIR/E0617.rs:13:36
    |
 LL |         printf(::std::ptr::null(), 0i16);
    |                                    ^^^^ help: cast the value to `c_int`: `0i16 as c_int`
 
 error[E0617]: can't pass `u8` to variadic function
-  --> $DIR/E0617.rs:18:36
+  --> $DIR/E0617.rs:16:36
    |
 LL |         printf(::std::ptr::null(), 0u8);
    |                                    ^^^ help: cast the value to `c_uint`: `0u8 as c_uint`
 
 error[E0617]: can't pass `u16` to variadic function
-  --> $DIR/E0617.rs:21:36
+  --> $DIR/E0617.rs:19:36
    |
 LL |         printf(::std::ptr::null(), 0u16);
    |                                    ^^^^ help: cast the value to `c_uint`: `0u16 as c_uint`
 
-error[E0617]: can't pass `for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaListImpl<'r>, ...) {printf}` to variadic function
-  --> $DIR/E0617.rs:24:36
+error[E0617]: can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function
+  --> $DIR/E0617.rs:22:36
    |
 LL |         printf(::std::ptr::null(), printf);
    |                                    ^^^^^^
-help: cast the value to `for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaListImpl<'r>, ...)`
+help: cast the value to `unsafe extern "C" fn(*const i8, ...)`
    |
-LL |         printf(::std::ptr::null(), printf as for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaListImpl<'r>, ...));
-   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |         printf(::std::ptr::null(), printf as unsafe extern "C" fn(*const i8, ...));
+   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 6 previous errors