Auto merge of #21677 - japaric:no-range, r=alexcrichton

Note: Do not merge until we get a newer snapshot that includes #21374

There was some type inference fallout (see 4th commit) because type inference with `a..b` is not as good as with `range(a, b)` (see #21672).

r? @alexcrichton
This commit is contained in:
bors 2015-01-29 16:28:52 +00:00
commit 265a23320d
366 changed files with 1314 additions and 1337 deletions

View file

@ -540,7 +540,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
run_lints!(self, exit_lint_attrs, attrs);
// rollback
for _ in range(0, pushed) {
for _ in 0..pushed {
let (lint, lvlsrc) = self.level_stack.pop().unwrap();
self.lints.set_level(lint, lvlsrc);
}

View file

@ -40,7 +40,7 @@ use syntax::ast;
pub use lint::context::{Context, LintStore, raw_emit_lint, check_crate, gather_attrs};
/// Specification of a single lint.
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
pub struct Lint {
/// A string identifier for the lint.
///
@ -207,7 +207,7 @@ impl LintId {
}
/// Setting for how to handle a lint.
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show)]
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug)]
pub enum Level {
Allow, Warn, Deny, Forbid
}

View file

@ -219,7 +219,7 @@ pub const tag_items_data_item_stability: uint = 0x92;
pub const tag_items_data_item_repr: uint = 0x93;
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct LinkMeta {
pub crate_name: String,
pub crate_hash: Svh,

View file

@ -49,7 +49,7 @@ pub struct crate_metadata {
pub span: Span,
}
#[derive(Copy, Show, PartialEq, Clone)]
#[derive(Copy, Debug, PartialEq, Clone)]
pub enum LinkagePreference {
RequireDynamic,
RequireStatic,

View file

@ -493,7 +493,7 @@ pub fn get_symbol(data: &[u8], id: ast::NodeId) -> String {
}
// Something that a name can resolve to.
#[derive(Copy, Clone, Show)]
#[derive(Copy, Clone, Debug)]
pub enum DefLike {
DlDef(def::Def),
DlImpl(ast::DefId),

View file

@ -1598,7 +1598,7 @@ fn encode_index<T, F>(rbml_w: &mut Encoder, index: Vec<entry<T>>, mut write_fn:
F: FnMut(&mut SeekableMemWriter, &T),
T: Hash<SipHasher>,
{
let mut buckets: Vec<Vec<entry<T>>> = range(0, 256u16).map(|_| Vec::new()).collect();
let mut buckets: Vec<Vec<entry<T>>> = (0..256u16).map(|_| Vec::new()).collect();
for elt in index.into_iter() {
let mut s = SipHasher::new();
elt.val.hash(&mut s);

View file

@ -43,7 +43,7 @@ use syntax::parse::token;
// 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
// astencode.rs for more information.
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
pub enum DefIdSource {
// Identifies a struct, trait, enum, etc.
NominalType,
@ -132,7 +132,7 @@ pub fn parse_state_from_data<'a, 'tcx>(data: &'a [u8], crate_num: ast::CrateNum,
fn data_log_string(data: &[u8], pos: uint) -> String {
let mut buf = String::new();
buf.push_str("<<");
for i in range(pos, data.len()) {
for i in pos..data.len() {
let c = data[i];
if c > 0x20 && c <= 0x7F {
buf.push(c as char);

View file

@ -1293,7 +1293,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
}
ty::AdjustDerefRef(ref adj) => {
assert!(!ty::adjust_is_object(adjustment));
for autoderef in range(0, adj.autoderefs) {
for autoderef in 0..adj.autoderefs {
let method_call = MethodCall::autoderef(id, autoderef);
for &method in tcx.method_map.borrow().get(&method_call).iter() {
rbml_w.tag(c::tag_table_method_map, |rbml_w| {
@ -1529,7 +1529,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
fn type_string(doc: rbml::Doc) -> String {
let mut str = String::new();
for i in range(doc.start, doc.end) {
for i in doc.start..doc.end {
str.push(doc.data[i] as char);
}
str

View file

@ -70,7 +70,7 @@ impl<'a> fmt::Debug for Matrix<'a> {
let column_count = m.iter().map(|row| row.len()).max().unwrap_or(0u);
assert!(m.iter().all(|row| row.len() == column_count));
let column_widths: Vec<uint> = range(0, column_count).map(|col| {
let column_widths: Vec<uint> = (0..column_count).map(|col| {
pretty_printed_matrix.iter().map(|row| row[col].len()).max().unwrap_or(0u)
}).collect();
@ -609,7 +609,7 @@ fn is_useful(cx: &MatchCheckCtxt,
let arity = constructor_arity(cx, &c, left_ty);
let mut result = {
let pat_slice = &pats[];
let subpats: Vec<_> = range(0, arity).map(|i| {
let subpats: Vec<_> = (0..arity).map(|i| {
pat_slice.get(i).map_or(DUMMY_WILD_PAT, |p| &**p)
}).collect();
vec![construct_witness(cx, &c, subpats, left_ty)]

View file

@ -28,7 +28,7 @@ use syntax::visit;
use syntax::print::{pp, pprust};
use util::nodemap::NodeMap;
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
pub enum EntryOrExit {
Entry,
Exit,
@ -352,7 +352,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
for (word_index, &word) in words.iter().enumerate() {
if word != 0 {
let base_index = word_index * uint::BITS;
for offset in range(0u, uint::BITS) {
for offset in 0u..uint::BITS {
let bit = 1 << offset;
if (word & bit) != 0 {
// NB: we round up the total number of bits
@ -552,7 +552,7 @@ fn bits_to_string(words: &[uint]) -> String {
for &word in words.iter() {
let mut v = word;
for _ in range(0u, uint::BYTES) {
for _ in 0u..uint::BYTES {
result.push(sep);
result.push_str(&format!("{:02x}", v & 0xFF)[]);
v >>= 8;

View file

@ -20,7 +20,7 @@ use syntax::ast_util::local_def;
use std::cell::RefCell;
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum Def {
DefFn(ast::DefId, bool /* is_ctor */),
DefStaticMethod(/* method */ ast::DefId, MethodProvenance),
@ -72,13 +72,13 @@ pub struct Export {
pub def_id: ast::DefId, // The definition of the target.
}
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum MethodProvenance {
FromTrait(ast::DefId),
FromImpl(ast::DefId),
}
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum TyParamProvenance {
FromSelf(ast::DefId),
FromParam(ast::DefId),

View file

@ -157,7 +157,7 @@ fn calculate_type(sess: &session::Session,
});
// Collect what we've got so far in the return vector.
let mut ret = range(1, sess.cstore.next_crate_num()).map(|i| {
let mut ret = (1..sess.cstore.next_crate_num()).map(|i| {
match formats.get(&i).map(|v| *v) {
v @ Some(cstore::RequireDynamic) => v,
_ => None,

View file

@ -95,7 +95,7 @@ pub trait Delegate<'tcx> {
mode: MutateMode);
}
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub enum LoanCause {
ClosureCapture(Span),
AddrOf,
@ -107,20 +107,20 @@ pub enum LoanCause {
MatchDiscriminant
}
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub enum ConsumeMode {
Copy, // reference to x where x has a type that copies
Move(MoveReason), // reference to x where x has a type that moves
}
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub enum MoveReason {
DirectRefMove,
PatBindingMove,
CaptureMove,
}
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub enum MatchMode {
NonBindingMatch,
BorrowingMatch,
@ -128,7 +128,7 @@ pub enum MatchMode {
MovingMatch,
}
#[derive(PartialEq,Show)]
#[derive(PartialEq,Debug)]
enum TrackMatchMode<T> {
Unknown,
Definite(MatchMode),
@ -197,7 +197,7 @@ impl<T> TrackMatchMode<T> {
}
}
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub enum MutateMode {
Init,
JustWrite, // x = y
@ -842,7 +842,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
autoderefs: uint) {
debug!("walk_autoderefs expr={} autoderefs={}", expr.repr(self.tcx()), autoderefs);
for i in range(0, autoderefs) {
for i in 0..autoderefs {
let deref_id = ty::MethodCall::autoderef(expr.id, i);
match self.typer.node_method_ty(deref_id) {
None => {}

View file

@ -61,18 +61,18 @@ impl<E: Debug> Debug for Edge<E> {
}
}
#[derive(Clone, Copy, PartialEq, Show)]
#[derive(Clone, Copy, PartialEq, Debug)]
pub struct NodeIndex(pub uint);
#[allow(non_upper_case_globals)]
pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub struct EdgeIndex(pub uint);
#[allow(non_upper_case_globals)]
pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
// Use a private field here to guarantee no more instances are created:
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
pub struct Direction { repr: uint }
#[allow(non_upper_case_globals)]
pub const Outgoing: Direction = Direction { repr: 0 };

View file

@ -176,7 +176,7 @@ pub trait Combine<'tcx> : Sized {
assert_eq!(num_region_params, a_rs.len());
assert_eq!(num_region_params, b_rs.len());
let mut rs = vec!();
for i in range(0, num_region_params) {
for i in 0..num_region_params {
let a_r = a_rs[i];
let b_r = b_rs[i];
let variance = variances[i];

View file

@ -1229,8 +1229,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
let mut insert = Vec::new();
if lifetimes.len() == 0 {
let anon = self.cur_anon.get();
for (i, a) in range(anon,
anon+expected).enumerate() {
for (i, a) in (anon..anon+expected).enumerate() {
if anon_nums.contains(&a) {
insert.push(i as u32);
}
@ -1343,11 +1342,11 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
let mut new_lts = Vec::new();
if data.lifetimes.len() == 0 {
// traverse once to see if there's a need to insert lifetime
let need_insert = range(0, expected).any(|i| {
let need_insert = (0..expected).any(|i| {
indexes.contains(&i)
});
if need_insert {
for i in range(0, expected) {
for i in 0..expected {
if indexes.contains(&i) {
new_lts.push(lifetime);
} else {
@ -1767,7 +1766,7 @@ impl LifeGiver {
let mut s = String::new();
let (n, r) = (counter/26 + 1, counter % 26);
let letter: char = from_u32((r+97) as u32).unwrap();
for _ in range(0, n) {
for _ in 0..n {
s.push(letter);
}
s

View file

@ -95,7 +95,7 @@ pub type SkolemizationMap = FnvHashMap<ty::BoundRegion,ty::Region>;
/// Why did we require that the two types be related?
///
/// See `error_reporting.rs` for more details
#[derive(Clone, Copy, Show)]
#[derive(Clone, Copy, Debug)]
pub enum TypeOrigin {
// Not yet categorized in a better way
Misc(Span),
@ -133,7 +133,7 @@ pub enum TypeOrigin {
}
/// See `error_reporting.rs` for more details
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub enum ValuePairs<'tcx> {
Types(ty::expected_found<Ty<'tcx>>),
TraitRefs(ty::expected_found<Rc<ty::TraitRef<'tcx>>>),
@ -144,7 +144,7 @@ pub enum ValuePairs<'tcx> {
/// encounter an error or subtyping constraint.
///
/// See `error_reporting.rs` for more details.
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct TypeTrace<'tcx> {
origin: TypeOrigin,
values: ValuePairs<'tcx>,
@ -153,7 +153,7 @@ pub struct TypeTrace<'tcx> {
/// The origin of a `r1 <= r2` constraint.
///
/// See `error_reporting.rs` for more details
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub enum SubregionOrigin<'tcx> {
// Arose from a subtyping relation
Subtype(TypeTrace<'tcx>),
@ -222,7 +222,7 @@ pub enum SubregionOrigin<'tcx> {
}
/// Times when we replace late-bound regions with variables:
#[derive(Clone, Copy, Show)]
#[derive(Clone, Copy, Debug)]
pub enum LateBoundRegionConversionTime {
/// when a fn is called
FnCall,
@ -237,7 +237,7 @@ pub enum LateBoundRegionConversionTime {
/// Reasons to create a region inference variable
///
/// See `error_reporting.rs` for more details
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub enum RegionVariableOrigin<'tcx> {
// Region variables created for ill-categorized reasons,
// mostly indicates places in need of refactoring
@ -270,7 +270,7 @@ pub enum RegionVariableOrigin<'tcx> {
BoundRegionInCoherence(ast::Name),
}
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
pub enum fixup_err {
unresolved_int_ty(IntVid),
unresolved_float_ty(FloatVid),
@ -828,7 +828,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
}
pub fn next_ty_vars(&self, n: uint) -> Vec<Ty<'tcx>> {
range(0, n).map(|_i| self.next_ty_var()).collect()
(0..n).map(|_i| self.next_ty_var()).collect()
}
pub fn next_int_var_id(&self) -> IntVid {

View file

@ -120,7 +120,7 @@ struct ConstraintGraph<'a, 'tcx: 'a> {
node_ids: FnvHashMap<Node, uint>,
}
#[derive(Clone, Hash, PartialEq, Eq, Show)]
#[derive(Clone, Hash, PartialEq, Eq, Debug)]
enum Node {
RegionVid(ty::RegionVid),
Region(ty::Region),

View file

@ -42,7 +42,7 @@ mod doc;
mod graphviz;
// A constraint that influences the inference process.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum Constraint {
// One region variable is subregion of another
ConstrainVarSubVar(RegionVid, RegionVid),
@ -69,7 +69,7 @@ pub enum Verify<'tcx> {
VerifyGenericBound(GenericKind<'tcx>, SubregionOrigin<'tcx>, Region, Vec<Region>),
}
#[derive(Clone, Show, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum GenericKind<'tcx> {
Param(ty::ParamTy),
Projection(ty::ProjectionTy<'tcx>),
@ -97,7 +97,7 @@ pub enum CombineMapType {
Lub, Glb
}
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub enum RegionResolutionError<'tcx> {
/// `ConcreteFailure(o, a, b)`:
///
@ -149,7 +149,7 @@ pub enum RegionResolutionError<'tcx> {
/// ```
/// would report an error because we expect 'a and 'b to match, and so we group
/// 'a and 'b together inside a SameRegions struct
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct SameRegions {
pub scope_id: ast::NodeId,
pub regions: Vec<BoundRegion>
@ -223,7 +223,7 @@ pub struct RegionVarBindings<'a, 'tcx: 'a> {
values: RefCell<Option<Vec<VarValue>>>,
}
#[derive(Show)]
#[derive(Debug)]
#[allow(missing_copy_implementations)]
pub struct RegionSnapshot {
length: uint,
@ -943,7 +943,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
// ______________________________________________________________________
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
enum Classification { Expanding, Contracting }
#[derive(Copy)]
@ -983,7 +983,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
}
fn construct_var_data(&self) -> Vec<VarData> {
range(0, self.num_vars() as uint).map(|_| {
(0..self.num_vars() as uint).map(|_| {
VarData {
// All nodes are initially classified as contracting; during
// the expansion phase, we will shift the classification for
@ -1259,7 +1259,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
let mut opt_graph = None;
for idx in range(0u, self.num_vars() as uint) {
for idx in 0u..self.num_vars() as uint {
match var_data[idx].value {
Value(_) => {
/* Inference successful */
@ -1316,7 +1316,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
}
}
range(0, self.num_vars() as uint).map(|idx| var_data[idx].value).collect()
(0..self.num_vars() as uint).map(|idx| var_data[idx].value).collect()
}
fn construct_graph(&self) -> RegionGraph {
@ -1328,7 +1328,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
let mut graph = graph::Graph::with_capacity(num_vars as uint + 1,
num_edges);
for _ in range(0, num_vars) {
for _ in 0..num_vars {
graph.add_node(());
}
let dummy_idx = graph.add_node(());

View file

@ -46,7 +46,7 @@ struct Delegate<'tcx>;
type Relation = (RelationDir, ty::TyVid);
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub enum RelationDir {
SubtypeOf, SupertypeOf, EqTo
}

View file

@ -63,7 +63,7 @@ pub trait UnifyValue : Clone + PartialEq + Debug {
/// to keep the DAG relatively balanced, which helps keep the running
/// time of the algorithm under control. For more information, see
/// <http://en.wikipedia.org/wiki/Disjoint-set_data_structure>.
#[derive(PartialEq,Clone,Show)]
#[derive(PartialEq,Clone,Debug)]
pub enum VarValue<K:UnifyKey> {
Redirect(K),
Root(K::Value, uint),

View file

@ -159,7 +159,7 @@ impl Clone for LiveNode {
}
}
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
enum LiveNodeKind {
FreeVarNode(Span),
ExprNode(Span),
@ -245,13 +245,13 @@ struct CaptureInfo {
var_nid: NodeId
}
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
struct LocalInfo {
id: NodeId,
ident: ast::Ident
}
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
enum VarKind {
Arg(NodeId, ast::Ident),
Local(LocalInfo),
@ -687,7 +687,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
{
let node_base_idx = self.idx(ln, Variable(0u));
let succ_base_idx = self.idx(succ_ln, Variable(0u));
for var_idx in range(0u, self.ir.num_vars) {
for var_idx in 0u..self.ir.num_vars {
op(self, node_base_idx + var_idx, succ_base_idx + var_idx);
}
}
@ -700,7 +700,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
F: FnMut(uint) -> LiveNode,
{
let node_base_idx = self.idx(ln, Variable(0));
for var_idx in range(0u, self.ir.num_vars) {
for var_idx in 0u..self.ir.num_vars {
let idx = node_base_idx + var_idx;
if test(idx).is_valid() {
try!(write!(wr, " {:?}", Variable(var_idx)));
@ -860,7 +860,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
// hack to skip the loop unless debug! is enabled:
debug!("^^ liveness computation results for body {} (entry={:?})",
{
for ln_idx in range(0u, self.ir.num_live_nodes) {
for ln_idx in 0u..self.ir.num_live_nodes {
debug!("{:?}", self.ln_str(LiveNode(ln_idx)));
}
body.id

View file

@ -87,7 +87,7 @@ use syntax::parse::token;
use std::cell::RefCell;
use std::rc::Rc;
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub enum categorization<'tcx> {
cat_rvalue(ty::Region), // temporary val, argument is its scope
cat_static_item,
@ -101,14 +101,14 @@ pub enum categorization<'tcx> {
}
// Represents any kind of upvar
#[derive(Clone, Copy, PartialEq, Show)]
#[derive(Clone, Copy, PartialEq, Debug)]
pub struct Upvar {
pub id: ty::UpvarId,
pub kind: ty::ClosureKind
}
// different kinds of pointers:
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum PointerKind {
/// `Box<T>`
Unique,
@ -125,25 +125,25 @@ pub enum PointerKind {
// We use the term "interior" to mean "something reachable from the
// base without a pointer dereference", e.g. a field
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum InteriorKind {
InteriorField(FieldName),
InteriorElement(ElementKind),
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum FieldName {
NamedField(ast::Name),
PositionalField(uint)
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum ElementKind {
VecElement,
OtherElement,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum MutabilityCategory {
McImmutable, // Immutable.
McDeclared, // Directly declared as mutable.
@ -155,7 +155,7 @@ pub enum MutabilityCategory {
// Upvar categorization can generate a variable number of nested
// derefs. The note allows detecting them without deep pattern
// matching on the categorization.
#[derive(Clone, Copy, PartialEq, Show)]
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum Note {
NoteClosureEnv(ty::UpvarId), // Deref through closure env
NoteUpvarRef(ty::UpvarId), // Deref through by-ref upvar
@ -176,7 +176,7 @@ pub enum Note {
// dereference, but its type is the type *before* the dereference
// (`@T`). So use `cmt.ty` to find the type of the value in a consistent
// fashion. For more details, see the method `cat_pattern`
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct cmt_<'tcx> {
pub id: ast::NodeId, // id of expr/pat producing this value
pub span: Span, // span of same expr/pat
@ -456,7 +456,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
debug!("cat_expr_autoderefd: autoderefs={}, cmt={}",
autoderefs,
cmt.repr(self.tcx()));
for deref in range(1u, autoderefs + 1) {
for deref in 1u..autoderefs + 1 {
cmt = try!(self.cat_deref(expr, cmt, deref));
}
return Ok(cmt);

View file

@ -35,7 +35,7 @@ pub type PublicItems = NodeSet;
// FIXME: dox
pub type LastPrivateMap = NodeMap<LastPrivate>;
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
pub enum LastPrivate {
LastMod(PrivateDep),
// `use` directives (imports) can refer to two separate definitions in the
@ -49,14 +49,14 @@ pub enum LastPrivate {
type_used: ImportUse},
}
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
pub enum PrivateDep {
AllPublic,
DependsOn(ast::DefId),
}
// How an import is used.
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub enum ImportUse {
Unused, // The import is not used.
Used, // The import is used.

View file

@ -37,7 +37,7 @@ use syntax::visit::{Visitor, FnKind};
/// actually attach a more meaningful ordering to scopes than the one
/// generated via deriving here.
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, RustcEncodable,
RustcDecodable, Show, Copy)]
RustcDecodable, Debug, Copy)]
pub enum CodeExtent {
Misc(ast::NodeId),
Remainder(BlockRemainder),
@ -61,7 +61,7 @@ pub enum CodeExtent {
/// * the subscope with `first_statement_index == 1` is scope of `c`,
/// and thus does not include EXPR_2, but covers the `...`.
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, RustcEncodable,
RustcDecodable, Show, Copy)]
RustcDecodable, Debug, Copy)]
pub struct BlockRemainder {
pub block: ast::NodeId,
pub first_statement_index: uint,
@ -179,7 +179,7 @@ pub struct RegionMaps {
/// Carries the node id for the innermost block or match expression,
/// for building up the `var_map` which maps ids to the blocks in
/// which they were declared.
#[derive(PartialEq, Eq, Show, Copy)]
#[derive(PartialEq, Eq, Debug, Copy)]
enum InnermostDeclaringBlock {
None,
Block(ast::NodeId),
@ -204,7 +204,7 @@ impl InnermostDeclaringBlock {
/// Contextual information for declarations introduced by a statement
/// (i.e. `let`). It carries node-id's for statement and enclosing
/// block both, as well as the statement's index within the block.
#[derive(PartialEq, Eq, Show, Copy)]
#[derive(PartialEq, Eq, Debug, Copy)]
struct DeclaringStatementContext {
stmt_id: ast::NodeId,
block_id: ast::NodeId,
@ -220,7 +220,7 @@ impl DeclaringStatementContext {
}
}
#[derive(PartialEq, Eq, Show, Copy)]
#[derive(PartialEq, Eq, Debug, Copy)]
enum InnermostEnclosingExpr {
None,
Some(ast::NodeId),
@ -242,7 +242,7 @@ impl InnermostEnclosingExpr {
}
}
#[derive(Show, Copy)]
#[derive(Debug, Copy)]
pub struct Context {
var_parent: InnermostDeclaringBlock,

View file

@ -33,7 +33,7 @@ use syntax::visit;
use syntax::visit::Visitor;
use util::nodemap::NodeMap;
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)]
pub enum DefRegion {
DefStaticRegion,
DefEarlyBoundRegion(/* space */ subst::ParamSpace,
@ -404,7 +404,7 @@ impl<'a> LifetimeContext<'a> {
}
fn check_lifetime_defs(&mut self, old_scope: Scope, lifetimes: &Vec<ast::LifetimeDef>) {
for i in range(0, lifetimes.len()) {
for i in 0..lifetimes.len() {
let lifetime_i = &lifetimes[i];
let special_idents = [special_idents::static_lifetime];
@ -417,7 +417,7 @@ impl<'a> LifetimeContext<'a> {
}
// It is a hard error to shadow a lifetime within the same scope.
for j in range(i + 1, lifetimes.len()) {
for j in i + 1..lifetimes.len() {
let lifetime_j = &lifetimes[j];
if lifetime_i.lifetime.name == lifetime_j.lifetime.name {

View file

@ -28,7 +28,7 @@ use syntax::codemap::{Span, DUMMY_SP};
/// identify each in-scope parameter by an *index* and a *parameter
/// space* (which indices where the parameter is defined; see
/// `ParamSpace`).
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct Substs<'tcx> {
pub types: VecPerParamSpace<Ty<'tcx>>,
pub regions: RegionSubsts,
@ -37,7 +37,7 @@ pub struct Substs<'tcx> {
/// Represents the values to use when substituting lifetime parameters.
/// If the value is `ErasedRegions`, then this subst is occurring during
/// trans, and all region parameters will be replaced with `ty::ReStatic`.
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub enum RegionSubsts {
ErasedRegions,
NonerasedRegions(VecPerParamSpace<ty::Region>)
@ -180,7 +180,7 @@ impl RegionSubsts {
// ParamSpace
#[derive(PartialOrd, Ord, PartialEq, Eq, Copy,
Clone, Hash, RustcEncodable, RustcDecodable, Show)]
Clone, Hash, RustcEncodable, RustcDecodable, Debug)]
pub enum ParamSpace {
TypeSpace, // Type parameters attached to a type definition, trait, or impl
SelfSpace, // Self parameter on a trait

View file

@ -147,7 +147,7 @@ pub type TraitObligations<'tcx> = subst::VecPerParamSpace<TraitObligation<'tcx>>
pub type Selection<'tcx> = Vtable<'tcx, PredicateObligation<'tcx>>;
#[derive(Clone,Show)]
#[derive(Clone,Debug)]
pub enum SelectionError<'tcx> {
Unimplemented,
Overflow,
@ -215,7 +215,7 @@ pub type SelectionResult<'tcx, T> = Result<Option<T>, SelectionError<'tcx>>;
/// ### The type parameter `N`
///
/// See explanation on `VtableImplData`.
#[derive(Show,Clone)]
#[derive(Debug,Clone)]
pub enum Vtable<'tcx, N> {
/// Vtable identifying a particular impl.
VtableImpl(VtableImplData<'tcx, N>),
@ -258,7 +258,7 @@ pub struct VtableImplData<'tcx, N> {
pub nested: subst::VecPerParamSpace<N>
}
#[derive(Show,Clone)]
#[derive(Debug,Clone)]
pub struct VtableBuiltinData<N> {
pub nested: subst::VecPerParamSpace<N>
}

View file

@ -36,7 +36,7 @@ pub enum ObjectSafetyViolation<'tcx> {
}
/// Reasons a method might not be object-safe.
#[derive(Copy,Clone,Show)]
#[derive(Copy,Clone,Debug)]
pub enum MethodViolationCode {
/// e.g., `fn(self)`
ByValueSelf,

View file

@ -96,7 +96,7 @@ pub enum MethodMatchResult {
MethodDidNotMatch,
}
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
pub enum MethodMatchedData {
// In the case of a precise match, we don't really need to store
// how the match was found. So don't.
@ -131,7 +131,7 @@ pub enum MethodMatchedData {
/// matching where clause. Part of the reason for this is that where
/// clauses can give additional information (like, the types of output
/// parameters) that would have to be inferred from the impl.
#[derive(PartialEq,Eq,Show,Clone)]
#[derive(PartialEq,Eq,Debug,Clone)]
enum SelectionCandidate<'tcx> {
BuiltinCandidate(ty::BuiltinBound),
ParamCandidate(ty::PolyTraitRef<'tcx>),
@ -172,7 +172,7 @@ enum BuiltinBoundConditions<'tcx> {
AmbiguousBuiltin
}
#[derive(Show)]
#[derive(Debug)]
enum EvaluationResult<'tcx> {
EvaluatedToOk,
EvaluatedToAmbig,
@ -595,7 +595,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
let mut i = 0;
while i < candidates.len() {
let is_dup =
range(0, candidates.len())
(0..candidates.len())
.filter(|&j| i != j)
.any(|j| self.candidate_should_be_dropped_in_favor_of(stack,
&candidates[i],

View file

@ -112,7 +112,7 @@ pub struct field<'tcx> {
pub mt: mt<'tcx>
}
#[derive(Clone, Copy, Show)]
#[derive(Clone, Copy, Debug)]
pub enum ImplOrTraitItemContainer {
TraitContainer(ast::DefId),
ImplContainer(ast::DefId),
@ -127,7 +127,7 @@ impl ImplOrTraitItemContainer {
}
}
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub enum ImplOrTraitItem<'tcx> {
MethodTraitItem(Rc<Method<'tcx>>),
TypeTraitItem(Rc<AssociatedType>),
@ -172,7 +172,7 @@ impl<'tcx> ImplOrTraitItem<'tcx> {
}
}
#[derive(Clone, Copy, Show)]
#[derive(Clone, Copy, Debug)]
pub enum ImplOrTraitItemId {
MethodTraitItemId(ast::DefId),
TypeTraitItemId(ast::DefId),
@ -187,7 +187,7 @@ impl ImplOrTraitItemId {
}
}
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct Method<'tcx> {
pub name: ast::Name,
pub generics: ty::Generics<'tcx>,
@ -231,7 +231,7 @@ impl<'tcx> Method<'tcx> {
}
}
#[derive(Clone, Copy, Show)]
#[derive(Clone, Copy, Debug)]
pub struct AssociatedType {
pub name: ast::Name,
pub vis: ast::Visibility,
@ -239,13 +239,13 @@ pub struct AssociatedType {
pub container: ImplOrTraitItemContainer,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub struct mt<'tcx> {
pub ty: Ty<'tcx>,
pub mutbl: ast::Mutability,
}
#[derive(Clone, Copy, Show)]
#[derive(Clone, Copy, Debug)]
pub struct field_ty {
pub name: Name,
pub id: DefId,
@ -274,7 +274,7 @@ pub struct ItemVariances {
pub regions: VecPerParamSpace<Variance>,
}
#[derive(Clone, PartialEq, RustcDecodable, RustcEncodable, Show, Copy)]
#[derive(Clone, PartialEq, RustcDecodable, RustcEncodable, Debug, Copy)]
pub enum Variance {
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
@ -282,13 +282,13 @@ pub enum Variance {
Bivariant, // T<A> <: T<B> -- e.g., unused type parameter
}
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub enum AutoAdjustment<'tcx> {
AdjustReifyFnPointer(ast::DefId), // go from a fn-item type to a fn-pointer type
AdjustDerefRef(AutoDerefRef<'tcx>)
}
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub enum UnsizeKind<'tcx> {
// [T, ..n] -> [T], the uint field is n.
UnsizeLength(uint),
@ -298,13 +298,13 @@ pub enum UnsizeKind<'tcx> {
UnsizeVtable(TyTrait<'tcx>, /* the self type of the trait */ Ty<'tcx>)
}
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct AutoDerefRef<'tcx> {
pub autoderefs: uint,
pub autoref: Option<AutoRef<'tcx>>
}
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub enum AutoRef<'tcx> {
/// Convert from T to &T
/// The third field allows us to wrap other AutoRef adjustments.
@ -421,13 +421,13 @@ pub fn type_of_adjust<'tcx>(cx: &ctxt<'tcx>, adj: &AutoAdjustment<'tcx>) -> Opti
}
}
#[derive(Clone, Copy, RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Show)]
#[derive(Clone, Copy, RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Debug)]
pub struct param_index {
pub space: subst::ParamSpace,
pub index: uint
}
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub enum MethodOrigin<'tcx> {
// fully statically resolved method
MethodStatic(ast::DefId),
@ -445,7 +445,7 @@ pub enum MethodOrigin<'tcx> {
// details for a method invoked with a receiver whose type is a type parameter
// with a bounded trait.
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct MethodParam<'tcx> {
// the precise trait reference that occurs as a bound -- this may
// be a supertrait of what the user actually typed. Note that it
@ -466,7 +466,7 @@ pub struct MethodParam<'tcx> {
}
// details for a method invoked with a receiver whose type is an object
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct MethodObject<'tcx> {
// the (super)trait containing the method to be invoked
pub trait_ref: Rc<ty::TraitRef<'tcx>>,
@ -503,13 +503,13 @@ pub struct MethodCallee<'tcx> {
/// needed to add to the side tables. Thus to disambiguate
/// we also keep track of whether there's an adjustment in
/// our key.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub struct MethodCall {
pub expr_id: ast::NodeId,
pub adjustment: ExprAdjustment
}
#[derive(Clone, PartialEq, Eq, Hash, Show, RustcEncodable, RustcDecodable, Copy)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable, Copy)]
pub enum ExprAdjustment {
NoAdjustment,
AutoDeref(uint),
@ -923,7 +923,7 @@ impl<'tcx> ctxt<'tcx> {
}
}
#[derive(Show)]
#[derive(Debug)]
pub struct TyS<'tcx> {
pub sty: sty<'tcx>,
pub flags: TypeFlags,
@ -1029,21 +1029,21 @@ pub fn type_escapes_depth(ty: Ty, depth: u32) -> bool {
ty.region_depth > depth
}
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct BareFnTy<'tcx> {
pub unsafety: ast::Unsafety,
pub abi: abi::Abi,
pub sig: PolyFnSig<'tcx>,
}
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct ClosureTy<'tcx> {
pub unsafety: ast::Unsafety,
pub abi: abi::Abi,
pub sig: PolyFnSig<'tcx>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum FnOutput<'tcx> {
FnConverging(Ty<'tcx>),
FnDiverging
@ -1100,7 +1100,7 @@ impl<'tcx> PolyFnSig<'tcx> {
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub struct ParamTy {
pub space: subst::ParamSpace,
pub idx: u32,
@ -1146,7 +1146,7 @@ pub struct ParamTy {
/// is the outer fn.
///
/// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show, Copy)]
#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug, Copy)]
pub struct DebruijnIndex {
// We maintain the invariant that this is never 0. So 1 indicates
// the innermost binder. To ensure this, create with `DebruijnIndex::new`.
@ -1154,7 +1154,7 @@ pub struct DebruijnIndex {
}
/// Representation of regions:
#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show, Copy)]
#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug, Copy)]
pub enum Region {
// Region bound in a type or fn declaration which will be
// substituted 'early' -- that is, at the same time when type
@ -1195,13 +1195,13 @@ pub enum Region {
/// 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
/// by the upvar) and the id of the closure expression.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub struct UpvarId {
pub var_id: ast::NodeId,
pub closure_expr_id: ast::NodeId,
}
#[derive(Clone, PartialEq, Eq, Hash, Show, RustcEncodable, RustcDecodable, Copy)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable, Copy)]
pub enum BorrowKind {
/// Data must be immutable and is aliasable.
ImmBorrow,
@ -1294,7 +1294,7 @@ pub enum BorrowKind {
/// - Through mutation, the borrowed upvars can actually escape
/// the closure, so sometimes it is necessary for them to be larger
/// than the closure lifetime itself.
#[derive(PartialEq, Clone, RustcEncodable, RustcDecodable, Show, Copy)]
#[derive(PartialEq, Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
pub struct UpvarBorrow {
pub kind: BorrowKind,
pub region: ty::Region,
@ -1320,7 +1320,7 @@ impl Region {
}
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash,
RustcEncodable, RustcDecodable, Show, Copy)]
RustcEncodable, RustcDecodable, Debug, Copy)]
/// A "free" region `fr` can be interpreted as "some region
/// at least as big as the scope `fr.scope`".
pub struct FreeRegion {
@ -1329,7 +1329,7 @@ pub struct FreeRegion {
}
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash,
RustcEncodable, RustcDecodable, Show, Copy)]
RustcEncodable, RustcDecodable, Debug, Copy)]
pub enum BoundRegion {
/// An anonymous region parameter for a given fn (&T)
BrAnon(u32),
@ -1350,7 +1350,7 @@ pub enum BoundRegion {
// NB: If you change this, you'll probably want to change the corresponding
// AST structure in libsyntax/ast.rs as well.
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub enum sty<'tcx> {
ty_bool,
ty_char,
@ -1397,7 +1397,7 @@ pub enum sty<'tcx> {
// on non-useful type error messages)
}
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct TyTrait<'tcx> {
pub principal: ty::PolyTraitRef<'tcx>,
pub bounds: ExistentialBounds<'tcx>,
@ -1469,7 +1469,7 @@ impl<'tcx> TyTrait<'tcx> {
/// Note that a `TraitRef` introduces a level of region binding, to
/// account for higher-ranked trait bounds like `T : for<'a> Foo<&'a
/// U>` or higher-ranked object types.
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct TraitRef<'tcx> {
pub def_id: DefId,
pub substs: &'tcx Substs<'tcx>,
@ -1509,7 +1509,7 @@ impl<'tcx> PolyTraitRef<'tcx> {
/// erase, or otherwise "discharge" these bound reons, we change the
/// type from `Binder<T>` to just `T` (see
/// e.g. `liberate_late_bound_regions`).
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct Binder<T>(pub T);
#[derive(Clone, Copy, PartialEq)]
@ -1518,7 +1518,7 @@ pub enum IntVarValue {
UintType(ast::UintTy),
}
#[derive(Clone, Copy, Show)]
#[derive(Clone, Copy, Debug)]
pub enum terr_vstore_kind {
terr_vec,
terr_str,
@ -1526,14 +1526,14 @@ pub enum terr_vstore_kind {
terr_trait
}
#[derive(Clone, Copy, Show)]
#[derive(Clone, Copy, Debug)]
pub struct expected_found<T> {
pub expected: T,
pub found: T
}
// Data structures used in type unification
#[derive(Clone, Copy, Show)]
#[derive(Clone, Copy, Debug)]
pub enum type_err<'tcx> {
terr_mismatch,
terr_unsafety_mismatch(expected_found<ast::Unsafety>),
@ -1567,7 +1567,7 @@ pub enum type_err<'tcx> {
/// Bounds suitable for a named type parameter like `A` in `fn foo<A>`
/// as well as the existential type parameter in an object type.
#[derive(PartialEq, Eq, Hash, Clone, Show)]
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
pub struct ParamBounds<'tcx> {
pub region_bounds: Vec<ty::Region>,
pub builtin_bounds: BuiltinBounds,
@ -1580,7 +1580,7 @@ pub struct ParamBounds<'tcx> {
/// major difference between this case and `ParamBounds` is that
/// general purpose trait bounds are omitted and there must be
/// *exactly one* region.
#[derive(PartialEq, Eq, Hash, Clone, Show)]
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
pub struct ExistentialBounds<'tcx> {
pub region_bound: ty::Region,
pub builtin_bounds: BuiltinBounds,
@ -1590,7 +1590,7 @@ pub struct ExistentialBounds<'tcx> {
pub type BuiltinBounds = EnumSet<BuiltinBound>;
#[derive(Clone, RustcEncodable, PartialEq, Eq, RustcDecodable, Hash,
Show, Copy)]
Debug, Copy)]
#[repr(uint)]
pub enum BuiltinBound {
BoundSend,
@ -1664,7 +1664,7 @@ pub enum InferTy {
FreshIntTy(u32),
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)]
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug, Copy)]
pub enum UnconstrainedNumeric {
UnconstrainedFloat,
UnconstrainedInt,
@ -1672,7 +1672,7 @@ pub enum UnconstrainedNumeric {
}
#[derive(Clone, RustcEncodable, RustcDecodable, Eq, Hash, Show, Copy)]
#[derive(Clone, RustcEncodable, RustcDecodable, Eq, Hash, Debug, Copy)]
pub enum InferRegion {
ReVar(RegionVid),
ReSkolemized(u32, BoundRegion)
@ -1746,7 +1746,7 @@ impl fmt::Debug for IntVarValue {
}
}
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct TypeParameterDef<'tcx> {
pub name: ast::Name,
pub def_id: ast::DefId,
@ -1756,7 +1756,7 @@ pub struct TypeParameterDef<'tcx> {
pub default: Option<Ty<'tcx>>,
}
#[derive(RustcEncodable, RustcDecodable, Clone, Show)]
#[derive(RustcEncodable, RustcDecodable, Clone, Debug)]
pub struct RegionParameterDef {
pub name: ast::Name,
pub def_id: ast::DefId,
@ -1773,7 +1773,7 @@ impl RegionParameterDef {
/// Information about the formal type/lifetime parameters associated
/// with an item or method. Analogous to ast::Generics.
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct Generics<'tcx> {
pub types: VecPerParamSpace<TypeParameterDef<'tcx>>,
pub regions: VecPerParamSpace<RegionParameterDef>,
@ -1809,7 +1809,7 @@ impl<'tcx> Generics<'tcx> {
}
}
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub enum Predicate<'tcx> {
/// Corresponds to `where Foo : Bar<A,B,C>`. `Foo` here would be
/// the `Self` type of the trait reference and `A`, `B`, and `C`
@ -1830,7 +1830,7 @@ pub enum Predicate<'tcx> {
Projection(PolyProjectionPredicate<'tcx>),
}
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct TraitPredicate<'tcx> {
pub trait_ref: Rc<TraitRef<'tcx>>
}
@ -1856,11 +1856,11 @@ impl<'tcx> PolyTraitPredicate<'tcx> {
}
}
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct EquatePredicate<'tcx>(pub Ty<'tcx>, pub Ty<'tcx>); // `0 == 1`
pub type PolyEquatePredicate<'tcx> = ty::Binder<EquatePredicate<'tcx>>;
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct OutlivesPredicate<A,B>(pub A, pub B); // `A : B`
pub type PolyOutlivesPredicate<A,B> = ty::Binder<OutlivesPredicate<A,B>>;
pub type PolyRegionOutlivesPredicate = PolyOutlivesPredicate<ty::Region, ty::Region>;
@ -1878,7 +1878,7 @@ pub type PolyTypeOutlivesPredicate<'tcx> = PolyOutlivesPredicate<Ty<'tcx>, ty::R
/// equality between arbitrary types. Processing an instance of Form
/// #2 eventually yields one of these `ProjectionPredicate`
/// instances to normalize the LHS.
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct ProjectionPredicate<'tcx> {
pub projection_ty: ProjectionTy<'tcx>,
pub ty: Ty<'tcx>,
@ -1898,7 +1898,7 @@ impl<'tcx> PolyProjectionPredicate<'tcx> {
/// Represents the projection of an associated type. In explicit UFCS
/// form this would be written `<T as Trait<..>>::N`.
#[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct ProjectionTy<'tcx> {
/// The trait reference `T as Trait<..>`.
pub trait_ref: Rc<ty::TraitRef<'tcx>>,
@ -2034,7 +2034,7 @@ impl<'tcx> Predicate<'tcx> {
/// `[[], [U:Bar<T>]]`. Now if there were some particular reference
/// like `Foo<int,uint>`, then the `GenericBounds` would be `[[],
/// [uint:Bar<int>]]`.
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct GenericBounds<'tcx> {
pub predicates: VecPerParamSpace<Predicate<'tcx>>,
}
@ -2243,7 +2243,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
/// stray references in a comment or something). We try to reserve the
/// "poly" prefix to refer to higher-ranked things, as in
/// `PolyTraitRef`.
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct TypeScheme<'tcx> {
pub generics: Generics<'tcx>,
pub ty: Ty<'tcx>
@ -2286,7 +2286,7 @@ pub struct Closure<'tcx> {
pub kind: ClosureKind,
}
#[derive(Clone, Copy, PartialEq, Eq, Show)]
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum ClosureKind {
FnClosureKind,
FnMutClosureKind,
@ -3745,7 +3745,7 @@ 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
/// will keep the "more erroneous" of two values.
#[derive(Copy, PartialOrd, Ord, Eq, PartialEq, Show)]
#[derive(Copy, PartialOrd, Ord, Eq, PartialEq, Debug)]
pub enum Representability {
Representable,
ContainsRecursive,
@ -4344,7 +4344,7 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>,
let mut adjusted_ty = unadjusted_ty;
if !ty::type_is_error(adjusted_ty) {
for i in range(0, adj.autoderefs) {
for i in 0..adj.autoderefs {
let method_call = MethodCall::autoderef(expr_id, i);
match method_type(method_call) {
Some(method_ty) => {
@ -6536,7 +6536,7 @@ impl<'a,'tcx> ClosureTyper<'tcx> for ty::ParameterEnvironment<'a,'tcx> {
/// The category of explicit self.
#[derive(Clone, Copy, Eq, PartialEq, Show)]
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
pub enum ExplicitSelfCategory {
StaticExplicitSelfCategory,
ByValueExplicitSelfCategory,

View file

@ -249,7 +249,7 @@ pub enum EntryFnType {
EntryNone,
}
#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Show)]
#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug)]
pub enum CrateType {
CrateTypeExecutable,
CrateTypeDylib,
@ -672,7 +672,7 @@ pub fn optgroups() -> Vec<getopts::OptGroup> {
.collect()
}
#[derive(Copy, Clone, PartialEq, Eq, Show)]
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum OptionStability { Stable, Unstable }
#[derive(Clone, PartialEq, Eq)]

View file

@ -10,7 +10,7 @@
use std::slice;
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct SearchPaths {
paths: Vec<(PathKind, Path)>,
}
@ -20,7 +20,7 @@ pub struct Iter<'a> {
iter: slice::Iter<'a, (PathKind, Path)>,
}
#[derive(Eq, PartialEq, Clone, Copy, Show)]
#[derive(Eq, PartialEq, Clone, Copy, Debug)]
pub enum PathKind {
Native,
Crate,

View file

@ -27,7 +27,7 @@ pub const FN_OUTPUT_NAME: &'static str = "Output";
// Useful type to use with `Result<>` indicate that an error has already
// been reported to the user, so no need to continue checking.
#[derive(Clone, Copy, Show)]
#[derive(Clone, Copy, Debug)]
pub struct ErrorReported;
pub fn time<T, U, F>(do_it: bool, what: &str, u: U, f: F) -> T where

View file

@ -14,7 +14,7 @@ pub fn lev_distance(me: &str, t: &str) -> uint {
if me.is_empty() { return t.chars().count(); }
if t.is_empty() { return me.chars().count(); }
let mut dcol: Vec<_> = range(0, t.len() + 1).collect();
let mut dcol: Vec<_> = (0..t.len() + 1).collect();
let mut t_last = 0;
for (i, sc) in me.chars().enumerate() {
@ -45,7 +45,7 @@ pub fn lev_distance(me: &str, t: &str) -> uint {
fn test_lev_distance() {
use std::char::{ from_u32, MAX };
// Test bytelength agnosticity
for c in range(0u32, MAX as u32)
for c in (0u32..MAX as u32)
.filter_map(|i| from_u32(i))
.map(|i| i.to_string()) {
assert_eq!(lev_distance(&c[], &c[]), 0);