The BSD grep for "basic regex" don't support \| as alternate operator (at least under OpenBSD).
Use multiple -e arguments for expressing alternative. I have checked it under Linux (Debian).
--- /dev/null
+# i586-unknown-linux-gnu configuration
+CC_i586-unknown-linux-gnu=$(CC)
+CXX_i586-unknown-linux-gnu=$(CXX)
+CPP_i586-unknown-linux-gnu=$(CPP)
+AR_i586-unknown-linux-gnu=$(AR)
+CFG_LIB_NAME_i586-unknown-linux-gnu=lib$(1).so
+CFG_STATIC_LIB_NAME_i586-unknown-linux-gnu=lib$(1).a
+CFG_LIB_GLOB_i586-unknown-linux-gnu=lib$(1)-*.so
+CFG_LIB_DSYM_GLOB_i586-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
+CFG_JEMALLOC_CFLAGS_i586-unknown-linux-gnu := -m32 $(CFLAGS)
+CFG_GCCISH_CFLAGS_i586-unknown-linux-gnu := -Wall -Werror -g -fPIC -m32 $(CFLAGS)
+CFG_GCCISH_CXXFLAGS_i586-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
+CFG_GCCISH_LINK_FLAGS_i586-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m32
+CFG_GCCISH_DEF_FLAG_i586-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
+CFG_LLC_FLAGS_i586-unknown-linux-gnu :=
+CFG_INSTALL_NAME_i586-unknown-linux-gnu =
+CFG_EXE_SUFFIX_i586-unknown-linux-gnu =
+CFG_WINDOWSY_i586-unknown-linux-gnu :=
+CFG_UNIXY_i586-unknown-linux-gnu := 1
+CFG_LDPATH_i586-unknown-linux-gnu :=
+CFG_RUN_i586-unknown-linux-gnu=$(2)
+CFG_RUN_TARG_i586-unknown-linux-gnu=$(call CFG_RUN_i586-unknown-linux-gnu,,$(2))
+CFG_GNU_TRIPLE_i586-unknown-linux-gnu := i586-unknown-linux-gnu
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::fs;
+use std::path::Path;
+
+use build::Build;
+
+pub fn clean(build: &Build) {
+ for host in build.config.host.iter() {
+
+ let out = build.out.join(host);
+
+ rm_rf(build, &out.join("compiler-rt"));
+
+ for stage in 0..4 {
+ rm_rf(build, &out.join(format!("stage{}", stage)));
+ rm_rf(build, &out.join(format!("stage{}-std", stage)));
+ rm_rf(build, &out.join(format!("stage{}-rustc", stage)));
+ }
+ }
+}
+
+fn rm_rf(build: &Build, path: &Path) {
+ if path.exists() {
+ build.verbose(&format!("removing `{}`", path.display()));
+ t!(fs::remove_dir_all(path));
+ }
+}
pub src: Option<PathBuf>,
pub jobs: Option<u32>,
pub args: Vec<String>,
+ pub clean: bool,
}
pub struct Filter {
opts.optopt("", "stage", "stage to build", "N");
opts.optopt("", "src", "path to repo root", "DIR");
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
+ opts.optflag("", "clean", "clean output directory");
opts.optflag("h", "help", "print this help message");
let usage = |n| -> ! {
Flags {
verbose: m.opt_present("v"),
+ clean: m.opt_present("clean"),
stage: m.opt_str("stage").map(|j| j.parse().unwrap()),
build: m.opt_str("build").unwrap(),
host: Filter { values: m.opt_strs("host") },
mem::size_of_val(&info) as DWORD);
assert!(r != 0, "{}", io::Error::last_os_error());
- // Assign our process to this job object
+ // Assign our process to this job object. Note that if this fails, one very
+ // likely reason is that we are ourselves already in a job object! This can
+ // happen on the build bots that we've got for Windows, or if just anyone
+ // else is instrumenting the build. In this case we just bail out
+ // immediately and assume that they take care of it.
+ //
+ // Also note that nested jobs (why this might fail) are supported in recent
+ // versions of Windows, but the version of Windows that our bots are running
+ // at least don't support nested job objects.
let r = AssignProcessToJobObject(job, GetCurrentProcess());
- assert!(r != 0, "{}", io::Error::last_os_error());
+ if r == 0 {
+ CloseHandle(job);
+ return
+ }
// If we've got a parent process (e.g. the python script that called us)
// then move ownership of this job object up to them. That way if the python
mod cc;
mod channel;
+mod clean;
mod compile;
mod config;
mod flags;
#[cfg(not(windows))] fn setup_job() {}
setup_job();
+ if self.flags.clean {
+ return clean::clean(self);
+ }
+
cc::find(self);
sanity::check(self);
channel::collect(self);
all:
$(Q)$(BOOTSTRAP)
+
+clean:
+ $(Q)$(BOOTSTRAP) --clean
fn main() {
let data = Arc::new(Mutex::new(0));
+ // `tx` is the "transmitter" or "sender"
+ // `rx` is the "receiver"
let (tx, rx) = mpsc::channel();
for _ in 0..10 {
```text
First, we set `x` to five:
- ```text
+ ```rust
let x = 5;
# let y = 6;
# println!("{}", x + y);
Next, we set `y` to six:
- ```text
+ ```rust
# let x = 5;
let y = 6;
# println!("{}", x + y);
Finally, we print the sum of `x` and `y`:
- ```text
+ ```rust
# let x = 5;
# let y = 6;
println!("{}", x + y);
}
```
-When `v` comes into scope, a new [vector] is created, and it allocates space on
-[the heap][heap] for each of its elements. When `v` goes out of scope at the
-end of `foo()`, Rust will clean up everything related to the vector, even the
-heap-allocated memory. This happens deterministically, at the end of the scope.
+When `v` comes into scope, a new [vector] is created on [the stack][stack],
+and it allocates space on [the heap][heap] for its elements. When `v` goes out
+of scope at the end of `foo()`, Rust will clean up everything related to the
+vector, even the heap-allocated memory. This happens deterministically, at the
+end of the scope.
We'll cover [vectors] in detail later in this chapter; we only use them
here as an example of a type that allocates space on the heap at runtime. They
[arrays]: primitive-types.html#arrays
[vectors]: vectors.html
[heap]: the-stack-and-the-heap.html
+[stack]: the-stack-and-the-heap.html#the-stack
[bindings]: variable-bindings.html
[generics]: generics.html
> For details on binaries without the standard library, see [the nightly
> chapter on `#![no_std]`](no-stdlib.html)
-To use `#![no_std]`, add a it to your crate root:
+To use `#![no_std]`, add it to your crate root:
```rust
#![no_std]
}
/// Inserts an element at position `index` within the vector, shifting all
- /// elements after position `i` one position to the right.
+ /// elements after it to the right.
///
/// # Panics
///
}
/// Removes and returns the element at position `index` within the vector,
- /// shifting all elements after position `index` one position to the left.
+ /// shifting all elements after it to the left.
///
/// # Panics
///
/// where `mask` removes any high-order bits of `rhs` that
/// would cause the shift to exceed the bitwidth of the type.
///
+ /// Note that this is *not* the same as a rotate-left; the
+ /// RHS of a wrapping shift-left is restricted to the range
+ /// of the type, rather than the bits shifted out of the LHS
+ /// being returned to the other end. The primitive integer
+ /// types all implement a `rotate_left` function, which may
+ /// be what you want instead.
+ ///
/// # Examples
///
/// Basic usage:
/// where `mask` removes any high-order bits of `rhs` that
/// would cause the shift to exceed the bitwidth of the type.
///
+ /// Note that this is *not* the same as a rotate-right; the
+ /// RHS of a wrapping shift-right is restricted to the range
+ /// of the type, rather than the bits shifted out of the LHS
+ /// being returned to the other end. The primitive integer
+ /// types all implement a `rotate_right` function, which may
+ /// be what you want instead.
+ ///
/// # Examples
///
/// Basic usage:
run_lints!(cx, check_item, late_passes, it);
cx.visit_ids(|v| v.visit_item(it));
hir_visit::walk_item(cx, it);
+ run_lints!(cx, check_item_post, late_passes, it);
})
}
fn visit_block(&mut self, b: &hir::Block) {
run_lints!(self, check_block, late_passes, b);
hir_visit::walk_block(self, b);
+ run_lints!(self, check_block_post, late_passes, b);
}
fn visit_arm(&mut self, a: &hir::Arm) {
run_lints!(cx, check_item, early_passes, it);
cx.visit_ids(|v| v.visit_item(it));
ast_visit::walk_item(cx, it);
+ run_lints!(cx, check_item_post, early_passes, it);
})
}
fn visit_block(&mut self, b: &ast::Block) {
run_lints!(self, check_block, early_passes, b);
ast_visit::walk_block(self, b);
+ run_lints!(self, check_block_post, early_passes, b);
}
fn visit_arm(&mut self, a: &ast::Arm) {
run_lints!(cx, check_crate, late_passes, krate);
hir_visit::walk_crate(cx, krate);
+
+ run_lints!(cx, check_crate_post, late_passes, krate);
});
// If we missed any lints added to the session, then there's a bug somewhere
run_lints!(cx, check_crate, early_passes, krate);
ast_visit::walk_crate(cx, krate);
+
+ run_lints!(cx, check_crate_post, early_passes, krate);
});
// Put the lint store back in the session.
pub trait LateLintPass: LintPass {
fn check_name(&mut self, _: &LateContext, _: Span, _: ast::Name) { }
fn check_crate(&mut self, _: &LateContext, _: &hir::Crate) { }
+ fn check_crate_post(&mut self, _: &LateContext, _: &hir::Crate) { }
fn check_mod(&mut self, _: &LateContext, _: &hir::Mod, _: Span, _: ast::NodeId) { }
fn check_foreign_item(&mut self, _: &LateContext, _: &hir::ForeignItem) { }
fn check_item(&mut self, _: &LateContext, _: &hir::Item) { }
+ fn check_item_post(&mut self, _: &LateContext, _: &hir::Item) { }
fn check_local(&mut self, _: &LateContext, _: &hir::Local) { }
fn check_block(&mut self, _: &LateContext, _: &hir::Block) { }
+ fn check_block_post(&mut self, _: &LateContext, _: &hir::Block) { }
fn check_stmt(&mut self, _: &LateContext, _: &hir::Stmt) { }
fn check_arm(&mut self, _: &LateContext, _: &hir::Arm) { }
fn check_pat(&mut self, _: &LateContext, _: &hir::Pat) { }
pub trait EarlyLintPass: LintPass {
fn check_ident(&mut self, _: &EarlyContext, _: Span, _: ast::Ident) { }
fn check_crate(&mut self, _: &EarlyContext, _: &ast::Crate) { }
+ fn check_crate_post(&mut self, _: &EarlyContext, _: &ast::Crate) { }
fn check_mod(&mut self, _: &EarlyContext, _: &ast::Mod, _: Span, _: ast::NodeId) { }
fn check_foreign_item(&mut self, _: &EarlyContext, _: &ast::ForeignItem) { }
fn check_item(&mut self, _: &EarlyContext, _: &ast::Item) { }
+ fn check_item_post(&mut self, _: &EarlyContext, _: &ast::Item) { }
fn check_local(&mut self, _: &EarlyContext, _: &ast::Local) { }
fn check_block(&mut self, _: &EarlyContext, _: &ast::Block) { }
+ fn check_block_post(&mut self, _: &EarlyContext, _: &ast::Block) { }
fn check_stmt(&mut self, _: &EarlyContext, _: &ast::Stmt) { }
fn check_arm(&mut self, _: &EarlyContext, _: &ast::Arm) { }
fn check_pat(&mut self, _: &EarlyContext, _: &ast::Pat) { }
pub parameter_environment: ty::ParameterEnvironment<'a, 'tcx>,
- pub fulfillment_cx: RefCell<traits::FulfillmentContext<'tcx>>,
-
// the set of predicates on which errors have been reported, to
// avoid reporting the same error twice.
pub reported_trait_errors: RefCell<FnvHashSet<traits::TraitErrorKey<'tcx>>>,
float_unification_table: RefCell::new(UnificationTable::new()),
region_vars: RegionVarBindings::new(tcx),
parameter_environment: param_env.unwrap_or(tcx.empty_parameter_environment()),
- fulfillment_cx: RefCell::new(traits::FulfillmentContext::new()),
reported_trait_errors: RefCell::new(FnvHashSet()),
normalize: false,
err_count_on_creation: tcx.sess.err_count()
result,
obligations);
- let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
+ let mut fulfill_cx = traits::FulfillmentContext::new();
for obligation in obligations {
fulfill_cx.register_predicate_obligation(&infcx, obligation);
cause: ObligationCause<'tcx>)
-> Ty<'tcx>
{
- debug!("normalize_associated_type(projection_ty={:?})",
+ debug!("normalize_projection_type(projection_ty={:?})",
projection_ty);
assert!(!projection_ty.has_escaping_regions());
self.register_predicate_obligation(infcx, obligation);
}
- debug!("normalize_associated_type: result={:?}", normalized.value);
+ debug!("normalize_projection_type: result={:?}", normalized.value);
normalized.value
}
assert!(!obligation.has_escaping_regions());
if self.is_duplicate_or_add(infcx.tcx, &obligation.predicate) {
- debug!("register_predicate({:?}) -- already seen, skip", obligation);
+ debug!("register_predicate_obligation({:?}) -- already seen, skip", obligation);
return;
}
- debug!("register_predicate({:?})", obligation);
+ debug!("register_predicate_obligation({:?})", obligation);
let obligation = PendingPredicateObligation {
obligation: obligation,
stalled_on: vec![]
let mut errors = Vec::new();
loop {
- debug!("select_where_possible: starting another iteration");
+ debug!("select: starting another iteration");
// Process pending obligations.
let outcome = {
region_obligations))
};
- debug!("select_where_possible: outcome={:?}", outcome);
+ debug!("select: outcome={:?}", outcome);
// these are obligations that were proven to be true.
for pending_obligation in outcome.completed {
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use target::Target;
+
+pub fn target() -> Target {
+ let mut base = super::linux_base::opts();
+ base.cpu = "pentium".to_string();
+ base.pre_link_args.push("-m32".to_string());
+
+ Target {
+ llvm_target: "i586-unknown-linux-gnu".to_string(),
+ target_endian: "little".to_string(),
+ target_pointer_width: "32".to_string(),
+ arch: "x86".to_string(),
+ target_os: "linux".to_string(),
+ target_env: "gnu".to_string(),
+ target_vendor: "unknown".to_string(),
+ options: base,
+ }
+}
let mut base = super::windows_msvc_base::opts();
base.cpu = "pentium4".to_string();
+ // Mark all dynamic libraries and executables as compatible with the larger 4GiB address
+ // space available to x86 Windows binaries on x86_64.
+ base.pre_link_args.push("/LARGEADDRESSAWARE".to_string());
+
+ // Ensure the linker will only produce an image if it can also produce a table of
+ // the image's safe exception handlers.
+ // https://msdn.microsoft.com/en-us/library/9a89h429.aspx
+ base.pre_link_args.push("/SAFESEH".to_string());
+
Target {
llvm_target: "i686-pc-windows-msvc".to_string(),
target_endian: "little".to_string(),
supported_targets! {
("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu),
("i686-unknown-linux-gnu", i686_unknown_linux_gnu),
+ ("i586-unknown-linux-gnu", i586_unknown_linux_gnu),
("mips-unknown-linux-gnu", mips_unknown_linux_gnu),
("mipsel-unknown-linux-gnu", mipsel_unknown_linux_gnu),
("powerpc-unknown-linux-gnu", powerpc_unknown_linux_gnu),
unit_temp: Lvalue<'tcx>,
data: &FreeData<'tcx>,
target: BasicBlock) -> Terminator<'tcx> {
- let free_func = tcx.lang_items.box_free_fn()
- .expect("box_free language item is missing");
+ let free_func = tcx.lang_items.require(lang_items::BoxFreeFnLangItem)
+ .unwrap_or_else(|e| tcx.sess.fatal(&e));
let substs = tcx.mk_substs(Substs::new(
VecPerParamSpace::new(vec![], vec![], vec![data.item_ty]),
VecPerParamSpace::new(vec![], vec![], vec![])
let ty = self.tcx.node_id_to_type(e.id);
let infcx = infer::new_infer_ctxt(self.tcx, &self.tcx.tables, None);
let cause = traits::ObligationCause::new(e.span, e.id, traits::SharedStatic);
- let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
- fulfill_cx.register_builtin_bound(&infcx, ty, ty::BoundSync, cause);
- match fulfill_cx.select_all_or_error(&infcx) {
+ let mut fulfillment_cx = traits::FulfillmentContext::new();
+ fulfillment_cx.register_builtin_bound(&infcx, ty, ty::BoundSync, cause);
+ match fulfillment_cx.select_all_or_error(&infcx) {
Ok(()) => { },
Err(ref errors) => {
traits::report_fulfillment_errors(&infcx, errors);
.tcx()
.lang_items
.require(ExchangeMallocFnLangItem)
- .expect("Could not find ExchangeMallocFnLangItem");
+ .unwrap_or_else(|e| self.ccx.sess().fatal(&e));
assert!(can_have_local_instance(self.ccx, exchange_malloc_fn_def_id));
let exchange_malloc_fn_trans_item =
let exchange_free_fn_def_id = ccx.tcx()
.lang_items
.require(ExchangeFreeFnLangItem)
- .expect("Could not find ExchangeFreeFnLangItem");
+ .unwrap_or_else(|e| ccx.sess().fatal(&e));
assert!(can_have_local_instance(ccx, exchange_free_fn_def_id));
let exchange_free_fn_trans_item =
// Currently, we use a fulfillment context to completely resolve
// all nested obligations. This is because they can inform the
// inference of the impl's type parameters.
- let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
+ let mut fulfill_cx = traits::FulfillmentContext::new();
let vtable = selection.map(|predicate| {
fulfill_cx.register_predicate_obligation(&infcx, predicate);
});
let tcx = ccx.tcx();
let infcx = infer::normalizing_infer_ctxt(tcx, &tcx.tables);
let mut selcx = traits::SelectionContext::new(&infcx);
- let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
+ let mut fulfill_cx = traits::FulfillmentContext::new();
let cause = traits::ObligationCause::dummy();
let traits::Normalized { value: predicates, obligations } =
traits::normalize(&mut selcx, cause.clone(), &predicates);
expected_vid: ty::TyVid)
-> (Option<ty::FnSig<'tcx>>, Option<ty::ClosureKind>)
{
- let fulfillment_cx = fcx.inh.infcx.fulfillment_cx.borrow();
+ let fulfillment_cx = fcx.inh.fulfillment_cx.borrow();
// Here `expected_ty` is known to be a type inference variable.
let expected_sig =
impl_trait_ref);
let mut infcx = infer::new_infer_ctxt(tcx, &tcx.tables, None);
- let mut fulfillment_cx = infcx.fulfillment_cx.borrow_mut();
+ let mut fulfillment_cx = traits::FulfillmentContext::new();
let trait_to_impl_substs = &impl_trait_ref.substs;
impl_trait_ref);
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, None);
- let mut fulfillment_cx = infcx.fulfillment_cx.borrow_mut();
+ let mut fulfillment_cx = traits::FulfillmentContext::new();
// The below is for the most part highly similar to the procedure
// for methods above. It is simpler in many respects, especially
let impl_param_env = ty::ParameterEnvironment::for_item(tcx, self_type_node_id);
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, Some(impl_param_env));
+ let mut fulfillment_cx = traits::FulfillmentContext::new();
let named_type = tcx.lookup_item_type(self_type_did).ty;
let named_type = named_type.subst(tcx, &infcx.parameter_environment.free_substs);
return Err(());
}
- if let Err(ref errors) = infcx.fulfillment_cx.borrow_mut().select_all_or_error(&infcx) {
+ if let Err(ref errors) = fulfillment_cx.select_all_or_error(&infcx) {
// this could be reached when we get lazy normalization
traits::report_fulfillment_errors(&infcx, errors);
return Err(());
infcx: infer::InferCtxt<'a, 'tcx>,
locals: RefCell<NodeMap<Ty<'tcx>>>,
+ fulfillment_cx: RefCell<traits::FulfillmentContext<'tcx>>,
+
tables: &'a RefCell<ty::Tables<'tcx>>,
// When we process a call like `c()` where `c` is a closure type,
Inherited {
infcx: infer::new_infer_ctxt(tcx, tables, Some(param_env)),
+ fulfillment_cx: RefCell::new(traits::FulfillmentContext::new()),
locals: RefCell::new(NodeMap()),
tables: tables,
deferred_call_resolutions: RefCell::new(DefIdMap()),
-> T
where T : TypeFoldable<'tcx>
{
- let mut fulfillment_cx = self.infcx.fulfillment_cx.borrow_mut();
assoc::normalize_associated_types_in(&self.infcx,
- &mut fulfillment_cx,
+ &mut self.fulfillment_cx.borrow_mut(),
span,
body_id,
value)
self.body_id,
traits::ObligationCauseCode::MiscObligation);
self.inh
- .infcx
.fulfillment_cx
.borrow_mut()
.normalize_projection_type(self.infcx(),
builtin_bound: ty::BuiltinBound,
cause: traits::ObligationCause<'tcx>)
{
- self.inh.infcx.fulfillment_cx.borrow_mut()
+ self.inh.fulfillment_cx.borrow_mut()
.register_builtin_bound(self.infcx(), ty, builtin_bound, cause);
}
{
debug!("register_predicate({:?})",
obligation);
- self.inh.infcx.fulfillment_cx
+ self.inh.fulfillment_cx
.borrow_mut()
.register_predicate_obligation(self.infcx(), obligation);
}
region: ty::Region,
cause: traits::ObligationCause<'tcx>)
{
- let mut fulfillment_cx = self.inh.infcx.fulfillment_cx.borrow_mut();
+ let mut fulfillment_cx = self.inh.fulfillment_cx.borrow_mut();
fulfillment_cx.register_region_obligation(ty, region, cause);
}
self.select_all_obligations_and_apply_defaults();
- let mut fulfillment_cx = self.inh.infcx.fulfillment_cx.borrow_mut();
+ let mut fulfillment_cx = self.inh.fulfillment_cx.borrow_mut();
match fulfillment_cx.select_all_or_error(self.infcx()) {
Ok(()) => { }
Err(errors) => { report_fulfillment_errors(self.infcx(), &errors); }
/// Select as many obligations as we can at present.
fn select_obligations_where_possible(&self) {
match
- self.inh.infcx.fulfillment_cx
+ self.inh.fulfillment_cx
.borrow_mut()
.select_where_possible(self.infcx())
{
let region_obligations =
self.fcx
.inh
- .infcx
.fulfillment_cx
.borrow()
.region_obligations(node_id)
// Processing the region obligations should not cause the list to grow further:
assert_eq!(region_obligations.len(),
- self.fcx.inh.infcx.fulfillment_cx.borrow().region_obligations(node_id).len());
+ self.fcx.inh.fulfillment_cx.borrow().region_obligations(node_id).len());
}
fn code_to_origin(&self,
}
};
- let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
+ let mut fulfill_cx = traits::FulfillmentContext::new();
// Register an obligation for `A: Trait<B>`.
let cause = traits::ObligationCause::misc(span, impl_node_id);
fn clean(&self, cx: &DocContext) -> Item {
let inner = match self.node {
hir::ImplItemKind::Const(ref ty, ref expr) => {
- ConstantItem(Constant{
- type_: ty.clean(cx),
- expr: expr.span.to_src(cx),
- })
+ AssociatedConstItem(ty.clean(cx),
+ Some(expr.span.to_src(cx)))
}
hir::ImplItemKind::Method(ref sig, _) => {
MethodItem(sig.clean(cx))
#[inline]
fn plain_summary_line(s: Option<&str>) -> String {
- let line = shorter(s).replace("\n", " ");
- markdown::plain_summary_line(&line[..])
+ let md = markdown::plain_summary_line(s.unwrap_or(""));
+ shorter(Some(&md)).replace("\n", " ")
}
fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Result {
} else {
String::new()
};
+ let doc_value = myitem.doc_value().unwrap_or("");
try!(write!(w, "
<tr class='{stab} module-item'>
<td><a class='{class}' href='{href}'
",
name = *myitem.name.as_ref().unwrap(),
stab_docs = stab_docs,
- docs = Markdown(&shorter(myitem.doc_value())),
+ docs = shorter(Some(&Markdown(doc_value).to_string())),
class = shortty(myitem),
stab = myitem.stability_class(),
href = item_path(myitem),
}
}
clean::TypedefItem(ref tydef, _) => {
- let id = derive_id(format!("assoc_type.{}", name));
+ let id = derive_id(format!("associatedtype.{}", name));
try!(write!(w, "<h4 id='{}' class='{}'><code>", id, shortty(item)));
try!(write!(w, "type {} = {}", name, tydef.type_));
try!(write!(w, "</code></h4>\n"));
}
clean::AssociatedConstItem(ref ty, ref default) => {
- let id = derive_id(format!("assoc_const.{}", name));
+ let id = derive_id(format!("associatedconstant.{}", name));
try!(write!(w, "<h4 id='{}' class='{}'><code>", id, shortty(item)));
try!(assoc_const(w, item, ty, default.as_ref()));
try!(write!(w, "</code></h4>\n"));
}
clean::ConstantItem(ref c) => {
- let id = derive_id(format!("assoc_const.{}", name));
+ let id = derive_id(format!("associatedconstant.{}", name));
try!(write!(w, "<h4 id='{}' class='{}'><code>", id, shortty(item)));
try!(assoc_const(w, item, &c.type_, Some(&c.expr)));
try!(write!(w, "</code></h4>\n"));
}
clean::AssociatedTypeItem(ref bounds, ref default) => {
- let id = derive_id(format!("assoc_type.{}", name));
+ let id = derive_id(format!("associatedtype.{}", name));
try!(write!(w, "<h4 id='{}' class='{}'><code>", id, shortty(item)));
try!(assoc_type(w, item, bounds, default));
try!(write!(w, "</code></h4>\n"));
#[stable(feature = "rust1", since = "1.0.0")]
type Owned;
- /// Checks if within the ASCII range.
+ /// Checks if the value is within the ASCII range.
///
/// # Examples
///
/// let ascii = 'a';
/// let utf8 = '❤';
///
- /// assert_eq!(true, ascii.is_ascii());
- /// assert_eq!(false, utf8.is_ascii())
+ /// assert!(ascii.is_ascii());
+ /// assert!(!utf8.is_ascii());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
fn is_ascii(&self) -> bool;
/// let ascii3 = 'A';
/// let ascii4 = 'z';
///
- /// assert_eq!(true, ascii1.eq_ignore_ascii_case(&ascii2));
- /// assert_eq!(true, ascii1.eq_ignore_ascii_case(&ascii3));
- /// assert_eq!(false, ascii1.eq_ignore_ascii_case(&ascii4));
+ /// assert!(ascii1.eq_ignore_ascii_case(&ascii2));
+ /// assert!(ascii1.eq_ignore_ascii_case(&ascii3));
+ /// assert!(!ascii1.eq_ignore_ascii_case(&ascii4));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
fn eq_ignore_ascii_case(&self, other: &Self) -> bool;
/// This macro takes any number of comma-separated identifiers, and
/// concatenates them all into one, yielding an expression which is a new
/// identifier. Note that hygiene makes it such that this macro cannot
- /// capture local variables, and macros are only allowed in item,
- /// statement or expression position, meaning this macro may be difficult to
- /// use in some situations.
+ /// capture local variables. Also, as a general rule, macros are only
+ /// allowed in item, statement or expression position. That means while
+ /// you may use this macro for referring to existing variables, functions or
+ /// modules etc, you cannot define a new one with it.
///
/// # Examples
///
///
/// let f = concat_idents!(foo, bar);
/// println!("{}", f());
+ ///
+ /// // fn concat_idents!(new, fun, name) { } // not usable in this way!
/// # }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
//! * [`std::marker`]::{[`Copy`], [`Send`], [`Sized`], [`Sync`]}. The marker
//! traits indicate fundamental properties of types.
//! * [`std::ops`]::{[`Drop`], [`Fn`], [`FnMut`], [`FnOnce`]}. Various
-//! operations for both destuctors and overloading `()`.
+//! operations for both destructors and overloading `()`.
//! * [`std::mem`]::[`drop`], a convenience function for explicitly dropping a
//! value.
//! * [`std::boxed`]::[`Box`], a way to allocate values on the heap.
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: Send + Reflect> Error for PoisonError<T> {
+impl<T: Reflect> Error for PoisonError<T> {
fn description(&self) -> &str {
"poisoned lock: another task failed inside"
}
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: Send + Reflect> fmt::Display for TryLockError<T> {
+impl<T> fmt::Display for TryLockError<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- self.description().fmt(f)
+ match *self {
+ TryLockError::Poisoned(..) => "poisoned lock: another task failed inside",
+ TryLockError::WouldBlock => "try_lock failed because the operation would block"
+ }.fmt(f)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<T: Send + Reflect> Error for TryLockError<T> {
+impl<T: Reflect> Error for TryLockError<T> {
fn description(&self) -> &str {
match *self {
TryLockError::Poisoned(ref p) => p.description(),
let _handle = Handle::new(token);
super::fill_utf16_buf(|buf, mut sz| {
match c::GetUserProfileDirectoryW(token, buf, &mut sz) {
- 0 if c::GetLastError() != 0 => 0,
+ 0 if c::GetLastError() != c::ERROR_INSUFFICIENT_BUFFER => 0,
0 => sz,
- n => n as c::DWORD,
+ _ => sz - 1, // sz includes the null terminator
}
}, super::os2path).ok()
})
for idx in 0.. {
if let Some(sp_trim) = sp.trim_start(prev) {
// Implies `sp.hi > prev.hi`
- let cur = match self.spans.as_slice().get(idx) {
+ let cur = match self.spans.get(idx) {
Some(s) => *s,
None => {
sp = sp_trim;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
use std::{env, fmt, process, sync, thread};
struct SlowFmt(u32);
// Test that we cleanup a fixed size Box<[D; k]> properly when D has a
// destructor.
+// ignore-emscripten no threads support
+
#![feature(const_fn)]
use std::thread;
// Test that we cleanup dynamic sized Box<[D]> properly when D has a
// destructor.
+// ignore-emscripten no threads support
+
#![feature(const_fn)]
use std::thread;
// that use capture clauses.
// pretty-expanded FIXME #23616
+// ignore-emscripten no threads support
extern crate cci_capture_clause;
// Reported as issue #126, child leaks the string.
// pretty-expanded FIXME #23616
+// ignore-emscripten no threads support
#![feature(std_misc)]
// It's unclear how likely such a bug is to recur, but it seems like a
// scenario worth testing.
+// ignore-emscripten no threads support
#![allow(unknown_features)]
#![feature(box_syntax)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
#![allow(unknown_features)]
#![feature(box_syntax, std_misc)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(std_misc)]
use std::thread;
// ignore-pretty
// compile-flags:--test
+// ignore-emscripten
// NB: These tests kill child processes. Valgrind sees these children as leaking
// memory, which makes for some *confusing* logs. That's why these are here
// except according to those terms.
// compile-flags: -Z force-dropflag-checks=off
+// ignore-emscripten no threads support
// Quick-and-dirty test to ensure -Z force-dropflag-checks=off works as
// expected. Note that the inlined drop-flag is slated for removal
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(libc)]
extern crate libc;
// make sure the stack pointers are maintained properly in both
// directions
+// ignore-emscripten no threads support
+
#![feature(libc, std_misc)]
extern crate libc;
// ignore-windows
// ignore-android
+// ignore-emscripten
#![feature(libc)]
// except according to those terms.
// ignore-aarch64
+// ignore-emscripten no threads support
+
#![feature(libc)]
extern crate libc;
// optimisation.
// pretty-expanded FIXME #23616
+// ignore-emscripten no threads support
#![feature(intrinsics, std_misc)]
// except according to those terms.
// compile-flags: -Z force-overflow-checks=on
+// ignore-emscripten no threads support
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
// This test is checking that the move_val_init intrinsic is
// respecting cleanups for both of its argument expressions.
//
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
// This test may not always fail, but it can be flaky if the race it used to
// expose is still present.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
#![feature(unboxed_closures)]
// DON'T REENABLE THIS UNLESS YOU'VE ACTUALLY FIXED THE UNDERLYING ISSUE
// ignore-android seems to block forever
+// ignore-emscripten no threads support
+
#![forbid(warnings)]
// Pretty printing tests complain about `use std::predule::*`
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
// Regression test for unwrapping the result of `join`, issue #21291
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
pub fn main() {
let f = || || 0;
std::thread::spawn(f());
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
use std::thread;
struct Foo(i32);
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(const_fn)]
// Check that the destructors of simple enums are run on unwinding
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
use std::thread;
struct Foo;
// spawned thread to isolate the expected error result from the
// SIGTRAP injected by the drop-flag consistency checking.
+// ignore-emscripten no threads support
+
struct Foo;
impl Drop for Foo {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
use std::sync::mpsc::channel;
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
use std::sync::mpsc::channel;
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(zero_one)]
use std::num::Zero;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(std_misc)]
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
use std::sync::mpsc::{TryRecvError, channel};
use std::thread;
// except according to those terms.
// pretty-expanded FIXME #23616
+// ignore-emscripten no threads support
#![feature(std_misc)]
// except according to those terms.
// ignore-windows
+// ignore-emscripten no threads support
// exec-env:RUST_LOG=debug
use std::cell::Cell;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
use std::thread;
macro_rules! expr { ($e: expr) => { $e } }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(std_misc)]
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
// Test that using the `vec!` macro nested within itself works when
// the contents implement Drop and we hit a panic in the middle of
// construction.
// except according to those terms.
// compile-flags: -Z no-landing-pads
-
+// ignore-emscripten no threads support
use std::thread;
// except according to those terms.
#![feature(panic_handler, std_panic)]
+// ignore-emscripten no threads support
+
use std::panic;
use std::thread;
// except according to those terms.
#![feature(panic_handler, const_fn, std_panic)]
+// ignore-emscripten no threads support
+
use std::sync::atomic::{AtomicUsize, Ordering};
use std::panic;
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(std_panic, recover, panic_propagate, panic_handler, const_fn)]
use std::sync::atomic::{AtomicUsize, Ordering};
// (instead of running forever), and that it does not print an error
// message about a broken pipe.
+// ignore-emscripten no threads support
+
use std::process;
use std::thread;
// except according to those terms.
// exec-env:RUST_LOG=rust_log_filter/foo
-
+// ignore-emscripten no threads support
#![allow(unknown_features)]
#![feature(box_syntax, std_misc, rustc_private)]
// except according to those terms.
// pretty-expanded FIXME #23616
+// ignore-emscripten no threads support
#![feature(std_misc)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![allow(unknown_features)]
#![feature(box_syntax)]
// ignore-bitrig
// compile-flags: -C codegen-units=3
+// ignore-emscripten no threads support
// Test unwinding through multiple compilation units.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
// Test that if a slicing expr[..] fails, the correct cleanups happen.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
// Test that if a slicing expr[..] fails, the correct cleanups happen.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
use std::thread;
fn x(s: String, n: isize) {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
/*
Make sure we can spawn tasks that take different types of
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
use std::thread;
pub fn main() {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
use std::thread;
pub fn main() {
// ignore-windows
// exec-env:RUST_LOG=debug
+// ignore-emscripten no threads support
// regression test for issue #10405, make sure we don't call println! too soon.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(std_misc)]
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(std_misc)]
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(std_misc)]
use std::thread;
// except according to those terms.
// pretty-expanded FIXME #23616
+// ignore-emscripten no threads support
#![feature(std_misc)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(std_misc)]
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(std_misc)]
use std::sync::mpsc::{channel, Sender};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(std_misc)]
use std::sync::mpsc::{channel, Sender};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
// pretty-expanded FIXME #23616
#![feature(std_misc)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
// pretty-expanded FIXME #23616
#![feature(std_misc)]
#![feature(std_misc)]
+// ignore-emscripten no threads support
// no-pretty-expanded FIXME #15189
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
#![feature(std_misc)]
#![allow(dead_assignment)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(std_misc)]
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
// pretty-expanded FIXME #23616
#![feature(std_misc)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
#![allow(unknown_features)]
#![feature(box_syntax, std_misc)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(box_syntax, set_stdio)]
use std::io::prelude::*;
// ignore-bitrig system ulimit (Too many open files)
// ignore-netbsd system ulimit (Too many open files)
// ignore-openbsd system ulimit (Too many open files)
+// ignore-emscripten no threads or sockets support
use std::io::prelude::*;
use std::net::{TcpListener, TcpStream};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
// Issue #787
// Don't try to clean up uninitialized locals
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(std_misc)]
use std::thread;
// except according to those terms.
// no-prefer-dynamic
+// ignore-emscripten no threads support
static mut HIT: bool = false;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
#![feature(thread_local_state)]
use std::thread::{self, LocalKeyState};
// Tests that a heterogeneous list of existential types can be put inside an Arc
// and shared between threads as long as all types fulfill Send.
+// ignore-emscripten no threads support
// ignore-pretty
#![allow(unknown_features)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
#![allow(unknown_features)]
#![feature(box_syntax)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
// Make sure the destructor is run for unit-like structs.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
use std::sync::mpsc::{channel, Sender};
use std::thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
#![allow(unknown_features)]
#![feature(box_syntax)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
#![feature(rand, num_bits_bytes)]
#![feature(const_fn)]
// aux-build:weak-lang-items.rs
+// ignore-emscripten no threads support
// pretty-expanded FIXME #23616
extern crate weak_lang_items as other;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
use std::thread;
pub fn main() {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-emscripten no threads support
+
use std::thread;
pub fn main() {
pub struct Bar;
impl Bar {
- // @has assoc_consts/struct.Bar.html '//*[@id="assoc_const.BAR"]' \
+ // @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAR"]' \
// 'const BAR: usize = 3'
pub const BAR: usize = 3;
}
extern crate issue_21092;
// @has issue_21092/struct.Bar.html
-// @has - '//*[@id="assoc_type.Bar"]' 'type Bar = i32'
+// @has - '//*[@id="associatedtype.Bar"]' 'type Bar = i32'
pub use issue_21092::{Foo, Bar};
}
impl<T> Bar for Foo<T> {
- // @has - '//*[@id="assoc_type.Item"]//code' 'type Item = T'
+ // @has - '//*[@id="associatedtype.Item"]//code' 'type Item = T'
type Item=T;
// @has - '//*[@id="method.quux"]//code' 'fn quux(self)'
fn quux(self) {}
}
impl<'a, T> Bar for &'a Foo<T> {
- // @has - '//*[@id="assoc_type.Item-1"]//code' "type Item = &'a T"
+ // @has - '//*[@id="associatedtype.Item-1"]//code' "type Item = &'a T"
type Item=&'a T;
// @has - '//*[@id="method.quux-1"]//code' 'fn quux(self)'
fn quux(self) {}
}
impl<'a, T> Bar for &'a mut Foo<T> {
- // @has - '//*[@id="assoc_type.Item-2"]//code' "type Item = &'a mut T"
+ // @has - '//*[@id="associatedtype.Item-2"]//code' "type Item = &'a mut T"
type Item=&'a mut T;
// @has - '//*[@id="method.quux-2"]//code' 'fn quux(self)'
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// @has issue_30366/index.html '//a/@href' 'http://www.rust-lang.org/'
+
+/// Describe it. [Link somewhere][1].
+///
+/// [1]: http://www.rust-lang.org/
+pub fn here_is_a_fn() { }