Rollup merge of #22635 - kmcallister:macros-chapter, r=steveklabnik
r? @steveklabnik
This commit is contained in:
commit
9692f3bc94
115 changed files with 2509 additions and 2683 deletions
|
|
@ -22,5 +22,8 @@ trait Grab {
|
|||
//~^ ERROR ambiguous associated type
|
||||
}
|
||||
|
||||
type X = std::ops::Deref::Target;
|
||||
//~^ ERROR ambiguous associated type
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ fn foo<'a>() {
|
|||
//~^ ERROR too many type parameters provided
|
||||
|
||||
let _ = S::<'a,isize>::new::<f64>(1, 1.0);
|
||||
//~^ ERROR too many lifetime parameters provided
|
||||
//~^ ERROR wrong number of lifetime parameters
|
||||
|
||||
let _: S2 = Trait::new::<isize,f64>(1, 1.0);
|
||||
//~^ ERROR too many type parameters provided
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ extern "rust-intrinsic" {
|
|||
|
||||
// Unresolved bounds should still error.
|
||||
fn align_of<T: NoSuchTrait>() -> usize;
|
||||
//~^ ERROR attempt to bound type parameter with a nonexistent trait `NoSuchTrait`
|
||||
//~^ ERROR use of undeclared trait name `NoSuchTrait`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -19,5 +19,5 @@ impl<A, B, C = (A, B)> Foo<A, B, C> {
|
|||
|
||||
fn main() {
|
||||
Foo::<isize>::new();
|
||||
//~^ ERROR too few type parameters provided
|
||||
//~^ ERROR wrong number of type arguments
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,5 +21,5 @@ impl<T, A = Heap> Vec<T, A> {
|
|||
|
||||
fn main() {
|
||||
Vec::<isize, Heap, bool>::new();
|
||||
//~^ ERROR too many type parameters provided
|
||||
//~^ ERROR wrong number of type arguments
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,9 +36,6 @@ fn main() {
|
|||
import(); //~ ERROR: unresolved
|
||||
|
||||
foo::<A>(); //~ ERROR: undeclared
|
||||
//~^ ERROR: undeclared
|
||||
foo::<C>(); //~ ERROR: undeclared
|
||||
//~^ ERROR: undeclared
|
||||
foo::<D>(); //~ ERROR: undeclared
|
||||
//~^ ERROR: undeclared
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
struct Foo;
|
||||
impl Foo {
|
||||
fn orange(&self){}
|
||||
fn orange(&self){} //~ ERROR error: duplicate definition of value `orange`
|
||||
fn orange(&self){} //~ ERROR error: duplicate method in trait impl
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ enum Bar<T> { What }
|
|||
|
||||
fn foo<T>() {
|
||||
static a: Bar<T> = Bar::What;
|
||||
//~^ ERROR: cannot use an outer type parameter in this context
|
||||
//~^ ERROR cannot use an outer type parameter in this context
|
||||
//~| ERROR use of undeclared type name `T`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ mod a {
|
|||
|
||||
fn main() {
|
||||
a::Foo::new();
|
||||
//~^ ERROR: static method `new` is inaccessible
|
||||
//~^ ERROR: method `new` is inaccessible
|
||||
//~^^ NOTE: struct `Foo` is private
|
||||
a::Bar::new();
|
||||
//~^ ERROR: static method `new` is inaccessible
|
||||
//~^ ERROR: method `new` is inaccessible
|
||||
//~^^ NOTE: enum `Bar` is private
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ impl Foo for *const BarTy {
|
|||
baz();
|
||||
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
|
||||
a;
|
||||
//~^ ERROR: unresolved name `a`. Did you mean to call `BarTy::a`?
|
||||
//~^ ERROR: unresolved name `a`
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -42,11 +42,11 @@ impl<'a> Foo for &'a BarTy {
|
|||
y;
|
||||
//~^ ERROR: unresolved name `y`. Did you mean `self.y`?
|
||||
a;
|
||||
//~^ ERROR: unresolved name `a`. Did you mean to call `BarTy::a`?
|
||||
//~^ ERROR: unresolved name `a`
|
||||
bah;
|
||||
//~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
|
||||
b;
|
||||
//~^ ERROR: unresolved name `b`. Did you mean to call `self.b`?
|
||||
//~^ ERROR: unresolved name `b`
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -59,11 +59,11 @@ impl<'a> Foo for &'a mut BarTy {
|
|||
y;
|
||||
//~^ ERROR: unresolved name `y`. Did you mean `self.y`?
|
||||
a;
|
||||
//~^ ERROR: unresolved name `a`. Did you mean to call `BarTy::a`?
|
||||
//~^ ERROR: unresolved name `a`
|
||||
bah;
|
||||
//~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
|
||||
b;
|
||||
//~^ ERROR: unresolved name `b`. Did you mean to call `self.b`?
|
||||
//~^ ERROR: unresolved name `b`
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,18 +15,11 @@ trait From<Src> {
|
|||
}
|
||||
|
||||
trait To {
|
||||
// This is a typo, the return type should be `<Dst as From<Self>>::Output`
|
||||
fn to<Dst: From<Self>>(
|
||||
self
|
||||
//~^ error: the trait `core::marker::Sized` is not implemented
|
||||
) ->
|
||||
fn to<Dst: From<Self>>(self) ->
|
||||
<Dst as From<Self>>::Dst
|
||||
//~^ error: the trait `core::marker::Sized` is not implemented
|
||||
//~^ ERROR use of undeclared associated type `From::Dst`
|
||||
{
|
||||
From::from(
|
||||
//~^ error: the trait `core::marker::Sized` is not implemented
|
||||
self
|
||||
)
|
||||
From::from(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ mod B {
|
|||
use crate1::A::Foo;
|
||||
fn bar(f: Foo) {
|
||||
Foo::foo(&f);
|
||||
//~^ ERROR: function `foo` is private
|
||||
//~^ ERROR: method `foo` is private
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ impl Groom for cat {
|
|||
shave(4);
|
||||
//~^ ERROR: unresolved name `shave`. Did you mean to call `Groom::shave`?
|
||||
purr();
|
||||
//~^ ERROR: unresolved name `purr`. Did you mean to call `self.purr`?
|
||||
//~^ ERROR: unresolved name `purr`
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -45,13 +45,13 @@ impl cat {
|
|||
|
||||
fn purr_louder() {
|
||||
static_method();
|
||||
//~^ ERROR: unresolved name `static_method`. Did you mean to call `cat::static_method`
|
||||
//~^ ERROR: unresolved name `static_method`
|
||||
purr();
|
||||
//~^ ERROR: unresolved name `purr`. Did you mean to call `self.purr`?
|
||||
//~^ ERROR: unresolved name `purr`
|
||||
purr();
|
||||
//~^ ERROR: unresolved name `purr`. Did you mean to call `self.purr`?
|
||||
//~^ ERROR: unresolved name `purr`
|
||||
purr();
|
||||
//~^ ERROR: unresolved name `purr`. Did you mean to call `self.purr`?
|
||||
//~^ ERROR: unresolved name `purr`
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ impl cat {
|
|||
|
||||
fn purr(&self) {
|
||||
grow_older();
|
||||
//~^ ERROR: unresolved name `grow_older`. Did you mean to call `cat::grow_older`
|
||||
//~^ ERROR: unresolved name `grow_older`
|
||||
shave();
|
||||
//~^ ERROR: unresolved name `shave`
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ impl cat {
|
|||
whiskers = 4;
|
||||
//~^ ERROR: unresolved name `whiskers`. Did you mean `self.whiskers`?
|
||||
purr_louder();
|
||||
//~^ ERROR: unresolved name `purr_louder`. Did you mean to call `cat::purr_louder`
|
||||
//~^ ERROR: unresolved name `purr_louder`
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@
|
|||
fn main() {
|
||||
let foo = 100;
|
||||
|
||||
static y: isize = foo + 1; //~ ERROR: attempt to use a non-constant value in a constant
|
||||
static y: isize = foo + 1;
|
||||
//~^ ERROR attempt to use a non-constant value in a constant
|
||||
//~| ERROR unresolved name `foo`
|
||||
|
||||
println!("{}", y);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ fn main() {
|
|||
|
||||
#[derive(Debug)]
|
||||
enum Stuff {
|
||||
Bar = foo //~ ERROR attempt to use a non-constant value in a constant
|
||||
Bar = foo
|
||||
//~^ ERROR attempt to use a non-constant value in a constant
|
||||
//~| ERROR unresolved name `foo`
|
||||
}
|
||||
|
||||
println!("{}", Stuff::Bar);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn f(x:isize) {
|
||||
static child: isize = x + 1; //~ ERROR attempt to use a non-constant value in a constant
|
||||
static child: isize = x + 1;
|
||||
//~^ ERROR attempt to use a non-constant value in a constant
|
||||
//~| ERROR unresolved name `x`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ impl PTrait for P {
|
|||
fn getChildOption(&self) -> Option<Box<P>> {
|
||||
static childVal: Box<P> = self.child.get();
|
||||
//~^ ERROR attempt to use a non-constant value in a constant
|
||||
//~| ERROR unresolved name `self`
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,5 @@ impl ToString_ for Point {
|
|||
|
||||
fn main() {
|
||||
let p = Point::new(0.0, 0.0);
|
||||
//~^ ERROR unresolved name `Point::new`
|
||||
//~^^ ERROR failed to resolve. Use of undeclared type or module `Point`
|
||||
println!("{}", p.to_string());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ impl Foo {
|
|||
Foo { baz: 0 }.bar();
|
||||
}
|
||||
|
||||
fn bar() { //~ ERROR duplicate definition of value `bar`
|
||||
fn bar() { //~ ERROR duplicate method in trait impl
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-tidy-linelength
|
||||
|
||||
struct Foo {
|
||||
x: isize
|
||||
}
|
||||
|
||||
impl Fo { //~ERROR inherent implementations are not allowed for types not defined in the current module
|
||||
impl Fo { //~ ERROR use of undeclared type name `Fo`
|
||||
fn foo() {}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// ignore-tidy-linelength
|
||||
|
||||
impl B { //~ERROR inherent implementations are not allowed for types not defined in the current module
|
||||
impl B { //~ ERROR use of undeclared type name `B`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -29,45 +29,104 @@ mod cross_crate {
|
|||
use lint_stability::*;
|
||||
|
||||
fn test() {
|
||||
type Foo = MethodTester;
|
||||
let foo = MethodTester;
|
||||
|
||||
deprecated(); //~ ERROR use of deprecated item
|
||||
foo.method_deprecated(); //~ ERROR use of deprecated item
|
||||
Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
|
||||
deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
|
||||
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::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
<Foo>::method_deprecated_unstable(&foo); //~ 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
|
||||
Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
<Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
<Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
|
||||
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::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
//~^ WARNING use of unstable library feature
|
||||
<Foo>::method_deprecated_unstable_text(&foo); //~ 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
|
||||
Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
//~^ WARNING use of unstable library feature
|
||||
<Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
//~^ WARNING use of unstable library feature
|
||||
<Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
//~^ WARNING use of unstable library feature
|
||||
|
||||
unstable(); //~ WARNING use of unstable library feature
|
||||
foo.method_unstable(); //~ WARNING use of unstable library feature
|
||||
Foo::method_unstable(&foo); //~ WARNING use of unstable library feature
|
||||
<Foo>::method_unstable(&foo); //~ WARNING use of unstable library feature
|
||||
foo.trait_unstable(); //~ WARNING use of unstable library feature
|
||||
Trait::trait_unstable(&foo); //~ WARNING use of unstable library feature
|
||||
<Foo>::trait_unstable(&foo); //~ WARNING use of unstable library feature
|
||||
<Foo as Trait>::trait_unstable(&foo); //~ WARNING use of unstable library feature
|
||||
|
||||
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
|
||||
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::method_unstable_text(&foo);
|
||||
//~^ WARNING use of unstable library feature 'test_feature': text
|
||||
<Foo>::method_unstable_text(&foo);
|
||||
//~^ WARNING use of unstable library feature 'test_feature': text
|
||||
foo.trait_unstable_text();
|
||||
//~^ WARNING use of unstable library feature 'test_feature': text
|
||||
Trait::trait_unstable_text(&foo);
|
||||
//~^ WARNING use of unstable library feature 'test_feature': text
|
||||
<Foo>::trait_unstable_text(&foo);
|
||||
//~^ WARNING use of unstable library feature 'test_feature': text
|
||||
<Foo as Trait>::trait_unstable_text(&foo);
|
||||
//~^ WARNING use of unstable library feature 'test_feature': text
|
||||
|
||||
stable();
|
||||
foo.method_stable();
|
||||
Foo::method_stable(&foo);
|
||||
<Foo>::method_stable(&foo);
|
||||
foo.trait_stable();
|
||||
Trait::trait_stable(&foo);
|
||||
<Foo>::trait_stable(&foo);
|
||||
<Foo as Trait>::trait_stable(&foo);
|
||||
|
||||
stable_text();
|
||||
foo.method_stable_text();
|
||||
Foo::method_stable_text(&foo);
|
||||
<Foo>::method_stable_text(&foo);
|
||||
foo.trait_stable_text();
|
||||
Trait::trait_stable_text(&foo);
|
||||
<Foo>::trait_stable_text(&foo);
|
||||
<Foo as Trait>::trait_stable_text(&foo);
|
||||
|
||||
let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item
|
||||
let _ = DeprecatedUnstableStruct { i: 0 }; //~ ERROR use of deprecated item
|
||||
|
|
@ -104,16 +163,47 @@ mod cross_crate {
|
|||
macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text
|
||||
}
|
||||
|
||||
fn test_method_param<F: Trait>(foo: F) {
|
||||
fn test_method_param<Foo: Trait>(foo: Foo) {
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
<Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
||||
//~^ WARNING use of unstable library feature
|
||||
<Foo as Trait>::trait_deprecated_unstable(&foo); //~ 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
|
||||
Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
//~^ WARNING use of unstable library feature
|
||||
<Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
||||
//~^ WARNING use of unstable library feature
|
||||
<Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ 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
|
||||
Trait::trait_unstable(&foo); //~ WARNING use of unstable library feature
|
||||
<Foo>::trait_unstable(&foo); //~ WARNING use of unstable library feature
|
||||
<Foo as Trait>::trait_unstable(&foo); //~ WARNING use of unstable library feature
|
||||
foo.trait_unstable_text();
|
||||
//~^ WARNING use of unstable library feature 'test_feature': text
|
||||
Trait::trait_unstable_text(&foo);
|
||||
//~^ WARNING use of unstable library feature 'test_feature': text
|
||||
<Foo>::trait_unstable_text(&foo);
|
||||
//~^ WARNING use of unstable library feature 'test_feature': text
|
||||
<Foo as Trait>::trait_unstable_text(&foo);
|
||||
//~^ WARNING use of unstable library feature 'test_feature': text
|
||||
foo.trait_stable();
|
||||
Trait::trait_stable(&foo);
|
||||
<Foo>::trait_stable(&foo);
|
||||
<Foo as Trait>::trait_stable(&foo);
|
||||
}
|
||||
|
||||
fn test_method_object(foo: &Trait) {
|
||||
|
|
@ -124,7 +214,8 @@ mod cross_crate {
|
|||
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_unstable_text();
|
||||
//~^ WARNING use of unstable library feature 'test_feature': text
|
||||
foo.trait_stable();
|
||||
}
|
||||
|
||||
|
|
@ -264,31 +355,62 @@ mod this_crate {
|
|||
// errors, because other stability attributes now have meaning
|
||||
// only *across* crates, not within a single crate.
|
||||
|
||||
type Foo = MethodTester;
|
||||
let foo = MethodTester;
|
||||
|
||||
deprecated(); //~ ERROR use of deprecated item
|
||||
foo.method_deprecated(); //~ ERROR use of deprecated item
|
||||
Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
|
||||
deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
|
||||
unstable();
|
||||
foo.method_unstable();
|
||||
Foo::method_unstable(&foo);
|
||||
<Foo>::method_unstable(&foo);
|
||||
foo.trait_unstable();
|
||||
Trait::trait_unstable(&foo);
|
||||
<Foo>::trait_unstable(&foo);
|
||||
<Foo as Trait>::trait_unstable(&foo);
|
||||
|
||||
unstable_text();
|
||||
foo.method_unstable_text();
|
||||
Foo::method_unstable_text(&foo);
|
||||
<Foo>::method_unstable_text(&foo);
|
||||
foo.trait_unstable_text();
|
||||
Trait::trait_unstable_text(&foo);
|
||||
<Foo>::trait_unstable_text(&foo);
|
||||
<Foo as Trait>::trait_unstable_text(&foo);
|
||||
|
||||
stable();
|
||||
foo.method_stable();
|
||||
Foo::method_stable(&foo);
|
||||
<Foo>::method_stable(&foo);
|
||||
foo.trait_stable();
|
||||
Trait::trait_stable(&foo);
|
||||
<Foo>::trait_stable(&foo);
|
||||
<Foo as Trait>::trait_stable(&foo);
|
||||
|
||||
stable_text();
|
||||
foo.method_stable_text();
|
||||
Foo::method_stable_text(&foo);
|
||||
<Foo>::method_stable_text(&foo);
|
||||
foo.trait_stable_text();
|
||||
Trait::trait_stable_text(&foo);
|
||||
<Foo>::trait_stable_text(&foo);
|
||||
<Foo as Trait>::trait_stable_text(&foo);
|
||||
|
||||
let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item
|
||||
let _ = UnstableStruct { i: 0 };
|
||||
|
|
@ -307,12 +429,27 @@ mod this_crate {
|
|||
let _ = StableTupleStruct (1);
|
||||
}
|
||||
|
||||
fn test_method_param<F: Trait>(foo: F) {
|
||||
fn test_method_param<Foo: Trait>(foo: Foo) {
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
<Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
||||
foo.trait_unstable();
|
||||
Trait::trait_unstable(&foo);
|
||||
<Foo>::trait_unstable(&foo);
|
||||
<Foo as Trait>::trait_unstable(&foo);
|
||||
foo.trait_unstable_text();
|
||||
Trait::trait_unstable_text(&foo);
|
||||
<Foo>::trait_unstable_text(&foo);
|
||||
<Foo as Trait>::trait_unstable_text(&foo);
|
||||
foo.trait_stable();
|
||||
Trait::trait_stable(&foo);
|
||||
<Foo>::trait_stable(&foo);
|
||||
<Foo as Trait>::trait_stable(&foo);
|
||||
}
|
||||
|
||||
fn test_method_object(foo: &Trait) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ impl S {
|
|||
|
||||
// Cause an error. It shouldn't have any macro backtrace frames.
|
||||
fn bar(&self) { }
|
||||
fn bar(&self) { } //~ ERROR duplicate definition
|
||||
fn bar(&self) { } //~ ERROR duplicate method
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@
|
|||
mod foo {
|
||||
mod baz {
|
||||
struct Test;
|
||||
impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Add for Test {} //~ ERROR: use of undeclared trait
|
||||
impl Clone for Test {} //~ ERROR: use of undeclared trait
|
||||
impl Iterator for Test {} //~ ERROR: use of undeclared trait
|
||||
impl ToString for Test {} //~ ERROR: use of undeclared trait
|
||||
impl Writer for Test {} //~ ERROR: use of undeclared trait
|
||||
|
||||
fn foo() {
|
||||
drop(2) //~ ERROR: unresolved name
|
||||
|
|
@ -30,11 +30,11 @@ mod foo {
|
|||
}
|
||||
|
||||
struct Test;
|
||||
impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Add for Test {} //~ ERROR: use of undeclared trait
|
||||
impl Clone for Test {} //~ ERROR: use of undeclared trait
|
||||
impl Iterator for Test {} //~ ERROR: use of undeclared trait
|
||||
impl ToString for Test {} //~ ERROR: use of undeclared trait
|
||||
impl Writer for Test {} //~ ERROR: use of undeclared trait
|
||||
|
||||
fn foo() {
|
||||
drop(2) //~ ERROR: unresolved name
|
||||
|
|
@ -45,11 +45,11 @@ fn qux() {
|
|||
#[no_implicit_prelude]
|
||||
mod qux_inner {
|
||||
struct Test;
|
||||
impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Add for Test {} //~ ERROR: use of undeclared trait
|
||||
impl Clone for Test {} //~ ERROR: use of undeclared trait
|
||||
impl Iterator for Test {} //~ ERROR: use of undeclared trait
|
||||
impl ToString for Test {} //~ ERROR: use of undeclared trait
|
||||
impl Writer for Test {} //~ ERROR: use of undeclared trait
|
||||
|
||||
fn foo() {
|
||||
drop(2) //~ ERROR: unresolved name
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@
|
|||
// fail with the same error message).
|
||||
|
||||
struct Test;
|
||||
impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait
|
||||
impl Add for Test {} //~ ERROR: use of undeclared trait
|
||||
impl Clone for Test {} //~ ERROR: use of undeclared trait
|
||||
impl Iterator for Test {} //~ ERROR: use of undeclared trait
|
||||
impl ToString for Test {} //~ ERROR: use of undeclared trait
|
||||
impl Writer for Test {} //~ ERROR: use of undeclared trait
|
||||
|
||||
fn main() {
|
||||
drop(2) //~ ERROR: unresolved name
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
|
||||
trait NewTrait : SomeNonExistentTrait {}
|
||||
//~^ ERROR attempt to derive a nonexistent trait `SomeNonExistentTrait`
|
||||
//~^ ERROR use of undeclared trait name `SomeNonExistentTrait`
|
||||
|
||||
impl SomeNonExistentTrait for isize {}
|
||||
//~^ ERROR attempt to implement a nonexistent trait `SomeNonExistentTrait`
|
||||
//~^ ERROR use of undeclared trait name `SomeNonExistentTrait`
|
||||
|
||||
fn f<T:SomeNonExistentTrait>() {}
|
||||
//~^ ERROR attempt to bound type parameter with a nonexistent trait `SomeNonExistentTrait`
|
||||
//~^ ERROR use of undeclared trait name `SomeNonExistentTrait`
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ mod a {
|
|||
trait A {
|
||||
}
|
||||
|
||||
impl A for a { //~ERROR found module name used as a type
|
||||
impl A for a { //~ ERROR use of undeclared type name `a`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -8,9 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-tidy-linelength
|
||||
|
||||
impl<T> Option<T> { //~ERROR inherent implementations are not allowed for types not defined in the current module
|
||||
impl<T> Option<T> {
|
||||
//~^ ERROR cannot associate methods with a type outside the crate the type is defined in
|
||||
pub fn foo(&self) { }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@ use std::borrow::IntoCow;
|
|||
|
||||
fn main() {
|
||||
<String as IntoCow>::into_cow("foo".to_string());
|
||||
//~^ ERROR wrong number of type arguments: expected 1, found 0
|
||||
//~^ ERROR too few type parameters provided: expected 1 parameter(s)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#![feature(unboxed_closures)]
|
||||
|
||||
fn f<F:Nonexist(isize) -> isize>(x: F) {} //~ ERROR nonexistent trait `Nonexist`
|
||||
fn f<F:Nonexist(isize) -> isize>(x: F) {} //~ ERROR undeclared trait name `Nonexist`
|
||||
|
||||
type Typedef = isize;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
use Trait::foo;
|
||||
//~^ ERROR `foo` is not directly importable
|
||||
use Foo::new;
|
||||
//~^ ERROR `new` is not directly importable
|
||||
//~^ ERROR unresolved import `Foo::new`. Not a module `Foo`
|
||||
|
||||
pub trait Trait {
|
||||
fn foo();
|
||||
|
|
|
|||
31
src/test/run-pass/impl-inherent-non-conflict.rs
Normal file
31
src/test/run-pass/impl-inherent-non-conflict.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// 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.
|
||||
|
||||
// Ensure that an user-defined type admits multiple inherent methods
|
||||
// with the same name, which can be called on values that have a
|
||||
// precise enough type to allow distinguishing between the methods.
|
||||
|
||||
struct Foo<T>(T);
|
||||
|
||||
impl Foo<usize> {
|
||||
fn bar(&self) -> i32 { self.0 as i32 }
|
||||
}
|
||||
|
||||
impl Foo<isize> {
|
||||
fn bar(&self) -> i32 { -(self.0 as i32) }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let foo_u = Foo::<usize>(5);
|
||||
assert_eq!(foo_u.bar(), 5);
|
||||
|
||||
let foo_i = Foo::<isize>(3);
|
||||
assert_eq!(foo_i.bar(), -3);
|
||||
}
|
||||
38
src/test/run-pass/impl-inherent-prefer-over-trait.rs
Normal file
38
src/test/run-pass/impl-inherent-prefer-over-trait.rs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// 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.
|
||||
|
||||
struct Foo;
|
||||
|
||||
trait Trait {
|
||||
fn bar(&self);
|
||||
}
|
||||
|
||||
// Inherent impls should be preferred over trait ones.
|
||||
impl Foo {
|
||||
fn bar(&self) {}
|
||||
}
|
||||
|
||||
impl Trait {
|
||||
fn baz(_: &Foo) {}
|
||||
}
|
||||
|
||||
impl Trait for Foo {
|
||||
fn bar(&self) { panic!("wrong method called!") }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
Foo.bar();
|
||||
Foo::bar(&Foo);
|
||||
<Foo>::bar(&Foo);
|
||||
|
||||
// Should work even if Trait::baz doesn't exist.
|
||||
// N.B: `<Trait>::bar` would be ambiguous.
|
||||
<Trait>::baz(&Foo);
|
||||
}
|
||||
|
|
@ -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,17 +8,17 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Test calling methods on an impl for a bare trait. This test checks trait impls
|
||||
// must be in the same module as the trait.
|
||||
|
||||
mod Foo {
|
||||
trait T {}
|
||||
}
|
||||
|
||||
mod Bar {
|
||||
impl<'a> ::Foo::T+'a { //~ERROR: inherent implementations may only be implemented in the same
|
||||
fn foo(&self) {}
|
||||
mod foo {
|
||||
pub struct Point {
|
||||
pub x: i32,
|
||||
pub y: i32,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
impl foo::Point {
|
||||
fn x(&self) -> i32 { self.x }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!((foo::Point { x: 1, y: 3}).x(), 1);
|
||||
}
|
||||
|
|
@ -8,14 +8,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-tidy-linelength
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
mod bar {
|
||||
use Foo;
|
||||
|
||||
impl Foo { //~ERROR inherent implementations are only allowed on types defined in the current module
|
||||
impl Foo {
|
||||
fn baz(&self) {}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,15 +8,13 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-tidy-linelength
|
||||
|
||||
pub mod a {
|
||||
pub struct Foo { a: usize }
|
||||
}
|
||||
|
||||
pub mod b {
|
||||
use a::Foo;
|
||||
impl Foo { //~ERROR inherent implementations are only allowed on types defined in the current module
|
||||
impl Foo {
|
||||
fn bar(&self) { }
|
||||
}
|
||||
}
|
||||
|
|
@ -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,17 +8,16 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
mod foo {
|
||||
pub struct Foo {
|
||||
x: isize,
|
||||
y: isize,
|
||||
pub mod Foo {
|
||||
pub trait Trait {
|
||||
fn foo(&self);
|
||||
}
|
||||
}
|
||||
|
||||
impl foo::Foo {
|
||||
//~^ ERROR implementations may only be implemented in the same module
|
||||
fn bar() {}
|
||||
mod Bar {
|
||||
impl<'a> ::Foo::Trait+'a {
|
||||
fn bar(&self) { self.foo() }
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
|
|
@ -27,11 +27,11 @@ struct Newt<T>(T);
|
|||
fn id<T>(x: T) -> T { x }
|
||||
fn eq<T: Eq>(a: T, b: T) -> bool { a == b }
|
||||
fn u8_as_i8(x: u8) -> i8 { x as i8 }
|
||||
fn odd(x: uint) -> bool { x % 2 == 1 }
|
||||
fn odd(x: usize) -> bool { x % 2 == 1 }
|
||||
fn dummy_rng() -> DummyRng { DummyRng::new_unseeded() }
|
||||
|
||||
trait Size: Sized {
|
||||
fn size() -> uint { std::mem::size_of::<Self>() }
|
||||
fn size() -> usize { std::mem::size_of::<Self>() }
|
||||
}
|
||||
impl<T> Size for T {}
|
||||
|
||||
|
|
@ -47,24 +47,26 @@ macro_rules! tests {
|
|||
|
||||
tests! {
|
||||
// Free function.
|
||||
id, fn(int) -> int, (5);
|
||||
id::<int>, fn(int) -> int, (5);
|
||||
id, fn(i32) -> i32, (5);
|
||||
id::<i32>, fn(i32) -> i32, (5);
|
||||
|
||||
// Enum variant constructor.
|
||||
Some, fn(int) -> Option<int>, (5);
|
||||
Some::<int>, fn(int) -> Option<int>, (5);
|
||||
Some, fn(i32) -> Option<i32>, (5);
|
||||
Some::<i32>, fn(i32) -> Option<i32>, (5);
|
||||
|
||||
// Tuple struct constructor.
|
||||
Newt, fn(int) -> Newt<int>, (5);
|
||||
Newt::<int>, fn(int) -> Newt<int>, (5);
|
||||
Newt, fn(i32) -> Newt<i32>, (5);
|
||||
Newt::<i32>, fn(i32) -> Newt<i32>, (5);
|
||||
|
||||
// Inherent static methods.
|
||||
Vec::new, fn() -> Vec<()>, ();
|
||||
Vec::<()>::new, fn() -> Vec<()>, ();
|
||||
Vec::with_capacity, fn(uint) -> Vec<()>, (5);
|
||||
Vec::<()>::with_capacity, fn(uint) -> Vec<()>, (5);
|
||||
BitVec::from_fn, fn(uint, fn(uint) -> bool) -> BitVec, (5, odd);
|
||||
BitVec::from_fn::<fn(uint) -> bool>, fn(uint, fn(uint) -> bool) -> BitVec, (5, odd);
|
||||
<Vec<()>>::new, fn() -> Vec<()>, ();
|
||||
Vec::with_capacity, fn(usize) -> Vec<()>, (5);
|
||||
Vec::<()>::with_capacity, fn(usize) -> Vec<()>, (5);
|
||||
<Vec<()>>::with_capacity, fn(usize) -> Vec<()>, (5);
|
||||
BitVec::from_fn, fn(usize, fn(usize) -> bool) -> BitVec, (5, odd);
|
||||
BitVec::from_fn::<fn(usize) -> bool>, fn(usize, fn(usize) -> bool) -> BitVec, (5, odd);
|
||||
|
||||
// Inherent non-static method.
|
||||
Vec::map_in_place, fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>, (vec![b'f', b'o', b'o'], u8_as_i8);
|
||||
|
|
@ -77,29 +79,52 @@ tests! {
|
|||
// , (vec![b'f', b'o', b'o'], u8_as_i8);
|
||||
|
||||
// Trait static methods.
|
||||
<bool as Size>::size, fn() -> uint, ();
|
||||
Default::default, fn() -> int, ();
|
||||
<int as Default>::default, fn() -> int, ();
|
||||
Rand::rand, fn(&mut DummyRng) -> int, (&mut dummy_rng());
|
||||
<int as Rand>::rand, fn(&mut DummyRng) -> int, (&mut dummy_rng());
|
||||
Rand::rand::<DummyRng>, fn(&mut DummyRng) -> int, (&mut dummy_rng());
|
||||
<int as Rand>::rand::<DummyRng>, fn(&mut DummyRng) -> int, (&mut dummy_rng());
|
||||
bool::size, fn() -> usize, ();
|
||||
<bool>::size, fn() -> usize, ();
|
||||
<bool as Size>::size, fn() -> usize, ();
|
||||
|
||||
Default::default, fn() -> i32, ();
|
||||
i32::default, fn() -> i32, ();
|
||||
<i32>::default, fn() -> i32, ();
|
||||
<i32 as Default>::default, fn() -> i32, ();
|
||||
|
||||
Rand::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng());
|
||||
i32::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng());
|
||||
<i32>::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng());
|
||||
<i32 as Rand>::rand, fn(&mut DummyRng) -> i32, (&mut dummy_rng());
|
||||
Rand::rand::<DummyRng>, fn(&mut DummyRng) -> i32, (&mut dummy_rng());
|
||||
i32::rand::<DummyRng>, fn(&mut DummyRng) -> i32, (&mut dummy_rng());
|
||||
<i32>::rand::<DummyRng>, fn(&mut DummyRng) -> i32, (&mut dummy_rng());
|
||||
<i32 as Rand>::rand::<DummyRng>, fn(&mut DummyRng) -> i32, (&mut dummy_rng());
|
||||
|
||||
// Trait non-static methods.
|
||||
Clone::clone, fn(&int) -> int, (&5);
|
||||
<int as Clone>::clone, fn(&int) -> int, (&5);
|
||||
FromIterator::from_iter, fn(OptionIter<int>) -> Vec<int>, (Some(5).into_iter());
|
||||
<Vec<_> as FromIterator<_>>::from_iter, fn(OptionIter<int>) -> Vec<int>,
|
||||
Clone::clone, fn(&i32) -> i32, (&5);
|
||||
i32::clone, fn(&i32) -> i32, (&5);
|
||||
<i32>::clone, fn(&i32) -> i32, (&5);
|
||||
<i32 as Clone>::clone, fn(&i32) -> i32, (&5);
|
||||
|
||||
FromIterator::from_iter, fn(OptionIter<i32>) -> Vec<i32>, (Some(5).into_iter());
|
||||
Vec::from_iter, fn(OptionIter<i32>) -> Vec<i32>, (Some(5).into_iter());
|
||||
<Vec<_>>::from_iter, fn(OptionIter<i32>) -> Vec<i32>, (Some(5).into_iter());
|
||||
<Vec<_> as FromIterator<_>>::from_iter, fn(OptionIter<i32>) -> Vec<i32>,
|
||||
(Some(5).into_iter());
|
||||
<Vec<int> as FromIterator<_>>::from_iter, fn(OptionIter<int>) -> Vec<int>,
|
||||
<Vec<i32> as FromIterator<_>>::from_iter, fn(OptionIter<i32>) -> Vec<i32>,
|
||||
(Some(5).into_iter());
|
||||
FromIterator::from_iter::<OptionIter<int>>, fn(OptionIter<int>) -> Vec<int>,
|
||||
FromIterator::from_iter::<OptionIter<i32>>, fn(OptionIter<i32>) -> Vec<i32>,
|
||||
(Some(5).into_iter());
|
||||
<Vec<int> as FromIterator<_>>::from_iter::<OptionIter<int>>, fn(OptionIter<int>) -> Vec<int>,
|
||||
<Vec<i32> as FromIterator<_>>::from_iter::<OptionIter<i32>>, fn(OptionIter<i32>) -> Vec<i32>,
|
||||
(Some(5).into_iter());
|
||||
|
||||
Add::add, fn(i32, i32) -> i32, (5, 6);
|
||||
i32::add, fn(i32, i32) -> i32, (5, 6);
|
||||
<i32>::add, fn(i32, i32) -> i32, (5, 6);
|
||||
<i32 as Add<_>>::add, fn(i32, i32) -> i32, (5, 6);
|
||||
<i32 as Add<i32>>::add, fn(i32, i32) -> i32, (5, 6);
|
||||
|
||||
String::into_cow, fn(String) -> Cow<'static, str>,
|
||||
("foo".to_string());
|
||||
<String>::into_cow, fn(String) -> Cow<'static, str>,
|
||||
("foo".to_string());
|
||||
<String as IntoCow<_>>::into_cow, fn(String) -> Cow<'static, str>,
|
||||
("foo".to_string());
|
||||
<String as IntoCow<'static, _>>::into_cow, fn(String) -> Cow<'static, str>,
|
||||
Loading…
Add table
Add a link
Reference in a new issue