rollup merge of #20556: japaric/no-for-sized

Conflicts:
	src/libcollections/slice.rs
	src/libcollections/str.rs
	src/libcore/borrow.rs
	src/libcore/cmp.rs
	src/libcore/ops.rs
	src/libstd/c_str.rs
	src/test/compile-fail/issue-19009.rs
This commit is contained in:
Alex Crichton 2015-01-05 18:47:45 -08:00
commit afbce050ca
43 changed files with 101 additions and 77 deletions

View file

@ -12,7 +12,7 @@
#![feature(lang_items)]
#[lang="sized"]
pub trait Sized for Sized? {}
pub trait Sized {}
#[lang="panic"]
fn panic(_: &(&'static str, &'static str, uint)) -> ! { loop {} }

View file

@ -16,7 +16,7 @@
#![no_std]
#[lang="sized"]
pub trait Sized for Sized? {
pub trait Sized {
// Empty.
}

View file

@ -10,7 +10,7 @@
// Test that we cannot create objects from unsized types.
trait Foo for Sized? {}
trait Foo {}
impl Foo for str {}
fn test1<Sized? T: Foo>(t: &T) {

View file

@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub trait Foo for Sized? { fn foo<T>(&self, ext_thing: &T); }
pub trait Bar for Sized?: Foo { }
pub trait Foo { fn foo<T>(&self, ext_thing: &T); }
pub trait Bar: Foo { }
impl<T: Foo> Bar for T { }
pub struct Thing;

View file

@ -0,0 +1,17 @@
// Copyright 2015 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.
// Test that we generate obsolete syntax errors around usages of `for Sized?`
trait Foo for Sized? {} //~ ERROR obsolete syntax: for Sized?
trait Bar for ?Sized {} //~ ERROR obsolete syntax: for Sized?
fn main() { }

View file

@ -11,7 +11,7 @@
#![feature(lang_items)]
#![no_std] // makes debugging this test *a lot* easier (during resolve)
#[lang = "sized"] pub trait Sized for Sized? {}
#[lang = "sized"] pub trait Sized {}
#[lang="copy"] pub trait Copy {}
// Test to make sure that private items imported through globs remain private

View file

@ -11,7 +11,7 @@
#![feature(lang_items)]
#![no_std]
#[lang="sized"] pub trait Sized for Sized? {}
#[lang="sized"] pub trait Sized {}
// error-pattern:requires `start` lang_item

View file

@ -18,7 +18,7 @@ trait Foo<T,U,V=T> {
fn dummy(&self, t: T, u: U, v: V);
}
trait Eq<Sized? X> for Sized? { }
trait Eq<Sized? X> { }
impl<Sized? X> Eq<X> for X { }
fn eq<Sized? A,Sized? B>() where A : Eq<B> { }

View file

@ -20,7 +20,7 @@ trait Foo<T,U> {
fn dummy(&self, t: T, u: U);
}
trait Eq<Sized? X> for Sized? { }
trait Eq<Sized? X> { }
impl<Sized? X> Eq<X> for X { }
fn eq<Sized? A,Sized? B:Eq<A>>() { }

View file

@ -20,7 +20,7 @@ trait Foo<T,U> {
fn dummy(&self, t: T, u: U);
}
trait Eq<Sized? X> for Sized? { }
trait Eq<Sized? X> { }
impl<Sized? X> Eq<X> for X { }
fn eq<Sized? A,Sized? B:Eq<A>>() { }

View file

@ -21,7 +21,7 @@ trait Foo<'a,T,U> {
fn dummy(&'a self) -> &'a (T,U);
}
trait Eq<Sized? X> for Sized? { }
trait Eq<Sized? X> { }
impl<Sized? X> Eq<X> for X { }
fn eq<Sized? A,Sized? B:Eq<A>>() { }

View file

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

View file

@ -11,7 +11,7 @@
// Test `Sized?` local variables.
trait T for Sized? {}
trait T {}
fn f1<Sized? X>(x: &X) {
let _: X; // <-- this is OK, no bindings created, no initializer.

View file

@ -10,7 +10,7 @@
// Test sized-ness checking in substitution in impls.
trait T for Sized? {}
trait T {}
// I would like these to fail eventually.
// impl - bounded

View file

@ -16,7 +16,7 @@
use std::ops::Deref;
pub trait MyEq<Sized? U=Self> for Sized? {
pub trait MyEq<Sized? U=Self> {
fn eq(&self, u: &U) -> bool;
}

View file

@ -14,7 +14,7 @@
struct Splits<'a, T, P>;
struct SplitsN<I>;
trait SliceExt2 for Sized? {
trait SliceExt2 {
type Item;
fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P>

View file

@ -14,7 +14,7 @@
struct Splits<'a, T, P>;
struct SplitsN<I>;
trait SliceExt2 for Sized? {
trait SliceExt2 {
type Item;
fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P>