Runtime: rustc 1.85

Rust Online Compiler (rustc 1.85)

Write, borrow-check, and run Rust programs online with Compilra’s rustc 1.85 sandbox. Practice ownership semantics, Result/Option pattern matching, iterators, and pre-supplied std::io::stdin parsing with full compiler diagnostics.

Why Use Compilra’s Rust Online Compiler?

rustc 1.85 & Standard Library (std)

Compile ownership-safe Rust code using Option, Result, traits, pattern matching, and iterators without installing rustup locally.

Actionable Borrow Checker Diagnostics

Read full rustc compiler diagnostics explaining lifetime bounds, move semantics, and suggested fixes right in the terminal.

Pre-Supplied std::io::stdin Support

Test command-line parsing and algorithmic input handling by placing lines into Stdin before pressing Run.

How to Use Compilra’s Rust Online Compiler

Compile safe Rust programs in your browser with rustc 1.85.

Step 01

Write Rust Inside fn main()

Use standard library types like Vec, String, HashMap, match expressions, and structs.

Step 02

Supply Optional Stdin

Enter pre-supplied input text in the Stdin panel before running if your code uses std::io::stdin().read_line().

Step 03

Compile with rustc 1.85

Press Run Code to type-check, borrow-check, compile, and run your Rust binary.

Step 04

Inspect Diagnostics & Stdout

Read println! output or rustc’s detailed compiler error annotations in the output panel.

Worked Example: Rust Reading std::io::stdin Input

Consume pre-supplied stdin into a String, filter integer tokens cleanly, and print the total.

Source Coderustc 1.85
use std::io::{self, Read};

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();

    let nums: Vec<i32> = input
        .split_whitespace()
        .filter_map(|s| s.parse::<i32>().ok())
        .collect();

    let sum: i32 = nums.iter().sum();
    println!("Read {} numbers, Sum: {}", nums.len(), sum);
}
Pre-Supplied Stdin (Input)
15 20 25
Verified Output (Stdout)
Read 3 numbers, Sum: 60

Supply test input lines in the Stdin box prior to running—input is provided before execution rather than typed live.

Frequently Asked Questions

Which version of Rust is available on Compilra?

Compilra runs rustc 1.85 with standard library (std) support using the compiler’s default edition.

Does Compilra show detailed Rust compiler borrow-check error messages?

Yes. The full diagnostic output from rustc—including error annotations, lifetime warnings, and compiler suggestions—is rendered in the console.

Can I read user input from std::io::stdin in Rust?

Yes. Add your input to the Standard Input (stdin) panel before clicking Run—input is pre-supplied prior to execution rather than typed live—and std::io::stdin().read_line(&mut buffer) will read from it.

How does the Rust borrow checker validate lifetimes and mutability in Compilra?

rustc evaluates ownership rules, mutable vs immutable references (& vs &mut), and lifetime bounds, providing actionable compiler diagnostics.

Are traits, enums, and pattern matching (match/if let) supported in Rust?

Yes. Rust’s type system—including Option<T>, Result<T, E>, exhaustive match expressions, and standard trait implementations—is functional.

Can I practice Rust algorithms on Compilra?

Yes. Compilra’s sandboxed compilation and execution workflow makes it convenient for practicing data structures and algorithmic exercises in Rust.

Ready to compile and run Rust code?

Practice Rust ownership, pattern matching, and algorithms with rustc 1.85 in your browser.

Open Rust Compiler