Skip to content

Commit

Permalink
Add back deprecated public field access to VarDefInfo.
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed Oct 31, 2023
1 parent bc15341 commit 5abe732
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions src/types/var_def.rs
Expand Up @@ -7,15 +7,48 @@ use std::prelude::v1::*;
#[derive(Debug, Clone, Hash)]
pub struct VarDefInfo<'a> {
/// Name of the variable to be defined.
name: &'a str,
///
/// # Deprecated API
///
/// [`VarDefInfo`] fields will be private in the next major version. Use `name()` instead.
#[deprecated(
since = "1.16.0",
note = "`VarDefInfo` fields will be private in the next major version. Use `name()` instead."
)]
pub name: &'a str,
/// `true` if the statement is `const`, otherwise it is `let`.
is_const: bool,
///
/// # Deprecated API
///
/// [`VarDefInfo`] fields will be private in the next major version. Use `is_const()` instead.
#[deprecated(
since = "1.16.0",
note = "`VarDefInfo` fields will be private in the next major version. Use `is_const()` instead."
)]
pub is_const: bool,
/// The current nesting level, with zero being the global level.
nesting_level: usize,
///
/// # Deprecated API
///
/// [`VarDefInfo`] fields will be private in the next major version. Use `nesting_level()` instead.
#[deprecated(
since = "1.16.0",
note = "`VarDefInfo` fields will be private in the next major version. Use `nesting_level()` instead."
)]
pub nesting_level: usize,
/// Will the variable _shadow_ an existing variable?
will_shadow: bool,
///
/// # Deprecated API
///
/// [`VarDefInfo`] fields will be private in the next major version. Use `will_shadow_other_variables()` instead.
#[deprecated(
since = "1.16.0",
note = "`VarDefInfo` fields will be private in the next major version. Use `will_shadow_other_variables()` instead."
)]
pub will_shadow: bool,
}

#[allow(deprecated)]
impl<'a> VarDefInfo<'a> {
/// Create a new [`VarDefInfo`].
#[inline(always)]
Expand Down

0 comments on commit 5abe732

Please sign in to comment.