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:
commit
afbce050ca
43 changed files with 101 additions and 77 deletions
|
|
@ -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 {} }
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#![no_std]
|
||||
|
||||
#[lang="sized"]
|
||||
pub trait Sized for Sized? {
|
||||
pub trait Sized {
|
||||
// Empty.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
17
src/test/compile-fail/obsolete-for-sized.rs
Normal file
17
src/test/compile-fail/obsolete-for-sized.rs
Normal 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() { }
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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> { }
|
||||
|
||||
|
|
|
|||
|
|
@ -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>>() { }
|
||||
|
||||
|
|
|
|||
|
|
@ -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>>() { }
|
||||
|
||||
|
|
|
|||
|
|
@ -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>>() { }
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue