Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/incoming' into incoming
Browse files Browse the repository at this point in the history
  • Loading branch information
erickt committed Mar 1, 2013
2 parents d2c4b64 + a660bb3 commit 85fecd0
Show file tree
Hide file tree
Showing 236 changed files with 1,504 additions and 1,192 deletions.
3 changes: 1 addition & 2 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -2304,11 +2304,10 @@ mod farm {
farmer: Human
}
// Note - visibility modifiers on impls currently have no effect
impl Farm {
priv fn feed_chickens(&self) { ... }
priv fn feed_cows(&self) { ... }
fn add_chicken(&self, c: Chicken) { ... }
pub fn add_chicken(&self, c: Chicken) { ... }
}
pub fn feed_animals(farm: &Farm) {
Expand Down
11 changes: 11 additions & 0 deletions src/etc/gedit/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Add syntax highlighting for Mozilla Rust in GtkSourceView (used by GEdit).


Instructions for Ubuntu Linux 12.04+

1) Close all instances of GEdit

2) Copy the included "share" folder into "~/.local/"

3) Open a shell in "~/.local/share/" and run "update-mime-database mime"

264 changes: 264 additions & 0 deletions src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- Syntax highlighting for the under-development Mozilla Rust language -->

<language id="rust" _name="Rust" version="2.0" _section="Sources">
<metadata>
<property name="mimetypes">text/x-rust</property>
<property name="globs">*.rs;*.rc</property>
<property name="line-comment-start">//</property>
<property name="block-comment-start">/*</property>
<property name="block-comment-end">*/</property>
</metadata>

<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="string" _name="String" map-to="def:string"/>
<style id="char" _name="Character" map-to="def:character"/>
<style id="keyword" _name="Keyword" map-to="def:keyword"/>
<style id="type" _name="Data Type" map-to="def:type"/>
<style id="constant" _name="Constant" map-to="def:constant"/>
<style id="identifier" _name="Identifier" map-to="def:identifier"/>
<style id="number" _name="Number" map-to="def:decimal"/>
<style id="scope" _name="Scope" map-to="def:preprocessor"/>
</styles>

<definitions>

<context id="function" style-ref="keyword">
<keyword>fn</keyword>
</context>

<context id="type" style-ref="keyword">
<keyword>type</keyword>
</context>

<context id="keywords" style-ref="keyword">
<keyword>as</keyword>
<keyword>assert</keyword>
<keyword>break</keyword>
<keyword>const</keyword>
<keyword>copy</keyword>
<keyword>do</keyword>
<keyword>drop</keyword>
<keyword>else</keyword>
<keyword>enum</keyword>
<keyword>export</keyword>
<keyword>extern</keyword>
<keyword>fail</keyword>
<keyword>for</keyword>
<keyword>if</keyword>
<keyword>impl</keyword>
<keyword>let</keyword>
<keyword>log</keyword>
<keyword>loop</keyword>
<keyword>match</keyword>
<keyword>mod</keyword>
<keyword>move</keyword>
<keyword>mut</keyword>
<keyword>priv</keyword>
<keyword>pub</keyword>
<keyword>pure</keyword>
<keyword>ref</keyword>
<keyword>return</keyword>
<keyword>static</keyword>
<keyword>struct</keyword>
<keyword>trait</keyword>
<keyword>unsafe</keyword>
<keyword>use</keyword>
<keyword>while</keyword>
</context>

<context id="types" style-ref="type">
<keyword>bool</keyword>
<keyword>int</keyword>
<keyword>uint</keyword>
<keyword>i8</keyword>
<keyword>i16</keyword>
<keyword>i32</keyword>
<keyword>i64</keyword>
<keyword>u8</keyword>
<keyword>u16</keyword>
<keyword>u32</keyword>
<keyword>u64</keyword>
<keyword>f32</keyword>
<keyword>f64</keyword>
<keyword>float</keyword>
<keyword>char</keyword>
<keyword>str</keyword>
<keyword>Either</keyword>
<keyword>Option</keyword>
<keyword>Result</keyword>
</context>

