From 2a57bd9d2583d6c237a1874165c3ef744aa5ad99 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 3 May 2022 21:55:08 +0800 Subject: [PATCH] Mark some types as non_exhaustive. --- CHANGELOG.md | 5 +++-- src/ast/flags.rs | 1 + src/module/mod.rs | 2 ++ src/optimizer.rs | 1 + src/types/dynamic.rs | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28e36210..d1cf25db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,11 +15,12 @@ Script-breaking changes * _Strict Variables Mode_ no longer returns an error when an undeclared variable matches a variable/constant in the provided external `Scope`. -Changes to unstable API's -------------------------- +Potentially breaking API changes +-------------------------------- * The `Engine::on_var` and `Engine::on_parse_token` API's are now marked unstable/volatile. * The closures passed to `Engine::on_var`, `Engine::on_def_var` and `Engine::register_debugger` take `EvalContext` instead of `&EvalContext` or `&mut EvalContext`. +* The following enum's are marked `non_exhaustive`: `AccessMode`, `FnAccess`, `FnNamespace`, `FnMetadata`, `OptimizationLevel` New API ------- diff --git a/src/ast/flags.rs b/src/ast/flags.rs index 6d2506ba..34a3bbaa 100644 --- a/src/ast/flags.rs +++ b/src/ast/flags.rs @@ -6,6 +6,7 @@ use std::prelude::v1::*; /// A type representing the access mode of a function. #[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[non_exhaustive] pub enum FnAccess { /// Private function. Private, diff --git a/src/module/mod.rs b/src/module/mod.rs index ea9b7ebe..5ad8e48e 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -23,6 +23,7 @@ use std::{ /// A type representing the namespace of a function. #[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[non_exhaustive] pub enum FnNamespace { /// Module namespace only. /// @@ -34,6 +35,7 @@ pub enum FnNamespace { /// A type containing all metadata for a registered function. #[derive(Debug, Clone, Eq, PartialEq, Hash)] +#[non_exhaustive] pub struct FnMetadata { /// Function namespace. pub namespace: FnNamespace, diff --git a/src/optimizer.rs b/src/optimizer.rs index f18b295b..69731719 100644 --- a/src/optimizer.rs +++ b/src/optimizer.rs @@ -23,6 +23,7 @@ use std::{ /// Level of optimization performed. #[derive(Debug, Eq, PartialEq, Hash, Clone, Copy)] +#[non_exhaustive] pub enum OptimizationLevel { /// No optimization performed. None, diff --git a/src/types/dynamic.rs b/src/types/dynamic.rs index 792d008b..0b5e891c 100644 --- a/src/types/dynamic.rs +++ b/src/types/dynamic.rs @@ -127,6 +127,7 @@ impl dyn Variant { /// _(internals)_ Modes of access. /// Exported under the `internals` feature only. #[derive(Debug, Eq, PartialEq, Hash, Copy, Clone)] +#[non_exhaustive] pub enum AccessMode { /// Mutable. ReadWrite,