Upgrade to rust 1.39.0 (#6939) (#6960)

automerge
This commit is contained in:
mergify[bot]
2019-11-14 12:55:54 -08:00
committed by Grimes
parent f895c3f66d
commit d0de05acaa
13 changed files with 36 additions and 11 deletions

View File

@@ -42,6 +42,7 @@ impl Transaction {
}
}
/// # Safety
pub unsafe fn into_native(self) -> TransactionNative {
TransactionNative {
signatures: CVec::into_native(self.signatures)
@@ -52,6 +53,7 @@ impl Transaction {
}
}
/// # Safety
#[allow(clippy::should_implement_trait)]
pub unsafe fn clone(&self) -> Self {
Self {
@@ -281,36 +283,43 @@ impl CVec<CompiledInstruction> {
}
}
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn free_transaction(tx: *mut Transaction) {
Box::from_raw(tx);
}
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn free_message(m: *mut Message) {
Box::from_raw(m);
}
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn free_message_header(mh: *mut MessageHeader) {
Box::from_raw(mh);
}
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn free_signature(s: *mut Signature) {
Box::from_raw(s);
}
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn free_compiled_instruction(i: *mut CompiledInstruction) {
Box::from_raw(i);
}
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn free_c_string(s: *mut c_char) {
CString::from_raw(s);
}
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn new_unsigned_transaction(message: *mut Message) -> *mut Transaction {
let message = Box::from_raw(message);
@@ -325,6 +334,8 @@ pub unsafe extern "C" fn new_unsigned_transaction(message: *mut Message) -> *mut
/// # Undefined Behavior
///
/// Causes UB if `seed` is not a pointer to an array of length 32 or if `seed` is `NULL`
///
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn generate_keypair(seed: *const u8) -> *mut Keypair {
let seed = <&[u8] as TryInto<&[u8; PUBLIC_KEY_LENGTH]>>::try_into(slice::from_raw_parts(
@@ -343,6 +354,8 @@ pub unsafe extern "C" fn generate_keypair(seed: *const u8) -> *mut Keypair {
/// # Undefined Behavior
///
/// Causes UB if `keypair` is `NULL` or if `keypair` in not a pointer to a valid `Keypair`
///
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn get_keypair_pubkey(keypair: *const Keypair) -> *mut Pubkey {
let keypair = if let Ok(k) = (*keypair).new_native() {
@@ -360,6 +373,8 @@ pub unsafe extern "C" fn get_keypair_pubkey(keypair: *const Keypair) -> *mut Pub
/// # Undefined Behavior
///
/// Causes UB if any of the input pointers is `NULL`, or if `tx` is not a valid `Transaction`
///
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn serialize_transaction(
tx: *mut Transaction,
@@ -385,6 +400,8 @@ pub unsafe extern "C" fn serialize_transaction(
/// # Undefined Behavior
///
/// Causes UB if `bytes` is `NULL`, or if `bytes` does not point to a valid array of length `len`
///
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn deserialize_transaction(
bytes: *const u8,
@@ -408,6 +425,8 @@ pub unsafe extern "C" fn deserialize_transaction(
///
/// Causes UB if any of the pointers is `NULL`, or if `keypairs` does not point to a valid array of
/// `Keypairs` of length `num_keypairs`
///
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn transaction_partial_sign(
tx: *mut Transaction,
@@ -457,6 +476,8 @@ pub unsafe extern "C" fn transaction_partial_sign(
///
/// Causes UB if `pubkey` is `NULL`, or if the returned c-string is freed by any method other than
/// calling `free_c_string()`
///
/// # Safety
#[no_mangle]
pub unsafe extern "C" fn get_pubkey_string(pubkey: *const Pubkey) -> *mut c_char {
if let Ok(s) = CString::new(format!("{}", *pubkey)) {