<context id="ctypes" style-ref="type">
<keyword>c_float</keyword>
<keyword>c_double</keyword>
<keyword>c_void</keyword>
<keyword>FILE</keyword>
<keyword>fpos_t</keyword>
<keyword>DIR</keyword>
<keyword>dirent</keyword>
<keyword>c_char</keyword>
<keyword>c_schar</keyword>
<keyword>c_uchar</keyword>
<keyword>c_short</keyword>
<keyword>c_ushort</keyword>
<keyword>c_int</keyword>
<keyword>c_uint</keyword>
<keyword>c_long</keyword>
<keyword>c_ulong</keyword>
<keyword>size_t</keyword>
<keyword>ptrdiff_t</keyword>
<keyword>clock_t</keyword>
<keyword>time_t</keyword>
<keyword>c_longlong</keyword>
<keyword>c_ulonglong</keyword>
<keyword>intptr_t</keyword>
<keyword>uintptr_t</keyword>
<keyword>off_t</keyword>
<keyword>dev_t</keyword>
<keyword>ino_t</keyword>
<keyword>pid_t</keyword>
<keyword>mode_t</keyword>
<keyword>ssize_t</keyword>
</context>

<context id="self" style-ref="identifier">
<keyword>self</keyword>
</context>

<context id="constants" style-ref="constant">
<keyword>true</keyword>
<keyword>false</keyword>
<keyword>Some</keyword>
<keyword>None</keyword>
<keyword>Left</keyword>
<keyword>Right</keyword>
<keyword>Ok</keyword>
<keyword>Err</keyword>
<keyword>Success</keyword>
<keyword>Failure</keyword>
<keyword>Cons</keyword>
<keyword>Nil</keyword>
</context>

<context id="cconstants" style-ref="constant">
<keyword>EXIT_FAILURE</keyword>
<keyword>EXIT_SUCCESS</keyword>
<keyword>RAND_MAX</keyword>
<keyword>EOF</keyword>
<keyword>SEEK_SET</keyword>
<keyword>SEEK_CUR</keyword>
<keyword>SEEK_END</keyword>
<keyword>_IOFBF</keyword>
<keyword>_IONBF</keyword>
<keyword>_IOLBF</keyword>
<keyword>BUFSIZ</keyword>
<keyword>FOPEN_MAX</keyword>
<keyword>FILENAME_MAX</keyword>
<keyword>L_tmpnam</keyword>
<keyword>TMP_MAX</keyword>
<keyword>O_RDONLY</keyword>
<keyword>O_WRONLY</keyword>
<keyword>O_RDWR</keyword>
<keyword>O_APPEND</keyword>
<keyword>O_CREAT</keyword>
<keyword>O_EXCL</keyword>
<keyword>O_TRUNC</keyword>
<keyword>S_IFIFO</keyword>
<keyword>S_IFCHR</keyword>
<keyword>S_IFBLK</keyword>
<keyword>S_IFDIR</keyword>
<keyword>S_IFREG</keyword>
<keyword>S_IFMT</keyword>
<keyword>S_IEXEC</keyword>
<keyword>S_IWRITE</keyword>
<keyword>S_IREAD</keyword>
<keyword>S_IRWXU</keyword>
<keyword>S_IXUSR</keyword>
<keyword>S_IWUSR</keyword>
<keyword>S_IRUSR</keyword>
<keyword>F_OK</keyword>
<keyword>R_OK</keyword>
<keyword>W_OK</keyword>
<keyword>X_OK</keyword>
<keyword>STDIN_FILENO</keyword>
<keyword>STDOUT_FILENO</keyword>
<keyword>STDERR_FILENO</keyword>
</context>

<context id="line-comment" style-ref="comment" end-at-line-end="true" class="comment" class-disabled="no-spell-check">
<start>//</start>
<include>
<context ref="def:in-line-comment"/>
</include>
</context>

<context id="block-comment" style-ref="comment" class="comment" class-disabled="no-spell-check">
<start>/\*</start>
<end>\*/</end>
<include>
<context ref="def:in-comment"/>
</include>
</context>

<context id="number" style-ref="number">
<match extended="true">
(?&lt;![\w\.])
(
0x[0-9a-fA-F_]+(u8|u16|u32|u64|i8|i16|i32|i64|u|i)?|
0b[0-1_]+(u8|u16|u32|u64|i8|i16|i32|i64|u|i)?|
[0-9][0-9_]*\.[0-9_]*([eE][+-]?[0-9_]+)?(f32|f64|f)?|
[0-9][0-9_]*(u8|u16|u32|u64|i8|i16|i32|i64|u|i)?
)
(?![\w\.])
</match>
</context>

<context id="scope" style-ref="scope">
<match extended="true">
[a-zA-Z_][a-zA-Z0-9_]*::
</match>
</context>

<context id="string" style-ref="string" class="string" class-disabled="no-spell-check">
<start>"</start>
<end>"</end>
<include>
<context ref="def:escape"/>
<context ref="def:line-continue"/>
</include>
</context>

