You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pubmod mymod{mod foo {pubtraitToFoo{fnto_foo(self) -> i32;}}pubuseself::foo::ToFoo;}pubfnfoobar<T: mymod::ToFoo>(x:T){let v = x.to_foo();}fnmain(){}
Output:
<anon>:14:13: 14:23 error: source trait is inaccessible
<anon>:14 let v = x.to_foo();
^~~~~~~~~~
<anon>:14:13: 14:23 note: module `foo` is private
<anon>:14 let v = x.to_foo();
^~~~~~~~~~
error: aborting due to previous error
playpen: application terminated with error code 101
Strangely as @bluss pointed out on IRC, this style does compile (playpen):
pub mod mymod{
mod foo {
pub trait ToFoo{
fn to_foo(self) -> i32;
}
}
pub use self::foo::ToFoo;
}
use mymod::ToFoo;
pub fn foobar<T: ToFoo>(x: T) {
let v = ToFoo::to_foo(x);
}
fn main() {}
The text was updated successfully, but these errors were encountered:
This code does not compile (playpen):
Output:
Strangely as @bluss pointed out on IRC, this style does compile (playpen):
The text was updated successfully, but these errors were encountered: