Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Rust #250

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiled_starters/rust/.codecrafters/compile.sh
Original file line number Diff line number Diff line change
@@ -8,4 +8,4 @@

set -e # Exit on failure

cargo build --release --target-dir=/tmp/codecrafters-redis-target --manifest-path Cargo.toml
cargo build --release --target-dir=/tmp/codecrafters-build-redis-rust --manifest-path Cargo.toml
4 changes: 1 addition & 3 deletions compiled_starters/rust/.codecrafters/run.sh
Original file line number Diff line number Diff line change
@@ -6,6 +6,4 @@
#
# Learn more: https://codecrafters.io/program-interface

set -e # Exit on failure

exec /tmp/codecrafters-redis-target/release/redis-starter-rust "$@"
exec /tmp/codecrafters-build-redis-rust/release/codecrafters-redis "$@"
404 changes: 13 additions & 391 deletions compiled_starters/rust/Cargo.lock

Large diffs are not rendered by default.

24 changes: 5 additions & 19 deletions compiled_starters/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
# DON'T EDIT THIS!
#
# Codecrafters relies on this file being intact to run tests successfully. Any changes
# here will not reflect when CodeCrafters tests your code, and might even cause build
# failures.
#
# DON'T EDIT THIS!
[package]
name = "redis-starter-rust"
name = "codecrafters-redis"
version = "0.1.0"
authors = ["Codecrafters <hello@codecrafters.io>"]
edition = "2021"
rust-version = "1.80"

# DON'T EDIT THIS!
#
# Codecrafters relies on this file being intact to run tests successfully. Any changes
# here will not reflect when CodeCrafters tests your code, and might even cause build
# failures.
#
# DON'T EDIT THIS!
[dependencies]
anyhow = "1.0.59" # error handling
bytes = "1.3.0" # helps manage buffers
thiserror = "1.0.32" # error handling
tokio = { version = "1.23.0", features = ["full"] } # async networking
anyhow = "1.0.68" # error handling
bytes = "1.3.0" # helps manage buffers
thiserror = "1.0.38" # error handling
2 changes: 1 addition & 1 deletion compiled_starters/rust/README.md
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ That's all!

Note: This section is for stages 2 and beyond.

1. Ensure you have `cargo (1.54)` installed locally
1. Ensure you have `cargo (1.80)` installed locally
1. Run `./your_program.sh` to run your Redis server, which is implemented in
`src/main.rs`. This command compiles your Rust project, so it might be slow
the first time you run it. Subsequent runs will be fast.
4 changes: 2 additions & 2 deletions compiled_starters/rust/codecrafters.yml
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@ debug: false
# Use this to change the Rust version used to run your code
# on Codecrafters.
#
# Available versions: rust-1.77
language_pack: rust-1.77
# Available versions: rust-1.80
language_pack: rust-1.80
4 changes: 2 additions & 2 deletions compiled_starters/rust/your_program.sh
Original file line number Diff line number Diff line change
@@ -14,11 +14,11 @@ set -e # Exit early if any commands fail
# - Edit .codecrafters/compile.sh to change how your program compiles remotely
(
cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory
cargo build --release --target-dir=/tmp/codecrafters-redis-target --manifest-path Cargo.toml
cargo build --release --target-dir=/tmp/codecrafters-build-redis-rust --manifest-path Cargo.toml
)

# Copied from .codecrafters/run.sh
#
# - Edit this to change how your program runs locally
# - Edit .codecrafters/run.sh to change how your program runs remotely
exec /tmp/codecrafters-redis-target/release/redis-starter-rust "$@"
exec /tmp/codecrafters-build-redis-rust/release/codecrafters-redis "$@"
13 changes: 13 additions & 0 deletions dockerfiles/rust-1.80.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# syntax=docker/dockerfile:1.7-labs
FROM rust:1.80-bookworm

# Rebuild the container if these files change
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="Cargo.toml,Cargo.lock"

WORKDIR /app

# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
COPY --exclude=.git --exclude=README.md . /app

# This runs cargo build
RUN .codecrafters/compile.sh
2 changes: 1 addition & 1 deletion solutions/rust/01-jm1/code/.codecrafters/compile.sh
Original file line number Diff line number Diff line change
@@ -8,4 +8,4 @@

set -e # Exit on failure

cargo build --release --target-dir=/tmp/codecrafters-redis-target --manifest-path Cargo.toml
cargo build --release --target-dir=/tmp/codecrafters-build-redis-rust --manifest-path Cargo.toml
4 changes: 1 addition & 3 deletions solutions/rust/01-jm1/code/.codecrafters/run.sh
Original file line number Diff line number Diff line change
@@ -6,6 +6,4 @@
#
# Learn more: https://codecrafters.io/program-interface

set -e # Exit on failure

exec /tmp/codecrafters-redis-target/release/redis-starter-rust "$@"
exec /tmp/codecrafters-build-redis-rust/release/codecrafters-redis "$@"
404 changes: 13 additions & 391 deletions solutions/rust/01-jm1/code/Cargo.lock

Large diffs are not rendered by default.

24 changes: 5 additions & 19 deletions solutions/rust/01-jm1/code/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
# DON'T EDIT THIS!
#
# Codecrafters relies on this file being intact to run tests successfully. Any changes
# here will not reflect when CodeCrafters tests your code, and might even cause build
# failures.
#
# DON'T EDIT THIS!
[package]
name = "redis-starter-rust"
name = "codecrafters-redis"
version = "0.1.0"
authors = ["Codecrafters <hello@codecrafters.io>"]
edition = "2021"
rust-version = "1.80"

# DON'T EDIT THIS!
#
# Codecrafters relies on this file being intact to run tests successfully. Any changes
# here will not reflect when CodeCrafters tests your code, and might even cause build
# failures.
#
# DON'T EDIT THIS!
[dependencies]
anyhow = "1.0.59" # error handling
bytes = "1.3.0" # helps manage buffers
thiserror = "1.0.32" # error handling
tokio = { version = "1.23.0", features = ["full"] } # async networking
anyhow = "1.0.68" # error handling
bytes = "1.3.0" # helps manage buffers
thiserror = "1.0.38" # error handling
2 changes: 1 addition & 1 deletion solutions/rust/01-jm1/code/README.md
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ That's all!

Note: This section is for stages 2 and beyond.

1. Ensure you have `cargo (1.54)` installed locally
1. Ensure you have `cargo (1.80)` installed locally
1. Run `./your_program.sh` to run your Redis server, which is implemented in
`src/main.rs`. This command compiles your Rust project, so it might be slow
the first time you run it. Subsequent runs will be fast.
4 changes: 2 additions & 2 deletions solutions/rust/01-jm1/code/codecrafters.yml
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@ debug: false
# Use this to change the Rust version used to run your code
# on Codecrafters.
#
# Available versions: rust-1.77
language_pack: rust-1.77
# Available versions: rust-1.80
language_pack: rust-1.80
4 changes: 2 additions & 2 deletions solutions/rust/01-jm1/code/your_program.sh
Original file line number Diff line number Diff line change
@@ -14,11 +14,11 @@ set -e # Exit early if any commands fail
# - Edit .codecrafters/compile.sh to change how your program compiles remotely
(
cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory
cargo build --release --target-dir=/tmp/codecrafters-redis-target --manifest-path Cargo.toml
cargo build --release --target-dir=/tmp/codecrafters-build-redis-rust --manifest-path Cargo.toml
)

# Copied from .codecrafters/run.sh
#
# - Edit this to change how your program runs locally
# - Edit .codecrafters/run.sh to change how your program runs remotely
exec /tmp/codecrafters-redis-target/release/redis-starter-rust "$@"
exec /tmp/codecrafters-build-redis-rust/release/codecrafters-redis "$@"
2 changes: 1 addition & 1 deletion starter_templates/rust/code/.codecrafters/compile.sh
Original file line number Diff line number Diff line change
@@ -8,4 +8,4 @@

set -e # Exit on failure

cargo build --release --target-dir=/tmp/codecrafters-redis-target --manifest-path Cargo.toml
cargo build --release --target-dir=/tmp/codecrafters-build-redis-rust --manifest-path Cargo.toml
4 changes: 1 addition & 3 deletions starter_templates/rust/code/.codecrafters/run.sh
Original file line number Diff line number Diff line change
@@ -6,6 +6,4 @@
#
# Learn more: https://codecrafters.io/program-interface

set -e # Exit on failure

exec /tmp/codecrafters-redis-target/release/redis-starter-rust "$@"
exec /tmp/codecrafters-build-redis-rust/release/codecrafters-redis "$@"
404 changes: 13 additions & 391 deletions starter_templates/rust/code/Cargo.lock

Large diffs are not rendered by default.

24 changes: 5 additions & 19 deletions starter_templates/rust/code/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
# DON'T EDIT THIS!
#
# Codecrafters relies on this file being intact to run tests successfully. Any changes
# here will not reflect when CodeCrafters tests your code, and might even cause build
# failures.
#
# DON'T EDIT THIS!
[package]
name = "redis-starter-rust"
name = "codecrafters-redis"
version = "0.1.0"
authors = ["Codecrafters <hello@codecrafters.io>"]
edition = "2021"
rust-version = "1.80"

# DON'T EDIT THIS!
#
# Codecrafters relies on this file being intact to run tests successfully. Any changes
# here will not reflect when CodeCrafters tests your code, and might even cause build
# failures.
#
# DON'T EDIT THIS!
[dependencies]
anyhow = "1.0.59" # error handling
bytes = "1.3.0" # helps manage buffers
thiserror = "1.0.32" # error handling
tokio = { version = "1.23.0", features = ["full"] } # async networking
anyhow = "1.0.68" # error handling
bytes = "1.3.0" # helps manage buffers
thiserror = "1.0.38" # error handling
4 changes: 2 additions & 2 deletions starter_templates/rust/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
attributes:
required_executable: cargo (1.54)
user_editable_file: src/main.rs
required_executable: cargo (1.80)
user_editable_file: src/main.rs