I have tried this fix and it seems to work either with single or multiple trait inheritance.
trait Base:Base2 + Base3{
fn foo(&self);
}
trait Base2 {
fn baz(&self);
}
trait Base3{
fn root(&self);
}
trait Super: Base{
fn bar(&self);
}
struct X;
impl Base for X {
fn foo(&self) {
println("base foo");
}
}
impl Base2 for X {
fn baz(&self) {
println("base2 baz");
}
}
impl Base3 for X {
fn root(&self) {
println("base3 root");
}
}
impl Super for X {
fn bar(&self) {
println("super bar");
}
}
fn main() {
let n = X;
let s = &n as &Super;
s.bar();
s.foo(); // super bar
s.baz();
s.root();
}
bmaxa@maxa:~/examples/rust$ rustc error.rs
bmaxa@maxa:~/examples/rust$ ./error
super bar
base foo
base2 baz
base3 root
This solves problem of incorrect indexing into vtable
when method from super trait was called through pointer
to derived trait.
Problem was that offset of super trait vtables
was not calculated at all.
Now it works, correct offset is calculated by
traversing all super traits up to super trait
where method belongs. That is how it is
intended to work.
If there's no TLS key just yet, then there's nothing to unsafely borrow, so
continue returning None. This prevents causing the runtime to abort itself when
logging before the runtime is fully initialized.
Closes#9487
r? @brson
Moved `StrSlice` doc comments from impl to trait.
Moved `OwnedStr` doc comments from impl to trait.
Normalized a few `StrSlice` method names from `FOO_reverse`, `FOO_rev` and `rFOO` to `FOO_rev`.
Added a few `#[inline]` hints.
The doc comment changes make the source a bit harder to read, as documentation and implementation no longer live right next to each other. But this way they at least appear in the docs.
Moved OwnedStr doc comments from impl to trait.
Added a few #[inline] hints.
The doc comment changes make the source a bit harder to read, as
documentation and implementation no longer live right next to each
other. But this way they at least appear in the docs.
This lifts various restrictions on the runtime, for example the character limit
when logging a message. Right now the old debug!-style macros still involve
allocating (because they use fmt! syntax), but the new debug2! macros don't
involve allocating at all (unless the formatter for a type requires allocation.
This will probably need to get tweaked once the privacy rules have been fully
agreed on, but for now this has all of the infrastructure necessary for
filtering out private items.
Closes#9410
In doing so, also remove the collapse-privacy pass because it's a little
over-zealous and may not be right 100% of the time (not used right now as well)
There is less implicit removal of various comment styles, and it also removes
extraneous stars occasionally found in docblock comments. It turns out that the
bug for getops was just a differently formatted block.
Closes#9425Closes#9417
If there's no TLS key just yet, then there's nothing to unsafely borrow, so
continue returning None. This prevents causing the runtime to abort itself when
logging before the runtime is fully initialized.
Closes#9487
Previously, any package would match any other package ID when searching
using the rust_path_hack, so long as the directory had one or more crate
files in it. Now, rustpkg checks that the parent directory matches the
package ID.
Closes#9273
r? anyone
Part of #7081.
Removed many unnecessary context arguments, turning them into visitors. Removed some @allocation.
If this lands, then I think the only thing left that is unaddressed are:
* the various lint visitors, and
* middle/privacy.rs, which has `impl<'self> Visitor<&'self method_map> for PrivacyVisitor`
In "/src/libstd/char.rs", there are function and method definitions for `is_lowercase()`, `is_uppercase()`, `is_whitespace()`, etc. However, there was no function or method for control characters, so I added the `is_control()` function and method definitions along with documentation and tests. Running `./configure && make check` shows that all tests for `is_control()` pass.