This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clone | |
move | |
move | |
Matrix { data: [100, 200, 300] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[deriving(Show)] | |
struct Matrix | |
{ | |
data: Vec<f32> | |
} | |
trait ToMat | |
{ | |
fn to_mat(self) -> Matrix; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io; | |
fn main() | |
{ | |
match io::stdin().read_line().unwrap().as_slice().trim() | |
{ | |
"abc" => println!("def"), | |
_ => () | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test3.rs:106:63: 106:71 error: lifetime of `comp_set` is too short to guarantee its contents can be safely reborrowed | |
test3.rs:106 self.get_comp_idx(Component::get_type(None::<T>)).map(|idx| comp_set.get_mut(idx)) | |
^~~~~~~~ | |
test3.rs:105:2: 115:3 note: `comp_set` would have to be valid for the lifetime &'l as defined on the block at 105:1... | |
test3.rs:105 { | |
test3.rs:106 self.get_comp_idx(Component::get_type(None::<T>)).map(|idx| comp_set.get_mut(idx)) | |
test3.rs:107 | |
test3.rs:108 /* | |
test3.rs:109 match self.get_comp_idx(Component::get_type(None::<T>)) | |
test3.rs:110 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: main | |
main: main.rs Makefile | |
rustc --opt-level 3 --dep-info [email protected] -L ~/lib -g $< | |
-include main.dep | |
.PHONY: clean | |
clean: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- out.ll 2014-05-12 13:20:11.501655442 -0400 | |
+++ in.ll 2014-05-12 13:20:06.781655392 -0400 | |
@@ -1,9 +1,8 @@ | |
-; Function Attrs: uwtable | |
-define internal void @_ZN4test3bug20hf04dd765537e803c3Ua4v0.0E(%struct.Vector* nocapture) unnamed_addr #1 { | |
+; Function Attrs: inlinehint uwtable | |
+define internal void @_ZN4test14vec_speed_vec212closure.2554E(i8*) unnamed_addr #2 { | |
entry-block: | |
%fmt.i = alloca %"struct.std::fmt::Arguments[#1]"* | |
%num = alloca %str_slice |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ModuleID = 'algebloat.rs' | |
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-unknown-linux-gnu" | |
%"struct.core::intrinsics::TypeId[#3]" = type { i64 } | |
%str_slice = type { i8*, i64 } | |
%"struct.test::Bencher[#5]" = type { i64, i64, i64, i64 } | |
%"struct.std::fmt::Arguments[#1]" = type { { %"enum.std::fmt::rt::Piece[#1]"*, i64 }, { %"struct.std::fmt::Argument[#1]"*, i64 } } | |
%"enum.std::fmt::rt::Piece[#1]" = type { i8, [7 x i8], [9 x i64] } | |
%"struct.std::fmt::Argument[#1]" = type { void (%"enum.core::result::Result<(),std::io::IoError>[#3]"*, %"enum.core::any::Void[#3]"*, %"struct.std::fmt::Formatter[#1]"*)*, %"enum.core::any::Void[#3]"* } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::cell::Cell; | |
trait IndexAssign<IDX, RHS> | |
{ | |
fn index_assign(self, idx: IDX, rhs: RHS); | |
} | |
struct ArrayLike | |
{ | |
arr: Vec<Cell<u32>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match (mine_left, mine_right, mine_up, mine_down) | |
{ | |
(true, _, _, _) => world.mine(player.x, player.y, -1, 0), | |
(_, true, _, _) => world.mine(player.x, player.y, 1, 0), | |
(_, _, true, _) => world.mine(player.x, player.y, 0, -1), | |
(_, _, _, true) => world.mine(player.x, player.y, 0, 1), | |
_ => () | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test.rs:5:2: 5:6 error: closure invocation in a `&` reference | |
test.rs:5 (*a)(); | |
^~~~ | |
error: aborting due to previous error |