<context id="char" style-ref="char" end-at-line-end="true" class="char" class-disabled="no-spell-check">
<start>'</start>
<end>'</end>
<include>
<context ref="def:escape"/>
</include>
</context>

<context id="rust" class="no-spell-check">
<include>
<context ref="function"/>
<context ref="type"/>
<context ref="keywords"/>
<context ref="types"/>
<context ref="ctypes"/>
<context ref="self"/>
<context ref="constants"/>
<context ref="cconstants"/>
<context ref="line-comment"/>
<context ref="block-comment"/>
<context ref="number"/>
<context ref="scope"/>
<context ref="string"/>
<context ref="char"/>
</include>
</context>

</definitions>

</language>

7 changes: 7 additions & 0 deletions src/etc/gedit/share/mime/packages/rust.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/x-rust">
<comment>Rust Source</comment>
<glob pattern="*.rs"/>
<glob pattern="*.rc"/>
</mime-type>
</mime-info>
2 changes: 1 addition & 1 deletion src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub pure fn empty_cell<T>() -> Cell<T> {
Cell { value: None }
}

impl<T> Cell<T> {
pub impl<T> Cell<T> {
/// Yields the value, failing if the cell is empty.
fn take() -> T {
if self.is_empty() {
Expand Down
9 changes: 3 additions & 6 deletions src/libcore/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// Transitional -- needs snapshot
#[allow(structural_records)];

use either::{Either, Left, Right};
use kinds::Owned;
use option;
Expand Down Expand Up @@ -190,7 +187,7 @@ pub fn PortSet<T: Owned>() -> PortSet<T>{
}
}

impl<T: Owned> PortSet<T> {
pub impl<T: Owned> PortSet<T> {

fn add(port: Port<T>) {
self.ports.push(port)
Expand Down Expand Up @@ -323,12 +320,12 @@ pub fn oneshot<T: Owned>() -> (PortOne<T>, ChanOne<T>) {
(port, chan)
}

impl<T: Owned> PortOne<T> {
pub impl<T: Owned> PortOne<T> {
fn recv(self) -> T { recv_one(self) }
fn try_recv(self) -> Option<T> { try_recv_one(self) }
}

impl<T: Owned> ChanOne<T> {
pub impl<T: Owned> ChanOne<T> {
fn send(self, data: T) { send_one(self, data) }
fn try_send(self, data: T) -> bool { try_send_one(self, data) }
}
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct Condition<T, U> {
key: task::local_data::LocalDataKey<Handler<T, U>>
}

impl<T, U> Condition<T, U> {
pub impl<T, U> Condition<T, U> {
fn trap(&self, h: &self/fn(T) -> U) -> Trap/&self<T, U> {
unsafe {
let p : *RustClosure = ::cast::transmute(&h);
Expand Down Expand Up @@ -69,7 +69,7 @@ struct Trap<T, U> {
handler: @Handler<T, U>
}

impl<T, U> Trap<T, U> {
pub impl<T, U> Trap<T, U> {
fn in<V>(&self, inner: &self/fn() -> V) -> V {
unsafe {
let _g = Guard { cond: self.cond };
Expand Down
4 changes: 0 additions & 4 deletions src/libcore/core.rc
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,6 @@ pub const debug : u32 = 4_u32;

// The runtime interface used by the compiler
#[cfg(notest)] pub mod rt;
// The runtime and compiler interface to fmt!
#[cfg(stage0)]
#[path = "private/extfmt.rs"]
pub mod extfmt;
// Private APIs
pub mod private;

Expand Down
6 changes: 3 additions & 3 deletions src/libcore/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ priv impl<T> DListNode<T> {
}
}

impl<T> DListNode<T> {
pub impl<T> DListNode<T> {
/// Get the next node in the list, if there is one.
pure fn next_link(@mut self) -> DListLink<T> {
self.assert_links();
Expand Down Expand Up @@ -208,7 +208,7 @@ priv impl<T> DList<T> {
}
}

impl<T> DList<T> {
pub impl<T> DList<T> {
/// Get the size of the list. O(1).
pure fn len(@mut self) -> uint { self.size }
/// Returns true if the list is empty. O(1).
Expand Down Expand Up @@ -457,7 +457,7 @@ impl<T> DList<T> {
}
}

impl<T:Copy> DList<T> {
pub impl<T:Copy> DList<T> {
/// Remove data from the head of the list. O(1).
fn pop(@mut self) -> Option<T> {
self.pop_n().map(|nobe| nobe.data)
Expand Down
Loading

1 comment on commit 85fecd0

@brson
Copy link

@brson brson commented on 85fecd0 Mar 1, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

Please sign in to comment.