Merge remote-tracking branch 'origin/master' into rollup
Conflicts: src/libcollections/slice.rs src/libcore/nonzero.rs src/libcore/ops.rs
This commit is contained in:
commit
c709ed2faf
340 changed files with 5765 additions and 3761 deletions
|
|
@ -9,52 +9,47 @@
|
|||
// except according to those terms.
|
||||
#![crate_name="inherited_stability"]
|
||||
#![crate_type = "lib"]
|
||||
#![unstable]
|
||||
#![unstable(feature = "test_feature")]
|
||||
#![feature(staged_api)]
|
||||
#![staged_api]
|
||||
|
||||
pub fn experimental() {}
|
||||
pub fn unstable() {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn stable() {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub mod stable_mod {
|
||||
pub fn experimental() {}
|
||||
pub fn unstable() {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn stable() {}
|
||||
}
|
||||
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub mod unstable_mod {
|
||||
#[unstable]
|
||||
pub fn experimental() {}
|
||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub fn deprecated() {}
|
||||
|
||||
pub fn unstable() {}
|
||||
}
|
||||
|
||||
pub mod experimental_mod {
|
||||
pub fn experimental() {}
|
||||
|
||||
#[stable]
|
||||
pub fn stable() {}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Stable {
|
||||
fn experimental(&self);
|
||||
fn unstable(&self);
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn stable(&self);
|
||||
}
|
||||
|
||||
impl Stable for uint {
|
||||
fn experimental(&self) {}
|
||||
fn unstable(&self) {}
|
||||
fn stable(&self) {}
|
||||
}
|
||||
|
||||
pub enum Experimental {
|
||||
ExperimentalVariant,
|
||||
#[stable]
|
||||
pub enum Unstable {
|
||||
UnstableVariant,
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
StableVariant
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,19 +10,22 @@
|
|||
|
||||
#![crate_name="lint_output_format"]
|
||||
#![crate_type = "lib"]
|
||||
#![feature(staged_api)]
|
||||
#![staged_api]
|
||||
#![unstable(feature = "test_feature")]
|
||||
|
||||
#[deprecated]
|
||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub fn foo() -> uint {
|
||||
20
|
||||
}
|
||||
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub fn bar() -> uint {
|
||||
40
|
||||
}
|
||||
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub fn baz() -> uint {
|
||||
30
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,64 +9,63 @@
|
|||
// except according to those terms.
|
||||
#![crate_name="lint_stability"]
|
||||
#![crate_type = "lib"]
|
||||
#![feature(staged_api)]
|
||||
#![staged_api]
|
||||
|
||||
#[deprecated]
|
||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub fn deprecated() {}
|
||||
#[deprecated="text"]
|
||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||
#[deprecated(since = "1.0.0", reason = "text")]
|
||||
pub fn deprecated_text() {}
|
||||
|
||||
#[unstable]
|
||||
pub fn experimental() {}
|
||||
#[unstable="text"]
|
||||
pub fn experimental_text() {}
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub fn deprecated_unstable() {}
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0", reason = "text")]
|
||||
pub fn deprecated_unstable_text() {}
|
||||
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub fn unstable() {}
|
||||
#[unstable="text"]
|
||||
#[unstable(feature = "test_feature", reason = "text")]
|
||||
pub fn unstable_text() {}
|
||||
|
||||
pub fn unmarked() {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn stable() {}
|
||||
#[stable="text"]
|
||||
#[stable(feature = "rust1", since = "1.0.0", reason = "text")]
|
||||
pub fn stable_text() {}
|
||||
|
||||
#[locked]
|
||||
pub fn locked() {}
|
||||
#[locked="text"]
|
||||
pub fn locked_text() {}
|
||||
|
||||
#[frozen]
|
||||
pub fn frozen() {}
|
||||
#[frozen="text"]
|
||||
pub fn frozen_text() {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct MethodTester;
|
||||
|
||||
impl MethodTester {
|
||||
#[deprecated]
|
||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub fn method_deprecated(&self) {}
|
||||
#[deprecated="text"]
|
||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||
#[deprecated(since = "1.0.0", reason = "text")]
|
||||
pub fn method_deprecated_text(&self) {}
|
||||
|
||||
#[unstable]
|
||||
pub fn method_experimental(&self) {}
|
||||
#[unstable="text"]
|
||||
pub fn method_experimental_text(&self) {}
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub fn method_deprecated_unstable(&self) {}
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0", reason = "text")]
|
||||
pub fn method_deprecated_unstable_text(&self) {}
|
||||
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub fn method_unstable(&self) {}
|
||||
#[unstable="text"]
|
||||
#[unstable(feature = "test_feature", reason = "text")]
|
||||
pub fn method_unstable_text(&self) {}
|
||||
|
||||
pub fn method_unmarked(&self) {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn method_stable(&self) {}
|
||||
#[stable="text"]
|
||||
#[stable(feature = "rust1", since = "1.0.0", reason = "text")]
|
||||
pub fn method_stable_text(&self) {}
|
||||
|
||||
#[locked]
|
||||
|
|
@ -81,26 +80,30 @@ impl MethodTester {
|
|||
}
|
||||
|
||||
pub trait Trait {
|
||||
#[deprecated]
|
||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
fn trait_deprecated(&self) {}
|
||||
#[deprecated="text"]
|
||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||
#[deprecated(since = "1.0.0", reason = "text")]
|
||||
fn trait_deprecated_text(&self) {}
|
||||
|
||||
#[unstable]
|
||||
fn trait_experimental(&self) {}
|
||||
#[unstable="text"]
|
||||
fn trait_experimental_text(&self) {}
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
fn trait_deprecated_unstable(&self) {}
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0", reason = "text")]
|
||||
fn trait_deprecated_unstable_text(&self) {}
|
||||
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
fn trait_unstable(&self) {}
|
||||
#[unstable="text"]
|
||||
#[unstable(feature = "test_feature", reason = "text")]
|
||||
fn trait_unstable_text(&self) {}
|
||||
|
||||
fn trait_unmarked(&self) {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn trait_stable(&self) {}
|
||||
#[stable="text"]
|
||||
#[stable(feature = "rust1", since = "1.0.0", reason = "text")]
|
||||
fn trait_stable_text(&self) {}
|
||||
|
||||
#[locked]
|
||||
|
|
@ -116,67 +119,59 @@ pub trait Trait {
|
|||
|
||||
impl Trait for MethodTester {}
|
||||
|
||||
#[unstable]
|
||||
pub trait ExperimentalTrait {}
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub trait UnstableTrait {}
|
||||
|
||||
#[deprecated]
|
||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub struct DeprecatedStruct { pub i: int }
|
||||
#[unstable]
|
||||
pub struct ExperimentalStruct { pub i: int }
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub struct DeprecatedUnstableStruct { pub i: int }
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub struct UnstableStruct { pub i: int }
|
||||
pub struct UnmarkedStruct { pub i: int }
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct StableStruct { pub i: int }
|
||||
#[frozen]
|
||||
pub struct FrozenStruct { pub i: int }
|
||||
#[locked]
|
||||
pub struct LockedStruct { pub i: int }
|
||||
|
||||
#[deprecated]
|
||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub struct DeprecatedUnitStruct;
|
||||
#[unstable]
|
||||
pub struct ExperimentalUnitStruct;
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub struct DeprecatedUnstableUnitStruct;
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub struct UnstableUnitStruct;
|
||||
pub struct UnmarkedUnitStruct;
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct StableUnitStruct;
|
||||
#[frozen]
|
||||
pub struct FrozenUnitStruct;
|
||||
#[locked]
|
||||
pub struct LockedUnitStruct;
|
||||
|
||||
pub enum Enum {
|
||||
#[deprecated]
|
||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
DeprecatedVariant,
|
||||
#[unstable]
|
||||
ExperimentalVariant,
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
DeprecatedUnstableVariant,
|
||||
#[unstable(feature = "test_feature")]
|
||||
UnstableVariant,
|
||||
|
||||
UnmarkedVariant,
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
StableVariant,
|
||||
#[frozen]
|
||||
FrozenVariant,
|
||||
#[locked]
|
||||
LockedVariant,
|
||||
}
|
||||
|
||||
#[deprecated]
|
||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub struct DeprecatedTupleStruct(pub int);
|
||||
#[unstable]
|
||||
pub struct ExperimentalTupleStruct(pub int);
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub struct DeprecatedUnstableTupleStruct(pub int);
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub struct UnstableTupleStruct(pub int);
|
||||
pub struct UnmarkedTupleStruct(pub int);
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct StableTupleStruct(pub int);
|
||||
#[frozen]
|
||||
pub struct FrozenTupleStruct(pub int);
|
||||
#[locked]
|
||||
pub struct LockedTupleStruct(pub int);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! macro_test {
|
||||
|
|
|
|||
|
|
@ -9,5 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![cfg_attr(foo, experimental)]
|
||||
#![cfg_attr(not(foo), stable)]
|
||||
#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))]
|
||||
#![feature(staged_api)]
|
||||
#![staged_api]
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
// compile-flags:--cfg foo
|
||||
|
||||
#![cfg_attr(foo, unstable)]
|
||||
#![cfg_attr(not(foo), stable)]
|
||||
#![cfg_attr(foo, unstable(feature = "test_feature"))]
|
||||
#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))]
|
||||
#![feature(staged_api)]
|
||||
#![staged_api]
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@
|
|||
// OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#![feature(simd)]
|
||||
#![allow(unstable)]
|
||||
|
||||
// ignore-pretty very bad with line comments
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ impl Car for ModelU { }
|
|||
|
||||
fn dent<C:Car>(c: C, color: C::Color) { c.chip_paint(color) }
|
||||
fn a() { dent(ModelT, Black); }
|
||||
fn b() { dent(ModelT, Blue); } //~ ERROR type mismatch
|
||||
fn c() { dent(ModelU, Black); } //~ ERROR type mismatch
|
||||
fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types
|
||||
fn c() { dent(ModelU, Black); } //~ ERROR mismatched types
|
||||
fn d() { dent(ModelU, Blue); }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub fn f2<T: Foo>(a: T) -> T::A {
|
|||
|
||||
pub fn f1_int_int() {
|
||||
f1(2is, 4is);
|
||||
//~^ ERROR type mismatch resolving
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected usize
|
||||
//~| found isize
|
||||
}
|
||||
|
|
@ -51,8 +51,6 @@ pub fn f2_int() {
|
|||
//~^ ERROR mismatched types
|
||||
//~| expected `isize`
|
||||
//~| found `usize`
|
||||
//~| expected isize
|
||||
//~| found usize
|
||||
}
|
||||
|
||||
pub fn main() { }
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ struct SFn {
|
|||
y: isize,
|
||||
}
|
||||
|
||||
impl Fn<(isize,),isize> for SFn {
|
||||
impl Fn<(isize,)> for SFn {
|
||||
type Output = isize;
|
||||
|
||||
extern "rust-call" fn call(&self, (z,): (isize,)) -> isize {
|
||||
self.x * self.y * z
|
||||
}
|
||||
|
|
@ -28,7 +30,9 @@ struct SFnMut {
|
|||
y: isize,
|
||||
}
|
||||
|
||||
impl FnMut<(isize,),isize> for SFnMut {
|
||||
impl FnMut<(isize,)> for SFnMut {
|
||||
type Output = isize;
|
||||
|
||||
extern "rust-call" fn call_mut(&mut self, (z,): (isize,)) -> isize {
|
||||
self.x * self.y * z
|
||||
}
|
||||
|
|
@ -38,7 +42,9 @@ struct SFnOnce {
|
|||
x: String,
|
||||
}
|
||||
|
||||
impl FnOnce<(String,),usize> for SFnOnce {
|
||||
impl FnOnce<(String,)> for SFnOnce {
|
||||
type Output = usize;
|
||||
|
||||
extern "rust-call" fn call_once(self, (z,): (String,)) -> usize {
|
||||
self.x.len() + z.len()
|
||||
}
|
||||
|
|
|
|||
23
src/test/compile-fail/enable-unstable-lib-feature.rs
Normal file
23
src/test/compile-fail/enable-unstable-lib-feature.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2012 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 enabling an unstable feature disables warnings
|
||||
|
||||
// aux-build:stability_cfg2.rs
|
||||
|
||||
#![feature(test_feature)]
|
||||
#![deny(non_snake_case)] // To trigger a hard error
|
||||
|
||||
// Shouldn't generate a warning about unstable features
|
||||
extern crate stability_cfg2;
|
||||
|
||||
pub fn BOGUS() { } //~ ERROR
|
||||
|
||||
pub fn main() { }
|
||||
|
|
@ -16,5 +16,7 @@ fn is_fn<F>(_: F) where F: Fn() {}
|
|||
fn main() {
|
||||
// extern functions are extern "C" fn
|
||||
let _x: extern "C" fn() = f; // OK
|
||||
is_fn(f); //~ ERROR the trait `core::ops::Fn()` is not implemented for the type `extern "C" fn()
|
||||
is_fn(f);
|
||||
//~^ ERROR the trait `core::ops::Fn<()>` is not implemented for the type `extern "C" fn()
|
||||
//~| ERROR the trait `core::ops::Fn<()>` is not implemented for the type `extern "C" fn()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#![deny(dead_code)]
|
||||
#![allow(unreachable_code)]
|
||||
#![allow(unstable)]
|
||||
#![feature(core)]
|
||||
|
||||
#[macro_use] extern crate core;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,18 +8,38 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Test that manual impls of the `Fn` traits are not possible without
|
||||
// a feature gate. In fact, the specialized check for these cases
|
||||
// never triggers (yet), because they encounter other problems around
|
||||
// angle bracket vs parentheses notation.
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
struct Foo;
|
||||
impl Fn() for Foo { //~ ERROR manual implementations of `Fn` are experimental
|
||||
impl Fn<()> for Foo {
|
||||
//~^ ERROR angle-bracket notation is not stable when used with the `Fn` family of traits
|
||||
type Output = ();
|
||||
|
||||
extern "rust-call" fn call(&self, args: ()) -> () {}
|
||||
}
|
||||
struct Foo1;
|
||||
impl Fn() for Foo1 {
|
||||
//~^ ERROR associated type bindings are not allowed here
|
||||
|
||||
extern "rust-call" fn call(&self, args: ()) -> () {}
|
||||
}
|
||||
struct Bar;
|
||||
impl FnMut() for Bar { //~ ERROR manual implementations of `FnMut` are experimental
|
||||
impl FnMut<()> for Bar {
|
||||
//~^ ERROR angle-bracket notation is not stable when used with the `Fn` family of traits
|
||||
type Output = ();
|
||||
|
||||
extern "rust-call" fn call_mut(&self, args: ()) -> () {}
|
||||
}
|
||||
struct Baz;
|
||||
impl FnOnce() for Baz { //~ ERROR manual implementations of `FnOnce` are experimental
|
||||
impl FnOnce<()> for Baz {
|
||||
//~^ ERROR angle-bracket notation is not stable when used with the `Fn` family of traits
|
||||
type Output = ();
|
||||
|
||||
extern "rust-call" fn call_once(&self, args: ()) -> () {}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,5 +34,7 @@ fn main() {
|
|||
//~| expected ()
|
||||
//~| found box
|
||||
|
||||
needs_fn(1is); //~ ERROR `core::ops::Fn(isize) -> isize`
|
||||
needs_fn(1is);
|
||||
//~^ ERROR `core::ops::Fn<(isize,)>`
|
||||
//~| ERROR `core::ops::Fn<(isize,)>`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ struct Debuger<T> {
|
|||
x: T
|
||||
}
|
||||
|
||||
impl<T: fmt::Debug> ops::Fn<(), ()> for Debuger<T> {
|
||||
impl<T: fmt::Debug> ops::Fn<(),> for Debuger<T> {
|
||||
type Output = ();
|
||||
|
||||
fn call(&self, _args: ()) {
|
||||
//~^ ERROR `call` has an incompatible type for trait: expected "rust-call" fn, found "Rust" fn
|
||||
println!("{:?}", self.x);
|
||||
|
|
|
|||
|
|
@ -8,13 +8,15 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(staged_api)]
|
||||
#![staged_api]
|
||||
#![deny(deprecated)]
|
||||
|
||||
struct Foo;
|
||||
|
||||
impl Foo {
|
||||
#[deprecated]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
fn foo(self) {}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#![feature(unboxed_closures)]
|
||||
|
||||
pub fn foo<'a, F: Fn<(&'a (),), ()>>(bar: F) {
|
||||
pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
|
||||
bar.call((
|
||||
&(), //~ ERROR borrowed value does not live long enough
|
||||
));
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![deny(unused_variables)]
|
||||
#![allow(unstable)]
|
||||
#![feature(core)]
|
||||
|
||||
fn main() {
|
||||
for _ in range(1is, 101) {
|
||||
|
|
|
|||
|
|
@ -32,5 +32,8 @@ fn main() {
|
|||
let bits: &[_] = &[0, 1];
|
||||
|
||||
0.contains(bits);
|
||||
//~^ ERROR the trait `Set<_>` is not implemented for the type `_`
|
||||
//~^ ERROR overflow
|
||||
//~| ERROR overflow
|
||||
//~| ERROR overflow
|
||||
//~| ERROR mismatched types
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ struct Foo;
|
|||
impl Foo {
|
||||
fn foo() {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
} //~ ERROR expected `fn`, found `}`
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
struct Foo;
|
||||
|
||||
impl Foo {
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
} //~ ERROR expected `fn`, found `}`
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ impl Bar {
|
|||
|
||||
#[derive(Hash)]
|
||||
struct Foo(Bar);
|
||||
//~^ error: the trait `core::hash::Hash<__S>` is not implemented for the type `Bar`
|
||||
//~^ error: the trait `core::hash::Hash<_>` is not implemented for the type `Bar`
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
macro_rules! test { ($wrong:t_ty ..) => () }
|
||||
//~^ ERROR: unrecognized builtin nonterminal `t_ty`
|
||||
//~^ ERROR: invalid fragment specifier `t_ty`
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![deny(improper_ctypes)]
|
||||
#![allow(unstable)]
|
||||
#![feature(libc)]
|
||||
|
||||
extern crate libc;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(missing_copy_implementations)]
|
||||
#![allow(unstable)]
|
||||
#![deny(dead_code)]
|
||||
#![feature(core)]
|
||||
|
||||
#![crate_type="lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
#![allow(unused_variables)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(unstable)]
|
||||
#![deny(dead_code)]
|
||||
#![feature(libc)]
|
||||
|
||||
#![crate_type="lib"]
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,10 @@
|
|||
|
||||
#![allow(unused_variables)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(unstable)]
|
||||
#![deny(dead_code)]
|
||||
#![feature(libc)]
|
||||
#![feature(core)]
|
||||
#![feature(collections)]
|
||||
|
||||
extern crate libc;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
#![deny(exceeding_bitshifts)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unstable)]
|
||||
#![allow(dead_code)]
|
||||
#![feature(core)]
|
||||
|
||||
fn main() {
|
||||
let n = 1u8 << 7;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![forbid(unstable)]
|
||||
#![forbid(deprecated)]
|
||||
|
||||
#[allow(unstable)] //~ ERROR allow(unstable) overruled by outer forbid(unstable)
|
||||
#[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated)
|
||||
fn main() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -F unstable
|
||||
// compile-flags: -F deprecated
|
||||
|
||||
#![feature(staged_api)]
|
||||
#![staged_api]
|
||||
#[allow(unstable)] //~ ERROR allow(unstable) overruled by outer forbid(unstable)
|
||||
#[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated)
|
||||
fn main() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,15 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-F unstable
|
||||
// compile-flags: -F unused_features
|
||||
// aux-build:lint_output_format.rs
|
||||
|
||||
extern crate lint_output_format; //~ ERROR: use of unmarked item
|
||||
#![feature(foo)] //~ ERROR unused or unknown feature
|
||||
|
||||
extern crate lint_output_format; //~ WARNING: use of unstable library feature
|
||||
use lint_output_format::{foo, bar};
|
||||
|
||||
fn main() {
|
||||
let _x = foo(); //~ WARNING #[warn(deprecated)] on by default
|
||||
let _y = bar(); //~ ERROR [-F unstable]
|
||||
let _y = bar(); //~ WARNING: use of unstable library feature
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,19 +12,19 @@
|
|||
// aux-build:inherited_stability.rs
|
||||
// aux-build:stability_cfg1.rs
|
||||
// aux-build:stability_cfg2.rs
|
||||
// ignore-tidy-linelength
|
||||
|
||||
#![deny(unstable)]
|
||||
#![deny(deprecated)]
|
||||
#![deny(unstable)]
|
||||
#![allow(dead_code)]
|
||||
#![feature(staged_api)]
|
||||
#![staged_api]
|
||||
|
||||
#[macro_use]
|
||||
extern crate lint_stability; //~ ERROR: use of unmarked item
|
||||
extern crate lint_stability; //~ ERROR: use of unmarked library feature
|
||||
|
||||
mod cross_crate {
|
||||
extern crate stability_cfg1;
|
||||
extern crate stability_cfg2; //~ ERROR: use of unstable item
|
||||
extern crate stability_cfg2; //~ WARNING: use of unstable library feature
|
||||
|
||||
use lint_stability::*;
|
||||
|
||||
|
|
@ -39,25 +39,31 @@ mod cross_crate {
|
|||
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
|
||||
experimental(); //~ ERROR use of unstable item
|
||||
foo.method_experimental(); //~ ERROR use of unstable item
|
||||
foo.trait_experimental(); //~ ERROR use of unstable item
|
||||
deprecated_unstable(); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
foo.method_deprecated_unstable(); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
|
||||
experimental_text(); //~ ERROR use of unstable item: text
|
||||
foo.method_experimental_text(); //~ ERROR use of unstable item: text
|
||||
foo.trait_experimental_text(); //~ ERROR use of unstable item: text
|
||||
deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
||||
//~^ WARNING use of unstable library feature
|
||||
foo.method_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
||||
//~^ WARNING use of unstable library feature
|
||||
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
||||
//~^ WARNING use of unstable library feature
|
||||
|
||||
unstable(); //~ ERROR use of unstable item
|
||||
foo.method_unstable(); //~ ERROR use of unstable item
|
||||
foo.trait_unstable(); //~ ERROR use of unstable item
|
||||
unstable(); //~ WARNING use of unstable library feature
|
||||
foo.method_unstable(); //~ WARNING use of unstable library feature
|
||||
foo.trait_unstable(); //~ WARNING use of unstable library feature
|
||||
|
||||
unstable_text(); //~ ERROR use of unstable item: text
|
||||
foo.method_unstable_text(); //~ ERROR use of unstable item: text
|
||||
foo.trait_unstable_text(); //~ ERROR use of unstable item: text
|
||||
unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text
|
||||
foo.method_unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text
|
||||
foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text
|
||||
|
||||
unmarked(); //~ ERROR use of unmarked item
|
||||
foo.method_unmarked(); //~ ERROR use of unmarked item
|
||||
foo.trait_unmarked(); //~ ERROR use of unmarked item
|
||||
unmarked(); //~ ERROR use of unmarked library feature
|
||||
foo.method_unmarked(); //~ ERROR use of unmarked library feature
|
||||
foo.trait_unmarked(); //~ ERROR use of unmarked library feature
|
||||
|
||||
stable();
|
||||
foo.method_stable();
|
||||
|
|
@ -67,53 +73,33 @@ mod cross_crate {
|
|||
foo.method_stable_text();
|
||||
foo.trait_stable_text();
|
||||
|
||||
frozen();
|
||||
foo.method_frozen();
|
||||
foo.trait_frozen();
|
||||
|
||||
frozen_text();
|
||||
foo.method_frozen_text();
|
||||
foo.trait_frozen_text();
|
||||
|
||||
locked();
|
||||
foo.method_locked();
|
||||
foo.trait_locked();
|
||||
|
||||
locked_text();
|
||||
foo.method_locked_text();
|
||||
foo.trait_locked_text();
|
||||
|
||||
let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item
|
||||
let _ = ExperimentalStruct { i: 0 }; //~ ERROR use of unstable item
|
||||
let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable item
|
||||
let _ = UnmarkedStruct { i: 0 }; //~ ERROR use of unmarked item
|
||||
let _ = DeprecatedUnstableStruct { i: 0 }; //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
let _ = UnstableStruct { i: 0 }; //~ WARNING use of unstable library feature
|
||||
let _ = UnmarkedStruct { i: 0 }; //~ ERROR use of unmarked library feature
|
||||
let _ = StableStruct { i: 0 };
|
||||
let _ = FrozenStruct { i: 0 };
|
||||
let _ = LockedStruct { i: 0 };
|
||||
|
||||
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
|
||||
let _ = ExperimentalUnitStruct; //~ ERROR use of unstable item
|
||||
let _ = UnstableUnitStruct; //~ ERROR use of unstable item
|
||||
let _ = UnmarkedUnitStruct; //~ ERROR use of unmarked item
|
||||
let _ = DeprecatedUnstableUnitStruct; //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
let _ = UnstableUnitStruct; //~ WARNING use of unstable library feature
|
||||
let _ = UnmarkedUnitStruct; //~ ERROR use of unmarked library feature
|
||||
let _ = StableUnitStruct;
|
||||
let _ = FrozenUnitStruct;
|
||||
let _ = LockedUnitStruct;
|
||||
|
||||
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
|
||||
let _ = Enum::ExperimentalVariant; //~ ERROR use of unstable item
|
||||
let _ = Enum::UnstableVariant; //~ ERROR use of unstable item
|
||||
let _ = Enum::UnmarkedVariant; //~ ERROR use of unmarked item
|
||||
let _ = Enum::DeprecatedUnstableVariant; //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
let _ = Enum::UnstableVariant; //~ WARNING use of unstable library feature
|
||||
let _ = Enum::UnmarkedVariant; //~ ERROR use of unmarked library feature
|
||||
let _ = Enum::StableVariant;
|
||||
let _ = Enum::FrozenVariant;
|
||||
let _ = Enum::LockedVariant;
|
||||
|
||||
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
|
||||
let _ = ExperimentalTupleStruct (1); //~ ERROR use of unstable item
|
||||
let _ = UnstableTupleStruct (1); //~ ERROR use of unstable item
|
||||
let _ = UnmarkedTupleStruct (1); //~ ERROR use of unmarked item
|
||||
let _ = DeprecatedUnstableTupleStruct (1); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
let _ = UnstableTupleStruct (1); //~ WARNING use of unstable library feature
|
||||
let _ = UnmarkedTupleStruct (1); //~ ERROR use of unmarked library feature
|
||||
let _ = StableTupleStruct (1);
|
||||
let _ = FrozenTupleStruct (1);
|
||||
let _ = LockedTupleStruct (1);
|
||||
|
||||
// At the moment, the lint checker only checks stability in
|
||||
// in the arguments of macros.
|
||||
|
|
@ -122,6 +108,8 @@ mod cross_crate {
|
|||
// on macros themselves are not yet linted.
|
||||
macro_test!();
|
||||
macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text
|
||||
macro_test_arg!(deprecated_unstable_text()); //~ ERROR use of deprecated item: text
|
||||
//~^ WARNING use of unstable library feature
|
||||
macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text
|
||||
macro_test_arg_nested!(deprecated_text);
|
||||
}
|
||||
|
|
@ -129,222 +117,164 @@ mod cross_crate {
|
|||
fn test_method_param<F: Trait>(foo: F) {
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.trait_experimental(); //~ ERROR use of unstable item
|
||||
foo.trait_experimental_text(); //~ ERROR use of unstable item: text
|
||||
foo.trait_unstable(); //~ ERROR use of unstable item
|
||||
foo.trait_unstable_text(); //~ ERROR use of unstable item: text
|
||||
foo.trait_unmarked(); //~ ERROR use of unmarked item
|
||||
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
||||
//~^ WARNING use of unstable library feature
|
||||
foo.trait_unstable(); //~ WARNING use of unstable library feature
|
||||
foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text
|
||||
foo.trait_unmarked(); //~ ERROR use of unmarked library feature
|
||||
foo.trait_stable();
|
||||
}
|
||||
|
||||
fn test_method_object(foo: &Trait) {
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.trait_experimental(); //~ ERROR use of unstable item
|
||||
foo.trait_experimental_text(); //~ ERROR use of unstable item: text
|
||||
foo.trait_unstable(); //~ ERROR use of unstable item
|
||||
foo.trait_unstable_text(); //~ ERROR use of unstable item: text
|
||||
foo.trait_unmarked(); //~ ERROR use of unmarked item
|
||||
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
||||
//~^ WARNING use of unstable library feature
|
||||
foo.trait_unstable(); //~ WARNING use of unstable library feature
|
||||
foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'test_feature': text
|
||||
foo.trait_unmarked(); //~ ERROR use of unmarked library feature
|
||||
foo.trait_stable();
|
||||
}
|
||||
|
||||
struct S;
|
||||
|
||||
impl ExperimentalTrait for S { } //~ ERROR use of unstable item
|
||||
impl UnstableTrait for S { } //~ WARNING use of unstable library feature
|
||||
|
||||
trait LocalTrait : ExperimentalTrait { } //~ ERROR use of unstable item
|
||||
trait LocalTrait : UnstableTrait { } //~ WARNING use of unstable library feature
|
||||
}
|
||||
|
||||
mod inheritance {
|
||||
extern crate inherited_stability; //~ ERROR: use of unstable item
|
||||
extern crate inherited_stability; //~ WARNING: use of unstable library feature
|
||||
use self::inherited_stability::*;
|
||||
|
||||
fn test_inheritance() {
|
||||
experimental(); //~ ERROR use of unstable item
|
||||
unstable(); //~ WARNING use of unstable library feature
|
||||
stable();
|
||||
|
||||
stable_mod::experimental(); //~ ERROR use of unstable item
|
||||
stable_mod::unstable(); //~ WARNING use of unstable library feature
|
||||
stable_mod::stable();
|
||||
|
||||
unstable_mod::experimental(); //~ ERROR use of unstable item
|
||||
unstable_mod::unstable(); //~ ERROR use of unstable item
|
||||
unstable_mod::deprecated(); //~ ERROR use of deprecated item
|
||||
unstable_mod::unstable(); //~ WARNING use of unstable library feature
|
||||
|
||||
experimental_mod::experimental(); //~ ERROR use of unstable item
|
||||
experimental_mod::stable();
|
||||
|
||||
let _ = Experimental::ExperimentalVariant; //~ ERROR use of unstable item
|
||||
let _ = Experimental::StableVariant;
|
||||
let _ = Unstable::UnstableVariant; //~ WARNING use of unstable library feature
|
||||
let _ = Unstable::StableVariant;
|
||||
|
||||
let x: usize = 0;
|
||||
x.experimental(); //~ ERROR use of unstable item
|
||||
x.unstable(); //~ WARNING use of unstable library feature
|
||||
x.stable();
|
||||
}
|
||||
}
|
||||
|
||||
mod this_crate {
|
||||
#[deprecated]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub fn deprecated() {}
|
||||
#[deprecated="text"]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0", reason = "text")]
|
||||
pub fn deprecated_text() {}
|
||||
|
||||
#[unstable]
|
||||
pub fn experimental() {}
|
||||
#[unstable="text"]
|
||||
pub fn experimental_text() {}
|
||||
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub fn unstable() {}
|
||||
#[unstable="text"]
|
||||
#[unstable(feature = "test_feature", reason = "text")]
|
||||
pub fn unstable_text() {}
|
||||
|
||||
pub fn unmarked() {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn stable() {}
|
||||
#[stable="text"]
|
||||
#[stable(feature = "rust1", since = "1.0.0", reason = "text")]
|
||||
pub fn stable_text() {}
|
||||
|
||||
#[locked]
|
||||
pub fn locked() {}
|
||||
#[locked="text"]
|
||||
pub fn locked_text() {}
|
||||
|
||||
#[frozen]
|
||||
pub fn frozen() {}
|
||||
#[frozen="text"]
|
||||
pub fn frozen_text() {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct MethodTester;
|
||||
|
||||
impl MethodTester {
|
||||
#[deprecated]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub fn method_deprecated(&self) {}
|
||||
#[deprecated="text"]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0", reason = "text")]
|
||||
pub fn method_deprecated_text(&self) {}
|
||||
|
||||
#[unstable]
|
||||
pub fn method_experimental(&self) {}
|
||||
#[unstable="text"]
|
||||
pub fn method_experimental_text(&self) {}
|
||||
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub fn method_unstable(&self) {}
|
||||
#[unstable="text"]
|
||||
#[unstable(feature = "test_feature", reason = "text")]
|
||||
pub fn method_unstable_text(&self) {}
|
||||
|
||||
pub fn method_unmarked(&self) {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn method_stable(&self) {}
|
||||
#[stable="text"]
|
||||
#[stable(feature = "rust1", since = "1.0.0", reason = "text")]
|
||||
pub fn method_stable_text(&self) {}
|
||||
|
||||
#[locked]
|
||||
pub fn method_locked(&self) {}
|
||||
#[locked="text"]
|
||||
pub fn method_locked_text(&self) {}
|
||||
|
||||
#[frozen]
|
||||
pub fn method_frozen(&self) {}
|
||||
#[frozen="text"]
|
||||
pub fn method_frozen_text(&self) {}
|
||||
}
|
||||
|
||||
pub trait Trait {
|
||||
#[deprecated]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
fn trait_deprecated(&self) {}
|
||||
#[deprecated="text"]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0", reason = "text")]
|
||||
fn trait_deprecated_text(&self) {}
|
||||
|
||||
#[unstable]
|
||||
fn trait_experimental(&self) {}
|
||||
#[unstable="text"]
|
||||
fn trait_experimental_text(&self) {}
|
||||
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
fn trait_unstable(&self) {}
|
||||
#[unstable="text"]
|
||||
#[unstable(feature = "test_feature", reason = "text")]
|
||||
fn trait_unstable_text(&self) {}
|
||||
|
||||
fn trait_unmarked(&self) {}
|
||||
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn trait_stable(&self) {}
|
||||
#[stable="text"]
|
||||
#[stable(feature = "rust1", since = "1.0.0", reason = "text")]
|
||||
fn trait_stable_text(&self) {}
|
||||
|
||||
#[locked]
|
||||
fn trait_locked(&self) {}
|
||||
#[locked="text"]
|
||||
fn trait_locked_text(&self) {}
|
||||
|
||||
#[frozen]
|
||||
fn trait_frozen(&self) {}
|
||||
#[frozen="text"]
|
||||
fn trait_frozen_text(&self) {}
|
||||
}
|
||||
|
||||
impl Trait for MethodTester {}
|
||||
|
||||
#[deprecated]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub struct DeprecatedStruct { i: isize }
|
||||
#[unstable]
|
||||
pub struct ExperimentalStruct { i: isize }
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub struct UnstableStruct { i: isize }
|
||||
pub struct UnmarkedStruct { i: isize }
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct StableStruct { i: isize }
|
||||
#[frozen]
|
||||
pub struct FrozenStruct { i: isize }
|
||||
#[locked]
|
||||
pub struct LockedStruct { i: isize }
|
||||
|
||||
#[deprecated]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub struct DeprecatedUnitStruct;
|
||||
#[unstable]
|
||||
pub struct ExperimentalUnitStruct;
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub struct UnstableUnitStruct;
|
||||
pub struct UnmarkedUnitStruct;
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct StableUnitStruct;
|
||||
#[frozen]
|
||||
pub struct FrozenUnitStruct;
|
||||
#[locked]
|
||||
pub struct LockedUnitStruct;
|
||||
|
||||
pub enum Enum {
|
||||
#[deprecated]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
DeprecatedVariant,
|
||||
#[unstable]
|
||||
ExperimentalVariant,
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
UnstableVariant,
|
||||
|
||||
UnmarkedVariant,
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
StableVariant,
|
||||
#[frozen]
|
||||
FrozenVariant,
|
||||
#[locked]
|
||||
LockedVariant,
|
||||
}
|
||||
|
||||
#[deprecated]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub struct DeprecatedTupleStruct(isize);
|
||||
#[unstable]
|
||||
pub struct ExperimentalTupleStruct(isize);
|
||||
#[unstable]
|
||||
#[unstable(feature = "test_feature")]
|
||||
pub struct UnstableTupleStruct(isize);
|
||||
pub struct UnmarkedTupleStruct(isize);
|
||||
#[stable]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct StableTupleStruct(isize);
|
||||
#[frozen]
|
||||
pub struct FrozenTupleStruct(isize);
|
||||
#[locked]
|
||||
pub struct LockedTupleStruct(isize);
|
||||
|
||||
fn test() {
|
||||
// Only the deprecated cases of the following should generate
|
||||
|
|
@ -361,14 +291,6 @@ mod this_crate {
|
|||
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
|
||||
experimental();
|
||||
foo.method_experimental();
|
||||
foo.trait_experimental();
|
||||
|
||||
experimental_text();
|
||||
foo.method_experimental_text();
|
||||
foo.trait_experimental_text();
|
||||
|
||||
unstable();
|
||||
foo.method_unstable();
|
||||
foo.trait_unstable();
|
||||
|
|
@ -389,60 +311,30 @@ mod this_crate {
|
|||
foo.method_stable_text();
|
||||
foo.trait_stable_text();
|
||||
|
||||
frozen();
|
||||
foo.method_frozen();
|
||||
foo.trait_frozen();
|
||||
|
||||
frozen_text();
|
||||
foo.method_frozen_text();
|
||||
foo.trait_frozen_text();
|
||||
|
||||
locked();
|
||||
foo.method_locked();
|
||||
foo.trait_locked();
|
||||
|
||||
locked_text();
|
||||
foo.method_locked_text();
|
||||
foo.trait_locked_text();
|
||||
|
||||
let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item
|
||||
let _ = ExperimentalStruct { i: 0 };
|
||||
let _ = UnstableStruct { i: 0 };
|
||||
let _ = UnmarkedStruct { i: 0 };
|
||||
let _ = StableStruct { i: 0 };
|
||||
let _ = FrozenStruct { i: 0 };
|
||||
let _ = LockedStruct { i: 0 };
|
||||
|
||||
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
|
||||
let _ = ExperimentalUnitStruct;
|
||||
let _ = UnstableUnitStruct;
|
||||
let _ = UnmarkedUnitStruct;
|
||||
let _ = StableUnitStruct;
|
||||
let _ = FrozenUnitStruct;
|
||||
let _ = LockedUnitStruct;
|
||||
|
||||
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
|
||||
let _ = Enum::ExperimentalVariant;
|
||||
let _ = Enum::UnstableVariant;
|
||||
let _ = Enum::UnmarkedVariant;
|
||||
let _ = Enum::StableVariant;
|
||||
let _ = Enum::FrozenVariant;
|
||||
let _ = Enum::LockedVariant;
|
||||
|
||||
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
|
||||
let _ = ExperimentalTupleStruct (1);
|
||||
let _ = UnstableTupleStruct (1);
|
||||
let _ = UnmarkedTupleStruct (1);
|
||||
let _ = StableTupleStruct (1);
|
||||
let _ = FrozenTupleStruct (1);
|
||||
let _ = LockedTupleStruct (1);
|
||||
}
|
||||
|
||||
fn test_method_param<F: Trait>(foo: F) {
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.trait_experimental();
|
||||
foo.trait_experimental_text();
|
||||
foo.trait_unstable();
|
||||
foo.trait_unstable_text();
|
||||
foo.trait_unmarked();
|
||||
|
|
@ -452,29 +344,30 @@ mod this_crate {
|
|||
fn test_method_object(foo: &Trait) {
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.trait_experimental();
|
||||
foo.trait_experimental_text();
|
||||
foo.trait_unstable();
|
||||
foo.trait_unstable_text();
|
||||
foo.trait_unmarked();
|
||||
foo.trait_stable();
|
||||
}
|
||||
|
||||
#[deprecated]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
fn test_fn_body() {
|
||||
fn fn_in_body() {}
|
||||
fn_in_body();
|
||||
}
|
||||
|
||||
impl MethodTester {
|
||||
#[deprecated]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
fn test_method_body(&self) {
|
||||
fn fn_in_body() {}
|
||||
fn_in_body();
|
||||
}
|
||||
}
|
||||
|
||||
#[deprecated]
|
||||
#[unstable(feature = "test_feature")]
|
||||
#[deprecated(since = "1.0.0")]
|
||||
pub trait DeprecatedTrait {}
|
||||
|
||||
struct S;
|
||||
|
|
|
|||
15
src/test/compile-fail/lint-unknown-feature-default.rs
Normal file
15
src/test/compile-fail/lint-unknown-feature-default.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// 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.
|
||||
|
||||
// Tests the default for the unused_features lint
|
||||
|
||||
#![feature(this_is_not_a_feature)] //~ ERROR: unused or unknown feature
|
||||
|
||||
fn main() { }
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(unknown_features)]
|
||||
#![deny(unused_features)]
|
||||
|
||||
#![feature(this_is_not_a_feature)] //~ ERROR: unknown feature
|
||||
#![feature(this_is_not_a_feature)] //~ ERROR: unused or unknown feature
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@
|
|||
|
||||
#![deny(unused_extern_crates)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(unstable)]
|
||||
#![feature(libc)]
|
||||
#![feature(collections)]
|
||||
#![feature(rand)]
|
||||
|
||||
extern crate libc; //~ ERROR: unused extern crate
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![allow(unstable)]
|
||||
#![deny(non_snake_case)]
|
||||
#![feature(path)]
|
||||
#![feature(io)]
|
||||
|
||||
use std::old_io::File;
|
||||
use std::old_io::IoError;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,9 @@
|
|||
|
||||
#![deny(unused_variables)]
|
||||
#![deny(unused_assignments)]
|
||||
#![allow(unstable)]
|
||||
#![allow(dead_code, non_camel_case_types)]
|
||||
#![feature(core)]
|
||||
#![feature(os)]
|
||||
|
||||
fn f1(x: isize) {
|
||||
//~^ ERROR unused variable: `x`
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
// compile-flags: --crate-type lib
|
||||
#![deny(missing_debug_implementations)]
|
||||
#![allow(unused, unstable, missing_copy_implementations)]
|
||||
#![allow(unused, missing_copy_implementations)]
|
||||
#![feature(core)]
|
||||
|
||||
use std::fmt;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ struct S {
|
|||
y: isize,
|
||||
}
|
||||
|
||||
impl FnMut<(isize,),isize> for S {
|
||||
impl FnMut<(isize,)> for S {
|
||||
type Output = isize;
|
||||
|
||||
extern "rust-call" fn call_mut(&mut self, (z,): (isize,)) -> isize {
|
||||
self.x * self.y * z
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ struct S {
|
|||
y: isize,
|
||||
}
|
||||
|
||||
impl FnMut<isize,isize> for S {
|
||||
impl FnMut<isize> for S {
|
||||
type Output = isize;
|
||||
extern "rust-call" fn call_mut(&mut self, z: isize) -> isize {
|
||||
self.x + self.y + z
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@
|
|||
// except according to those terms.
|
||||
|
||||
|
||||
struct invariant<'a> {
|
||||
struct Invariant<'a> {
|
||||
f: Box<for<'b> FnOnce() -> &'b mut &'a isize + 'static>,
|
||||
}
|
||||
|
||||
fn to_same_lifetime<'r>(bi: invariant<'r>) {
|
||||
let bj: invariant<'r> = bi;
|
||||
fn to_same_lifetime<'r>(bi: Invariant<'r>) {
|
||||
let bj: Invariant<'r> = bi;
|
||||
}
|
||||
|
||||
fn to_longer_lifetime<'r>(bi: invariant<'r>) -> invariant<'static> {
|
||||
fn to_longer_lifetime<'r>(bi: Invariant<'r>) -> Invariant<'static> {
|
||||
bi //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ fn foo(p: &Panolpy) {
|
|||
// known to be an integer, but meh.
|
||||
let x;
|
||||
22 >> x;
|
||||
//~^ ERROR right-hand-side of a shift operation must have integral type
|
||||
//~^ ERROR the type of this value must be known in this context
|
||||
|
||||
22 >> 1;
|
||||
// Integer literal types are OK
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
// ignore-tidy-linelength
|
||||
|
||||
#![allow(unstable)]
|
||||
|
||||
use std::simd::f32x4;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,10 @@
|
|||
fn main() {
|
||||
let x: &[isize] = &[1, 2, 3, 4, 5];
|
||||
// Immutable slices are not mutable.
|
||||
|
||||
let y: &mut[_] = &x[2..4];
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `&mut [_]`
|
||||
//~| found `&_`
|
||||
//~| found `&[isize]`
|
||||
//~| values differ in mutability
|
||||
}
|
||||
|
|
|
|||
95
src/test/compile-fail/stability-attribute-sanity.rs
Normal file
95
src/test/compile-fail/stability-attribute-sanity.rs
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
// 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.
|
||||
|
||||
// Various checks that stability attributes are used correctly, per RFC 507
|
||||
|
||||
#![feature(staged_api)]
|
||||
#![staged_api]
|
||||
|
||||
mod bogus_attribute_types_1 {
|
||||
#[stable(feature = "a", since = "a", reason)] //~ ERROR incorrect meta item
|
||||
fn f1() { }
|
||||
|
||||
#[stable(feature = "a", since, reason = "a")] //~ ERROR incorrect meta item
|
||||
fn f2() { }
|
||||
|
||||
#[stable(feature, since = "a", reason = "a")] //~ ERROR incorrect meta item
|
||||
fn f3() { }
|
||||
|
||||
#[stable(feature = "a", since = "a", reason(b))] //~ ERROR incorrect meta item
|
||||
fn f4() { }
|
||||
|
||||
#[stable(feature = "a", since(b), reason = "a")] //~ ERROR incorrect meta item
|
||||
fn f5() { }
|
||||
|
||||
#[stable(feature(b), since = "a", reason = "a")] //~ ERROR incorrect meta item
|
||||
fn f6() { }
|
||||
}
|
||||
|
||||
mod bogus_attribute_types_2 {
|
||||
#[unstable] //~ ERROR incorrect stability attribute type
|
||||
fn f1() { }
|
||||
|
||||
#[unstable = "a"] //~ ERROR incorrect stability attribute type
|
||||
fn f2() { }
|
||||
|
||||
#[stable] //~ ERROR incorrect stability attribute type
|
||||
fn f3() { }
|
||||
|
||||
#[stable = "a"] //~ ERROR incorrect stability attribute type
|
||||
fn f4() { }
|
||||
|
||||
#[stable(feature = "a", since = "b")]
|
||||
#[deprecated] //~ ERROR incorrect stability attribute type
|
||||
fn f5() { }
|
||||
|
||||
#[stable(feature = "a", since = "b")]
|
||||
#[deprecated = "a"] //~ ERROR incorrect stability attribute type
|
||||
fn f6() { }
|
||||
}
|
||||
|
||||
mod missing_feature_names {
|
||||
#[unstable(since = "a")] //~ ERROR missing 'feature'
|
||||
fn f1() { }
|
||||
|
||||
#[stable(since = "a")] //~ ERROR missing 'feature'
|
||||
fn f2() { }
|
||||
}
|
||||
|
||||
mod missing_version {
|
||||
#[stable(feature = "a")] //~ ERROR missing 'since'
|
||||
fn f1() { }
|
||||
|
||||
#[stable(feature = "a", since = "b")]
|
||||
#[deprecated(reason = "a")] //~ ERROR missing 'since'
|
||||
fn f2() { }
|
||||
}
|
||||
|
||||
#[unstable(feature = "a", since = "b")]
|
||||
#[stable(feature = "a", since = "b")]
|
||||
fn multiple1() { } //~ ERROR multiple stability levels
|
||||
|
||||
#[unstable(feature = "a", since = "b")]
|
||||
#[unstable(feature = "a", since = "b")]
|
||||
fn multiple2() { } //~ ERROR multiple stability levels
|
||||
|
||||
#[stable(feature = "a", since = "b")]
|
||||
#[stable(feature = "a", since = "b")]
|
||||
fn multiple3() { } //~ ERROR multiple stability levels
|
||||
|
||||
#[stable(feature = "a", since = "b")]
|
||||
#[deprecated(since = "b")]
|
||||
#[deprecated(since = "b")]
|
||||
fn multiple4() { } //~ ERROR multiple deprecated attributes
|
||||
|
||||
#[deprecated(since = "a")]
|
||||
fn deprecated_without_unstable_or_stable() { } //~ ERROR deprecated attribute must be paired
|
||||
|
||||
fn main() { }
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// 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.
|
||||
//
|
||||
|
|
@ -8,10 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(unstable)]
|
||||
#![staged_api] //~ ERROR staged_api is for use by rustc only
|
||||
|
||||
use std::simd;
|
||||
|
||||
fn main() {
|
||||
let _ = simd::i64x2(0, 0); //~ ERROR: experimental
|
||||
}
|
||||
fn main() { }
|
||||
|
|
@ -26,7 +26,7 @@ where T : Convert<U>
|
|||
}
|
||||
|
||||
fn a() {
|
||||
test(22is, 44is); //~ ERROR not implemented
|
||||
test(22is, 44is); //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
// Check that parenthetical notation is feature-gated except with the
|
||||
// `Fn` traits.
|
||||
|
||||
trait Foo<A,R> {
|
||||
trait Foo<A> {
|
||||
type Output;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,9 @@
|
|||
#![feature(unboxed_closures)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
trait Foo<T,U,V=T> {
|
||||
fn dummy(&self, t: T, u: U, v: V);
|
||||
trait Foo<T,V=T> {
|
||||
type Output;
|
||||
fn dummy(&self, t: T, v: V);
|
||||
}
|
||||
|
||||
trait Eq<X: ?Sized> { }
|
||||
|
|
@ -24,14 +25,14 @@ fn eq<A: ?Sized,B: ?Sized>() where A : Eq<B> { }
|
|||
|
||||
fn test<'a,'b>() {
|
||||
// Parens are equivalent to omitting default in angle.
|
||||
eq::< Foo<(isize,),()>, Foo(isize) >();
|
||||
eq::< Foo<(isize,),Output=()>, Foo(isize) >();
|
||||
|
||||
// In angle version, we supply something other than the default
|
||||
eq::< Foo<(isize,),(),isize>, Foo(isize) >();
|
||||
eq::< Foo<(isize,),isize,Output=()>, Foo(isize) >();
|
||||
//~^ ERROR not implemented
|
||||
|
||||
// Supply default explicitly.
|
||||
eq::< Foo<(isize,),(),(isize,)>, Foo(isize) >();
|
||||
eq::< Foo<(isize,),(isize,),Output=()>, Foo(isize) >();
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@
|
|||
#![feature(unboxed_closures)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
trait Foo<T,U> {
|
||||
fn dummy(&self, t: T, u: U);
|
||||
trait Foo<T> {
|
||||
type Output;
|
||||
fn dummy(&self, t: T, u: Self::Output);
|
||||
}
|
||||
|
||||
trait Eq<X: ?Sized> { }
|
||||
|
|
@ -26,31 +27,32 @@ fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { }
|
|||
|
||||
fn test<'a,'b>() {
|
||||
// No errors expected:
|
||||
eq::< Foo<(),()>, Foo() >();
|
||||
eq::< Foo<(isize,),()>, Foo(isize) >();
|
||||
eq::< Foo<(isize,usize),()>, Foo(isize,usize) >();
|
||||
eq::< Foo<(isize,usize),usize>, Foo(isize,usize) -> usize >();
|
||||
eq::< Foo<(&'a isize,&'b usize),usize>, Foo(&'a isize,&'b usize) -> usize >();
|
||||
eq::< Foo<(),Output=()>, Foo() >();
|
||||
eq::< Foo<(isize,),Output=()>, Foo(isize) >();
|
||||
eq::< Foo<(isize,usize),Output=()>, Foo(isize,usize) >();
|
||||
eq::< Foo<(isize,usize),Output=usize>, Foo(isize,usize) -> usize >();
|
||||
eq::< Foo<(&'a isize,&'b usize),Output=usize>, Foo(&'a isize,&'b usize) -> usize >();
|
||||
|
||||
// Test that anonymous regions in `()` form are equivalent
|
||||
// to fresh bound regions, and that we can intermingle
|
||||
// named and anonymous as we choose:
|
||||
eq::< for<'x,'y> Foo<(&'x isize,&'y usize),usize>,
|
||||
eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>,
|
||||
for<'x,'y> Foo(&'x isize,&'y usize) -> usize >();
|
||||
eq::< for<'x,'y> Foo<(&'x isize,&'y usize),usize>,
|
||||
eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>,
|
||||
for<'x> Foo(&'x isize,&usize) -> usize >();
|
||||
eq::< for<'x,'y> Foo<(&'x isize,&'y usize),usize>,
|
||||
eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>,
|
||||
for<'y> Foo(&isize,&'y usize) -> usize >();
|
||||
eq::< for<'x,'y> Foo<(&'x isize,&'y usize),usize>,
|
||||
eq::< for<'x,'y> Foo<(&'x isize,&'y usize),Output=usize>,
|
||||
Foo(&isize,&usize) -> usize >();
|
||||
|
||||
// lifetime elision
|
||||
eq::< for<'x> Foo<(&'x isize,), &'x isize>,
|
||||
eq::< for<'x> Foo<(&'x isize,), Output=&'x isize>,
|
||||
Foo(&isize) -> &isize >();
|
||||
|
||||
// Errors expected:
|
||||
eq::< Foo<(),()>, Foo(char) >();
|
||||
//~^ ERROR not implemented
|
||||
eq::< Foo<(),Output=()>,
|
||||
Foo(char) >();
|
||||
//~^^ ERROR not implemented
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@
|
|||
#![feature(unboxed_closures)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
trait Foo<T,U> {
|
||||
fn dummy(&self, t: T, u: U);
|
||||
trait Foo<T> {
|
||||
type Output;
|
||||
fn dummy(&self, t: T);
|
||||
}
|
||||
|
||||
trait Eq<X: ?Sized> { }
|
||||
|
|
@ -25,9 +26,9 @@ impl<X: ?Sized> Eq<X> for X { }
|
|||
fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { }
|
||||
|
||||
fn main() {
|
||||
eq::< for<'a> Foo<(&'a isize,), &'a isize>,
|
||||
eq::< for<'a> Foo<(&'a isize,), Output=&'a isize>,
|
||||
Foo(&isize) -> &isize >();
|
||||
eq::< for<'a> Foo<(&'a isize,), (&'a isize, &'a isize)>,
|
||||
eq::< for<'a> Foo<(&'a isize,), Output=(&'a isize, &'a isize)>,
|
||||
Foo(&isize) -> (&isize, &isize) >();
|
||||
|
||||
let _: Foo(&isize, &usize) -> &usize; //~ ERROR missing lifetime specifier
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@
|
|||
|
||||
// Test that the `Fn` traits require `()` form without a feature gate.
|
||||
|
||||
fn bar1(x: &Fn<(),()>) {
|
||||
fn bar1(x: &Fn<()>) {
|
||||
//~^ ERROR angle-bracket notation is not stable when used with the `Fn` family
|
||||
}
|
||||
|
||||
fn bar2<T>(x: &T) where T: Fn<(),()> {
|
||||
fn bar2<T>(x: &T) where T: Fn<()> {
|
||||
//~^ ERROR angle-bracket notation is not stable when used with the `Fn` family
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@
|
|||
|
||||
use std::marker;
|
||||
|
||||
trait Foo<'a,T,U> {
|
||||
fn dummy(&'a self) -> &'a (T,U);
|
||||
trait Foo<'a,T> {
|
||||
type Output;
|
||||
fn dummy(&'a self) -> &'a (T,Self::Output);
|
||||
}
|
||||
|
||||
trait Eq<X: ?Sized> { }
|
||||
|
|
@ -29,16 +30,17 @@ fn same_type<A,B:Eq<A>>(a: A, b: B) { }
|
|||
|
||||
fn test<'a,'b>() {
|
||||
// Parens are equivalent to omitting default in angle.
|
||||
eq::< Foo<(isize,),()>, Foo(isize) >();
|
||||
eq::< Foo<(isize,),Output=()>, Foo(isize) >();
|
||||
|
||||
// Here we specify 'static explicitly in angle-bracket version.
|
||||
// Parenthesized winds up getting inferred.
|
||||
eq::< Foo<'static, (isize,),()>, Foo(isize) >();
|
||||
eq::< Foo<'static, (isize,),Output=()>, Foo(isize) >();
|
||||
}
|
||||
|
||||
fn test2(x: &Foo<(isize,),()>, y: &Foo(isize)) {
|
||||
fn test2(x: &Foo<(isize,),Output=()>, y: &Foo(isize)) {
|
||||
// Here, the omitted lifetimes are expanded to distinct things.
|
||||
same_type(x, y) //~ ERROR cannot infer
|
||||
//~^ ERROR cannot infer
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -11,13 +11,14 @@
|
|||
|
||||
// Test that parentheses form doesn't work with struct types appearing in local variables.
|
||||
|
||||
struct Bar<A,R> {
|
||||
f: A, r: R
|
||||
struct Bar<A> {
|
||||
f: A
|
||||
}
|
||||
|
||||
fn bar() {
|
||||
let x: Box<Bar()> = panic!();
|
||||
//~^ ERROR parenthesized parameters may only be used with a trait
|
||||
//~^^ ERROR associated type bindings are not allowed here
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -10,12 +10,13 @@
|
|||
|
||||
// Test that parentheses form doesn't work with struct types appearing in argument types.
|
||||
|
||||
struct Bar<A,R> {
|
||||
f: A, r: R
|
||||
struct Bar<A> {
|
||||
f: A
|
||||
}
|
||||
|
||||
fn foo(b: Box<Bar()>) {
|
||||
//~^ ERROR parenthesized parameters may only be used with a trait
|
||||
//~^^ ERROR associated type bindings are not allowed here
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
trait One<A> { fn foo(&self) -> A; }
|
||||
|
||||
fn foo(_: &One()) //~ ERROR wrong number of type arguments
|
||||
fn foo(_: &One()) //~ ERROR no associated type `Output` defined in `One<()>`
|
||||
{}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
trait Trait {}
|
||||
|
||||
fn f<F:Trait(isize) -> isize>(x: F) {}
|
||||
//~^ ERROR wrong number of type arguments: expected 0, found 2
|
||||
//~^ ERROR wrong number of type arguments: expected 0, found 1
|
||||
|
||||
fn main() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ use std::ops::{Fn,FnMut,FnOnce};
|
|||
|
||||
struct S;
|
||||
|
||||
impl FnMut<(isize,),isize> for S {
|
||||
impl FnMut<(isize,)> for S {
|
||||
type Output = isize;
|
||||
|
||||
extern "rust-call" fn call_mut(&mut self, (x,): (isize,)) -> isize {
|
||||
x * x
|
||||
}
|
||||
|
|
@ -29,6 +31,8 @@ fn call_it<F:Fn(isize)->isize>(f: &F, x: isize) -> isize {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let x = call_it(&S, 22); //~ ERROR not implemented
|
||||
let x = call_it(&S, 22);
|
||||
//~^ ERROR not implemented
|
||||
//~| ERROR not implemented
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@ fn call_it_mut<F:FnMut(&isize)->isize>(_: &mut F, _: isize) -> isize { 0 }
|
|||
fn call_it_once<F:FnOnce(&isize)->isize>(_: F, _: isize) -> isize { 0 }
|
||||
|
||||
fn a() {
|
||||
let x = call_it(&square, 22); //~ ERROR not implemented
|
||||
let x = call_it(&square, 22);
|
||||
//~^ ERROR not implemented
|
||||
//~| ERROR not implemented
|
||||
}
|
||||
|
||||
fn b() {
|
||||
|
|
|
|||
|
|
@ -12,13 +12,15 @@
|
|||
|
||||
use std::ops::FnMut;
|
||||
|
||||
fn call_it<F:FnMut<(isize,isize),isize>>(y: isize, mut f: F) -> isize {
|
||||
fn call_it<F:FnMut(isize,isize)->isize>(y: isize, mut f: F) -> isize {
|
||||
f(2, y)
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let f = |&mut: x: usize, y: isize| -> isize { (x as isize) + y };
|
||||
let z = call_it(3, f); //~ ERROR type mismatch
|
||||
let z = call_it(3, f);
|
||||
//~^ ERROR type mismatch
|
||||
//~| ERROR type mismatch
|
||||
println!("{}", z);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@ fn call_it_mut<F:FnMut(&isize)->isize>(_: &mut F, _: isize) -> isize { 0 }
|
|||
fn call_it_once<F:FnOnce(&isize)->isize>(_: F, _: isize) -> isize { 0 }
|
||||
|
||||
fn a() {
|
||||
let x = call_it(&square, 22); //~ ERROR not implemented
|
||||
let x = call_it(&square, 22);
|
||||
//~^ ERROR not implemented
|
||||
//~| ERROR not implemented
|
||||
}
|
||||
|
||||
fn b() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ fn call_it_mut<F:FnMut(&isize)->isize>(_: &mut F, _: isize) -> isize { 0 }
|
|||
fn call_it_once<F:FnOnce(&isize)->isize>(_: F, _: isize) -> isize { 0 }
|
||||
|
||||
fn a() {
|
||||
let x = call_it(&square, 22); //~ ERROR not implemented
|
||||
let x = call_it(&square, 22);
|
||||
//~^ ERROR not implemented
|
||||
//~| ERROR not implemented
|
||||
}
|
||||
|
||||
fn b() {
|
||||
|
|
|
|||
|
|
@ -18,5 +18,6 @@ fn main() {
|
|||
let z: isize = 7;
|
||||
assert_eq!(c(|&mut: x: isize, y| x + y + z), 10);
|
||||
//~^ ERROR not implemented
|
||||
//~| ERROR not implemented
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
#![deny(unused_attributes)]
|
||||
#![allow(dead_code, unused_imports)]
|
||||
#![allow(unstable)]
|
||||
#![feature(core)]
|
||||
|
||||
#![foo] //~ ERROR unused attribute
|
||||
|
||||
|
|
|
|||
24
src/test/compile-fail/variance-object-types.rs
Normal file
24
src/test/compile-fail/variance-object-types.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2012 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 Cell is considered invariant with respect to its
|
||||
// type.
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
// For better or worse, associated types are invariant, and hence we
|
||||
// get an invariant result for `'a`.
|
||||
#[rustc_variance]
|
||||
struct Foo<'a> { //~ ERROR regions=[[o];[];[]]
|
||||
x: Box<Fn(i32) -> &'a i32 + 'static>
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
|
@ -41,7 +41,6 @@
|
|||
|
||||
// gdb-command:continue
|
||||
|
||||
#![allow(unstable)]
|
||||
#![allow(unused_variables)]
|
||||
#![omit_gdb_pretty_printer_section]
|
||||
|
||||
|
|
|
|||
0
src/test/run-make/allow-non-lint-warnings-cmdline/1
Normal file
0
src/test/run-make/allow-non-lint-warnings-cmdline/1
Normal file
12
src/test/run-make/allow-non-lint-warnings-cmdline/Makefile
Normal file
12
src/test/run-make/allow-non-lint-warnings-cmdline/Makefile
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
-include ../tools.mk
|
||||
|
||||
# Test that -A warnings makes the 'empty trait list for derive' warning go away
|
||||
OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" )
|
||||
|
||||
all: foo
|
||||
test -z '$(OUT)'
|
||||
|
||||
# This is just to make sure the above command actually succeeds
|
||||
foo:
|
||||
$(RUSTC) foo.rs -A warnings
|
||||
|
||||
15
src/test/run-make/allow-non-lint-warnings-cmdline/foo.rs
Normal file
15
src/test/run-make/allow-non-lint-warnings-cmdline/foo.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// 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.
|
||||
|
||||
#[derive()]
|
||||
#[derive(Copy)]
|
||||
pub struct Foo;
|
||||
|
||||
pub fn main() { }
|
||||
0
src/test/run-make/allow-warnings-cmdline-stability/1
Normal file
0
src/test/run-make/allow-warnings-cmdline-stability/1
Normal file
19
src/test/run-make/allow-warnings-cmdline-stability/Makefile
Normal file
19
src/test/run-make/allow-warnings-cmdline-stability/Makefile
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
-include ../tools.mk
|
||||
|
||||
# Test that -A warnings makes the 'empty trait list for derive' warning go away
|
||||
DEP=$(shell $(RUSTC) bar.rs)
|
||||
OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" )
|
||||
|
||||
all: foo bar
|
||||
test -z '$(OUT)'
|
||||
|
||||
# These are just to ensure that the above commands actually work
|
||||
bar:
|
||||
$(RUSTC) bar.rs
|
||||
|
||||
foo: bar
|
||||
$(RUSTC) foo.rs -A warnings
|
||||
|
||||
|
||||
|
||||
|
||||
16
src/test/run-make/allow-warnings-cmdline-stability/bar.rs
Normal file
16
src/test/run-make/allow-warnings-cmdline-stability/bar.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// 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.
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(staged_api)]
|
||||
#![staged_api]
|
||||
#![unstable(feature = "test_feature")]
|
||||
|
||||
pub fn baz() { }
|
||||
13
src/test/run-make/allow-warnings-cmdline-stability/foo.rs
Normal file
13
src/test/run-make/allow-warnings-cmdline-stability/foo.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// 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.
|
||||
|
||||
extern crate bar;
|
||||
|
||||
pub fn main() { bar::baz() }
|
||||
28
src/test/run-pass/associated-types-issue-21212.rs
Normal file
28
src/test/run-pass/associated-types-issue-21212.rs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// 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.
|
||||
|
||||
// Regression test for #21212: an overflow occurred during trait
|
||||
// checking where normalizing `Self::Input` led to normalizing the
|
||||
// where clauses in the environment which in turn required normalizing
|
||||
// `Self::Input`.
|
||||
|
||||
pub trait Parser {
|
||||
type Input;
|
||||
|
||||
fn parse(input: <Self as Parser>::Input) {
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
impl <P> Parser for P {
|
||||
type Input = ();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
// 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 normalize associated types that appear in a bound that
|
||||
// contains a binding. Issue #21664.
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
pub trait Integral {
|
||||
type Opposite;
|
||||
}
|
||||
|
||||
impl Integral for i32 {
|
||||
type Opposite = u32;
|
||||
}
|
||||
|
||||
impl Integral for u32 {
|
||||
type Opposite = i32;
|
||||
}
|
||||
|
||||
pub trait FnLike<A> {
|
||||
type R;
|
||||
}
|
||||
|
||||
fn foo<T>()
|
||||
where T : FnLike<<i32 as Integral>::Opposite, R=bool>
|
||||
{
|
||||
bar::<T>();
|
||||
}
|
||||
|
||||
fn bar<T>()
|
||||
where T : FnLike<u32, R=bool>
|
||||
{}
|
||||
|
||||
fn main() { }
|
||||
|
|
@ -11,7 +11,6 @@
|
|||
// Regression test for issue #21010: Normalize associated types in
|
||||
// various special paths in the `type_is_immediate` function.
|
||||
|
||||
#![allow(unstable)]
|
||||
|
||||
pub trait OffsetState: Sized {}
|
||||
pub trait Offset { type State: OffsetState; }
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
use std::ops::FnMut;
|
||||
|
||||
fn call_f<F:FnMut<(),()>>(mut f: F) {
|
||||
fn call_f<F:FnMut()>(mut f: F) {
|
||||
f();
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ fn f() {
|
|||
println!("hello");
|
||||
}
|
||||
|
||||
fn call_g<G:FnMut<(String,String),String>>(mut g: G, x: String, y: String)
|
||||
fn call_g<G:FnMut(String,String) -> String>(mut g: G, x: String, y: String)
|
||||
-> String {
|
||||
g(x, y)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,23 +22,23 @@ trait Get<A,R> {
|
|||
// Parse HRTB with explicit `for` in a where-clause:
|
||||
|
||||
fn foo00<T>(t: T)
|
||||
where T : for<'a> Get<&'a int, &'a int>
|
||||
where T : for<'a> Get<&'a i32, &'a i32>
|
||||
{
|
||||
}
|
||||
|
||||
fn foo01<T: for<'a> Get<&'a int, &'a int>>(t: T)
|
||||
fn foo01<T: for<'a> Get<&'a i32, &'a i32>>(t: T)
|
||||
{
|
||||
}
|
||||
|
||||
// Parse HRTB with explicit `for` in various sorts of types:
|
||||
|
||||
fn foo10(t: Box<for<'a> Get<int, int>>) { }
|
||||
fn foo11(t: Box<for<'a> Get(int) -> int>) { }
|
||||
fn foo10(t: Box<for<'a> Get<i32, i32>>) { }
|
||||
fn foo11(t: Box<for<'a> Fn(i32) -> i32>) { }
|
||||
|
||||
fn foo20(t: for<'a> fn(int) -> int) { }
|
||||
fn foo21(t: for<'a> unsafe fn(int) -> int) { }
|
||||
fn foo22(t: for<'a> extern "C" fn(int) -> int) { }
|
||||
fn foo23(t: for<'a> unsafe extern "C" fn(int) -> int) { }
|
||||
fn foo20(t: for<'a> fn(i32) -> i32) { }
|
||||
fn foo21(t: for<'a> unsafe fn(i32) -> i32) { }
|
||||
fn foo22(t: for<'a> extern "C" fn(i32) -> i32) { }
|
||||
fn foo23(t: for<'a> unsafe extern "C" fn(i32) -> i32) { }
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ trait FnLike<A,R> {
|
|||
fn call(&self, arg: A) -> R;
|
||||
}
|
||||
|
||||
type FnObject<'b> = for<'a> FnLike(&'a int) -> (&'a int) + 'b;
|
||||
type FnObject<'b> = for<'a> FnLike<(&'a i32,), &'a i32> + 'b;
|
||||
|
||||
struct Identity;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
#![deny(warnings)]
|
||||
#![allow(unused_must_use)]
|
||||
#![allow(unknown_features)]
|
||||
#![allow(unstable)]
|
||||
#![feature(box_syntax)]
|
||||
|
||||
use std::fmt;
|
||||
|
|
|
|||
41
src/test/run-pass/into-iterator-type-inference-shift.rs
Normal file
41
src/test/run-pass/into-iterator-type-inference-shift.rs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// 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.
|
||||
|
||||
// Regression test for type inference failure around shifting. In this
|
||||
// case, the iteration yields an int, but we hadn't run the full type
|
||||
// propagation yet, and so we just saw a type variable, yielding an
|
||||
// error.
|
||||
|
||||
use std::u8;
|
||||
|
||||
trait IntoIterator {
|
||||
type Iter: Iterator;
|
||||
|
||||
fn into_iter(self) -> Self::Iter;
|
||||
}
|
||||
|
||||
impl<I> IntoIterator for I where I: Iterator {
|
||||
type Iter = I;
|
||||
|
||||
fn into_iter(self) -> I {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn desugared_for_loop_bad(byte: u8) -> u8 {
|
||||
let mut result = 0;
|
||||
let mut x = IntoIterator::into_iter(range(0, u8::BITS));
|
||||
let mut y = Iterator::next(&mut x);
|
||||
let mut z = y.unwrap();
|
||||
byte >> z;
|
||||
1
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
// Pretty printing tests complain about `use std::predule::*`
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unstable)]
|
||||
|
||||
// We shouldn't need to rebind a moved upvar as mut if it's already
|
||||
// marked as mut
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ use std::ops::Fn;
|
|||
|
||||
struct Foo<T>(T);
|
||||
|
||||
impl<T: Copy> Fn<(), T> for Foo<T> {
|
||||
impl<T: Copy> Fn<()> for Foo<T> {
|
||||
type Output = T;
|
||||
extern "rust-call" fn call(&self, _: ()) -> T {
|
||||
match *self {
|
||||
Foo(t) => t
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ trait Foo {}
|
|||
|
||||
struct Bar;
|
||||
|
||||
impl<'a> std::ops::Fn<(&'a (Foo+'a),), ()> for Bar {
|
||||
impl<'a> std::ops::Fn<(&'a (Foo+'a),)> for Bar {
|
||||
type Output = ();
|
||||
extern "rust-call" fn call(&self, _: (&'a Foo,)) {}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@ impl Alloy {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b> Fn<(&'b mut (Response+'b),),()> for SendFile<'a> {
|
||||
impl<'a, 'b> Fn<(&'b mut (Response+'b),)> for SendFile<'a> {
|
||||
type Output = ();
|
||||
|
||||
extern "rust-call" fn call(&self, (_res,): (&'b mut (Response+'b),)) {}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#![feature(unboxed_closures)]
|
||||
|
||||
struct Parser<'a, I, O> {
|
||||
parse: Box<FnMut<(I,), Result<O, String>> + 'a>
|
||||
parse: Box<FnMut(I) -> Result<O, String> + 'a>
|
||||
}
|
||||
|
||||
impl<'a, I, O: 'a> Parser<'a, I, O> {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
// Pretty printing tests complain about `use std::predule::*`
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unstable)]
|
||||
|
||||
// A var moved into a proc, that has a mutable loan path should
|
||||
// not trigger a misleading unused_mut warning.
|
||||
|
|
|
|||
|
|
@ -15,27 +15,30 @@
|
|||
// Test that unboxing shim for calling rust-call ABI methods through a
|
||||
// trait box works and does not cause an ICE.
|
||||
|
||||
struct Foo { foo: uint }
|
||||
struct Foo { foo: u32 }
|
||||
|
||||
impl FnMut<(), uint> for Foo {
|
||||
extern "rust-call" fn call_mut(&mut self, _: ()) -> uint { self.foo }
|
||||
impl FnMut<()> for Foo {
|
||||
type Output = u32;
|
||||
extern "rust-call" fn call_mut(&mut self, _: ()) -> u32 { self.foo }
|
||||
}
|
||||
|
||||
impl FnMut<(uint,), uint> for Foo {
|
||||
extern "rust-call" fn call_mut(&mut self, (x,): (uint,)) -> uint { self.foo + x }
|
||||
impl FnMut<(u32,)> for Foo {
|
||||
type Output = u32;
|
||||
extern "rust-call" fn call_mut(&mut self, (x,): (u32,)) -> u32 { self.foo + x }
|
||||
}
|
||||
|
||||
impl FnMut<(uint, uint), uint> for Foo {
|
||||
extern "rust-call" fn call_mut(&mut self, (x, y): (uint, uint)) -> uint { self.foo + x + y }
|
||||
impl FnMut<(u32,u32)> for Foo {
|
||||
type Output = u32;
|
||||
extern "rust-call" fn call_mut(&mut self, (x, y): (u32, u32)) -> u32 { self.foo + x + y }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut f = box Foo { foo: 42 } as Box<FnMut<(), uint>>;
|
||||
let mut f = box Foo { foo: 42 } as Box<FnMut() -> u32>;
|
||||
assert_eq!(f.call_mut(()), 42);
|
||||
|
||||
let mut f = box Foo { foo: 40 } as Box<FnMut<(uint,), uint>>;
|
||||
let mut f = box Foo { foo: 40 } as Box<FnMut(u32) -> u32>;
|
||||
assert_eq!(f.call_mut((2,)), 42);
|
||||
|
||||
let mut f = box Foo { foo: 40 } as Box<FnMut<(uint, uint), uint>>;
|
||||
let mut f = box Foo { foo: 40 } as Box<FnMut(u32, u32) -> u32>;
|
||||
assert_eq!(f.call_mut((1, 1)), 42);
|
||||
}
|
||||
|
|
|
|||
20
src/test/run-pass/issue-19499.rs
Normal file
20
src/test/run-pass/issue-19499.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// 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.
|
||||
|
||||
// Regression test for issue #19499. Due to incorrect caching of trait
|
||||
// results for closures with upvars whose types were not fully
|
||||
// computed, this rather bizarre little program (along with many more
|
||||
// reasonable examples) let to ambiguity errors about not being able
|
||||
// to infer sufficient type information.
|
||||
|
||||
fn main() {
|
||||
let n = 0;
|
||||
let it = Some(1_us).into_iter().inspect(|_| {n;});
|
||||
}
|
||||
|
|
@ -8,7 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(unstable)]
|
||||
|
||||
struct NT(str);
|
||||
struct DST { a: u32, b: str }
|
||||
|
|
|
|||
62
src/test/run-pass/issue-21245.rs
Normal file
62
src/test/run-pass/issue-21245.rs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
// 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.
|
||||
|
||||
// Regression test for issue #21245. Check that we are able to infer
|
||||
// the types in these examples correctly. It used to be that
|
||||
// insufficient type propagation caused the type of the iterator to be
|
||||
// incorrectly unified with the `*const` type to which it is coerced.
|
||||
|
||||
use std::ptr;
|
||||
|
||||
trait IntoIterator {
|
||||
type Iter: Iterator;
|
||||
|
||||
fn into_iter(self) -> Self::Iter;
|
||||
}
|
||||
|
||||
impl<I> IntoIterator for I where I: Iterator {
|
||||
type Iter = I;
|
||||
|
||||
fn into_iter(self) -> I {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn desugared_for_loop_bad<T>(v: Vec<T>) {
|
||||
match IntoIterator::into_iter(v.iter()) {
|
||||
mut iter => {
|
||||
loop {
|
||||
match ::std::iter::Iterator::next(&mut iter) {
|
||||
::std::option::Option::Some(x) => {
|
||||
unsafe { ptr::read(x); }
|
||||
},
|
||||
::std::option::Option::None => break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn desugared_for_loop_good<T>(v: Vec<T>) {
|
||||
match v.iter().into_iter() {
|
||||
mut iter => {
|
||||
loop {
|
||||
match ::std::iter::Iterator::next(&mut iter) {
|
||||
::std::option::Option::Some(x) => {
|
||||
unsafe { ptr::read(x); }
|
||||
},
|
||||
::std::option::Option::None => break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
36
src/test/run-pass/object-method-numbering.rs
Normal file
36
src/test/run-pass/object-method-numbering.rs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// 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 for using an object with an associated type binding as the
|
||||
// instantiation for a generic type with a bound.
|
||||
|
||||
trait SomeTrait {
|
||||
type SomeType;
|
||||
|
||||
fn get(&self) -> Self::SomeType;
|
||||
}
|
||||
|
||||
fn get_int<T:SomeTrait<SomeType=i32>+?Sized>(x: &T) -> i32 {
|
||||
x.get()
|
||||
}
|
||||
|
||||
impl SomeTrait for i32 {
|
||||
type SomeType = i32;
|
||||
fn get(&self) -> i32 {
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = 22_i32;
|
||||
let x1: &SomeTrait<SomeType=i32> = &x;
|
||||
let y = get_int(x1);
|
||||
assert_eq!(x, y);
|
||||
}
|
||||
|
|
@ -17,13 +17,15 @@ use std::ops::Add;
|
|||
|
||||
struct G<A>;
|
||||
|
||||
impl<'a, A: Add<int, Output=int>> Fn<(A,), int> for G<A> {
|
||||
extern "rust-call" fn call(&self, (arg,): (A,)) -> int {
|
||||
impl<'a, A: Add<i32, Output=i32>> Fn<(A,)> for G<A> {
|
||||
type Output = i32;
|
||||
|
||||
extern "rust-call" fn call(&self, (arg,): (A,)) -> i32 {
|
||||
arg.add(1)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// ICE trigger
|
||||
G(1i);
|
||||
G(1_i32);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,34 +13,37 @@
|
|||
use std::ops::{Fn, FnMut, FnOnce};
|
||||
|
||||
struct S1 {
|
||||
x: int,
|
||||
y: int,
|
||||
x: i32,
|
||||
y: i32,
|
||||
}
|
||||
|
||||
impl FnMut<(int,),int> for S1 {
|
||||
extern "rust-call" fn call_mut(&mut self, (z,): (int,)) -> int {
|
||||
impl FnMut<(i32,)> for S1 {
|
||||
type Output = i32;
|
||||
extern "rust-call" fn call_mut(&mut self, (z,): (i32,)) -> i32 {
|
||||
self.x * self.y * z
|
||||
}
|
||||
}
|
||||
|
||||
struct S2 {
|
||||
x: int,
|
||||
y: int,
|
||||
x: i32,
|
||||
y: i32,
|
||||
}
|
||||
|
||||
impl Fn<(int,),int> for S2 {
|
||||
extern "rust-call" fn call(&self, (z,): (int,)) -> int {
|
||||
impl Fn<(i32,)> for S2 {
|
||||
type Output = i32;
|
||||
extern "rust-call" fn call(&self, (z,): (i32,)) -> i32 {
|
||||
self.x * self.y * z
|
||||
}
|
||||
}
|
||||
|
||||
struct S3 {
|
||||
x: int,
|
||||
y: int,
|
||||
x: i32,
|
||||
y: i32,
|
||||
}
|
||||
|
||||
impl FnOnce<(int,int),int> for S3 {
|
||||
extern "rust-call" fn call_once(self, (z,zz): (int,int)) -> int {
|
||||
impl FnOnce<(i32,i32)> for S3 {
|
||||
type Output = i32;
|
||||
extern "rust-call" fn call_once(self, (z,zz): (i32,i32)) -> i32 {
|
||||
self.x * self.y * z * zz
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,12 +13,13 @@
|
|||
use std::ops::{FnMut};
|
||||
|
||||
struct S {
|
||||
x: int,
|
||||
y: int,
|
||||
x: i32,
|
||||
y: i32,
|
||||
}
|
||||
|
||||
impl FnMut<(),int> for S {
|
||||
extern "rust-call" fn call_mut(&mut self, (): ()) -> int {
|
||||
impl FnMut<()> for S {
|
||||
type Output = i32;
|
||||
extern "rust-call" fn call_mut(&mut self, (): ()) -> i32 {
|
||||
self.x * self.y
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(unstable)]
|
||||
|
||||
use std::simd::{i32x4, f32x4, u32x4};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
|
||||
#![allow(unstable)]
|
||||
#![feature(simd)]
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
// one test task to ensure that errors are timeouts, not file descriptor
|
||||
// exhaustion.
|
||||
|
||||
#![allow(unstable)]
|
||||
#![reexport_test_harness_main = "test_main"]
|
||||
|
||||
#![allow(unused_imports)]
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
use std::ops::FnMut;
|
||||
|
||||
fn make_adder(x: int) -> Box<FnMut<(int,),int>+'static> {
|
||||
(box move |&mut: y: int| -> int { x + y }) as
|
||||
Box<FnMut<(int,),int>+'static>
|
||||
fn make_adder(x: i32) -> Box<FnMut(i32)->i32+'static> {
|
||||
(box move |&mut: y: i32| -> i32 { x + y }) as
|
||||
Box<FnMut(i32)->i32+'static>
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -18,21 +18,22 @@ use std::ops::{Fn,FnMut,FnOnce};
|
|||
|
||||
struct S;
|
||||
|
||||
impl Fn<(int,),int> for S {
|
||||
extern "rust-call" fn call(&self, (x,): (int,)) -> int {
|
||||
impl Fn<(i32,)> for S {
|
||||
type Output = i32;
|
||||
extern "rust-call" fn call(&self, (x,): (i32,)) -> i32 {
|
||||
x * x
|
||||
}
|
||||
}
|
||||
|
||||
fn call_it<F:Fn(int)->int>(f: &F, x: int) -> int {
|
||||
fn call_it<F:Fn(i32)->i32>(f: &F, x: i32) -> i32 {
|
||||
f(x)
|
||||
}
|
||||
|
||||
fn call_it_mut<F:FnMut(int)->int>(f: &mut F, x: int) -> int {
|
||||
fn call_it_mut<F:FnMut(i32)->i32>(f: &mut F, x: i32) -> i32 {
|
||||
f(x)
|
||||
}
|
||||
|
||||
fn call_it_once<F:FnOnce(int)->int>(f: F, x: int) -> int {
|
||||
fn call_it_once<F:FnOnce(i32)->i32>(f: F, x: i32) -> i32 {
|
||||
f(x)
|
||||
}
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue