rust is a systems programming language that runs
play

Rust is a systems programming language that runs blazingly fast, - PowerPoint PPT Presentation


  1. ����� � ���� ������ ������������������������� �������������������������� � � � � � � � � � � �������� ��� ����������� ����� ����� ��� �� ���� ����� �� �� ���� ���� ��� RUST DISTILLED : AN EXPRESSIVE TOWER OF LANGUAGES Aaron Weiss , Daniel Patterson, Amal Ahmed Northeastern University and Inria Paris

  2. “ Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. – the official Rust website

  3. “ systems programming Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. – the official Rust website

  4. “ Rust is a systems programming blazingly fast language that runs blazingly fast, prevents segfaults, and guarantees thread safety. – the official Rust website

  5. “ Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees prevents segfaults, guarantees thread safety. thread safety. – the official Rust website

  6. Memory safety without garbage collection Abstraction without overhead Concurrency without data races Stability without stagnation Hack without fear.

  7. WE HAVE CUTE CRABS

  8. ... BUT HOW?

  9. ... BUT HOW? Ownership x y z identifiers "own" values

  10. ... BUT HOW? Ownership x y z identifiers "own" values Borrowing x y z &x references "borrow" values

  11. A PROGRAM IN RUST extern crate irc; use irc �:; client �:; prelude �:; *; fn main() �-? irc �:; error �:; Result<()> { let config = Config { ��../ }; let mut reactor = IrcReactor �:; new()?; let client = reactor.prepare_client_and_connect(&config)?; client.identify()?; reactor.register_client_with_handler(client, |client, message| { print!("{}", message); Ok(()) }); reactor.run()?; }

  12. A PROGRAM IN RUST extern crate irc; use irc �:; client �:; prelude �:; *; fn main() �-? irc �:; error �:; Result<()> { let config = Config { ��../ }; let mut reactor = IrcReactor �:; new()?; let client = reactor.prepare_client_and_connect(&config)?; client.identify()?; reactor.register_client_with_handler(client, |client, message| { print!("{}", message); Ok(()) }); reactor.run()?; }

  13. A PROGRAM IN RUST extern crate irc; use irc �:; client �:; prelude �:; *; fn main() �-? irc �:; error �:; Result<()> { let config = Config { ��../ }; let mut reactor = IrcReactor �:; new()?; let client = reactor.prepare_client_and_connect(&config)?; client.identify()?; reactor.register_client_with_handler(client, |client, message| { print!("{}", message); Ok(()) }); reactor.run()?; }

  14. A PROGRAM IN RUST extern crate irc; use irc �:; client �:; prelude �:; *; fn main() �-? irc �:; error �:; Result<()> { let config = Config { ��../ }; let mut reactor = IrcReactor �:; new()?; let client = reactor.prepare_client_and_connect(&config)?; client.identify()?; reactor.register_client_with_handler(client, |client, message| { print!("{}", message); Ok(()) }); reactor.run()?; }

  15. A PROGRAM IN RUST extern crate irc; use irc �:; client �:; prelude �:; *; fn main() �-? irc �:; error �:; Result<()> { let config = Config { ��../ }; let mut reactor = IrcReactor �:; new()?; let client = reactor.prepare_client_and_connect(&config)?; client.identify()?; reactor.register_client_with_handler(client, |client, message| { print!("{}", message); Ok(()) }); reactor.run()?; }

  16. A PROGRAM IN RUST extern crate irc; use irc �:; client �:; prelude �:; *; fn main() �-? irc �:; error �:; Result<()> { let config = Config { ��../ }; let mut reactor = IrcReactor �:; new()?; let client = reactor.prepare_client_and_connect(&config)?; client.identify()?; reactor.register_client_with_handler(client, |client, message| { print!("{}", message); Ok(()) }); reactor.run()?; }

  17. A PROGRAM IN RUST extern crate irc; use irc �:; client �:; prelude �:; *; fn main() �-? irc �:; error �:; Result<()> { let config = Config { ��../ }; let mut reactor = IrcReactor �:; new()?; let client = reactor.prepare_client_and_connect(&config)?; &config client.identify()?; reactor.register_client_with_handler(client, |client, message| { print!("{}", message); Ok(()) }); reactor.run()?; }

  18. A PROGRAM IN RUST extern crate irc; use irc �:; client �:; prelude �:; *; fn main() �-? irc �:; error �:; Result<()> { let config = Config { ��../ }; let mut reactor = IrcReactor �:; new()?; let client = reactor.prepare_client_and_connect(&config)?; client.identify()?; reactor.register_client_with_handler(client, |client, message| { client print!("{}", message); Ok(()) }); reactor.run()?; }

  19. ⊢ γεια ⊢ ελλάδα

  20. THE CURRENT STATE OF AFFAIRS

  21. THE CURRENT STATE OF AFFAIRS RUST interprocedural static analysis with ad-hoc constraint solving

  22. THE CURRENT STATE OF AFFAIRS RUST interprocedural static analysis with ad-hoc constraint solving RUSTBELT (JUNG, JOURDAN, KREBBERS, AND DREYER, POPL '18) formal language specified in Iris but low-level, in a CPS-style .

  23. BUT WE WANT TO DO BETTER

  24. BUT WE WANT TO DO BETTER

  25. CAPABILITIES FOR OWNERSHIP x y z

  26. CAPABILITIES FOR OWNERSHIP x y z capabilities guard the use of identifiers

  27. BORROWS BREAK CAPABILITIES INTO FRACTIONS x y z

  28. BORROWS BREAK CAPABILITIES INTO FRACTIONS &x x y z

  29. BORROWS BREAK CAPABILITIES INTO FRACTIONS &x x y z

  30. BORROWS BREAK CAPABILITIES INTO FRACTIONS &x &mut z x y z

  31. BORROWS BREAK CAPABILITIES INTO FRACTIONS &x &mut z x y z

  32. MOVES TAKE THE CAPABILITY AND THE HOLE &x &mut z x y z

  33. MOVES TAKE THE CAPABILITY AND THE HOLE &x &mut z x y z w

  34. WE CALL REFERENCE SITES LOANS extern crate irc; use irc �:; client �:; prelude �:; *; fn main() �-? irc �:; error �:; Result<()> { a loan let config = Config { ��../ }; let mut reactor = IrcReactor �:; new()?; let client = reactor.prepare_client_and_connect(&config)?; &config client.identify()?; reactor.register_client_with_handler(client, |client, message| { print!("{}", message); Ok(()) }); reactor.run()?; }

  35. WHAT ABOUT LIFETIMES?

  36. WHAT ABOUT LIFETIMES? x : u32

  37. WHAT ABOUT LIFETIMES? x : u32 &x : &'x u32

  38. WHAT ABOUT LIFETIMES? x : u32 &x : &'x u32 To keep type-checking tractable, regions correspond to sets of loans.

  39. TYPE CHECKING

  40. TYPE CHECKING global context Σ

  41. TYPE CHECKING global context Σ ; Δ type variable context

  42. TYPE CHECKING global context variable context Σ ; Δ ; Γ type variable context

  43. TYPE CHECKING global context variable context Σ ; Δ ; Γ ; L loan context type variable context

  44. TYPE CHECKING global context variable context region context Σ ; Δ ; Γ ; L ; P loan context type variable context

  45. TYPE CHECKING global context variable context region context Σ ; Δ ; Γ ; L ; P ⊢ e loan context type variable context

  46. TYPE CHECKING global context variable context region context Σ ; Δ ; Γ ; L ; P ⊢ e : τ loan context type variable context

  47. TYPE CHECKING global context variable context region context Σ ; Δ ; Γ ; L ; P ⊢ e : τ ⇒ ε ownership effects loan context type variable context

  48. TYPING BORROWS Γ , x : f τ ; L ; P ⊢ &' a x : Σ ; Δ ;

  49. TYPING BORROWS f ≠ 0 Γ , x : f τ ; L ; P ⊢ &' a x : Σ ; Δ ;

  50. TYPING BORROWS f ≠ 0 x : &{ Γ , x : f τ ; L ; P ⊢ &' a ' a } τ Σ ; Δ ;

  51. TYPING BORROWS f ≠ 0 Γ , x : f τ ; L ; P ⊢ &' a x : &{ ' a } τ Σ ; Δ ; ⇒ borrow imm x as ' a

  52. TYPING BRANCHING Σ ; Δ ; Γ ; L ; P ⊢ if { } else { } e 3 : e 1 e 2 Σ ; Δ ;

  53. TYPING BRANCHING Σ ; Δ ; Γ ; L ; P ⊢ e 1 : bool ⇒ ε 1 Σ ; Δ ; Σ ; Δ ; Γ ; L ; P ⊢ if { } else { } e 3 : e 1 e 2 Σ ; Δ ;

  54. TYPING BRANCHING Σ ; Δ ; Γ ; L ; P ⊢ e 1 : bool ⇒ ε 1 Σ ; Δ ; Σ ; Δ ; Σ ; Δ ; ε 1 ( Γ ); ε 1 ( L ); ε 1 ( P ) ⊢ e 2 : τ 2 ⇒ ε 2 Σ ; Δ ; Γ ; L ; P ⊢ if { } else { } e 3 : e 1 e 2 Σ ; Δ ;

  55. TYPING BRANCHING Σ ; Δ ; Γ ; L ; P ⊢ e 1 : bool ⇒ ε 1 Σ ; Δ ; Σ ; Δ ; Σ ; Δ ; ε 1 ( Γ ); ε 1 ( L ); ε 1 ( P ) ⊢ e 2 : τ 2 ⇒ ε 2 Σ ; Δ ; ε 1 ( Γ ); ε 1 ( L ); ε 1 ( P ) ⊢ e 3 : τ 3 ⇒ ε 3 Σ ; Δ ; Σ ; Δ ; Γ ; L ; P ⊢ if { } else { } e 3 : e 1 e 2 Σ ; Δ ;

  56. TYPING BRANCHING Σ ; Δ ; Γ ; L ; P ⊢ e 1 : bool ⇒ ε 1 Σ ; Δ ; Σ ; Δ ; Σ ; Δ ; ε 1 ( Γ ); ε 1 ( L ); ε 1 ( P ) ⊢ e 2 : τ 2 ⇒ ε 2 Σ ; Δ ; ε 1 ( Γ ); ε 1 ( L ); ε 1 ( P ) ⊢ e 3 : τ 3 ⇒ ε 3 Σ ; Δ ; τ 2 ∼ τ 3 ⇒ τ Σ ; Δ ; Γ ; L ; P ⊢ if { } else { } e 3 : e 1 e 2 Σ ; Δ ;

Recommend


More recommend