Upgrade to rust 1.39.0 (#6939)
* Upgrade to rust 1.39.0 * 1.39.0 clippy
This commit is contained in:
parent
f108f483b7
commit
e7f63cd336
@ -78,7 +78,7 @@ $ source $HOME/.cargo/env
|
||||
$ rustup component add rustfmt
|
||||
```
|
||||
|
||||
If your rustc version is lower than 1.38.0, please update it:
|
||||
If your rustc version is lower than 1.39.0, please update it:
|
||||
|
||||
```bash
|
||||
$ rustup update
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM solanalabs/rust:1.38.0
|
||||
FROM solanalabs/rust:1.39.0
|
||||
ARG date
|
||||
|
||||
RUN set -x \
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Note: when the rust version is changed also modify
|
||||
# ci/rust-version.sh to pick up the new image tag
|
||||
FROM rust:1.38.0
|
||||
FROM rust:1.39.0
|
||||
|
||||
# Add Google Protocol Buffers for Libra's metrics library.
|
||||
ENV PROTOC_VERSION 3.8.0
|
||||
|
@ -13,8 +13,8 @@
|
||||
# $ source ci/rust-version.sh
|
||||
#
|
||||
|
||||
stable_version=1.38.0
|
||||
nightly_version=2019-10-03
|
||||
stable_version=1.39.0
|
||||
nightly_version=2019-11-13
|
||||
|
||||
export rust_stable="$stable_version"
|
||||
export rust_stable_docker_image=solanalabs/rust:"$stable_version"
|
||||
|
@ -990,7 +990,7 @@ impl ClusterInfo {
|
||||
fn gossip_request(&mut self, stakes: &HashMap<Pubkey, u64>) -> Vec<(SocketAddr, Protocol)> {
|
||||
let pulls: Vec<_> = self.new_pull_requests(stakes);
|
||||
let pushes: Vec<_> = self.new_push_requests();
|
||||
vec![pulls, pushes].into_iter().flat_map(|x| x).collect()
|
||||
vec![pulls, pushes].into_iter().flatten().collect()
|
||||
}
|
||||
|
||||
/// At random pick a node and try to get updated changes from them
|
||||
|
@ -83,6 +83,7 @@ pub fn add_genesis_accounts(file: &str, genesis_config: &mut GenesisConfig) -> i
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn main() -> Result<(), Box<dyn error::Error>> {
|
||||
let default_bootstrap_leader_lamports = &sol_to_lamports(500.0).to_string();
|
||||
let default_bootstrap_leader_stake_lamports = &sol_to_lamports(0.5).to_string();
|
||||
|
@ -388,6 +388,7 @@ fn graph_forks(
|
||||
dot.join("\n")
|
||||
}
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
fn main() {
|
||||
const DEFAULT_ROOT_COUNT: &str = "1";
|
||||
solana_logger::setup_with_filter("solana=info");
|
||||
|
@ -150,7 +150,7 @@ impl LeaderScheduleCache {
|
||||
}
|
||||
start_index = 0;
|
||||
}
|
||||
first_slot.and_then(|slot| Some((slot, last_slot)))
|
||||
first_slot.map(|slot| (slot, last_slot))
|
||||
}
|
||||
|
||||
fn slot_leader_at_no_compute(&self, slot: Slot) -> Option<Pubkey> {
|
||||
|
@ -300,7 +300,7 @@ impl Accounts {
|
||||
},
|
||||
);
|
||||
|
||||
let mut versions: Vec<(Pubkey, u64, B)> = accumulator.into_iter().flat_map(|x| x).collect();
|
||||
let mut versions: Vec<(Pubkey, u64, B)> = accumulator.into_iter().flatten().collect();
|
||||
self.accounts_db.thread_pool.install(|| {
|
||||
versions.par_sort_by_key(|s| (s.0, s.1));
|
||||
});
|
||||
|
@ -62,7 +62,7 @@ pub fn validator_accounts(bank: &Bank) -> HashMap<Pubkey, Account> {
|
||||
.iter()
|
||||
.filter_map(|account_id| {
|
||||
bank.get_account(account_id)
|
||||
.and_then(|account| Some((*account_id, account)))
|
||||
.map(|account| (*account_id, account))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@ -73,7 +73,7 @@ pub fn archiver_accounts(bank: &Bank) -> HashMap<Pubkey, Account> {
|
||||
.iter()
|
||||
.filter_map(|account_id| {
|
||||
bank.get_account(account_id)
|
||||
.and_then(|account| Some((*account_id, account)))
|
||||
.map(|account| (*account_id, account))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ impl Transaction {
|
||||
}
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
pub unsafe fn into_native(self) -> TransactionNative {
|
||||
TransactionNative {
|
||||
signatures: CVec::into_native(self.signatures)
|
||||
@ -54,6 +55,7 @@ impl Transaction {
|
||||
}
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
#[allow(clippy::should_implement_trait)]
|
||||
pub unsafe fn clone(&self) -> Self {
|
||||
Self {
|
||||
@ -283,36 +285,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);
|
||||
@ -327,6 +336,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(
|
||||
@ -345,6 +356,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() {
|
||||
@ -362,6 +375,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,
|
||||
@ -387,6 +402,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,
|
||||
@ -410,6 +427,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,
|
||||
@ -459,6 +478,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)) {
|
||||
|
@ -38,6 +38,8 @@ macro_rules! entrypoint {
|
||||
}
|
||||
|
||||
/// Deserialize the input parameters
|
||||
///
|
||||
/// # Safety
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub unsafe fn deserialize<'a>(input: *mut u8) -> (&'a Pubkey, Vec<AccountInfo<'a>>, &'a [u8]) {
|
||||
let mut offset: usize = 0;
|
||||
|
@ -41,7 +41,7 @@ pub fn next_keyed_account<I: Iterator>(iter: &mut I) -> Result<I::Item, Instruct
|
||||
iter.next().ok_or(InstructionError::NotEnoughAccountKeys)
|
||||
}
|
||||
|
||||
pub fn limited_deserialize<T>(data: &[u8]) -> Result<(T), InstructionError>
|
||||
pub fn limited_deserialize<T>(data: &[u8]) -> Result<T, InstructionError>
|
||||
where
|
||||
T: serde::de::DeserializeOwned,
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user