Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Rust (programming language)

This is a good article. Click here for more information.
From Wikipedia, the free encyclopedia
General-purpose programming language

Rust
Rust logo; a capital letter R set into a sprocket
Paradigms
DeveloperThe Rust Team
First appearedJanuary 19, 2012; 13 years ago (2012-01-19)
Stable release
1.91.1[1] Edit this on Wikidata / November 10, 2025; 18 days ago (November 10, 2025)
Typing discipline
Implementation languageOCaml (2006–2011)
Rust (2012–present)
PlatformCross-platform[note 1]
OSCross-platform[note 2]
LicenseMIT,Apache 2.0[note 3]
Filename extensions.rs,.rlib
Websiterust-lang.org
Influenced by
Influenced

Rust is ageneral-purposeprogramming language. It is noted for its emphasis onperformance,type safety,concurrency, andmemory safety.

Rust supports multipleprogramming paradigms. It was influenced by ideas fromfunctional programming, includingimmutability,higher-order functions,algebraic data types, andpattern matching. It also supportsobject-oriented programming via structs,enums, traits, and methods. Rust is noted for enforcing memory safety (i.e., that allreferences point to valid memory) without a conventionalgarbage collector; instead, memory safety errors anddata races are prevented by the "borrow checker", which tracks theobject lifetime of referencesat compile time.

Software developer Graydon Hoare created Rust in 2006 while working atMozilla, which officially sponsored the project in 2009. The first stable release, Rust 1.0, was published in May 2015. Following a layoff of Mozilla employees in August 2020, four other companies joined Mozilla in sponsoring Rust through the creation of theRust Foundation in February 2021.

Rust has been adopted by many software projects, especiallyweb services andsystem software. It has been studied academically and has a growing community of developers.

History

[edit]

2006–2009: Early years

[edit]
Mozilla Foundation headquarters, 650 Castro Street inMountain View, California, June 2009

Rust began as a personal project byMozilla employee Graydon Hoare in 2006. According toMIT Technology Review, he started the project due to his frustration with a broken elevator in his apartment building whose software had crashed,[15] and named the language after thegroup of fungi of the same name that is "over-engineered for survival".[15] During the time period between 2006 and 2009, Rust was not publicized to others at Mozilla and was written in Hoare's free time;[16]: 7:50  Hoare began speaking about the language around 2009 after a small group at Mozilla became interested in the project.[17] Hoare cited languages from the 1970s, 1980s, and 1990s as influences — includingCLU,BETA,Mesa, NIL,[note 4]Erlang,Newsqueak,Napier,Hermes,Sather,Alef, andLimbo.[17] He described the language as "technology from the past come to save the future from itself."[16]: 8:17 [17] Early Rust developer Manish Goregaokar similarly described Rust as being based on "mostly decades-old research."[15]

During the early years, the Rustcompiler was written in about 38,000 lines ofOCaml.[16]: 15:34 [18] Features of early Rust that were later removed include explicitobject-oriented programming via anobj keyword,[16]: 10:08  and atypestates system for variable state changes (such as going from uninitialized to initialized).[16]: 13:12 

2009–2012: Mozilla sponsorship

[edit]

Mozilla officially sponsored the Rust project in 2009.[15]Brendan Eich and other executives, intrigued by the possibility of using Rust for a safeweb browserengine, placed engineers on the project including Patrick Walton, Niko Matsakis, Felix Klock, and Manish Goregaokar.[15] A conference room taken by the project developers was dubbed "the nerd cave," with a sign placed outside the door.[15]

During this time period, work had shifted from the initial OCaml compiler to aself-hosting compiler (i.e., written in Rust) targettingLLVM.[19][note 5] The ownership system was in place by 2010.[15] The Rust logo was developed in 2011 based on a bicycle chainring.[21]

Rust 0.1 became the first public release on January 20, 2012[22] for Windows, Linux, and MacOS.[23] The early 2010s witnessed an increasing number of full-time engineers at Mozilla, as well as increasing involvement from open source volunteers outside of Mozilla and outside of the United States.[15]

2012–2015: Evolution

[edit]

The years from 2012 to 2015 were marked by substantial changes to the Rusttype system.[16]: 18:36 [15] Memory management through the ownership system was gradually consolidated and expanded. By 2013, thegarbage collector was rarely used, and was removed in favor of the ownership system.[15] Other features were removed in order to simplify the language, including typestates, thepure keyword,[24] various specialized pointer types, and syntax support forchannels.[16]: 22:32 

According to Steve Klabnik, Rust was influenced during this period by developers coming fromC++ (e.g., low-level performance of features),scripting languages (e.g., Cargo and package management), andfunctional programming (e.g., type systems development).[16]: 30:50 

Graydon Hoare stepped down from Rust in 2013.[15] After Hoare's departure, it evolved organically under a federated governance structure, with a "core team" of initially six people,[16]: 21:45  and around 30-40 developers total across various other teams.[16]: 22:22  ARequest for Comments (RFC) process for new language features was added in March 2014.[16]: 33:47  The core team would grow to nine people by 2016[16]: 21:45  with over 1600 RFCs.[16]: 34:08 

According to Andrew Binstock forDr. Dobb's Journal in January 2014, while Rust was "widely viewed as a remarkably elegant language", adoption slowed because it radically changed from version to version.[25] Rust development at this time focused on finalizing features for version 1.0 so that it could begin promisingbackward compatibility.[16]: 41:26 

Six years after Mozilla's sponsorship, Rust 1.0 was published and became the firststable release on May 15, 2015.[15] A year after, the Rust compiler had accumulated over 1,400 contributors and there were over 5,000 third-party libraries published on the Rust package management website Crates.io.[16]: 43:15 

2015–2020: Servo and early adoption

[edit]
Early homepage of Mozilla'sServo browser engine

The development of theServo browser engine continued in parallel with Rust, jointly funded by Mozilla andSamsung.[26] The teams behind the two projects worked in close collaboration; new features in Rust were tested out by the Servo team, and new features in Servo were used to give feedback back to the Rust team.[16]: 5:41  The first version of Servo was released in 2016.[15] TheFirefox web browser shipped with Rust code as of 2016 (version 45),[16]: 53:30 [27] but components of Servo did not appear in Firefox until September 2017 (version 57) as part of theGecko andQuantum projects.[28]

Improvements were made to the Rust toolchain ecosystem during the years following 1.0 includingRustfmt,integrated development environment integration,[16]: 44:56  and a regular compiler testing and release cycle.[16]: 46:48  Rust gained a communitycode of conduct and anIRC chat for community discussion.[16]: 50:36 

The earliest known adoption outside of Mozilla was by individual projects at Samsung,Facebook (nowMeta Platforms),Dropbox, and Tilde, Inc., the company behindember.js.[16]: 55:44 [15]Amazon Web Services followed in 2020.[15] Engineers cited performance, lack of a garbage collector, safety, and pleasantness of working in the language as reasons for the adoption. Amazon developers cited a finding by Portuguese researchers that Rust code usedless energy compared to similar code written inJava.[15][29]

2020–present: Mozilla layoffs and Rust Foundation

[edit]

In August 2020, Mozilla laid off 250 of its 1,000 employees worldwide, as part of a corporate restructuring caused by theCOVID-19 pandemic.[30][31] The team behind Servo was disbanded. The event raised concerns about the future of Rust.[32] In the following week, the Rust Core Team acknowledged the severe impact of the layoffs and announced that plans for a Rust foundation were underway. The first goal of the foundation would be to take ownership of alltrademarks anddomain names and to take financial responsibility for their costs.[33]

On February 8, 2021, the formation of theRust Foundation was announced by five founding companies:Amazon Web Services,Google,Huawei,Microsoft, andMozilla.[34][35] The foundation would provide financial support for Rust developers in the form of grants and server funding.[15] In a blog post published on April 6, 2021, Google announced support for Rust within theAndroid Open Source Project as an alternative to C/C++.[36]

On November 22, 2021, the Moderation Team, which was responsible for enforcing the community code of conduct, announced their resignation "in protest of the Core Team placing themselves unaccountable to anyone but themselves".[37] In May 2022, members of the Rust leadership council posted a public response to the incident.[38]

The Rust Foundation posted a draft for a new trademark policy on April 6, 2023, which resulted in widespread negative reactions from Rust users and contributors.[39] The trademark policy included rules for how the Rust logo and name could be used.[39]

On February 26, 2024, the U.S.White HouseOffice of the National Cyber Director released a 19-page press report urging software development to move away from C and C++ to memory-safe languages like C#, Go, Java, Ruby, Swift, and Rust.[40][41][42]

Syntax and features

[edit]
Main article:Rust syntax

Rust'ssyntax is similar to that ofC and C++,[43][44] although many of its features were influenced byfunctional programming languages such asOCaml.[45] Hoare has described Rust as targeted at frustrated C++ developers and emphasized safety, control ofmemory layout, andconcurrency.[17]

Hello World program

[edit]

Below is a"Hello, World!" program in Rust. Thefn keyword denotes afunction, and theprintln!macro (see§ Macros) prints the message tostandard output.[46]Statements in Rust are separated bysemicolons.

fnmain(){println!("Hello, World!");}

Variables

[edit]

Variables in Rust are defined through thelet keyword.[47] The example below assigns a value to the variable with namefoo of typei32 and outputs its value; the type annotation:i32 can be omitted.

fnmain(){letfoo:i32=10;println!("The value of foo is {foo}");}

Variables areimmutable by default, unless themut keyword is added.[48] The following example uses//, which denotes the start of acomment.[49]

fnmain(){// This code would not compile without adding "mut".letmutfoo=10;println!("The value of foo is {foo}");foo=20;println!("The value of foo is {foo}");}

Multiplelet expressions can define multiple variables with the same name, known asvariable shadowing. Variable shadowing allows transforming variables without having to name the variables differently.[50] The example below declares a new variable with the same name that is double the original value:

fnmain(){letfoo=10;// This will output "The value of foo is 10"println!("The value of foo is {foo}");letfoo=foo*2;// This will output "The value of foo is 20"println!("The value of foo is {foo}");}

Variable shadowing is also possible for values of different types. For example, going from a string to its length:

fnmain(){letletters="abc";letletters=letters.len();}

Block expressions and control flow

[edit]

Ablock expression is delimited bycurly brackets. When the last expression inside a block does not end with a semicolon, the block evaluates to the value of that trailing expression:[51]

fnmain(){letx={println!("this is inside the block");1+2};println!("1 + 2 = {x}");}

Trailing expressions of function bodies are used as the return value:[52]

fnadd_two(x:i32)->i32{x+2}

if expressions

[edit]

Anifconditional expression executes code based on whether the given value istrue.else can be used for when the value evaluates tofalse, andelseif can be used for combining multiple expressions.[53]

fnmain(){letx=10;ifx>5{println!("value is greater than five");}ifx%7==0{println!("value is divisible by 7");}elseifx%5==0{println!("value is divisible by 5");}else{println!("value is not divisible by 7 or 5");}}

if andelse blocks can evaluate to a value, which can then be assigned to a variable:[53]

fnmain(){letx=10;letnew_x=ifx%2==0{x/2}else{3*x+1};println!("{new_x}");}

while loops

[edit]

while can be used to repeat a block of code while a condition is met.[54]

fnmain(){// Iterate over all integers from 4 to 10letmutvalue=4;whilevalue<=10{println!("value = {value}");value+=1;}}

for loops and iterators

[edit]

For loops in Rust loop over elements of a collection.[55]for expressions work over anyiterator type.

fnmain(){// Using `for` with range syntax for the same functionality as above// The syntax 4..=10 means the range from 4 to 10, up to and including 10.forvaluein4..=10{println!("value = {value}");}}

In the above code,4..=10 is a value of typeRange which implements theIterator trait. The code within the curly braces is applied to each element returned by the iterator.

Iterators can be combined with functions over iterators likemap,filter, andsum. For example, the following adds up all numbers between 1 and 100 that are multiples of 3:

(1..=100).filter(|x:&u32|->bool{x%3==0}).sum()

loop andbreak statements

[edit]

More generally, theloop keyword allows repeating a portion of code until abreak occurs.break may optionally exit the loop with a value. In the case of nested loops, labels denoted by'label_name can be used to break an outer loop rather than the innermost loop.[56]

fnmain(){letvalue=456;letmutx=1;lety=loop{x*=10;ifx>value{breakx/10;}};println!("largest power of ten that is smaller than or equal to value: {y}");letmutup=1;'outer:loop{letmutdown=120;loop{ifup>100{break'outer;}ifdown<4{break;}down/=2;up+=1;println!("up: {up}, down: {down}");}up*=2;}}

Pattern matching

[edit]

Thematch andiflet expressions can be used forpattern matching. For example,match can be used to double an optional integer value if present, and return zero otherwise:[57]

fndouble(x:Option<u64>)->u64{matchx{Some(y)=>y*2,None=>0,}}

Equivalently, this can be written withiflet andelse:

fndouble(x:Option<u64>)->u64{ifletSome(y)=x{y*2}else{0}}

Types

[edit]

Rust isstrongly typed andstatically typed, meaning that the types of all variables must be known at compilation time. Assigning a value of a particular type to a differently typed variable causes acompilation error.Type inference is used to determine the type of variables if unspecified.[58]

The type(), called the "unit type" in Rust, is a concrete type that has exactly one value. It occupies no memory (as it represents the absence of value). All functions that do not have an indicated return type implicitly return(). It is similar tovoid in other C-style languages, howevervoid denotes the absence of a type and cannot have any value.

The default integer type isi32, and the defaultfloating point type isf64. If the type of aliteral number is not explicitly provided, it is either inferred from the context or the default type is used.[59]

Primitive types

[edit]

Integer types in Rust are named based on thesignedness and the number of bits the type takes. For example,i32 is a signed integer that takes 32 bits of storage, whereasu8 is unsigned and only takes 8 bits of storage.isize andusize take storage depending on thememory address bus width of the compilation target. For example, when building for32-bit targets, both types will take up 32 bits of space.[60][61]

By default, integer literals are in base-10, but differentradices are supported with prefixes, for example,0b11 forbinary numbers,0o567 foroctals, and0xDB forhexadecimals. By default, integer literals default toi32 as its type. Suffixes such as4u32 can be used to explicitly set the type of a literal.[62] Byte literals such asb'X' are available to represent theASCII value (as au8) of a specific character.[63]

TheBoolean type is referred to asbool which can take a value of eithertrue orfalse. Achar takes up 32 bits of space and represents a Unicode scalar value:[64] aUnicode codepoint that is not asurrogate.[65]IEEE 754 floating point numbers are supported withf32 forsingle precision floats andf64 fordouble precision floats.[66]

Compound types

[edit]

Compound types can contain multiple values. Tuples are fixed-size lists that can contain values whose types can be different. Arrays are fixed-size lists whose values are of the same type. Expressions of the tuple and array types can be written through listing the values, and can be accessed with.index or[index]:[67]

lettuple:(u32,bool)=(3,true);letarray:[i8;5]=[1,2,3,4,5];letvalue=tuple.1;// trueletvalue=array[2];// 3

Arrays can also be constructed through copying a single value a number of times:[68]

letarray2:[char;10]=[' ';10];

Ownership and references

[edit]

Rust's ownership system consists of rules that ensure memory safety without using a garbage collector. At compile time, each value must be attached to a variable called theowner of that value, and every value must have exactly one owner.[69] Values are moved between different owners through assignment or passing a value as a function parameter. Values can also beborrowed, meaning they are temporarily passed to a different function before being returned to the owner.[70] With these rules, Rust can prevent the creation and use ofdangling pointers:[70][71]

fnprint_string(s:String){println!("{}",s);}fnmain(){lets=String::from("Hello, World");print_string(s);// s consumed by print_string// s has been moved, so cannot be used any more// another print_string(s); would result in a compile error}

The functionprint_string takes ownership over theString value passed in; Alternatively,& can be used to indicate areference type (in&String) and to create a reference (in&s):[72]

fnprint_string(s:&String){println!("{}",s);}fnmain(){lets=String::from("Hello, World");print_string(&s);// s borrowed by print_stringprint_string(&s);// s has not been consumed; we can call the function many times}

Because of these ownership rules, Rust types are known aslinear oraffine types, meaning each value can be used exactly once. This enforces a form ofsoftware fault isolation as the owner of a value is solely responsible for its correctness and deallocation.[73]

When a value goes out of scope, it isdropped by running itsdestructor. The destructor may be programmatically defined through implementing theDroptrait. This helps manage resources such as file handles, network sockets, andlocks, since when objects are dropped, the resources associated with them are closed or released automatically.[74]

Lifetimes

[edit]

Object lifetime refers to the period of time during which a reference is valid; that is, the time between the object creation and destruction.[75] Theselifetimes are implicitly associated with all Rust reference types. While often inferred, they can also be indicated explicitly with named lifetime parameters (often denoted'a,'b, and so on).[76]

Lifetimes in Rust can be thought of aslexically scoped, meaning that the duration of an object lifetime is inferred from the set of locations in the source code (i.e., function, line, and column numbers) for which a variable is valid.[77] For example, a reference to a local variable has a lifetime corresponding to the block it is defined in:[77]

fnmain(){letx=5;// ------------------+- Lifetime 'a//                   |letr=&x;// -+-- Lifetime 'b  |//  |                |println!("r: {}",r);//  |                |//  |                |// -+                |}// ------------------+

The borrow checker in the Rust compiler then enforces that references are only used in the locations of the source code where the associated lifetime is valid.[78][79] In the example above, storing a reference to variablex inr is valid, as variablex has a longer lifetime ('a) than variabler ('b). However, whenx has a shorter lifetime, the borrow checker would reject the program:

fnmain(){letr;// ------------------+- Lifetime 'a//                   |{//                   |letx=5;// -+-- Lifetime 'b  |r=&x;// ERROR: x does  |                |}// not live long -|                |// enough                          |println!("r: {}",r);//                   |}// ------------------+

Since the lifetime of the referenced variable ('b) is shorter than the lifetime of the variable holding the reference ('a), the borrow checker errors, preventingx from being used from outside its scope.[80]

Lifetimes can be indicated using explicitlifetime parameters on function arguments. For example, the following code specifies that the reference returned by the function has the same lifetime asoriginal (andnot necessarily the same lifetime asprefix):[81]

fnremove_prefix<'a>(mutoriginal:&'astr,prefix:&str)->&'astr{iforiginal.starts_with(prefix){original=original[prefix.len()..];}original}

In the compiler, ownership and lifetimes work together to prevent memory safety issues such as dangling pointers.[82][83]

User-defined types

[edit]

User-defined types are created with thestruct orenum keywords. Thestruct keyword is used to denote arecord type that groups multiple related values.[84]enums can take on different variants at runtime, with its capabilities similar toalgebraic data types found in functional programming languages.[85] Both records and enum variants can containfields with different types.[86] Alternative names, or aliases, for the same type can be defined with thetype keyword.[87]

Theimpl keyword can define methods for a user-defined type. Data and functions are defined separately. Implementations fulfill a role similar to that ofclasses within other languages.[88]

Standard library

[edit]
A diagram of the dependencies between the standard library modules of Rust.

The Ruststandard library defines and implements many widely used custom data types, including core data structures such asVec,Option, andHashMap, as well assmart pointer types. Rust provides a way to exclude most of the standard library using the attribute#![no_std], for applications such as embedded devices. Internally, the standard library is divided into three parts,core,alloc, andstd, wherestd andalloc are excluded by#![no_std].[89]

Rust uses theoption typeOption<T> to define optional values, which can be matched usingif let ormatch to access the inner value:[90]

fnmain(){letname1:Option<&str>=None;// In this case, nothing will be printed outifletSome(name)=name1{println!("{name}");}letname2:Option<&str>=Some("Matthew");// In this case, the word "Matthew" will be printed outifletSome(name)=name2{println!("{name}");}}

Similarly, Rust'sresult typeResult<T, E> holds either a successfully computed value (theOk variant) or an error (theErr variant).[91] LikeOption, the use ofResult means that the inner value cannot be used directly; programmers must use amatch expression, syntactic sugar such as? (the “try” operator), or an explicitunwrap assertion to access it. BothOption andResult are used throughout the standard library and are a fundamental part of Rust's explicit approach to handling errors and missing data.

Pointers

[edit]

The& and&mut reference types are guaranteed to not be null and point to valid memory.[92] The raw pointer types*const and*mut opt out of the safety guarantees, thus they may be null or invalid; however, it is impossible to dereference them unless the code is explicitly declared unsafe through the use of anunsafe block.[93] Unlike dereferencing, the creation of raw pointers is allowed inside safe Rust code.[94]

Type conversion

[edit]
This section is an excerpt fromType conversion § Rust.[edit]

Rust provides no implicit type conversion (coercion) between most primitive types. But, explicit type conversion (casting) can be performed using theas keyword.[95]

letx:i32=1000;println!("1000 as a u16 is: {}",xasu16);
A presentation on Rust by Emily Dunham fromMozilla's Rust team (linux.conf.au conference, Hobart, 2017)

Polymorphism

[edit]

Rust supportspolymorphism throughtraits,generic functions, andtrait objects.[96]

Traits

[edit]

Common behavior between types is declared using traits andimpl blocks:[97]

traitZero:Sized{fnzero()->Self;fnis_zero(&self)->boolwhereSelf:PartialEq,{self==&Zero::zero()}}implZeroforu32{fnzero()->u32{0}}implZeroforf32{fnzero()->Self{0.0}}

The example above includes a methodis_zero which provides a default implementation that may be overridden when implementing the trait.[97]

Generic functions

[edit]

A function can be made generic by adding type parameters inside angle brackets (<Num>), which only allow types that implement the trait:

// zero is a generic function with one type parameter, Numfnzero<Num:Zero>()->Num{Num::zero()}fnmain(){leta:u32=zero();letb:f32=zero();assert!(a.is_zero()&&b.is_zero());}

In the examples above,Num:Zero as well aswhereSelf:PartialEq are trait bounds that constrain the type to only allow types that implementZero orPartialEq.[97] Within a trait or impl,Self refers to the type that the code is implementing.[98]

Generics can be used in functions to allow implementing a behavior for different types without repeating the same code (seebounded parametric polymorphism). Generic functions can be written in relation to other generics, without knowing the actual type.[99]

Trait objects

[edit]

By default, traits usestatic dispatch: the compilermonomorphizes the function for each concrete type instance, yielding performance equivalent to type-specific code at the cost of longer compile times and larger binaries.[100]

When the exact type is not known at compile time, Rust providestrait objects&dyn Trait andBox<dyn Trait>.[101] Trait object calls usedynamic dispatch via a lookup table; a trait object is a "fat pointer" carrying both a data pointer and a method table pointer.[100] This indirection adds a small runtime cost, but it keeps a single copy of the code and reduces binary size. Only "object-safe" traits are eligible to be used as trait objects.[102]

This approach is similar toduck typing, where all data types that implement a given trait can be treated as functionally interchangeable.[103] The following example creates a list of objects where each object implements theDisplay trait:

usestd::fmt::Display;letv:Vec<Box<dynDisplay>>=vec![Box::new(3),Box::new(5.0),Box::new("hi"),];forxinv{println!("{x}");}

If an element in the list does not implement theDisplay trait, it will cause a compile-time error.[104]

Memory management

[edit]

Rust does not usegarbage collection. Memory and other resources are instead managed through the "resource acquisition is initialization" convention,[105] with optionalreference counting. Rust provides deterministic management of resources, with very lowoverhead.[106] Values areallocated on the stack by default, and alldynamic allocations must be explicit.[107]

The built-in reference types using the& symbol do not involve run-time reference counting. The safety and validity of the underlying pointers is verified at compile time, preventingdangling pointers and other forms ofundefined behavior.[108] Rust's type system separates shared,immutable references of the form&T from unique, mutable references of the form&mut T. A mutable reference can be coerced to an immutable reference, but not vice versa.[109]

Unsafe

[edit]

Rust's memory safety checks (See#Safety) may be circumvented through the use ofunsafe blocks. This allows programmers to dereference arbitrary raw pointers, call external code, or perform other low-level functionality not allowed by safe Rust.[110] Some low-level functionality enabled in this way includesvolatile memory access, architecture-specific intrinsics,type punning, and inline assembly.[111]

Unsafe code is sometimes needed to implement complex data structures.[112] A frequently cited example is that it is difficult or impossible to implementdoubly linked lists in safe Rust.[113][114][115][116]

Programmers using unsafe Rust are considered responsible for upholding Rust's memory and type safety requirements, for example, that no two mutable references exist pointing to the same location.[117] If programmers write code which violates these requirements, this results inundefined behavior.[117] The Rust documentation includes a list of behavior considered undefined, including accessing dangling or misaligned pointers, or breaking the aliasing rules for references.[118]

Macros

[edit]

Macros allow generation and transformation of Rust code to reduce repetition. Macros come in two forms, withdeclarative macros defined throughmacro_rules!, andprocedural macros, which are defined in separate crates.[119][120]

Declarative macros

[edit]

A declarative macro (also called a "macro by example") is a macro, defined using themacro_rules! keyword, that uses pattern matching to determine its expansion.[121][122] Below is an example that sums over all its arguments:

macro_rules!sum{($initial:expr$(,$expr:expr)*$(,)?)=>{$initial$(+$expr)*}}fnmain(){letx=sum!(1,2,3);println!("{x}");// prints 6}

In this example, the macro namedsum is defined using the formmacro_rules! sum {(...) => { ... } }. The first part inside the parentheses of the definition, the macro pattern( $initial:expr $(, $expr:expr )* $(,)? ) specifies the structure of input it can take. Here,$initial:expr represents the first expression, while$(, $expr:expr )* means there can be zero or more additional comma-separated expressions after it. The trailing$(,)? allows the caller to optionally include a final comma without causing an error. The second part after the arrow=> describes what code will be generated when the macro is invoked. In this case,$initial $(+ $expr)* means that the generated code will start with the first expression, followed by a+ and each of the additional expressions in sequence. The* again means "repeat this pattern zero or more times". This means, when the macro is later called in line 8, assum!(1, 2, 3) the macro will resolve to1 + 2 + 3 representing the addition of all of the passed expressions.

Procedural macros

[edit]

Procedural macros are Rust functions that run and modify the compiler's inputtoken stream, before any other components are compiled. They are generally more flexible than declarative macros, but are more difficult to maintain due to their complexity.[123][124]

Procedural macros come in three flavors:

  • Function-like macroscustom!(...)
  • Derive macros#[derive(CustomDerive)]
  • Attribute macros#[custom_attribute]

Interface with C and C++

[edit]

Rust supports the creation offoreign function interfaces (FFI) through theextern keyword. A function that uses the Ccalling convention can be written usingextern"C"fn. Symbols can be exported from Rust to other languages through the#[unsafe(no_mangle)] attribute, and symbols can be imported into Rust throughextern blocks:[note 6][126]

#[unsafe(no_mangle)]pubextern"C"fnexported_from_rust(x:i32)->i32{x+1}unsafeextern"C"{fnimported_into_rust(x:i32)->i32;}

The#[repr(C)] attribute enables deterministic memory layouts forstructs andenums for use across FFI boundaries.[126] External libraries such asbindgen andcxx can generate Rust bindings for C/C++.[126][127]

Safety

[edit]

Safety properties guaranteed by Rust includememory safety,type safety, anddata race freedom. As described above, these guarantees can be circumvented by using theunsafe keyword.

Memory safety includes the absence of dereferences tonull,dangling, and misalignedpointers, and the absence ofbuffer overflows anddouble free errors.[128][129][130][131] Data values can be initialized only through a fixed set of forms, all of which require their inputs to be already initialized.[132]

Memory leaks are possible in safe Rust.[133][134]

Some users have pointed out that Rust's safety guarantees can be circumvented by exploiting unsoundness in the Rust compiler.[135][136]

Ecosystem

[edit]
Compiling a Rust program with Cargo

The Rust ecosystem includes its compiler, itsstandard library, and additional components for software development. Component installation is typically managed byrustup, a Rusttoolchain installer developed by the Rust project.[137]

Compiler

[edit]

The Rust compiler,rustc, compiles Rust code intobinaries. First, the compiler parses the source code into anAST. Next, this AST is lowered toIR. The compiler backend is then invoked as a subcomponent to applyoptimizations and translate the resulting IR intoobject code. Finally, alinker is used to combine the object(s) into a single executable image.[138]

rustc usesLLVM as its compiler backend by default, but it also supports using alternative backends such asGCC andCranelift.[139] The intention of those alternative backends is to increase platform coverage of Rust or to improve compilation times.[140][141]

Cargo

[edit]
Screenshot of crates.io in June 2022

Cargo is Rust'sbuild system andpackage manager. It downloads, compiles, distributes, and uploads packages—calledcrates—that are maintained in an official registry. It also acts as a front-end for Clippy and other Rust components.[142]

By default, Cargo sources its dependencies from the user-contributed registrycrates.io, butGit repositories, crates in the local filesystem, and other external sources can also be specified as dependencies.[143]

Rustfmt

[edit]

Rustfmt is acode formatter for Rust. It formats whitespace andindentation to produce code in accordance with a commonstyle, unless otherwise specified. It can be invoked as a standalone program, or from a Rust project through Cargo.[144]

Clippy

[edit]
Example output of Clippy on a hello world Rust program

Clippy is Rust's built-inlinting tool to improve the correctness, performance, and readability of Rust code. As of 2025[update], it has 795 rules.[145][146]

Versioning system

[edit]

Following Rust 1.0, new features are developed innightly versions which are released daily. During each six-week release cycle, changes to nightly versions are released to beta, while changes from the previous beta version are released to a new stable version.[147]

Every two or three years, a new "edition" is produced. Editions are released to allow making limitedbreaking changes, such as promotingawait to a keyword to supportasync/await features. Crates targeting different editions can interoperate with each other, so a crate can upgrade to a new edition even if its callers or its dependencies still target older editions. Migration to a new edition can be assisted with automated tooling.[148]

IDE support

[edit]

rust-analyzer is a set ofutilities that providesintegrated development environments (IDEs) andtext editors with information about a Rust project through theLanguage Server Protocol. This enables features includingautocomplete, andcompilation error display, while editing code.[149]

Performance

[edit]

Since it performs no garbage collection, Rust is often faster than other memory-safe languages.[150][73][151] Most of Rust's memory safety guarantees impose no runtime overhead,[152] with the exception ofarray indexing which is checked at runtime by default.[153] The performance impact of array indexing bounds checks varies, but can be significant in some cases.[153]

Many of Rust's features are so-calledzero-cost abstractions, meaning they are optimized away at compile time and incur no runtime penalty.[154] The ownership and borrowing system permitszero-copy implementations for some performance-sensitive tasks, such asparsing.[155]Static dispatch is used by default to eliminatemethod calls, except for methods called on dynamic trait objects.[156] The compiler usesinline expansion to eliminatefunction calls and statically-dispatched method invocations.[157]

Since Rust usesLLVM, all performance improvements in LLVM apply to Rust also.[158] Unlike C and C++, Rust allows the compiler to reorder struct and enum elements unless a#[repr(C)] representation attribute is applied.[159] This allows the compiler to optimize for memory footprint, alignment, and padding, which can be used to produce more efficient code in some cases.[160]

Adoption

[edit]
See also:Category:Rust (programming language) software
Firefox has components written in Rust as part of the underlyingGecko browser engine.

Inweb services,OpenDNS, aDNS resolution service owned byCisco, uses Rust internally.[161][162]Amazon Web Services uses Rust in "performance-sensitive components" of its several services. In 2019, AWSopen-sourcedFirecracker, a virtualization solution primarily written in Rust.[163]Microsoft Azure IoT Edge, a platform used to run Azure services onIoT devices, has components implemented in Rust.[164] Microsoft also uses Rust to run containerized modules withWebAssembly andKubernetes.[165]Cloudflare, a company providingcontent delivery network services, used Rust to build a newweb proxy named Pingora for increased performance and efficiency.[166] Thenpm package manager used Rust for its production authentication service in 2019.[167][168][169]

TheRust for Linux project has been supported in theLinux kernel since 2022.

In operating systems, theRust for Linux project, launched in 2020, merged initial support into theLinux kernel version 6.1 in late 2022.[170][171][172] The project is active with a team of 6–7 developers, and has added more Rust code with kernel releases from 2022 to 2024,[173] aiming to demonstrate theminimum viability of the project and resolve key compatibility blockers.[170][174] The first drivers written in Rust were merged into the kernel for version 6.8.[170] TheAndroid developers used Rust in 2021 to rewrite existing components.[175][176]Microsoft has rewritten parts ofWindows in Rust.[177] The r9 project aims to re-implementPlan 9 from Bell Labs in Rust.[178] Rust has been used in the development of new operating systems such asRedox, a "Unix-like" operating system andmicrokernel,[179] Theseus, an experimental operating system with modular state management,[180][181] and most ofFuchsia.[182] Rust is used for command-line tools and operating system components such asstratisd, afile system manager[183][184] and COSMIC, adesktop environment bySystem76.[185]

In web development,Deno, a secure runtime forJavaScript andTypeScript, is built on top ofV8 using Rust and Tokio.[186] Other notable adoptions in this space includeRuffle, an open-sourceSWF emulator,[187] andPolkadot, an open sourceblockchain andcryptocurrency platform.[188] Components from the Servo browser engine (funded byMozilla andSamsung) were incorporated in theGecko browser engine underlyingFirefox.[189] In January 2023, Google (Alphabet) announced support for using third party Rust libraries inChromium.[190][191]

In other uses,Discord, aninstant messaging software company, rewrote parts of its system in Rust for increased performance in 2020. In the same year, Dropbox announced that itsfile synchronization had been rewritten in Rust.Facebook (Meta) used Rust to redesign its system that manages source code for internal projects.[15]

In the 2025Stack Overflow Developer Survey, 14.8% of respondents had recently done extensive development in Rust.[192] The survey named Rust the "most admired programming language" annually from 2016 to 2025 (inclusive), as measured by the number of existing developers interested in continuing to work in the language.[193][note 7] In 2025, 29.2% of developers not currently working in Rust expressed an interest in doing so.[192]

In academic research

[edit]

Rust's safety and performance have been investigated in programming languages research.[194][112][195]

In other fields, a journal article published toProceedings of the International Astronomical Union used Rust to simulate multi-planet systems.[196] An article published inNature shared stories of bioinformaticians using Rust.[142] Both articles cited Rust's performance and safety as advantages, and thelearning curve as being a primary drawback to Rust adoption.

The 2025DARPA project TRACTOR aims to automatically translate C to Rust using techniques such as static analysis, dynamic analysis, and large language models.[197]

Community

[edit]
A bright orange crab icon
Some Rust users refer to themselves as Rustaceans (similar to the wordcrustacean) and have adopted an orange crab, Ferris, as their unofficial mascot.[198][199]

According to theMIT Technology Review, the Rust community has been seen as "unusually friendly" to newcomers and particularly attracted people from thequeer community, partly due to itscode of conduct.[15] Inclusiveness has been cited as an important factor for some Rust developers.[142] The official Rust blog collects and publishes demographic data each year.[200]

Rust Foundation

[edit]
Rust Foundation
FormationFebruary 8, 2021; 4 years ago (2021-02-08)
Founders
TypeNonprofit organization
Location
Shane Miller
Rebecca Rumbul
Websitefoundation.rust-lang.org

TheRust Foundation is anon-profitmembership organization incorporated inUnited States; it manages the Rust trademark, infrastructure, and assets.[201][44]

It was established on February 8, 2021, with five founding corporate members (Amazon Web Services, Huawei, Google, Microsoft, and Mozilla).[202] The foundation's board was chaired by Shane Miller,[203] with Ashley Williams as interim executive director.[44] In late 2021, Rebecca Rumbul became Executive Director and CEO.[204]

Governance teams

[edit]

The Rust project is maintained by 8 top-levelteams as of November 2025[update]: the leadership council, compiler team, dev tools team, infrastructure team, language team, launching pad, library team, and moderation team.[205] The leadership council oversees the project and is formed by representatives among the other teams.[206]

See also

[edit]

Notes

[edit]
  1. ^Including build tools, host tools, and standard library support forx86-64,ARM,MIPS,RISC-V,WebAssembly,i686,AArch64,PowerPC, ands390x.[2]
  2. ^IncludingWindows,Linux,macOS,FreeBSD,NetBSD, andIllumos. Host build tools onAndroid,iOS,Haiku,Redox, andFuchsia are not officially shipped; these operating systems are supported as targets.[2]
  3. ^Third-party dependencies, e.g.,LLVM orMSVC, are subject to their own licenses.[3][4]
  4. ^abNIL is cited as an influence for Rust in multiple sources; this likely refers to Network Implementation Language developed by Robert Strom and others atIBM, which pioneeredtypestate analysis,[5][6] not to be confused withNew Implementation of LISP.
  5. ^The list of Rust compiler versions (referred to as a bootstrapping chain) has history going back to 2012.[20]
  6. ^wrappingno_mangle withunsafe as well as prefacing theextern"C" block withunsafe are required in the 2024 edition or later.[125]
  7. ^That is, among respondents who have done "extensive development work [with Rust] in over the past year" (14.8%), Rust had the largest percentage who also expressed interest to "work in [Rust] over the next year" (72.4%).[192]

References

[edit]

Book sources

[edit]

Others

[edit]
  1. ^"Announcing Rust 1.91.1". 2025-11-10. Retrieved2025-11-11.
  2. ^ab"Platform Support".The rustc book.Archived from the original on 2022-06-30. Retrieved2022-06-27.
  3. ^"Copyright".GitHub. The Rust Programming Language. 2022-10-19.Archived from the original on 2023-07-22. Retrieved2022-10-19.
  4. ^"Licenses".The Rust Programming Language.Archived from the original on 2025-02-23. Retrieved2025-03-07.
  5. ^Strom, Robert E. (1983). "Mechanisms for compile-time enforcement of security".Proceedings of the 10th ACM SIGACT-SIGPLAN symposium on Principles of programming languages - POPL '83. pp. 276–284.doi:10.1145/567067.567093.ISBN 0897910907.S2CID 6630704.
  6. ^Strom, Robert E.; Yemini, Shaula (1986)."Typestate: A programming language concept for enhancing software reliability"(PDF).IEEE Transactions on Software Engineering.12. IEEE:157–171.doi:10.1109/tse.1986.6312929.S2CID 15575346.
  7. ^"Uniqueness Types".Rust Blog.Archived from the original on 2016-09-15. Retrieved2016-10-08.Those of you familiar with the Elm style may recognize that the updated--explain messages draw heavy inspiration from the Elm approach.
  8. ^"Influences".The Rust Reference.Archived from the original on 2023-11-26. Retrieved2023-12-31.
  9. ^"Uniqueness Types".Idris 1.3.3 documentation.Archived from the original on 2018-11-21. Retrieved2022-07-14.They are inspired by ... ownership types and borrowed pointers in the Rust programming language.
  10. ^Tung, Liam."Microsoft opens up Rust-inspired Project Verona programming language on GitHub".ZDNET.Archived from the original on 2020-01-17. Retrieved2020-01-17.
  11. ^Jaloyan, Georges-Axel (2017-10-19). "Safe Pointers in SPARK 2014".arXiv:1710.07047 [cs.PL].
  12. ^Lattner, Chris."Chris Lattner's Homepage".Nondot.Archived from the original on 2018-12-25. Retrieved2019-05-14.
  13. ^"V documentation (Introduction)".GitHub. The V Programming Language. Retrieved2023-11-04.
  14. ^Yegulalp, Serdar (2016-08-29)."New challenger joins Rust to topple C language".InfoWorld.Archived from the original on 2021-11-25. Retrieved2022-10-19.
  15. ^abcdefghijklmnopqrsThompson, Clive (2023-02-14)."How Rust went from a side project to the world's most-loved programming language".MIT Technology Review.Archived from the original on 2024-09-19. Retrieved2023-02-23.
  16. ^abcdefghijklmnopqrstuKlabnik, Steve (2016-06-02)."The History of Rust".Applicative 2016. New York, NY, USA: Association for Computing Machinery. p. 80.doi:10.1145/2959689.2960081.ISBN 978-1-4503-4464-7.
  17. ^abcdHoare, Graydon (July 2010).Project Servo: Technology from the past come to save the future from itself(PDF). Mozilla Annual Summit. Archived fromthe original(PDF) on 2021-12-26. Retrieved2024-10-29.
  18. ^Hoare, Graydon (November 2016)."Rust Prehistory (Archive of the original Rust OCaml compiler source code)".GitHub. Retrieved2024-10-29.
  19. ^"0.1 first supported public release Milestone · rust-lang/rust".GitHub. Retrieved2024-10-29.
  20. ^Nelson, Jynn (2022-08-05).RustConf 2022 - Bootstrapping: The once and future compiler. Portland, Oregon: Rust Team. Retrieved2024-10-29 – via YouTube.
  21. ^"Rust logo".Bugzilla.Archived from the original on 2024-02-02. Retrieved2024-02-02.
  22. ^Anderson, Brian (2012-01-24)."[rust-dev] The Rust compiler 0.1 is unleashed".rust-dev (Mailing list). Archived fromthe original on 2012-01-24. Retrieved2025-01-07.
  23. ^Anthony, Sebastian (2012-01-24)."Mozilla releases Rust 0.1, the language that will eventually usurp Firefox's C++".ExtremeTech. Retrieved2025-01-07.
  24. ^"Purity by pcwalton · Pull Request #5412 · rust-lang/rust".GitHub. Retrieved2024-10-29.
  25. ^Binstock, Andrew (2014-01-07)."The Rise And Fall of Languages in 2013".Dr. Dobb's Journal. Archived fromthe original on 2016-08-07. Retrieved2022-11-20.
  26. ^Lardinois, Frederic (2015-04-03)."Mozilla And Samsung Team Up To Develop Servo, Mozilla's Next-Gen Browser Engine For Multicore Processors".TechCrunch.Archived from the original on 2016-09-10. Retrieved2017-06-25.
  27. ^"Firefox 45.0, See All New Features, Updates and Fixes".Mozilla.Archived from the original on 2016-03-17. Retrieved2024-10-31.
  28. ^Lardinois, Frederic (2017-09-29)."It's time to give Firefox another chance".TechCrunch.Archived from the original on 2023-08-15. Retrieved2023-08-15.
  29. ^Pereira, Rui; Couto, Marco; Ribeiro, Francisco; Rua, Rui; Cunha, Jácome; Fernandes, João Paulo; Saraiva, João (2017-10-23)."Energy efficiency across programming languages: How do energy, time, and memory relate?".Proceedings of the 10th ACM SIGPLAN International Conference on Software Language Engineering. SLE 2017. New York, NY, USA: Association for Computing Machinery. pp. 256–267.doi:10.1145/3136014.3136031.hdl:1822/65359.ISBN 978-1-4503-5525-4.
  30. ^Cimpanu, Catalin (2020-08-11)."Mozilla lays off 250 employees while it refocuses on commercial products".ZDNET.Archived from the original on 2022-03-18. Retrieved2020-12-02.
  31. ^Cooper, Daniel (2020-08-11)."Mozilla lays off 250 employees due to the pandemic".Engadget.Archived from the original on 2020-12-13. Retrieved2020-12-02.
  32. ^Tung, Liam (2020-08-21)."Programming language Rust: Mozilla job cuts have hit us badly but here's how we'll survive".ZDNET.Archived from the original on 2022-04-21. Retrieved2022-04-21.
  33. ^"Laying the foundation for Rust's future".Rust Blog. 2020-08-18.Archived from the original on 2020-12-02. Retrieved2020-12-02.
  34. ^"Hello World!".Rust Foundation. 2020-02-08.Archived from the original on 2022-04-19. Retrieved2022-06-04.
  35. ^"Mozilla Welcomes the Rust Foundation".Mozilla Blog. 2021-02-09.Archived from the original on 2021-02-08. Retrieved2021-02-09.
  36. ^Amadeo, Ron (2021-04-07)."Google is now writing low-level Android code in Rust".Ars Technica.Archived from the original on 2021-04-08. Retrieved2021-04-08.
  37. ^Anderson, Tim (2021-11-23)."Entire Rust moderation team resigns".The Register.Archived from the original on 2022-07-14. Retrieved2022-08-04.
  38. ^Levick, Ryan; Bos, Mara."Governance Update".Inside Rust Blog.Archived from the original on 2022-10-27. Retrieved2022-10-27.
  39. ^abClaburn, Thomas (2023-04-17)."Rust Foundation apologizes for trademark policy confusion".The Register.Archived from the original on 2023-05-07. Retrieved2023-05-07.
  40. ^Gross, Grant (2024-02-27)."White House urges developers to dump C and C++".InfoWorld. Retrieved2025-01-26.
  41. ^Warminsky, Joe (2024-02-27)."After decades of memory-related software bugs, White House calls on industry to act".The Record. Retrieved2025-01-26.
  42. ^"Press Release: Future Software Should Be Memory Safe".The White House. 2024-02-26. Archived fromthe original on 2025-01-18. Retrieved2025-01-26.
  43. ^Proven, Liam (2019-11-27)."Rebecca Rumbul named new CEO of The Rust Foundation".The Register.Archived from the original on 2022-07-14. Retrieved2022-07-14.Both are curly bracket languages, with C-like syntax that makes them unintimidating for C programmers.
  44. ^abcVigliarolo, Brandon (2021-02-10)."The Rust programming language now has its own independent foundation".TechRepublic. Archived fromthe original on 2023-03-20. Retrieved2022-07-14.
  45. ^Klabnik & Nichols 2019, p. 263.
  46. ^Klabnik & Nichols 2019, pp. 5–6.
  47. ^Klabnik & Nichols 2023, p. 32.
  48. ^Klabnik & Nichols 2023, pp. 32–33.
  49. ^Klabnik & Nichols 2023, pp. 49–50.
  50. ^Klabnik & Nichols 2023, pp. 34–36.
  51. ^Klabnik & Nichols 2023, pp. 6, 47, 53.
  52. ^Klabnik & Nichols 2023, pp. 47–48.
  53. ^abKlabnik & Nichols 2023, pp. 50–53.
  54. ^Klabnik & Nichols 2023, p. 56.
  55. ^Klabnik & Nichols 2023, pp. 57–58.
  56. ^Klabnik & Nichols 2023, pp. 54–56.
  57. ^Klabnik & Nichols 2019, pp. 104–109.
  58. ^Klabnik & Nichols 2019, pp. 24.
  59. ^Klabnik & Nichols 2019, pp. 36–38.
  60. ^"isize".doc.rust-lang.org. Retrieved2025-09-28.
  61. ^"usize".doc.rust-lang.org. Retrieved2025-09-28.
  62. ^Klabnik & Nichols 2023, pp. 36–38.
  63. ^Klabnik & Nichols 2023, p. 502.
  64. ^"Primitive Type char".The Rust Standard Library documentation. Retrieved2025-09-07.
  65. ^"Glossary of Unicode Terms".Unicode Consortium.Archived from the original on 2018-09-24. Retrieved2024-07-30.
  66. ^Klabnik & Nichols 2019, pp. 38–40.
  67. ^Klabnik & Nichols 2023, pp. 40–42.
  68. ^Klabnik & Nichols 2023, p. 42.
  69. ^Klabnik & Nichols 2019, pp. 59–61.
  70. ^abKlabnik & Nichols 2019, pp. 63–68.
  71. ^Klabnik & Nichols 2019, pp. 74–75.
  72. ^Klabnik & Nichols 2023, pp. 71–72.
  73. ^abBalasubramanian, Abhiram; Baranowski, Marek S.; Burtsev, Anton; Panda, Aurojit; Rakamarić, Zvonimir; Ryzhyk, Leonid (2017-05-07)."System Programming in Rust".Proceedings of the 16th Workshop on Hot Topics in Operating Systems. HotOS '17. New York, NY, US: Association for Computing Machinery. pp. 156–161.doi:10.1145/3102980.3103006.ISBN 978-1-4503-5068-6.S2CID 24100599.Archived from the original on 2022-06-11. Retrieved2022-06-01.
  74. ^Klabnik & Nichols 2023, pp. 327–30.
  75. ^"Lifetimes".Rust by Example.Archived from the original on 2024-11-16. Retrieved2024-10-29.
  76. ^"Explicit annotation".Rust by Example. Retrieved2024-10-29.
  77. ^abKlabnik & Nichols 2019, p. 194.
  78. ^Klabnik & Nichols 2019, pp. 75, 134.
  79. ^Shamrell-Harrington, Nell (2022-04-15)."The Rust Borrow Checker – a Deep Dive".InfoQ.Archived from the original on 2022-06-25. Retrieved2022-06-25.
  80. ^Klabnik & Nichols 2019, pp. 194–195.
  81. ^Klabnik & Nichols 2023, pp. 208–12.
  82. ^Klabnik & Nichols 2023,4.2. References and Borrowing.
  83. ^Pearce, David (2021-04-17)."A Lightweight Formalism for Reference Lifetimes and Borrowing in Rust".ACM Transactions on Programming Languages and Systems.43:1–73.doi:10.1145/3443420.Archived from the original on 2024-04-15. Retrieved2024-12-11.
  84. ^Klabnik & Nichols 2019, p. 83.
  85. ^Klabnik & Nichols 2019, p. 97.
  86. ^Klabnik & Nichols 2019, pp. 98–101.
  87. ^Klabnik & Nichols 2019, pp. 438–440.
  88. ^Klabnik & Nichols 2019, pp. 93.
  89. ^Gjengset 2021, pp. 213–215.
  90. ^Klabnik & Nichols 2023, pp. 108–110, 113–114, 116–117.
  91. ^"Rust error handling is perfect actually".Bitfield Consulting.Archived from the original on 2025-08-07. Retrieved2025-09-15.
  92. ^Gjengset 2021, p. 155-156.
  93. ^Klabnik & Nichols 2023, pp. 421–423.
  94. ^Klabnik & Nichols 2019, pp. 418–427.
  95. ^"Casting".Rust by Example. Retrieved2025-04-01.
  96. ^Klabnik & Nichols 2023, p. 378.
  97. ^abcKlabnik & Nichols 2023, pp. 192–198.
  98. ^Klabnik & Nichols 2023, p. 98.
  99. ^Klabnik & Nichols 2019, pp. 171–172, 205.
  100. ^abKlabnik & Nichols 2023, pp. 191–192.
  101. ^Klabnik & Nichols 2019, pp. 441–442.
  102. ^Gjengset 2021, p. 25.
  103. ^Klabnik & Nichols 2023,18.2. Using Trait Objects That Allow for Values of Different Types.
  104. ^Klabnik & Nichols 2019, pp. 379–380.
  105. ^"RAII".Rust by Example.Archived from the original on 2019-04-21. Retrieved2020-11-22.
  106. ^"Abstraction without overhead: traits in Rust".Rust Blog.Archived from the original on 2021-09-23. Retrieved2021-10-19.
  107. ^"Box, stack and heap".Rust by Example.Archived from the original on 2022-05-31. Retrieved2022-06-13.
  108. ^Klabnik & Nichols 2019, pp. 70–75.
  109. ^Klabnik & Nichols 2019, p. 323.
  110. ^Klabnik & Nichols 2023, pp. 420–429.
  111. ^McNamara 2021, p. 139, 376–379, 395.
  112. ^abAstrauskas, Vytautas; Matheja, Christoph; Poli, Federico; Müller, Peter; Summers, Alexander J. (2020-11-13)."How do programmers use unsafe rust?".Proceedings of the ACM on Programming Languages.4:1–27.doi:10.1145/3428204.hdl:20.500.11850/465785.ISSN 2475-1421.
  113. ^Lattuada, Andrea; Hance, Travis; Cho, Chanhee; Brun, Matthias; Subasinghe, Isitha; Zhou, Yi; Howell, Jon; Parno, Bryan; Hawblitzel, Chris (2023-04-06)."Verus: Verifying Rust Programs using Linear Ghost Types".Proceedings of the ACM on Programming Languages.7: 85:286–85:315.doi:10.1145/3586037.hdl:20.500.11850/610518.
  114. ^Milano, Mae; Turcotti, Julia; Myers, Andrew C. (2022-06-09). "A flexible type system for fearless concurrency".Proceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation. New York, NY, USA: Association for Computing Machinery. pp. 458–473.doi:10.1145/3519939.3523443.ISBN 978-1-4503-9265-5.
  115. ^"Introduction - Learning Rust With Entirely Too Many Linked Lists".rust-unofficial.github.io. Retrieved2025-08-06.
  116. ^Noble, James; Mackay, Julian; Wrigstad, Tobias (2023-10-16)."Rusty Links in Local Chains✱".Proceedings of the 24th ACM International Workshop on Formal Techniques for Java-like Programs. New York, NY, USA: Association for Computing Machinery. pp. 1–3.doi:10.1145/3611096.3611097.ISBN 979-8-4007-0784-1.
  117. ^abEvans, Ana Nora; Campbell, Bradford; Soffa, Mary Lou (2020-10-01)."Is rust used safely by software developers?".Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering. New York, NY, USA: Association for Computing Machinery. pp. 246–257.arXiv:2007.00752.doi:10.1145/3377811.3380413.ISBN 978-1-4503-7121-6.
  118. ^"Behavior considered undefined".The Rust Reference. Retrieved2025-08-06.
  119. ^Klabnik & Nichols 2023, pp. 449–455.
  120. ^Gjengset 2021, pp. 101–102.
  121. ^"Macros By Example".The Rust Reference.Archived from the original on 2023-04-21. Retrieved2023-04-21.
  122. ^Klabnik & Nichols 2019, pp. 446–448.
  123. ^"Procedural Macros".The Rust Programming Language Reference.Archived from the original on 2020-11-07. Retrieved2021-03-23.
  124. ^Klabnik & Nichols 2019, pp. 449–455.
  125. ^Baumgartner, Stefan (2025-05-23)."Programming language: Rust 2024 is the most comprehensive edition to date".heise online. Retrieved2025-06-28.
  126. ^abcGjengset 2021, pp. 193–209.
  127. ^"Safe Interoperability between Rust and C++ with CXX".InfoQ. 2020-12-06.Archived from the original on 2021-01-22. Retrieved2021-01-03.
  128. ^Rosenblatt, Seth (2013-04-03)."Samsung joins Mozilla's quest for Rust".CNET.Archived from the original on 2013-04-04. Retrieved2013-04-05.
  129. ^Brown, Neil (2013-04-17)."A taste of Rust".LWN.net.Archived from the original on 2013-04-26. Retrieved2013-04-25.
  130. ^"Races".The Rustonomicon.Archived from the original on 2017-07-10. Retrieved2017-07-03.
  131. ^Vandervelden, Thibaut; De Smet, Ruben; Deac, Diana; Steenhaut, Kris; Braeken, An (2024-09-07)."Overview of Embedded Rust Operating Systems and Frameworks".Sensors.24 (17): 5818.Bibcode:2024Senso..24.5818V.doi:10.3390/s24175818.PMC 11398098.PMID 39275729.
  132. ^"The Rust Language FAQ". The Rust Programming Language. 2015. Archived fromthe original on 2015-04-20. Retrieved2017-04-24.
  133. ^"Reference Cycles Can Leak Memory - The Rust Programming Language".doc.rust-lang.org. Retrieved2025-11-16.
  134. ^"Is it possible to cause a memory leak in Rust?".Stack Overflow. Retrieved2025-11-16.
  135. ^Speykious (2025-11-15),Speykious/cve-rs: Blazingly 🔥 fast 🚀 memory vulnerabilities, written in 100% safe Rust. 🦀, retrieved2025-11-16
  136. ^"Implied bounds on nested references + variance = soundness hole · Issue #25860 · rust-lang/rust".GitHub. Retrieved2025-11-22.
  137. ^Blandy, Orendorff & Tindall 2021, pp. 6–8.
  138. ^"Overview of the compiler".Rust Compiler Development Guide. Rust project contributors.Archived from the original on 2023-05-31. Retrieved2024-11-07.
  139. ^"Code Generation".Rust Compiler Development Guide. Rust project contributors. Retrieved2024-03-03.
  140. ^"rust-lang/rustc_codegen_gcc".GitHub. The Rust Programming Language. 2024-03-02. Retrieved2024-03-03.
  141. ^"rust-lang/rustc_codegen_cranelift".GitHub. The Rust Programming Language. 2024-03-02. Retrieved2024-03-03.
  142. ^abcPerkel, Jeffrey M. (2020-12-01)."Why scientists are turning to Rust".Nature.588 (7836):185–186.Bibcode:2020Natur.588..185P.doi:10.1038/d41586-020-03382-2.PMID 33262490.S2CID 227251258.Archived from the original on 2022-05-06. Retrieved2022-05-15.
  143. ^Simone, Sergio De (2019-04-18)."Rust 1.34 Introduces Alternative Registries for Non-Public Crates".InfoQ.Archived from the original on 2022-07-14. Retrieved2022-07-14.
  144. ^Klabnik & Nichols 2019, pp. 511–512.
  145. ^"Clippy".GitHub. The Rust Programming Language. 2023-11-30.Archived from the original on 2021-05-23. Retrieved2025-10-09.
  146. ^"Clippy Lints".The Rust Programming Language. Retrieved2023-11-30.
  147. ^Klabnik & Nichols 2019, Appendix G – How Rust is Made and "Nightly Rust"
  148. ^Blandy, Orendorff & Tindall 2021, pp. 176–177.
  149. ^Klabnik & Nichols 2023, p. 623.
  150. ^Anderson, Tim (2021-11-30)."Can Rust save the planet? Why, and why not".The Register.Archived from the original on 2022-07-11. Retrieved2022-07-11.
  151. ^Yegulalp, Serdar (2021-10-06)."What is the Rust language? Safe, fast, and easy software development".InfoWorld.Archived from the original on 2022-06-24. Retrieved2022-06-25.
  152. ^McNamara 2021, p. 11.
  153. ^abPopescu, Natalie; Xu, Ziyang; Apostolakis, Sotiris; August, David I.; Levy, Amit (2021-10-15)."Safer at any speed: automatic context-aware safety enhancement for Rust".Proceedings of the ACM on Programming Languages.5 (OOPSLA). Section 2.doi:10.1145/3485480.S2CID 238212612. p. 5:We observe a large variance in the overheads of checked indexing: 23.6% of benchmarks do report significant performance hits from checked indexing, but 64.5% report little-to-no impact and, surprisingly, 11.8% report improved performance ... Ultimately, while unchecked indexing can improve performance, most of the time it does not.
  154. ^McNamara 2021, p. 19, 27.
  155. ^Couprie, Geoffroy (2015). "Nom, A Byte oriented, streaming, Zero copy, Parser Combinators Library in Rust".2015 IEEE Security and Privacy Workshops. pp. 142–148.doi:10.1109/SPW.2015.31.ISBN 978-1-4799-9933-0.S2CID 16608844.
  156. ^McNamara 2021, p. 20.
  157. ^"Code generation".The Rust Reference.Archived from the original on 2022-10-09. Retrieved2022-10-09.
  158. ^"How Fast Is Rust?".The Rust Programming Language FAQ.Archived from the original on 2020-10-28. Retrieved2019-04-11.
  159. ^Farshin, Alireza; Barbette, Tom; Roozbeh, Amir; Maguire, Gerald Q. Jr; Kostić, Dejan (2021). "PacketMill: Toward per-Core 100-GBPS networking".Proceedings of the 26th ACM International Conference on Architectural Support for Programming Languages and Operating Systems. pp. 1–17.doi:10.1145/3445814.3446724.ISBN 9781450383172.S2CID 231949599.Archived from the original on 2022-07-12. Retrieved2022-07-12.... While some compilers (e.g., Rust) support structure reordering [82], C & C++ compilers are forbidden to reorder data structures (e.g., struct or class) [74] ...
  160. ^Gjengset 2021, p. 22.
  161. ^Shankland, Stephen (2016-07-12)."Firefox will get overhaul in bid to get you interested again".CNET.Archived from the original on 2022-07-14. Retrieved2022-07-14.
  162. ^Security Research Team (2013-10-04)."ZeroMQ: Helping us Block Malicious Domains in Real Time".Cisco Umbrella. Archived fromthe original on 2023-05-13. Retrieved2023-05-13.
  163. ^Cimpanu, Catalin (2019-10-15)."AWS to sponsor Rust project".ZDNET. Retrieved2024-07-17.
  164. ^Nichols, Shaun (2018-06-27)."Microsoft's next trick? Kicking things out of the cloud to Azure IoT Edge".The Register.Archived from the original on 2019-09-27. Retrieved2019-09-27.
  165. ^Tung, Liam (2020-04-30)."Microsoft: Why we used programming language Rust over Go for WebAssembly on Kubernetes app".ZDNET.Archived from the original on 2022-04-21. Retrieved2022-04-21.
  166. ^Claburn, Thomas (2022-09-20)."In Rust We Trust: Microsoft Azure CTO shuns C and C++".The Register. Retrieved2024-07-07.
  167. ^Simone, Sergio De (2019-03-10)."NPM Adopted Rust to Remove Performance Bottlenecks".InfoQ.Archived from the original on 2023-11-19. Retrieved2023-11-20.
  168. ^Lyu, Shing (2020)."Welcome to the World of Rust". In Lyu, Shing (ed.).Practical Rust Projects: Building Game, Physical Computing, and Machine Learning Applications. Berkeley, CA: Apress. pp. 1–8.doi:10.1007/978-1-4842-5599-5_1.ISBN 978-1-4842-5599-5. Retrieved2023-11-29.
  169. ^Lyu, Shing (2021)."Rust in the Web World". In Lyu, Shing (ed.).Practical Rust Web Projects: Building Cloud and Web-Based Applications. Berkeley, CA: Apress. pp. 1–7.doi:10.1007/978-1-4842-6589-5_1.ISBN 978-1-4842-6589-5. Retrieved2023-11-29.
  170. ^abcLi, Hongyu; Guo, Liwei; Yang, Yexuan; Wang, Shangguang; Xu, Mengwei (2024-06-30)."An Empirical Study of Rust-for-Linux: The Success, Dissatisfaction, and Compromise".USENIX. Retrieved2024-11-28.
  171. ^Corbet, Jonathan (2022-10-13)."A first look at Rust in the 6.1 kernel".LWN.net.Archived from the original on 2023-11-17. Retrieved2023-11-11.
  172. ^Vaughan-Nichols, Steven (2021-12-07)."Rust takes a major step forward as Linux's second official language".ZDNET. Retrieved2024-11-27.
  173. ^Corbet, Jonathan (2022-11-17)."Rust in the 6.2 kernel".LWN.net. Retrieved2024-11-28.
  174. ^Corbet, Jonathan (2024-09-24)."Committing to Rust in the kernel".LWN.net. Retrieved2024-11-28.
  175. ^Amadeo, Ron (2021-04-07)."Google is now writing low-level Android code in Rust".Ars Technica.Archived from the original on 2021-04-08. Retrieved2022-04-21.
  176. ^Darkcrizt (2021-04-02)."Google Develops New Bluetooth Stack for Android, Written in Rust".Desde Linux. Archived fromthe original on 2021-08-25. Retrieved2024-08-31.
  177. ^Claburn, Thomas (2023-04-27)."Microsoft is rewriting core Windows libraries in Rust".The Register.Archived from the original on 2023-05-13. Retrieved2023-05-13.
  178. ^Proven, Liam (2023-12-01)."Small but mighty, 9Front's 'Humanbiologics' is here for the truly curious".The Register. Retrieved2024-03-07.
  179. ^Yegulalp, Serdar (2016-03-21)."Rust's Redox OS could show Linux a few new tricks".InfoWorld. Archived fromthe original on 2016-03-21. Retrieved2016-03-21.
  180. ^Anderson, Tim (2021-01-14)."Another Rust-y OS: Theseus joins Redox in pursuit of safer, more resilient systems".The Register.Archived from the original on 2022-07-14. Retrieved2022-07-14.
  181. ^Boos, Kevin; Liyanage, Namitha; Ijaz, Ramla; Zhong, Lin (2020).Theseus: an Experiment in Operating System Structure and State Management. pp. 1–19.ISBN 978-1-939133-19-9.Archived from the original on 2023-05-13. Retrieved2023-05-13.
  182. ^Zhang, HanDong (2023-01-31)."2022 Review | The adoption of Rust in Business".Rust Magazine. Retrieved2023-02-07.
  183. ^Sei, Mark (2018-10-10)."Fedora 29 new features: Startis now officially in Fedora".Marksei, Weekly sysadmin pills.Archived from the original on 2019-04-13. Retrieved2019-05-13.
  184. ^Proven, Liam (2022-07-12)."Oracle Linux 9 released, with some interesting additions".The Register.Archived from the original on 2022-07-14. Retrieved2022-07-14.
  185. ^Proven, Liam (2023-02-02)."System76 teases features coming in homegrown Rust-based desktop COSMIC".The Register.Archived from the original on 2024-07-17. Retrieved2024-07-17.
  186. ^Hu, Vivian (2020-06-12)."Deno Is Ready for Production".InfoQ.Archived from the original on 2020-07-01. Retrieved2022-07-14.
  187. ^Abrams, Lawrence (2021-02-06)."This Flash Player emulator lets you securely play your old games".Bleeping Computer.Archived from the original on 2021-12-25. Retrieved2021-12-25.
  188. ^Kharif, Olga (2020-10-17)."Ethereum Blockchain Killer Goes By Unassuming Name of Polkadot".Bloomberg News.Bloomberg L.P.Archived from the original on 2020-10-17. Retrieved2021-07-14.
  189. ^Keizer, Gregg (2016-10-31)."Mozilla plans to rejuvenate Firefox in 2017".Computerworld.Archived from the original on 2023-05-13. Retrieved2023-05-13.
  190. ^Claburn, Thomas (2023-01-12)."Google polishes Chromium code with a layer of Rust".The Register. Retrieved2024-07-17.
  191. ^Jansens, Dana (2023-01-12)."Supporting the Use of Rust in the Chromium Project".Google Online Security Blog.Archived from the original on 2023-01-13. Retrieved2023-11-12.
  192. ^abc"2025 Stack Overflow Developer Survey – Technology".Stack Overflow. Retrieved2025-08-09.
  193. ^Claburn, Thomas (2022-06-23)."Linus Torvalds says Rust is coming to the Linux kernel".The Register.Archived from the original on 2022-07-28. Retrieved2022-07-15.
  194. ^Jung, Ralf; Jourdan, Jacques-Henri; Krebbers, Robbert; Dreyer, Derek (2017-12-27)."RustBelt: securing the foundations of the Rust programming language".Proceedings of the ACM on Programming Languages.2 (POPL):1–34.doi:10.1145/3158154.hdl:21.11116/0000-0003-34C6-3.ISSN 2475-1421.
  195. ^Popescu, Natalie; Xu, Ziyang; Apostolakis, Sotiris; August, David I.; Levy, Amit (2021-10-20)."Safer at any speed: automatic context-aware safety enhancement for Rust".Proceedings of the ACM on Programming Languages.5 (OOPSLA):1–23.doi:10.1145/3485480.ISSN 2475-1421.
  196. ^Blanco-Cuaresma, Sergi; Bolmont, Emeline (2017-05-30)."What can the programming language Rust do for astrophysics?".Proceedings of the International Astronomical Union.12 (S325):341–344.arXiv:1702.02951.Bibcode:2017IAUS..325..341B.doi:10.1017/S1743921316013168.ISSN 1743-9213.S2CID 7857871.Archived from the original on 2022-06-25. Retrieved2022-06-25.
  197. ^Wallach, Dan."TRACTOR: Translating All C to Rust".DARPA. Retrieved2025-08-03.
  198. ^Klabnik & Nichols 2019, p. 4.
  199. ^"Getting Started".The Rust Programming Language.Archived from the original on 2020-11-01. Retrieved2020-10-11.
  200. ^The Rust Survey Team (2025-02-13)."2024 State of Rust Survey Results".The Rust Programming Language. Retrieved2025-09-07.
  201. ^Tung, Liam (2021-02-08)."The Rust programming language just took a huge step forwards".ZDNET.Archived from the original on 2022-07-14. Retrieved2022-07-14.
  202. ^Krill, Paul (2021-02-09)."Rust language moves to independent foundation".InfoWorld.Archived from the original on 2021-04-10. Retrieved2021-04-10.
  203. ^Vaughan-Nichols, Steven J. (2021-04-09)."AWS's Shane Miller to head the newly created Rust Foundation".ZDNET.Archived from the original on 2021-04-10. Retrieved2021-04-10.
  204. ^Vaughan-Nichols, Steven J. (2021-11-17)."Rust Foundation appoints Rebecca Rumbul as executive director".ZDNET.Archived from the original on 2021-11-18. Retrieved2021-11-18.
  205. ^"Governance".The Rust Programming Language.Archived from the original on 2025-10-02. Retrieved2025-11-19.
  206. ^"Introducing the Rust Leadership Council".Rust Blog. 2023-06-20. Retrieved2024-01-12.

External links

[edit]
Wikibooks has a book on the topic of:Rust for the Novice Programmer
Rust at Wikipedia'ssister projects
Compilers
Package management and build tools
Libraries and frameworks
Development environments
Verification, testing, and analysis
Embedded and real-time systems
Related topics
Projects
Mozilla
Labs
Mozilla
Research
Mozilla
Foundation
Firefox
Origins
Frameworks
Components
Typefaces
Discontinued
Forks
Discontinued projects are initalics. Some projects abandoned by Mozilla that are still maintained by third parties are inunderline.
Organization
Foundation
Official affiliates
People
Community
Other topics
International
National
Other
Portal:
Retrieved from "https://en.wikipedia.org/w/index.php?title=Rust_(programming_language)&oldid=1324335692"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp