-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a31ad75
commit 7d15250
Showing
6 changed files
with
161 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2016 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. | ||
|
||
#![feature(rustc_attrs)] | ||
|
||
struct S<T>(*const T) where T: ?Sized; | ||
|
||
#[rustc_error] | ||
fn main() { //~ ERROR compilation successful | ||
let u = vec![1, 2, 3]; | ||
let _s: S<[u8]> = S(&u[..]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2016 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 S1<T>(T) where (T): ?Sized; | ||
//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared | ||
|
||
struct S2<T>(T) where u8: ?Sized; | ||
//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared | ||
|
||
struct S3<T>(T) where &'static T: ?Sized; | ||
//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared | ||
|
||
trait Trait<'a> {} | ||
|
||
struct S4<T>(T) where for<'a> T: ?Trait<'a>; | ||
//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared | ||
|
||
struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized; | ||
//~^ ERROR type parameter has more than one relaxed default bound | ||
//~| WARN default bound relaxed for a type parameter | ||
|
||
impl<T> S1<T> { | ||
fn f() where T: ?Sized {} | ||
//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared | ||
} | ||
|
||
fn main() { | ||
let u = vec![1, 2, 3]; | ||
let _s: S5<[u8]> = S5(&u[..]); // OK | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2016 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 Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits | ||
//~^ NOTE traits are `?Sized` by default | ||
|
||
type A1 = Tr + ?Sized; //~ ERROR `?Trait` is not permitted in trait object types | ||
type A2 = for<'a> Tr + ?Sized; //~ ERROR `?Trait` is not permitted in trait object types | ||
|
||
fn main() {} |