mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Replace inheritance_integrity by trait shenanigans
For each derived DomObject impl, we also generate a dummy trait ShouldNotImplDomObject that is implemented for all T: DomObject. We then try to implement it for each field type except the first one. If compilation succeed, this means that field type doesn't implement DomObject itself otherwise it would break coherence rules. error[E0119]: conflicting implementations of trait `dom::xmlhttprequest::_IMPL_DOMOBJECT_FOR_XMLHttpRequest::ShouldNotImplDomObject` for type `((), SomeFieldTypeThatShouldNotImplementDomObject)`: --> /Users/nox/src/servo/components/script/dom/xmlhttprequest.rs:120:1 | 120 | #[dom_struct] | ^^^^^^^^^^^^^ | | | first implementation here | conflicting implementation for `((), SomeFieldTypeThatShouldNotImplementDomObject)`
This commit is contained in:
parent
37dab8f9f2
commit
a6d59d8714
7 changed files with 56 additions and 139 deletions
|
@ -27,9 +27,8 @@ pub fn reflect_dom_object<T, U>(
|
|||
|
||||
/// A struct to store a reference to the reflector of a DOM object.
|
||||
#[allow(unrooted_must_root)]
|
||||
#[must_root]
|
||||
#[servo_lang = "reflector"]
|
||||
#[derive(HeapSizeOf)]
|
||||
#[must_root]
|
||||
// If you're renaming or moving this field, update the path in plugins::reflector as well
|
||||
pub struct Reflector {
|
||||
#[ignore_heap_size_of = "defined and measured in rust-mozjs"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue