mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
crown: Do not check trait item projections. (#36095)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
80434d4644
commit
471f3f49bc
12 changed files with 32 additions and 22 deletions
|
@ -127,7 +127,6 @@ impl LayoutCanvasRenderingContextHelpers for LayoutDom<'_, CanvasRenderingContex
|
||||||
impl CanvasContext for CanvasRenderingContext2D {
|
impl CanvasContext for CanvasRenderingContext2D {
|
||||||
type ID = CanvasId;
|
type ID = CanvasId;
|
||||||
|
|
||||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))] // Crown is wrong here #35570
|
|
||||||
fn context_id(&self) -> Self::ID {
|
fn context_id(&self) -> Self::ID {
|
||||||
self.canvas_state.get_canvas_id()
|
self.canvas_state.get_canvas_id()
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,9 +89,6 @@ impl TestBindingMaplikeWithInterfaceMethods<crate::DomTypeHolder>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this error is wrong because if we inline Self::Key and Self::Value all errors are gone
|
|
||||||
// TODO: FIX THIS
|
|
||||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
|
|
||||||
impl Maplike for TestBindingMaplikeWithInterface {
|
impl Maplike for TestBindingMaplikeWithInterface {
|
||||||
type Key = DOMString;
|
type Key = DOMString;
|
||||||
type Value = DomRoot<TestBinding>;
|
type Value = DomRoot<TestBinding>;
|
||||||
|
|
|
@ -87,9 +87,6 @@ impl TestBindingMaplikeWithPrimitiveMethods<crate::DomTypeHolder>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this error is wrong because if we inline Self::Key and Self::Value all errors are gone
|
|
||||||
// TODO: FIX THIS
|
|
||||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
|
|
||||||
impl Maplike for TestBindingMaplikeWithPrimitive {
|
impl Maplike for TestBindingMaplikeWithPrimitive {
|
||||||
type Key = DOMString;
|
type Key = DOMString;
|
||||||
type Value = i32;
|
type Value = i32;
|
||||||
|
|
|
@ -61,9 +61,6 @@ impl TestBindingSetlikeWithInterfaceMethods<crate::DomTypeHolder>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this error is wrong because if we inline Self::Key and Self::Value all errors are gone
|
|
||||||
// TODO: FIX THIS
|
|
||||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
|
|
||||||
impl Setlike for TestBindingSetlikeWithInterface {
|
impl Setlike for TestBindingSetlikeWithInterface {
|
||||||
type Key = DomRoot<TestBinding>;
|
type Key = DomRoot<TestBinding>;
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,6 @@ impl TestBindingSetlikeWithPrimitiveMethods<crate::DomTypeHolder>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this error is wrong because if we inline Self::Key and Self::Value all errors are gone
|
|
||||||
// TODO: FIX THIS
|
|
||||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
|
|
||||||
impl Setlike for TestBindingSetlikeWithPrimitive {
|
impl Setlike for TestBindingSetlikeWithPrimitive {
|
||||||
type Key = DOMString;
|
type Key = DOMString;
|
||||||
|
|
||||||
|
|
|
@ -903,7 +903,6 @@ impl WebGL2RenderingContext {
|
||||||
impl CanvasContext for WebGL2RenderingContext {
|
impl CanvasContext for WebGL2RenderingContext {
|
||||||
type ID = WebGLContextId;
|
type ID = WebGLContextId;
|
||||||
|
|
||||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))] // Crown is wrong here #35570
|
|
||||||
fn context_id(&self) -> Self::ID {
|
fn context_id(&self) -> Self::ID {
|
||||||
self.base.context_id()
|
self.base.context_id()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1864,7 +1864,6 @@ impl WebGLRenderingContext {
|
||||||
impl CanvasContext for WebGLRenderingContext {
|
impl CanvasContext for WebGLRenderingContext {
|
||||||
type ID = WebGLContextId;
|
type ID = WebGLContextId;
|
||||||
|
|
||||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))] // Crown is wrong here #35570
|
|
||||||
fn context_id(&self) -> Self::ID {
|
fn context_id(&self) -> Self::ID {
|
||||||
self.webgl_sender.context_id()
|
self.webgl_sender.context_id()
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,6 @@ impl GPUCanvasContext {
|
||||||
impl CanvasContext for GPUCanvasContext {
|
impl CanvasContext for GPUCanvasContext {
|
||||||
type ID = WebGPUContextId;
|
type ID = WebGPUContextId;
|
||||||
|
|
||||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))] // Crown is wrong here #35570
|
|
||||||
fn context_id(&self) -> WebGPUContextId {
|
fn context_id(&self) -> WebGPUContextId {
|
||||||
self.context_id
|
self.context_id
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,8 +139,6 @@ pub(crate) fn gpu_to_wgt_feature(feature: GPUFeatureName) -> Option<Features> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this error is wrong because if we inline Self::Key and Self::Value all errors are gone
|
|
||||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
|
|
||||||
impl Setlike for GPUSupportedFeatures {
|
impl Setlike for GPUSupportedFeatures {
|
||||||
type Key = DOMString;
|
type Key = DOMString;
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,6 @@ impl WGSLLanguageFeaturesMethods<crate::DomTypeHolder> for WGSLLanguageFeatures
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this error is wrong because if we inline Self::Key and Self::Value all errors are gone
|
|
||||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
|
|
||||||
impl Setlike for WGSLLanguageFeatures {
|
impl Setlike for WGSLLanguageFeatures {
|
||||||
type Key = DOMString;
|
type Key = DOMString;
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,9 @@ fn is_unrooted_ty<'tcx>(
|
||||||
ty::RawPtr(..) => false, // don't recurse down *ptrs
|
ty::RawPtr(..) => false, // don't recurse down *ptrs
|
||||||
ty::FnDef(..) | ty::FnPtr(..) => false,
|
ty::FnDef(..) | ty::FnPtr(..) => false,
|
||||||
ty::Alias(
|
ty::Alias(
|
||||||
ty::AliasTyKind::Projection | ty::AliasTyKind::Inherent | ty::AliasTyKind::Weak,
|
kind @ ty::AliasTyKind::Projection |
|
||||||
|
kind @ ty::AliasTyKind::Inherent |
|
||||||
|
kind @ ty::AliasTyKind::Weak,
|
||||||
ty,
|
ty,
|
||||||
) => {
|
) => {
|
||||||
if has_attr(ty.def_id, sym.must_root) {
|
if has_attr(ty.def_id, sym.must_root) {
|
||||||
|
@ -201,7 +203,10 @@ fn is_unrooted_ty<'tcx>(
|
||||||
} else if has_attr(ty.def_id, sym.allow_unrooted_interior) {
|
} else if has_attr(ty.def_id, sym.allow_unrooted_interior) {
|
||||||
false
|
false
|
||||||
} else {
|
} else {
|
||||||
true
|
// If this is a projection (i.e. Self::FOO), recursing will
|
||||||
|
// make us consider Self, which is overly conservative for
|
||||||
|
// this analysys.
|
||||||
|
*kind != ty::AliasTyKind::Projection
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => true,
|
_ => true,
|
||||||
|
|
25
support/crown/tests/run-pass/alias-projection-ignored.rs
Normal file
25
support/crown/tests/run-pass/alias-projection-ignored.rs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
//@rustc-env:RUSTC_BOOTSTRAP=1
|
||||||
|
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
|
|
||||||
|
struct CanvasId(u64);
|
||||||
|
|
||||||
|
trait CanvasContext {
|
||||||
|
type ID;
|
||||||
|
|
||||||
|
fn context_id(&self) -> Self::ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[crown::unrooted_must_root_lint::must_root]
|
||||||
|
struct Context;
|
||||||
|
|
||||||
|
impl CanvasContext for Context {
|
||||||
|
type ID = CanvasId;
|
||||||
|
|
||||||
|
fn context_id(&self) -> Self::ID { CanvasId(0) }
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue