ourc Node: 2 Reference Next: 3 Limitations Prev: 1 Using ourc Up: Top

2 Reference

What ourc compiles, item by item. Each row rests on the compiler source, the boundary probes checked against rustc, the end-to-end programs, and the run of rustc 1.99.1’s tests/ui suite.

Anything not listed here is either refused or, rarely, a bug. A refusal is never a wrong answer.

2.1 Status words

supported

ourc compiles it, and the program behaves as rustc’s build does.

partial

Some forms compile and the rest are refused; the row says which.

refused

ourc stops with an error and exits 1.

Rows marked † were checked directly against the release binary.

2.2 Items

fn (free, nested, const fn, unsafe fn, extern "C" fn with a body)supported
struct (named, tuple, unit), struct update ..basesupported
enum (payloads, struct variants, explicit discriminants)supported#[non_exhaustive] within the crate
const, static, static mutpartialrefused: a const whose type implements Drop; a non-Sync static
trait (default methods, associated types and consts, supertraits, generic methods)supported
impl (inherent, trait, generic, blanket)supportedorphan rule enforced as rustc does
mod, use (self/super/crate, trees, as, globs, pub(crate))supportedinline modules and module files
type aliases, including generic onessupported
unionrefused
extern "C" { … } blocks (FFI)refused
extern crate, Cargo dependencies, multi-crate programsrefused
async fn, await, coroutinesrefused

2.3 Generics, traits and lifetimes

type parameters, bounds, where, turbofish, defaults, ?Sizedsupported
associated-type equality bounds (T: Iterator<Item = u8>)supported
lifetimes and elisionsupportedlifetimes are checked only partly (see 3.4)
higher-ranked bounds for<'a>supported†in where, dyn, impl and fn-pointer positions
const genericspartialon functions only; on types and traits refused
dyn Trait (Box<dyn T>, &dyn T, dyn Fn)partialuser traits; trait objects of std traits refused; non-dyn-compatible traits refused
impl Traitpartialargument and return position; elsewhere refused (E0562)
operator overloadingpartialAdd, Sub, Mul, Div, PartialEq and the compound-assignment traits; Neg and Index on user types refused†
specialization, type_alias_impl_trait, other nightly featuresrefusedany #![feature(..)] is refused

2.4 Expressions and patterns

closures (Fn/FnMut/FnOnce, move, boxed, returned as impl Fn, coerced to fn pointers)supported
match: guards, |, ranges, @, slice patterns, nested enumspartialrefused: .. before the end of a tuple pattern; nested patterns in struct-variant fields; writes through ref mut; non-primitive consts as patterns
if let, while let, let … elsesupported
if let chains (if let P = e && c)refusedan edition-2024 feature
loop/while/for, labels, break with a value, labelled blockssupported
ranges (a..b, ..=, open, as values, in slicing)supported
? on Option and Resultsupported
as castspartialnumeric casts (float to int saturates, as rustc); of the char casts only u8 as char
destructuring assignmentpartialtuples and arrays of plain names
&mutpartial&mut parameters and places; some mutating calls in value position refused
unsafe blocks, raw pointers, ptr::null/eq, transmute, size_ofpartiala pointer’s address as an integer is refused
inline assembly (asm!)refused

2.5 Types

i8–i64, u8–u64, isize, usize, bool, charsupported
i128, u128refused
f64supported
f32refused†“f32 is not implemented; f64 is”
references, slices, arrays ([x; N], nested), tuplessupported
str / StringsupportedUTF-8 text in source and at run time†
fn pointers (including extern "C" fn, unsafe fn)supported
!partialas a return type

2.6 Attributes

#[derive(..)]partialClone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash; any other derive refused
#[repr(C)], #[repr(u8)] and other integer reprssupported
#[repr(packed)], #[repr(align(N))]partialnot honoured; programs that observe the layout are refused
#[cfg(..)] on itemssupported
#![feature(..)]refused
procedural macrosrefused

2.7 macro_rules!

fragments expr, tt, ident, ty, literal, block, patsupported
repetition with separators, $(,)?, tt-munching, recursionsupported
hygiene of let bindings and labelssupported
:meta fragment, attributes inside matchersrefused
repetition separated by ;, nested repetition with a , separatorsupported†an inner separator other than , is refused
#[macro_export] macros reached by a module pathrefused

2.8 Drop order

Supported, and among the most heavily probed areas: reverse declaration order, inner scopes first, explicit drop, let _ =, temporaries (including the for head and lifetime extension), moves into iterators, reassignment, and drop glue for enum payloads and generic types.

2.9 Standard library

