summaryrefslogtreecommitdiffstats
path: root/servo/tests/unit/malloc_size_of/lib.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /servo/tests/unit/malloc_size_of/lib.rs
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/tests/unit/malloc_size_of/lib.rs')
-rw-r--r--servo/tests/unit/malloc_size_of/lib.rs109
1 files changed, 109 insertions, 0 deletions
diff --git a/servo/tests/unit/malloc_size_of/lib.rs b/servo/tests/unit/malloc_size_of/lib.rs
new file mode 100644
index 0000000000..75ad4d9413
--- /dev/null
+++ b/servo/tests/unit/malloc_size_of/lib.rs
@@ -0,0 +1,109 @@
+/* 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/. */
+
+/**
+```
+extern crate malloc_size_of;
+extern crate servo_arc;
+
+fn sizeable<T: malloc_size_of::MallocSizeOf>() {}
+fn shallow_sizeable<T: malloc_size_of::MallocShallowSizeOf>() {}
+fn cloneable<T: Clone>() {}
+
+fn main() {
+ cloneable::<servo_arc::Arc<i32>>();
+ cloneable::<std::sync::Arc<i32>>();
+ cloneable::<std::rc::Rc<i32>>();
+}
+```
+*/
+pub fn imports_ok() {}
+
+pub mod does_not_impl_malloc_size_of {
+ /**
+ ```compile_fail,E0277
+ extern crate malloc_size_of;
+ extern crate servo_arc;
+
+ fn sizeable<T: malloc_size_of::MallocSizeOf>() {}
+
+ fn main() {
+ sizeable::<servo_arc::Arc<i32>>();
+ }
+ ```
+ */
+ pub fn servo_arc() {}
+
+
+ /**
+ ```compile_fail,E0277
+ extern crate malloc_size_of;
+
+ fn sizeable<T: malloc_size_of::MallocSizeOf>() {}
+
+ fn main() {
+ sizeable::<std::sync::Arc<i32>>();
+ }
+ ```
+ */
+ pub fn std_arc() {}
+
+
+ /**
+ ```compile_fail,E0277
+ extern crate malloc_size_of;
+
+ fn sizeable<T: malloc_size_of::MallocSizeOf>() {}
+
+ fn main() {
+ sizeable::<std::rc::Rc<i32>>();
+ }
+ ```
+ */
+ pub fn rc() {}
+}
+
+pub mod does_not_impl_malloc_shallow_size_of {
+ /**
+ ```compile_fail,E0277
+ extern crate malloc_size_of;
+ extern crate servo_arc;
+
+ fn shallow_sizeable<T: malloc_size_of::MallocShallowSizeOf>() {}
+
+ fn main() {
+ shallow_sizeable::<servo_arc::Arc<i32>>();
+ }
+ ```
+ */
+ pub fn servo_arc() {}
+
+
+ /**
+ ```compile_fail,E0277
+ extern crate malloc_size_of;
+
+ fn shallow_sizeable<T: malloc_size_of::MallocShallowSizeOf>() {}
+
+ fn main() {
+ shallow_sizeable::<std::sync::Arc<i32>>();
+ }
+ ```
+ */
+ pub fn std_arc() {}
+
+
+ /**
+ ```compile_fail,E0277
+ extern crate malloc_size_of;
+
+ fn shallow_sizeable<T: malloc_size_of::MallocShallowSizeOf>() {}
+
+ fn main() {
+ shallow_sizeable::<std::rc::Rc<i32>>();
+ }
+ ```
+ */
+ pub fn rc() {}
+}