1
Fork 0

auto merge of #8889 : erickt/rust/cleanup, r=catamorphism

This fixes a couple minor things I've been sitting on. It cleans up some warnings, CapCases some types in librustc's rscope module, and adds a fixme.
This commit is contained in:
bors 2013-08-30 17:20:36 -07:00
commit 29449e355a
18 changed files with 64 additions and 81 deletions

View file

@ -11,7 +11,7 @@
/*! /*!
* Conversion from AST representation of types to the ty.rs * Conversion from AST representation of types to the ty.rs
* representation. The main routine here is `ast_ty_to_ty()`: each use * representation. The main routine here is `ast_ty_to_ty()`: each use
* is parameterized by an instance of `AstConv` and a `region_scope`. * is parameterized by an instance of `AstConv` and a `RegionScope`.
* *
* The parameterization of `ast_ty_to_ty()` is because it behaves * The parameterization of `ast_ty_to_ty()` is because it behaves
* somewhat differently during the collect and check phases, * somewhat differently during the collect and check phases,
@ -23,12 +23,12 @@
* In the check phase, when the @FnCtxt is used as the `AstConv`, * In the check phase, when the @FnCtxt is used as the `AstConv`,
* `get_item_ty()` just looks up the item type in `tcx.tcache`. * `get_item_ty()` just looks up the item type in `tcx.tcache`.
* *
* The `region_scope` trait controls how region references are * The `RegionScope` trait controls how region references are
* handled. It has two methods which are used to resolve anonymous * handled. It has two methods which are used to resolve anonymous
* region references (e.g., `&T`) and named region references (e.g., * region references (e.g., `&T`) and named region references (e.g.,
* `&a.T`). There are numerous region scopes that can be used, but most * `&a.T`). There are numerous region scopes that can be used, but most
* commonly you want either `empty_rscope`, which permits only the static * commonly you want either `EmptyRscope`, which permits only the static
* region, or `type_rscope`, which permits the self region if the type in * region, or `TypeRscope`, which permits the self region if the type in
* question is parameterized by a region. * question is parameterized by a region.
* *
* Unlike the `AstConv` trait, the region scope can change as we descend * Unlike the `AstConv` trait, the region scope can change as we descend
@ -58,7 +58,7 @@ use middle::ty::{substs};
use middle::ty::{ty_param_substs_and_ty}; use middle::ty::{ty_param_substs_and_ty};
use middle::ty; use middle::ty;
use middle::typeck::rscope::in_binding_rscope; use middle::typeck::rscope::in_binding_rscope;
use middle::typeck::rscope::{region_scope, RegionError}; use middle::typeck::rscope::{RegionScope, RegionError};
use middle::typeck::rscope::RegionParamNames; use middle::typeck::rscope::RegionParamNames;
use middle::typeck::lookup_def_tcx; use middle::typeck::lookup_def_tcx;
@ -104,7 +104,7 @@ pub fn get_region_reporting_err(
} }
} }
pub fn ast_region_to_region<AC:AstConv,RS:region_scope + Clone + 'static>( pub fn ast_region_to_region<AC:AstConv,RS:RegionScope + Clone + 'static>(
this: &AC, this: &AC,
rscope: &RS, rscope: &RS,
default_span: span, default_span: span,
@ -129,7 +129,7 @@ pub fn ast_region_to_region<AC:AstConv,RS:region_scope + Clone + 'static>(
get_region_reporting_err(this.tcx(), span, opt_lifetime, res) get_region_reporting_err(this.tcx(), span, opt_lifetime, res)
} }
fn ast_path_substs<AC:AstConv,RS:region_scope + Clone + 'static>( fn ast_path_substs<AC:AstConv,RS:RegionScope + Clone + 'static>(
this: &AC, this: &AC,
rscope: &RS, rscope: &RS,
def_id: ast::def_id, def_id: ast::def_id,
@ -200,7 +200,7 @@ fn ast_path_substs<AC:AstConv,RS:region_scope + Clone + 'static>(
} }
pub fn ast_path_to_substs_and_ty<AC:AstConv, pub fn ast_path_to_substs_and_ty<AC:AstConv,
RS:region_scope + Clone + 'static>( RS:RegionScope + Clone + 'static>(
this: &AC, this: &AC,
rscope: &RS, rscope: &RS,
did: ast::def_id, did: ast::def_id,
@ -217,7 +217,7 @@ pub fn ast_path_to_substs_and_ty<AC:AstConv,
ty_param_substs_and_ty { substs: substs, ty: ty } ty_param_substs_and_ty { substs: substs, ty: ty }
} }
pub fn ast_path_to_trait_ref<AC:AstConv,RS:region_scope + Clone + 'static>( pub fn ast_path_to_trait_ref<AC:AstConv,RS:RegionScope + Clone + 'static>(
this: &AC, this: &AC,
rscope: &RS, rscope: &RS,
trait_def_id: ast::def_id, trait_def_id: ast::def_id,
@ -240,7 +240,7 @@ pub fn ast_path_to_trait_ref<AC:AstConv,RS:region_scope + Clone + 'static>(
return trait_ref; return trait_ref;
} }
pub fn ast_path_to_ty<AC:AstConv,RS:region_scope + Clone + 'static>( pub fn ast_path_to_ty<AC:AstConv,RS:RegionScope + Clone + 'static>(
this: &AC, this: &AC,
rscope: &RS, rscope: &RS,
did: ast::def_id, did: ast::def_id,
@ -262,10 +262,10 @@ pub static NO_TPS: uint = 2;
// Parses the programmer's textual representation of a type into our // Parses the programmer's textual representation of a type into our
// internal notion of a type. `getter` is a function that returns the type // internal notion of a type. `getter` is a function that returns the type
// corresponding to a definition ID: // corresponding to a definition ID:
pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Clone + 'static>( pub fn ast_ty_to_ty<AC:AstConv, RS:RegionScope + Clone + 'static>(
this: &AC, rscope: &RS, ast_ty: &ast::Ty) -> ty::t { this: &AC, rscope: &RS, ast_ty: &ast::Ty) -> ty::t {
fn ast_mt_to_mt<AC:AstConv, RS:region_scope + Clone + 'static>( fn ast_mt_to_mt<AC:AstConv, RS:RegionScope + Clone + 'static>(
this: &AC, rscope: &RS, mt: &ast::mt) -> ty::mt { this: &AC, rscope: &RS, mt: &ast::mt) -> ty::mt {
ty::mt {ty: ast_ty_to_ty(this, rscope, mt.ty), mutbl: mt.mutbl} ty::mt {ty: ast_ty_to_ty(this, rscope, mt.ty), mutbl: mt.mutbl}
@ -274,7 +274,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Clone + 'static>(
// Handle @, ~, and & being able to mean estrs and evecs. // Handle @, ~, and & being able to mean estrs and evecs.
// If a_seq_ty is a str or a vec, make it an estr/evec. // If a_seq_ty is a str or a vec, make it an estr/evec.
// Also handle first-class trait types. // Also handle first-class trait types.
fn mk_pointer<AC:AstConv,RS:region_scope + Clone + 'static>( fn mk_pointer<AC:AstConv,RS:RegionScope + Clone + 'static>(
this: &AC, this: &AC,
rscope: &RS, rscope: &RS,
a_seq_ty: &ast::mt, a_seq_ty: &ast::mt,
@ -540,7 +540,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Clone + 'static>(
} }
pub fn ty_of_arg<AC:AstConv, pub fn ty_of_arg<AC:AstConv,
RS:region_scope + Clone + 'static>( RS:RegionScope + Clone + 'static>(
this: &AC, this: &AC,
rscope: &RS, rscope: &RS,
a: &ast::arg, a: &ast::arg,
@ -588,7 +588,7 @@ struct SelfInfo {
explicit_self: ast::explicit_self explicit_self: ast::explicit_self
} }
pub fn ty_of_method<AC:AstConv,RS:region_scope + Clone + 'static>( pub fn ty_of_method<AC:AstConv,RS:RegionScope + Clone + 'static>(
this: &AC, this: &AC,
rscope: &RS, rscope: &RS,
purity: ast::purity, purity: ast::purity,
@ -606,7 +606,7 @@ pub fn ty_of_method<AC:AstConv,RS:region_scope + Clone + 'static>(
(a.unwrap(), b) (a.unwrap(), b)
} }
pub fn ty_of_bare_fn<AC:AstConv,RS:region_scope + Clone + 'static>( pub fn ty_of_bare_fn<AC:AstConv,RS:RegionScope + Clone + 'static>(
this: &AC, this: &AC,
rscope: &RS, rscope: &RS,
purity: ast::purity, purity: ast::purity,
@ -619,7 +619,7 @@ pub fn ty_of_bare_fn<AC:AstConv,RS:region_scope + Clone + 'static>(
b b
} }
fn ty_of_method_or_bare_fn<AC:AstConv,RS:region_scope + Clone + 'static>( fn ty_of_method_or_bare_fn<AC:AstConv,RS:RegionScope + Clone + 'static>(
this: &AC, this: &AC,
rscope: &RS, rscope: &RS,
purity: ast::purity, purity: ast::purity,
@ -657,7 +657,7 @@ fn ty_of_method_or_bare_fn<AC:AstConv,RS:region_scope + Clone + 'static>(
output: output_ty} output: output_ty}
}); });
fn transform_self_ty<AC:AstConv,RS:region_scope + Clone + 'static>( fn transform_self_ty<AC:AstConv,RS:RegionScope + Clone + 'static>(
this: &AC, this: &AC,
rscope: &RS, rscope: &RS,
self_info: &SelfInfo) -> Option<ty::t> self_info: &SelfInfo) -> Option<ty::t>
@ -690,7 +690,7 @@ fn ty_of_method_or_bare_fn<AC:AstConv,RS:region_scope + Clone + 'static>(
} }
} }
pub fn ty_of_closure<AC:AstConv,RS:region_scope + Clone + 'static>( pub fn ty_of_closure<AC:AstConv,RS:RegionScope + Clone + 'static>(
this: &AC, this: &AC,
rscope: &RS, rscope: &RS,
sigil: ast::Sigil, sigil: ast::Sigil,

View file

@ -101,7 +101,7 @@ use middle::typeck::infer::{resolve_type, force_tvar};
use middle::typeck::infer; use middle::typeck::infer;
use middle::typeck::rscope::bound_self_region; use middle::typeck::rscope::bound_self_region;
use middle::typeck::rscope::{RegionError}; use middle::typeck::rscope::{RegionError};
use middle::typeck::rscope::region_scope; use middle::typeck::rscope::RegionScope;
use middle::typeck::{isr_alist, lookup_def_ccx}; use middle::typeck::{isr_alist, lookup_def_ccx};
use middle::typeck::no_params; use middle::typeck::no_params;
use middle::typeck::{require_same_types, method_map, vtable_map}; use middle::typeck::{require_same_types, method_map, vtable_map};
@ -705,7 +705,7 @@ impl FnCtxt {
} }
} }
impl region_scope for FnCtxt { impl RegionScope for FnCtxt {
fn anon_region(&self, span: span) -> Result<ty::Region, RegionError> { fn anon_region(&self, span: span) -> Result<ty::Region, RegionError> {
result::Ok(self.infcx().next_region_var(infer::MiscVariable(span))) result::Ok(self.infcx().next_region_var(infer::MiscVariable(span)))
} }

View file

@ -97,7 +97,7 @@ pub fn collect_item_types(ccx: @mut CrateCtxt, crate: &ast::Crate) {
} }
pub trait ToTy { pub trait ToTy {
fn to_ty<RS:region_scope + Clone + 'static>( fn to_ty<RS:RegionScope + Clone + 'static>(
&self, &self,
rs: &RS, rs: &RS,
ast_ty: &ast::Ty) ast_ty: &ast::Ty)
@ -105,7 +105,7 @@ pub trait ToTy {
} }
impl ToTy for CrateCtxt { impl ToTy for CrateCtxt {
fn to_ty<RS:region_scope + Clone + 'static>( fn to_ty<RS:RegionScope + Clone + 'static>(
&self, &self,
rs: &RS, rs: &RS,
ast_ty: &ast::Ty) ast_ty: &ast::Ty)
@ -163,7 +163,7 @@ pub fn get_enum_variant_types(ccx: &CrateCtxt,
let result_ty; let result_ty;
match variant.node.kind { match variant.node.kind {
ast::tuple_variant_kind(ref args) if args.len() > 0 => { ast::tuple_variant_kind(ref args) if args.len() > 0 => {
let rs = type_rscope(region_parameterization); let rs = TypeRscope(region_parameterization);
let input_tys = args.map(|va| ccx.to_ty(&rs, &va.ty)); let input_tys = args.map(|va| ccx.to_ty(&rs, &va.ty));
result_ty = Some(ty::mk_ctor_fn(tcx, input_tys, enum_ty)); result_ty = Some(ty::mk_ctor_fn(tcx, input_tys, enum_ty));
} }
@ -724,7 +724,7 @@ pub fn convert_field(ccx: &CrateCtxt,
generics: &ast::Generics) { generics: &ast::Generics) {
let region_parameterization = let region_parameterization =
RegionParameterization::from_variance_and_generics(rp, generics); RegionParameterization::from_variance_and_generics(rp, generics);
let tt = ccx.to_ty(&type_rscope(region_parameterization), &v.node.ty); let tt = ccx.to_ty(&TypeRscope(region_parameterization), &v.node.ty);
write_ty_to_tcx(ccx.tcx, v.node.id, tt); write_ty_to_tcx(ccx.tcx, v.node.id, tt);
/* add the field to the tcache */ /* add the field to the tcache */
ccx.tcx.tcache.insert(local_def(v.node.id), ccx.tcx.tcache.insert(local_def(v.node.id),
@ -863,7 +863,7 @@ pub fn convert(ccx: &CrateCtxt, it: &ast::item) {
let i_ty_generics = ty_generics(ccx, rp, generics, 0); let i_ty_generics = ty_generics(ccx, rp, generics, 0);
let region_parameterization = let region_parameterization =
RegionParameterization::from_variance_and_generics(rp, generics); RegionParameterization::from_variance_and_generics(rp, generics);
let selfty = ccx.to_ty(&type_rscope(region_parameterization), selfty); let selfty = ccx.to_ty(&TypeRscope(region_parameterization), selfty);
write_ty_to_tcx(tcx, it.id, selfty); write_ty_to_tcx(tcx, it.id, selfty);
tcx.tcache.insert(local_def(it.id), tcx.tcache.insert(local_def(it.id),
ty_param_bounds_and_ty { ty_param_bounds_and_ty {
@ -1024,7 +1024,7 @@ pub fn instantiate_trait_ref(ccx: &CrateCtxt,
let rp = RegionParameterization::from_variance_and_generics(rp, generics); let rp = RegionParameterization::from_variance_and_generics(rp, generics);
let rscope = type_rscope(rp); let rscope = TypeRscope(rp);
match lookup_def_tcx(ccx.tcx, ast_trait_ref.path.span, ast_trait_ref.ref_id) { match lookup_def_tcx(ccx.tcx, ast_trait_ref.path.span, ast_trait_ref.ref_id) {
ast::def_trait(trait_did) => { ast::def_trait(trait_did) => {
@ -1099,7 +1099,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::item)
let rp = tcx.region_paramd_items.find(&it.id).map_move(|x| *x); let rp = tcx.region_paramd_items.find(&it.id).map_move(|x| *x);
match it.node { match it.node {
ast::item_static(ref t, _, _) => { ast::item_static(ref t, _, _) => {
let typ = ccx.to_ty(&empty_rscope, t); let typ = ccx.to_ty(&EmptyRscope, t);
let tpt = no_params(typ); let tpt = no_params(typ);
tcx.tcache.insert(local_def(it.id), tpt); tcx.tcache.insert(local_def(it.id), tpt);
return tpt; return tpt;
@ -1108,7 +1108,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::item)
assert!(rp.is_none()); assert!(rp.is_none());
let ty_generics = ty_generics(ccx, None, generics, 0); let ty_generics = ty_generics(ccx, None, generics, 0);
let tofd = astconv::ty_of_bare_fn(ccx, let tofd = astconv::ty_of_bare_fn(ccx,
&empty_rscope, &EmptyRscope,
purity, purity,
abi, abi,
&generics.lifetimes, &generics.lifetimes,
@ -1137,7 +1137,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::item)
let region_parameterization = let region_parameterization =
RegionParameterization::from_variance_and_generics(rp, generics); RegionParameterization::from_variance_and_generics(rp, generics);
let tpt = { let tpt = {
let ty = ccx.to_ty(&type_rscope(region_parameterization), t); let ty = ccx.to_ty(&TypeRscope(region_parameterization), t);
ty_param_bounds_and_ty { ty_param_bounds_and_ty {
generics: ty_generics(ccx, rp, generics, 0), generics: ty_generics(ccx, rp, generics, 0),
ty: ty ty: ty
@ -1197,7 +1197,7 @@ pub fn ty_of_foreign_item(ccx: &CrateCtxt,
type_param_defs: @~[], type_param_defs: @~[],
region_param: None, region_param: None,
}, },
ty: ast_ty_to_ty(ccx, &empty_rscope, t) ty: ast_ty_to_ty(ccx, &EmptyRscope, t)
} }
} }
} }
@ -1282,7 +1282,7 @@ pub fn ty_of_foreign_fn_decl(ccx: &CrateCtxt,
-> ty::ty_param_bounds_and_ty { -> ty::ty_param_bounds_and_ty {
let ty_generics = ty_generics(ccx, None, ast_generics, 0); let ty_generics = ty_generics(ccx, None, ast_generics, 0);
let region_param_names = RegionParamNames::from_generics(ast_generics); let region_param_names = RegionParamNames::from_generics(ast_generics);
let rb = in_binding_rscope(&empty_rscope, region_param_names); let rb = in_binding_rscope(&EmptyRscope, region_param_names);
let input_tys = decl.inputs.map(|a| ty_of_arg(ccx, &rb, a, None) ); let input_tys = decl.inputs.map(|a| ty_of_arg(ccx, &rb, a, None) );
let output_ty = ast_ty_to_ty(ccx, &rb, &decl.output); let output_ty = ast_ty_to_ty(ccx, &rb, &decl.output);

View file

@ -24,7 +24,7 @@ pub struct RegionError {
replacement: ty::Region replacement: ty::Region
} }
pub trait region_scope { pub trait RegionScope {
fn anon_region(&self, span: span) -> Result<ty::Region, RegionError>; fn anon_region(&self, span: span) -> Result<ty::Region, RegionError>;
fn self_region(&self, span: span) -> Result<ty::Region, RegionError>; fn self_region(&self, span: span) -> Result<ty::Region, RegionError>;
fn named_region(&self, span: span, id: ast::ident) fn named_region(&self, span: span, id: ast::ident)
@ -32,8 +32,8 @@ pub trait region_scope {
} }
#[deriving(Clone)] #[deriving(Clone)]
pub enum empty_rscope { empty_rscope } pub struct EmptyRscope;
impl region_scope for empty_rscope { impl RegionScope for EmptyRscope {
fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> { fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> {
result::Err(RegionError { result::Err(RegionError {
msg: ~"only 'static is allowed here", msg: ~"only 'static is allowed here",
@ -175,7 +175,7 @@ impl MethodRscope {
} }
} }
impl region_scope for MethodRscope { impl RegionScope for MethodRscope {
fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> { fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> {
result::Err(RegionError { result::Err(RegionError {
msg: ~"anonymous lifetimes are not permitted here", msg: ~"anonymous lifetimes are not permitted here",
@ -202,7 +202,7 @@ impl region_scope for MethodRscope {
if !self.region_param_names.has_ident(id) { if !self.region_param_names.has_ident(id) {
return RegionParamNames::undeclared_name(None); return RegionParamNames::undeclared_name(None);
} }
do empty_rscope.named_region(span, id).chain_err |_e| { do EmptyRscope.named_region(span, id).chain_err |_e| {
result::Err(RegionError { result::Err(RegionError {
msg: ~"lifetime is not in scope", msg: ~"lifetime is not in scope",
replacement: ty::re_bound(ty::br_self) replacement: ty::re_bound(ty::br_self)
@ -212,9 +212,9 @@ impl region_scope for MethodRscope {
} }
#[deriving(Clone)] #[deriving(Clone)]
pub struct type_rscope(Option<RegionParameterization>); pub struct TypeRscope(Option<RegionParameterization>);
impl type_rscope { impl TypeRscope {
fn replacement(&self) -> ty::Region { fn replacement(&self) -> ty::Region {
if self.is_some() { if self.is_some() {
ty::re_bound(ty::br_self) ty::re_bound(ty::br_self)
@ -223,7 +223,7 @@ impl type_rscope {
} }
} }
} }
impl region_scope for type_rscope { impl RegionScope for TypeRscope {
fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> { fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> {
result::Err(RegionError { result::Err(RegionError {
msg: ~"anonymous lifetimes are not permitted here", msg: ~"anonymous lifetimes are not permitted here",
@ -251,7 +251,7 @@ impl region_scope for type_rscope {
} }
fn named_region(&self, span: span, id: ast::ident) fn named_region(&self, span: span, id: ast::ident)
-> Result<ty::Region, RegionError> { -> Result<ty::Region, RegionError> {
do empty_rscope.named_region(span, id).chain_err |_e| { do EmptyRscope.named_region(span, id).chain_err |_e| {
result::Err(RegionError { result::Err(RegionError {
msg: ~"only 'self is allowed as part of a type declaration", msg: ~"only 'self is allowed as part of a type declaration",
replacement: self.replacement() replacement: self.replacement()
@ -268,15 +268,15 @@ pub fn bound_self_region(rp: Option<ty::region_variance>)
} }
} }
pub struct binding_rscope { pub struct BindingRscope {
base: @region_scope, base: @RegionScope,
anon_bindings: @mut uint, anon_bindings: @mut uint,
region_param_names: RegionParamNames, region_param_names: RegionParamNames,
} }
impl Clone for binding_rscope { impl Clone for BindingRscope {
fn clone(&self) -> binding_rscope { fn clone(&self) -> BindingRscope {
binding_rscope { BindingRscope {
base: self.base, base: self.base,
anon_bindings: self.anon_bindings, anon_bindings: self.anon_bindings,
region_param_names: self.region_param_names.clone(), region_param_names: self.region_param_names.clone(),
@ -284,20 +284,20 @@ impl Clone for binding_rscope {
} }
} }
pub fn in_binding_rscope<RS:region_scope + Clone + 'static>( pub fn in_binding_rscope<RS:RegionScope + Clone + 'static>(
this: &RS, this: &RS,
region_param_names: RegionParamNames) region_param_names: RegionParamNames)
-> binding_rscope { -> BindingRscope {
let base = @(*this).clone(); let base = @(*this).clone();
let base = base as @region_scope; let base = base as @RegionScope;
binding_rscope { BindingRscope {
base: base, base: base,
anon_bindings: @mut 0, anon_bindings: @mut 0,
region_param_names: region_param_names, region_param_names: region_param_names,
} }
} }
impl region_scope for binding_rscope { impl RegionScope for BindingRscope {
fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> { fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> {
let idx = *self.anon_bindings; let idx = *self.anon_bindings;
*self.anon_bindings += 1; *self.anon_bindings += 1;

View file

@ -595,7 +595,6 @@ impl<'self> Parser<'self> {
mod tests { mod tests {
use super::*; use super::*;
use prelude::*; use prelude::*;
use realstd::fmt::{String};
fn same(fmt: &'static str, p: ~[Piece<'static>]) { fn same(fmt: &'static str, p: ~[Piece<'static>]) {
let mut parser = Parser::new(fmt); let mut parser = Parser::new(fmt);

View file

@ -285,6 +285,7 @@ pub trait Primitive: Num
+ Div<Self,Self> + Div<Self,Self>
+ Rem<Self,Self> { + Rem<Self,Self> {
// FIXME (#5527): These should be associated constants // FIXME (#5527): These should be associated constants
// FIXME (#8888): Removing `unused_self` requires #8888 to be fixed.
fn bits(unused_self: Option<Self>) -> uint; fn bits(unused_self: Option<Self>) -> uint;
fn bytes(unused_self: Option<Self>) -> uint; fn bytes(unused_self: Option<Self>) -> uint;
} }
@ -327,6 +328,7 @@ pub trait Float: Real
fn is_normal(&self) -> bool; fn is_normal(&self) -> bool;
fn classify(&self) -> FPCategory; fn classify(&self) -> FPCategory;
// FIXME (#8888): Removing `unused_self` requires #8888 to be fixed.
fn mantissa_digits(unused_self: Option<Self>) -> uint; fn mantissa_digits(unused_self: Option<Self>) -> uint;
fn digits(unused_self: Option<Self>) -> uint; fn digits(unused_self: Option<Self>) -> uint;
fn epsilon() -> Self; fn epsilon() -> Self;

View file

@ -12,6 +12,7 @@
use cast; use cast;
use clone::Clone; use clone::Clone;
#[cfg(not(test))]
use cmp::Equiv; use cmp::Equiv;
use iterator::{range, Iterator}; use iterator::{range, Iterator};
use option::{Option, Some, None}; use option::{Option, Some, None};

View file

@ -340,7 +340,7 @@ mod test {
use parse::token::{str_to_ident}; use parse::token::{str_to_ident};
use util::parser_testing::{string_to_tts_and_sess, string_to_parser}; use util::parser_testing::{string_to_tts_and_sess, string_to_parser};
use util::parser_testing::{string_to_expr, string_to_item}; use util::parser_testing::{string_to_expr, string_to_item};
use util::parser_testing::{string_to_stmt, strs_to_idents}; use util::parser_testing::string_to_stmt;
// map a string to tts, return the tt without its parsesess // map a string to tts, return the tt without its parsesess
fn string_to_tts_only(source_str : @str) -> ~[ast::token_tree] { fn string_to_tts_only(source_str : @str) -> ~[ast::token_tree] {

View file

@ -28,7 +28,6 @@ use std::io;
use std::os; use std::os;
use std::result::{Ok, Err}; use std::result::{Ok, Err};
use std::task; use std::task;
use std::u64;
use std::uint; use std::uint;
fn fib(n: int) -> int { fn fib(n: int) -> int {

View file

@ -13,11 +13,8 @@
extern mod cci_const; extern mod cci_const;
use cci_const::bar; use cci_const::bar;
use std::cast::transmute;
static foo: extern "C" fn() = bar; static foo: extern "C" fn() = bar;
pub fn main() { pub fn main() {
unsafe { assert_eq!(foo, bar);
assert_eq!(foo, bar);
}
} }

View file

@ -18,8 +18,6 @@ struct S {
} }
pub fn main() { pub fn main() {
unsafe { assert_eq!(foopy, f);
assert_eq!(foopy, f); assert_eq!(f, s.f);
assert_eq!(f, s.f);
}
} }

View file

@ -15,7 +15,7 @@ extern fn voidret2() {}
extern fn uintret() -> uint { 22 } extern fn uintret() -> uint { 22 }
extern fn uintvoidret(x: uint) {} extern fn uintvoidret(_x: uint) {}
extern fn uintuintuintuintret(x: uint, y: uint, z: uint) -> uint { x+y+z } extern fn uintuintuintuintret(x: uint, y: uint, z: uint) -> uint { x+y+z }

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::cast::transmute;
extern fn f() { extern fn f() {
} }
@ -17,12 +15,10 @@ extern fn g() {
} }
pub fn main() { pub fn main() {
unsafe { let a: extern "C" fn() = f;
let a: extern "C" fn() = f; let b: extern "C" fn() = f;
let b: extern "C" fn() = f; let c: extern "C" fn() = g;
let c: extern "C" fn() = g;
assert_eq!(a, b); assert_eq!(a, b);
assert!(a != c); assert!(a != c);
}
} }

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::io;
struct T (&'static [int]); struct T (&'static [int]);
static t : T = T (&'static [5, 4, 3]); static t : T = T (&'static [5, 4, 3]);
fn main () { fn main () {

View file

@ -10,8 +10,6 @@
// xfail-fast // xfail-fast
use std::int;
trait vec_monad<A> { trait vec_monad<A> {
fn bind<B>(&self, f: &fn(&A) -> ~[B]) -> ~[B]; fn bind<B>(&self, f: &fn(&A) -> ~[B]) -> ~[B];
} }

View file

@ -10,7 +10,6 @@
// xfail-fast // xfail-fast
use std::int;
use std::libc::c_void; use std::libc::c_void;
use std::ptr; use std::ptr;
use std::sys; use std::sys;

View file

@ -10,8 +10,6 @@
// xfail-fast // xfail-fast
use std::uint;
pub trait plus { pub trait plus {
fn plus(&self) -> int; fn plus(&self) -> int;
} }

View file

@ -10,8 +10,6 @@
// xfail-fast // xfail-fast
use std::int;
trait to_str { trait to_str {
fn to_string(&self) -> ~str; fn to_string(&self) -> ~str;
} }