Problem with traits during learning rust


I’ve got an unexpected (for me) problem while trying to learn rust. I’ve created two files:

trait Shape {
fn where_am_i(&self) {

pub struct Rect {
ul_x : i16,
ul_y : i16,
lr_x : i16,
lr_y : i16

impl Shape for Rect {
fn where_am_i(&self) {


mod shape;

use shape::*;

fn main() {
let r : Rect;

during compiling i’ve got an error E0599: no method named ‘where_am_i’ found for type ‘shape::Rect’ in the current scope
help: items from traits can only be used if the trait is implemented and in scope
note: the following trait defines an item ‘where_am_i’, perhaps you need to implement it
and so on…

Please, point me my error and please, don’t be cruel, cause it’s my second rust program after “Hello World”))
Thanks in advance.


Your Shape trait is private, so use shape::* doesn’t bring it into scope, and the compiler complains. (With a non-wildcard use that would’ve been immediately obvious, which is why I avoid wildcards as a rule.)

When you make the trait public, you’ll get the “possibly uninitialized” error, which is to be expected.


Thanks! That helped!