mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Annotate 'inline' to TCast::to/to_unchecked/from.
This commit is contained in:
parent
de67069b0a
commit
cfb2af60d8
1 changed files with 3 additions and 0 deletions
|
@ -5745,10 +5745,12 @@ class GlobalGenRoots():
|
||||||
derived += [CGGeneric('\n')]
|
derived += [CGGeneric('\n')]
|
||||||
|
|
||||||
cast = [CGGeneric(string.Template('''pub trait ${castTraitName} {
|
cast = [CGGeneric(string.Template('''pub trait ${castTraitName} {
|
||||||
|
#[inline(always)]
|
||||||
fn from<T: ${fromBound}>(derived: &JS<T>) -> JS<Self> {
|
fn from<T: ${fromBound}>(derived: &JS<T>) -> JS<Self> {
|
||||||
unsafe { derived.clone().transmute() }
|
unsafe { derived.clone().transmute() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
fn to<T: ${toBound}>(base: &JS<T>) -> Option<JS<Self>> {
|
fn to<T: ${toBound}>(base: &JS<T>) -> Option<JS<Self>> {
|
||||||
match base.get().${checkFn}() {
|
match base.get().${checkFn}() {
|
||||||
true => unsafe { Some(base.clone().transmute()) },
|
true => unsafe { Some(base.clone().transmute()) },
|
||||||
|
@ -5756,6 +5758,7 @@ class GlobalGenRoots():
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
unsafe fn to_unchecked<T: ${toBound}>(base: &JS<T>) -> JS<Self> {
|
unsafe fn to_unchecked<T: ${toBound}>(base: &JS<T>) -> JS<Self> {
|
||||||
assert!(base.get().${checkFn}());
|
assert!(base.get().${checkFn}());
|
||||||
base.clone().transmute()
|
base.clone().transmute()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue