librustc_typeck: use #[deriving(Copy)]
This commit is contained in:
parent
5e2bca9e86
commit
fa0383f38d
6 changed files with 11 additions and 27 deletions
|
@ -46,14 +46,12 @@ pub enum MethodError {
|
||||||
|
|
||||||
// A pared down enum describing just the places from which a method
|
// A pared down enum describing just the places from which a method
|
||||||
// candidate can arise. Used for error reporting only.
|
// candidate can arise. Used for error reporting only.
|
||||||
#[deriving(PartialOrd, Ord, PartialEq, Eq)]
|
#[deriving(Copy, PartialOrd, Ord, PartialEq, Eq)]
|
||||||
pub enum CandidateSource {
|
pub enum CandidateSource {
|
||||||
ImplSource(ast::DefId),
|
ImplSource(ast::DefId),
|
||||||
TraitSource(/* trait id */ ast::DefId),
|
TraitSource(/* trait id */ ast::DefId),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for CandidateSource {}
|
|
||||||
|
|
||||||
type MethodIndex = uint; // just for doc purposes
|
type MethodIndex = uint; // just for doc purposes
|
||||||
|
|
||||||
/// Determines whether the type `self_ty` supports a method name `method_name` or not.
|
/// Determines whether the type `self_ty` supports a method name `method_name` or not.
|
||||||
|
|
|
@ -166,6 +166,7 @@ pub struct Inherited<'a, 'tcx: 'a> {
|
||||||
|
|
||||||
/// When type-checking an expression, we propagate downward
|
/// When type-checking an expression, we propagate downward
|
||||||
/// whatever type hint we are able in the form of an `Expectation`.
|
/// whatever type hint we are able in the form of an `Expectation`.
|
||||||
|
#[deriving(Copy)]
|
||||||
enum Expectation<'tcx> {
|
enum Expectation<'tcx> {
|
||||||
/// We know nothing about what type this expression should have.
|
/// We know nothing about what type this expression should have.
|
||||||
NoExpectation,
|
NoExpectation,
|
||||||
|
@ -177,8 +178,6 @@ enum Expectation<'tcx> {
|
||||||
ExpectCastableToType(Ty<'tcx>),
|
ExpectCastableToType(Ty<'tcx>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Copy for Expectation<'tcx> {}
|
|
||||||
|
|
||||||
impl<'tcx> Expectation<'tcx> {
|
impl<'tcx> Expectation<'tcx> {
|
||||||
// Disregard "castable to" expectations because they
|
// Disregard "castable to" expectations because they
|
||||||
// can lead us astray. Consider for example `if cond
|
// can lead us astray. Consider for example `if cond
|
||||||
|
@ -1976,14 +1975,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[deriving(Copy, Show)]
|
||||||
pub enum LvaluePreference {
|
pub enum LvaluePreference {
|
||||||
PreferMutLvalue,
|
PreferMutLvalue,
|
||||||
NoPreference
|
NoPreference
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for LvaluePreference {}
|
|
||||||
|
|
||||||
/// Executes an autoderef loop for the type `t`. At each step, invokes `should_stop` to decide
|
/// Executes an autoderef loop for the type `t`. At each step, invokes `should_stop` to decide
|
||||||
/// whether to terminate the loop. Returns the final type and number of derefs that it performed.
|
/// whether to terminate the loop. Returns the final type and number of derefs that it performed.
|
||||||
///
|
///
|
||||||
|
@ -2856,14 +2853,12 @@ pub fn lookup_tup_field_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
|
||||||
|
|
||||||
// Controls whether the arguments are automatically referenced. This is useful
|
// Controls whether the arguments are automatically referenced. This is useful
|
||||||
// for overloaded binary and unary operators.
|
// for overloaded binary and unary operators.
|
||||||
#[deriving(PartialEq)]
|
#[deriving(Copy, PartialEq)]
|
||||||
pub enum AutorefArgs {
|
pub enum AutorefArgs {
|
||||||
Yes,
|
Yes,
|
||||||
No,
|
No,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for AutorefArgs {}
|
|
||||||
|
|
||||||
/// Controls whether the arguments are tupled. This is used for the call
|
/// Controls whether the arguments are tupled. This is used for the call
|
||||||
/// operator.
|
/// operator.
|
||||||
///
|
///
|
||||||
|
|
|
@ -343,6 +343,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Resolution reason.
|
// Resolution reason.
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
enum ResolveReason {
|
enum ResolveReason {
|
||||||
ResolvingExpr(Span),
|
ResolvingExpr(Span),
|
||||||
ResolvingLocal(Span),
|
ResolvingLocal(Span),
|
||||||
|
@ -351,8 +352,6 @@ enum ResolveReason {
|
||||||
ResolvingUnboxedClosure(ast::DefId),
|
ResolvingUnboxedClosure(ast::DefId),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ResolveReason {}
|
|
||||||
|
|
||||||
impl ResolveReason {
|
impl ResolveReason {
|
||||||
fn span(&self, tcx: &ty::ctxt) -> Span {
|
fn span(&self, tcx: &ty::ctxt) -> Span {
|
||||||
match *self {
|
match *self {
|
||||||
|
|
|
@ -490,6 +490,7 @@ fn convert_associated_type<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Copy)]
|
||||||
enum ConvertMethodContext<'a> {
|
enum ConvertMethodContext<'a> {
|
||||||
/// Used when converting implementation methods.
|
/// Used when converting implementation methods.
|
||||||
ImplConvertMethodContext,
|
ImplConvertMethodContext,
|
||||||
|
@ -498,8 +499,6 @@ enum ConvertMethodContext<'a> {
|
||||||
TraitConvertMethodContext(ast::DefId, &'a [ast::TraitItem]),
|
TraitConvertMethodContext(ast::DefId, &'a [ast::TraitItem]),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Copy for ConvertMethodContext<'a> {}
|
|
||||||
|
|
||||||
fn convert_methods<'a,'tcx,'i,I>(ccx: &CrateCtxt<'a, 'tcx>,
|
fn convert_methods<'a,'tcx,'i,I>(ccx: &CrateCtxt<'a, 'tcx>,
|
||||||
convert_method_context: ConvertMethodContext,
|
convert_method_context: ConvertMethodContext,
|
||||||
container: ImplOrTraitItemContainer,
|
container: ImplOrTraitItemContainer,
|
||||||
|
|
|
@ -36,10 +36,9 @@ pub trait RegionScope {
|
||||||
|
|
||||||
// A scope in which all regions must be explicitly named. This is used
|
// A scope in which all regions must be explicitly named. This is used
|
||||||
// for types that appear in structs and so on.
|
// for types that appear in structs and so on.
|
||||||
|
#[deriving(Copy)]
|
||||||
pub struct ExplicitRscope;
|
pub struct ExplicitRscope;
|
||||||
|
|
||||||
impl Copy for ExplicitRscope {}
|
|
||||||
|
|
||||||
impl RegionScope for ExplicitRscope {
|
impl RegionScope for ExplicitRscope {
|
||||||
fn default_region_bound(&self, _span: Span) -> Option<ty::Region> {
|
fn default_region_bound(&self, _span: Span) -> Option<ty::Region> {
|
||||||
None
|
None
|
||||||
|
|
|
@ -229,19 +229,16 @@ pub fn infer_variance(tcx: &ty::ctxt) {
|
||||||
|
|
||||||
type VarianceTermPtr<'a> = &'a VarianceTerm<'a>;
|
type VarianceTermPtr<'a> = &'a VarianceTerm<'a>;
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[deriving(Copy, Show)]
|
||||||
struct InferredIndex(uint);
|
struct InferredIndex(uint);
|
||||||
|
|
||||||
impl Copy for InferredIndex {}
|
#[deriving(Copy)]
|
||||||
|
|
||||||
enum VarianceTerm<'a> {
|
enum VarianceTerm<'a> {
|
||||||
ConstantTerm(ty::Variance),
|
ConstantTerm(ty::Variance),
|
||||||
TransformTerm(VarianceTermPtr<'a>, VarianceTermPtr<'a>),
|
TransformTerm(VarianceTermPtr<'a>, VarianceTermPtr<'a>),
|
||||||
InferredTerm(InferredIndex),
|
InferredTerm(InferredIndex),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Copy for VarianceTerm<'a> {}
|
|
||||||
|
|
||||||
impl<'a> fmt::Show for VarianceTerm<'a> {
|
impl<'a> fmt::Show for VarianceTerm<'a> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -268,14 +265,12 @@ struct TermsContext<'a, 'tcx: 'a> {
|
||||||
inferred_infos: Vec<InferredInfo<'a>> ,
|
inferred_infos: Vec<InferredInfo<'a>> ,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Show, PartialEq)]
|
#[deriving(Copy, Show, PartialEq)]
|
||||||
enum ParamKind {
|
enum ParamKind {
|
||||||
TypeParam,
|
TypeParam,
|
||||||
RegionParam
|
RegionParam
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for ParamKind {}
|
|
||||||
|
|
||||||
struct InferredInfo<'a> {
|
struct InferredInfo<'a> {
|
||||||
item_id: ast::NodeId,
|
item_id: ast::NodeId,
|
||||||
kind: ParamKind,
|
kind: ParamKind,
|
||||||
|
@ -427,13 +422,12 @@ struct ConstraintContext<'a, 'tcx: 'a> {
|
||||||
|
|
||||||
/// Declares that the variable `decl_id` appears in a location with
|
/// Declares that the variable `decl_id` appears in a location with
|
||||||
/// variance `variance`.
|
/// variance `variance`.
|
||||||
|
#[deriving(Copy)]
|
||||||
struct Constraint<'a> {
|
struct Constraint<'a> {
|
||||||
inferred: InferredIndex,
|
inferred: InferredIndex,
|
||||||
variance: &'a VarianceTerm<'a>,
|
variance: &'a VarianceTerm<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Copy for Constraint<'a> {}
|
|
||||||
|
|
||||||
fn add_constraints_from_crate<'a, 'tcx>(terms_cx: TermsContext<'a, 'tcx>,
|
fn add_constraints_from_crate<'a, 'tcx>(terms_cx: TermsContext<'a, 'tcx>,
|
||||||
krate: &ast::Crate)
|
krate: &ast::Crate)
|
||||||
-> ConstraintContext<'a, 'tcx> {
|
-> ConstraintContext<'a, 'tcx> {
|
||||||
|
|
Loading…
Reference in a new issue