* pattern - see the `glob` function for more details.
*/
pub struct Paths {
- root: Path,
dir_patterns: Vec<Pattern>,
require_dir: bool,
options: MatchOptions,
// FIXME: How do we want to handle verbatim paths? I'm inclined to return nothing,
// since we can't very well find all UNC shares with a 1-letter server name.
return Paths {
- root: root,
dir_patterns: Vec::new(),
require_dir: false,
options: options,
}
Paths {
- root: root,
dir_patterns: dir_patterns,
require_dir: require_dir,
options: options,
/// Implementation of rt::rtio's IoFactory trait to generate handles to the
/// native I/O functionality.
pub struct IoFactory {
- cannot_construct_outside_of_this_module: ()
+ _cannot_construct_outside_of_this_module: ()
}
impl IoFactory {
pub fn new() -> IoFactory {
net::init();
- IoFactory { cannot_construct_outside_of_this_module: () }
+ IoFactory { _cannot_construct_outside_of_this_module: () }
}
}
struct Inner {
fd: sock_t,
- lock: mutex::NativeMutex,
+
+ // Unused on Linux, where this lock is not necessary.
+ #[allow(dead_code)]
+ lock: mutex::NativeMutex
}
pub struct Guard<'a> {
struct Inner {
fd: fd_t,
- lock: mutex::NativeMutex,
+
+ // Unused on Linux, where this lock is not necessary.
+ #[allow(dead_code)]
+ lock: mutex::NativeMutex
}
impl Inner {
/// See `Gamma` for sampling from a Gamma distribution with general
/// shape parameters.
struct GammaLargeShape {
- shape: f64,
scale: f64,
c: f64,
d: f64
fn new_raw(shape: f64, scale: f64) -> GammaLargeShape {
let d = shape - 1. / 3.;
GammaLargeShape {
- shape: shape,
scale: scale,
c: 1. / (9. * d).sqrt(),
d: d
fold.fold_crate(krate)
}
-struct PreludeInjector<'a> {
- sess: &'a Session,
-}
+struct PreludeInjector<'a>;
impl<'a> fold::Folder for PreludeInjector<'a> {
}
}
-fn inject_prelude(sess: &Session, krate: ast::Crate) -> ast::Crate {
- let mut fold = PreludeInjector {
- sess: sess,
- };
+fn inject_prelude(_: &Session, krate: ast::Crate) -> ast::Crate {
+ let mut fold = PreludeInjector;
fold.fold_crate(krate)
}
}
pub struct ArchiveMetadata {
- archive: ArchiveRO,
+ _archive: ArchiveRO,
// See comments in ArchiveMetadata::new for why this is static
data: &'static [u8],
}
unsafe { mem::transmute(data) }
};
Some(ArchiveMetadata {
- archive: ar,
+ _archive: ar,
data: data,
})
}
// Extra parameters are for converting to/from def_ids in the string rep.
// Whatever format you choose should not contain pipe characters.
pub struct ty_abbrev {
- pos: uint,
- len: uint,
s: String
}
if abbrev_len < len {
// I.e. it's actually an abbreviation.
cx.abbrevs.borrow_mut().insert(t, ty_abbrev {
- pos: pos as uint,
- len: len as uint,
s: format!("\\#{:x}:{:x}\\#", pos, len)
});
}
cause: euv::LoanCause,
cmt: mc::cmt,
loan_region: ty::Region,
- loan_kind: ty::BorrowKind)
+ _: ty::BorrowKind)
-> Result<(),()> {
debug!("guarantee_lifetime(cmt={}, loan_region={})",
cmt.repr(bccx.tcx), loan_region.repr(bccx.tcx));
span: span,
cause: cause,
loan_region: loan_region,
- loan_kind: loan_kind,
cmt_original: cmt.clone()};
ctxt.check(&cmt, None)
}
span: Span,
cause: euv::LoanCause,
loan_region: ty::Region,
- loan_kind: ty::BorrowKind,
cmt_original: mc::cmt
}
Loan {
index: self.all_loans.len(),
loan_path: loan_path,
- cmt: cmt,
kind: req_kind,
gen_scope: gen_scope,
kill_scope: kill_scope,
/// This visitor walks static initializer's expressions and makes
/// sure the loans being taken are sound.
struct StaticInitializerCtxt<'a> {
- bccx: &'a BorrowckCtxt<'a>,
- item_ub: ast::NodeId,
+ bccx: &'a BorrowckCtxt<'a>
}
impl<'a> visit::Visitor<()> for StaticInitializerCtxt<'a> {
debug!("gather_loans_in_static_initializer(expr={})", expr.repr(bccx.tcx));
let mut sicx = StaticInitializerCtxt {
- bccx: bccx,
- item_ub: expr.id,
+ bccx: bccx
};
sicx.visit_expr(expr, ());
bccx: bccx,
span: span,
cause: cause,
- cmt_original: cmt.clone(),
loan_region: loan_region,
};
struct RestrictionsContext<'a> {
bccx: &'a BorrowckCtxt<'a>,
span: Span,
- cmt_original: mc::cmt,
loan_region: ty::Region,
cause: euv::LoanCause,
}
pub struct Loan {
index: uint,
loan_path: Rc<LoanPath>,
- cmt: mc::cmt,
kind: ty::BorrowKind,
restrictions: Vec<Restriction>,
gen_scope: ast::NodeId,
struct CaptureInfo {
ln: LiveNode,
- is_move: bool,
var_nid: NodeId
}
-enum LocalKind {
- FromMatch(BindingMode),
- FromLetWithInitializer,
- FromLetNoInitializer
-}
-
struct LocalInfo {
id: NodeId,
- ident: Ident,
- is_mutbl: bool,
- kind: LocalKind,
+ ident: Ident
}
enum VarKind {
}
fn visit_local(ir: &mut IrMaps, local: &Local) {
- pat_util::pat_bindings(&ir.tcx.def_map, local.pat, |bm, p_id, sp, path| {
+ pat_util::pat_bindings(&ir.tcx.def_map, local.pat, |_, p_id, sp, path| {
debug!("adding local variable {}", p_id);
let name = ast_util::path_to_ident(path);
ir.add_live_node_for_node(p_id, VarDefNode(sp));
- let kind = match local.init {
- Some(_) => FromLetWithInitializer,
- None => FromLetNoInitializer
- };
- let mutbl = match bm {
- BindByValue(MutMutable) => true,
- _ => false
- };
ir.add_variable(Local(LocalInfo {
id: p_id,
- ident: name,
- is_mutbl: mutbl,
- kind: kind
+ ident: name
}));
});
visit::walk_local(ir, local, ());
debug!("adding local variable {} from match with bm {:?}",
p_id, bm);
let name = ast_util::path_to_ident(path);
- let mutbl = match bm {
- BindByValue(MutMutable) => true,
- _ => false
- };
ir.add_live_node_for_node(p_id, VarDefNode(sp));
ir.add_variable(Local(LocalInfo {
id: p_id,
- ident: name,
- is_mutbl: mutbl,
- kind: FromMatch(bm)
+ ident: name
}));
})
}
// in better error messages than just pointing at the closure
// construction site.
let mut call_caps = Vec::new();
- let fv_mode = freevars::get_capture_mode(ir.tcx, expr.id);
freevars::with_freevars(ir.tcx, expr.id, |freevars| {
for fv in freevars.iter() {
match moved_variable_node_id_from_def(fv.def) {
Some(rv) => {
let fv_ln = ir.add_live_node(FreeVarNode(fv.span));
- let fv_id = fv.def.def_id().node;
- let fv_ty = ty::node_id_to_type(ir.tcx, fv_id);
- let is_move = match fv_mode {
- // var must be dead afterwards
- freevars::CaptureByValue => {
- ty::type_moves_by_default(ir.tcx, fv_ty)
- }
-
- // var can still be used
- freevars::CaptureByRef => {
- false
- }
- };
call_caps.push(CaptureInfo {ln: fv_ln,
- is_move: is_move,
var_nid: rv});
}
None => {}
struct PrivacyVisitor<'a> {
tcx: &'a ty::ctxt,
curitem: ast::NodeId,
- in_fn: bool,
in_foreign: bool,
parents: NodeMap<ast::NodeId>,
external_exports: resolve::ExternalExports,
// Use the parent map to check the privacy of everything
let mut visitor = PrivacyVisitor {
curitem: ast::DUMMY_NODE_ID,
- in_fn: false,
in_foreign: false,
tcx: tcx,
parents: visitor.parents,
/// The main resolver class.
struct Resolver<'a> {
session: &'a Session,
- lang_items: &'a LanguageItems,
graph_root: NameBindings,
// The idents for the primitive types.
primitive_type_table: PrimitiveTypeTable,
- // The four namespaces.
- namespaces: Vec<Namespace> ,
-
def_map: DefMap,
export_map2: ExportMap2,
trait_map: TraitMap,
}
impl<'a> Resolver<'a> {
- fn new(session: &'a Session, lang_items: &'a LanguageItems, crate_span: Span) -> Resolver<'a> {
+ fn new(session: &'a Session, crate_span: Span) -> Resolver<'a> {
let graph_root = NameBindings::new();
graph_root.define_module(NoParentLink,
Resolver {
session: session,
- lang_items: lang_items,
// The outermost module has def ID 0; this is not reflected in the
// AST.
primitive_type_table: PrimitiveTypeTable::new(),
- namespaces: vec!(TypeNS, ValueNS),
-
def_map: RefCell::new(NodeMap::new()),
export_map2: RefCell::new(NodeMap::new()),
trait_map: NodeMap::new(),
/// Entry point to crate resolution.
pub fn resolve_crate(session: &Session,
- lang_items: &LanguageItems,
+ _: &LanguageItems,
krate: &Crate)
-> CrateMap {
- let mut resolver = Resolver::new(session, lang_items, krate.span);
+ let mut resolver = Resolver::new(session, krate.span);
resolver.resolve(krate);
let Resolver { def_map, export_map2, trait_map, last_private,
external_exports, .. } = resolver;
task_local_insn_key.replace(Some(RefCell::new(Vec::new())));
}
-pub struct _InsnCtxt { _x: () }
+pub struct _InsnCtxt {
+ _cannot_construct_outside_of_this_module: ()
+}
#[unsafe_destructor]
impl Drop for _InsnCtxt {
Some(ctx) => ctx.borrow_mut().push(s),
None => {}
}
- _InsnCtxt { _x: () }
+ _InsnCtxt { _cannot_construct_outside_of_this_module: () }
}
pub struct StatRecorder<'a> {
// function, because the foreign function may opt to return via an
// out pointer.
llret_ty: Type,
-
- // True if *Rust* would use an outpointer for this function.
- sret: bool,
}
let llret_ty = type_of::type_of(ccx, fn_sig.output);
LlvmSignature {
llarg_tys: llarg_tys,
- llret_ty: llret_ty,
- sret: type_of::return_uses_outptr(ccx, fn_sig.output),
+ llret_ty: llret_ty
}
}
use std::rc::Rc;
struct UniversalQuantificationResult {
- monotype: t,
- type_variables: Vec<ty::t> ,
- type_param_defs: Rc<Vec<ty::TypeParameterDef> >
+ monotype: t
}
fn get_base_type(inference_context: &InferCtxt,
let monotype = polytype.ty.subst(self.crate_context.tcx, &substitutions);
UniversalQuantificationResult {
- monotype: monotype,
- type_variables: substitutions.tps,
- type_param_defs: polytype.generics.type_param_defs.clone()
+ monotype: monotype
}
}
struct InferredInfo<'a> {
item_id: ast::NodeId,
kind: ParamKind,
- index: uint,
param_id: ast::NodeId,
term: VarianceTermPtr<'a>,
}
let term = self.arena.alloc(|| InferredTerm(inf_index));
self.inferred_infos.push(InferredInfo { item_id: item_id,
kind: kind,
- index: index,
param_id: param_id,
term: term });
let newly_added = self.inferred_map.insert(param_id, inf_index);
r
}
-pub struct _indenter {
- _i: (),
+pub struct Indenter {
+ _cannot_construct_outside_of_this_module: ()
}
-impl Drop for _indenter {
+impl Drop for Indenter {
fn drop(&mut self) { debug!("<<"); }
}
-pub fn _indenter(_i: ()) -> _indenter {
- _indenter {
- _i: ()
- }
-}
-
-pub fn indenter() -> _indenter {
+pub fn indenter() -> Indenter {
debug!(">>");
- _indenter(())
+ Indenter { _cannot_construct_outside_of_this_module: () }
}
struct LoopQueryVisitor<'a> {
//! // ... something using html
//! ```
+#![allow(dead_code)]
#![allow(non_camel_case_types)]
use libc;
#[cfg(target_arch = "mips")]
static __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
+ #[repr(C)]
pub struct pthread_mutex_t {
__align: libc::c_longlong,
size: [u8, ..__SIZEOF_PTHREAD_MUTEX_T],
}
+ #[repr(C)]
pub struct pthread_cond_t {
__align: libc::c_longlong,
size: [u8, ..__SIZEOF_PTHREAD_COND_T],
pub struct IdleWatcher {
handle: *uvll::uv_idle_t,
idle_flag: bool,
- closed: bool,
callback: Box<Callback:Send>,
}
let me = box IdleWatcher {
handle: handle,
idle_flag: false,
- closed: false,
callback: cb,
};
return me.install();
pub struct TcpListener {
home: HomeHandle,
handle: *uvll::uv_pipe_t,
- closing_task: Option<BlockedTask>,
outgoing: Sender<Result<Box<rtio::RtioTcpStream:Send>, IoError>>,
incoming: Receiver<Result<Box<rtio::RtioTcpStream:Send>, IoError>>,
}
let l = box TcpListener {
home: io.make_handle(),
handle: handle,
- closing_task: None,
outgoing: tx,
incoming: rx,
};
// These fields are private because they must be interfaced with through the
// functions below.
+#[repr(C)]
pub struct uv_stdio_container_t {
flags: libc::c_int,
stream: *uv_stream_t,
}
pub fn move_iter(self) -> MoveEntries<K, V> {
- MoveEntries { table: self, idx: 0, elems_seen: 0 }
+ MoveEntries { table: self, idx: 0 }
}
}
/// Iterator over the entries in a table, consuming the table.
pub struct MoveEntries<K, V> {
table: RawTable<K, V>,
- idx: uint,
- elems_seen: uint,
+ idx: uint
}
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> {
#[cfg(target_os = "macos")]
fn print(w: &mut Writer, idx: int, addr: *libc::c_void) -> IoResult<()> {
use intrinsics;
+ #[repr(C)]
struct Dl_info {
dli_fname: *libc::c_char,
dli_fbase: *libc::c_void,
/// Options to spawn the new task with
pub opts: TaskOpts,
gen_body: Option<proc(v: proc():Send):Send -> proc():Send>,
- nocopy: Option<marker::NoCopy>,
+ nocopy: marker::NoCopy,
}
impl TaskBuilder {
TaskBuilder {
opts: TaskOpts::new(),
gen_body: None,
- nocopy: None,
+ nocopy: marker::NoCopy,
}
}
/// dropped, this value will release the resource back to the semaphore.
#[must_use]
pub struct SemaphoreGuard<'a> {
- guard: SemGuard<'a, ()>,
+ _guard: SemGuard<'a, ()>,
}
impl Semaphore {
/// Acquire a resource of this semaphore, returning an RAII guard which will
/// release the resource when dropped.
pub fn access<'a>(&'a self) -> SemaphoreGuard<'a> {
- SemaphoreGuard { guard: self.sem.access() }
+ SemaphoreGuard { _guard: self.sem.access() }
}
}
/// corresponding mutex is also unlocked.
#[must_use]
pub struct MutexGuard<'a> {
- guard: SemGuard<'a, Vec<WaitQueue>>,
+ _guard: SemGuard<'a, Vec<WaitQueue>>,
/// Inner condition variable which is connected to the outer mutex, and can
/// be used for atomic-unlock-and-deschedule.
pub cond: Condvar<'a>,
/// also be accessed through the returned guard.
pub fn lock<'a>(&'a self) -> MutexGuard<'a> {
let SemCondGuard { guard, cvar } = self.sem.access_cond();
- MutexGuard { guard: guard, cond: cvar }
+ MutexGuard { _guard: guard, cond: cvar }
}
}
use parse::token::InternedString;
use parse::token;
-pub struct Field {
- ident: ast::Ident,
- ex: @ast::Expr
-}
-
// Transitional reexports so qquote can find the paths it is looking for
mod syntax {
pub use ext;
}
}
-struct Duplicator<'a> {
- cx: &'a ExtCtxt<'a>,
-}
+struct Duplicator<'a>;
impl<'a> Folder for Duplicator<'a> {
fn new_id(&mut self, _: NodeId) -> NodeId {
}
impl Duplicate for @ast::Expr {
- fn duplicate(&self, cx: &ExtCtxt) -> @ast::Expr {
- let mut folder = Duplicator {
- cx: cx,
- };
+ fn duplicate(&self, _: &ExtCtxt) -> @ast::Expr {
+ let mut folder = Duplicator;
folder.fold_expr(*self)
}
}
use codemap;
use diagnostic;
use parse::classify::expr_is_simple_block;
-use parse::token::IdentInterner;
use parse::token;
use parse::lexer::comments;
use parse;
use std::io::{IoResult, MemWriter};
use std::io;
use std::mem;
-use std::rc::Rc;
use std::str;
use std::string::String;
pub struct State<'a> {
pub s: pp::Printer,
cm: Option<&'a CodeMap>,
- intr: Rc<token::IdentInterner>,
comments: Option<Vec<comments::Comment> >,
literals: Option<Vec<comments::Literal> >,
cur_cmnt_and_lit: CurrentCommentAndLiteral,
State {
s: pp::mk_printer(writer, default_columns),
cm: None,
- intr: token::get_ident_interner(),
comments: None,
literals: None,
cur_cmnt_and_lit: CurrentCommentAndLiteral {
let mut s = State {
s: pp::mk_printer(out, default_columns),
cm: Some(cm),
- intr: token::get_ident_interner(),
comments: Some(cmnts),
// If the code is post expansion, don't use the table of
// literals, since it doesn't correspond with the literals
pub type typ = *UsedStruct4;
pub struct PubStruct();
struct PrivStruct; //~ ERROR: code is never used
-struct UsedStruct1 { x: int }
+struct UsedStruct1 {
+ #[allow(dead_code)]
+ x: int
+}
struct UsedStruct2(int);
struct UsedStruct3;
struct UsedStruct4;
struct StructUsedInEnum;
struct StructUsedInGeneric;
pub struct PubStruct2 {
+ #[allow(dead_code)]
struct_used_as_field: *StructUsedAsField
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+#![allow(dead_code)]
#![feature(managed_boxes)]
#![forbid(managed_heap_memory)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+#![allow(dead_code)]
#![forbid(owned_heap_memory)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+#![allow(dead_code)]
#![deny(uppercase_variables)]
use std::io::File;