diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /servo/tests/unit/malloc_size_of | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/tests/unit/malloc_size_of')
-rw-r--r-- | servo/tests/unit/malloc_size_of/Cargo.toml | 13 | ||||
-rw-r--r-- | servo/tests/unit/malloc_size_of/lib.rs | 109 |
2 files changed, 122 insertions, 0 deletions
diff --git a/servo/tests/unit/malloc_size_of/Cargo.toml b/servo/tests/unit/malloc_size_of/Cargo.toml new file mode 100644 index 0000000000..80668d5ba6 --- /dev/null +++ b/servo/tests/unit/malloc_size_of/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "malloc_size_of_tests" +version = "0.0.1" +authors = ["The Servo Project Developers"] +license = "MPL-2.0" + +[lib] +path = "lib.rs" +test = false + +[dependencies] +malloc_size_of = {path = "../../../components/malloc_size_of"} +servo_arc = {path = "../../../components/servo_arc"} 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() {} +} |