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
Currently, if a method on an iface mentions the type self, we forbid that method from being called via a boxed iface. But this restriction can be worked around by using generic types:
iface i { fn foo() -> self<>; }
fn foo<T:i>(v: T) -> T {
ret v.foo();
}
impl of i for uint {
fn foo() -> uint { ret self; }
}
fn main() {
let x: i = 3u as i;
let y = foo(x); // y has type i, but is in fact a uint
}
A couple of solutions spring to mind, but on IRC we discussed saying that if an iface i includes a self type, then instances of i do not implement i.
The text was updated successfully, but these errors were encountered:
* Docs for `needs-forced-clang-based-tests` (was `needs-matching-clang`)
* Docs for `aux-codegen-backend`
* Docs for `{{sysroot-base}}` and `{{target-linker}}`
bors
pushed a commit
to rust-lang-ci/rust
that referenced
this issue
Jan 2, 2025
* Docs for `needs-forced-clang-based-tests` (was `needs-matching-clang`)
* Docs for `aux-codegen-backend`
* Docs for `{{sysroot-base}}` and `{{target-linker}}`
Currently, if a method on an iface mentions the type
self
, we forbid that method from being called via a boxed iface. But this restriction can be worked around by using generic types:A couple of solutions spring to mind, but on IRC we discussed saying that if an iface
i
includes a self type, then instances ofi
do not implementi
.The text was updated successfully, but these errors were encountered: