More test fixes!

This commit is contained in:
Alex Crichton 2015-01-05 19:13:38 -08:00
parent ee9921aaed
commit 4b359e3aee
42 changed files with 50 additions and 328 deletions

View file

@ -10,7 +10,7 @@
// Test inherant trait impls work cross-crait.
pub trait Bar<'a> for ?Sized : 'a {}
pub trait Bar<'a> : 'a {}
impl<'a> Bar<'a> {
pub fn bar(&self) {}

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// force-host
#[macro_export]
macro_rules! macro_one { () => ("one") }

View file

@ -11,8 +11,6 @@
// Test equality constraints in a where clause where the type being
// equated appears in a supertrait.
#![feature(associated_types)]
pub trait Vehicle {
type Color;

View file

@ -11,8 +11,6 @@
// Test equality constraints in a where clause where the type being
// equated appears in a supertrait.
#![feature(associated_types)]
pub trait Vehicle {
type Color;

View file

@ -11,8 +11,6 @@
// Test equality constraints in a where clause where the type being
// equated appears in a supertrait.
#![feature(associated_types)]
pub trait Vehicle {
type Color;

View file

@ -1,33 +0,0 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
trait Get {
type Value; //~ ERROR associated types are experimental
fn get(&self) -> Get::Value;
}
struct Struct {
x: int,
}
impl Get for Struct {
type Value = int; //~ ERROR associated types are experimental
fn get(&self) -> int {
self.x
}
}
fn main() {
let s = Struct {
x: 100,
};
assert_eq!(s.get(), 100);
}

View file

@ -11,8 +11,6 @@
// Test that we report an error if the trait ref in an qualified type
// uses invalid type arguments.
#![feature(associated_types)]
trait Foo<T> {
type Bar;
fn get_bar(&self) -> Self::Bar;

View file

@ -11,8 +11,6 @@
// Test that we do not ICE when an impl is missing an associated type (and that we report
// a useful error, of course).
#![feature(associated_types)]
trait Trait {
type Type;
}

View file

@ -1,22 +0,0 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// aux-build:default_type_params_xc.rs
#![deny(default_type_param_usage)]
extern crate default_type_params_xc;
pub struct FooAlloc;
pub type VecFoo<T> = default_type_params_xc::FakeVec<T, FooAlloc>;
//~^ ERROR: default type parameters are experimental
fn main() {}

View file

@ -1,15 +0,0 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct Heap;
struct Vec<T, A = Heap>; //~ ERROR: default type parameters are experimental
fn main() {}

View file

@ -1,14 +0,0 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::*;
//~^ ERROR: glob import statements are experimental
fn main() {}

View file

@ -10,7 +10,7 @@
fn main() {
assert!(1 == 2)
assert!(3 == 4) //~ ERROR expected one of `.`, `;`, or `}`, found `assert`
assert!(3 == 4) //~ ERROR expected one of `.`, `;`, `}`, or an operator, found `assert`
println!("hello");
}

View file

@ -13,8 +13,8 @@ fn main() {
// (separate lines to ensure the spans are accurate)
// SNAP c894171 uncomment this after the next snapshot
// NOTE(stage0) just in case tidy doesn't check SNAP's in tests
// SNAP b2085d9 uncomment this after the next snapshot
// NOTE(stage0) just in case tidy doesn't check snap's in tests
// let &_ // ~ ERROR expected `&mut int`, found `&_`
// = foo;
let &mut _ = foo;

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_types)]
trait X {}
trait Iter {

View file

@ -20,7 +20,7 @@ fn f2<X>(x: &X) {
}
// Bounded.
trait T for {}
trait T {}
fn f3<X: ?Sized + T>(x: &X) {
f4::<X>(x);
//~^ ERROR the trait `core::kinds::Sized` is not implemented

View file

@ -18,8 +18,6 @@ pub fn main() {
unsafe {
let foo = &A as *const u8;
assert_eq!(str::from_utf8_unchecked(&A), "hi");
assert_eq!(String::from_raw_buf_len(foo, A.len()), "hi".to_string());
assert_eq!(String::from_raw_buf_len(C, B.len()), "hi".to_string());
assert!(*C == A[0]);
assert!(*(&B[0] as *const u8) == A[0]);
}

View file

@ -16,7 +16,7 @@
use std::kinds::Sized;
// Note: this must be generic for the problem to show up
trait Foo<A> for ?Sized {
trait Foo<A> {
fn foo(&self);
}

View file

@ -27,7 +27,7 @@ struct Foo<'a,'tcx:'a> {
impl<'a,'tcx> Foo<'a,'tcx> {
fn bother(&mut self) -> int {
self.elaborate_bounds(|this| {
self.elaborate_bounds(box |this| {
// (*) Here: type of `this` is `&'f0 Foo<&'f1, '_2>`,
// where `'f0` and `'f1` are fresh, free regions that
// result from the bound regions on the closure, and `'2`
@ -50,7 +50,7 @@ impl<'a,'tcx> Foo<'a,'tcx> {
fn elaborate_bounds(
&mut self,
mk_cand: for<'b>|this: &mut Foo<'b, 'tcx>| -> int)
mut mk_cand: Box<for<'b> FnMut(&mut Foo<'b, 'tcx>) -> int>)
-> int
{
mk_cand(self)

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::ffi;
use std::io::process::{Command, ProcessOutput};
use std::os;
use std::rt::unwind::try;
@ -34,7 +35,8 @@ fn start(argc: int, argv: *const *const u8) -> int {
let args = unsafe {
range(0, argc as uint).map(|i| {
String::from_raw_buf(*argv.offset(i as int)).into_bytes()
let ptr = *argv.offset(i as int) as *const _;
ffi::c_str_to_bytes(&ptr).to_vec()
}).collect::<Vec<_>>()
};
let me = args[0].as_slice();

View file

@ -12,9 +12,9 @@
// Test syntax checks for `?Sized` syntax.
trait T1 for ?Sized {}
pub trait T2 for ?Sized {}
trait T3<X: T1> for ?Sized: T2 {}
trait T1 {}
pub trait T2 {}
trait T3<X: T1> : T2 {}
trait T4<X: ?Sized> {}
trait T5<X: ?Sized, Y> {}
trait T6<Y, X: ?Sized> {}

View file

@ -22,7 +22,7 @@ fn f2<X>(x: &X) {
}
// Bounded.
trait T for ?Sized {}
trait T {}
fn f3<X: T+?Sized>(x: &X) {
f3::<X>(x);
}
@ -32,7 +32,7 @@ fn f4<X: T>(x: &X) {
}
// Self type.
trait T2 for ?Sized {
trait T2 {
fn f() -> Box<Self>;
}
struct S;
@ -48,7 +48,7 @@ fn f6<X: T2>(x: &X) {
let _: Box<X> = T2::f();
}
trait T3 for ?Sized {
trait T3 {
fn f() -> Box<Self>;
}
impl T3 for S {

View file

@ -11,6 +11,8 @@
#![feature(lang_items)]
#![no_std]
extern crate "std" as other;
#[macro_use]
extern crate core;
extern crate libc;
@ -22,10 +24,6 @@ use core::option::Option::Some;
use core::slice::SliceExt;
use collections::vec::Vec;
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
// Issue #16806
#[start]