librustc: Mark all type implementations public. rs=impl-publicity
This commit is contained in:
parent
b171d0ef7b
commit
107bf96ff0
114 changed files with 175 additions and 175 deletions
|
@ -28,7 +28,7 @@ pub pure fn empty_cell<T>() -> Cell<T> {
|
|||
Cell { value: None }
|
||||
}
|
||||
|
||||
impl<T> Cell<T> {
|
||||
pub impl<T> Cell<T> {
|
||||
/// Yields the value, failing if the cell is empty.
|
||||
fn take() -> T {
|
||||
if self.is_empty() {
|
||||
|
|
|
@ -190,7 +190,7 @@ pub fn PortSet<T: Owned>() -> PortSet<T>{
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: Owned> PortSet<T> {
|
||||
pub impl<T: Owned> PortSet<T> {
|
||||
|
||||
fn add(port: Port<T>) {
|
||||
self.ports.push(port)
|
||||
|
@ -323,12 +323,12 @@ pub fn oneshot<T: Owned>() -> (PortOne<T>, ChanOne<T>) {
|
|||
(port, chan)
|
||||
}
|
||||
|
||||
impl<T: Owned> PortOne<T> {
|
||||
pub impl<T: Owned> PortOne<T> {
|
||||
fn recv(self) -> T { recv_one(self) }
|
||||
fn try_recv(self) -> Option<T> { try_recv_one(self) }
|
||||
}
|
||||
|
||||
impl<T: Owned> ChanOne<T> {
|
||||
pub impl<T: Owned> ChanOne<T> {
|
||||
fn send(self, data: T) { send_one(self, data) }
|
||||
fn try_send(self, data: T) -> bool { try_send_one(self, data) }
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ pub struct Condition<T, U> {
|
|||
key: task::local_data::LocalDataKey<Handler<T, U>>
|
||||
}
|
||||
|
||||
impl<T, U> Condition<T, U> {
|
||||
pub impl<T, U> Condition<T, U> {
|
||||
fn trap(&self, h: &self/fn(T) -> U) -> Trap/&self<T, U> {
|
||||
unsafe {
|
||||
let p : *RustClosure = ::cast::transmute(&h);
|
||||
|
@ -69,7 +69,7 @@ struct Trap<T, U> {
|
|||
handler: @Handler<T, U>
|
||||
}
|
||||
|
||||
impl<T, U> Trap<T, U> {
|
||||
pub impl<T, U> Trap<T, U> {
|
||||
fn in<V>(&self, inner: &self/fn() -> V) -> V {
|
||||
unsafe {
|
||||
let _g = Guard { cond: self.cond };
|
||||
|
|
|
@ -62,7 +62,7 @@ priv impl<T> DListNode<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> DListNode<T> {
|
||||
pub impl<T> DListNode<T> {
|
||||
/// Get the next node in the list, if there is one.
|
||||
pure fn next_link(@mut self) -> DListLink<T> {
|
||||
self.assert_links();
|
||||
|
@ -208,7 +208,7 @@ priv impl<T> DList<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> DList<T> {
|
||||
pub impl<T> DList<T> {
|
||||
/// Get the size of the list. O(1).
|
||||
pure fn len(@mut self) -> uint { self.size }
|
||||
/// Returns true if the list is empty. O(1).
|
||||
|
@ -457,7 +457,7 @@ impl<T> DList<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Copy> DList<T> {
|
||||
pub impl<T:Copy> DList<T> {
|
||||
/// Remove data from the head of the list. O(1).
|
||||
fn pop(@mut self) -> Option<T> {
|
||||
self.pop_n().map(|nobe| nobe.data)
|
||||
|
|
|
@ -117,7 +117,7 @@ priv impl<A> DVec<A> {
|
|||
// In theory, most everything should work with any A, but in practice
|
||||
// almost nothing works without the copy bound due to limitations
|
||||
// around closures.
|
||||
impl<A> DVec<A> {
|
||||
pub impl<A> DVec<A> {
|
||||
/// Reserves space for N elements
|
||||
fn reserve(count: uint) {
|
||||
vec::reserve(&mut self.data, count)
|
||||
|
@ -215,7 +215,7 @@ impl<A> DVec<A> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<A:Copy> DVec<A> {
|
||||
pub impl<A:Copy> DVec<A> {
|
||||
/**
|
||||
* Append all elements of a vector to the end of the list
|
||||
*
|
||||
|
|
|
@ -43,7 +43,7 @@ pub fn unwrap<T>(m: Mut<T>) -> T {
|
|||
value
|
||||
}
|
||||
|
||||
impl<T> Data<T> {
|
||||
pub impl<T> Data<T> {
|
||||
fn borrow_mut<R>(op: &fn(t: &mut T) -> R) -> R {
|
||||
match self.mode {
|
||||
Immutable => fail!(fmt!("%? currently immutable",
|
||||
|
|
|
@ -281,7 +281,7 @@ pub pure fn expect<T>(opt: Option<T>, reason: &str) -> T {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> Option<T> {
|
||||
pub impl<T> Option<T> {
|
||||
/// Returns true if the option equals `none`
|
||||
#[inline(always)]
|
||||
pure fn is_none(&self) -> bool { is_none(self) }
|
||||
|
@ -393,7 +393,7 @@ impl<T> Option<T> {
|
|||
pure fn expect(self, reason: &str) -> T { expect(self, reason) }
|
||||
}
|
||||
|
||||
impl<T:Copy> Option<T> {
|
||||
pub impl<T:Copy> Option<T> {
|
||||
/**
|
||||
Gets the value out of an option
|
||||
|
||||
|
@ -421,7 +421,7 @@ impl<T:Copy> Option<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Copy + Zero> Option<T> {
|
||||
pub impl<T:Copy + Zero> Option<T> {
|
||||
#[inline(always)]
|
||||
pure fn get_or_zero(self) -> T { get_or_zero(self) }
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ mod stat {
|
|||
}
|
||||
|
||||
|
||||
impl Path {
|
||||
pub impl Path {
|
||||
fn stat(&self) -> Option<libc::stat> {
|
||||
unsafe {
|
||||
do str::as_c_str(self.to_str()) |buf| {
|
||||
|
@ -290,7 +290,7 @@ impl Path {
|
|||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
impl Path {
|
||||
pub impl Path {
|
||||
fn get_atime(&self) -> Option<(i64, int)> {
|
||||
match self.stat() {
|
||||
None => None,
|
||||
|
@ -324,7 +324,7 @@ impl Path {
|
|||
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(target_os = "macos")]
|
||||
impl Path {
|
||||
pub impl Path {
|
||||
fn get_birthtime(&self) -> Option<(i64, int)> {
|
||||
match self.stat() {
|
||||
None => None,
|
||||
|
@ -337,7 +337,7 @@ impl Path {
|
|||
}
|
||||
|
||||
#[cfg(target_os = "win32")]
|
||||
impl Path {
|
||||
pub impl Path {
|
||||
fn get_atime(&self) -> Option<(i64, int)> {
|
||||
match self.stat() {
|
||||
None => None,
|
||||
|
|
|
@ -800,7 +800,7 @@ pub fn SendPacketBuffered<T,Tbuffer>(p: *Packet<T>)
|
|||
}
|
||||
}
|
||||
|
||||
impl<T,Tbuffer> SendPacketBuffered<T,Tbuffer> {
|
||||
pub impl<T,Tbuffer> SendPacketBuffered<T,Tbuffer> {
|
||||
fn unwrap() -> *Packet<T> {
|
||||
let mut p = None;
|
||||
p <-> self.p;
|
||||
|
@ -857,7 +857,7 @@ impl<T:Owned,Tbuffer:Owned> ::ops::Drop for RecvPacketBuffered<T,Tbuffer> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Owned,Tbuffer:Owned> RecvPacketBuffered<T, Tbuffer> {
|
||||
pub impl<T:Owned,Tbuffer:Owned> RecvPacketBuffered<T, Tbuffer> {
|
||||
fn unwrap() -> *Packet<T> {
|
||||
let mut p = None;
|
||||
p <-> self.p;
|
||||
|
|
|
@ -335,7 +335,7 @@ fn LittleLock() -> LittleLock {
|
|||
}
|
||||
}
|
||||
|
||||
impl LittleLock {
|
||||
pub impl LittleLock {
|
||||
#[inline(always)]
|
||||
unsafe fn lock<T>(f: fn() -> T) -> T {
|
||||
struct Unlock {
|
||||
|
@ -381,7 +381,7 @@ impl<T:Owned> Clone for Exclusive<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Owned> Exclusive<T> {
|
||||
pub impl<T:Owned> Exclusive<T> {
|
||||
// Exactly like std::arc::mutex_arc,access(), but with the little_lock
|
||||
// instead of a proper mutex. Same reason for being unsafe.
|
||||
//
|
||||
|
|
|
@ -142,7 +142,7 @@ pub mod ct {
|
|||
next: uint
|
||||
}
|
||||
|
||||
impl<T> Parsed<T> {
|
||||
pub impl<T> Parsed<T> {
|
||||
static pure fn new(val: T, next: uint) -> Parsed<T> {
|
||||
Parsed {val: val, next: next}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ pub struct Weighted<T> {
|
|||
}
|
||||
|
||||
/// Extension methods for random number generators
|
||||
impl Rng {
|
||||
pub impl Rng {
|
||||
/// Return a random value for a Rand type
|
||||
fn gen<T:Rand>() -> T {
|
||||
Rand::rand(self)
|
||||
|
|
|
@ -45,7 +45,7 @@ pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
|
|||
MovePtrAdaptor { inner: v }
|
||||
}
|
||||
|
||||
impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
|
||||
pub impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
|
||||
#[inline(always)]
|
||||
fn bump(sz: uint) {
|
||||
do self.inner.move_ptr() |p| {
|
||||
|
|
|
@ -167,7 +167,7 @@ impl MovePtr for ReprVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
impl ReprVisitor {
|
||||
pub impl ReprVisitor {
|
||||
|
||||
// Various helpers for the TyVisitor impl
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ pub pure fn map_err<T:Copy,E,F:Copy>(res: &Result<T, E>, op: fn(&E) -> F)
|
|||
}
|
||||
}
|
||||
|
||||
impl<T, E> Result<T, E> {
|
||||
pub impl<T, E> Result<T, E> {
|
||||
#[inline(always)]
|
||||
pure fn get_ref(&self) -> &self/T { get_ref(self) }
|
||||
|
||||
|
@ -261,7 +261,7 @@ impl<T, E> Result<T, E> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Copy,E> Result<T, E> {
|
||||
pub impl<T:Copy,E> Result<T, E> {
|
||||
#[inline(always)]
|
||||
pure fn get(&self) -> T { get(self) }
|
||||
|
||||
|
@ -271,7 +271,7 @@ impl<T:Copy,E> Result<T, E> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T, E: Copy> Result<T, E> {
|
||||
pub impl<T, E: Copy> Result<T, E> {
|
||||
#[inline(always)]
|
||||
pure fn get_err(&self) -> E { get_err(self) }
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ priv impl TaskBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
impl TaskBuilder {
|
||||
pub impl TaskBuilder {
|
||||
/**
|
||||
* Decouple the child task's failure from the parent's. If either fails,
|
||||
* the other will not be killed.
|
||||
|
|
|
@ -167,7 +167,7 @@ fn reserve_id_range(sess: Session,
|
|||
ast_util::id_range { min: to_id_min, max: to_id_min }
|
||||
}
|
||||
|
||||
impl ExtendedDecodeContext {
|
||||
pub impl ExtendedDecodeContext {
|
||||
fn tr_id(&self, id: ast::node_id) -> ast::node_id {
|
||||
/*!
|
||||
*
|
||||
|
|
|
@ -89,7 +89,7 @@ enum assignment_type {
|
|||
at_swap
|
||||
}
|
||||
|
||||
impl assignment_type {
|
||||
pub impl assignment_type {
|
||||
fn checked_by_liveness(&self) -> bool {
|
||||
// the liveness pass guarantees that immutable local variables
|
||||
// are only assigned once; but it doesn't consider &mut
|
||||
|
@ -106,7 +106,7 @@ impl assignment_type {
|
|||
}
|
||||
}
|
||||
|
||||
impl CheckLoanCtxt {
|
||||
pub impl CheckLoanCtxt {
|
||||
fn tcx(@mut self) -> ty::ctxt { self.bccx.tcx }
|
||||
|
||||
fn purity(@mut self, scope_id: ast::node_id) -> Option<purity_cause> {
|
||||
|
|
|
@ -289,7 +289,7 @@ fn req_loans_in_expr(ex: @ast::expr,
|
|||
self.root_ub = old_root_ub;
|
||||
}
|
||||
|
||||
impl GatherLoanCtxt {
|
||||
pub impl GatherLoanCtxt {
|
||||
fn tcx(@mut self) -> ty::ctxt { self.bccx.tcx }
|
||||
|
||||
fn guarantee_adjustments(@mut self,
|
||||
|
|
|
@ -87,7 +87,7 @@ struct LoanContext {
|
|||
loans: ~[Loan]
|
||||
}
|
||||
|
||||
impl LoanContext {
|
||||
pub impl LoanContext {
|
||||
fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
|
||||
|
||||
fn loan(&mut self,
|
||||
|
|
|
@ -433,7 +433,7 @@ pub fn save_and_restore_managed<T:Copy,U>(save_and_restore_t: @mut T,
|
|||
u
|
||||
}
|
||||
|
||||
impl LoanKind {
|
||||
pub impl LoanKind {
|
||||
fn is_freeze(&self) -> bool {
|
||||
match *self {
|
||||
TotalFreeze | PartialFreeze => true,
|
||||
|
|
|
@ -35,7 +35,7 @@ pub enum PreserveCondition {
|
|||
PcIfPure(bckerr)
|
||||
}
|
||||
|
||||
impl PreserveCondition {
|
||||
pub impl PreserveCondition {
|
||||
// combines two preservation conditions such that if either of
|
||||
// them requires purity, the result requires purity
|
||||
fn combine(&self, pc: PreserveCondition) -> PreserveCondition {
|
||||
|
@ -46,7 +46,7 @@ impl PreserveCondition {
|
|||
}
|
||||
}
|
||||
|
||||
impl BorrowckCtxt {
|
||||
pub impl BorrowckCtxt {
|
||||
fn preserve(&self,
|
||||
cmt: cmt,
|
||||
scope_region: ty::Region,
|
||||
|
@ -80,7 +80,7 @@ struct PreserveCtxt {
|
|||
root_managed_data: bool
|
||||
}
|
||||
|
||||
impl PreserveCtxt {
|
||||
pub impl PreserveCtxt {
|
||||
fn tcx(&self) -> ty::ctxt { self.bccx.tcx }
|
||||
|
||||
fn preserve(&self, cmt: cmt) -> bckres<PreserveCondition> {
|
||||
|
|
|
@ -322,7 +322,7 @@ struct LanguageItemCollector {
|
|||
item_refs: HashMap<@~str, uint>,
|
||||
}
|
||||
|
||||
impl LanguageItemCollector {
|
||||
pub impl LanguageItemCollector {
|
||||
fn match_and_collect_meta_item(&self, item_def_id: def_id,
|
||||
meta_item: meta_item) {
|
||||
match meta_item.node {
|
||||
|
|
|
@ -331,7 +331,7 @@ struct Context {
|
|||
sess: Session
|
||||
}
|
||||
|
||||
impl Context {
|
||||
pub impl Context {
|
||||
fn get_level(&self, lint: lint) -> level {
|
||||
get_lint_level(self.curr, lint)
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ impl to_str::ToStr for Variable {
|
|||
// variable must not be assigned if there is some successor
|
||||
// assignment. And so forth.
|
||||
|
||||
impl LiveNode {
|
||||
pub impl LiveNode {
|
||||
pure fn is_valid(&self) -> bool { **self != uint::max_value }
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,7 @@ fn IrMaps(tcx: ty::ctxt,
|
|||
}
|
||||
}
|
||||
|
||||
impl IrMaps {
|
||||
pub impl IrMaps {
|
||||
fn add_live_node(&mut self, lnk: LiveNodeKind) -> LiveNode {
|
||||
let ln = LiveNode(self.num_live_nodes);
|
||||
self.lnks.push(lnk);
|
||||
|
@ -693,7 +693,7 @@ fn Liveness(ir: @mut IrMaps, specials: Specials) -> Liveness {
|
|||
}
|
||||
}
|
||||
|
||||
impl Liveness {
|
||||
pub impl Liveness {
|
||||
fn live_node(&self, node_id: node_id, span: span) -> LiveNode {
|
||||
match self.ir.live_node_map.find(&node_id) {
|
||||
Some(ln) => ln,
|
||||
|
@ -1649,7 +1649,7 @@ enum ReadKind {
|
|||
PartiallyMovedValue
|
||||
}
|
||||
|
||||
impl @Liveness {
|
||||
pub impl @Liveness {
|
||||
fn check_ret(&self, id: node_id, sp: span, _fk: visit::fn_kind,
|
||||
entry_ln: LiveNode) {
|
||||
if self.live_on_entry(entry_ln, self.s.no_ret_var).is_some() {
|
||||
|
|
|
@ -312,7 +312,7 @@ impl ToStr for MutabilityCategory {
|
|||
}
|
||||
}
|
||||
|
||||
impl MutabilityCategory {
|
||||
pub impl MutabilityCategory {
|
||||
static fn from_mutbl(&self, m: ast::mutability) -> MutabilityCategory {
|
||||
match m {
|
||||
m_imm => McImmutable,
|
||||
|
|
|
@ -301,7 +301,7 @@ fn compute_modes_for_expr(expr: @expr,
|
|||
cx.consume_expr(expr, v);
|
||||
}
|
||||
|
||||
impl UseMode {
|
||||
pub impl UseMode {
|
||||
fn component_mode(&self, expr: @expr) -> UseMode {
|
||||
/*!
|
||||
*
|
||||
|
@ -316,7 +316,7 @@ impl UseMode {
|
|||
}
|
||||
}
|
||||
|
||||
impl VisitContext {
|
||||
pub impl VisitContext {
|
||||
fn consume_exprs(&self,
|
||||
exprs: &[@expr],
|
||||
visitor: vt<VisitContext>)
|
||||
|
|
|
@ -154,7 +154,7 @@ pub enum Dest {
|
|||
Ignore,
|
||||
}
|
||||
|
||||
impl Dest {
|
||||
pub impl Dest {
|
||||
fn to_str(&self, ccx: @CrateContext) -> ~str {
|
||||
match *self {
|
||||
SaveIn(v) => fmt!("SaveIn(%s)", val_str(ccx.tn, v)),
|
||||
|
|
|
@ -3714,7 +3714,7 @@ pub enum DtorKind {
|
|||
TraitDtor(def_id)
|
||||
}
|
||||
|
||||
impl DtorKind {
|
||||
pub impl DtorKind {
|
||||
pure fn is_not_present(&const self) -> bool {
|
||||
match *self {
|
||||
NoDtor => true,
|
||||
|
|
|
@ -87,7 +87,7 @@ use syntax::ast;
|
|||
// function.
|
||||
pub enum Coerce = CombineFields;
|
||||
|
||||
impl Coerce {
|
||||
pub impl Coerce {
|
||||
fn tys(&self, a: ty::t, b: ty::t) -> CoerceResult {
|
||||
debug!("Coerce.tys(%s => %s)",
|
||||
a.inf_str(self.infcx),
|
||||
|
|
|
@ -551,7 +551,7 @@ struct Snapshot {
|
|||
region_vars_snapshot: uint,
|
||||
}
|
||||
|
||||
impl @mut InferCtxt {
|
||||
pub impl @mut InferCtxt {
|
||||
fn combine_fields(&self, a_is_expected: bool,
|
||||
span: span) -> CombineFields {
|
||||
CombineFields {infcx: *self,
|
||||
|
@ -643,7 +643,7 @@ fn next_simple_var<V:Copy,T:Copy>(
|
|||
return id;
|
||||
}
|
||||
|
||||
impl @mut InferCtxt {
|
||||
pub impl @mut InferCtxt {
|
||||
fn next_ty_var_id(&self) -> TyVid {
|
||||
let id = self.ty_var_counter;
|
||||
self.ty_var_counter += 1;
|
||||
|
|
|
@ -1218,7 +1218,7 @@ fn TwoRegionsMap() -> TwoRegionsMap {
|
|||
return HashMap();
|
||||
}
|
||||
|
||||
impl RegionVarBindings {
|
||||
pub impl RegionVarBindings {
|
||||
fn infer_variable_values(&mut self) -> ~[GraphNodeValue] {
|
||||
let mut graph = self.construct_graph();
|
||||
self.expansion(&mut graph);
|
||||
|
|
|
@ -79,7 +79,7 @@ fn setup_env(test_name: &str, source_string: &str) -> Env {
|
|||
err_messages: messages};
|
||||
}
|
||||
|
||||
impl Env {
|
||||
pub impl Env {
|
||||
fn create_region_hierarchy(&self, rh: &RH) {
|
||||
for rh.sub.each |child_rh| {
|
||||
self.create_region_hierarchy(child_rh);
|
||||
|
|
|
@ -174,7 +174,7 @@ pub struct IndexEntry {
|
|||
link: ~str
|
||||
}
|
||||
|
||||
impl Doc {
|
||||
pub impl Doc {
|
||||
fn CrateDoc(&self) -> CrateDoc {
|
||||
option::get(vec::foldl(None, self.pages, |_m, page| {
|
||||
match copy *page {
|
||||
|
@ -190,7 +190,7 @@ impl Doc {
|
|||
}
|
||||
|
||||
/// Some helper methods on ModDoc, mostly for testing
|
||||
impl ModDoc {
|
||||
pub impl ModDoc {
|
||||
fn mods(&self) -> ~[ModDoc] {
|
||||
do vec::filter_mapped(self.items) |itemtag| {
|
||||
match copy *itemtag {
|
||||
|
|
|
@ -51,7 +51,7 @@ fn test() {
|
|||
fn ifn() { } \
|
||||
enum ienum { ivar } \
|
||||
trait itrait { fn a(); } \
|
||||
impl int { fn a() { } } \
|
||||
pub impl int { fn a() { } } \
|
||||
type itype = int; \
|
||||
struct istruct { f: () }";
|
||||
do astsrv::from_str(source) |srv| {
|
||||
|
|
|
@ -30,7 +30,7 @@ use core::util;
|
|||
/// As sync::condvar, a mechanism for unlock-and-descheduling and signalling.
|
||||
pub struct Condvar { is_mutex: bool, failed: &mut bool, cond: &sync::Condvar }
|
||||
|
||||
impl &Condvar {
|
||||
pub impl &Condvar {
|
||||
/// Atomically exit the associated ARC and block until a signal is sent.
|
||||
#[inline(always)]
|
||||
fn wait() { self.wait_on(0) }
|
||||
|
@ -158,7 +158,7 @@ impl<T:Owned> Clone for MutexARC<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Owned> &MutexARC<T> {
|
||||
pub impl<T:Owned> &MutexARC<T> {
|
||||
|
||||
/**
|
||||
* Access the underlying mutable data with mutual exclusion from other
|
||||
|
@ -301,7 +301,7 @@ pub fn rw_arc_with_condvars<T:Const + Owned>(
|
|||
RWARC { x: unsafe { shared_mutable_state(data) }, cant_nest: () }
|
||||
}
|
||||
|
||||
impl<T:Const + Owned> RWARC<T> {
|
||||
pub impl<T:Const + Owned> RWARC<T> {
|
||||
/// Duplicate a rwlock-protected ARC, as arc::clone.
|
||||
fn clone(&self) -> RWARC<T> {
|
||||
RWARC { x: unsafe { clone_shared_mutable_state(&self.x) },
|
||||
|
@ -310,7 +310,7 @@ impl<T:Const + Owned> RWARC<T> {
|
|||
|
||||
}
|
||||
|
||||
impl<T:Const + Owned> &RWARC<T> {
|
||||
pub impl<T:Const + Owned> &RWARC<T> {
|
||||
/**
|
||||
* Access the underlying data mutably. Locks the rwlock in write mode;
|
||||
* other readers and writers will block.
|
||||
|
@ -445,7 +445,7 @@ pub enum RWWriteMode<T> =
|
|||
/// The "read permission" token used for RWARC.write_downgrade().
|
||||
pub enum RWReadMode<T> = (&T, sync::RWlockReadMode);
|
||||
|
||||
impl<T:Const + Owned> &RWWriteMode<T> {
|
||||
pub impl<T:Const + Owned> &RWWriteMode<T> {
|
||||
/// Access the pre-downgrade RWARC in write mode.
|
||||
fn write<U>(blk: fn(x: &mut T) -> U) -> U {
|
||||
match *self {
|
||||
|
@ -475,7 +475,7 @@ impl<T:Const + Owned> &RWWriteMode<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Const + Owned> &RWReadMode<T> {
|
||||
pub impl<T:Const + Owned> &RWReadMode<T> {
|
||||
/// Access the post-downgrade rwlock in read mode.
|
||||
fn read<U>(blk: fn(x: &T) -> U) -> U {
|
||||
match *self {
|
||||
|
|
|
@ -161,7 +161,7 @@ unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TypeDesc, bool) {
|
|||
(reinterpret_cast(&(p & !1)), p & 1 == 1)
|
||||
}
|
||||
|
||||
impl &Arena {
|
||||
pub impl &Arena {
|
||||
// Functions for the POD part of the arena
|
||||
fn alloc_pod_grow(n_bytes: uint, align: uint) -> *u8 {
|
||||
// Allocate a new chunk.
|
||||
|
|
|
@ -27,7 +27,7 @@ fn small_mask(nbits: uint) -> uint {
|
|||
(1 << nbits) - 1
|
||||
}
|
||||
|
||||
impl SmallBitv {
|
||||
pub impl SmallBitv {
|
||||
static fn new(bits: uint) -> SmallBitv {
|
||||
SmallBitv {bits: bits}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ fn big_mask(nbits: uint, elem: uint) -> uint {
|
|||
}
|
||||
}
|
||||
|
||||
impl BigBitv {
|
||||
pub impl BigBitv {
|
||||
static fn new(storage: ~[uint]) -> BigBitv {
|
||||
BigBitv {storage: storage}
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ priv impl Bitv {
|
|||
|
||||
}
|
||||
|
||||
impl Bitv {
|
||||
pub impl Bitv {
|
||||
static fn new(nbits: uint, init: bool) -> Bitv {
|
||||
let rep = if nbits <= uint::bits {
|
||||
Small(~SmallBitv::new(if init {!0} else {0}))
|
||||
|
@ -591,7 +591,7 @@ pub struct BitvSet {
|
|||
priv bitv: BigBitv
|
||||
}
|
||||
|
||||
impl BitvSet {
|
||||
pub impl BitvSet {
|
||||
/// Creates a new bit vector set with initially no contents
|
||||
static fn new() -> BitvSet {
|
||||
BitvSet{ size: 0, bitv: BigBitv::new(~[0]) }
|
||||
|
|
|
@ -37,7 +37,7 @@ impl<T> Mutable for Deque<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> Deque<T> {
|
||||
pub impl<T> Deque<T> {
|
||||
static pure fn new() -> Deque<T> {
|
||||
Deque{nelts: 0, lo: 0, hi: 0,
|
||||
elts: vec::from_fn(initial_capacity, |_| None)}
|
||||
|
|
|
@ -279,7 +279,7 @@ pub mod reader {
|
|||
}
|
||||
}
|
||||
|
||||
impl Decoder {
|
||||
pub impl Decoder {
|
||||
fn read_opaque<R>(&self, op: fn(Doc) -> R) -> R {
|
||||
do self.push_doc(self.next_doc(EsOpaque)) {
|
||||
op(copy self.parent)
|
||||
|
@ -451,7 +451,7 @@ pub mod writer {
|
|||
}
|
||||
|
||||
// FIXME (#2741): Provide a function to write the standard ebml header.
|
||||
impl Encoder {
|
||||
pub impl Encoder {
|
||||
fn start_tag(tag_id: uint) {
|
||||
debug!("Start tag %u", tag_id);
|
||||
|
||||
|
@ -571,7 +571,7 @@ pub mod writer {
|
|||
}
|
||||
}
|
||||
|
||||
impl Encoder {
|
||||
pub impl Encoder {
|
||||
fn emit_opaque(&self, f: fn()) {
|
||||
do self.wr_tag(EsOpaque as uint) {
|
||||
f()
|
||||
|
|
|
@ -49,14 +49,14 @@ priv enum FutureState<A> {
|
|||
}
|
||||
|
||||
/// Methods on the `future` type
|
||||
impl<A:Copy> Future<A> {
|
||||
pub impl<A:Copy> Future<A> {
|
||||
fn get() -> A {
|
||||
//! Get the value of the future
|
||||
*(self.get_ref())
|
||||
}
|
||||
}
|
||||
|
||||
impl<A> Future<A> {
|
||||
pub impl<A> Future<A> {
|
||||
|
||||
pure fn get_ref(&self) -> &self/A {
|
||||
/*!
|
||||
|
|
|
@ -820,7 +820,7 @@ pub fn socket_buf(sock: TcpSocket) -> TcpSocketBuf {
|
|||
}
|
||||
|
||||
/// Convenience methods extending `net::tcp::tcp_socket`
|
||||
impl TcpSocket {
|
||||
pub impl TcpSocket {
|
||||
pub fn read_start() -> result::Result<@Port<
|
||||
result::Result<~[u8], TcpErrData>>, TcpErrData> {
|
||||
read_start(&self)
|
||||
|
|
|
@ -168,7 +168,7 @@ pub mod chained {
|
|||
}
|
||||
}
|
||||
|
||||
impl<K:Eq + IterBytes + Hash,V> T<K, V> {
|
||||
pub impl<K:Eq + IterBytes + Hash,V> T<K, V> {
|
||||
pure fn contains_key(&self, k: &K) -> bool {
|
||||
let hash = k.hash_keyed(0,0) as uint;
|
||||
match self.search_tbl(k, hash) {
|
||||
|
@ -252,7 +252,7 @@ pub mod chained {
|
|||
}
|
||||
}
|
||||
|
||||
impl<K:Eq + IterBytes + Hash + Copy,V:Copy> T<K, V> {
|
||||
pub impl<K:Eq + IterBytes + Hash + Copy,V:Copy> T<K, V> {
|
||||
pure fn find(&self, k: &K) -> Option<V> {
|
||||
match self.search_tbl(k, k.hash_keyed(0,0) as uint) {
|
||||
NotFound => None,
|
||||
|
@ -325,7 +325,7 @@ pub mod chained {
|
|||
}
|
||||
}
|
||||
|
||||
impl<K:Eq + IterBytes + Hash + Copy + ToStr,V:ToStr + Copy> T<K, V> {
|
||||
pub impl<K:Eq + IterBytes + Hash + Copy + ToStr,V:ToStr + Copy> T<K, V> {
|
||||
fn to_writer(wr: io::Writer) {
|
||||
if self.count == 0u {
|
||||
wr.write_str(~"{}");
|
||||
|
|
|
@ -48,7 +48,7 @@ impl<T:Ord> Mutable for PriorityQueue<T> {
|
|||
fn clear(&mut self) { self.data.truncate(0) }
|
||||
}
|
||||
|
||||
impl <T:Ord> PriorityQueue<T> {
|
||||
pub impl <T:Ord> PriorityQueue<T> {
|
||||
/// Returns the greatest item in the queue - fails if empty
|
||||
pure fn top(&self) -> &self/T { &self.data[0] }
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ fn MergeState<T>() -> MergeState<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Copy + Ord> MergeState<T> {
|
||||
pub impl<T:Copy + Ord> MergeState<T> {
|
||||
fn push_run(&self, run_base: uint, run_len: uint) {
|
||||
let tmp = RunState{base: run_base, len: run_len};
|
||||
self.runs.push(tmp);
|
||||
|
|
|
@ -100,7 +100,7 @@ fn new_sem_and_signal(count: int, num_condvars: uint)
|
|||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl<Q:Owned> &Sem<Q> {
|
||||
pub impl<Q:Owned> &Sem<Q> {
|
||||
fn acquire() {
|
||||
let mut waiter_nobe = None;
|
||||
unsafe {
|
||||
|
@ -136,7 +136,7 @@ impl<Q:Owned> &Sem<Q> {
|
|||
}
|
||||
// FIXME(#3154) move both copies of this into Sem<Q>, and unify the 2 structs
|
||||
#[doc(hidden)]
|
||||
impl &Sem<()> {
|
||||
pub impl &Sem<()> {
|
||||
fn access<U>(blk: fn() -> U) -> U {
|
||||
let mut release = None;
|
||||
unsafe {
|
||||
|
@ -149,7 +149,7 @@ impl &Sem<()> {
|
|||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
impl &Sem<~[Waitqueue]> {
|
||||
pub impl &Sem<~[Waitqueue]> {
|
||||
fn access<U>(blk: fn() -> U) -> U {
|
||||
let mut release = None;
|
||||
unsafe {
|
||||
|
@ -192,7 +192,7 @@ pub struct Condvar { priv sem: &Sem<~[Waitqueue]> }
|
|||
|
||||
impl Drop for Condvar { fn finalize(&self) {} }
|
||||
|
||||
impl &Condvar {
|
||||
pub impl &Condvar {
|
||||
/**
|
||||
* Atomically drop the associated lock, and block until a signal is sent.
|
||||
*
|
||||
|
@ -344,7 +344,7 @@ fn check_cvar_bounds<U>(out_of_bounds: Option<uint>, id: uint, act: &str,
|
|||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl &Sem<~[Waitqueue]> {
|
||||
pub impl &Sem<~[Waitqueue]> {
|
||||
// The only other place that condvars get built is rwlock_write_mode.
|
||||
fn access_cond<U>(blk: fn(c: &Condvar) -> U) -> U {
|
||||
do self.access { blk(&Condvar { sem: self }) }
|
||||
|
@ -370,7 +370,7 @@ impl Clone for Semaphore {
|
|||
}
|
||||
}
|
||||
|
||||
impl &Semaphore {
|
||||
pub impl &Semaphore {
|
||||
/**
|
||||
* Acquire a resource represented by the semaphore. Blocks if necessary
|
||||
* until resource(s) become available.
|
||||
|
@ -418,7 +418,7 @@ impl Clone for Mutex {
|
|||
fn clone(&self) -> Mutex { Mutex { sem: Sem((*self.sem).clone()) } }
|
||||
}
|
||||
|
||||
impl &Mutex {
|
||||
pub impl &Mutex {
|
||||
/// Run a function with ownership of the mutex.
|
||||
fn lock<U>(blk: fn() -> U) -> U { (&self.sem).access(blk) }
|
||||
|
||||
|
@ -467,7 +467,7 @@ pub fn rwlock_with_condvars(num_condvars: uint) -> RWlock {
|
|||
read_count: 0 }) }
|
||||
}
|
||||
|
||||
impl &RWlock {
|
||||
pub impl &RWlock {
|
||||
/// Create a new handle to the rwlock.
|
||||
fn clone() -> RWlock {
|
||||
RWlock { order_lock: (&(self.order_lock)).clone(),
|
||||
|
@ -688,7 +688,7 @@ impl Drop for RWlockWriteMode { fn finalize(&self) {} }
|
|||
pub struct RWlockReadMode { priv lock: &RWlock }
|
||||
impl Drop for RWlockReadMode { fn finalize(&self) {} }
|
||||
|
||||
impl &RWlockWriteMode {
|
||||
pub impl &RWlockWriteMode {
|
||||
/// Access the pre-downgrade rwlock in write mode.
|
||||
fn write<U>(blk: fn() -> U) -> U { blk() }
|
||||
/// Access the pre-downgrade rwlock in write mode with a condvar.
|
||||
|
@ -696,7 +696,7 @@ impl &RWlockWriteMode {
|
|||
blk(&Condvar { sem: &self.lock.access_lock })
|
||||
}
|
||||
}
|
||||
impl &RWlockReadMode {
|
||||
pub impl &RWlockReadMode {
|
||||
/// Access the post-downgrade rwlock in read mode.
|
||||
fn read<U>(blk: fn() -> U) -> U { blk() }
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ pub struct Timespec { sec: i64, nsec: i32 }
|
|||
* -1.2 seconds before the epoch is represented by `Timespec { sec: -2_i64,
|
||||
* nsec: 800_000_000_i32 }`.
|
||||
*/
|
||||
impl Timespec {
|
||||
pub impl Timespec {
|
||||
static pure fn new(sec: i64, nsec: i32) -> Timespec {
|
||||
assert nsec >= 0 && nsec < NSEC_PER_SEC;
|
||||
Timespec { sec: sec, nsec: nsec }
|
||||
|
@ -208,7 +208,7 @@ pub pure fn strftime(format: &str, tm: &Tm) -> ~str {
|
|||
unsafe { do_strftime(format, tm) }
|
||||
}
|
||||
|
||||
impl Tm {
|
||||
pub impl Tm {
|
||||
/// Convert time to the seconds from January 1, 1970
|
||||
fn to_timespec() -> Timespec {
|
||||
unsafe {
|
||||
|
|
|
@ -177,7 +177,7 @@ impl<K:Ord,V> Map<K, V> for TreeMap<K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
impl <K:Ord,V> TreeMap<K, V> {
|
||||
pub impl <K:Ord,V> TreeMap<K, V> {
|
||||
/// Create an empty TreeMap
|
||||
static pure fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
|
||||
|
||||
|
@ -208,7 +208,7 @@ pub struct TreeMapIterator<K, V> {
|
|||
/// tuple with a reference to the key and value. If there are no
|
||||
/// more nodes, return `None`.
|
||||
fn map_next<K: Ord, V>(iter: &mut TreeMapIterator/&r<K, V>)
|
||||
-> Option<(&r/K, &r/V)> {
|
||||
-> Option<(&r/K, &r/V)> {
|
||||
while !iter.stack.is_empty() || iter.node.is_some() {
|
||||
match *iter.node {
|
||||
Some(ref x) => {
|
||||
|
@ -480,7 +480,7 @@ impl<T:Ord> Set<T> for TreeSet<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl <T:Ord> TreeSet<T> {
|
||||
pub impl <T:Ord> TreeSet<T> {
|
||||
/// Create an empty TreeSet
|
||||
static pure fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} }
|
||||
|
||||
|
@ -518,7 +518,7 @@ struct TreeNode<K, V> {
|
|||
level: uint
|
||||
}
|
||||
|
||||
impl <K:Ord,V> TreeNode<K, V> {
|
||||
pub impl <K:Ord,V> TreeNode<K, V> {
|
||||
#[inline(always)]
|
||||
static pure fn new(key: K, value: V) -> TreeNode<K, V> {
|
||||
TreeNode{key: key, value: value, left: None, right: None, level: 1}
|
||||
|
|
|
@ -132,7 +132,7 @@ impl cmp::Ord for WorkKey {
|
|||
}
|
||||
}
|
||||
|
||||
impl WorkKey {
|
||||
pub impl WorkKey {
|
||||
static fn new(kind: &str, name: &str) -> WorkKey {
|
||||
WorkKey { kind: kind.to_owned(), name: name.to_owned() }
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ struct Database {
|
|||
mut db_dirty: bool
|
||||
}
|
||||
|
||||
impl Database {
|
||||
pub impl Database {
|
||||
fn prepare(&mut self, fn_name: &str,
|
||||
declared_inputs: &WorkMap) -> Option<(WorkMap, WorkMap, ~str)>
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ struct Logger {
|
|||
a: ()
|
||||
}
|
||||
|
||||
impl Logger {
|
||||
pub impl Logger {
|
||||
fn info(i: &str) {
|
||||
io::println(~"workcache: " + i.to_owned());
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ fn digest_file(path: &Path) -> ~str {
|
|||
sha.result_str()
|
||||
}
|
||||
|
||||
impl Context {
|
||||
pub impl Context {
|
||||
|
||||
static fn new(db: @Mut<Database>,
|
||||
lg: @Mut<Logger>,
|
||||
|
@ -356,7 +356,7 @@ impl TPrep for @Mut<Prep> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Owned + Encodable<json::Encoder> + Decodable<json::Decoder>> Work<T> {
|
||||
pub impl<T:Owned+Encodable<json::Encoder>+Decodable<json::Decoder>> Work<T> {
|
||||
static fn new(p: @Mut<Prep>, e: Either<T,PortOne<(Exec,T)>>) -> Work<T> {
|
||||
Work { prep: p, res: Some(e) }
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ pub struct Generics {
|
|||
ty_params: OptVec<TyParam>
|
||||
}
|
||||
|
||||
impl Generics {
|
||||
pub impl Generics {
|
||||
fn is_empty(&self) -> bool {
|
||||
self.lifetimes.len() + self.ty_params.len() == 0
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ enum Junction {
|
|||
Disjunction,
|
||||
}
|
||||
|
||||
impl Junction {
|
||||
pub impl Junction {
|
||||
fn to_binop(self) -> binop {
|
||||
match self {
|
||||
Conjunction => and,
|
||||
|
|
|
@ -4,7 +4,7 @@ pub struct Fish {
|
|||
x: int
|
||||
}
|
||||
|
||||
impl Fish {
|
||||
pub impl Fish {
|
||||
fn swim(&self) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
enum S = ();
|
||||
|
||||
impl S {
|
||||
pub impl S {
|
||||
fn foo() { }
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ fn timed(result: &mut float, op: fn()) {
|
|||
*result = (end - start);
|
||||
}
|
||||
|
||||
impl Results {
|
||||
pub impl Results {
|
||||
fn bench_int<T:Set<uint>>(&mut self, rng: @rand::Rng, num_keys: uint,
|
||||
rand_cap: uint, f: fn() -> T) {
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ fn Noise2DContext() -> ~Noise2DContext {
|
|||
}
|
||||
}
|
||||
|
||||
impl Noise2DContext {
|
||||
pub impl Noise2DContext {
|
||||
#[inline(always)]
|
||||
fn get_gradient(&self, x: int, y: int) -> Vec2 {
|
||||
let idx = self.permutations[x & 255] + self.permutations[y & 255];
|
||||
|
|
|
@ -14,7 +14,7 @@ struct cat {
|
|||
how_hungry : int,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub impl cat {
|
||||
|
||||
fn speak() { self.meows += 1u; }
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
use core::either::*;
|
||||
enum X = Either<(uint,uint),extern fn()>;
|
||||
impl &X {
|
||||
pub impl &X {
|
||||
fn with(blk: fn(x: &Either<(uint,uint),extern fn()>)) {
|
||||
blk(&**self)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ struct Foo {
|
|||
x: int,
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
pub impl Foo {
|
||||
fn f(&self) {}
|
||||
fn g(&const self) {}
|
||||
fn h(&mut self) {}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct Foo {
|
|||
n: LinearSet<int>,
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
pub impl Foo {
|
||||
fn foo(&mut self, fun: fn(&int)) {
|
||||
for self.n.each |f| {
|
||||
fun(f);
|
||||
|
|
|
@ -19,7 +19,7 @@ impl ops::Add<int,int> for Point {
|
|||
}
|
||||
}
|
||||
|
||||
impl Point {
|
||||
pub impl Point {
|
||||
fn times(z: int) -> int {
|
||||
self.x * self.y * z
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ struct cat {
|
|||
name : ~str,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub impl cat {
|
||||
|
||||
fn eat() -> bool {
|
||||
if self.how_hungry > 0 {
|
||||
|
|
|
@ -14,6 +14,6 @@ struct cat {
|
|||
tail: int,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub impl cat {
|
||||
fn meow() { tail += 1; } //~ ERROR: Did you mean: `self.tail`
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ pub mod stream {
|
|||
use core::option;
|
||||
use core::pipes;
|
||||
|
||||
impl<T:Owned> Stream<T> {
|
||||
pub impl<T:Owned> Stream<T> {
|
||||
pub fn recv() -> extern fn(+v: Stream<T>) -> ::stream::Stream<T> {
|
||||
// resolve really should report just one error here.
|
||||
// Change the test case when it changes.
|
||||
|
|
|
@ -16,7 +16,7 @@ fn siphash(k0 : u64) {
|
|||
v0: u64,
|
||||
}
|
||||
|
||||
impl siphash {
|
||||
pub impl siphash {
|
||||
fn reset(&mut self) {
|
||||
self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR attempted dynamic environment-capture
|
||||
//~^ ERROR unresolved name: `k0`.
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// xfail-test
|
||||
enum x = ();
|
||||
impl x {
|
||||
pub impl x {
|
||||
unsafe fn with() { } // This should fail
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ struct Foo {
|
|||
u: ~()
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
pub impl Foo {
|
||||
fn get_s(&self) -> &self/str {
|
||||
self.s
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ struct Obj {
|
|||
member: uint
|
||||
}
|
||||
|
||||
impl Obj {
|
||||
pub impl Obj {
|
||||
static pure fn boom() -> bool {
|
||||
return 1+1 == 2
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ mod my_mod {
|
|||
pub fn MyStruct () -> MyStruct {
|
||||
MyStruct {priv_field: 4}
|
||||
}
|
||||
impl MyStruct {
|
||||
pub impl MyStruct {
|
||||
priv fn happyfun() {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ struct cat {
|
|||
how_hungry : int,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub impl cat {
|
||||
fn eat() {
|
||||
self.how_hungry -= 5;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ struct dog {
|
|||
cats_chased: uint,
|
||||
}
|
||||
|
||||
impl dog {
|
||||
pub impl dog {
|
||||
fn chase_cat(&mut self) {
|
||||
let p: &static/mut uint = &mut self.cats_chased; //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements
|
||||
*p += 1u;
|
||||
|
|
|
@ -12,7 +12,7 @@ struct dog {
|
|||
food: uint,
|
||||
}
|
||||
|
||||
impl dog {
|
||||
pub impl dog {
|
||||
fn chase_cat(&mut self) {
|
||||
for uint::range(0u, 10u) |_i| {
|
||||
let p: &'static mut uint = &mut self.food; //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// error-pattern: implement a trait or new type instead
|
||||
impl <T> Option<T> {
|
||||
pub impl <T> Option<T> {
|
||||
fn foo() { }
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ impl Drop for S {
|
|||
fn finalize(&self) {}
|
||||
}
|
||||
|
||||
impl S {
|
||||
pub impl S {
|
||||
fn foo(self) -> int {
|
||||
self.bar();
|
||||
return self.x; //~ ERROR use of moved value
|
||||
|
|
|
@ -2,7 +2,7 @@ struct S {
|
|||
x: ~int
|
||||
}
|
||||
|
||||
impl S {
|
||||
pub impl S {
|
||||
fn foo(self) -> int {
|
||||
self.bar();
|
||||
return *self.x; //~ ERROR use of moved value
|
||||
|
|
|
@ -12,7 +12,7 @@ struct Foo {
|
|||
x: int
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
pub impl Foo {
|
||||
static fn new() -> Foo {
|
||||
Foo { x: 3 }
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
enum Foo = uint;
|
||||
|
||||
impl Foo {
|
||||
pub impl Foo {
|
||||
fn len(&self) -> uint { **self }
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ struct Foo {
|
|||
x: int,
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
pub impl Foo {
|
||||
fn f(&const self) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ struct Wizard {
|
|||
spells: ~[&static/str]
|
||||
}
|
||||
|
||||
impl Wizard {
|
||||
pub impl Wizard {
|
||||
fn cast(&mut self) {
|
||||
for self.spells.each |&spell| {
|
||||
io::println(spell);
|
||||
|
|
|
@ -18,7 +18,7 @@ struct dog {
|
|||
volume : @mut int,
|
||||
}
|
||||
|
||||
impl dog {
|
||||
pub impl dog {
|
||||
priv fn bark() -> int {
|
||||
debug!("Woof %u %d", *self.barks, *self.volume);
|
||||
*self.barks += 1u;
|
||||
|
@ -55,7 +55,7 @@ impl noisy for cat {
|
|||
fn speak() -> int { self.meow() as int }
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub impl cat {
|
||||
fn meow_count() -> uint { *self.meows }
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ impl noisy for cat {
|
|||
fn speak(&mut self) { self.meow(); }
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub impl cat {
|
||||
fn eat(&mut self) -> bool {
|
||||
if self.how_hungry > 0 {
|
||||
error!("OM NOM NOM");
|
||||
|
|
|
@ -34,7 +34,7 @@ struct cat<T> {
|
|||
name : T,
|
||||
}
|
||||
|
||||
impl<T> cat<T> {
|
||||
pub impl<T> cat<T> {
|
||||
fn speak(&mut self) { self.meow(); }
|
||||
|
||||
fn eat(&mut self) -> bool {
|
||||
|
@ -103,7 +103,7 @@ impl<T> Map<int, T> for cat<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> cat<T> {
|
||||
pub impl<T> cat<T> {
|
||||
pure fn get(&self, k: &int) -> &self/T {
|
||||
match self.find(k) {
|
||||
Some(v) => { v }
|
||||
|
|
|
@ -20,7 +20,7 @@ struct cat {
|
|||
name : ~str,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub impl cat {
|
||||
fn eat(&mut self) -> bool {
|
||||
if self.how_hungry > 0 {
|
||||
error!("OM NOM NOM");
|
||||
|
|
|
@ -32,7 +32,7 @@ priv impl cat {
|
|||
}
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub impl cat {
|
||||
fn eat(&mut self) -> bool {
|
||||
if self.how_hungry > 0 {
|
||||
error!("OM NOM NOM");
|
||||
|
|
|
@ -14,7 +14,7 @@ struct cat {
|
|||
how_hungry : int,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub impl cat {
|
||||
fn speak(&mut self) { self.meows += 1u; }
|
||||
fn meow_count(&mut self) -> uint { self.meows }
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ struct cat<U> {
|
|||
how_hungry : int,
|
||||
}
|
||||
|
||||
impl<U> cat<U> {
|
||||
pub impl<U> cat<U> {
|
||||
fn speak<T>(&mut self, stuff: ~[T]) {
|
||||
self.meows += stuff.len();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ struct cat {
|
|||
name : ~str,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub impl cat {
|
||||
fn speak(&mut self) { self.meow(); }
|
||||
|
||||
fn eat(&mut self) -> bool {
|
||||
|
|
|
@ -14,7 +14,7 @@ struct cat<U> {
|
|||
how_hungry : int,
|
||||
}
|
||||
|
||||
impl<U> cat<U> {
|
||||
pub impl<U> cat<U> {
|
||||
fn speak(&mut self) { self.meows += 1u; }
|
||||
fn meow_count(&mut self) -> uint { self.meows }
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct cat {
|
|||
how_hungry : int,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub impl cat {
|
||||
fn speak(&mut self) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ struct cat {
|
|||
name : ~str,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
pub impl cat {
|
||||
fn speak(&mut self) { self.meow(); }
|
||||
|
||||
fn eat(&mut self) -> bool {
|
||||
|
|
|
@ -2,7 +2,7 @@ struct SpeechMaker {
|
|||
speeches: uint
|
||||
}
|
||||
|
||||
impl SpeechMaker {
|
||||
pub impl SpeechMaker {
|
||||
pure fn how_many(&self) -> uint { self.speeches }
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ struct SpeechMaker {
|
|||
speeches: uint
|
||||
}
|
||||
|
||||
impl SpeechMaker {
|
||||
pub impl SpeechMaker {
|
||||
fn talk(&mut self) {
|
||||
self.speeches += 1;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
enum E { V, VV(int) }
|
||||
const C: E = V;
|
||||
|
||||
impl E {
|
||||
pub impl E {
|
||||
fn method(&self) {
|
||||
match *self {
|
||||
V => {}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct Box {
|
|||
x: uint
|
||||
}
|
||||
|
||||
impl Box {
|
||||
pub impl Box {
|
||||
fn set_many(&mut self, xs: &[uint]) {
|
||||
for xs.each |x| { self.x = *x; }
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ fn linear_map<K,V>() -> LinearMap<K,V> {
|
|||
size: 0})
|
||||
}
|
||||
|
||||
impl<K,V> LinearMap<K,V> {
|
||||
pub impl<K,V> LinearMap<K,V> {
|
||||
fn len(&mut self) -> uint {
|
||||
self.size
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ fn compute_area(shape: &shape) -> float {
|
|||
}
|
||||
}
|
||||
|
||||
impl shape {
|
||||
pub impl shape {
|
||||
// self is in the implicit self region
|
||||
fn select<T>(&self, threshold: float,
|
||||
a: &r/T, b: &r/T) -> &r/T {
|
||||
|
@ -54,7 +54,7 @@ fn thing(x: A) -> thing {
|
|||
}
|
||||
}
|
||||
|
||||
impl thing {
|
||||
pub impl thing {
|
||||
fn foo(@self) -> int { *self.x.a }
|
||||
fn bar(~self) -> int { *self.x.a }
|
||||
fn quux(&self) -> int { *self.x.a }
|
||||
|
|
|
@ -13,7 +13,7 @@ enum option_<T> {
|
|||
some_(T),
|
||||
}
|
||||
|
||||
impl<T> option_<T> {
|
||||
pub impl<T> option_<T> {
|
||||
fn foo() -> bool { true }
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ enum option__ {
|
|||
some__(int)
|
||||
}
|
||||
|
||||
impl option__ {
|
||||
pub impl option__ {
|
||||
fn foo() -> bool { true }
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ struct foo<A> {
|
|||
x: A,
|
||||
}
|
||||
|
||||
impl<A:Copy> foo<A> {
|
||||
pub impl<A:Copy> foo<A> {
|
||||
fn bar<B,C:clam<A>>(c: C) -> B {
|
||||
fail!();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ trait clam<A> { }
|
|||
|
||||
enum foo = int;
|
||||
|
||||
impl foo {
|
||||
pub impl foo {
|
||||
fn bar<B,C:clam<B>>(c: C) -> B { fail!(); }
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ struct c1<T> {
|
|||
x: T,
|
||||
}
|
||||
|
||||
impl<T:Copy> c1<T> {
|
||||
pub impl<T:Copy> c1<T> {
|
||||
fn f1(x: int) {
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ fn c1<T:Copy>(x: T) -> c1<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Copy> c1<T> {
|
||||
pub impl<T:Copy> c1<T> {
|
||||
fn f2(x: int) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ struct c1<T> {
|
|||
x: T,
|
||||
}
|
||||
|
||||
impl<T:Copy> c1<T> {
|
||||
pub impl<T:Copy> c1<T> {
|
||||
fn f1(x: T) {}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ fn c1<T:Copy>(x: T) -> c1<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Copy> c1<T> {
|
||||
pub impl<T:Copy> c1<T> {
|
||||
fn f2(x: T) {}
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue