aboutsummaryrefslogtreecommitdiff
path: root/src/api_interface_definition.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api_interface_definition.rs')
-rw-r--r--src/api_interface_definition.rs132
1 files changed, 75 insertions, 57 deletions
diff --git a/src/api_interface_definition.rs b/src/api_interface_definition.rs
index 441d3f7..784b7d0 100644
--- a/src/api_interface_definition.rs
+++ b/src/api_interface_definition.rs
@@ -614,12 +614,15 @@ mod tests
{
let mut mock_deserializer = MockDeserializer::new();
- mock_deserializer.expect_de_list().times(1).returning(|_| {
- Ok(vec![
- Feature::new(FeatureKind::Command, "glNewList", None),
- Feature::new(FeatureKind::Command, "glEndList", None),
- ])
- });
+ // SAFETY: No argument lifetime is mistreated
+ unsafe {
+ mock_deserializer.expect_de_list().times(1).returning(|_| {
+ Ok(vec![
+ Feature::new(FeatureKind::Command, "glNewList", None),
+ Feature::new(FeatureKind::Command, "glEndList", None),
+ ])
+ });
+ }
let removal = Removal::deserialize(
&BytesStart::new("remove").with_attributes([
@@ -648,27 +651,36 @@ mod tests
{
let mut mock_deserializer = MockDeserializer::new();
- mock_deserializer.expect_de_list().times(1).returning(|_| {
- Ok(vec![
- Feature::new(FeatureKind::Command, "glNewList", None),
- Feature::new(FeatureKind::Command, "glEndList", None),
- ])
- });
-
- mock_deserializer.expect_de_list().times(1).returning(|_| {
- Ok(vec![
- Feature::new(FeatureKind::Enum, "GL_COLOR_TABLE", None),
- Feature::new(FeatureKind::Enum, "GL_MINMAX", None),
- Feature::new(FeatureKind::Enum, "GL_HISTOGRAM", None),
- ])
- });
-
- mock_deserializer.expect_de_list().times(1).returning(|_| {
- Ok(vec![
- Feature::new(FeatureKind::Enum, "GL_STACK_UNDERFLOW", None),
- Feature::new(FeatureKind::Enum, "GL_STACK_OVERFLOW", None),
- ])
- });
+ // SAFETY: No argument lifetime is mistreated
+ unsafe {
+ mock_deserializer.expect_de_list().times(1).returning(|_| {
+ Ok(vec![
+ Feature::new(FeatureKind::Command, "glNewList", None),
+ Feature::new(FeatureKind::Command, "glEndList", None),
+ ])
+ });
+ }
+
+ // SAFETY: No argument lifetime is mistreated
+ unsafe {
+ mock_deserializer.expect_de_list().times(1).returning(|_| {
+ Ok(vec![
+ Feature::new(FeatureKind::Enum, "GL_COLOR_TABLE", None),
+ Feature::new(FeatureKind::Enum, "GL_MINMAX", None),
+ Feature::new(FeatureKind::Enum, "GL_HISTOGRAM", None),
+ ])
+ });
+ }
+
+ // SAFETY: No argument lifetime is mistreated
+ unsafe {
+ mock_deserializer.expect_de_list().times(1).returning(|_| {
+ Ok(vec![
+ Feature::new(FeatureKind::Enum, "GL_STACK_UNDERFLOW", None),
+ Feature::new(FeatureKind::Enum, "GL_STACK_OVERFLOW", None),
+ ])
+ });
+ }
let requirement =
Requirement::deserialize(&BytesStart::new("require"), &mut mock_deserializer)
@@ -722,37 +734,43 @@ mod tests
{
let mut mock_deserializer = MockDeserializer::new();
- mock_deserializer
- .expect_de_tag_list()
- .times(1)
- .returning(|_, _| {
- Ok(vec![
- Requirement::new(
- None,
- None,
- vec![
- Feature::new(FeatureKind::Command, "glFenceSync", None),
- Feature::new(FeatureKind::Enum, "GL_WAIT_FAILED", None),
- ],
- ),
- Requirement::new(
- None,
- Some("Reuse ARB_sync".to_string()),
- [Feature::new(FeatureKind::Enum, "GL_OBJECT_TYPE", None)],
- ),
- ])
- });
+ // SAFETY: No argument lifetime is mistreated
+ unsafe {
+ mock_deserializer
+ .expect_de_tag_list()
+ .times(1)
+ .returning(|_, _| {
+ Ok(vec![
+ Requirement::new(
+ None,
+ None,
+ vec![
+ Feature::new(FeatureKind::Command, "glFenceSync", None),
+ Feature::new(FeatureKind::Enum, "GL_WAIT_FAILED", None),
+ ],
+ ),
+ Requirement::new(
+ None,
+ Some("Reuse ARB_sync".to_string()),
+ [Feature::new(FeatureKind::Enum, "GL_OBJECT_TYPE", None)],
+ ),
+ ])
+ });
+ }
- mock_deserializer
- .expect_de_tag_list()
- .times(1)
- .returning(|_, _| {
- Ok(vec![Removal::new(
- "core",
- "Compatibility-only GL 1.0 features removed from GL 3.2",
- vec![Feature::new(FeatureKind::Command, "glBegin", None)],
- )])
- });
+ // SAFETY: No argument lifetime is mistreated
+ unsafe {
+ mock_deserializer
+ .expect_de_tag_list()
+ .times(1)
+ .returning(|_, _| {
+ Ok(vec![Removal::new(
+ "core",
+ "Compatibility-only GL 1.0 features removed from GL 3.2",
+ vec![Feature::new(FeatureKind::Command, "glBegin", None)],
+ )])
+ });
+ }
let api_interface_definition = APIInterfaceDefinition::deserialize(
&BytesStart::new("feature").with_attributes([