ourc does not compile std. It knows a core of it directly and maps those names onto its own runtime. Any std type, method or function not listed here is refused.

Integerspow, abs, min, max, cmp, count_ones, leading_zeros, trailing_zeros, rem_euclid, div_euclid, signum, checked_div, wrapping_add/sub/mul/neg/shl/shr, to_le; MIN and MAX. checked_add/sub/mul and saturating_add/sub below 64 bits; saturating_mul at 16 bits or fewer.
f64floor, ceil, round, abs, sqrt, powi, powf, max, min, signum, is_nan, is_infinite, is_finite, ln, exp, exp2, sin, cos, log2, log10.
charis_alphabetic, is_numeric, is_alphanumeric, is_whitespace, is_lowercase, is_uppercase, the is_ascii_* forms, to_ascii_uppercase, to_ascii_lowercase, to_string; char::from_u32.
str and Stringlen, is_empty, push, push_str, chars, char_indices, bytes, as_bytes, as_str, to_string, to_owned, clone, into, split, split_whitespace, trim, trim_start, trim_end, trim_matches, trim_start_matches, trim_end_matches, contains, find, rfind, starts_with, ends_with, to_uppercase, to_lowercase, repeat, replace, replacen, parse; String::new, with_capacity, from; join and concat on slices of strings. A closure as a string pattern is refused.
Vec, arrays, sliceslen, is_empty, push, pop, get, insert, remove, swap_remove, contains, clear, truncate, append, extend, reverse, swap, dedup, retain, sort, sort_unstable, sort_by, sort_by_key, binary_search (integer elements), windows, chunks, to_vec, clone, iter, iter_mut, into_iter, as_slice, as_mut_slice; Vec::new, Vec::with_capacity, vec![..]. Arrays: len, iter, into_iter. Sorting, max and min over struct or enum elements are refused.
Optionunwrap, expect, unwrap_or, unwrap_or_else, unwrap_or_default, is_some, is_none, map, map_or, and_then, ok_or, filter, copied, cloned.
Resultunwrap, expect, unwrap_or, is_ok, is_err, ok, map, map_err. and_then and unwrap_or_else are refused.†
HashMappartial: new, insert, get, remove, contains_key, len, is_empty, keys, iter, m[&k], entry(k).or_insert(v); keys of string or integer type; collect() into a map refused.
Box, Rc, ArcBox supported; Rc and Arc partial: new, clone, Rc::strong_count.
Cell, RefCell, Mutex, RwLockpartial: new, get, set, borrow, borrow_mut, lock, write, into_inner.
Iteratorsmap, filter, enumerate, zip, chain, flat_map, rev, take, skip, step_by, take_while, skip_while, cloned, copied; collect (into Vec or String), sum, product, count, max, min, max_by_key, min_by_key, last, next, nth, fold, reduce, any, all, position, find, partition; iter::empty, iter::once, iter::repeat(..).take(n); user impl Iterator. An adapter whose closure prints is refused: ourc evaluates iterators eagerly, which would change the output order.
TraitsClone, Copy, Debug, Display, Default (not on enums), PartialEq, Eq, PartialOrd, Ord, Hash, Iterator, IntoIterator, Drop, Deref, DerefMut, FromStr, Add/Sub/Mul/Div and their *Assign forms. A hand-written impl Debug used through {:?}, and Display or to_string of a struct, are refused.
Macrosprintln!, print!, eprintln!, eprint!, format!, write!, writeln!, vec!, panic!, assert!, assert_eq!, assert_ne!, debug_assert!, unreachable!, todo!, unimplemented!, matches!, concat!, stringify!. dbg! is refused.†
Format specs{}, {:?}, {N}, {name}, {{ and }}, fill and alignment (<, ^, >), 0, width, precision ({:.3}, {:8.3}), {:e}. Refused: {:x}, {:X}, {:b}, {:o}, {:+}† and width from an argument ({:1$}). {:?} of a HashMap inside format!, of generic enum payloads and of sequences of () is refused.
Free functionsstd::mem: swap, replace, take, size_of, size_of_val, align_of, transmute, zeroed. std::cmp: max, min, Ordering. std::process: exit. std::fs: read_to_string, read. std::env: args. std::thread: spawn and join, for a thread whose closure cannot panic. std::ptr: null, null_mut, eq, addr_eq, from_ref, from_mut.
RefusedHashSet, BTreeMap, BTreeSet, VecDeque, and any std type, method or function not listed here.

2.10 Known issues

Nothing is written to stderr on a panic or an Err from main.† stdout and the exit code (101, 1) match rustc; the panic message and the Error: … line are missing.