2016-05-17 08:01:31 -05:00
|
|
|
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
trait SomeTrait {
|
|
|
|
fn foo();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2016-08-14 18:48:55 -05:00
|
|
|
let trait_obj: &SomeTrait = SomeTrait;
|
2016-11-30 16:35:25 -06:00
|
|
|
//~^ ERROR expected value, found trait `SomeTrait`
|
|
|
|
//~| NOTE not a value
|
2016-08-14 18:48:55 -05:00
|
|
|
//~| ERROR E0038
|
|
|
|
//~| method `foo` has no receiver
|
|
|
|
//~| NOTE the trait `SomeTrait` cannot be made into an object
|
2016-08-08 15:37:44 -05:00
|
|
|
|
|
|
|
let &invalid = trait_obj;
|
|
|
|
//~^ ERROR E0033
|
|
|
|
//~| NOTE type `&SomeTrait` cannot be dereferenced
|
2016-05-17 08:01:31 -05:00
|
|
|
}
|