diff options
Diffstat (limited to 'src/librustc/middle/mem_categorization.rs')
| -rw-r--r-- | src/librustc/middle/mem_categorization.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index cd70d8e2b48..302fbd53dd5 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -110,6 +110,8 @@ pub struct Upvar { pub is_unboxed: bool } +impl Copy for Upvar {} + // different kinds of pointers: #[deriving(Clone, PartialEq, Eq, Hash, Show)] pub enum PointerKind { @@ -119,6 +121,8 @@ pub enum PointerKind { UnsafePtr(ast::Mutability) } +impl Copy for PointerKind {} + // We use the term "interior" to mean "something reachable from the // base without a pointer dereference", e.g. a field #[deriving(Clone, PartialEq, Eq, Hash, Show)] @@ -127,18 +131,24 @@ pub enum InteriorKind { InteriorElement(ElementKind), } +impl Copy for InteriorKind {} + #[deriving(Clone, PartialEq, Eq, Hash, Show)] pub enum FieldName { NamedField(ast::Name), PositionalField(uint) } +impl Copy for FieldName {} + #[deriving(Clone, PartialEq, Eq, Hash, Show)] pub enum ElementKind { VecElement, OtherElement, } +impl Copy for ElementKind {} + #[deriving(Clone, PartialEq, Eq, Hash, Show)] pub enum MutabilityCategory { McImmutable, // Immutable. @@ -146,6 +156,8 @@ pub enum MutabilityCategory { McInherited, // Inherited from the fact that owner is mutable. } +impl Copy for MutabilityCategory {} + // A note about the provenance of a `cmt`. This is used for // special-case handling of upvars such as mutability inference. // Upvar categorization can generate a variable number of nested @@ -158,6 +170,8 @@ pub enum Note { NoteNone // Nothing special } +impl Copy for Note {} + // `cmt`: "Category, Mutability, and Type". // // a complete categorization of a value indicating where it originated @@ -191,6 +205,8 @@ pub enum deref_kind { deref_interior(InteriorKind), } +impl Copy for deref_kind {} + // Categorizes a derefable type. Note that we include vectors and strings as // derefable (we model an index as the combination of a deref and then a // pointer adjustment). @@ -261,6 +277,8 @@ pub struct MemCategorizationContext<'t,TYPER:'t> { typer: &'t TYPER } +impl<'t,TYPER:'t> Copy for MemCategorizationContext<'t,TYPER> {} + pub type McResult<T> = Result<T, ()>; /// The `Typer` trait provides the interface for the mem-categorization @@ -1384,6 +1402,8 @@ pub enum InteriorSafety { InteriorSafe } +impl Copy for InteriorSafety {} + pub enum AliasableReason { AliasableBorrowed, AliasableClosure(ast::NodeId), // Aliasable due to capture Fn closure env @@ -1392,6 +1412,8 @@ pub enum AliasableReason { AliasableStaticMut(InteriorSafety), } +impl Copy for AliasableReason {} + impl<'tcx> cmt_<'tcx> { pub fn guarantor(&self) -> cmt<'tcx> { //! Returns `self` after stripping away any owned pointer derefs or |
