]> git.lizzy.rs Git - rust.git/commitdiff
ffi: rename VaList::copy to VaList::with_copy
authorDan Robertson <dan@dlrobertson.com>
Fri, 22 Mar 2019 16:09:16 +0000 (16:09 +0000)
committerDan Robertson <dan@dlrobertson.com>
Fri, 22 Mar 2019 22:28:07 +0000 (22:28 +0000)
Rename `VaList::copy` to `VaList::with_copy`.

src/libcore/ffi.rs
src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs
src/test/ui/c-variadic/variadic-ffi-4.rs
src/test/ui/c-variadic/variadic-ffi-4.stderr
src/test/ui/c-variadic/variadic-ffi-5.rs
src/test/ui/c-variadic/variadic-ffi-5.stderr

index 5cc9c25c21e0f81044eeac7d1f39a16601343edb..7ae3ced4bcedb31403f3b5a13ec6a157db7d4996 100644 (file)
@@ -189,7 +189,7 @@ pub unsafe fn arg<T: sealed_trait::VaArgSafe>(&mut self) -> T {
                reason = "the `c_variadic` feature has not been properly tested on \
                          all supported platforms",
                issue = "44930")]
-    pub unsafe fn copy<F, R>(&self, f: F) -> R
+    pub unsafe fn with_copy<F, R>(&self, f: F) -> R
             where F: for<'copy> FnOnce(VaList<'copy>) -> R {
         #[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
                       not(target_arch = "x86_64")),
index 96a238afaec05039a5c515bd7b79cfa3317f0523..163d50c4e4b4a1dfa7920bdbf96dff2e564f3ecb 100644 (file)
@@ -62,7 +62,7 @@ unsafe fn compare_c_str(ptr: *const c_char, val: &str) -> bool {
     continue_if!(ap.arg::<c_int>() == 16);
     continue_if!(ap.arg::<c_char>() == 'A' as c_char);
     continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Skip Me!"));
-    ap.copy(|mut ap| {
+    ap.with_copy(|mut ap| {
         if compare_c_str(ap.arg::<*const c_char>(), "Correct") {
             0
         } else {
index 9101be56456463361a4f6b6c5a19f413d8438e27..1c77479d02f4055ff120e5be72e1758a0a65e5fc 100644 (file)
@@ -13,7 +13,7 @@
 }
 
 pub unsafe extern "C" fn no_escape2(_: usize, ap: ...) {
-    let _ = ap.copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate lifetime
+    let _ = ap.with_copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate lifetime
 }
 
 pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
index a3e3f81b73d80b817417908b8b5924ba8609345b..311e2173702c8ae0a0375faeb2ff48fb4f062f7d 100644 (file)
@@ -15,29 +15,29 @@ LL |     ap
    |     ^^ lifetime `'static` required
 
 error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
-  --> $DIR/variadic-ffi-4.rs:16:28
+  --> $DIR/variadic-ffi-4.rs:16:33
    |
-LL |     let _ = ap.copy(|ap| { ap });
-   |                            ^^
+LL |     let _ = ap.with_copy(|ap| { ap });
+   |                                 ^^
    |
-note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 16:21...
-  --> $DIR/variadic-ffi-4.rs:16:21
+note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 16:26...
+  --> $DIR/variadic-ffi-4.rs:16:26
    |
-LL |     let _ = ap.copy(|ap| { ap });
-   |                     ^^^^^^^^^^^
+LL |     let _ = ap.with_copy(|ap| { ap });
+   |                          ^^^^^^^^^^^
    = note: ...so that the expression is assignable:
            expected core::ffi::VaList<'_>
               found core::ffi::VaList<'_>
 note: but, the lifetime must be valid for the method call at 16:13...
   --> $DIR/variadic-ffi-4.rs:16:13
    |
-LL |     let _ = ap.copy(|ap| { ap });
-   |             ^^^^^^^^^^^^^^^^^^^^
+LL |     let _ = ap.with_copy(|ap| { ap });
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^
 note: ...so type `core::ffi::VaList<'_>` of expression is valid during the expression
   --> $DIR/variadic-ffi-4.rs:16:13
    |
-LL |     let _ = ap.copy(|ap| { ap });
-   |             ^^^^^^^^^^^^^^^^^^^^
+LL |     let _ = ap.with_copy(|ap| { ap });
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0308]: mismatched types
   --> $DIR/variadic-ffi-4.rs:20:12
index d96482ff4d17aa982052229bd788ea48cd5ddae6..fcc80d9b0cca0a2d62682fd5ae1490f22c0da6a0 100644 (file)
@@ -16,7 +16,7 @@
 }
 
 pub unsafe extern "C" fn no_escape2(_: usize, ap: ...) {
-    let _ = ap.copy(|ap| { ap }); //~ ERROR: lifetime may not live long enough
+    let _ = ap.with_copy(|ap| { ap }); //~ ERROR: lifetime may not live long enough
 }
 
 pub unsafe extern "C" fn no_escape3(_: usize, ap0: &mut VaList, mut ap1: ...) {
index 2ad1964b6fc7bfdd074afb47012a127817e33337..8f1dfe8ba9b6342c387e83e728672c79acc6ec71 100644 (file)
@@ -15,13 +15,13 @@ LL |     ap
    |     ^^ lifetime `'static` required
 
 error: lifetime may not live long enough
-  --> $DIR/variadic-ffi-5.rs:19:28
+  --> $DIR/variadic-ffi-5.rs:19:33
    |
-LL |     let _ = ap.copy(|ap| { ap });
-   |                      ---   ^^ returning this value requires that `'1` must outlive `'2`
-   |                      | |
-   |                      | return type of closure is core::ffi::VaList<'2>
-   |                      has type `core::ffi::VaList<'1>`
+LL |     let _ = ap.with_copy(|ap| { ap });
+   |                           ---   ^^ returning this value requires that `'1` must outlive `'2`
+   |                           | |
+   |                           | return type of closure is core::ffi::VaList<'2>
+   |                           has type `core::ffi::VaList<'1>`
 
 error: lifetime may not live long enough
   --> $DIR/variadic-ffi-5.rs:23:5