librustc: use #[deriving(Copy)]
This commit is contained in:
parent
f2ef2cda52
commit
e64a0072d6
36 changed files with 159 additions and 426 deletions
|
@ -56,10 +56,9 @@ declare_lint! {
|
||||||
"suggest using `loop { }` instead of `while true { }`"
|
"suggest using `loop { }` instead of `while true { }`"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct WhileTrue;
|
pub struct WhileTrue;
|
||||||
|
|
||||||
impl Copy for WhileTrue {}
|
|
||||||
|
|
||||||
impl LintPass for WhileTrue {
|
impl LintPass for WhileTrue {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(WHILE_TRUE)
|
lint_array!(WHILE_TRUE)
|
||||||
|
@ -83,10 +82,9 @@ declare_lint! {
|
||||||
"detects unnecessary type casts that can be removed"
|
"detects unnecessary type casts that can be removed"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct UnusedCasts;
|
pub struct UnusedCasts;
|
||||||
|
|
||||||
impl Copy for UnusedCasts {}
|
|
||||||
|
|
||||||
impl LintPass for UnusedCasts {
|
impl LintPass for UnusedCasts {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(UNUSED_TYPECASTS)
|
lint_array!(UNUSED_TYPECASTS)
|
||||||
|
@ -126,13 +124,12 @@ declare_lint! {
|
||||||
"shift exceeds the type's number of bits"
|
"shift exceeds the type's number of bits"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct TypeLimits {
|
pub struct TypeLimits {
|
||||||
/// Id of the last visited negated expression
|
/// Id of the last visited negated expression
|
||||||
negated_expr_id: ast::NodeId,
|
negated_expr_id: ast::NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for TypeLimits {}
|
|
||||||
|
|
||||||
impl TypeLimits {
|
impl TypeLimits {
|
||||||
pub fn new() -> TypeLimits {
|
pub fn new() -> TypeLimits {
|
||||||
TypeLimits {
|
TypeLimits {
|
||||||
|
@ -442,10 +439,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ImproperCTypesVisitor<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct ImproperCTypes;
|
pub struct ImproperCTypes;
|
||||||
|
|
||||||
impl Copy for ImproperCTypes {}
|
|
||||||
|
|
||||||
impl LintPass for ImproperCTypes {
|
impl LintPass for ImproperCTypes {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(IMPROPER_CTYPES)
|
lint_array!(IMPROPER_CTYPES)
|
||||||
|
@ -486,10 +482,9 @@ declare_lint! {
|
||||||
"use of owned (Box type) heap memory"
|
"use of owned (Box type) heap memory"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct BoxPointers;
|
pub struct BoxPointers;
|
||||||
|
|
||||||
impl Copy for BoxPointers {}
|
|
||||||
|
|
||||||
impl BoxPointers {
|
impl BoxPointers {
|
||||||
fn check_heap_type<'a, 'tcx>(&self, cx: &Context<'a, 'tcx>,
|
fn check_heap_type<'a, 'tcx>(&self, cx: &Context<'a, 'tcx>,
|
||||||
span: Span, ty: Ty<'tcx>) {
|
span: Span, ty: Ty<'tcx>) {
|
||||||
|
@ -627,10 +622,9 @@ declare_lint! {
|
||||||
"detects attributes that were not used by the compiler"
|
"detects attributes that were not used by the compiler"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct UnusedAttributes;
|
pub struct UnusedAttributes;
|
||||||
|
|
||||||
impl Copy for UnusedAttributes {}
|
|
||||||
|
|
||||||
impl LintPass for UnusedAttributes {
|
impl LintPass for UnusedAttributes {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(UNUSED_ATTRIBUTES)
|
lint_array!(UNUSED_ATTRIBUTES)
|
||||||
|
@ -711,10 +705,9 @@ declare_lint! {
|
||||||
"path statements with no effect"
|
"path statements with no effect"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct PathStatements;
|
pub struct PathStatements;
|
||||||
|
|
||||||
impl Copy for PathStatements {}
|
|
||||||
|
|
||||||
impl LintPass for PathStatements {
|
impl LintPass for PathStatements {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(PATH_STATEMENTS)
|
lint_array!(PATH_STATEMENTS)
|
||||||
|
@ -746,10 +739,9 @@ declare_lint! {
|
||||||
"unused result of an expression in a statement"
|
"unused result of an expression in a statement"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct UnusedResults;
|
pub struct UnusedResults;
|
||||||
|
|
||||||
impl Copy for UnusedResults {}
|
|
||||||
|
|
||||||
impl LintPass for UnusedResults {
|
impl LintPass for UnusedResults {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(UNUSED_MUST_USE, UNUSED_RESULTS)
|
lint_array!(UNUSED_MUST_USE, UNUSED_RESULTS)
|
||||||
|
@ -815,10 +807,9 @@ declare_lint! {
|
||||||
"types, variants, traits and type parameters should have camel case names"
|
"types, variants, traits and type parameters should have camel case names"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct NonCamelCaseTypes;
|
pub struct NonCamelCaseTypes;
|
||||||
|
|
||||||
impl Copy for NonCamelCaseTypes {}
|
|
||||||
|
|
||||||
impl NonCamelCaseTypes {
|
impl NonCamelCaseTypes {
|
||||||
fn check_case(&self, cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
|
fn check_case(&self, cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
|
||||||
fn is_camel_case(ident: ast::Ident) -> bool {
|
fn is_camel_case(ident: ast::Ident) -> bool {
|
||||||
|
@ -939,10 +930,9 @@ declare_lint! {
|
||||||
"methods, functions, lifetime parameters and modules should have snake case names"
|
"methods, functions, lifetime parameters and modules should have snake case names"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct NonSnakeCase;
|
pub struct NonSnakeCase;
|
||||||
|
|
||||||
impl Copy for NonSnakeCase {}
|
|
||||||
|
|
||||||
impl NonSnakeCase {
|
impl NonSnakeCase {
|
||||||
fn check_snake_case(&self, cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
|
fn check_snake_case(&self, cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
|
||||||
fn is_snake_case(ident: ast::Ident) -> bool {
|
fn is_snake_case(ident: ast::Ident) -> bool {
|
||||||
|
@ -1053,10 +1043,9 @@ declare_lint! {
|
||||||
"static constants should have uppercase identifiers"
|
"static constants should have uppercase identifiers"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct NonUpperCaseGlobals;
|
pub struct NonUpperCaseGlobals;
|
||||||
|
|
||||||
impl Copy for NonUpperCaseGlobals {}
|
|
||||||
|
|
||||||
impl LintPass for NonUpperCaseGlobals {
|
impl LintPass for NonUpperCaseGlobals {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(NON_UPPER_CASE_GLOBALS)
|
lint_array!(NON_UPPER_CASE_GLOBALS)
|
||||||
|
@ -1107,10 +1096,9 @@ declare_lint! {
|
||||||
"`if`, `match`, `while` and `return` do not need parentheses"
|
"`if`, `match`, `while` and `return` do not need parentheses"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct UnusedParens;
|
pub struct UnusedParens;
|
||||||
|
|
||||||
impl Copy for UnusedParens {}
|
|
||||||
|
|
||||||
impl UnusedParens {
|
impl UnusedParens {
|
||||||
fn check_unused_parens_core(&self, cx: &Context, value: &ast::Expr, msg: &str,
|
fn check_unused_parens_core(&self, cx: &Context, value: &ast::Expr, msg: &str,
|
||||||
struct_lit_needs_parens: bool) {
|
struct_lit_needs_parens: bool) {
|
||||||
|
@ -1202,10 +1190,9 @@ declare_lint! {
|
||||||
"unnecessary braces around an imported item"
|
"unnecessary braces around an imported item"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct UnusedImportBraces;
|
pub struct UnusedImportBraces;
|
||||||
|
|
||||||
impl Copy for UnusedImportBraces {}
|
|
||||||
|
|
||||||
impl LintPass for UnusedImportBraces {
|
impl LintPass for UnusedImportBraces {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(UNUSED_IMPORT_BRACES)
|
lint_array!(UNUSED_IMPORT_BRACES)
|
||||||
|
@ -1242,10 +1229,9 @@ declare_lint! {
|
||||||
"using `Struct { x: x }` instead of `Struct { x }`"
|
"using `Struct { x: x }` instead of `Struct { x }`"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct NonShorthandFieldPatterns;
|
pub struct NonShorthandFieldPatterns;
|
||||||
|
|
||||||
impl Copy for NonShorthandFieldPatterns {}
|
|
||||||
|
|
||||||
impl LintPass for NonShorthandFieldPatterns {
|
impl LintPass for NonShorthandFieldPatterns {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(NON_SHORTHAND_FIELD_PATTERNS)
|
lint_array!(NON_SHORTHAND_FIELD_PATTERNS)
|
||||||
|
@ -1276,10 +1262,9 @@ declare_lint! {
|
||||||
"unnecessary use of an `unsafe` block"
|
"unnecessary use of an `unsafe` block"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct UnusedUnsafe;
|
pub struct UnusedUnsafe;
|
||||||
|
|
||||||
impl Copy for UnusedUnsafe {}
|
|
||||||
|
|
||||||
impl LintPass for UnusedUnsafe {
|
impl LintPass for UnusedUnsafe {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(UNUSED_UNSAFE)
|
lint_array!(UNUSED_UNSAFE)
|
||||||
|
@ -1302,10 +1287,9 @@ declare_lint! {
|
||||||
"usage of an `unsafe` block"
|
"usage of an `unsafe` block"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct UnsafeBlocks;
|
pub struct UnsafeBlocks;
|
||||||
|
|
||||||
impl Copy for UnsafeBlocks {}
|
|
||||||
|
|
||||||
impl LintPass for UnsafeBlocks {
|
impl LintPass for UnsafeBlocks {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(UNSAFE_BLOCKS)
|
lint_array!(UNSAFE_BLOCKS)
|
||||||
|
@ -1327,10 +1311,9 @@ declare_lint! {
|
||||||
"detect mut variables which don't need to be mutable"
|
"detect mut variables which don't need to be mutable"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct UnusedMut;
|
pub struct UnusedMut;
|
||||||
|
|
||||||
impl Copy for UnusedMut {}
|
|
||||||
|
|
||||||
impl UnusedMut {
|
impl UnusedMut {
|
||||||
fn check_unused_mut_pat(&self, cx: &Context, pats: &[P<ast::Pat>]) {
|
fn check_unused_mut_pat(&self, cx: &Context, pats: &[P<ast::Pat>]) {
|
||||||
// collect all mutable pattern and group their NodeIDs by their Identifier to
|
// collect all mutable pattern and group their NodeIDs by their Identifier to
|
||||||
|
@ -1397,10 +1380,9 @@ declare_lint! {
|
||||||
"detects unnecessary allocations that can be eliminated"
|
"detects unnecessary allocations that can be eliminated"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct UnusedAllocation;
|
pub struct UnusedAllocation;
|
||||||
|
|
||||||
impl Copy for UnusedAllocation {}
|
|
||||||
|
|
||||||
impl LintPass for UnusedAllocation {
|
impl LintPass for UnusedAllocation {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(UNUSED_ALLOCATION)
|
lint_array!(UNUSED_ALLOCATION)
|
||||||
|
@ -1589,10 +1571,9 @@ impl LintPass for MissingDoc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct MissingCopyImplementations;
|
pub struct MissingCopyImplementations;
|
||||||
|
|
||||||
impl Copy for MissingCopyImplementations {}
|
|
||||||
|
|
||||||
impl LintPass for MissingCopyImplementations {
|
impl LintPass for MissingCopyImplementations {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(MISSING_COPY_IMPLEMENTATIONS)
|
lint_array!(MISSING_COPY_IMPLEMENTATIONS)
|
||||||
|
@ -1665,10 +1646,9 @@ declare_lint! {
|
||||||
|
|
||||||
/// Checks for use of items with `#[deprecated]`, `#[experimental]` and
|
/// Checks for use of items with `#[deprecated]`, `#[experimental]` and
|
||||||
/// `#[unstable]` attributes, or no stability attribute.
|
/// `#[unstable]` attributes, or no stability attribute.
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct Stability;
|
pub struct Stability;
|
||||||
|
|
||||||
impl Copy for Stability {}
|
|
||||||
|
|
||||||
impl Stability {
|
impl Stability {
|
||||||
fn lint(&self, cx: &Context, id: ast::DefId, span: Span) {
|
fn lint(&self, cx: &Context, id: ast::DefId, span: Span) {
|
||||||
let stability = stability::lookup(cx.tcx, id);
|
let stability = stability::lookup(cx.tcx, id);
|
||||||
|
@ -1903,10 +1883,9 @@ declare_lint!{
|
||||||
|
|
||||||
/// Does nothing as a lint pass, but registers some `Lint`s
|
/// Does nothing as a lint pass, but registers some `Lint`s
|
||||||
/// which are used by other parts of the compiler.
|
/// which are used by other parts of the compiler.
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct HardwiredLints;
|
pub struct HardwiredLints;
|
||||||
|
|
||||||
impl Copy for HardwiredLints {}
|
|
||||||
|
|
||||||
impl LintPass for HardwiredLints {
|
impl LintPass for HardwiredLints {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(
|
lint_array!(
|
||||||
|
|
|
@ -42,6 +42,7 @@ use syntax::ast;
|
||||||
pub use lint::context::{Context, LintStore, raw_emit_lint, check_crate, gather_attrs};
|
pub use lint::context::{Context, LintStore, raw_emit_lint, check_crate, gather_attrs};
|
||||||
|
|
||||||
/// Specification of a single lint.
|
/// Specification of a single lint.
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct Lint {
|
pub struct Lint {
|
||||||
/// A string identifier for the lint.
|
/// A string identifier for the lint.
|
||||||
///
|
///
|
||||||
|
@ -64,8 +65,6 @@ pub struct Lint {
|
||||||
pub desc: &'static str,
|
pub desc: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Lint {}
|
|
||||||
|
|
||||||
impl Lint {
|
impl Lint {
|
||||||
/// Get the lint's name, with ASCII letters converted to lowercase.
|
/// Get the lint's name, with ASCII letters converted to lowercase.
|
||||||
pub fn name_lower(&self) -> String {
|
pub fn name_lower(&self) -> String {
|
||||||
|
@ -175,14 +174,12 @@ pub trait LintPass {
|
||||||
pub type LintPassObject = Box<LintPass + 'static>;
|
pub type LintPassObject = Box<LintPass + 'static>;
|
||||||
|
|
||||||
/// Identifies a lint known to the compiler.
|
/// Identifies a lint known to the compiler.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone, Copy)]
|
||||||
pub struct LintId {
|
pub struct LintId {
|
||||||
// Identity is based on pointer equality of this field.
|
// Identity is based on pointer equality of this field.
|
||||||
lint: &'static Lint,
|
lint: &'static Lint,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for LintId {}
|
|
||||||
|
|
||||||
impl PartialEq for LintId {
|
impl PartialEq for LintId {
|
||||||
fn eq(&self, other: &LintId) -> bool {
|
fn eq(&self, other: &LintId) -> bool {
|
||||||
(self.lint as *const Lint) == (other.lint as *const Lint)
|
(self.lint as *const Lint) == (other.lint as *const Lint)
|
||||||
|
@ -213,13 +210,11 @@ impl LintId {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Setting for how to handle a lint.
|
/// Setting for how to handle a lint.
|
||||||
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord)]
|
#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord)]
|
||||||
pub enum Level {
|
pub enum Level {
|
||||||
Allow, Warn, Deny, Forbid
|
Allow, Warn, Deny, Forbid
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Level {}
|
|
||||||
|
|
||||||
impl Level {
|
impl Level {
|
||||||
/// Convert a level to a lower-case string.
|
/// Convert a level to a lower-case string.
|
||||||
pub fn as_str(self) -> &'static str {
|
pub fn as_str(self) -> &'static str {
|
||||||
|
@ -244,7 +239,7 @@ impl Level {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// How a lint level was set.
|
/// How a lint level was set.
|
||||||
#[deriving(Clone, PartialEq, Eq)]
|
#[deriving(Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum LintSource {
|
pub enum LintSource {
|
||||||
/// Lint is at the default level as declared
|
/// Lint is at the default level as declared
|
||||||
/// in rustc or a plugin.
|
/// in rustc or a plugin.
|
||||||
|
@ -257,8 +252,6 @@ pub enum LintSource {
|
||||||
CommandLine,
|
CommandLine,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for LintSource {}
|
|
||||||
|
|
||||||
pub type LevelSource = (Level, LintSource);
|
pub type LevelSource = (Level, LintSource);
|
||||||
|
|
||||||
pub mod builtin;
|
pub mod builtin;
|
||||||
|
|
|
@ -113,7 +113,7 @@ pub const tag_items_data_item_reexport_def_id: uint = 0x39;
|
||||||
pub const tag_items_data_item_reexport_name: uint = 0x3a;
|
pub const tag_items_data_item_reexport_name: uint = 0x3a;
|
||||||
|
|
||||||
// used to encode crate_ctxt side tables
|
// used to encode crate_ctxt side tables
|
||||||
#[deriving(PartialEq)]
|
#[deriving(Copy, PartialEq)]
|
||||||
#[repr(uint)]
|
#[repr(uint)]
|
||||||
pub enum astencode_tag { // Reserves 0x40 -- 0x5f
|
pub enum astencode_tag { // Reserves 0x40 -- 0x5f
|
||||||
tag_ast = 0x40,
|
tag_ast = 0x40,
|
||||||
|
@ -145,7 +145,6 @@ pub enum astencode_tag { // Reserves 0x40 -- 0x5f
|
||||||
tag_table_object_cast_map = 0x57,
|
tag_table_object_cast_map = 0x57,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for astencode_tag {}
|
|
||||||
static first_astencode_tag: uint = tag_ast as uint;
|
static first_astencode_tag: uint = tag_ast as uint;
|
||||||
static last_astencode_tag: uint = tag_table_object_cast_map as uint;
|
static last_astencode_tag: uint = tag_table_object_cast_map as uint;
|
||||||
impl astencode_tag {
|
impl astencode_tag {
|
||||||
|
|
|
@ -33,14 +33,13 @@ use syntax::parse::token;
|
||||||
|
|
||||||
use std::collections::hash_map::HashMap;
|
use std::collections::hash_map::HashMap;
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct MethodInfo {
|
pub struct MethodInfo {
|
||||||
pub name: ast::Name,
|
pub name: ast::Name,
|
||||||
pub def_id: ast::DefId,
|
pub def_id: ast::DefId,
|
||||||
pub vis: ast::Visibility,
|
pub vis: ast::Visibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for MethodInfo {}
|
|
||||||
|
|
||||||
pub fn get_symbol(cstore: &cstore::CStore, def: ast::DefId) -> String {
|
pub fn get_symbol(cstore: &cstore::CStore, def: ast::DefId) -> String {
|
||||||
let cdata = cstore.get_crate_data(def.krate);
|
let cdata = cstore.get_crate_data(def.krate);
|
||||||
decoder::get_symbol(cdata.data(), def.node)
|
decoder::get_symbol(cdata.data(), def.node)
|
||||||
|
|
|
@ -48,23 +48,19 @@ pub struct crate_metadata {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Show, PartialEq, Clone)]
|
#[deriving(Copy, Show, PartialEq, Clone)]
|
||||||
pub enum LinkagePreference {
|
pub enum LinkagePreference {
|
||||||
RequireDynamic,
|
RequireDynamic,
|
||||||
RequireStatic,
|
RequireStatic,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for LinkagePreference {}
|
#[deriving(Copy, Clone, PartialEq, FromPrimitive)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, FromPrimitive)]
|
|
||||||
pub enum NativeLibraryKind {
|
pub enum NativeLibraryKind {
|
||||||
NativeStatic, // native static library (.a archive)
|
NativeStatic, // native static library (.a archive)
|
||||||
NativeFramework, // OSX-specific
|
NativeFramework, // OSX-specific
|
||||||
NativeUnknown, // default way to specify a dynamic library
|
NativeUnknown, // default way to specify a dynamic library
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for NativeLibraryKind {}
|
|
||||||
|
|
||||||
// Where a crate came from on the local filesystem. One of these two options
|
// Where a crate came from on the local filesystem. One of these two options
|
||||||
// must be non-None.
|
// must be non-None.
|
||||||
#[deriving(PartialEq, Clone)]
|
#[deriving(PartialEq, Clone)]
|
||||||
|
|
|
@ -450,15 +450,13 @@ pub fn get_symbol(data: &[u8], id: ast::NodeId) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Something that a name can resolve to.
|
// Something that a name can resolve to.
|
||||||
#[deriving(Clone,Show)]
|
#[deriving(Copy, Clone, Show)]
|
||||||
pub enum DefLike {
|
pub enum DefLike {
|
||||||
DlDef(def::Def),
|
DlDef(def::Def),
|
||||||
DlImpl(ast::DefId),
|
DlImpl(ast::DefId),
|
||||||
DlField
|
DlField
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for DefLike {}
|
|
||||||
|
|
||||||
/// Iterates over the language items in the given crate.
|
/// Iterates over the language items in the given crate.
|
||||||
pub fn each_lang_item<F>(cdata: Cmd, mut f: F) -> bool where
|
pub fn each_lang_item<F>(cdata: Cmd, mut f: F) -> bool where
|
||||||
F: FnMut(ast::NodeId, uint) -> bool,
|
F: FnMut(ast::NodeId, uint) -> bool,
|
||||||
|
|
|
@ -20,13 +20,12 @@ use std::os;
|
||||||
|
|
||||||
use util::fs as myfs;
|
use util::fs as myfs;
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub enum FileMatch {
|
pub enum FileMatch {
|
||||||
FileMatches,
|
FileMatches,
|
||||||
FileDoesntMatch,
|
FileDoesntMatch,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for FileMatch {}
|
|
||||||
|
|
||||||
// A module for searching for libraries
|
// A module for searching for libraries
|
||||||
// FIXME (#2658): I'm not happy how this module turned out. Should
|
// FIXME (#2658): I'm not happy how this module turned out. Should
|
||||||
// probably just be folded into cstore.
|
// probably just be folded into cstore.
|
||||||
|
|
|
@ -44,7 +44,7 @@ use syntax::parse::token;
|
||||||
// def-id will depend on where it originated from. Therefore, the conversion
|
// def-id will depend on where it originated from. Therefore, the conversion
|
||||||
// function is given an indicator of the source of the def-id. See
|
// function is given an indicator of the source of the def-id. See
|
||||||
// astencode.rs for more information.
|
// astencode.rs for more information.
|
||||||
#[deriving(Show)]
|
#[deriving(Copy, Show)]
|
||||||
pub enum DefIdSource {
|
pub enum DefIdSource {
|
||||||
// Identifies a struct, trait, enum, etc.
|
// Identifies a struct, trait, enum, etc.
|
||||||
NominalType,
|
NominalType,
|
||||||
|
@ -62,7 +62,6 @@ pub enum DefIdSource {
|
||||||
UnboxedClosureSource
|
UnboxedClosureSource
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for DefIdSource {}
|
|
||||||
pub type conv_did<'a> =
|
pub type conv_did<'a> =
|
||||||
|source: DefIdSource, ast::DefId|: 'a -> ast::DefId;
|
|source: DefIdSource, ast::DefId|: 'a -> ast::DefId;
|
||||||
|
|
||||||
|
|
|
@ -26,14 +26,13 @@ struct CFGBuilder<'a, 'tcx: 'a> {
|
||||||
loop_scopes: Vec<LoopScope>,
|
loop_scopes: Vec<LoopScope>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
struct LoopScope {
|
struct LoopScope {
|
||||||
loop_id: ast::NodeId, // id of loop/while node
|
loop_id: ast::NodeId, // id of loop/while node
|
||||||
continue_index: CFGIndex, // where to go on a `loop`
|
continue_index: CFGIndex, // where to go on a `loop`
|
||||||
break_index: CFGIndex, // where to go on a `break
|
break_index: CFGIndex, // where to go on a `break
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for LoopScope {}
|
|
||||||
|
|
||||||
pub fn construct(tcx: &ty::ctxt,
|
pub fn construct(tcx: &ty::ctxt,
|
||||||
blk: &ast::Block) -> CFG {
|
blk: &ast::Block) -> CFG {
|
||||||
let mut graph = graph::Graph::new();
|
let mut graph = graph::Graph::new();
|
||||||
|
|
|
@ -26,12 +26,11 @@ pub struct CFG {
|
||||||
pub exit: CFGIndex,
|
pub exit: CFGIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct CFGNodeData {
|
pub struct CFGNodeData {
|
||||||
pub id: ast::NodeId
|
pub id: ast::NodeId
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for CFGNodeData {}
|
|
||||||
|
|
||||||
pub struct CFGEdgeData {
|
pub struct CFGEdgeData {
|
||||||
pub exiting_scopes: Vec<ast::NodeId>
|
pub exiting_scopes: Vec<ast::NodeId>
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,20 +16,17 @@ use syntax::codemap::Span;
|
||||||
use syntax::visit::Visitor;
|
use syntax::visit::Visitor;
|
||||||
use syntax::visit;
|
use syntax::visit;
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq)]
|
#[deriving(Clone, Copy, PartialEq)]
|
||||||
enum Context {
|
enum Context {
|
||||||
Normal, Loop, Closure
|
Normal, Loop, Closure
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Context {}
|
#[deriving(Copy)]
|
||||||
|
|
||||||
struct CheckLoopVisitor<'a> {
|
struct CheckLoopVisitor<'a> {
|
||||||
sess: &'a Session,
|
sess: &'a Session,
|
||||||
cx: Context
|
cx: Context
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Copy for CheckLoopVisitor<'a> {}
|
|
||||||
|
|
||||||
pub fn check_crate(sess: &Session, krate: &ast::Crate) {
|
pub fn check_crate(sess: &Session, krate: &ast::Crate) {
|
||||||
visit::walk_crate(&mut CheckLoopVisitor { sess: sess, cx: Normal }, krate)
|
visit::walk_crate(&mut CheckLoopVisitor { sess: sess, cx: Normal }, krate)
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,13 +127,12 @@ enum Usefulness {
|
||||||
NotUseful
|
NotUseful
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
enum WitnessPreference {
|
enum WitnessPreference {
|
||||||
ConstructWitness,
|
ConstructWitness,
|
||||||
LeaveOutWitness
|
LeaveOutWitness
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for WitnessPreference {}
|
|
||||||
|
|
||||||
impl<'a, 'tcx, 'v> Visitor<'v> for MatchCheckCtxt<'a, 'tcx> {
|
impl<'a, 'tcx, 'v> Visitor<'v> for MatchCheckCtxt<'a, 'tcx> {
|
||||||
fn visit_expr(&mut self, ex: &ast::Expr) {
|
fn visit_expr(&mut self, ex: &ast::Expr) {
|
||||||
check_expr(self, ex);
|
check_expr(self, ex);
|
||||||
|
|
|
@ -39,7 +39,7 @@ use syntax::visit::Visitor;
|
||||||
use syntax::codemap::Span;
|
use syntax::codemap::Span;
|
||||||
use syntax::visit;
|
use syntax::visit;
|
||||||
|
|
||||||
#[deriving(Eq, PartialEq)]
|
#[deriving(Copy, Eq, PartialEq)]
|
||||||
enum Mode {
|
enum Mode {
|
||||||
InConstant,
|
InConstant,
|
||||||
InStatic,
|
InStatic,
|
||||||
|
@ -47,8 +47,6 @@ enum Mode {
|
||||||
InNothing,
|
InNothing,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Mode {}
|
|
||||||
|
|
||||||
struct CheckStaticVisitor<'a, 'tcx: 'a> {
|
struct CheckStaticVisitor<'a, 'tcx: 'a> {
|
||||||
tcx: &'a ty::ctxt<'tcx>,
|
tcx: &'a ty::ctxt<'tcx>,
|
||||||
mode: Mode,
|
mode: Mode,
|
||||||
|
|
|
@ -62,14 +62,13 @@ use std::collections::hash_map::Vacant;
|
||||||
// - Non-constants: everything else.
|
// - Non-constants: everything else.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub enum constness {
|
pub enum constness {
|
||||||
integral_const,
|
integral_const,
|
||||||
general_const,
|
general_const,
|
||||||
non_const
|
non_const
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for constness {}
|
|
||||||
|
|
||||||
type constness_cache = DefIdMap<constness>;
|
type constness_cache = DefIdMap<constness>;
|
||||||
|
|
||||||
pub fn join(a: constness, b: constness) -> constness {
|
pub fn join(a: constness, b: constness) -> constness {
|
||||||
|
|
|
@ -27,14 +27,12 @@ use syntax::visit;
|
||||||
use syntax::print::{pp, pprust};
|
use syntax::print::{pp, pprust};
|
||||||
use util::nodemap::NodeMap;
|
use util::nodemap::NodeMap;
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[deriving(Copy, Show)]
|
||||||
pub enum EntryOrExit {
|
pub enum EntryOrExit {
|
||||||
Entry,
|
Entry,
|
||||||
Exit,
|
Exit,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for EntryOrExit {}
|
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct DataFlowContext<'a, 'tcx: 'a, O> {
|
pub struct DataFlowContext<'a, 'tcx: 'a, O> {
|
||||||
tcx: &'a ty::ctxt<'tcx>,
|
tcx: &'a ty::ctxt<'tcx>,
|
||||||
|
|
|
@ -15,7 +15,7 @@ use middle::subst::ParamSpace;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::ast_util::local_def;
|
use syntax::ast_util::local_def;
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||||
pub enum Def {
|
pub enum Def {
|
||||||
DefFn(ast::DefId, bool /* is_ctor */),
|
DefFn(ast::DefId, bool /* is_ctor */),
|
||||||
DefStaticMethod(/* method */ ast::DefId, MethodProvenance),
|
DefStaticMethod(/* method */ ast::DefId, MethodProvenance),
|
||||||
|
@ -56,15 +56,13 @@ pub enum Def {
|
||||||
DefMethod(ast::DefId /* method */, Option<ast::DefId> /* trait */, MethodProvenance),
|
DefMethod(ast::DefId /* method */, Option<ast::DefId> /* trait */, MethodProvenance),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Def {}
|
#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
|
||||||
pub enum MethodProvenance {
|
pub enum MethodProvenance {
|
||||||
FromTrait(ast::DefId),
|
FromTrait(ast::DefId),
|
||||||
FromImpl(ast::DefId),
|
FromImpl(ast::DefId),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||||
pub enum TyParamProvenance {
|
pub enum TyParamProvenance {
|
||||||
FromSelf(ast::DefId),
|
FromSelf(ast::DefId),
|
||||||
FromParam(ast::DefId),
|
FromParam(ast::DefId),
|
||||||
|
@ -81,8 +79,6 @@ impl MethodProvenance {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for MethodProvenance {}
|
|
||||||
|
|
||||||
impl TyParamProvenance {
|
impl TyParamProvenance {
|
||||||
pub fn def_id(&self) -> ast::DefId {
|
pub fn def_id(&self) -> ast::DefId {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -92,8 +88,6 @@ impl TyParamProvenance {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for TyParamProvenance {}
|
|
||||||
|
|
||||||
impl Def {
|
impl Def {
|
||||||
pub fn def_id(&self) -> ast::DefId {
|
pub fn def_id(&self) -> ast::DefId {
|
||||||
match *self {
|
match *self {
|
||||||
|
|
|
@ -23,15 +23,13 @@ use syntax::codemap::Span;
|
||||||
use syntax::visit;
|
use syntax::visit;
|
||||||
use syntax::visit::Visitor;
|
use syntax::visit::Visitor;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[deriving(Copy, PartialEq)]
|
||||||
enum UnsafeContext {
|
enum UnsafeContext {
|
||||||
SafeContext,
|
SafeContext,
|
||||||
UnsafeFn,
|
UnsafeFn,
|
||||||
UnsafeBlock(ast::NodeId),
|
UnsafeBlock(ast::NodeId),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for UnsafeContext {}
|
|
||||||
|
|
||||||
fn type_is_unsafe_function(ty: Ty) -> bool {
|
fn type_is_unsafe_function(ty: Ty) -> bool {
|
||||||
match ty.sty {
|
match ty.sty {
|
||||||
ty::ty_bare_fn(ref f) => f.unsafety == ast::Unsafety::Unsafe,
|
ty::ty_bare_fn(ref f) => f.unsafety == ast::Unsafety::Unsafe,
|
||||||
|
|
|
@ -95,7 +95,7 @@ pub trait Delegate<'tcx> {
|
||||||
mode: MutateMode);
|
mode: MutateMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq, Show)]
|
#[deriving(Copy, PartialEq, Show)]
|
||||||
pub enum LoanCause {
|
pub enum LoanCause {
|
||||||
ClosureCapture(Span),
|
ClosureCapture(Span),
|
||||||
AddrOf,
|
AddrOf,
|
||||||
|
@ -107,26 +107,20 @@ pub enum LoanCause {
|
||||||
MatchDiscriminant
|
MatchDiscriminant
|
||||||
}
|
}
|
||||||
|
|
||||||
impl kinds::Copy for LoanCause {}
|
#[deriving(Copy, PartialEq, Show)]
|
||||||
|
|
||||||
#[deriving(PartialEq, Show)]
|
|
||||||
pub enum ConsumeMode {
|
pub enum ConsumeMode {
|
||||||
Copy, // reference to x where x has a type that copies
|
Copy, // reference to x where x has a type that copies
|
||||||
Move(MoveReason), // reference to x where x has a type that moves
|
Move(MoveReason), // reference to x where x has a type that moves
|
||||||
}
|
}
|
||||||
|
|
||||||
impl kinds::Copy for ConsumeMode {}
|
#[deriving(Copy, PartialEq, Show)]
|
||||||
|
|
||||||
#[deriving(PartialEq,Show)]
|
|
||||||
pub enum MoveReason {
|
pub enum MoveReason {
|
||||||
DirectRefMove,
|
DirectRefMove,
|
||||||
PatBindingMove,
|
PatBindingMove,
|
||||||
CaptureMove,
|
CaptureMove,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl kinds::Copy for MoveReason {}
|
#[deriving(Copy, PartialEq, Show)]
|
||||||
|
|
||||||
#[deriving(PartialEq,Show)]
|
|
||||||
pub enum MatchMode {
|
pub enum MatchMode {
|
||||||
NonBindingMatch,
|
NonBindingMatch,
|
||||||
BorrowingMatch,
|
BorrowingMatch,
|
||||||
|
@ -134,8 +128,6 @@ pub enum MatchMode {
|
||||||
MovingMatch,
|
MovingMatch,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl kinds::Copy for MatchMode {}
|
|
||||||
|
|
||||||
#[deriving(PartialEq,Show)]
|
#[deriving(PartialEq,Show)]
|
||||||
enum TrackMatchMode<T> {
|
enum TrackMatchMode<T> {
|
||||||
Unknown,
|
Unknown,
|
||||||
|
@ -205,23 +197,20 @@ impl<T> TrackMatchMode<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq,Show)]
|
#[deriving(Copy, PartialEq, Show)]
|
||||||
pub enum MutateMode {
|
pub enum MutateMode {
|
||||||
Init,
|
Init,
|
||||||
JustWrite, // x = y
|
JustWrite, // x = y
|
||||||
WriteAndRead, // x += y
|
WriteAndRead, // x += y
|
||||||
}
|
}
|
||||||
|
|
||||||
impl kinds::Copy for MutateMode {}
|
#[deriving(Copy)]
|
||||||
|
|
||||||
enum OverloadedCallType {
|
enum OverloadedCallType {
|
||||||
FnOverloadedCall,
|
FnOverloadedCall,
|
||||||
FnMutOverloadedCall,
|
FnMutOverloadedCall,
|
||||||
FnOnceOverloadedCall,
|
FnOnceOverloadedCall,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl kinds::Copy for OverloadedCallType {}
|
|
||||||
|
|
||||||
impl OverloadedCallType {
|
impl OverloadedCallType {
|
||||||
fn from_trait_id(tcx: &ty::ctxt, trait_id: ast::DefId)
|
fn from_trait_id(tcx: &ty::ctxt, trait_id: ast::DefId)
|
||||||
-> OverloadedCallType {
|
-> OverloadedCallType {
|
||||||
|
|
|
@ -14,7 +14,7 @@ use syntax::ast;
|
||||||
use self::SimplifiedType::*;
|
use self::SimplifiedType::*;
|
||||||
|
|
||||||
/// See `simplify_type
|
/// See `simplify_type
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub enum SimplifiedType {
|
pub enum SimplifiedType {
|
||||||
BoolSimplifiedType,
|
BoolSimplifiedType,
|
||||||
CharSimplifiedType,
|
CharSimplifiedType,
|
||||||
|
@ -33,8 +33,6 @@ pub enum SimplifiedType {
|
||||||
ParameterSimplifiedType,
|
ParameterSimplifiedType,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for SimplifiedType {}
|
|
||||||
|
|
||||||
/// Tries to simplify a type by dropping type parameters, deref'ing away any reference types, etc.
|
/// Tries to simplify a type by dropping type parameters, deref'ing away any reference types, etc.
|
||||||
/// The idea is to get something simple that we can use to quickly decide if two types could unify
|
/// The idea is to get something simple that we can use to quickly decide if two types could unify
|
||||||
/// during method lookup.
|
/// during method lookup.
|
||||||
|
|
|
@ -60,30 +60,24 @@ impl<E: Show> Show for Edge<E> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Show)]
|
#[deriving(Clone, Copy, PartialEq, Show)]
|
||||||
pub struct NodeIndex(pub uint);
|
pub struct NodeIndex(pub uint);
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
|
pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
|
||||||
|
|
||||||
impl Copy for NodeIndex {}
|
#[deriving(Copy, PartialEq, Show)]
|
||||||
|
|
||||||
#[deriving(PartialEq, Show)]
|
|
||||||
pub struct EdgeIndex(pub uint);
|
pub struct EdgeIndex(pub uint);
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
|
pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
|
||||||
|
|
||||||
impl Copy for EdgeIndex {}
|
|
||||||
|
|
||||||
// Use a private field here to guarantee no more instances are created:
|
// Use a private field here to guarantee no more instances are created:
|
||||||
#[deriving(Show)]
|
#[deriving(Copy, Show)]
|
||||||
pub struct Direction { repr: uint }
|
pub struct Direction { repr: uint }
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
pub const Outgoing: Direction = Direction { repr: 0 };
|
pub const Outgoing: Direction = Direction { repr: 0 };
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
pub const Incoming: Direction = Direction { repr: 1 };
|
pub const Incoming: Direction = Direction { repr: 1 };
|
||||||
|
|
||||||
impl Copy for Direction {}
|
|
||||||
|
|
||||||
impl NodeIndex {
|
impl NodeIndex {
|
||||||
fn get(&self) -> uint { let NodeIndex(v) = *self; v }
|
fn get(&self) -> uint { let NodeIndex(v) = *self; v }
|
||||||
/// Returns unique id (unique with respect to the graph holding associated node).
|
/// Returns unique id (unique with respect to the graph holding associated node).
|
||||||
|
|
|
@ -97,7 +97,7 @@ pub type SkolemizationMap = FnvHashMap<ty::BoundRegion,ty::Region>;
|
||||||
/// Why did we require that the two types be related?
|
/// Why did we require that the two types be related?
|
||||||
///
|
///
|
||||||
/// See `error_reporting.rs` for more details
|
/// See `error_reporting.rs` for more details
|
||||||
#[deriving(Clone, Show)]
|
#[deriving(Clone, Copy, Show)]
|
||||||
pub enum TypeOrigin {
|
pub enum TypeOrigin {
|
||||||
// Not yet categorized in a better way
|
// Not yet categorized in a better way
|
||||||
Misc(Span),
|
Misc(Span),
|
||||||
|
@ -131,8 +131,6 @@ pub enum TypeOrigin {
|
||||||
EquatePredicate(Span),
|
EquatePredicate(Span),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for TypeOrigin {}
|
|
||||||
|
|
||||||
/// See `error_reporting.rs` for more details
|
/// See `error_reporting.rs` for more details
|
||||||
#[deriving(Clone, Show)]
|
#[deriving(Clone, Show)]
|
||||||
pub enum ValuePairs<'tcx> {
|
pub enum ValuePairs<'tcx> {
|
||||||
|
@ -223,7 +221,7 @@ pub enum SubregionOrigin<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Times when we replace late-bound regions with variables:
|
/// Times when we replace late-bound regions with variables:
|
||||||
#[deriving(Clone, Show)]
|
#[deriving(Clone, Copy, Show)]
|
||||||
pub enum LateBoundRegionConversionTime {
|
pub enum LateBoundRegionConversionTime {
|
||||||
/// when a fn is called
|
/// when a fn is called
|
||||||
FnCall,
|
FnCall,
|
||||||
|
@ -232,8 +230,6 @@ pub enum LateBoundRegionConversionTime {
|
||||||
HigherRankedType,
|
HigherRankedType,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for LateBoundRegionConversionTime {}
|
|
||||||
|
|
||||||
/// Reasons to create a region inference variable
|
/// Reasons to create a region inference variable
|
||||||
///
|
///
|
||||||
/// See `error_reporting.rs` for more details
|
/// See `error_reporting.rs` for more details
|
||||||
|
@ -270,15 +266,13 @@ pub enum RegionVariableOrigin<'tcx> {
|
||||||
BoundRegionInCoherence(ast::Name),
|
BoundRegionInCoherence(ast::Name),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[deriving(Copy, Show)]
|
||||||
pub enum fixup_err {
|
pub enum fixup_err {
|
||||||
unresolved_int_ty(IntVid),
|
unresolved_int_ty(IntVid),
|
||||||
unresolved_float_ty(FloatVid),
|
unresolved_float_ty(FloatVid),
|
||||||
unresolved_ty(TyVid)
|
unresolved_ty(TyVid)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for fixup_err {}
|
|
||||||
|
|
||||||
pub fn fixup_err_to_string(f: fixup_err) -> String {
|
pub fn fixup_err_to_string(f: fixup_err) -> String {
|
||||||
match f {
|
match f {
|
||||||
unresolved_int_ty(_) => {
|
unresolved_int_ty(_) => {
|
||||||
|
|
|
@ -40,7 +40,7 @@ mod doc;
|
||||||
mod graphviz;
|
mod graphviz;
|
||||||
|
|
||||||
// A constraint that influences the inference process.
|
// A constraint that influences the inference process.
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||||
pub enum Constraint {
|
pub enum Constraint {
|
||||||
// One region variable is subregion of another
|
// One region variable is subregion of another
|
||||||
ConstrainVarSubVar(RegionVid, RegionVid),
|
ConstrainVarSubVar(RegionVid, RegionVid),
|
||||||
|
@ -52,8 +52,6 @@ pub enum Constraint {
|
||||||
ConstrainVarSubReg(RegionVid, Region),
|
ConstrainVarSubReg(RegionVid, Region),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Constraint {}
|
|
||||||
|
|
||||||
// Something we have to verify after region inference is done, but
|
// Something we have to verify after region inference is done, but
|
||||||
// which does not directly influence the inference process
|
// which does not directly influence the inference process
|
||||||
pub enum Verify<'tcx> {
|
pub enum Verify<'tcx> {
|
||||||
|
@ -69,15 +67,13 @@ pub enum Verify<'tcx> {
|
||||||
VerifyParamBound(ty::ParamTy, SubregionOrigin<'tcx>, Region, Vec<Region>),
|
VerifyParamBound(ty::ParamTy, SubregionOrigin<'tcx>, Region, Vec<Region>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq, Eq, Hash)]
|
#[deriving(Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct TwoRegions {
|
pub struct TwoRegions {
|
||||||
a: Region,
|
a: Region,
|
||||||
b: Region,
|
b: Region,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for TwoRegions {}
|
#[deriving(Copy, PartialEq)]
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
|
||||||
pub enum UndoLogEntry {
|
pub enum UndoLogEntry {
|
||||||
OpenSnapshot,
|
OpenSnapshot,
|
||||||
CommitedSnapshot,
|
CommitedSnapshot,
|
||||||
|
@ -88,15 +84,11 @@ pub enum UndoLogEntry {
|
||||||
AddCombination(CombineMapType, TwoRegions)
|
AddCombination(CombineMapType, TwoRegions)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for UndoLogEntry {}
|
#[deriving(Copy, PartialEq)]
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
|
||||||
pub enum CombineMapType {
|
pub enum CombineMapType {
|
||||||
Lub, Glb
|
Lub, Glb
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for CombineMapType {}
|
|
||||||
|
|
||||||
#[deriving(Clone, Show)]
|
#[deriving(Clone, Show)]
|
||||||
pub enum RegionResolutionError<'tcx> {
|
pub enum RegionResolutionError<'tcx> {
|
||||||
/// `ConcreteFailure(o, a, b)`:
|
/// `ConcreteFailure(o, a, b)`:
|
||||||
|
@ -940,15 +932,12 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||||
|
|
||||||
// ______________________________________________________________________
|
// ______________________________________________________________________
|
||||||
|
|
||||||
#[deriving(PartialEq, Show)]
|
#[deriving(Copy, PartialEq, Show)]
|
||||||
enum Classification { Expanding, Contracting }
|
enum Classification { Expanding, Contracting }
|
||||||
|
|
||||||
impl Copy for Classification {}
|
#[deriving(Copy)]
|
||||||
|
|
||||||
pub enum VarValue { NoValue, Value(Region), ErrorValue }
|
pub enum VarValue { NoValue, Value(Region), ErrorValue }
|
||||||
|
|
||||||
impl Copy for VarValue {}
|
|
||||||
|
|
||||||
struct VarData {
|
struct VarData {
|
||||||
classification: Classification,
|
classification: Classification,
|
||||||
value: VarValue,
|
value: VarValue,
|
||||||
|
|
|
@ -46,13 +46,11 @@ struct Delegate;
|
||||||
|
|
||||||
type Relation = (RelationDir, ty::TyVid);
|
type Relation = (RelationDir, ty::TyVid);
|
||||||
|
|
||||||
#[deriving(PartialEq,Show)]
|
#[deriving(Copy, PartialEq, Show)]
|
||||||
pub enum RelationDir {
|
pub enum RelationDir {
|
||||||
SubtypeOf, SupertypeOf, EqTo
|
SubtypeOf, SupertypeOf, EqTo
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for RelationDir {}
|
|
||||||
|
|
||||||
impl RelationDir {
|
impl RelationDir {
|
||||||
fn opposite(self) -> RelationDir {
|
fn opposite(self) -> RelationDir {
|
||||||
match self {
|
match self {
|
||||||
|
|
|
@ -90,10 +90,9 @@ pub struct Node<K,V> {
|
||||||
pub rank: uint,
|
pub rank: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct Delegate;
|
pub struct Delegate;
|
||||||
|
|
||||||
impl Copy for Delegate {}
|
|
||||||
|
|
||||||
// We can't use V:LatticeValue, much as I would like to,
|
// We can't use V:LatticeValue, much as I would like to,
|
||||||
// because frequently the pattern is that V=Option<U> for some
|
// because frequently the pattern is that V=Option<U> for some
|
||||||
// other type parameter U, and we have no way to say
|
// other type parameter U, and we have no way to say
|
||||||
|
|
|
@ -45,13 +45,11 @@ macro_rules! lets_do_this {
|
||||||
$( $variant:ident, $name:expr, $method:ident; )*
|
$( $variant:ident, $name:expr, $method:ident; )*
|
||||||
) => {
|
) => {
|
||||||
|
|
||||||
#[deriving(FromPrimitive, PartialEq, Eq, Hash)]
|
#[deriving(Copy, FromPrimitive, PartialEq, Eq, Hash)]
|
||||||
pub enum LangItem {
|
pub enum LangItem {
|
||||||
$($variant),*
|
$($variant),*
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for LangItem {}
|
|
||||||
|
|
||||||
pub struct LanguageItems {
|
pub struct LanguageItems {
|
||||||
pub items: Vec<Option<ast::DefId>>,
|
pub items: Vec<Option<ast::DefId>>,
|
||||||
pub missing: Vec<LangItem>,
|
pub missing: Vec<LangItem>,
|
||||||
|
|
|
@ -135,16 +135,12 @@ enum LoopKind<'a> {
|
||||||
ForLoop(&'a ast::Pat),
|
ForLoop(&'a ast::Pat),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[deriving(Copy, PartialEq)]
|
||||||
struct Variable(uint);
|
struct Variable(uint);
|
||||||
|
|
||||||
impl Copy for Variable {}
|
#[deriving(Copy, PartialEq)]
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
|
||||||
struct LiveNode(uint);
|
struct LiveNode(uint);
|
||||||
|
|
||||||
impl Copy for LiveNode {}
|
|
||||||
|
|
||||||
impl Variable {
|
impl Variable {
|
||||||
fn get(&self) -> uint { let Variable(v) = *self; v }
|
fn get(&self) -> uint { let Variable(v) = *self; v }
|
||||||
}
|
}
|
||||||
|
@ -159,7 +155,7 @@ impl Clone for LiveNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq, Show)]
|
#[deriving(Copy, PartialEq, Show)]
|
||||||
enum LiveNodeKind {
|
enum LiveNodeKind {
|
||||||
FreeVarNode(Span),
|
FreeVarNode(Span),
|
||||||
ExprNode(Span),
|
ExprNode(Span),
|
||||||
|
@ -167,8 +163,6 @@ enum LiveNodeKind {
|
||||||
ExitNode
|
ExitNode
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for LiveNodeKind {}
|
|
||||||
|
|
||||||
fn live_node_kind_to_string(lnk: LiveNodeKind, cx: &ty::ctxt) -> String {
|
fn live_node_kind_to_string(lnk: LiveNodeKind, cx: &ty::ctxt) -> String {
|
||||||
let cm = cx.sess.codemap();
|
let cm = cx.sess.codemap();
|
||||||
match lnk {
|
match lnk {
|
||||||
|
@ -247,15 +241,13 @@ struct CaptureInfo {
|
||||||
var_nid: NodeId
|
var_nid: NodeId
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[deriving(Copy, Show)]
|
||||||
struct LocalInfo {
|
struct LocalInfo {
|
||||||
id: NodeId,
|
id: NodeId,
|
||||||
ident: ast::Ident
|
ident: ast::Ident
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for LocalInfo {}
|
#[deriving(Copy, Show)]
|
||||||
|
|
||||||
#[deriving(Show)]
|
|
||||||
enum VarKind {
|
enum VarKind {
|
||||||
Arg(NodeId, ast::Ident),
|
Arg(NodeId, ast::Ident),
|
||||||
Local(LocalInfo),
|
Local(LocalInfo),
|
||||||
|
@ -263,8 +255,6 @@ enum VarKind {
|
||||||
CleanExit
|
CleanExit
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for VarKind {}
|
|
||||||
|
|
||||||
struct IrMaps<'a, 'tcx: 'a> {
|
struct IrMaps<'a, 'tcx: 'a> {
|
||||||
tcx: &'a ty::ctxt<'tcx>,
|
tcx: &'a ty::ctxt<'tcx>,
|
||||||
|
|
||||||
|
@ -536,15 +526,13 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
|
||||||
// Actually we compute just a bit more than just liveness, but we use
|
// Actually we compute just a bit more than just liveness, but we use
|
||||||
// the same basic propagation framework in all cases.
|
// the same basic propagation framework in all cases.
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone, Copy)]
|
||||||
struct Users {
|
struct Users {
|
||||||
reader: LiveNode,
|
reader: LiveNode,
|
||||||
writer: LiveNode,
|
writer: LiveNode,
|
||||||
used: bool
|
used: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Users {}
|
|
||||||
|
|
||||||
fn invalid_users() -> Users {
|
fn invalid_users() -> Users {
|
||||||
Users {
|
Users {
|
||||||
reader: invalid_node(),
|
reader: invalid_node(),
|
||||||
|
@ -553,6 +541,7 @@ fn invalid_users() -> Users {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
struct Specials {
|
struct Specials {
|
||||||
exit_ln: LiveNode,
|
exit_ln: LiveNode,
|
||||||
fallthrough_ln: LiveNode,
|
fallthrough_ln: LiveNode,
|
||||||
|
@ -560,8 +549,6 @@ struct Specials {
|
||||||
clean_exit_var: Variable
|
clean_exit_var: Variable
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Specials {}
|
|
||||||
|
|
||||||
static ACC_READ: uint = 1u;
|
static ACC_READ: uint = 1u;
|
||||||
static ACC_WRITE: uint = 2u;
|
static ACC_WRITE: uint = 2u;
|
||||||
static ACC_USE: uint = 4u;
|
static ACC_USE: uint = 4u;
|
||||||
|
|
|
@ -101,7 +101,7 @@ pub enum categorization<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represents any kind of upvar
|
// Represents any kind of upvar
|
||||||
#[deriving(Clone, PartialEq, Show)]
|
#[deriving(Clone, Copy, PartialEq, Show)]
|
||||||
pub struct Upvar {
|
pub struct Upvar {
|
||||||
pub id: ty::UpvarId,
|
pub id: ty::UpvarId,
|
||||||
// Unboxed closure kinds are used even for old-style closures for simplicity
|
// Unboxed closure kinds are used even for old-style closures for simplicity
|
||||||
|
@ -110,10 +110,8 @@ pub struct Upvar {
|
||||||
pub is_unboxed: bool
|
pub is_unboxed: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Upvar {}
|
|
||||||
|
|
||||||
// different kinds of pointers:
|
// different kinds of pointers:
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||||
pub enum PointerKind {
|
pub enum PointerKind {
|
||||||
OwnedPtr,
|
OwnedPtr,
|
||||||
BorrowedPtr(ty::BorrowKind, ty::Region),
|
BorrowedPtr(ty::BorrowKind, ty::Region),
|
||||||
|
@ -121,57 +119,45 @@ pub enum PointerKind {
|
||||||
UnsafePtr(ast::Mutability)
|
UnsafePtr(ast::Mutability)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for PointerKind {}
|
|
||||||
|
|
||||||
// We use the term "interior" to mean "something reachable from the
|
// We use the term "interior" to mean "something reachable from the
|
||||||
// base without a pointer dereference", e.g. a field
|
// base without a pointer dereference", e.g. a field
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||||
pub enum InteriorKind {
|
pub enum InteriorKind {
|
||||||
InteriorField(FieldName),
|
InteriorField(FieldName),
|
||||||
InteriorElement(ElementKind),
|
InteriorElement(ElementKind),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for InteriorKind {}
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
|
||||||
pub enum FieldName {
|
pub enum FieldName {
|
||||||
NamedField(ast::Name),
|
NamedField(ast::Name),
|
||||||
PositionalField(uint)
|
PositionalField(uint)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for FieldName {}
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
|
||||||
pub enum ElementKind {
|
pub enum ElementKind {
|
||||||
VecElement,
|
VecElement,
|
||||||
OtherElement,
|
OtherElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ElementKind {}
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
|
||||||
pub enum MutabilityCategory {
|
pub enum MutabilityCategory {
|
||||||
McImmutable, // Immutable.
|
McImmutable, // Immutable.
|
||||||
McDeclared, // Directly declared as mutable.
|
McDeclared, // Directly declared as mutable.
|
||||||
McInherited, // Inherited from the fact that owner is mutable.
|
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
|
// A note about the provenance of a `cmt`. This is used for
|
||||||
// special-case handling of upvars such as mutability inference.
|
// special-case handling of upvars such as mutability inference.
|
||||||
// Upvar categorization can generate a variable number of nested
|
// Upvar categorization can generate a variable number of nested
|
||||||
// derefs. The note allows detecting them without deep pattern
|
// derefs. The note allows detecting them without deep pattern
|
||||||
// matching on the categorization.
|
// matching on the categorization.
|
||||||
#[deriving(Clone, PartialEq, Show)]
|
#[deriving(Clone, Copy, PartialEq, Show)]
|
||||||
pub enum Note {
|
pub enum Note {
|
||||||
NoteClosureEnv(ty::UpvarId), // Deref through closure env
|
NoteClosureEnv(ty::UpvarId), // Deref through closure env
|
||||||
NoteUpvarRef(ty::UpvarId), // Deref through by-ref upvar
|
NoteUpvarRef(ty::UpvarId), // Deref through by-ref upvar
|
||||||
NoteNone // Nothing special
|
NoteNone // Nothing special
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Note {}
|
|
||||||
|
|
||||||
// `cmt`: "Category, Mutability, and Type".
|
// `cmt`: "Category, Mutability, and Type".
|
||||||
//
|
//
|
||||||
// a complete categorization of a value indicating where it originated
|
// a complete categorization of a value indicating where it originated
|
||||||
|
@ -200,13 +186,12 @@ pub type cmt<'tcx> = Rc<cmt_<'tcx>>;
|
||||||
|
|
||||||
// We pun on *T to mean both actual deref of a ptr as well
|
// We pun on *T to mean both actual deref of a ptr as well
|
||||||
// as accessing of components:
|
// as accessing of components:
|
||||||
|
#[deriving(Copy)]
|
||||||
pub enum deref_kind {
|
pub enum deref_kind {
|
||||||
deref_ptr(PointerKind),
|
deref_ptr(PointerKind),
|
||||||
deref_interior(InteriorKind),
|
deref_interior(InteriorKind),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for deref_kind {}
|
|
||||||
|
|
||||||
// Categorizes a derefable type. Note that we include vectors and strings as
|
// 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
|
// derefable (we model an index as the combination of a deref and then a
|
||||||
// pointer adjustment).
|
// pointer adjustment).
|
||||||
|
@ -1394,13 +1379,13 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub enum InteriorSafety {
|
pub enum InteriorSafety {
|
||||||
InteriorUnsafe,
|
InteriorUnsafe,
|
||||||
InteriorSafe
|
InteriorSafe
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for InteriorSafety {}
|
#[deriving(Copy)]
|
||||||
|
|
||||||
pub enum AliasableReason {
|
pub enum AliasableReason {
|
||||||
AliasableBorrowed,
|
AliasableBorrowed,
|
||||||
AliasableClosure(ast::NodeId), // Aliasable due to capture Fn closure env
|
AliasableClosure(ast::NodeId), // Aliasable due to capture Fn closure env
|
||||||
|
@ -1409,8 +1394,6 @@ pub enum AliasableReason {
|
||||||
AliasableStaticMut(InteriorSafety),
|
AliasableStaticMut(InteriorSafety),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for AliasableReason {}
|
|
||||||
|
|
||||||
impl<'tcx> cmt_<'tcx> {
|
impl<'tcx> cmt_<'tcx> {
|
||||||
pub fn guarantor(&self) -> cmt<'tcx> {
|
pub fn guarantor(&self) -> cmt<'tcx> {
|
||||||
//! Returns `self` after stripping away any owned pointer derefs or
|
//! Returns `self` after stripping away any owned pointer derefs or
|
||||||
|
|
|
@ -36,13 +36,11 @@ use syntax::visit::{Visitor, FnKind};
|
||||||
/// placate the same deriving in `ty::FreeRegion`, but we may want to
|
/// placate the same deriving in `ty::FreeRegion`, but we may want to
|
||||||
/// actually attach a more meaningful ordering to scopes than the one
|
/// actually attach a more meaningful ordering to scopes than the one
|
||||||
/// generated via deriving here.
|
/// generated via deriving here.
|
||||||
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)]
|
#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)]
|
||||||
pub enum CodeExtent {
|
pub enum CodeExtent {
|
||||||
Misc(ast::NodeId)
|
Misc(ast::NodeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for CodeExtent {}
|
|
||||||
|
|
||||||
impl CodeExtent {
|
impl CodeExtent {
|
||||||
/// Creates a scope that represents the dynamic extent associated
|
/// Creates a scope that represents the dynamic extent associated
|
||||||
/// with `node_id`.
|
/// with `node_id`.
|
||||||
|
@ -117,6 +115,7 @@ pub struct RegionMaps {
|
||||||
terminating_scopes: RefCell<FnvHashSet<CodeExtent>>,
|
terminating_scopes: RefCell<FnvHashSet<CodeExtent>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct Context {
|
pub struct Context {
|
||||||
var_parent: Option<ast::NodeId>,
|
var_parent: Option<ast::NodeId>,
|
||||||
|
|
||||||
|
@ -124,8 +123,6 @@ pub struct Context {
|
||||||
parent: Option<ast::NodeId>,
|
parent: Option<ast::NodeId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Context {}
|
|
||||||
|
|
||||||
struct RegionResolutionVisitor<'a> {
|
struct RegionResolutionVisitor<'a> {
|
||||||
sess: &'a Session,
|
sess: &'a Session,
|
||||||
|
|
||||||
|
|
|
@ -89,13 +89,12 @@ use std::uint;
|
||||||
// Definition mapping
|
// Definition mapping
|
||||||
pub type DefMap = RefCell<NodeMap<Def>>;
|
pub type DefMap = RefCell<NodeMap<Def>>;
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
struct binding_info {
|
struct binding_info {
|
||||||
span: Span,
|
span: Span,
|
||||||
binding_mode: BindingMode,
|
binding_mode: BindingMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for binding_info {}
|
|
||||||
|
|
||||||
// Map from the name in a pattern to its binding mode.
|
// Map from the name in a pattern to its binding mode.
|
||||||
type BindingMap = HashMap<Name,binding_info>;
|
type BindingMap = HashMap<Name,binding_info>;
|
||||||
|
|
||||||
|
@ -118,7 +117,7 @@ pub type ExternalExports = DefIdSet;
|
||||||
// FIXME: dox
|
// FIXME: dox
|
||||||
pub type LastPrivateMap = NodeMap<LastPrivate>;
|
pub type LastPrivateMap = NodeMap<LastPrivate>;
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[deriving(Copy, Show)]
|
||||||
pub enum LastPrivate {
|
pub enum LastPrivate {
|
||||||
LastMod(PrivateDep),
|
LastMod(PrivateDep),
|
||||||
// `use` directives (imports) can refer to two separate definitions in the
|
// `use` directives (imports) can refer to two separate definitions in the
|
||||||
|
@ -132,25 +131,19 @@ pub enum LastPrivate {
|
||||||
type_used: ImportUse},
|
type_used: ImportUse},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for LastPrivate {}
|
#[deriving(Copy, Show)]
|
||||||
|
|
||||||
#[deriving(Show)]
|
|
||||||
pub enum PrivateDep {
|
pub enum PrivateDep {
|
||||||
AllPublic,
|
AllPublic,
|
||||||
DependsOn(DefId),
|
DependsOn(DefId),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for PrivateDep {}
|
|
||||||
|
|
||||||
// How an import is used.
|
// How an import is used.
|
||||||
#[deriving(PartialEq, Show)]
|
#[deriving(Copy, PartialEq, Show)]
|
||||||
pub enum ImportUse {
|
pub enum ImportUse {
|
||||||
Unused, // The import is not used.
|
Unused, // The import is not used.
|
||||||
Used, // The import is used.
|
Used, // The import is used.
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ImportUse {}
|
|
||||||
|
|
||||||
impl LastPrivate {
|
impl LastPrivate {
|
||||||
fn or(self, other: LastPrivate) -> LastPrivate {
|
fn or(self, other: LastPrivate) -> LastPrivate {
|
||||||
match (self, other) {
|
match (self, other) {
|
||||||
|
@ -160,24 +153,20 @@ impl LastPrivate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[deriving(Copy, PartialEq)]
|
||||||
enum PatternBindingMode {
|
enum PatternBindingMode {
|
||||||
RefutableMode,
|
RefutableMode,
|
||||||
LocalIrrefutableMode,
|
LocalIrrefutableMode,
|
||||||
ArgumentIrrefutableMode,
|
ArgumentIrrefutableMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for PatternBindingMode {}
|
#[deriving(Copy, PartialEq, Eq, Hash, Show)]
|
||||||
|
|
||||||
#[deriving(PartialEq, Eq, Hash, Show)]
|
|
||||||
enum Namespace {
|
enum Namespace {
|
||||||
TypeNS,
|
TypeNS,
|
||||||
ValueNS
|
ValueNS
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Namespace {}
|
#[deriving(Copy, PartialEq)]
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
|
||||||
enum NamespaceError {
|
enum NamespaceError {
|
||||||
NoError,
|
NoError,
|
||||||
ModuleError,
|
ModuleError,
|
||||||
|
@ -185,8 +174,6 @@ enum NamespaceError {
|
||||||
ValueError
|
ValueError
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for NamespaceError {}
|
|
||||||
|
|
||||||
/// A NamespaceResult represents the result of resolving an import in
|
/// A NamespaceResult represents the result of resolving an import in
|
||||||
/// a particular namespace. The result is either definitely-resolved,
|
/// a particular namespace. The result is either definitely-resolved,
|
||||||
/// definitely- unresolved, or unknown.
|
/// definitely- unresolved, or unknown.
|
||||||
|
@ -247,13 +234,12 @@ impl<'a, 'v> Visitor<'v> for Resolver<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Contains data for specific types of import directives.
|
/// Contains data for specific types of import directives.
|
||||||
|
#[deriving(Copy)]
|
||||||
enum ImportDirectiveSubclass {
|
enum ImportDirectiveSubclass {
|
||||||
SingleImport(Name /* target */, Name /* source */),
|
SingleImport(Name /* target */, Name /* source */),
|
||||||
GlobImport
|
GlobImport
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ImportDirectiveSubclass {}
|
|
||||||
|
|
||||||
/// The context that we thread through while building the reduced graph.
|
/// The context that we thread through while building the reduced graph.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
enum ReducedGraphParent {
|
enum ReducedGraphParent {
|
||||||
|
@ -293,6 +279,7 @@ enum FallbackSuggestion {
|
||||||
TraitMethod(String),
|
TraitMethod(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
enum TypeParameters<'a> {
|
enum TypeParameters<'a> {
|
||||||
NoTypeParameters,
|
NoTypeParameters,
|
||||||
HasTypeParameters(
|
HasTypeParameters(
|
||||||
|
@ -310,11 +297,9 @@ enum TypeParameters<'a> {
|
||||||
RibKind)
|
RibKind)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Copy for TypeParameters<'a> {}
|
|
||||||
|
|
||||||
// The rib kind controls the translation of local
|
// The rib kind controls the translation of local
|
||||||
// definitions (`DefLocal`) to upvars (`DefUpvar`).
|
// definitions (`DefLocal`) to upvars (`DefUpvar`).
|
||||||
#[deriving(Show)]
|
#[deriving(Copy, Show)]
|
||||||
enum RibKind {
|
enum RibKind {
|
||||||
// No translation needs to be applied.
|
// No translation needs to be applied.
|
||||||
NormalRibKind,
|
NormalRibKind,
|
||||||
|
@ -337,38 +322,31 @@ enum RibKind {
|
||||||
ConstantItemRibKind
|
ConstantItemRibKind
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for RibKind {}
|
|
||||||
|
|
||||||
// Methods can be required or provided. RequiredMethod methods only occur in traits.
|
// Methods can be required or provided. RequiredMethod methods only occur in traits.
|
||||||
#[deriving(Show)]
|
#[deriving(Copy, Show)]
|
||||||
enum MethodSort {
|
enum MethodSort {
|
||||||
RequiredMethod,
|
RequiredMethod,
|
||||||
ProvidedMethod(NodeId)
|
ProvidedMethod(NodeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for MethodSort {}
|
#[deriving(Copy)]
|
||||||
|
|
||||||
enum UseLexicalScopeFlag {
|
enum UseLexicalScopeFlag {
|
||||||
DontUseLexicalScope,
|
DontUseLexicalScope,
|
||||||
UseLexicalScope
|
UseLexicalScope
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for UseLexicalScopeFlag {}
|
|
||||||
|
|
||||||
enum ModulePrefixResult {
|
enum ModulePrefixResult {
|
||||||
NoPrefixFound,
|
NoPrefixFound,
|
||||||
PrefixFound(Rc<Module>, uint)
|
PrefixFound(Rc<Module>, uint)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Eq, PartialEq)]
|
#[deriving(Clone, Copy, Eq, PartialEq)]
|
||||||
pub enum TraitItemKind {
|
pub enum TraitItemKind {
|
||||||
NonstaticMethodTraitItemKind,
|
NonstaticMethodTraitItemKind,
|
||||||
StaticMethodTraitItemKind,
|
StaticMethodTraitItemKind,
|
||||||
TypeTraitItemKind,
|
TypeTraitItemKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for TraitItemKind {}
|
|
||||||
|
|
||||||
impl TraitItemKind {
|
impl TraitItemKind {
|
||||||
pub fn from_explicit_self_category(explicit_self_category:
|
pub fn from_explicit_self_category(explicit_self_category:
|
||||||
ExplicitSelfCategory)
|
ExplicitSelfCategory)
|
||||||
|
@ -381,7 +359,7 @@ impl TraitItemKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[deriving(Copy, PartialEq)]
|
||||||
enum NameSearchType {
|
enum NameSearchType {
|
||||||
/// We're doing a name search in order to resolve a `use` directive.
|
/// We're doing a name search in order to resolve a `use` directive.
|
||||||
ImportSearch,
|
ImportSearch,
|
||||||
|
@ -391,19 +369,16 @@ enum NameSearchType {
|
||||||
PathSearch,
|
PathSearch,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for NameSearchType {}
|
#[deriving(Copy)]
|
||||||
|
|
||||||
enum BareIdentifierPatternResolution {
|
enum BareIdentifierPatternResolution {
|
||||||
FoundStructOrEnumVariant(Def, LastPrivate),
|
FoundStructOrEnumVariant(Def, LastPrivate),
|
||||||
FoundConst(Def, LastPrivate),
|
FoundConst(Def, LastPrivate),
|
||||||
BareIdentifierPatternUnresolved
|
BareIdentifierPatternUnresolved
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for BareIdentifierPatternResolution {}
|
|
||||||
|
|
||||||
// Specifies how duplicates should be handled when adding a child item if
|
// Specifies how duplicates should be handled when adding a child item if
|
||||||
// another item exists with the same name in some namespace.
|
// another item exists with the same name in some namespace.
|
||||||
#[deriving(PartialEq)]
|
#[deriving(Copy, PartialEq)]
|
||||||
enum DuplicateCheckingMode {
|
enum DuplicateCheckingMode {
|
||||||
ForbidDuplicateModules,
|
ForbidDuplicateModules,
|
||||||
ForbidDuplicateTypesAndModules,
|
ForbidDuplicateTypesAndModules,
|
||||||
|
@ -412,8 +387,6 @@ enum DuplicateCheckingMode {
|
||||||
OverwriteDuplicates
|
OverwriteDuplicates
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for DuplicateCheckingMode {}
|
|
||||||
|
|
||||||
/// One local scope.
|
/// One local scope.
|
||||||
#[deriving(Show)]
|
#[deriving(Show)]
|
||||||
struct Rib {
|
struct Rib {
|
||||||
|
@ -543,7 +516,7 @@ enum ParentLink {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The type of module this is.
|
/// The type of module this is.
|
||||||
#[deriving(PartialEq)]
|
#[deriving(Copy, PartialEq)]
|
||||||
enum ModuleKind {
|
enum ModuleKind {
|
||||||
NormalModuleKind,
|
NormalModuleKind,
|
||||||
TraitModuleKind,
|
TraitModuleKind,
|
||||||
|
@ -552,8 +525,6 @@ enum ModuleKind {
|
||||||
AnonymousModuleKind,
|
AnonymousModuleKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ModuleKind {}
|
|
||||||
|
|
||||||
/// One node in the tree of modules.
|
/// One node in the tree of modules.
|
||||||
struct Module {
|
struct Module {
|
||||||
parent_link: ParentLink,
|
parent_link: ParentLink,
|
||||||
|
@ -645,15 +616,13 @@ struct TypeNsDef {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Records a possibly-private value definition.
|
// Records a possibly-private value definition.
|
||||||
#[deriving(Clone, Show)]
|
#[deriving(Clone, Copy, Show)]
|
||||||
struct ValueNsDef {
|
struct ValueNsDef {
|
||||||
modifiers: DefModifiers, // see note in ImportResolution about how to use this
|
modifiers: DefModifiers, // see note in ImportResolution about how to use this
|
||||||
def: Def,
|
def: Def,
|
||||||
value_span: Option<Span>,
|
value_span: Option<Span>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ValueNsDef {}
|
|
||||||
|
|
||||||
// Records the definitions (at most one for each namespace) that a name is
|
// Records the definitions (at most one for each namespace) that a name is
|
||||||
// bound to.
|
// bound to.
|
||||||
struct NameBindings {
|
struct NameBindings {
|
||||||
|
@ -662,6 +631,7 @@ struct NameBindings {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ways in which a trait can be referenced
|
/// Ways in which a trait can be referenced
|
||||||
|
#[deriving(Copy)]
|
||||||
enum TraitReferenceType {
|
enum TraitReferenceType {
|
||||||
TraitImplementation, // impl SomeTrait for T { ... }
|
TraitImplementation, // impl SomeTrait for T { ... }
|
||||||
TraitDerivation, // trait T : SomeTrait { ... }
|
TraitDerivation, // trait T : SomeTrait { ... }
|
||||||
|
@ -670,8 +640,6 @@ enum TraitReferenceType {
|
||||||
TraitQPath, // <T as SomeTrait>::
|
TraitQPath, // <T as SomeTrait>::
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for TraitReferenceType {}
|
|
||||||
|
|
||||||
impl NameBindings {
|
impl NameBindings {
|
||||||
fn new() -> NameBindings {
|
fn new() -> NameBindings {
|
||||||
NameBindings {
|
NameBindings {
|
||||||
|
|
|
@ -34,7 +34,7 @@ use syntax::visit;
|
||||||
use syntax::visit::Visitor;
|
use syntax::visit::Visitor;
|
||||||
use util::nodemap::NodeMap;
|
use util::nodemap::NodeMap;
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
||||||
pub enum DefRegion {
|
pub enum DefRegion {
|
||||||
DefStaticRegion,
|
DefStaticRegion,
|
||||||
DefEarlyBoundRegion(/* space */ subst::ParamSpace,
|
DefEarlyBoundRegion(/* space */ subst::ParamSpace,
|
||||||
|
@ -46,8 +46,6 @@ pub enum DefRegion {
|
||||||
/* lifetime decl */ ast::NodeId),
|
/* lifetime decl */ ast::NodeId),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for DefRegion {}
|
|
||||||
|
|
||||||
// maps the id of each lifetime reference to the lifetime decl
|
// maps the id of each lifetime reference to the lifetime decl
|
||||||
// that it corresponds to
|
// that it corresponds to
|
||||||
pub type NamedRegionMap = NodeMap<DefRegion>;
|
pub type NamedRegionMap = NodeMap<DefRegion>;
|
||||||
|
|
|
@ -187,7 +187,7 @@ impl RegionSubsts {
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// ParamSpace
|
// ParamSpace
|
||||||
|
|
||||||
#[deriving(PartialOrd, Ord, PartialEq, Eq,
|
#[deriving(Copy, PartialOrd, Ord, PartialEq, Eq,
|
||||||
Clone, Hash, Encodable, Decodable, Show)]
|
Clone, Hash, Encodable, Decodable, Show)]
|
||||||
pub enum ParamSpace {
|
pub enum ParamSpace {
|
||||||
TypeSpace, // Type parameters attached to a type definition, trait, or impl
|
TypeSpace, // Type parameters attached to a type definition, trait, or impl
|
||||||
|
@ -196,8 +196,6 @@ pub enum ParamSpace {
|
||||||
FnSpace, // Type parameters attached to a method or fn
|
FnSpace, // Type parameters attached to a method or fn
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ParamSpace {}
|
|
||||||
|
|
||||||
impl ParamSpace {
|
impl ParamSpace {
|
||||||
pub fn all() -> [ParamSpace, ..4] {
|
pub fn all() -> [ParamSpace, ..4] {
|
||||||
[TypeSpace, SelfSpace, AssocSpace, FnSpace]
|
[TypeSpace, SelfSpace, AssocSpace, FnSpace]
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub enum MethodMatchResult {
|
||||||
MethodDidNotMatch,
|
MethodDidNotMatch,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[deriving(Copy, Show)]
|
||||||
pub enum MethodMatchedData {
|
pub enum MethodMatchedData {
|
||||||
// In the case of a precise match, we don't really need to store
|
// In the case of a precise match, we don't really need to store
|
||||||
// how the match was found. So don't.
|
// how the match was found. So don't.
|
||||||
|
@ -102,8 +102,6 @@ pub enum MethodMatchedData {
|
||||||
CoerciveMethodMatch(/* impl we matched */ ast::DefId)
|
CoerciveMethodMatch(/* impl we matched */ ast::DefId)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for MethodMatchedData {}
|
|
||||||
|
|
||||||
/// The selection process begins by considering all impls, where
|
/// The selection process begins by considering all impls, where
|
||||||
/// clauses, and so forth that might resolve an obligation. Sometimes
|
/// clauses, and so forth that might resolve an obligation. Sometimes
|
||||||
/// we'll be able to say definitively that (e.g.) an impl does not
|
/// we'll be able to say definitively that (e.g.) an impl does not
|
||||||
|
|
|
@ -107,22 +107,18 @@ pub struct CrateAnalysis<'tcx> {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq, Eq, Hash)]
|
#[deriving(Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct field<'tcx> {
|
pub struct field<'tcx> {
|
||||||
pub name: ast::Name,
|
pub name: ast::Name,
|
||||||
pub mt: mt<'tcx>
|
pub mt: mt<'tcx>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Copy for field<'tcx> {}
|
#[deriving(Clone, Copy, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, Show)]
|
|
||||||
pub enum ImplOrTraitItemContainer {
|
pub enum ImplOrTraitItemContainer {
|
||||||
TraitContainer(ast::DefId),
|
TraitContainer(ast::DefId),
|
||||||
ImplContainer(ast::DefId),
|
ImplContainer(ast::DefId),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ImplOrTraitItemContainer {}
|
|
||||||
|
|
||||||
impl ImplOrTraitItemContainer {
|
impl ImplOrTraitItemContainer {
|
||||||
pub fn id(&self) -> ast::DefId {
|
pub fn id(&self) -> ast::DefId {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -177,14 +173,12 @@ impl<'tcx> ImplOrTraitItem<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone, Copy)]
|
||||||
pub enum ImplOrTraitItemId {
|
pub enum ImplOrTraitItemId {
|
||||||
MethodTraitItemId(ast::DefId),
|
MethodTraitItemId(ast::DefId),
|
||||||
TypeTraitItemId(ast::DefId),
|
TypeTraitItemId(ast::DefId),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ImplOrTraitItemId {}
|
|
||||||
|
|
||||||
impl ImplOrTraitItemId {
|
impl ImplOrTraitItemId {
|
||||||
pub fn def_id(&self) -> ast::DefId {
|
pub fn def_id(&self) -> ast::DefId {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -238,7 +232,7 @@ impl<'tcx> Method<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone, Copy)]
|
||||||
pub struct AssociatedType {
|
pub struct AssociatedType {
|
||||||
pub name: ast::Name,
|
pub name: ast::Name,
|
||||||
pub vis: ast::Visibility,
|
pub vis: ast::Visibility,
|
||||||
|
@ -246,17 +240,13 @@ pub struct AssociatedType {
|
||||||
pub container: ImplOrTraitItemContainer,
|
pub container: ImplOrTraitItemContainer,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for AssociatedType {}
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
|
||||||
pub struct mt<'tcx> {
|
pub struct mt<'tcx> {
|
||||||
pub ty: Ty<'tcx>,
|
pub ty: Ty<'tcx>,
|
||||||
pub mutbl: ast::Mutability,
|
pub mutbl: ast::Mutability,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Copy for mt<'tcx> {}
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
|
||||||
pub enum TraitStore {
|
pub enum TraitStore {
|
||||||
/// Box<Trait>
|
/// Box<Trait>
|
||||||
UniqTraitStore,
|
UniqTraitStore,
|
||||||
|
@ -264,9 +254,7 @@ pub enum TraitStore {
|
||||||
RegionTraitStore(Region, ast::Mutability),
|
RegionTraitStore(Region, ast::Mutability),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for TraitStore {}
|
#[deriving(Clone, Copy, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, Show)]
|
|
||||||
pub struct field_ty {
|
pub struct field_ty {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
pub id: DefId,
|
pub id: DefId,
|
||||||
|
@ -274,33 +262,28 @@ pub struct field_ty {
|
||||||
pub origin: ast::DefId, // The DefId of the struct in which the field is declared.
|
pub origin: ast::DefId, // The DefId of the struct in which the field is declared.
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for field_ty {}
|
|
||||||
|
|
||||||
// Contains information needed to resolve types and (in the future) look up
|
// Contains information needed to resolve types and (in the future) look up
|
||||||
// the types of AST nodes.
|
// the types of AST nodes.
|
||||||
#[deriving(PartialEq, Eq, Hash)]
|
#[deriving(Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct creader_cache_key {
|
pub struct creader_cache_key {
|
||||||
pub cnum: CrateNum,
|
pub cnum: CrateNum,
|
||||||
pub pos: uint,
|
pub pos: uint,
|
||||||
pub len: uint
|
pub len: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for creader_cache_key {}
|
#[deriving(Copy)]
|
||||||
|
|
||||||
pub enum ast_ty_to_ty_cache_entry<'tcx> {
|
pub enum ast_ty_to_ty_cache_entry<'tcx> {
|
||||||
atttce_unresolved, /* not resolved yet */
|
atttce_unresolved, /* not resolved yet */
|
||||||
atttce_resolved(Ty<'tcx>) /* resolved to a type, irrespective of region */
|
atttce_resolved(Ty<'tcx>) /* resolved to a type, irrespective of region */
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Copy for ast_ty_to_ty_cache_entry<'tcx> {}
|
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Decodable, Encodable)]
|
#[deriving(Clone, PartialEq, Decodable, Encodable)]
|
||||||
pub struct ItemVariances {
|
pub struct ItemVariances {
|
||||||
pub types: VecPerParamSpace<Variance>,
|
pub types: VecPerParamSpace<Variance>,
|
||||||
pub regions: VecPerParamSpace<Variance>,
|
pub regions: VecPerParamSpace<Variance>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Decodable, Encodable, Show)]
|
#[deriving(Clone, Copy, PartialEq, Decodable, Encodable, Show)]
|
||||||
pub enum Variance {
|
pub enum Variance {
|
||||||
Covariant, // T<A> <: T<B> iff A <: B -- e.g., function return type
|
Covariant, // T<A> <: T<B> iff A <: B -- e.g., function return type
|
||||||
Invariant, // T<A> <: T<B> iff B == A -- e.g., type of mutable cell
|
Invariant, // T<A> <: T<B> iff B == A -- e.g., type of mutable cell
|
||||||
|
@ -308,8 +291,6 @@ pub enum Variance {
|
||||||
Bivariant, // T<A> <: T<B> -- e.g., unused type parameter
|
Bivariant, // T<A> <: T<B> -- e.g., unused type parameter
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Variance {}
|
|
||||||
|
|
||||||
#[deriving(Clone, Show)]
|
#[deriving(Clone, Show)]
|
||||||
pub enum AutoAdjustment<'tcx> {
|
pub enum AutoAdjustment<'tcx> {
|
||||||
AdjustAddEnv(ty::TraitStore),
|
AdjustAddEnv(ty::TraitStore),
|
||||||
|
@ -449,14 +430,12 @@ pub fn type_of_adjust<'tcx>(cx: &ctxt<'tcx>, adj: &AutoAdjustment<'tcx>) -> Opti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Encodable, Decodable, PartialEq, PartialOrd, Show)]
|
#[deriving(Clone, Copy, Encodable, Decodable, PartialEq, PartialOrd, Show)]
|
||||||
pub struct param_index {
|
pub struct param_index {
|
||||||
pub space: subst::ParamSpace,
|
pub space: subst::ParamSpace,
|
||||||
pub index: uint
|
pub index: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for param_index {}
|
|
||||||
|
|
||||||
#[deriving(Clone, Show)]
|
#[deriving(Clone, Show)]
|
||||||
pub enum MethodOrigin<'tcx> {
|
pub enum MethodOrigin<'tcx> {
|
||||||
// fully statically resolved method
|
// fully statically resolved method
|
||||||
|
@ -513,8 +492,6 @@ pub struct MethodCallee<'tcx> {
|
||||||
pub substs: subst::Substs<'tcx>
|
pub substs: subst::Substs<'tcx>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for MethodCall {}
|
|
||||||
|
|
||||||
/// With method calls, we store some extra information in
|
/// With method calls, we store some extra information in
|
||||||
/// side tables (i.e method_map). We use
|
/// side tables (i.e method_map). We use
|
||||||
/// MethodCall as a key to index into these tables instead of
|
/// MethodCall as a key to index into these tables instead of
|
||||||
|
@ -527,21 +504,19 @@ impl Copy for MethodCall {}
|
||||||
/// needed to add to the side tables. Thus to disambiguate
|
/// needed to add to the side tables. Thus to disambiguate
|
||||||
/// we also keep track of whether there's an adjustment in
|
/// we also keep track of whether there's an adjustment in
|
||||||
/// our key.
|
/// our key.
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||||
pub struct MethodCall {
|
pub struct MethodCall {
|
||||||
pub expr_id: ast::NodeId,
|
pub expr_id: ast::NodeId,
|
||||||
pub adjustment: ExprAdjustment
|
pub adjustment: ExprAdjustment
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show, Encodable, Decodable)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show, Encodable, Decodable)]
|
||||||
pub enum ExprAdjustment {
|
pub enum ExprAdjustment {
|
||||||
NoAdjustment,
|
NoAdjustment,
|
||||||
AutoDeref(uint),
|
AutoDeref(uint),
|
||||||
AutoObject
|
AutoObject
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ExprAdjustment {}
|
|
||||||
|
|
||||||
impl MethodCall {
|
impl MethodCall {
|
||||||
pub fn expr(id: ast::NodeId) -> MethodCall {
|
pub fn expr(id: ast::NodeId) -> MethodCall {
|
||||||
MethodCall {
|
MethodCall {
|
||||||
|
@ -615,6 +590,7 @@ pub type ObjectCastMap<'tcx> = RefCell<NodeMap<Rc<ty::PolyTraitRef<'tcx>>>>;
|
||||||
|
|
||||||
/// A restriction that certain types must be the same size. The use of
|
/// A restriction that certain types must be the same size. The use of
|
||||||
/// `transmute` gives rise to these restrictions.
|
/// `transmute` gives rise to these restrictions.
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct TransmuteRestriction<'tcx> {
|
pub struct TransmuteRestriction<'tcx> {
|
||||||
/// The span from whence the restriction comes.
|
/// The span from whence the restriction comes.
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
@ -626,8 +602,6 @@ pub struct TransmuteRestriction<'tcx> {
|
||||||
pub id: ast::NodeId,
|
pub id: ast::NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Copy for TransmuteRestriction<'tcx> {}
|
|
||||||
|
|
||||||
/// The data structure to keep track of all the information that typechecker
|
/// The data structure to keep track of all the information that typechecker
|
||||||
/// generates so that so that it can be reused and doesn't have to be redone
|
/// generates so that so that it can be reused and doesn't have to be redone
|
||||||
/// later on.
|
/// later on.
|
||||||
|
@ -923,7 +897,7 @@ pub struct ClosureTy<'tcx> {
|
||||||
pub abi: abi::Abi,
|
pub abi: abi::Abi,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub enum FnOutput<'tcx> {
|
pub enum FnOutput<'tcx> {
|
||||||
FnConverging(Ty<'tcx>),
|
FnConverging(Ty<'tcx>),
|
||||||
FnDiverging
|
FnDiverging
|
||||||
|
@ -938,8 +912,6 @@ impl<'tcx> FnOutput<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Copy for FnOutput<'tcx> {}
|
|
||||||
|
|
||||||
/// Signature of a function type, which I have arbitrarily
|
/// Signature of a function type, which I have arbitrarily
|
||||||
/// decided to use to refer to the input/output types.
|
/// decided to use to refer to the input/output types.
|
||||||
///
|
///
|
||||||
|
@ -955,15 +927,13 @@ pub struct FnSig<'tcx> {
|
||||||
|
|
||||||
pub type PolyFnSig<'tcx> = Binder<FnSig<'tcx>>;
|
pub type PolyFnSig<'tcx> = Binder<FnSig<'tcx>>;
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||||
pub struct ParamTy {
|
pub struct ParamTy {
|
||||||
pub space: subst::ParamSpace,
|
pub space: subst::ParamSpace,
|
||||||
pub idx: uint,
|
pub idx: uint,
|
||||||
pub def_id: DefId
|
pub def_id: DefId
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ParamTy {}
|
|
||||||
|
|
||||||
/// A [De Bruijn index][dbi] is a standard means of representing
|
/// A [De Bruijn index][dbi] is a standard means of representing
|
||||||
/// regions (and perhaps later types) in a higher-ranked setting. In
|
/// regions (and perhaps later types) in a higher-ranked setting. In
|
||||||
/// particular, imagine a type like this:
|
/// particular, imagine a type like this:
|
||||||
|
@ -1003,7 +973,7 @@ impl Copy for ParamTy {}
|
||||||
/// is the outer fn.
|
/// is the outer fn.
|
||||||
///
|
///
|
||||||
/// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
|
/// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
||||||
pub struct DebruijnIndex {
|
pub struct DebruijnIndex {
|
||||||
// We maintain the invariant that this is never 0. So 1 indicates
|
// We maintain the invariant that this is never 0. So 1 indicates
|
||||||
// the innermost binder. To ensure this, create with `DebruijnIndex::new`.
|
// the innermost binder. To ensure this, create with `DebruijnIndex::new`.
|
||||||
|
@ -1011,7 +981,7 @@ pub struct DebruijnIndex {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Representation of regions:
|
/// Representation of regions:
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
||||||
pub enum Region {
|
pub enum Region {
|
||||||
// Region bound in a type or fn declaration which will be
|
// Region bound in a type or fn declaration which will be
|
||||||
// substituted 'early' -- that is, at the same time when type
|
// substituted 'early' -- that is, at the same time when type
|
||||||
|
@ -1052,15 +1022,13 @@ pub enum Region {
|
||||||
/// Upvars do not get their own node-id. Instead, we use the pair of
|
/// Upvars do not get their own node-id. Instead, we use the pair of
|
||||||
/// the original var id (that is, the root variable that is referenced
|
/// the original var id (that is, the root variable that is referenced
|
||||||
/// by the upvar) and the id of the closure expression.
|
/// by the upvar) and the id of the closure expression.
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||||
pub struct UpvarId {
|
pub struct UpvarId {
|
||||||
pub var_id: ast::NodeId,
|
pub var_id: ast::NodeId,
|
||||||
pub closure_expr_id: ast::NodeId,
|
pub closure_expr_id: ast::NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for UpvarId {}
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show, Encodable, Decodable)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show, Encodable, Decodable)]
|
|
||||||
pub enum BorrowKind {
|
pub enum BorrowKind {
|
||||||
/// Data must be immutable and is aliasable.
|
/// Data must be immutable and is aliasable.
|
||||||
ImmBorrow,
|
ImmBorrow,
|
||||||
|
@ -1106,8 +1074,6 @@ pub enum BorrowKind {
|
||||||
MutBorrow
|
MutBorrow
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for BorrowKind {}
|
|
||||||
|
|
||||||
/// Information describing the borrowing of an upvar. This is computed
|
/// Information describing the borrowing of an upvar. This is computed
|
||||||
/// during `typeck`, specifically by `regionck`. The general idea is
|
/// during `typeck`, specifically by `regionck`. The general idea is
|
||||||
/// that the compiler analyses treat closures like:
|
/// that the compiler analyses treat closures like:
|
||||||
|
@ -1155,7 +1121,7 @@ impl Copy for BorrowKind {}
|
||||||
/// - Through mutation, the borrowed upvars can actually escape
|
/// - Through mutation, the borrowed upvars can actually escape
|
||||||
/// the closure, so sometimes it is necessary for them to be larger
|
/// the closure, so sometimes it is necessary for them to be larger
|
||||||
/// than the closure lifetime itself.
|
/// than the closure lifetime itself.
|
||||||
#[deriving(PartialEq, Clone, Encodable, Decodable, Show)]
|
#[deriving(Copy, PartialEq, Clone, Encodable, Decodable, Show)]
|
||||||
pub struct UpvarBorrow {
|
pub struct UpvarBorrow {
|
||||||
pub kind: BorrowKind,
|
pub kind: BorrowKind,
|
||||||
pub region: ty::Region,
|
pub region: ty::Region,
|
||||||
|
@ -1163,8 +1129,6 @@ pub struct UpvarBorrow {
|
||||||
|
|
||||||
pub type UpvarBorrowMap = FnvHashMap<UpvarId, UpvarBorrow>;
|
pub type UpvarBorrowMap = FnvHashMap<UpvarId, UpvarBorrow>;
|
||||||
|
|
||||||
impl Copy for UpvarBorrow {}
|
|
||||||
|
|
||||||
impl Region {
|
impl Region {
|
||||||
pub fn is_bound(&self) -> bool {
|
pub fn is_bound(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -1182,9 +1146,7 @@ impl Region {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Region {}
|
#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)]
|
|
||||||
/// A "free" region `fr` can be interpreted as "some region
|
/// A "free" region `fr` can be interpreted as "some region
|
||||||
/// at least as big as the scope `fr.scope`".
|
/// at least as big as the scope `fr.scope`".
|
||||||
pub struct FreeRegion {
|
pub struct FreeRegion {
|
||||||
|
@ -1192,9 +1154,7 @@ pub struct FreeRegion {
|
||||||
pub bound_region: BoundRegion
|
pub bound_region: BoundRegion
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for FreeRegion {}
|
#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)]
|
|
||||||
pub enum BoundRegion {
|
pub enum BoundRegion {
|
||||||
/// An anonymous region parameter for a given fn (&T)
|
/// An anonymous region parameter for a given fn (&T)
|
||||||
BrAnon(uint),
|
BrAnon(uint),
|
||||||
|
@ -1213,8 +1173,6 @@ pub enum BoundRegion {
|
||||||
BrEnv
|
BrEnv
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for BoundRegion {}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn mk_prim_t<'tcx>(primitive: &'tcx TyS<'static>) -> Ty<'tcx> {
|
pub fn mk_prim_t<'tcx>(primitive: &'tcx TyS<'static>) -> Ty<'tcx> {
|
||||||
// FIXME(#17596) Ty<'tcx> is incorrectly invariant w.r.t 'tcx.
|
// FIXME(#17596) Ty<'tcx> is incorrectly invariant w.r.t 'tcx.
|
||||||
|
@ -1378,15 +1336,13 @@ impl<'tcx> PolyTraitRef<'tcx> {
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
||||||
pub struct Binder<T>(pub T);
|
pub struct Binder<T>(pub T);
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq)]
|
#[deriving(Clone, Copy, PartialEq)]
|
||||||
pub enum IntVarValue {
|
pub enum IntVarValue {
|
||||||
IntType(ast::IntTy),
|
IntType(ast::IntTy),
|
||||||
UintType(ast::UintTy),
|
UintType(ast::UintTy),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for IntVarValue {}
|
#[deriving(Clone, Copy, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, Show)]
|
|
||||||
pub enum terr_vstore_kind {
|
pub enum terr_vstore_kind {
|
||||||
terr_vec,
|
terr_vec,
|
||||||
terr_str,
|
terr_str,
|
||||||
|
@ -1394,18 +1350,14 @@ pub enum terr_vstore_kind {
|
||||||
terr_trait
|
terr_trait
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for terr_vstore_kind {}
|
#[deriving(Clone, Copy, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, Show)]
|
|
||||||
pub struct expected_found<T> {
|
pub struct expected_found<T> {
|
||||||
pub expected: T,
|
pub expected: T,
|
||||||
pub found: T
|
pub found: T
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy> Copy for expected_found<T> {}
|
|
||||||
|
|
||||||
// Data structures used in type unification
|
// Data structures used in type unification
|
||||||
#[deriving(Clone, Show)]
|
#[deriving(Clone, Copy, Show)]
|
||||||
pub enum type_err<'tcx> {
|
pub enum type_err<'tcx> {
|
||||||
terr_mismatch,
|
terr_mismatch,
|
||||||
terr_unsafety_mismatch(expected_found<ast::Unsafety>),
|
terr_unsafety_mismatch(expected_found<ast::Unsafety>),
|
||||||
|
@ -1438,8 +1390,6 @@ pub enum type_err<'tcx> {
|
||||||
terr_convergence_mismatch(expected_found<bool>)
|
terr_convergence_mismatch(expected_found<bool>)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Copy for type_err<'tcx> {}
|
|
||||||
|
|
||||||
/// Bounds suitable for a named type parameter like `A` in `fn foo<A>`
|
/// Bounds suitable for a named type parameter like `A` in `fn foo<A>`
|
||||||
/// as well as the existential type parameter in an object type.
|
/// as well as the existential type parameter in an object type.
|
||||||
#[deriving(PartialEq, Eq, Hash, Clone, Show)]
|
#[deriving(PartialEq, Eq, Hash, Clone, Show)]
|
||||||
|
@ -1454,17 +1404,15 @@ pub struct ParamBounds<'tcx> {
|
||||||
/// major difference between this case and `ParamBounds` is that
|
/// major difference between this case and `ParamBounds` is that
|
||||||
/// general purpose trait bounds are omitted and there must be
|
/// general purpose trait bounds are omitted and there must be
|
||||||
/// *exactly one* region.
|
/// *exactly one* region.
|
||||||
#[deriving(PartialEq, Eq, Hash, Clone, Show)]
|
#[deriving(Copy, PartialEq, Eq, Hash, Clone, Show)]
|
||||||
pub struct ExistentialBounds {
|
pub struct ExistentialBounds {
|
||||||
pub region_bound: ty::Region,
|
pub region_bound: ty::Region,
|
||||||
pub builtin_bounds: BuiltinBounds
|
pub builtin_bounds: BuiltinBounds
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ExistentialBounds {}
|
|
||||||
|
|
||||||
pub type BuiltinBounds = EnumSet<BuiltinBound>;
|
pub type BuiltinBounds = EnumSet<BuiltinBound>;
|
||||||
|
|
||||||
#[deriving(Clone, Encodable, PartialEq, Eq, Decodable, Hash, Show)]
|
#[deriving(Copy, Clone, Encodable, PartialEq, Eq, Decodable, Hash, Show)]
|
||||||
#[repr(uint)]
|
#[repr(uint)]
|
||||||
pub enum BuiltinBound {
|
pub enum BuiltinBound {
|
||||||
BoundSend,
|
BoundSend,
|
||||||
|
@ -1473,8 +1421,6 @@ pub enum BuiltinBound {
|
||||||
BoundSync,
|
BoundSync,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for BuiltinBound {}
|
|
||||||
|
|
||||||
pub fn empty_builtin_bounds() -> BuiltinBounds {
|
pub fn empty_builtin_bounds() -> BuiltinBounds {
|
||||||
EnumSet::new()
|
EnumSet::new()
|
||||||
}
|
}
|
||||||
|
@ -1502,35 +1448,27 @@ impl CLike for BuiltinBound {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct TyVid {
|
pub struct TyVid {
|
||||||
pub index: uint
|
pub index: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for TyVid {}
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash)]
|
|
||||||
pub struct IntVid {
|
pub struct IntVid {
|
||||||
pub index: uint
|
pub index: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for IntVid {}
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash)]
|
|
||||||
pub struct FloatVid {
|
pub struct FloatVid {
|
||||||
pub index: uint
|
pub index: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for FloatVid {}
|
#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
|
|
||||||
pub struct RegionVid {
|
pub struct RegionVid {
|
||||||
pub index: uint
|
pub index: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for RegionVid {}
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Hash)]
|
|
||||||
pub enum InferTy {
|
pub enum InferTy {
|
||||||
TyVar(TyVid),
|
TyVar(TyVid),
|
||||||
IntVar(IntVid),
|
IntVar(IntVid),
|
||||||
|
@ -1547,16 +1485,12 @@ pub enum InferTy {
|
||||||
FreshIntTy(uint),
|
FreshIntTy(uint),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for InferTy {}
|
#[deriving(Clone, Copy, Encodable, Decodable, Eq, Hash, Show)]
|
||||||
|
|
||||||
#[deriving(Clone, Encodable, Decodable, Eq, Hash, Show)]
|
|
||||||
pub enum InferRegion {
|
pub enum InferRegion {
|
||||||
ReVar(RegionVid),
|
ReVar(RegionVid),
|
||||||
ReSkolemized(uint, BoundRegion)
|
ReSkolemized(uint, BoundRegion)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for InferRegion {}
|
|
||||||
|
|
||||||
impl cmp::PartialEq for InferRegion {
|
impl cmp::PartialEq for InferRegion {
|
||||||
fn eq(&self, other: &InferRegion) -> bool {
|
fn eq(&self, other: &InferRegion) -> bool {
|
||||||
match ((*self), *other) {
|
match ((*self), *other) {
|
||||||
|
@ -2006,15 +1940,13 @@ pub struct UnboxedClosure<'tcx> {
|
||||||
pub kind: UnboxedClosureKind,
|
pub kind: UnboxedClosureKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, Eq, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Show)]
|
||||||
pub enum UnboxedClosureKind {
|
pub enum UnboxedClosureKind {
|
||||||
FnUnboxedClosureKind,
|
FnUnboxedClosureKind,
|
||||||
FnMutUnboxedClosureKind,
|
FnMutUnboxedClosureKind,
|
||||||
FnOnceUnboxedClosureKind,
|
FnOnceUnboxedClosureKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for UnboxedClosureKind {}
|
|
||||||
|
|
||||||
impl UnboxedClosureKind {
|
impl UnboxedClosureKind {
|
||||||
pub fn trait_did(&self, cx: &ctxt) -> ast::DefId {
|
pub fn trait_did(&self, cx: &ctxt) -> ast::DefId {
|
||||||
let result = match *self {
|
let result = match *self {
|
||||||
|
@ -2795,13 +2727,11 @@ pub fn type_needs_unwind_cleanup<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
|
||||||
/// The reason we compute type contents and not kinds is that it is
|
/// The reason we compute type contents and not kinds is that it is
|
||||||
/// easier for me (nmatsakis) to think about what is contained within
|
/// easier for me (nmatsakis) to think about what is contained within
|
||||||
/// a type than to think about what is *not* contained within a type.
|
/// a type than to think about what is *not* contained within a type.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone, Copy)]
|
||||||
pub struct TypeContents {
|
pub struct TypeContents {
|
||||||
pub bits: u64
|
pub bits: u64
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for TypeContents {}
|
|
||||||
|
|
||||||
macro_rules! def_type_content_sets {
|
macro_rules! def_type_content_sets {
|
||||||
(mod $mname:ident { $($name:ident = $bits:expr),+ }) => {
|
(mod $mname:ident { $($name:ident = $bits:expr),+ }) => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
@ -3443,15 +3373,13 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool {
|
||||||
///
|
///
|
||||||
/// The ordering of the cases is significant. They are sorted so that cmp::max
|
/// The ordering of the cases is significant. They are sorted so that cmp::max
|
||||||
/// will keep the "more erroneous" of two values.
|
/// will keep the "more erroneous" of two values.
|
||||||
#[deriving(PartialOrd, Ord, Eq, PartialEq, Show)]
|
#[deriving(Copy, PartialOrd, Ord, Eq, PartialEq, Show)]
|
||||||
pub enum Representability {
|
pub enum Representability {
|
||||||
Representable,
|
Representable,
|
||||||
ContainsRecursive,
|
ContainsRecursive,
|
||||||
SelfRecursive,
|
SelfRecursive,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Representability {}
|
|
||||||
|
|
||||||
/// Check whether a type is representable. This means it cannot contain unboxed
|
/// Check whether a type is representable. This means it cannot contain unboxed
|
||||||
/// structural recursion. This check is needed for structs and enums.
|
/// structural recursion. This check is needed for structs and enums.
|
||||||
pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
|
pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
|
||||||
|
@ -4228,6 +4156,7 @@ pub fn expr_is_lval(tcx: &ctxt, e: &ast::Expr) -> bool {
|
||||||
/// two kinds of rvalues is an artifact of trans which reflects how we will
|
/// two kinds of rvalues is an artifact of trans which reflects how we will
|
||||||
/// generate code for that kind of expression. See trans/expr.rs for more
|
/// generate code for that kind of expression. See trans/expr.rs for more
|
||||||
/// information.
|
/// information.
|
||||||
|
#[deriving(Copy)]
|
||||||
pub enum ExprKind {
|
pub enum ExprKind {
|
||||||
LvalueExpr,
|
LvalueExpr,
|
||||||
RvalueDpsExpr,
|
RvalueDpsExpr,
|
||||||
|
@ -4235,8 +4164,6 @@ pub enum ExprKind {
|
||||||
RvalueStmtExpr
|
RvalueStmtExpr
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ExprKind {}
|
|
||||||
|
|
||||||
pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
|
pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
|
||||||
if tcx.method_map.borrow().contains_key(&MethodCall::expr(expr.id)) {
|
if tcx.method_map.borrow().contains_key(&MethodCall::expr(expr.id)) {
|
||||||
// Overloaded operations are generally calls, and hence they are
|
// Overloaded operations are generally calls, and hence they are
|
||||||
|
@ -4791,15 +4718,13 @@ pub fn associated_type_parameter_index(cx: &ctxt,
|
||||||
cx.sess.bug("couldn't find associated type parameter index")
|
cx.sess.bug("couldn't find associated type parameter index")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq, Eq)]
|
#[deriving(Copy, PartialEq, Eq)]
|
||||||
pub struct AssociatedTypeInfo {
|
pub struct AssociatedTypeInfo {
|
||||||
pub def_id: ast::DefId,
|
pub def_id: ast::DefId,
|
||||||
pub index: uint,
|
pub index: uint,
|
||||||
pub name: ast::Name,
|
pub name: ast::Name,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for AssociatedTypeInfo {}
|
|
||||||
|
|
||||||
impl PartialOrd for AssociatedTypeInfo {
|
impl PartialOrd for AssociatedTypeInfo {
|
||||||
fn partial_cmp(&self, other: &AssociatedTypeInfo) -> Option<Ordering> {
|
fn partial_cmp(&self, other: &AssociatedTypeInfo) -> Option<Ordering> {
|
||||||
Some(self.index.cmp(&other.index))
|
Some(self.index.cmp(&other.index))
|
||||||
|
@ -4979,13 +4904,12 @@ pub fn item_path_str(cx: &ctxt, id: ast::DefId) -> String {
|
||||||
with_path(cx, id, |path| ast_map::path_to_string(path)).to_string()
|
with_path(cx, id, |path| ast_map::path_to_string(path)).to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub enum DtorKind {
|
pub enum DtorKind {
|
||||||
NoDtor,
|
NoDtor,
|
||||||
TraitDtor(DefId, bool)
|
TraitDtor(DefId, bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for DtorKind {}
|
|
||||||
|
|
||||||
impl DtorKind {
|
impl DtorKind {
|
||||||
pub fn is_present(&self) -> bool {
|
pub fn is_present(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -5403,14 +5327,13 @@ pub fn tup_fields<'tcx>(v: &[Ty<'tcx>]) -> Vec<field<'tcx>> {
|
||||||
}).collect()
|
}).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct UnboxedClosureUpvar<'tcx> {
|
pub struct UnboxedClosureUpvar<'tcx> {
|
||||||
pub def: def::Def,
|
pub def: def::Def,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub ty: Ty<'tcx>,
|
pub ty: Ty<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Copy for UnboxedClosureUpvar<'tcx> {}
|
|
||||||
|
|
||||||
// Returns a list of `UnboxedClosureUpvar`s for each upvar.
|
// Returns a list of `UnboxedClosureUpvar`s for each upvar.
|
||||||
pub fn unboxed_closure_upvars<'tcx>(tcx: &ctxt<'tcx>, closure_id: ast::DefId, substs: &Substs<'tcx>)
|
pub fn unboxed_closure_upvars<'tcx>(tcx: &ctxt<'tcx>, closure_id: ast::DefId, substs: &Substs<'tcx>)
|
||||||
-> Vec<UnboxedClosureUpvar<'tcx>> {
|
-> Vec<UnboxedClosureUpvar<'tcx>> {
|
||||||
|
@ -6259,7 +6182,7 @@ impl<'tcx> mc::Typer<'tcx> for ty::ctxt<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The category of explicit self.
|
/// The category of explicit self.
|
||||||
#[deriving(Clone, Eq, PartialEq, Show)]
|
#[deriving(Clone, Copy, Eq, PartialEq, Show)]
|
||||||
pub enum ExplicitSelfCategory {
|
pub enum ExplicitSelfCategory {
|
||||||
StaticExplicitSelfCategory,
|
StaticExplicitSelfCategory,
|
||||||
ByValueExplicitSelfCategory,
|
ByValueExplicitSelfCategory,
|
||||||
|
@ -6267,8 +6190,6 @@ pub enum ExplicitSelfCategory {
|
||||||
ByBoxExplicitSelfCategory,
|
ByBoxExplicitSelfCategory,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ExplicitSelfCategory {}
|
|
||||||
|
|
||||||
/// Pushes all the lifetimes in the given type onto the given list. A
|
/// Pushes all the lifetimes in the given type onto the given list. A
|
||||||
/// "lifetime in a type" is a lifetime specified by a reference or a lifetime
|
/// "lifetime in a type" is a lifetime specified by a reference or a lifetime
|
||||||
/// in a list of type substitutions. This does *not* traverse into nominal
|
/// in a list of type substitutions. This does *not* traverse into nominal
|
||||||
|
@ -6329,7 +6250,7 @@ pub fn accumulate_lifetimes_in_type(accumulator: &mut Vec<ty::Region>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A free variable referred to in a function.
|
/// A free variable referred to in a function.
|
||||||
#[deriving(Encodable, Decodable)]
|
#[deriving(Copy, Encodable, Decodable)]
|
||||||
pub struct Freevar {
|
pub struct Freevar {
|
||||||
/// The variable being accessed free.
|
/// The variable being accessed free.
|
||||||
pub def: def::Def,
|
pub def: def::Def,
|
||||||
|
@ -6338,8 +6259,6 @@ pub struct Freevar {
|
||||||
pub span: Span
|
pub span: Span
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for Freevar {}
|
|
||||||
|
|
||||||
pub type FreevarMap = NodeMap<Vec<Freevar>>;
|
pub type FreevarMap = NodeMap<Vec<Freevar>>;
|
||||||
|
|
||||||
pub type CaptureModeMap = NodeMap<ast::CaptureClause>;
|
pub type CaptureModeMap = NodeMap<ast::CaptureClause>;
|
||||||
|
@ -6469,8 +6388,6 @@ impl DebruijnIndex {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for DebruijnIndex {}
|
|
||||||
|
|
||||||
impl<'tcx> Repr<'tcx> for AutoAdjustment<'tcx> {
|
impl<'tcx> Repr<'tcx> for AutoAdjustment<'tcx> {
|
||||||
fn repr(&self, tcx: &ctxt<'tcx>) -> String {
|
fn repr(&self, tcx: &ctxt<'tcx>) -> String {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -6589,14 +6506,13 @@ pub fn make_substs_for_receiver_types<'tcx>(tcx: &ty::ctxt<'tcx>,
|
||||||
trait_ref.substs.clone().with_method(meth_tps, meth_regions)
|
trait_ref.substs.clone().with_method(meth_tps, meth_regions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
pub enum CopyImplementationError {
|
pub enum CopyImplementationError {
|
||||||
FieldDoesNotImplementCopy(ast::Name),
|
FieldDoesNotImplementCopy(ast::Name),
|
||||||
VariantDoesNotImplementCopy(ast::Name),
|
VariantDoesNotImplementCopy(ast::Name),
|
||||||
TypeIsStructural,
|
TypeIsStructural,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for CopyImplementationError {}
|
|
||||||
|
|
||||||
pub fn can_type_implement_copy<'tcx>(tcx: &ctxt<'tcx>,
|
pub fn can_type_implement_copy<'tcx>(tcx: &ctxt<'tcx>,
|
||||||
self_type: Ty<'tcx>,
|
self_type: Ty<'tcx>,
|
||||||
param_env: &ParameterEnvironment<'tcx>)
|
param_env: &ParameterEnvironment<'tcx>)
|
||||||
|
|
|
@ -47,7 +47,7 @@ pub struct Config {
|
||||||
pub uint_type: UintTy,
|
pub uint_type: UintTy,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq)]
|
#[deriving(Clone, Copy, PartialEq)]
|
||||||
pub enum OptLevel {
|
pub enum OptLevel {
|
||||||
No, // -O0
|
No, // -O0
|
||||||
Less, // -O1
|
Less, // -O1
|
||||||
|
@ -55,18 +55,14 @@ pub enum OptLevel {
|
||||||
Aggressive // -O3
|
Aggressive // -O3
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for OptLevel {}
|
#[deriving(Clone, Copy, PartialEq)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq)]
|
|
||||||
pub enum DebugInfoLevel {
|
pub enum DebugInfoLevel {
|
||||||
NoDebugInfo,
|
NoDebugInfo,
|
||||||
LimitedDebugInfo,
|
LimitedDebugInfo,
|
||||||
FullDebugInfo,
|
FullDebugInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for DebugInfoLevel {}
|
#[deriving(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
|
||||||
|
|
||||||
#[deriving(Clone, PartialEq, PartialOrd, Ord, Eq)]
|
|
||||||
pub enum OutputType {
|
pub enum OutputType {
|
||||||
OutputTypeBitcode,
|
OutputTypeBitcode,
|
||||||
OutputTypeAssembly,
|
OutputTypeAssembly,
|
||||||
|
@ -75,8 +71,6 @@ pub enum OutputType {
|
||||||
OutputTypeExe,
|
OutputTypeExe,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for OutputType {}
|
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Options {
|
pub struct Options {
|
||||||
// The crate config requested for the session, which may be combined
|
// The crate config requested for the session, which may be combined
|
||||||
|
@ -220,16 +214,14 @@ pub fn basic_options() -> Options {
|
||||||
// users can have their own entry
|
// users can have their own entry
|
||||||
// functions that don't start a
|
// functions that don't start a
|
||||||
// scheduler
|
// scheduler
|
||||||
#[deriving(PartialEq)]
|
#[deriving(Copy, PartialEq)]
|
||||||
pub enum EntryFnType {
|
pub enum EntryFnType {
|
||||||
EntryMain,
|
EntryMain,
|
||||||
EntryStart,
|
EntryStart,
|
||||||
EntryNone,
|
EntryNone,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for EntryFnType {}
|
#[deriving(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash)]
|
||||||
|
|
||||||
#[deriving(PartialEq, PartialOrd, Clone, Ord, Eq, Hash)]
|
|
||||||
pub enum CrateType {
|
pub enum CrateType {
|
||||||
CrateTypeExecutable,
|
CrateTypeExecutable,
|
||||||
CrateTypeDylib,
|
CrateTypeDylib,
|
||||||
|
@ -237,8 +229,6 @@ pub enum CrateType {
|
||||||
CrateTypeStaticlib,
|
CrateTypeStaticlib,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for CrateType {}
|
|
||||||
|
|
||||||
macro_rules! debugging_opts {
|
macro_rules! debugging_opts {
|
||||||
([ $opt:ident ] $cnt:expr ) => (
|
([ $opt:ident ] $cnt:expr ) => (
|
||||||
pub const $opt: u64 = 1 << $cnt;
|
pub const $opt: u64 = 1 << $cnt;
|
||||||
|
|
|
@ -22,11 +22,9 @@ use syntax::visit::Visitor;
|
||||||
|
|
||||||
// Useful type to use with `Result<>` indicate that an error has already
|
// Useful type to use with `Result<>` indicate that an error has already
|
||||||
// been reported to the user, so no need to continue checking.
|
// been reported to the user, so no need to continue checking.
|
||||||
#[deriving(Clone,Show)]
|
#[deriving(Clone, Copy, Show)]
|
||||||
pub struct ErrorReported;
|
pub struct ErrorReported;
|
||||||
|
|
||||||
impl Copy for ErrorReported {}
|
|
||||||
|
|
||||||
pub fn time<T, U, F>(do_it: bool, what: &str, u: U, f: F) -> T where
|
pub fn time<T, U, F>(do_it: bool, what: &str, u: U, f: F) -> T where
|
||||||
F: FnOnce(U) -> T,
|
F: FnOnce(U) -> T,
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,11 +68,9 @@ pub mod DefIdSet {
|
||||||
///
|
///
|
||||||
/// This uses FNV hashing, as described here:
|
/// This uses FNV hashing, as described here:
|
||||||
/// http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
|
/// http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
|
||||||
#[deriving(Clone, Default)]
|
#[deriving(Clone, Copy, Default)]
|
||||||
pub struct FnvHasher;
|
pub struct FnvHasher;
|
||||||
|
|
||||||
impl Copy for FnvHasher {}
|
|
||||||
|
|
||||||
#[allow(missing_copy_implementations)]
|
#[allow(missing_copy_implementations)]
|
||||||
pub struct FnvState(u64);
|
pub struct FnvState(u64);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue