librustc: Ensure that type parameters are in the right positions in paths.

This removes the stacking of type parameters that occurs when invoking
trait methods, and fixes all places in the standard library that were
relying on it. It is somewhat awkward in places; I think we'll probably
want something like the `Foo::<for T>::new()` syntax.
This commit is contained in:
Patrick Walton 2013-08-08 11:38:10 -07:00
parent 3b6314c39b
commit 8693943676
70 changed files with 1130 additions and 528 deletions

View file

@ -538,7 +538,8 @@ mod test {
#[test]
fn option_empty() {
assert!(AtomicOption::empty::<()>().is_empty(SeqCst));
let mut option: AtomicOption<()> = AtomicOption::empty();
assert!(option.is_empty(SeqCst));
}
#[test]

View file

@ -13,7 +13,7 @@
use c_str::ToCStr;
use cast::transmute;
use libc::{c_char, c_void, size_t, uintptr_t};
use option::{Some, None};
use option::{Option, None, Some};
use sys;
use rt::task::Task;
use rt::local::Local;
@ -37,7 +37,8 @@ pub fn fail_bounds_check(file: *c_char, line: size_t,
#[lang="malloc"]
pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
// XXX: Unsafe borrow for speed. Lame.
match Local::try_unsafe_borrow::<Task>() {
let task: Option<*mut Task> = Local::try_unsafe_borrow();
match task {
Some(task) => {
(*task).heap.alloc(td as *c_void, size as uint) as *c_char
}

View file

@ -279,7 +279,8 @@ pub unsafe fn atomically<U>(f: &fn() -> U) -> U {
use rt::task::{Task, GreenTask, SchedTask};
use rt::local::Local;
match Local::try_unsafe_borrow::<Task>() {
let task_opt: Option<*mut Task> = Local::try_unsafe_borrow();
match task_opt {
Some(t) => {
match (*t).task_type {
GreenTask(_) => {