Skip to content

fix: compile a Cargo-less main.rs in ojt with edition 2024 and --cfg atcoder - #16

Merged
haiiro2gou merged 1 commit into
masterfrom
worktree-ojt-rustc-edition
Sep 24, 2026
Merged

haiiro2gou merged 1 commit into
masterfrom
worktree-ojt-rustc-edition

Conversation

@carbon-nil

Copy link
Copy Markdown
Owner

Summary

ojt built a main.rs without Cargo.toml with rustc -O main.rs, which differs from AtCoder in two ways:

  • no --edition, so edition 2015 instead of AtCoder's 2024
  • no --cfg atcoder, because it only lives in cargo's $CARGO_HOME/config.toml

It now runs rustc --edition 2024 -O --cfg atcoder main.rs. The README line describing this fallback is updated too. The Cargo.toml path (cargo build --release) is unchanged.

Closes #15

Test

In ghcr.io/carbon-nil/atcoder-docker:latest-light (4.1.0), with the fixed bin/ojt mounted over /usr/local/bin/ojt, ran ojt on the main.rs from the issue (let chains plus #[cfg(atcoder)]), expecting atcoder 1:

  • before: error[E0658]: let expressions in this position are unstable
  • after: AC, so both edition 2024 and cfg(atcoder) are in effect

CI build of both targets on amd64 and arm64: https://github.com/carbon-nil/atcoder-docker/actions/runs/35985309500

🤖 Generated with Claude Code

https://claude.ai/code/session_01VQaZJRoT1k7VZ8ThsuLdFa

…atcoder

rustc without --edition used edition 2015, and --cfg atcoder only lives in
cargo's config, so a single main.rs was built differently from AtCoder.

Closes #15

Co-Authored-By: Claude Code <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQaZJRoT1k7VZ8ThsuLdFa
@haiiro2gou
haiiro2gou merged commit e1bcc8d into master Sep 24, 2026
4 checks passed
@haiiro2gou
haiiro2gou deleted the worktree-ojt-rustc-edition branch September 24, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ojt が Cargo.toml の無い main.rs を edition 2015 で、--cfg atcoder なしでコンパイルする

2 participants