Commit e99aa1e1 authored by Graham King's avatar Graham King Committed by GitHub
Browse files

chore: Upgrade Rust to 1.86 (#518)

Also upgrade the cargo resolver to v3, the default.

New clippy lints:
- `next_back()` instead of `last()` for a double-ended iterator. That avoids walking the whole list.
- ` repeat_n` instead of `repeat.take`. That avoids cloning.
- Doc indenting
parent 123f3386
...@@ -66,7 +66,7 @@ jobs: ...@@ -66,7 +66,7 @@ jobs:
if: ${{ env.ACT }} if: ${{ env.ACT }}
run: | run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
rustup toolchain install 1.85.0-x86_64-unknown-linux-gnu rustup toolchain install 1.86.0-x86_64-unknown-linux-gnu
echo "$HOME/.cargo/bin" >> $GITHUB_PATH echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Set up Rust Toolchain Components - name: Set up Rust Toolchain Components
run: rustup component add rustfmt clippy run: rustup component add rustfmt clippy
......
...@@ -22,7 +22,7 @@ members = [ ...@@ -22,7 +22,7 @@ members = [
"lib/bindings/c", "lib/bindings/c",
"lib/engines/*", "lib/engines/*",
] ]
resolver = "2" resolver = "3"
[workspace.package] [workspace.package]
version = "0.1.0" version = "0.1.0"
......
...@@ -73,13 +73,13 @@ rust-base: ...@@ -73,13 +73,13 @@ rust-base:
ENV RUSTUP_HOME=/usr/local/rustup ENV RUSTUP_HOME=/usr/local/rustup
ENV CARGO_HOME=/usr/local/cargo ENV CARGO_HOME=/usr/local/cargo
ENV PATH=/usr/local/cargo/bin:$PATH ENV PATH=/usr/local/cargo/bin:$PATH
ENV RUST_VERSION=1.85.0 ENV RUST_VERSION=1.86.0
ENV RUSTARCH=x86_64-unknown-linux-gnu ENV RUSTARCH=x86_64-unknown-linux-gnu
RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/x86_64-unknown-linux-gnu/rustup-init" && \ RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/x86_64-unknown-linux-gnu/rustup-init" && \
echo "a3339fb004c3d0bb9862ba0bce001861fe5cbde9c10d16591eb3f39ee6cd3e7f *rustup-init" | sha256sum -c - && \ echo "a3339fb004c3d0bb9862ba0bce001861fe5cbde9c10d16591eb3f39ee6cd3e7f *rustup-init" | sha256sum -c - && \
chmod +x rustup-init && \ chmod +x rustup-init && \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.85.0 --default-host x86_64-unknown-linux-gnu && \ ./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.86.0 --default-host x86_64-unknown-linux-gnu && \
rm rustup-init && \ rm rustup-init && \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME chmod -R a+w $RUSTUP_HOME $CARGO_HOME
......
...@@ -25,7 +25,7 @@ RUN apt update -y && \ ...@@ -25,7 +25,7 @@ RUN apt update -y && \
ENV RUSTUP_HOME=/usr/local/rustup \ ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \ CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \ PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.85.0 \ RUST_VERSION=1.86.0 \
RUSTARCH=x86_64-unknown-linux-gnu RUSTARCH=x86_64-unknown-linux-gnu
RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/${RUSTARCH}/rustup-init" && \ RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/${RUSTARCH}/rustup-init" && \
......
...@@ -68,7 +68,7 @@ RUN apt-get update && \ ...@@ -68,7 +68,7 @@ RUN apt-get update && \
ENV RUSTUP_HOME=/usr/local/rustup \ ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \ CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \ PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.85.0 \ RUST_VERSION=1.86.0 \
RUSTARCH=x86_64-unknown-linux-gnu RUSTARCH=x86_64-unknown-linux-gnu
RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/${RUSTARCH}/rustup-init" && \ RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/${RUSTARCH}/rustup-init" && \
......
...@@ -237,7 +237,7 @@ RUN apt update -y && \ ...@@ -237,7 +237,7 @@ RUN apt update -y && \
ENV RUSTUP_HOME=/usr/local/rustup \ ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \ CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \ PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.85.0 \ RUST_VERSION=1.86.0 \
RUSTARCH=x86_64-unknown-linux-gnu RUSTARCH=x86_64-unknown-linux-gnu
RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/${RUSTARCH}/rustup-init" && \ RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/${RUSTARCH}/rustup-init" && \
......
...@@ -100,7 +100,7 @@ pub async fn run( ...@@ -100,7 +100,7 @@ pub async fn run(
.or_else(|| { .or_else(|| {
model_path model_path
.as_ref() .as_ref()
.and_then(|p| p.iter().last()) .and_then(|p| p.iter().next_back())
.map(|n| n.to_string_lossy().into_owned()) .map(|n| n.to_string_lossy().into_owned())
}) })
.or_else(|| { .or_else(|| {
...@@ -116,7 +116,7 @@ pub async fn run( ...@@ -116,7 +116,7 @@ pub async fn run(
if !inner_model_path.exists() { if !inner_model_path.exists() {
model_name = inner_model_path model_name = inner_model_path
.iter() .iter()
.last() .next_back()
.map(|s| s.to_string_lossy().to_string()); .map(|s| s.to_string_lossy().to_string());
model_path = Some(hub::from_hf(inner_model_path).await?); model_path = Some(hub::from_hf(inner_model_path).await?);
} }
......
...@@ -139,7 +139,7 @@ impl ...@@ -139,7 +139,7 @@ impl
let (request, context) = incoming_request.transfer(()); let (request, context) = incoming_request.transfer(());
let deltas = request.response_generator(); let deltas = request.response_generator();
let ctx = context.context(); let ctx = context.context();
let req = request.inner.messages.into_iter().last().unwrap(); let req = request.inner.messages.into_iter().next_back().unwrap();
let prompt = match req { let prompt = match req {
async_openai::types::ChatCompletionRequestMessage::User(user_msg) => { async_openai::types::ChatCompletionRequestMessage::User(user_msg) => {
......
...@@ -822,9 +822,7 @@ impl KvIndexerInterface for KvIndexerSharded { ...@@ -822,9 +822,7 @@ impl KvIndexerInterface for KvIndexerSharded {
- (scores.frequencies.len() as i64); - (scores.frequencies.len() as i64);
if diff > 0 { if diff > 0 {
scores scores.frequencies.extend(iter::repeat_n(0, diff as usize));
.frequencies
.extend(iter::repeat(0).take(diff as usize));
} }
for i in 0..response.frequencies.len() { for i in 0..response.frequencies.len() {
......
...@@ -62,7 +62,7 @@ impl ModelDeploymentCard { ...@@ -62,7 +62,7 @@ impl ModelDeploymentCard {
let model_name = model_name.map(|s| s.to_string()).or_else(|| { let model_name = model_name.map(|s| s.to_string()).or_else(|| {
gguf_file gguf_file
.iter() .iter()
.last() .next_back()
.map(|n| n.to_string_lossy().to_string()) .map(|n| n.to_string_lossy().to_string())
}); });
let Some(model_name) = model_name else { let Some(model_name) = model_name else {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
//! The Preprocessor consists of the following modules //! The Preprocessor consists of the following modules
//! //!
//! - `translation`: This module converts the allowed Ingress message types to the corresponding //! - `translation`: This module converts the allowed Ingress message types to the corresponding
//! internal representation. //! internal representation.
//! - `apply`: This module applies ModelConfig defaults to any empty optional fields specified //! - `apply`: This module applies ModelConfig defaults to any empty optional fields specified
//! - `prompt`: This module applies any prompt template logic to the internal Request object. //! - `prompt`: This module applies any prompt template logic to the internal Request object.
//! - `tokenize`: This module tokenizes the formatted prompt string and returns the token ids. //! - `tokenize`: This module tokenizes the formatted prompt string and returns the token ids.
......
...@@ -18,7 +18,7 @@ members = [ ...@@ -18,7 +18,7 @@ members = [
"hello_world", "hello_world",
"service_metrics", "service_metrics",
] ]
resolver = "2" resolver = "3"
[workspace.package] [workspace.package]
version = "0.1.0" version = "0.1.0"
...@@ -31,4 +31,4 @@ repository = "https://github.com/ai-dynamo/dynamo.git" ...@@ -31,4 +31,4 @@ repository = "https://github.com/ai-dynamo/dynamo.git"
[workspace.dependencies] [workspace.dependencies]
# local or crates.io # local or crates.io
dynamo-runtime = { path = "../" } dynamo-runtime = { path = "../" }
\ No newline at end of file
[toolchain] [toolchain]
channel = "1.85.0" channel = "1.86.0"
...@@ -96,7 +96,7 @@ impl RuntimeConfig { ...@@ -96,7 +96,7 @@ impl RuntimeConfig {
/// Load the runtime configuration from the environment and configuration files /// Load the runtime configuration from the environment and configuration files
/// Configuration is priorities in the following order, where the last has the lowest priority: /// Configuration is priorities in the following order, where the last has the lowest priority:
/// 1. Environment variables (top priority) /// 1. Environment variables (top priority)
/// TO DO: Add documentation for configuration files. Paths should be configurable. /// TO DO: Add documentation for configuration files. Paths should be configurable.
/// 2. /opt/dynamo/etc/runtime.toml /// 2. /opt/dynamo/etc/runtime.toml
/// 3. /opt/dynamo/defaults/runtime.toml (lowest priority) /// 3. /opt/dynamo/defaults/runtime.toml (lowest priority)
/// ///
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
//! There are two context object defined in this module: //! There are two context object defined in this module:
//! //!
//! - [`Context`] is an input context which is propagated through the processing pipeline, //! - [`Context`] is an input context which is propagated through the processing pipeline,
//! up to the point where the input is pass to an [`crate::engine::AsyncEngine`] for processing. //! up to the point where the input is pass to an [`crate::engine::AsyncEngine`] for processing.
//! - [`StreamContext`] is the input context transformed into to a type erased context that maintains the inputs //! - [`StreamContext`] is the input context transformed into to a type erased context that maintains the inputs
//! registry and visitors. `StreamAdaptors` will amend themselves to the [`StreamContext`] to allow for the //! registry and visitors. `StreamAdaptors` will amend themselves to the [`StreamContext`] to allow for the
......
...@@ -67,7 +67,7 @@ impl EndpointInfo { ...@@ -67,7 +67,7 @@ impl EndpointInfo {
let id = self let id = self
.subject .subject
.split('-') .split('-')
.last() .next_back()
.ok_or_else(|| error!("No id found in subject"))?; .ok_or_else(|| error!("No id found in subject"))?;
i64::from_str_radix(id, 16).map_err(|e| error!("Invalid id format: {}", e)) i64::from_str_radix(id, 16).map_err(|e| error!("Invalid id format: {}", e))
......
[toolchain] [toolchain]
channel = "1.85.0" channel = "1.86.0"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment