Skip to content

Instantly share code, notes, and snippets.

diff --git a/js/src/builtin/TypedObject.js b/js/src/builtin/TypedObject.js
index 3821665..59ee049 100644
--- a/js/src/builtin/TypedObject.js
+++ b/js/src/builtin/TypedObject.js
@@ -1430,7 +1430,7 @@ function MapTypedParImplDepth1(inArray, inArrayType, outArrayType, func) {
return outArray;
function redirect(typedObj, offset) {
- if (!InParallelSection() || !outGrainTypeIsTransparent) {
+ if (!outGrainTypeIsTransparent || !InParallelSection()) {

RFC: Opt-in builtin traits

In today's Rust, there are a number of builtin traits (sometimes called "kinds"): Send, Freeze, Share, and Pod (in the future, perhaps Sized). These are expressed as traits, but they are quite unlike other traits in certain ways. One way is that they do not have any methods; instead, implementing a trait like Freeze indicates that the type has certain properties (defined below). The biggest difference, though, is that these traits are not implemented manually by users. Instead, the compiler decides automatically whether or not a

@nikomatsakis
nikomatsakis / gist:9272598
Created February 28, 2014 15:01
RFC: Strong guarantees for mutable borrows

Today, if you do a mutable borrow of a local variable, you lose the ability to write to that variable except through the new reference you just created:

let mut x = 3;
let p = &mut x;
x += 1;  // Error
*p += 1; // OK

However, you retain the ability to read the original variable:

template<typename K, typename V>
class entry {
K key;
V value;
public:
entry(K&& key, V&& value)
: key(key), value(value) { }
};
commit a0049922adf1efd3ac0f416f6bf2bea472b08277
Author: Niko Matsakis <niko@alum.mit.edu>
Date: Tue Mar 4 10:20:16 2014 -0500
WIP -- new tests, patch
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index 2ba008b..6a2c4e2 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
commit 23a1d59063159b233cfb559f77c6149df5be62d6
Author: Niko Matsakis <niko@alum.mit.edu>
Date: Fri Mar 7 11:10:14 2014 -0500
WIP nits
diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs
index a48c640..ad7a418 100644
--- a/src/librustc/middle/trans/callee.rs
+++ b/src/librustc/middle/trans/callee.rs
@nikomatsakis
nikomatsakis / gist:9546184
Created March 14, 2014 11:40
A plausible approach for Rust ordering
## Ord trait
A possible Ord trait definition:
enum Ordering {
LessThan, Equal, GreaterThan
}
// Defines both a partial and total ordering.
// The partial ordering may contain unordered
fn foo<type T>(f: fn() -> ~T) {
let y: T;
{
let z = f();
y = *z;
}
// y points into freed memory
}
compare to:
@nikomatsakis
nikomatsakis / Revisions.markdown
Created April 3, 2014 13:40
Typed object revisions

Typed objects revisions

Note: This is my current thinking and I am updating it as I go. There is some historical record of broken versions down below.

Summary

  1. New kind of value type representing "fat pointers"
  2. Remove opaqueType() and valueType() type transformers
  3. Introduce ConstType() constructor
#![feature(managed_boxes)]
fn foo<'a>(x: &'a @int) -> &'a int {
match x {
&ref y => {
&**y // Do not expect an error here
}
}
}