From ab90c718ebc39fe94166bca8061be578edf53c18 Mon Sep 17 00:00:00 2001 From: Tetsuharu OHZEKI Date: Thu, 16 Oct 2014 10:48:23 +0900 Subject: [PATCH] Add the comment about to use `mem::transmute()` for values contained in DOMRefCell. --- components/script/dom/element.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index d9f995720a8..fab5feff560 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -1084,11 +1084,13 @@ impl<'a> VirtualMethods for JSRef<'a, Element> { impl<'a> style::TElement<'a> for JSRef<'a, Element> { fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str> { self.get_attribute(namespace.clone(), attr).root().map(|attr| { + // This transmute is used to cheat the lifetime restriction. unsafe { mem::transmute(attr.value().as_slice()) } }) } fn get_attrs(self, attr: &Atom) -> Vec<&'a str> { self.get_attributes(attr).iter().map(|attr| attr.root()).map(|attr| { + // This transmute is used to cheat the lifetime restriction. unsafe { mem::transmute(attr.value().as_slice()) } }).collect() }