Editor only — Rust is not executed here
Online Rust Editor
Rust's syntax rewards a real editor — lifetimes, macros, traits and match arms all need proper highlighting to read well, and Monaco provides it in any browser. The borrow checker, however, is a compiler feature, and this page does not pretend to be a compiler.
Can you run Rust here? No — and that is deliberate.
AltF Code edits Rust; it does not compile it. There is no rustc or Cargo in a browser tab, so no borrow checking and no build happens here. Take the file to cargo run on your own machine.
A browser can execute only HTML, CSS and JavaScript. Everything else on AltF Code is a full editing surface — real highlighting, real editing, real files — and this page says so instead of advertising a compiler that does not exist.
Rust in the editor
A file named main.rs is highlighted with the rust grammar — the same grammar Visual Studio Code uses.
fn main() {
let nums = vec![3, 1, 4, 1, 5, 9];
let total: i32 = nums.iter().sum();
let evens: Vec<&i32> = nums.iter().filter(|n| *n % 2 == 0).collect();
println!("sum = {total}, evens = {evens:?}");
}
What you can do with Rust here
- Write a function, trait impl or match expression with correct highlighting for lifetimes, macros and attributes.
- Read a Rust snippet from a blog post or issue thread with proper colouring instead of plain text.
- Export a .rs file ready to drop into a Cargo project on your own machine.
Rust in this editor — the specifics
| File extension | .rs |
|---|---|
| Syntax grammar | Monaco "rust" — bundled, no download |
| Code intelligence | Syntax highlighting, bracket matching, comment toggling and word-based suggestions — no type checking |
| Runs in this page | No — editing and highlighting only |
| Run it locally with | cargo run |
| Cost / account | Free, no sign-up; files stay in your browser |
Rust editor — common questions
- Can I compile Rust in the browser here?
- No. rustc and Cargo are not available in a browser tab, so nothing is compiled or borrow-checked on this page. It is an editor — use cargo run locally for real builds.
- Will it catch borrow-checker errors?
- No. Those come from the compiler, and no compiler runs here. The editor helps you write and read Rust; correctness feedback comes from cargo check on your machine.
- Is it free, and does my code stay private?
- Free with no account, and your code never leaves the browser — it is saved only in local storage on your device.
- How do I run what I wrote?
- Create a project with cargo new, drop the file into src/, and run cargo run. For a single file, rustc main.rs && ./main also works.
Start writing Rust
The editor opens with a blank file and a cursor. Nothing to install, nothing to sign up for, and your work is saved in your own browser.
Open AltF Code