]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #12284 : brson/rust/install, r=alexcrichton
authorbors <bors@rust-lang.org>
Mon, 17 Feb 2014 11:26:51 +0000 (03:26 -0800)
committerbors <bors@rust-lang.org>
Mon, 17 Feb 2014 11:26:51 +0000 (03:26 -0800)
Work toward #9876.

This adds `prepare.mk`, which is simply a more heavily-parameterized `install.mk`, then uses `prepare` to implement both `install` and the windows installer (`dist`). Smoke tested on both Linux and Windows.

531 files changed:
.gitignore
mk/main.mk
mk/platform.mk
mk/tests.mk
src/compiletest/compiletest.rs
src/compiletest/procsrv.rs
src/doc/favicon.inc
src/doc/guide-ffi.md
src/doc/guide-runtime.md
src/doc/guide-tasks.md
src/doc/guide-testing.md
src/doc/index.md
src/doc/po/ja/complement-cheatsheet.md.po
src/doc/po/ja/guide-conditions.md.po
src/doc/po/ja/guide-container.md.po
src/doc/po/ja/guide-ffi.md.po
src/doc/po/ja/guide-pointers.md.po
src/doc/po/ja/guide-runtime.md.po
src/doc/po/ja/guide-testing.md.po
src/doc/po/ja/rust.md.po
src/doc/po/ja/tutorial.md.po
src/doc/rust.md
src/doc/rustdoc.md
src/doc/tutorial.md
src/doc/version_info.html.template
src/driver/driver.rs
src/etc/combine-tests.py
src/etc/emacs/rust-mode.el
src/etc/extract-tests.py
src/etc/generate-deriving-span-tests.py
src/etc/vim/syntax/rust.vim
src/libarena/lib.rs
src/libcollections/btree.rs
src/libcollections/dlist.rs
src/libcollections/lib.rs
src/libextra/json.rs
src/libextra/lib.rs
src/libextra/stats.rs
src/libextra/test.rs
src/libfourcc/lib.rs
src/libgetopts/lib.rs
src/libglob/lib.rs
src/libgreen/lib.rs
src/libgreen/sched.rs
src/libgreen/simple.rs
src/libgreen/task.rs
src/libnative/bookkeeping.rs
src/libnative/io/net.rs
src/libnative/io/process.rs
src/libnative/io/timer_helper.rs
src/libnative/lib.rs
src/libnative/task.rs
src/libnum/lib.rs
src/librustc/front/test.rs
src/librustc/lib.rs
src/librustc/metadata/creader.rs
src/librustc/metadata/cstore.rs
src/librustc/middle/resolve.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/consts.rs
src/librustc/middle/ty.rs
src/librustdoc/html/markdown.rs
src/librustdoc/html/render.rs
src/librustdoc/lib.rs
src/librustdoc/test.rs
src/librustuv/lib.rs
src/librustuv/process.rs
src/librustuv/queue.rs
src/libserialize/base64.rs
src/libserialize/hex.rs
src/libserialize/lib.rs
src/libstd/c_str.rs
src/libstd/comm/mod.rs
src/libstd/comm/shared.rs
src/libstd/comm/stream.rs
src/libstd/fmt/mod.rs
src/libstd/hashmap.rs
src/libstd/io/comm_adapters.rs
src/libstd/io/mod.rs
src/libstd/io/net/unix.rs
src/libstd/io/process.rs
src/libstd/io/test.rs
src/libstd/io/util.rs
src/libstd/iter.rs
src/libstd/kinds.rs
src/libstd/lib.rs
src/libstd/libc.rs
src/libstd/logging.rs
src/libstd/managed.rs
src/libstd/num/f32.rs
src/libstd/num/f64.rs
src/libstd/num/int_macros.rs
src/libstd/num/mod.rs
src/libstd/os.rs
src/libstd/path/mod.rs
src/libstd/prelude.rs
src/libstd/ptr.rs
src/libstd/rand/distributions/gamma.rs
src/libstd/rc.rs
src/libstd/repr.rs
src/libstd/rt/args.rs
src/libstd/rt/env.rs
src/libstd/rt/local_heap.rs
src/libstd/run.rs
src/libstd/str.rs
src/libstd/sync/deque.rs
src/libstd/task.rs
src/libstd/to_str.rs
src/libstd/tuple.rs
src/libstd/unstable/dynamic_lib.rs
src/libstd/unstable/finally.rs
src/libstd/unstable/mutex.rs
src/libstd/unstable/sync.rs
src/libstd/vec.rs
src/libstd/vec_ng.rs
src/libsync/sync/mutex.rs
src/libsyntax/ast.rs
src/libsyntax/ext/deriving/encodable.rs
src/libsyntax/ext/deriving/generic.rs
src/libsyntax/lib.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs
src/libuuid/lib.rs
src/libuv
src/rt/libuv-auto-clean-trigger
src/snapshots.txt
src/test/auxiliary/crateresolve4b-1.rs
src/test/auxiliary/crateresolve4b-2.rs
src/test/auxiliary/crateresolve7x.rs
src/test/auxiliary/crateresolve_calories-1.rs
src/test/auxiliary/crateresolve_calories-2.rs
src/test/auxiliary/issue-2414-b.rs
src/test/auxiliary/issue-2526.rs
src/test/auxiliary/issue-2631-a.rs
src/test/auxiliary/issue-9906.rs
src/test/auxiliary/issue2378b.rs
src/test/auxiliary/issue_2242_c.rs
src/test/auxiliary/issue_2316_b.rs
src/test/auxiliary/macro_crate_outlive_expansion_phase.rs
src/test/auxiliary/macro_crate_test.rs
src/test/auxiliary/pub_use_xcrate2.rs
src/test/auxiliary/trait_default_method_xc_aux_2.rs
src/test/bench/core-map.rs
src/test/bench/core-set.rs
src/test/bench/core-std.rs
src/test/bench/msgsend-pipes-shared.rs
src/test/bench/msgsend-pipes.rs
src/test/bench/msgsend-ring-mutex-arcs.rs
src/test/bench/msgsend-ring-rw-arcs.rs
src/test/bench/noise.rs
src/test/bench/rt-messaging-ping-pong.rs
src/test/bench/rt-parfib.rs
src/test/bench/rt-spawn-rate.rs
src/test/bench/shootout-ackermann.rs
src/test/bench/shootout-binarytrees.rs
src/test/bench/shootout-chameneos-redux.rs
src/test/bench/shootout-fasta.rs
src/test/bench/shootout-fibo.rs
src/test/bench/shootout-k-nucleotide-pipes.rs
src/test/bench/shootout-k-nucleotide.rs
src/test/bench/shootout-pfib.rs
src/test/bench/shootout-pidigits.rs
src/test/bench/shootout-spectralnorm.rs
src/test/bench/std-smallintmap.rs
src/test/bench/sudoku.rs
src/test/bench/task-perf-alloc-unwind.rs
src/test/compile-fail/ambig_impl_2_exe.rs
src/test/compile-fail/arc-cant-nest-rw-arc-3177.rs
src/test/compile-fail/arc-rw-cond-shouldnt-escape.rs
src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs
src/test/compile-fail/arc-rw-state-shouldnt-escape.rs
src/test/compile-fail/arc-rw-write-mode-cond-shouldnt-escape.rs
src/test/compile-fail/arc-rw-write-mode-shouldnt-escape.rs
src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs [new file with mode: 0644]
src/test/compile-fail/builtin-superkinds-in-metadata.rs
src/test/compile-fail/coherence_inherent_cc.rs
src/test/compile-fail/conflicting-implementations-aux.rs
src/test/compile-fail/crateresolve1.rs
src/test/compile-fail/crateresolve2.rs
src/test/compile-fail/crateresolve5.rs
src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs
src/test/compile-fail/deriving-span-Clone-enum.rs
src/test/compile-fail/deriving-span-Clone-struct.rs
src/test/compile-fail/deriving-span-Clone-tuple-struct.rs
src/test/compile-fail/deriving-span-DeepClone-enum-struct-variant.rs
src/test/compile-fail/deriving-span-DeepClone-enum.rs
src/test/compile-fail/deriving-span-DeepClone-struct.rs
src/test/compile-fail/deriving-span-DeepClone-tuple-struct.rs
src/test/compile-fail/deriving-span-Default-struct.rs
src/test/compile-fail/deriving-span-Default-tuple-struct.rs
src/test/compile-fail/deriving-span-Eq-enum-struct-variant.rs
src/test/compile-fail/deriving-span-Eq-enum.rs
src/test/compile-fail/deriving-span-Eq-struct.rs
src/test/compile-fail/deriving-span-Eq-tuple-struct.rs
src/test/compile-fail/deriving-span-Ord-enum-struct-variant.rs
src/test/compile-fail/deriving-span-Ord-enum.rs
src/test/compile-fail/deriving-span-Ord-struct.rs
src/test/compile-fail/deriving-span-Ord-tuple-struct.rs
src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs
src/test/compile-fail/deriving-span-Rand-enum.rs
src/test/compile-fail/deriving-span-Rand-struct.rs
src/test/compile-fail/deriving-span-Rand-tuple-struct.rs
src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs
src/test/compile-fail/deriving-span-Show-enum.rs
src/test/compile-fail/deriving-span-Show-struct.rs
src/test/compile-fail/deriving-span-Show-tuple-struct.rs
src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs
src/test/compile-fail/deriving-span-TotalEq-enum.rs
src/test/compile-fail/deriving-span-TotalEq-struct.rs
src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs
src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs
src/test/compile-fail/deriving-span-TotalOrd-enum.rs
src/test/compile-fail/deriving-span-TotalOrd-struct.rs
src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs
src/test/compile-fail/deriving-span-Zero-struct.rs
src/test/compile-fail/deriving-span-Zero-tuple-struct.rs
src/test/compile-fail/functional-struct-update-noncopyable.rs
src/test/compile-fail/future_not_copyable.rs
src/test/compile-fail/gated-non-ascii-idents.rs
src/test/compile-fail/gated-phase.rs
src/test/compile-fail/gated-simd.rs
src/test/compile-fail/issue-11593.rs
src/test/compile-fail/issue-3021-b.rs
src/test/compile-fail/issue-3021-c.rs
src/test/compile-fail/issue-3021-d.rs
src/test/compile-fail/issue-3021.rs
src/test/compile-fail/issue-3096-2.rs
src/test/compile-fail/issue-3907.rs
src/test/compile-fail/issue-5844.rs
src/test/compile-fail/issue-9957.rs
src/test/compile-fail/lint-stability.rs
src/test/compile-fail/log-syntax-gate.rs
src/test/compile-fail/macro-crate-unexported-macro.rs
src/test/compile-fail/macro-crate-unknown-crate.rs
src/test/compile-fail/moves-based-on-type-cyclic-types-issue-4821.rs
src/test/compile-fail/mutex-arc-nested.rs
src/test/compile-fail/no-capture-arc.rs
src/test/compile-fail/no-reuse-move-arc.rs
src/test/compile-fail/noexporttypeexe.rs
src/test/compile-fail/once-cant-call-twice-on-heap.rs
src/test/compile-fail/once-cant-call-twice-on-stack.rs
src/test/compile-fail/once-cant-move-out-of-non-once-on-stack.rs
src/test/compile-fail/pattern-tyvar-2.rs
src/test/compile-fail/pattern-tyvar.rs
src/test/compile-fail/phase-syntax-doesnt-resolve.rs
src/test/compile-fail/private-method-cross-crate.rs
src/test/compile-fail/private-struct-field-cross-crate.rs
src/test/compile-fail/private-variant-xc.rs
src/test/compile-fail/private_variant_2.rs
src/test/compile-fail/qquote-1.rs
src/test/compile-fail/qquote-2.rs
src/test/compile-fail/regions-glb-free-free.rs
src/test/compile-fail/seq-args.rs
src/test/compile-fail/spawn-non-nil-fn.rs
src/test/compile-fail/static-priv-by-default.rs
src/test/compile-fail/static-priv-by-default2.rs
src/test/compile-fail/struct-field-privacy.rs
src/test/compile-fail/sync-cond-shouldnt-escape.rs
src/test/compile-fail/sync-rwlock-cond-shouldnt-escape.rs
src/test/compile-fail/sync-rwlock-read-mode-shouldnt-escape.rs
src/test/compile-fail/sync-rwlock-write-mode-cond-shouldnt-escape.rs
src/test/compile-fail/sync-rwlock-write-mode-shouldnt-escape.rs
src/test/compile-fail/syntax-extension-fourcc-bad-len.rs
src/test/compile-fail/syntax-extension-fourcc-invalid-endian.rs
src/test/compile-fail/syntax-extension-fourcc-non-ascii-str.rs
src/test/compile-fail/syntax-extension-fourcc-non-literal.rs
src/test/compile-fail/syntax-extension-fourcc-unsupported-literal.rs
src/test/compile-fail/unresolved-extern-mod-suggestion.rs
src/test/compile-fail/unresolved-import.rs
src/test/compile-fail/use-from-trait-xc.rs
src/test/compile-fail/use-meta-mismatch.rs
src/test/compile-fail/use-meta.rc
src/test/compile-fail/view-items-at-top.rs
src/test/compile-fail/xc-private-method.rs
src/test/compile-fail/xc-private-method2.rs
src/test/compile-fail/xcrate-private-by-default.rs
src/test/compile-fail/xcrate-unit-struct.rs
src/test/pretty/raw-str-nonexpr.rs
src/test/run-fail/fail-main.rs
src/test/run-fail/fmt-fail.rs
src/test/run-fail/for-each-loop-fail.rs
src/test/run-fail/issue-2444.rs
src/test/run-fail/linked-failure.rs
src/test/run-fail/morestack2.rs
src/test/run-fail/morestack3.rs
src/test/run-fail/morestack4.rs
src/test/run-fail/native-failure.rs
src/test/run-fail/run-unexported-tests.rs
src/test/run-fail/spawnfail.rs
src/test/run-make/bootstrap-from-c-with-green/lib.rs
src/test/run-make/bootstrap-from-c-with-native/lib.rs
src/test/run-make/c-dynamic-dylib/bar.rs
src/test/run-make/c-dynamic-rlib/bar.rs
src/test/run-make/c-static-dylib/bar.rs
src/test/run-make/c-static-rlib/bar.rs
src/test/run-make/dylib-chain/m2.rs
src/test/run-make/dylib-chain/m3.rs
src/test/run-make/dylib-chain/m4.rs
src/test/run-make/lto-smoke/main.rs
src/test/run-make/mixing-deps/dylib.rs
src/test/run-make/mixing-deps/prog.rs
src/test/run-make/mixing-libs/dylib.rs
src/test/run-make/mixing-libs/prog.rs
src/test/run-make/prefer-dylib/foo.rs
src/test/run-make/prefer-rlib/foo.rs
src/test/run-make/rlib-chain/m2.rs
src/test/run-make/rlib-chain/m3.rs
src/test/run-make/rlib-chain/m4.rs
src/test/run-make/simple-dylib/foo.rs
src/test/run-make/simple-rlib/foo.rs
src/test/run-make/static-unwinding/main.rs
src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs
src/test/run-pass-fulldeps/macro-crate.rs
src/test/run-pass-fulldeps/qquote.rs
src/test/run-pass-fulldeps/quote-tokens.rs
src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs
src/test/run-pass-fulldeps/syntax-extension-fourcc.rs
src/test/run-pass/anon-extern-mod-cross-crate-2.rs
src/test/run-pass/anon_trait_static_method_exe.rs
src/test/run-pass/attr-before-view-item.rs
src/test/run-pass/attr-before-view-item2.rs
src/test/run-pass/auto-encode.rs
src/test/run-pass/bind-by-move.rs
src/test/run-pass/bitv-perf-test.rs
src/test/run-pass/block-arg-call-as.rs
src/test/run-pass/borrowck-borrow-from-expr-block.rs
src/test/run-pass/borrowck-preserve-box-in-field.rs
src/test/run-pass/borrowck-preserve-box-in-uniq.rs
src/test/run-pass/borrowck-preserve-box.rs
src/test/run-pass/borrowck-preserve-expl-deref.rs
src/test/run-pass/builtin-superkinds-capabilities-xc.rs
src/test/run-pass/builtin-superkinds-in-metadata.rs
src/test/run-pass/cap-clause-move.rs [deleted file]
src/test/run-pass/capturing-logging.rs
src/test/run-pass/cci_borrow.rs
src/test/run-pass/cci_capture_clause.rs
src/test/run-pass/cci_impl_exe.rs
src/test/run-pass/cci_iter_exe.rs
src/test/run-pass/cci_nested_exe.rs
src/test/run-pass/cci_no_inline_exe.rs
src/test/run-pass/cfg_inner_static.rs
src/test/run-pass/class-cast-to-trait-cross-crate-2.rs
src/test/run-pass/class-implement-trait-cross-crate.rs
src/test/run-pass/class-method-cross-crate.rs
src/test/run-pass/class-methods-cross-crate.rs
src/test/run-pass/class-poly-methods-cross-crate.rs
src/test/run-pass/classes-cross-crate.rs
src/test/run-pass/classes-simple-cross-crate.rs
src/test/run-pass/clone-with-exterior.rs
src/test/run-pass/const-cross-crate-const.rs
src/test/run-pass/const-cross-crate-extern.rs
src/test/run-pass/const-region-ptrs-noncopy.rs
src/test/run-pass/crate-method-reexport-grrrrrrr.rs
src/test/run-pass/crateresolve1.rs
src/test/run-pass/crateresolve2.rs
src/test/run-pass/crateresolve3.rs
src/test/run-pass/crateresolve4.rs
src/test/run-pass/crateresolve5.rs
src/test/run-pass/crateresolve8.rs
src/test/run-pass/cross-crate-const-pat.rs
src/test/run-pass/cross-crate-newtype-struct-pat.rs
src/test/run-pass/deriving-encodable-decodable.rs
src/test/run-pass/deriving-global.rs
src/test/run-pass/duplicate-use.rs
src/test/run-pass/duplicated-external-mods.rs
src/test/run-pass/enum-alignment.rs
src/test/run-pass/explicit-self-generic.rs
src/test/run-pass/explicit_self_xcrate_exe.rs
src/test/run-pass/extern-calling-convention-test.rs
src/test/run-pass/extern-crosscrate.rs
src/test/run-pass/extern-foreign-crate.rs
src/test/run-pass/extern-mod-ordering-exe.rs
src/test/run-pass/extern-mod-syntax.rs
src/test/run-pass/float-nan.rs
src/test/run-pass/foreign-fn-linkname.rs
src/test/run-pass/generic-default-type-params-cross-crate.rs
src/test/run-pass/getopts_ref.rs
src/test/run-pass/glob-std.rs
src/test/run-pass/impl-privacy-xc-1.rs
src/test/run-pass/impl-privacy-xc-2.rs
src/test/run-pass/import-glob-crate.rs
src/test/run-pass/infinite-loops.rs
src/test/run-pass/inner-static.rs
src/test/run-pass/intrinsic-atomics-cc.rs
src/test/run-pass/intrinsics-integer.rs
src/test/run-pass/invoke-external-foreign.rs
src/test/run-pass/issue-10031.rs
src/test/run-pass/issue-10626.rs
src/test/run-pass/issue-11224.rs
src/test/run-pass/issue-11225-1.rs
src/test/run-pass/issue-11225-2.rs
src/test/run-pass/issue-2316-c.rs
src/test/run-pass/issue-2380-b.rs
src/test/run-pass/issue-2383.rs
src/test/run-pass/issue-2414-c.rs
src/test/run-pass/issue-2472.rs
src/test/run-pass/issue-2526-a.rs
src/test/run-pass/issue-2631-b.rs
src/test/run-pass/issue-2723-b.rs
src/test/run-pass/issue-2804.rs
src/test/run-pass/issue-2904.rs
src/test/run-pass/issue-2989.rs
src/test/run-pass/issue-3012-2.rs
src/test/run-pass/issue-3424.rs
src/test/run-pass/issue-3556.rs
src/test/run-pass/issue-3563-3.rs
src/test/run-pass/issue-3574.rs
src/test/run-pass/issue-3609.rs
src/test/run-pass/issue-3979-xcrate.rs
src/test/run-pass/issue-4016.rs
src/test/run-pass/issue-4036.rs
src/test/run-pass/issue-4208.rs
src/test/run-pass/issue-4241.rs
src/test/run-pass/issue-4545.rs
src/test/run-pass/issue-5521.rs
src/test/run-pass/issue-6919.rs
src/test/run-pass/issue-7178.rs
src/test/run-pass/issue-8044.rs
src/test/run-pass/issue-8259.rs
src/test/run-pass/issue-8401.rs
src/test/run-pass/issue-8860.rs
src/test/run-pass/issue-9123.rs
src/test/run-pass/issue-9188.rs
src/test/run-pass/issue-9906.rs
src/test/run-pass/issue-9968.rs
src/test/run-pass/issue2170exe.rs
src/test/run-pass/issue2378c.rs
src/test/run-pass/issue_3136_b.rs
src/test/run-pass/issue_9155.rs
src/test/run-pass/item-attributes.rs
src/test/run-pass/kinds-in-metadata.rs
src/test/run-pass/linkage-visibility.rs
src/test/run-pass/log-knows-the-names-of-variants-in-std.rs
src/test/run-pass/logging-right-crate.rs
src/test/run-pass/lots-a-fail.rs
src/test/run-pass/macro-crate-def-only.rs
src/test/run-pass/macro-export-inner-module.rs
src/test/run-pass/match-join.rs
src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs
src/test/run-pass/morestack5.rs
src/test/run-pass/move-3-unique.rs
src/test/run-pass/move-3.rs
src/test/run-pass/move-4-unique.rs
src/test/run-pass/move-4.rs
src/test/run-pass/moves-based-on-type-cross-crate.rs
src/test/run-pass/mutable-alias-vec.rs
src/test/run-pass/native-always-waits.rs
src/test/run-pass/nested_item_main.rs
src/test/run-pass/newtype-struct-xc-2.rs
src/test/run-pass/newtype-struct-xc.rs
src/test/run-pass/no-std-xcrate.rs
src/test/run-pass/no-std-xcrate2.rs
src/test/run-pass/non-boolean-pure-fns.rs
src/test/run-pass/once-move-out-on-heap.rs
src/test/run-pass/once-move-out-on-stack.rs
src/test/run-pass/packed-struct-size-xc.rs
src/test/run-pass/phase-syntax-link-does-resolve.rs
src/test/run-pass/placement-new-arena.rs
src/test/run-pass/preempt.rs
src/test/run-pass/priv-impl-prim-ty.rs
src/test/run-pass/privacy-reexport.rs
src/test/run-pass/process-detach.rs [new file with mode: 0644]
src/test/run-pass/pub-use-xcrate.rs
src/test/run-pass/pub_use_mods_xcrate_exe.rs
src/test/run-pass/reexport-should-still-link.rs
src/test/run-pass/reexported-static-methods-cross-crate.rs
src/test/run-pass/regions-lifetime-static-items-enclosing-scopes.rs
src/test/run-pass/regions-mock-tcx.rs
src/test/run-pass/rename-directory.rs
src/test/run-pass/send-iloop.rs
src/test/run-pass/send_str_treemap.rs
src/test/run-pass/spawn.rs
src/test/run-pass/stable-addr-of.rs
src/test/run-pass/stat.rs
src/test/run-pass/static-fn-inline-xc.rs
src/test/run-pass/static-fn-trait-xc.rs
src/test/run-pass/static-function-pointer-xc.rs
src/test/run-pass/static-method-xcrate.rs
src/test/run-pass/static-mut-xc.rs
src/test/run-pass/str-append.rs
src/test/run-pass/str-multiline.rs
src/test/run-pass/string-self-append.rs
src/test/run-pass/struct-destructuring-cross-crate.rs
src/test/run-pass/struct_variant_xc.rs
src/test/run-pass/swap-overlapping.rs
src/test/run-pass/task-comm-0.rs
src/test/run-pass/task-comm-10.rs
src/test/run-pass/task-comm-11.rs
src/test/run-pass/task-comm-12.rs
src/test/run-pass/task-comm-13.rs
src/test/run-pass/task-comm-15.rs
src/test/run-pass/task-comm-17.rs
src/test/run-pass/task-comm-3.rs
src/test/run-pass/task-comm-5.rs
src/test/run-pass/task-comm-7.rs
src/test/run-pass/task-comm-9.rs
src/test/run-pass/task-comm-chan-nil.rs
src/test/run-pass/task-life-0.rs
src/test/run-pass/task-spawn-move-and-copy.rs
src/test/run-pass/tempfile.rs
src/test/run-pass/terminate-in-initializer.rs
src/test/run-pass/test-ignore-cfg.rs
src/test/run-pass/test-runner-hides-main.rs
src/test/run-pass/threads.rs
src/test/run-pass/trait-bounds-in-arc.rs
src/test/run-pass/trait-default-method-xc-2.rs
src/test/run-pass/trait-default-method-xc.rs
src/test/run-pass/trait-inheritance-auto-xc-2.rs
src/test/run-pass/trait-inheritance-auto-xc.rs
src/test/run-pass/trait-inheritance-cross-trait-call-xc.rs
src/test/run-pass/trait-inheritance-num.rs
src/test/run-pass/trait-inheritance-num2.rs
src/test/run-pass/trait-inheritance-overloading-xc-exe.rs
src/test/run-pass/trait-typedef-cc.rs
src/test/run-pass/type-sizes.rs
src/test/run-pass/typeid-intrinsic.rs
src/test/run-pass/unify-return-ty.rs
src/test/run-pass/uniq-cc-generic.rs
src/test/run-pass/unwind-box.rs
src/test/run-pass/unwind-resource.rs
src/test/run-pass/unwind-resource2.rs
src/test/run-pass/unwind-unique.rs
src/test/run-pass/use-crate-name-alias.rs
src/test/run-pass/use.rs
src/test/run-pass/use_inline_dtor.rs
src/test/run-pass/utf8_chars.rs
src/test/run-pass/vec-self-append.rs
src/test/run-pass/xcrate-address-insignificant.rs
src/test/run-pass/xcrate-static-addresses.rs
src/test/run-pass/xcrate-trait-lifetime-param.rs
src/test/run-pass/xcrate-unit-struct.rs

index 2fa5de274954c6848e047bd58cfbaf78de65516d..a72ba1be0df977d511163fd3fb0c5f3fb6b5666b 100644 (file)
@@ -60,7 +60,7 @@ config.mk
 /rt/
 /rustllvm/
 /test/
-/build/
+/build
 /inst/
 /mingw-build/
 src/.DS_Store
index aa5ae77b3ac7780c2ed71b86925e258b4d012779..53ba07e65cbdd6ede725175eb9a0b6ec50d6262b 100644 (file)
@@ -45,7 +45,7 @@ CFG_VERSION_WIN = $(subst -pre,,$(CFG_RELEASE))
 # and include all of the .d files in one fell swoop.
 ALL_OBJ_FILES :=
 
-ifneq ($(NO_MAKEFILE_DEPS),)
+ifneq ($(NO_MKFILE_DEPS),)
 MKFILE_DEPS :=
 else
 MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)
index c473618004e37969959934908ba3bbdb0fc9e258..b27546289f30c89906ea863b3ae4d53a10fbfaff 100644 (file)
@@ -350,7 +350,7 @@ CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-
 CFG_GCCISH_PRE_LIB_FLAGS_arm-unknown-linux-gnueabi := -Wl,-whole-archive
 CFG_GCCISH_POST_LIB_FLAGS_arm-unknown-linux-gnueabi := -Wl,-no-whole-archive
 CFG_DEF_SUFFIX_arm-unknown-linux-gnueabi := .linux.def
-CFG_LLC_FLAGS_arm-unknown-linux-gnueabi := -arm-enable-ehabi -arm-enable-ehabi-descriptors
+CFG_LLC_FLAGS_arm-unknown-linux-gnueabi :=
 CFG_INSTALL_NAME_arm-unknown-linux-gnueabi =
 CFG_LIBUV_LINK_FLAGS_arm-unknown-linux-gnueabi =
 CFG_EXE_SUFFIX_arm-unknown-linux-gnueabi :=
index 8ca4da85994fdfa218cb65299632f96296fb918c..e1c4a4ccf94b46578e9fa7f2aad1b694f4f019e3 100644 (file)
@@ -174,16 +174,6 @@ endif
 check: cleantestlibs cleantmptestlogs tidy all check-stage2
        $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
 
-check-notidy: cleantestlibs cleantmptestlogs all check-stage2
-       $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
-check-full: cleantestlibs cleantmptestlogs tidy \
-            all check-stage1 check-stage2 check-stage3
-       $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
-check-test: cleantestlibs cleantmptestlogs all check-stage2-rfail
-       $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
 check-lite: cleantestlibs cleantmptestlogs \
        $(foreach crate,$(TARGET_CRATES),check-stage2-$(crate)) \
        check-stage2-rpass \
index 94153c169aca311bfe24d304dd17e8482e8147c2..15aa68aaebbdf77b345a25df3e61b12673db1be1 100644 (file)
@@ -13,8 +13,8 @@
 #[allow(non_camel_case_types)];
 #[deny(warnings)];
 
-extern mod extra;
-extern mod getopts;
+extern crate extra;
+extern crate getopts;
 
 use std::os;
 use std::io;
index 019803a9337796d87b7a12ccf9f64f63dfce4a37..1016c3cf0e61b55535d932f8f35cdb4ae5b60ea9 100644 (file)
@@ -51,10 +51,7 @@ pub fn run(lib_path: &str,
     let env = env + target_env(lib_path, prog);
     let mut opt_process = run::Process::new(prog, args, run::ProcessOptions {
         env: Some(env),
-        dir: None,
-        in_fd: None,
-        out_fd: None,
-        err_fd: None
+        .. run::ProcessOptions::new()
     });
 
     match opt_process {
@@ -83,10 +80,7 @@ pub fn run_background(lib_path: &str,
     let env = env + target_env(lib_path, prog);
     let opt_process = run::Process::new(prog, args, run::ProcessOptions {
         env: Some(env),
-        dir: None,
-        in_fd: None,
-        out_fd: None,
-        err_fd: None
+        .. run::ProcessOptions::new()
     });
 
     match opt_process {
index 8dd05620e48f6c6c5847d2cc7e0574b78f00f286..b68c58c9b6176685c5ed62927268143de98d6e37 100644 (file)
@@ -1 +1 @@
-<link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico" />
\ No newline at end of file
+<link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico" />
index 053a8612694ab399aff710291f4f3af61e05d1f7..c279ff314b474454dc961a5c2fa4949610c88eaa 100644 (file)
@@ -229,7 +229,7 @@ impl<T: Send> Drop for Unique<T> {
             let x = mem::uninit(); // dummy value to swap in
             // We need to move the object out of the box, so that
             // the destructor is called (at the end of this scope.)
-            ptr::replace_ptr(self.ptr, x);
+            ptr::replace(self.ptr, x);
             free(self.ptr as *mut c_void)
         }
     }
@@ -306,7 +306,7 @@ which would call back to `callback()` in Rust.
 The former example showed how a global function can be called from C code.
 However it is often desired that the callback is targetted to a special
 Rust object. This could be the object that represents the wrapper for the
-respective C object. 
+respective C object.
 
 This can be achieved by passing an unsafe pointer to the object down to the
 C library. The C library can then include the pointer to the Rust object in
@@ -335,7 +335,7 @@ extern {
 fn main() {
     // Create the object that will be referenced in the callback
     let rust_object = ~RustObject{a: 5, ...};
-     
+
     unsafe {
         // Gets a raw pointer to the object
         let target_addr:*RustObject = ptr::to_unsafe_ptr(rust_object);
@@ -380,8 +380,8 @@ Rust is to use channels (in `std::comm`) to forward data from the C thread
 that invoked the callback into a Rust task.
 
 If an asychronous callback targets a special object in the Rust address space
-it is also absolutely necessary that no more callbacks are performed by the 
-C library after the respective Rust object gets destroyed. 
+it is also absolutely necessary that no more callbacks are performed by the
+C library after the respective Rust object gets destroyed.
 This can be achieved by unregistering the callback in the object's
 destructor and designing the library in a way that guarantees that no
 callback will be performed after unregistration.
index 40319c1ec4fabeb55cbe17fff0aa3fe75480eab8..6d5d90e2617fe5f5dfbbaff0f1a85054cc0d6f4c 100644 (file)
@@ -232,7 +232,7 @@ fn main() {}
 Whereas this program explicitly opts into using a particular runtime
 
 ~~~{.rust}
-extern mod green;
+extern crate green;
 
 #[start]
 fn start(argc: int, argv: **u8) -> int {
index 9ff712df0215220773ab39a90d73c182b7e76514..813b61dc8fb39f649a1aa5b6b5953e9e5b82146f 100644 (file)
@@ -285,7 +285,7 @@ later.
 The basic example below illustrates this.
 
 ~~~
-# extern mod sync;
+# extern crate sync;
 
 # fn main() {
 # fn make_a_sandwich() {};
@@ -310,7 +310,7 @@ Here is another example showing how futures allow you to background computations
 be distributed on the available cores.
 
 ~~~
-# extern mod sync;
+# extern crate sync;
 # use std::vec;
 fn partial_sum(start: uint) -> f64 {
     let mut local_sum = 0f64;
@@ -346,7 +346,7 @@ Here is a small example showing how to use Arcs. We wish to run concurrently sev
 a single large vector of floats. Each task needs the full vector to perform its duty.
 
 ~~~
-# extern mod sync;
+# extern crate sync;
 # use std::vec;
 # use std::rand;
 use sync::Arc;
@@ -379,7 +379,7 @@ at the power given as argument and takes the inverse power of this value). The A
 created by the line
 
 ~~~
-# extern mod sync;
+# extern crate sync;
 # use sync::Arc;
 # use std::vec;
 # use std::rand;
@@ -392,7 +392,7 @@ let numbers_arc=Arc::new(numbers);
 and a clone of it is sent to each task
 
 ~~~
-# extern mod sync;
+# extern crate sync;
 # use sync::Arc;
 # use std::vec;
 # use std::rand;
@@ -409,7 +409,7 @@ copying only the wrapper and not its contents.
 Each task recovers the underlying data by
 
 ~~~
-# extern mod sync;
+# extern crate sync;
 # use sync::Arc;
 # use std::vec;
 # use std::rand;
@@ -499,7 +499,7 @@ the string in response.  The child terminates when it receives `0`.
 Here is the function that implements the child task:
 
 ~~~
-# extern mod sync;
+# extern crate sync;
 # fn main() {
 # use sync::DuplexStream;
     fn stringifier(channel: &DuplexStream<~str, uint>) {
@@ -524,7 +524,7 @@ response itself is simply the stringified version of the received value,
 Here is the code for the parent task:
 
 ~~~
-# extern mod sync;
+# extern crate sync;
 # use std::task::spawn;
 # use sync::DuplexStream;
 # fn stringifier(channel: &DuplexStream<~str, uint>) {
index 455c65cef8b7f8cfda260f1961238034faae7c59..e51988565b0312c090fd2f48e3005012983b6d67 100644 (file)
@@ -185,7 +185,7 @@ amount.
 For example:
 
 ~~~
-extern mod extra;
+extern crate extra;
 use std::vec;
 use extra::test::BenchHarness;
 
@@ -243,7 +243,7 @@ recognize that some calculation has no external effects and remove
 it entirely.
 
 ~~~
-extern mod extra;
+extern crate extra;
 use extra::test::BenchHarness;
 
 #[bench]
index 9d6ab27598f742cae0694fbb3922de8fbe7eb58c..e343173f50ac6359f1dd12492dcfe1488109b9da 100644 (file)
@@ -24,27 +24,24 @@ li {list-style-type: none; }
 
 # Libraries
 
-* [The standard library, `libstd`](std/index.html)
-* [The extra library, `libextra`](extra/index.html)
-
-* [The M:N runtime library, `libgreen`](green/index.html)
-* [The 1:1 runtime library, `libnative`](native/index.html)
-
-* [The Rust libuv library, `librustuv`](rustuv/index.html)
-
-* [The Rust parser, `libsyntax`](syntax/index.html)
-* [The Rust compiler, `librustc`](rustc/index.html)
+* [The standard library, `std`](std/index.html)
 
 * [The `arena` allocation library](arena/index.html)
-* [The `num` arbitrary precision numerics library](num/index.html)
 * [The `collections` library](collections/index.html)
+* [The `extra` library of extra stuff](extra/index.html)
 * [The `flate` compression library](flate/index.html)
 * [The `fourcc` four-character code library](fourcc/index.html)
 * [The `getopts` argument parsing library](getopts/index.html)
 * [The `glob` file path matching library](glob/index.html)
+* [The `green` M:N runtime library](green/index.html)
+* [The `native` 1:1 threading runtime](native/index.html)
+* [The `num` arbitrary precision numerics library](num/index.html)
+* [The `rustc` compiler](rustc/index.html)
+* [The `rustuv` M:N I/O library](rustuv/index.html)
 * [The `semver` version collation library](semver/index.html)
 * [The `serialize` value encoding/decoding library](serialize/index.html)
 * [The `sync` library for concurrency-enabled mechanisms and primitives](sync/index.html)
+* [The `syntax` library, the Rust parser](syntax/index.html)
 * [The `term` terminal-handling library](term/index.html)
 * [The `uuid` 128-bit universally unique identifier library](uuid/index.html)
 
index 77fdddf343defff859180ea098d6ae018fff5e26..72ef1d5a0102bd840b99945074fd7bb6a60a8ff0 100644 (file)
@@ -273,7 +273,7 @@ msgstr "## タプル"
 #. type: Plain text
 #: src/doc/complement-cheatsheet.md:122
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~\n"
 "struct Foo {\n"
@@ -282,7 +282,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
index 1ef53f940e8054d65347fc33f931ddfa660869ea..a65d6eec4198cbc2f2843f34e147d8e5ab25d3b8 100644 (file)
@@ -79,13 +79,13 @@ msgstr "# 関数"
 #: src/doc/guide-conditions.md:262
 #, fuzzy
 #| msgid ""
-#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
+#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
 #| "\" + world::explore()); } ~~~~"
 msgid "fn main() {"
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
index 652338c5fd41fd413b121cfe8ed9e962b777a26f..23e1c7734f0b478d2a9a298b0ebbff508afb195c 100644 (file)
@@ -74,7 +74,7 @@ msgstr "# イントロダクション"
 #. type: Plain text
 #: src/doc/guide-container.md:85
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "impl Iterator<int> for ZeroStream {\n"
 "    fn next(&mut self) -> Option<int> {\n"
@@ -85,7 +85,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
index e2f24daadce477e3d5e12bc0c9ce4c0e2e5b7638..3155b9f65053f9d81358def0fd9216df1a5fbb8d 100644 (file)
@@ -70,7 +70,7 @@ msgstr "## 最小限の例"
 #. type: Plain text
 #: src/doc/guide-ffi.md:323
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "struct RustObject {\n"
 "    a: i32,\n"
@@ -79,7 +79,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
index 8cae9a3162701160cadd7f0a01173c3698bb8b85..2b130821c4c9ab6a1e9394ebcc6ba46cf63dea32 100644 (file)
@@ -154,7 +154,7 @@ msgstr ""
 #: src/doc/guide-pointers.md:141 src/doc/guide-pointers.md:221
 #: src/doc/guide-pointers.md:238 src/doc/guide-pointers.md:300
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~rust\n"
 "struct Point {\n"
@@ -164,7 +164,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -222,7 +222,7 @@ msgstr "# データ構造"
 #. type: Plain text
 #: src/doc/guide-pointers.md:189
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~rust\n"
 "enum List<T> {\n"
@@ -232,7 +232,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -304,7 +304,7 @@ msgstr "## マネージドボックス"
 #. type: Plain text
 #: src/doc/guide-pointers.md:269
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~rust{.ignore}\n"
 "struct Point {\n"
@@ -314,7 +314,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -372,7 +372,7 @@ msgstr ""
 #. type: Plain text
 #: src/doc/guide-pointers.md:341
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "struct Point {\n"
 "    x: f32,\n"
@@ -381,7 +381,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -402,7 +402,7 @@ msgstr ""
 #. type: Plain text
 #: src/doc/guide-pointers.md:378
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~rust{.ignore}\n"
 "fn main() {\n"
@@ -413,7 +413,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -499,7 +499,7 @@ msgstr ""
 #. type: Plain text
 #: src/doc/guide-pointers.md:450
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "    let x = ~5;\n"
@@ -509,7 +509,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -530,7 +530,7 @@ msgstr ""
 #. type: Plain text
 #: src/doc/guide-pointers.md:463
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "    let x = ~5;\n"
@@ -540,14 +540,14 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
 #. type: Plain text
 #: src/doc/guide-pointers.md:477
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "    let x = ~5;\n"
@@ -557,7 +557,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
index 9c4259fa11335ea4b48b390bfa0ef41d8412fb60..2e02fe344ebaf82c4a8c8e48b25ed801e34e177b 100644 (file)
@@ -83,13 +83,13 @@ msgstr "## 他のクレートの利用"
 #: src/doc/guide-runtime.md:231
 #, fuzzy
 #| msgid ""
-#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
+#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
 #| "\" + world::explore()); } ~~~~"
 msgid "~~~{.rust} fn main() {} ~~~"
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -97,7 +97,7 @@ msgstr ""
 #: src/doc/guide-runtime.md:236
 #, fuzzy
 #| msgid "~~~~ {.ignore} let foo = 10;"
-msgid "~~~{.rust} extern mod green;"
+msgid "~~~{.rust} extern crate green;"
 msgstr ""
 "~~~~ {.ignore}\n"
 "let foo = 10;"
@@ -106,13 +106,13 @@ msgstr ""
 #: src/doc/guide-runtime.md:246
 #, fuzzy
 #| msgid ""
-#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
+#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
 #| "\" + world::explore()); } ~~~~"
 msgid "fn main() {} ~~~"
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
index 4a173de1cbf0a790f65fc81e0a1216bd140c6c14..6ec1a4467da86bdb187f4838703145c719082b6d 100644 (file)
@@ -61,7 +61,7 @@ msgstr "## 最小限の例"
 #: src/doc/guide-testing.md:131
 #, fuzzy
 #| msgid "~~~~ use std::task::spawn;"
-msgid "~~~ extern mod extra; use std::vec;"
+msgid "~~~ extern crate extra; use std::vec;"
 msgstr ""
 "~~~~\n"
 "use std::task::spawn;"
index a4b875062fbda5cd65be98d5d12ff4f1e77971d2..0e96f4db84bf4bdbd999a0b1d7587652fb147120 100644 (file)
@@ -310,14 +310,14 @@ msgstr "## 他のクレートの利用"
 #: src/doc/rust.md:786
 #, fuzzy
 #| msgid "## Using other crates"
-msgid "Four examples of `extern mod` declarations:"
+msgid "Four examples of `extern crate` declarations:"
 msgstr "## 他のクレートの利用"
 
 #. type: Plain text
 #: src/doc/rust.md:789
 #, fuzzy
 #| msgid "~~~~ {.ignore} let foo = 10;"
-msgid "~~~~ {.ignore} extern mod pcre;"
+msgid "~~~~ {.ignore} extern crate pcre;"
 msgstr ""
 "~~~~ {.ignore}\n"
 "let foo = 10;"
@@ -365,7 +365,7 @@ msgstr "## 最小限の例"
 #| msgid "~~~~ {.ignore} let foo = 10;"
 msgid ""
 "mod foo {\n"
-"    extern mod extra;\n"
+"    extern crate extra;\n"
 msgstr ""
 "~~~~ {.ignore}\n"
 "let foo = 10;"
@@ -374,13 +374,13 @@ msgstr ""
 #: src/doc/rust.md:901
 #, fuzzy
 #| msgid ""
-#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
+#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
 #| "\" + world::explore()); } ~~~~"
 msgid "fn main() {} ~~~~"
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -751,7 +751,7 @@ msgstr "# イントロダクション"
 #. type: Plain text
 #: src/doc/rust.md:1420
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "struct Circle {\n"
 "    radius: f64,\n"
@@ -760,7 +760,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -775,13 +775,13 @@ msgstr "## 本書の表記について"
 #: src/doc/rust.md:1644 src/doc/rust.md:1665
 #, fuzzy
 #| msgid ""
-#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
+#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
 #| "\" + world::explore()); } ~~~~"
 msgid "# fn main() {} ~~~~"
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -866,7 +866,7 @@ msgstr "## 凍結"
 #. type: Plain text
 #: src/doc/rust.md:1953
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~~\n"
 "#[deriving(Eq, Clone)]\n"
@@ -878,7 +878,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -1254,7 +1254,7 @@ msgstr ""
 #. type: Plain text
 #: src/doc/rust.md:2702
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "while i < 10 {\n"
 "    println!(\"hello\");\n"
@@ -1264,7 +1264,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -1306,7 +1306,7 @@ msgstr "## 最小限の例"
 #. type: Plain text
 #: src/doc/rust.md:2774
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "for e in v.iter() {\n"
 "    bar(*e);\n"
@@ -1315,7 +1315,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -1637,7 +1637,7 @@ msgstr "## 最小限の例"
 #. type: Plain text
 #: src/doc/rust.md:3314
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~~\n"
 "trait Printable {\n"
@@ -1646,14 +1646,14 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
 #. type: Plain text
 #: src/doc/rust.md:3318
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "impl Printable for int {\n"
 "  fn to_string(&self) -> ~str { self.to_str() }\n"
@@ -1661,14 +1661,14 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
 #. type: Plain text
 #: src/doc/rust.md:3327
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "   print(@10 as @Printable);\n"
@@ -1677,7 +1677,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -1698,7 +1698,7 @@ msgstr "# クロージャ"
 #. type: Plain text
 #: src/doc/rust.md:3359
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~~\n"
 "trait Printable {\n"
@@ -1707,14 +1707,14 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
 #. type: Plain text
 #: src/doc/rust.md:3366
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "impl Printable for ~str {\n"
 "    fn make_string(&self) -> ~str {\n"
@@ -1725,7 +1725,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
index 9d36cb4d91358b55db04550600ee44cf5ccbb3de..34769b320b7d0724bcd4fc1abebe93556d14ceb9 100644 (file)
@@ -431,7 +431,7 @@ msgstr ""
 #. type: Plain text
 #: src/doc/tutorial.md:136
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~~\n"
 "fn main() {\n"
@@ -441,7 +441,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -634,7 +634,7 @@ msgstr ""
 #. type: Plain text
 #: src/doc/tutorial.md:222
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "while count < 10 {\n"
 "    println!(\"count is {}\", count);\n"
@@ -644,7 +644,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -1413,7 +1413,7 @@ msgstr ""
 #. type: Plain text
 #: src/doc/tutorial.md:602
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~~\n"
 "struct Point {\n"
@@ -1424,7 +1424,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -2187,7 +2187,7 @@ msgstr "# ボックス"
 #. type: Plain text
 #: src/doc/tutorial.md:986
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "struct Foo {\n"
 "    a: u32,\n"
@@ -2198,7 +2198,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -2312,7 +2312,7 @@ msgstr "例として、シンプルな構造体型の `Point` について考え
 #. type: Plain text
 #: src/doc/tutorial.md:1376
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~\n"
 "struct Point {\n"
@@ -2323,7 +2323,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -3688,7 +3688,7 @@ msgstr ""
 #. type: Plain text
 #: src/doc/tutorial.md:2110
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~\n"
 "struct TimeBomb {\n"
@@ -3697,7 +3697,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -3735,7 +3735,7 @@ msgstr ""
 #. type: Plain text
 #: src/doc/tutorial.md:2135
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~~\n"
 "trait Printable {\n"
@@ -3745,7 +3745,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -3774,7 +3774,7 @@ msgstr "[impls]: #メソッド"
 #. type: Plain text
 #: src/doc/tutorial.md:2160 src/doc/tutorial.md:2206
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "impl Printable for ~str {\n"
 "    fn print(&self) { println!(\"{}\", *self) }\n"
@@ -3782,7 +3782,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -3821,7 +3821,7 @@ msgstr "## トレイトの実装の導出"
 #. type: Plain text
 #: src/doc/tutorial.md:2185
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "impl Printable for bool {\n"
 "    fn print(&self) { println!(\"{:?}\", *self) }\n"
@@ -3829,7 +3829,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -3864,7 +3864,7 @@ msgstr "## タプル"
 #. type: Plain text
 #: src/doc/tutorial.md:2235
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~~\n"
 "trait Seq<T> {\n"
@@ -3873,14 +3873,14 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
 #. type: Plain text
 #: src/doc/tutorial.md:2240
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "impl<T> Seq<T> for ~[T] {\n"
 "    fn length(&self) -> uint { self.len() }\n"
@@ -3889,7 +3889,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -4447,7 +4447,7 @@ msgstr "## クレート"
 #. type: Plain text
 #: src/doc/tutorial.md:2554
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "~~~~\n"
 "// `main.rs`\n"
@@ -4458,7 +4458,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -4487,7 +4487,7 @@ msgstr "## 標準ライブラリ"
 #. type: Plain text
 #: src/doc/tutorial.md:2587
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "    println!(\"Hello farm!\");\n"
@@ -4496,7 +4496,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -4510,21 +4510,21 @@ msgstr "## マネージドクロージャ"
 #. type: Plain text
 #: src/doc/tutorial.md:2607
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "    println!(\"Hello chicken!\");\n"
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
 #. type: Plain text
 #: src/doc/tutorial.md:2639
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "    println!(\"Hello chicken!\");\n"
@@ -4534,7 +4534,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -4573,7 +4573,7 @@ msgstr "# モジュールとクレート"
 #. type: Plain text
 #: src/doc/tutorial.md:2719
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "    println!(\"Hello farm!\");\n"
@@ -4583,7 +4583,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -4653,34 +4653,34 @@ msgstr ""
 #: src/doc/tutorial.md:2897
 #, fuzzy
 #| msgid ""
-#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
+#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
 #| "\" + world::explore()); } ~~~~"
 msgid "fn main() { cow() } ~~~"
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
 #. type: Plain text
 #: src/doc/tutorial.md:2916
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "    println!(\"Hello farm!\");\n"
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
 #. type: Plain text
 #: src/doc/tutorial.md:2923
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "    // Can now refer to those names directly:\n"
 "    chicken();\n"
@@ -4691,7 +4691,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -4699,7 +4699,7 @@ msgstr ""
 #: src/doc/tutorial.md:2932
 #, fuzzy
 #| msgid ""
-#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
+#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
 #| "\" + world::explore()); } ~~~~"
 msgid ""
 "~~~{.ignore} // `a.rs` - crate root use b::foo; mod b; fn main() { foo(); } "
@@ -4707,7 +4707,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -4715,21 +4715,21 @@ msgstr ""
 #: src/doc/tutorial.md:2939
 #, fuzzy
 #| msgid ""
-#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
+#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
 #| "\" + world::explore()); } ~~~~"
 msgid ""
 "~~~{.ignore} // `b.rs` use b::c::bar; pub mod c; pub fn foo() { bar(); } ~~~"
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
 #. type: Plain text
 #: src/doc/tutorial.md:2985
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "    egg_layer();\n"
@@ -4738,7 +4738,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -4752,7 +4752,7 @@ msgstr "# ポインタのデリファレンス"
 #. type: Plain text
 #: src/doc/tutorial.md:3014
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "    farm::chicken();\n"
@@ -4763,7 +4763,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -4778,13 +4778,13 @@ msgstr "## 他のクレートの利用"
 #: src/doc/tutorial.md:3035
 #, fuzzy
 #| msgid "## Using other crates"
-msgid "For that, Rust offers you the `extern mod` declaration:"
+msgid "For that, Rust offers you the `extern crate` declaration:"
 msgstr "## 他のクレートの利用"
 
 #. type: Plain text
 #: src/doc/tutorial.md:3045
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "    // The rational number '1/2':\n"
@@ -4794,7 +4794,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -4802,7 +4802,7 @@ msgstr ""
 #: src/doc/tutorial.md:3068
 #, fuzzy
 #| msgid "~~~~ {.ignore} let foo = 10;"
-msgid "~~~ extern mod extra;"
+msgid "~~~ extern crate extra;"
 msgstr ""
 "~~~~ {.ignore}\n"
 "let foo = 10;"
@@ -4810,7 +4810,7 @@ msgstr ""
 #. type: Plain text
 #: src/doc/tutorial.md:3081
 #, fuzzy, no-wrap
-#| msgid "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
+#| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "fn main() {\n"
 "    farm::dog();\n"
@@ -4820,7 +4820,7 @@ msgid ""
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -4835,17 +4835,17 @@ msgstr "## 構造体"
 #: src/doc/tutorial.md:3123
 #, fuzzy
 #| msgid ""
-#| "~~~~ {.ignore} extern mod farm; extern mod my_farm (name = \"farm\", vers "
-#| "= \"2.5\"); extern mod my_auxiliary_farm (name = \"farm\", author = \"mjh"
+#| "~~~~ {.ignore} extern crate farm; extern crate my_farm (name = \"farm\", vers "
+#| "= \"2.5\"); extern crate my_auxiliary_farm (name = \"farm\", author = \"mjh"
 #| "\"); ~~~~"
 msgid ""
-"~~~~ {.ignore} extern mod farm; extern mod farm = \"farm#2.5\"; extern mod "
+"~~~~ {.ignore} extern crate farm; extern crate farm = \"farm#2.5\"; extern crate "
 "my_farm = \"farm\"; ~~~~"
 msgstr ""
 "~~~~ {.ignore}\n"
-"extern mod farm;\n"
-"extern mod my_farm (name = \"farm\", vers = \"2.5\");\n"
-"extern mod my_auxiliary_farm (name = \"farm\", author = \"mjh\");\n"
+"extern crate farm;\n"
+"extern crate my_farm (name = \"farm\", vers = \"2.5\");\n"
+"extern crate my_auxiliary_farm (name = \"farm\", author = \"mjh\");\n"
 "~~~~"
 
 #. type: Plain text
@@ -4891,7 +4891,7 @@ msgstr ""
 #| "~~~~ // world.rs #[link(name = \"world\", vers = \"1.0\")]; pub fn "
 #| "explore() -> &str { \"world\" } ~~~~"
 msgid ""
-"~~~~ // `world.rs` #[crate_id = \"world#0.42\"]; # extern mod extra; pub fn "
+"~~~~ // `world.rs` #[crate_id = \"world#0.42\"]; # extern crate extra; pub fn "
 "explore() -> &'static str { \"world\" } # fn main() {} ~~~~"
 msgstr ""
 "~~~~\n"
@@ -4904,15 +4904,15 @@ msgstr ""
 #: src/doc/tutorial.md:3159
 #, fuzzy
 #| msgid ""
-#| "~~~~ {.ignore} // main.rs extern mod world; fn main() { println(~\"hello "
+#| "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello "
 #| "\" + world::explore()); } ~~~~"
 msgid ""
-"~~~~ {.ignore} // `main.rs` extern mod world; fn main() { println!(\"hello "
+"~~~~ {.ignore} // `main.rs` extern crate world; fn main() { println!(\"hello "
 "{}\", world::explore()); } ~~~~"
 msgstr ""
 "~~~~ {.ignore}\n"
 "// main.rs\n"
-"extern mod world;\n"
+"extern crate world;\n"
 "fn main() { println(~\"hello \" + world::explore()); }\n"
 "~~~~"
 
@@ -4977,7 +4977,7 @@ msgstr "## 標準ライブラリ"
 #: src/doc/tutorial.md:3187
 #, fuzzy
 #| msgid "~~~~ {.ignore} let foo = 10;"
-msgid "~~~ {.ignore} extern mod std; ~~~"
+msgid "~~~ {.ignore} extern crate std; ~~~"
 msgstr ""
 "~~~~ {.ignore}\n"
 "let foo = 10;"
index fe0fd8bd84d5c4f916ba6806a64a26bffd535291..c605ed06ffd1f8858bf72dd6ad4c6874dbcef10d 100644 (file)
@@ -759,7 +759,7 @@ A view item manages the namespace of a module.
 View items do not define new items, but rather, simply change other items' visibility.
 There are several kinds of view item:
 
- * [`extern mod` declarations](#extern-mod-declarations)
+ * [`extern crate` declarations](#extern-mod-declarations)
  * [`use` declarations](#use-declarations)
 
 ##### Extern mod declarations
@@ -770,7 +770,7 @@ link_attrs : link_attr [ ',' link_attrs ] + ;
 link_attr : ident '=' literal ;
 ~~~~
 
-An _`extern mod` declaration_ specifies a dependency on an external crate.
+An _`extern crate` declaration_ specifies a dependency on an external crate.
 The external crate is then bound into the declaring scope
 as the `ident` provided in the `extern_mod_decl`.
 
@@ -782,16 +782,16 @@ against the `crateid` attributes that were declared on the external crate when
 it was compiled.  If no `crateid` is provided, a default `name` attribute is
 assumed, equal to the `ident` given in the `extern_mod_decl`.
 
-Four examples of `extern mod` declarations:
+Four examples of `extern crate` declarations:
 
 ~~~~ {.ignore}
-extern mod pcre;
+extern crate pcre;
 
-extern mod extra; // equivalent to: extern mod extra = "extra";
+extern crate extra; // equivalent to: extern crate extra = "extra";
 
-extern mod rustextra = "extra"; // linking to 'extra' under another name
+extern crate rustextra = "extra"; // linking to 'extra' under another name
 
-extern mod foo = "some/where/rust-foo#foo:1.0"; // a full package ID for external tools
+extern crate foo = "some/where/rust-foo#foo:1.0"; // a full package ID for external tools
 ~~~~
 
 ##### Use declarations
@@ -813,7 +813,7 @@ module item. These declarations may appear at the top of [modules](#modules) and
 
 *Note*: Unlike in many languages,
 `use` declarations in Rust do *not* declare linkage dependency with external crates.
-Rather, [`extern mod` declarations](#extern-mod-declarations) declare linkage dependencies.
+Rather, [`extern crate` declarations](#extern-mod-declarations) declare linkage dependencies.
 
 Use declarations support a number of convenient shortcuts:
 
@@ -869,7 +869,7 @@ This also means that top-level module declarations should be at the crate root i
 of the declared modules within `use` items is desired.  It is also possible to use `self` and `super`
 at the beginning of a `use` item to refer to the current and direct parent modules respectively.
 All rules regarding accessing declared modules in `use` declarations applies to both module declarations
-and `extern mod` declarations.
+and `extern crate` declarations.
 
 An example of what will and will not work for `use` items:
 
@@ -879,7 +879,7 @@ use foo::extra;          // good: foo is at the root of the crate
 use foo::baz::foobaz;    // good: foo is at the root of the crate
 
 mod foo {
-    extern mod extra;
+    extern crate extra;
 
     use foo::extra::time;  // good: foo is at crate root
 //  use extra::*;          // bad:  extra is not at the crate root
index 72282030fb322ac6218404b2330450fe5c2fb45a..3809dcd3f48ade0325e9e1f80a88591a5b577b45 100644 (file)
@@ -53,7 +53,7 @@ struct Whizbang;
 
 To generate the docs, run `rustdoc universe.rs`. By default, it generates a
 directory called `doc`, with the documentation for `universe` being in
-`doc/universe/index.html`. If you are using other crates with `extern mod`,
+`doc/universe/index.html`. If you are using other crates with `extern crate`,
 rustdoc will even link to them when you use their types, as long as their
 documentation has already been generated by a previous run of rustdoc, or the
 crate advertises that its documentation is hosted at a given URL.
@@ -100,34 +100,29 @@ rustdoc --test crate.rs
 
 ## Defining tests
 
-Rust documentation currently uses the markdown format, and code blocks can refer
-to any piece of code-related documentation, which isn't always rust. Because of
-this, only code blocks with the language of "rust" will be considered for
-testing.
+Rust documentation currently uses the markdown format, and rustdoc treats all
+code blocks as testable-by-default. In order to not run a test over a block of
+code, the `ignore` string can be added to the three-backtick form of markdown
+code block.
 
 ~~~
-```rust
+```
 // This is a testable code block
 ```
 
-```
+```ignore
 // This is not a testable code block
 ```
 
-    // This is not a testable code block (4-space indent)
+    // This is a testable code block (4-space indent)
 ~~~
 
-In addition to only testing "rust"-language code blocks, there are additional
-specifiers that can be used to dictate how a code block is tested:
+In addition to the `ignore` directive, you can specify that the test's execution
+should fail with the `should_fail` directive.
 
 ~~~
-```rust,ignore
-// This code block is ignored by rustdoc, but is passed through to the test
-// harness
-```
-
-```rust,should_fail
-// This code block is expected to generate a failure
+```should_fail
+// This code block is expected to generate a failure when run
 ```
 ~~~
 
@@ -143,7 +138,7 @@ that one can still write things like `#[deriving(Eq)]`).
 # the doc-generating tool.  In order to display them anyway in this particular
 # case, the character following the leading '#' is not a usual space like in
 # these first five lines but a non breakable one.
-# 
+#
 # // showing 'fib' in this documentation would just be tedious and detracts from
 # // what's actualy being documented.
 # fn fib(n: int) { n + 2 }
@@ -169,14 +164,11 @@ rustdoc --test lib.rs --test-args 'foo'
 
 // See what's possible when running tests
 rustdoc --test lib.rs --test-args '--help'
-
-// Run all ignored tests
-rustdoc --test lib.rs --test-args '--ignored'
 ~~~
 
 When testing a library, code examples will often show how functions are used,
 and this code often requires `use`-ing paths from the crate. To accomodate this,
-rustdoc will implicitly add `extern mod <crate>;` where `<crate>` is the name of
+rustdoc will implicitly add `extern crate <crate>;` where `<crate>` is the name of
 the crate being tested to the top of each code example. This means that rustdoc
 must be able to find a compiled version of the library crate being tested. Extra
 search paths may be added via the `-L` flag to `rustdoc`.
index d620ed0b54f37d1bd4fde49b17b3eaa86dd73e56..d5181f4cea42946e0ad1de907b47b248ee851dd4 100644 (file)
@@ -2581,7 +2581,7 @@ As you can see, your module hierarchy is now three modules deep: There is the cr
 function, and the module `farm`. The module `farm` also contains two functions and a third module `barn`,
 which contains a function `hay`.
 
-(In case you already stumbled over `extern mod`: It isn't directly related to a bare `mod`, we'll get to it later. )
+(In case you already stumbled over `extern crate`: It isn't directly related to a bare `mod`, we'll get to it later. )
 
 ## Paths and visibility
 
@@ -3018,10 +3018,10 @@ as there really is no reason to start from scratch each time you start a new pro
 
 In Rust terminology, we need a way to refer to other crates.
 
-For that, Rust offers you the `extern mod` declaration:
+For that, Rust offers you the `extern crate` declaration:
 
 ~~~
-extern mod num;
+extern crate num;
 // `num` ships with Rust (much like `extra`; more details further down).
 
 fn main() {
@@ -3030,8 +3030,8 @@ fn main() {
 }
 ~~~
 
-Despite its name, `extern mod` is a distinct construct from regular `mod` declarations:
-A statement of the form `extern mod foo;` will cause `rustc` to search for the crate `foo`,
+Despite its name, `extern crate` is a distinct construct from regular `mod` declarations:
+A statement of the form `extern crate foo;` will cause `rustc` to search for the crate `foo`,
 and if it finds a matching binary it lets you use it from inside your crate.
 
 The effect it has on your module hierarchy mirrors aspects of both `mod` and `use`:
@@ -3039,19 +3039,19 @@ The effect it has on your module hierarchy mirrors aspects of both `mod` and `us
 - Like `mod`, it causes `rustc` to actually emit code:
   The linkage information the binary needs to use the library `foo`.
 
-- But like `use`, all `extern mod` statements that refer to the same library are interchangeable,
+- But like `use`, all `extern crate` statements that refer to the same library are interchangeable,
   as each one really just presents an alias to an external module (the crate root of the library
   you're linking against).
 
 Remember how `use`-statements have to go before local declarations because the latter shadows the former?
-Well, `extern mod` statements also have their own rules in that regard:
-Both `use` and local declarations can shadow them, so the rule is that `extern mod` has to go in front
+Well, `extern crate` statements also have their own rules in that regard:
+Both `use` and local declarations can shadow them, so the rule is that `extern crate` has to go in front
 of both `use` and local declarations.
 
 Which can result in something like this:
 
 ~~~
-extern mod num;
+extern crate num;
 
 use farm::dog;
 use num::rational::Ratio;
@@ -3071,7 +3071,7 @@ they model most closely what people expect to shadow.
 
 ## Package ids
 
-If you use `extern mod`, per default `rustc` will look for libraries in the library search path (which you can
+If you use `extern crate`, per default `rustc` will look for libraries in the library search path (which you can
 extend with the `-L` switch).
 
 ## Crate metadata and settings
@@ -3098,14 +3098,14 @@ Therefore, if you plan to compile your crate as a library, you should annotate i
 # fn farm() {}
 ~~~~
 
-You can also specify package ID information in a `extern mod` statement.  For
-example, these `extern mod` statements would both accept and select the
+You can also specify package ID information in a `extern crate` statement.  For
+example, these `extern crate` statements would both accept and select the
 crate define above:
 
 ~~~~ {.ignore}
-extern mod farm;
-extern mod farm = "farm#2.5";
-extern mod my_farm = "farm";
+extern crate farm;
+extern crate farm = "farm#2.5";
+extern crate my_farm = "farm";
 ~~~~
 
 Other crate settings and metadata include things like enabling/disabling certain errors or warnings,
@@ -3133,14 +3133,14 @@ We define two crates, and use one of them as a library in the other.
 ~~~~
 // `world.rs`
 #[crate_id = "world#0.42"];
-# extern mod extra;
+# extern crate extra;
 pub fn explore() -> &'static str { "world" }
 # fn main() {}
 ~~~~
 
 ~~~~ {.ignore}
 // `main.rs`
-extern mod world;
+extern crate world;
 fn main() { println!("hello {}", world::explore()); }
 ~~~~
 
@@ -3169,7 +3169,7 @@ in the `std` library, which is a crate that ships with Rust.
 The only magical thing that happens is that `rustc` automatically inserts this line into your crate root:
 
 ~~~ {.ignore}
-extern mod std;
+extern crate std;
 ~~~
 
 As well as this line into every module body:
@@ -3221,7 +3221,7 @@ See the [API documentation][stddoc] for details.
 
 Rust ships with crates such as the [extra library], an accumulation of useful things,
 that are however not important enough to deserve a place in the standard
-library.  You can link to a library such as `extra` with an `extern mod extra;`.
+library.  You can link to a library such as `extra` with an `extern crate extra;`.
 
 [extra library]: extra/index.html
 
@@ -3240,7 +3240,6 @@ guides on individual topics.
 * [Macros][macros]
 * [The foreign function interface][ffi]
 * [Containers and iterators][container]
-* [Error-handling and Conditions][conditions]
 * [Documenting Rust code][rustdoc]
 * [Testing Rust code][testing]
 * [The Rust Runtime][runtime]
@@ -3253,7 +3252,6 @@ There is further documentation on the [wiki], however those tend to be even more
 [macros]: guide-macros.html
 [ffi]: guide-ffi.html
 [container]: guide-container.html
-[conditions]: guide-conditions.html
 [testing]: guide-testing.html
 [runtime]: guide-runtime.html
 [rustdoc]: rustdoc.html
index 858e5a35f8741d47f7884e876fd482106487b50c..06008d16f5db0c9de3ac3fd8505a8a4f7df612d6 100644 (file)
@@ -3,4 +3,4 @@
   <span class="white-sticker"><a href="http://rust-lang.org">Rust</a> VERSION</span><br>
   <a href="http://github.com/mozilla/rust/commit/STAMP"
     class="hash white-sticker">SHORT_HASH</a>
-</div>
\ No newline at end of file
+</div>
index 25095950e1849cda522e3dd3343578517ea3663a..ca462fc7a39226b9386b3775e0a5431248655949 100644 (file)
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 #[cfg(rustdoc)]
-extern mod this = "rustdoc";
+extern crate this = "rustdoc";
 
 #[cfg(rustc)]
-extern mod this = "rustc";
+extern crate this = "rustc";
 
 fn main() { this::main() }
index 2c6edaea284f4cb1bc2761c3933b824a19f03fba..c972392a4a0b3167604eb7d3d259db5280ac3026 100755 (executable)
@@ -71,8 +71,8 @@ d.write(
 """
 // AUTO-GENERATED FILE: DO NOT EDIT
 #[feature(globs, managed_boxes)];
-extern mod extra;
-extern mod run_pass_stage2;
+extern crate extra;
+extern crate run_pass_stage2;
 use run_pass_stage2::*;
 use std::io;
 use std::io::Writer;
index 95732f2553c39f595a7d06b2c2c974e425c93395..4e1c74c31df919f35d454f4c7e50784aba9c72cb 100644 (file)
 (defconst rust-mode-keywords
   '("as"
     "break"
-    "continue"
-    "crate"
+    "continue" "crate"
     "do"
     "else" "enum" "extern"
     "false" "fn" "for"
@@ -368,7 +367,7 @@ With argument, do it that many times.
 Negative argument -N means move back to Nth preceding end of defun.
 
 Assume that this is called after beginning-of-defun. So point is
-at the beginning of the defun body. 
+at the beginning of the defun body.
 
 This is written mainly to be used as `end-of-defun-function' for Rust."
   (interactive "p")
index 13eadc7988057fcb5d4f30fad9902a3ec77c1d97..2900023ea2b43fd2f599cfe8f6cf422382e821d0 100644 (file)
@@ -28,7 +28,7 @@ CODE_BLOCK_DELIM_REGEX = re.compile(r'~~~')
 COMMENT_REGEX = re.compile(r'^# ')
 COMPILER_DIRECTIVE_REGEX = re.compile(r'\#\[(.*)\];')
 ELLIPSES_REGEX = re.compile(r'\.\.\.')
-EXTERN_MOD_REGEX = re.compile(r'\bextern mod extra\b')
+EXTERN_CRATE_REGEX = re.compile(r'\bextern crate extra\b')
 MAIN_FUNCTION_REGEX = re.compile(r'\bfn main\b')
 TAGS_REGEX = re.compile(r'\.([\w-]*)')
 
@@ -49,12 +49,12 @@ OUTPUT_BLOCK_HEADER = '\n'.join((
 
 def add_extern_mod(block):
     if not has_extern_mod(block):
-        # add `extern mod extra;` after compiler directives
+        # add `extern crate extra;` after compiler directives
         directives = []
         while len(block) and is_compiler_directive(block[0]):
             directives.append(block.popleft())
 
-        block.appendleft("\nextern mod extra;\n\n")
+        block.appendleft("\nextern crate extra;\n\n")
         block.extendleft(reversed(directives))
 
     return block
@@ -112,8 +112,8 @@ def extract_code_fragments(dest_dir, lines):
 
 
 def has_extern_mod(block):
-    """Checks if a code block has the line `extern mod extra`."""
-    find_extern_mod = lambda x: re.search(EXTERN_MOD_REGEX, x)
+    """Checks if a code block has the line `extern crate extra`."""
+    find_extern_mod = lambda x: re.search(EXTERN_CRATE_REGEX, x)
     return any(imap(find_extern_mod, block))
 
 
index 7acaa761bb21531a4a49ed22209257a49f7aa20b..ecf58d55576cfcbbf415a5fb5d5de78acff6a84d 100755 (executable)
@@ -38,7 +38,7 @@ TEMPLATE = """// Copyright {year} The Rust Project Developers. See the COPYRIGHT
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 {error_deriving}
 struct Error;
index aac759e3950c7f762c2ab9165839e236f33734cd..03c67276049ec32fefa8ac3e633b5109737554c2 100644 (file)
@@ -95,13 +95,9 @@ syn keyword rustTrait Buffer Writer Reader Seek
 syn keyword rustTrait Str StrVector StrSlice OwnedStr IntoMaybeOwned
 syn keyword rustTrait IterBytes
 syn keyword rustTrait ToStr IntoStr
-syn keyword rustTrait CloneableTuple ImmutableTuple
 syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
 syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
 syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
-syn keyword rustTrait ImmutableTuple1 ImmutableTuple2 ImmutableTuple3 ImmutableTuple4
-syn keyword rustTrait ImmutableTuple5 ImmutableTuple6 ImmutableTuple7 ImmutableTuple8
-syn keyword rustTrait ImmutableTuple9 ImmutableTuple10 ImmutableTuple11 ImmutableTuple12
 syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector ImmutableCloneableVector
 syn keyword rustTrait OwnedVector OwnedCloneableVector OwnedEqVector MutableVector
 syn keyword rustTrait Vector VectorVector CloneableVector ImmutableVector
index 6639e7b3ab7d2fdd759237b75d0747ca7d668350..d827e45eddb8777d79424d2b97b17170ae109ebb 100644 (file)
@@ -22,9 +22,7 @@
 #[allow(missing_doc)];
 #[feature(managed_boxes)];
 
-extern mod collections;
-
-#[cfg(test)] extern mod extra;
+extern crate collections;
 
 use collections::list::{List, Cons, Nil};
 use collections::list;
@@ -506,8 +504,9 @@ fn drop(&mut self) {
 
 #[cfg(test)]
 mod test {
+    extern crate extra;
     use super::{Arena, TypedArena};
-    use extra::test::BenchHarness;
+    use self::extra::test::BenchHarness;
 
     struct Point {
         x: int,
index 34aee6459a809320256de791b34155c7b48210c4..13b39da0756e0db46e42ab9d52e451375d7137e1 100644 (file)
@@ -500,15 +500,15 @@ fn insert(mut self, k: K, v: V, ub: uint) -> (Node<K, V>, bool) {
                     let new_outcome = self.clone().rightmost_child.insert(k.clone(),
                                                                        v.clone(),
                                                                        ub.clone());
-                    new_branch = new_outcome.clone().n0();
-                    outcome = new_outcome.n1();
+                    new_branch = new_outcome.clone().val0();
+                    outcome = new_outcome.val1();
                 }
                 else {
                     let new_outcome = self.clone().elts[index.unwrap()].left.insert(k.clone(),
                                                                                  v.clone(),
                                                                                  ub.clone());
-                    new_branch = new_outcome.clone().n0();
-                    outcome = new_outcome.n1();
+                    new_branch = new_outcome.clone().val0();
+                    outcome = new_outcome.val1();
                 }
                 //Check to see whether a branch or a leaf was returned from the
                 //tree traversal.
index 15e2303bd8502821379c624f166ef4cefa5d917c..28e7b9460dc7aee9571b64829d2d491d81ee2fd7 100644 (file)
@@ -83,7 +83,7 @@ fn none() -> Rawlink<T> {
 
     /// Like Option::Some for Rawlink
     fn some(n: &mut T) -> Rawlink<T> {
-        Rawlink{p: ptr::to_mut_unsafe_ptr(n)}
+        Rawlink{p: n}
     }
 
     /// Convert the `Rawlink` into an Option value
index 417bf47803eaf4290309a883fb95ec82a3160a65..e97eeac4f6628b4ce84f7c04ac3b58f5db42c384 100644 (file)
@@ -19,9 +19,8 @@
 
 #[feature(macro_rules, managed_boxes)];
 
-#[cfg(test)] extern mod extra;
-
-extern mod serialize;
+extern crate serialize;
+#[cfg(test)] extern crate extra; // benchmark tests need this
 
 pub use bitv::Bitv;
 pub use btree::BTree;
@@ -43,4 +42,4 @@
 pub mod priority_queue;
 pub mod ringbuf;
 pub mod smallintmap;
-pub mod treemap;
\ No newline at end of file
+pub mod treemap;
index 3938f1a89942b6593492bb653d3543592ebd45c8..4c6cd4218e7ae9b49fd12da9749dbb0bf2e0c52b 100644 (file)
@@ -30,7 +30,7 @@
 Arrays are enclosed in square brackets ([ ... ]) and objects in curly brackets ({ ... }).
 A simple JSON document encoding a person, his/her age, address and phone numbers could look like:
 
-```
+```ignore
 {
     "FirstName": "John",
     "LastName": "Doe",
@@ -59,7 +59,7 @@
 To encode using Encodable :
 
 ```rust
-extern mod serialize;
+extern crate serialize;
 use extra::json;
 use std::io;
 use serialize::Encodable;
@@ -98,7 +98,7 @@ fn main() {
 
 
 ```rust
-extern mod collections;
+extern crate collections;
 
 use extra::json;
 use extra::json::ToJson;
@@ -128,7 +128,7 @@ fn main() {
 To decode a json string using `Decodable` trait :
 
 ```rust
-extern mod serialize;
+extern crate serialize;
 use serialize::Decodable;
 
 #[deriving(Decodable)]
@@ -154,7 +154,7 @@ fn main() {
 using the serialization API, using the derived serialization code.
 
 ```rust
-extern mod serialize;
+extern crate serialize;
 use extra::json;
 use serialize::{Encodable, Decodable};
 
@@ -186,8 +186,8 @@ fn main() {
 Example of `ToJson` trait implementation for TestStruct1.
 
 ```rust
-extern mod serialize;
-extern mod collections;
+extern crate serialize;
+extern crate collections;
 
 use extra::json;
 use extra::json::ToJson;
index c630ac096f622ad578cec3399723567274c59064..be7aa216e30243d845ecdf17adc337b4dcf16203 100644 (file)
 #[deny(non_camel_case_types)];
 #[deny(missing_doc)];
 
-extern mod sync;
-extern mod serialize;
+extern crate sync;
+extern crate serialize;
 
-extern mod collections;
+extern crate collections;
 
 // Utility modules
 
index 174f5fcfc030fda250403cbb7f2f77f6c9328e7f..799157f9a1a7842054f5bc4b94f344707d5c870e 100644 (file)
@@ -341,7 +341,7 @@ pub fn write_5_number_summary(w: &mut io::Writer,
 /// As an example, the summary with 5-number-summary `(min=15, q1=17, med=20, q3=24, max=31)` might
 /// display as:
 ///
-/// ~~~~
+/// ~~~~ignore
 ///   10 |        [--****#******----------]          | 40
 /// ~~~~
 
index df13538b4bcc3dcdb69efb4528f840e312a77acd..07327227d8504fd7b39fa9c45959a214afdc6adb 100644 (file)
@@ -15,8 +15,8 @@
 // simplest interface possible for representing and running tests
 // while providing a base that other test frameworks may build off of.
 
-extern mod getopts;
-extern mod term;
+extern crate getopts;
+extern crate term;
 
 use json::ToJson;
 use json;
index e0353cb1fb6b5e5f05ba9ac8b693956d2b68c7dc..270416305dd1c793a8f967eea51d57f74a39e6db 100644 (file)
@@ -23,7 +23,7 @@
 
 ```rust,ignore
 #[phase(syntax)]
-extern mod fourcc;
+extern crate fourcc;
 
 fn main() {
     let val = fourcc!("\xC0\xFF\xEE!");
@@ -46,7 +46,7 @@ fn main() {
 
 #[feature(macro_registrar, managed_boxes)];
 
-extern mod syntax;
+extern crate syntax;
 
 use syntax::ast;
 use syntax::ast::Name;
index 34e09ac1913db23a645e5edf45188f8df7e395fa..537c2d40c66bf0439da823b718bd8e4b8336f475 100644 (file)
@@ -30,7 +30,7 @@
 //! file name following `-o`, and accepts both `-h` and `--help` as optional flags.
 //!
 //! ~~~{.rust}
-//! extern mod getopts;
+//! extern crate getopts;
 //! use getopts::{optopt,optflag,getopts,OptGroup};
 //! use std::os;
 //!
index cb6f5b24a0943eb562601091e139fff20dcf67be..3a93b10ad29c825756441f182c0d79c54cb8b2f5 100644 (file)
@@ -67,7 +67,7 @@ pub struct Paths {
 ///
 /// The above code will print:
 ///
-/// ```
+/// ```ignore
 /// /media/pictures/kittens.jpg
 /// /media/pictures/puppies.jpg
 /// ```
index 834bf7951ef1ce7e79be0b1405b3a05a7f2d7f25..8758eb1179ef91dd5005fedab407860d58d223d0 100644 (file)
 //! # Starting with libgreen
 //!
 //! ```rust
-//! extern mod green;
+//! extern crate green;
 //!
 //! #[start]
 //! fn start(argc: int, argv: **u8) -> int { green::start(argc, argv, main) }
index 4b1c4e3b425d4da9822c603ddccccc494defa054..ad32ba7ba6d1c8ff5dda82bef37ab754a4da3d7b 100644 (file)
@@ -15,7 +15,7 @@
 use std::rt::task::BlockedTask;
 use std::rt::task::Task;
 use std::sync::deque;
-use std::unstable::mutex::Mutex;
+use std::unstable::mutex::NativeMutex;
 use std::unstable::raw;
 
 use TaskState;
@@ -669,8 +669,7 @@ pub fn change_task_context(mut ~self,
         // is acquired here. This is the resumption points and the "bounce"
         // that it is referring to.
         unsafe {
-            current_task.nasty_deschedule_lock.lock();
-            current_task.nasty_deschedule_lock.unlock();
+            let _guard = current_task.nasty_deschedule_lock.lock();
         }
         return current_task;
     }
@@ -765,10 +764,11 @@ pub fn switch_running_tasks_and_then(~self,
         // to it, but we're guaranteed that the task won't exit until we've
         // unlocked the lock so there's no worry of this memory going away.
         let cur = self.change_task_context(cur, next, |sched, mut task| {
-            let lock: *mut Mutex = &mut task.nasty_deschedule_lock;
-            unsafe { (*lock).lock() }
-            f(sched, BlockedTask::block(task.swap()));
-            unsafe { (*lock).unlock() }
+            let lock: *mut NativeMutex = &mut task.nasty_deschedule_lock;
+            unsafe {
+                let _guard = (*lock).lock();
+                f(sched, BlockedTask::block(task.swap()));
+            }
         });
         cur.put();
     }
@@ -1453,8 +1453,8 @@ fn single_threaded_yield() {
 
     #[test]
     fn test_spawn_sched_blocking() {
-        use std::unstable::mutex::{Mutex, MUTEX_INIT};
-        static mut LOCK: Mutex = MUTEX_INIT;
+        use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
+        static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
 
         // Testing that a task in one scheduler can block in foreign code
         // without affecting other schedulers
@@ -1466,12 +1466,11 @@ fn test_spawn_sched_blocking() {
             let mut handle = pool.spawn_sched();
             handle.send(PinnedTask(pool.task(TaskOpts::new(), proc() {
                 unsafe {
-                    LOCK.lock();
+                    let mut guard = LOCK.lock();
 
                     start_ch.send(());
-                    LOCK.wait();   // block the scheduler thread
-                    LOCK.signal(); // let them know we have the lock
-                    LOCK.unlock();
+                    guard.wait();   // block the scheduler thread
+                    guard.signal(); // let them know we have the lock
                 }
 
                 fin_ch.send(());
@@ -1503,10 +1502,9 @@ fn pingpong(po: &Port<int>, ch: &Chan<int>) {
                 child_ch.send(20);
                 pingpong(&parent_po, &child_ch);
                 unsafe {
-                    LOCK.lock();
-                    LOCK.signal();   // wakeup waiting scheduler
-                    LOCK.wait();     // wait for them to grab the lock
-                    LOCK.unlock();
+                    let mut guard = LOCK.lock();
+                    guard.signal();   // wakeup waiting scheduler
+                    guard.wait();     // wait for them to grab the lock
                 }
             })));
             drop(handle);
index 8db95f55d18db7a13f6f73256ea57d70e7dd7a5a..297c22e2cd6ced672f32ad3b602f95e2dca48387 100644 (file)
 use std::rt::rtio;
 use std::rt::task::{Task, BlockedTask};
 use std::task::TaskOpts;
-use std::unstable::sync::LittleLock;
+use std::unstable::mutex::NativeMutex;
 
 struct SimpleTask {
-    lock: LittleLock,
+    lock: NativeMutex,
     awoken: bool,
 }
 
@@ -59,9 +59,9 @@ fn reawaken(mut ~self, mut to_wake: ~Task) {
         to_wake.put_runtime(self as ~Runtime);
         unsafe {
             cast::forget(to_wake);
-            let _l = (*me).lock.lock();
+            let mut guard = (*me).lock.lock();
             (*me).awoken = true;
-            (*me).lock.signal();
+            guard.signal();
         }
     }
 
@@ -83,7 +83,7 @@ fn wrap(~self) -> ~Any { fail!() }
 pub fn task() -> ~Task {
     let mut task = ~Task::new();
     task.put_runtime(~SimpleTask {
-        lock: LittleLock::new(),
+        lock: unsafe {NativeMutex::new()},
         awoken: false,
     } as ~Runtime);
     return task;
index 2aca72e35f19dd22ec45e2a651a7d09bf137b20f..74d93b4b2db9aadafb90f903f814eff381cc8263 100644 (file)
@@ -25,7 +25,7 @@
 use std::rt::rtio;
 use std::rt::task::{Task, BlockedTask, SendMessage};
 use std::task::TaskOpts;
-use std::unstable::mutex::Mutex;
+use std::unstable::mutex::NativeMutex;
 use std::unstable::raw;
 
 use context::Context;
@@ -65,7 +65,7 @@ pub struct GreenTask {
     pool_id: uint,
 
     // See the comments in the scheduler about why this is necessary
-    nasty_deschedule_lock: Mutex,
+    nasty_deschedule_lock: NativeMutex,
 }
 
 pub enum TaskType {
@@ -163,7 +163,7 @@ pub fn new_typed(coroutine: Option<Coroutine>,
             task_type: task_type,
             sched: None,
             handle: None,
-            nasty_deschedule_lock: unsafe { Mutex::new() },
+            nasty_deschedule_lock: unsafe { NativeMutex::new() },
             task: Some(~Task::new()),
         }
     }
@@ -322,11 +322,10 @@ fn terminate(mut ~self) -> ! {
     // uncontended except for when the task is rescheduled).
     fn reawaken_remotely(mut ~self) {
         unsafe {
-            let mtx = &mut self.nasty_deschedule_lock as *mut Mutex;
+            let mtx = &mut self.nasty_deschedule_lock as *mut NativeMutex;
             let handle = self.handle.get_mut_ref() as *mut SchedHandle;
-            (*mtx).lock();
+            let _guard = (*mtx).lock();
             (*handle).send(RunOnce(self));
-            (*mtx).unlock();
         }
     }
 }
@@ -479,12 +478,6 @@ fn can_block(&self) -> bool { false }
     fn wrap(~self) -> ~Any { self as ~Any }
 }
 
-impl Drop for GreenTask {
-    fn drop(&mut self) {
-        unsafe { self.nasty_deschedule_lock.destroy(); }
-    }
-}
-
 #[cfg(test)]
 mod tests {
     use std::rt::Runtime;
index 868586b36911e431ac6b83d227a5cbc9da7f857f..b1addc5cda53136f516e35719cb49fd53fe9e170 100644 (file)
 //! The green counterpart for this is bookkeeping on sched pools.
 
 use std::sync::atomics;
-use std::unstable::mutex::{Mutex, MUTEX_INIT};
+use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
 
 static mut TASK_COUNT: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT;
-static mut TASK_LOCK: Mutex = MUTEX_INIT;
+static mut TASK_LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
 
 pub fn increment() {
     let _ = unsafe { TASK_COUNT.fetch_add(1, atomics::SeqCst) };
@@ -29,9 +29,8 @@ pub fn increment() {
 pub fn decrement() {
     unsafe {
         if TASK_COUNT.fetch_sub(1, atomics::SeqCst) == 1 {
-            TASK_LOCK.lock();
-            TASK_LOCK.signal();
-            TASK_LOCK.unlock();
+            let mut guard = TASK_LOCK.lock();
+            guard.signal();
         }
     }
 }
@@ -40,11 +39,12 @@ pub fn decrement() {
 /// the entry points of native programs
 pub fn wait_for_other_tasks() {
     unsafe {
-        TASK_LOCK.lock();
-        while TASK_COUNT.load(atomics::SeqCst) > 0 {
-            TASK_LOCK.wait();
+        {
+            let mut guard = TASK_LOCK.lock();
+            while TASK_COUNT.load(atomics::SeqCst) > 0 {
+                guard.wait();
+            }
         }
-        TASK_LOCK.unlock();
         TASK_LOCK.destroy();
     }
 }
index ec6a5c5cb9bc9939754c889958eea23bc66247f4..b33b54862dc2bcb0679da957246f536882850010 100644 (file)
@@ -218,11 +218,11 @@ fn WSAStartup(wVersionRequested: libc::WORD,
     }
 
     unsafe {
-        use std::unstable::mutex::{Mutex, MUTEX_INIT};
+        use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
         static mut INITIALIZED: bool = false;
-        static mut LOCK: Mutex = MUTEX_INIT;
+        static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
 
-        LOCK.lock();
+        let _guard = LOCK.lock();
         if !INITIALIZED {
             let mut data: WSADATA = mem::init();
             let ret = WSAStartup(0x202,      // version 2.2
@@ -230,7 +230,6 @@ fn WSAStartup(wVersionRequested: libc::WORD,
             assert_eq!(ret, 0);
             INITIALIZED = true;
         }
-        LOCK.unlock();
     }
 }
 
index 2a061c5f9b204fe565c8a7088dfd861adeca2973..affa3ebf54456537bb1d56f9262ed3942d3ea671 100644 (file)
@@ -98,8 +98,8 @@ fn get_io(io: &[p::StdioContainer],
 
         let env = config.env.map(|a| a.to_owned());
         let cwd = config.cwd.map(|a| Path::new(a));
-        let res = spawn_process_os(config.program, config.args, env,
-                                   cwd.as_ref(), in_fd, out_fd, err_fd);
+        let res = spawn_process_os(config, env, cwd.as_ref(), in_fd, out_fd,
+                                   err_fd);
 
         unsafe {
             for pipe in in_pipe.iter() { let _ = libc::close(pipe.input); }
@@ -180,7 +180,7 @@ struct SpawnProcessResult {
 }
 
 #[cfg(windows)]
-fn spawn_process_os(prog: &str, args: &[~str],
+fn spawn_process_os(config: p::ProcessConfig,
                     env: Option<~[(~str, ~str)]>,
                     dir: Option<&Path>,
                     in_fd: c_int, out_fd: c_int,
@@ -202,6 +202,14 @@ fn spawn_process_os(prog: &str, args: &[~str],
 
     use std::mem;
 
+    if config.gid.is_some() || config.uid.is_some() {
+        return Err(io::IoError {
+            kind: io::OtherIoError,
+            desc: "unsupported gid/uid requested on windows",
+            detail: None,
+        })
+    }
+
     unsafe {
 
         let mut si = zeroed_startupinfo();
@@ -237,16 +245,23 @@ fn spawn_process_os(prog: &str, args: &[~str],
             fail!("failure in DuplicateHandle: {}", os::last_os_error());
         }
 
-        let cmd = make_command_line(prog, args);
+        let cmd = make_command_line(config.program, config.args);
         let mut pi = zeroed_process_information();
         let mut create_err = None;
 
+        // stolen from the libuv code.
+        let mut flags = 0;
+        if config.detach {
+            flags |= libc::DETACHED_PROCESS | libc::CREATE_NEW_PROCESS_GROUP;
+        }
+
         with_envp(env, |envp| {
             with_dirp(dir, |dirp| {
                 cmd.with_c_str(|cmdp| {
                     let created = CreateProcessA(ptr::null(), cast::transmute(cmdp),
                                                  ptr::mut_null(), ptr::mut_null(), TRUE,
-                                                 0, envp, dirp, &mut si, &mut pi);
+                                                 flags, envp, dirp, &mut si,
+                                                 &mut pi);
                     if created == FALSE {
                         create_err = Some(super::last_error());
                     }
@@ -364,7 +379,7 @@ fn backslash_run_ends_in_quote(s: &str, mut i: uint) -> bool {
 }
 
 #[cfg(unix)]
-fn spawn_process_os(prog: &str, args: &[~str],
+fn spawn_process_os(config: p::ProcessConfig,
                     env: Option<~[(~str, ~str)]>,
                     dir: Option<&Path>,
                     in_fd: c_int, out_fd: c_int,
@@ -372,7 +387,6 @@ fn spawn_process_os(prog: &str, args: &[~str],
     use std::libc::funcs::posix88::unistd::{fork, dup2, close, chdir, execvp};
     use std::libc::funcs::bsd44::getdtablesize;
     use std::libc::c_ulong;
-    use std::unstable::intrinsics;
 
     mod rustrt {
         extern {
@@ -441,22 +455,34 @@ unsafe fn set_cloexec(fd: c_int) {
         }
         drop(input);
 
+        fn fail(output: &mut file::FileDesc) -> ! {
+            let errno = os::errno();
+            let bytes = [
+                (errno << 24) as u8,
+                (errno << 16) as u8,
+                (errno <<  8) as u8,
+                (errno <<  0) as u8,
+            ];
+            assert!(output.inner_write(bytes).is_ok());
+            unsafe { libc::_exit(1) }
+        }
+
         rustrt::rust_unset_sigprocmask();
 
         if in_fd == -1 {
             let _ = libc::close(libc::STDIN_FILENO);
         } else if retry(|| dup2(in_fd, 0)) == -1 {
-            fail!("failure in dup2(in_fd, 0): {}", os::last_os_error());
+            fail(&mut output);
         }
         if out_fd == -1 {
             let _ = libc::close(libc::STDOUT_FILENO);
         } else if retry(|| dup2(out_fd, 1)) == -1 {
-            fail!("failure in dup2(out_fd, 1): {}", os::last_os_error());
+            fail(&mut output);
         }
         if err_fd == -1 {
             let _ = libc::close(libc::STDERR_FILENO);
         } else if retry(|| dup2(err_fd, 2)) == -1 {
-            fail!("failure in dup3(err_fd, 2): {}", os::last_os_error());
+            fail(&mut output);
         }
         // close all other fds
         for fd in range(3, getdtablesize()).rev() {
@@ -465,9 +491,44 @@ unsafe fn set_cloexec(fd: c_int) {
             }
         }
 
+        match config.gid {
+            Some(u) => {
+                if libc::setgid(u as libc::gid_t) != 0 {
+                    fail(&mut output);
+                }
+            }
+            None => {}
+        }
+        match config.uid {
+            Some(u) => {
+                // When dropping privileges from root, the `setgroups` call will
+                // remove any extraneous groups. If we don't call this, then
+                // even though our uid has dropped, we may still have groups
+                // that enable us to do super-user things. This will fail if we
+                // aren't root, so don't bother checking the return value, this
+                // is just done as an optimistic privilege dropping function.
+                extern {
+                    fn setgroups(ngroups: libc::c_int,
+                                 ptr: *libc::c_void) -> libc::c_int;
+                }
+                let _ = setgroups(0, 0 as *libc::c_void);
+
+                if libc::setuid(u as libc::uid_t) != 0 {
+                    fail(&mut output);
+                }
+            }
+            None => {}
+        }
+        if config.detach {
+            // Don't check the error of setsid because it fails if we're the
+            // process leader already. We just forked so it shouldn't return
+            // error, but ignore it anyway.
+            let _ = libc::setsid();
+        }
+
         with_dirp(dir, |dirp| {
             if !dirp.is_null() && chdir(dirp) == -1 {
-                fail!("failure in chdir: {}", os::last_os_error());
+                fail(&mut output);
             }
         });
 
@@ -476,17 +537,9 @@ unsafe fn set_cloexec(fd: c_int) {
                 set_environ(envp);
             }
         });
-        with_argv(prog, args, |argv| {
+        with_argv(config.program, config.args, |argv| {
             let _ = execvp(*argv, argv);
-            let errno = os::errno();
-            let bytes = [
-                (errno << 24) as u8,
-                (errno << 16) as u8,
-                (errno <<  8) as u8,
-                (errno <<  0) as u8,
-            ];
-            assert!(output.inner_write(bytes).is_ok());
-            intrinsics::abort();
+            fail(&mut output);
         })
     }
 }
@@ -529,7 +582,7 @@ fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: |*c_void| -> T) -> T {
             let mut tmps = vec::with_capacity(env.len());
 
             for pair in env.iter() {
-                let kv = format!("{}={}", pair.first(), pair.second());
+                let kv = format!("{}={}", *pair.ref0(), *pair.ref1());
                 tmps.push(kv.to_c_str());
             }
 
@@ -553,7 +606,7 @@ fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: |*mut c_void| -> T) -> T {
             let mut blk = ~[];
 
             for pair in env.iter() {
-                let kv = format!("{}={}", pair.first(), pair.second());
+                let kv = format!("{}={}", *pair.ref0(), *pair.ref1());
                 blk.push_all(kv.as_bytes());
                 blk.push(0);
             }
index 2c976e67d25b3c1b0509d3d219a4956addf35090..004cd6f311452dfde95e61b9225997295b979e6f 100644 (file)
@@ -22,7 +22,7 @@
 
 use std::cast;
 use std::rt;
-use std::unstable::mutex::{Mutex, MUTEX_INIT};
+use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
 
 use bookkeeping;
 use io::timer::{Req, Shutdown};
 static mut HELPER_SIGNAL: imp::signal = 0 as imp::signal;
 
 pub fn boot(helper: fn(imp::signal, Port<Req>)) {
-    static mut LOCK: Mutex = MUTEX_INIT;
+    static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
     static mut INITIALIZED: bool = false;
 
     unsafe {
-        LOCK.lock();
+        let mut _guard = LOCK.lock();
         if !INITIALIZED {
             let (msgp, msgc) = Chan::new();
             // promote this to a shared channel
@@ -58,7 +58,6 @@ pub fn boot(helper: fn(imp::signal, Port<Req>)) {
             rt::at_exit(proc() { shutdown() });
             INITIALIZED = true;
         }
-        LOCK.unlock();
     }
 }
 
index 4840c561289f95f87f5b8ff9f3430d0a8f776adf..c28a1175494f938957e454ffbaba7c3e8a498fec 100644 (file)
@@ -17,7 +17,7 @@
 //! # Starting with libnative
 //!
 //! ```rust
-//! extern mod native;
+//! extern crate native;
 //!
 //! #[start]
 //! fn start(argc: int, argv: **u8) -> int { native::start(argc, argv, main) }
@@ -30,7 +30,7 @@
 //! # Force spawning a native task
 //!
 //! ```rust
-//! extern mod native;
+//! extern crate native;
 //!
 //! fn main() {
 //!     // We're not sure whether this main function is run in 1:1 or M:N mode.
index a9c3afbbb16c8d0f6bf5f7cc5aa603be6c3dd2d5..d8f410834f252c3b99d7b15086e2b91fc6692a5c 100644 (file)
@@ -22,7 +22,7 @@
 use std::rt::thread::Thread;
 use std::rt;
 use std::task::TaskOpts;
-use std::unstable::mutex::Mutex;
+use std::unstable::mutex::NativeMutex;
 use std::unstable::stack;
 
 use io;
@@ -40,7 +40,7 @@ pub fn new(stack_bounds: (uint, uint)) -> ~Task {
 
 fn ops() -> ~Ops {
     ~Ops {
-        lock: unsafe { Mutex::new() },
+        lock: unsafe { NativeMutex::new() },
         awoken: false,
         io: io::IoFactory::new(),
         // these *should* get overwritten
@@ -109,7 +109,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc()) {
 // This structure is the glue between channels and the 1:1 scheduling mode. This
 // structure is allocated once per task.
 struct Ops {
-    lock: Mutex,       // native synchronization
+    lock: NativeMutex,       // native synchronization
     awoken: bool,      // used to prevent spurious wakeups
     io: io::IoFactory, // local I/O factory
 
@@ -191,20 +191,19 @@ fn deschedule(mut ~self, times: uint, mut cur_task: ~Task,
             let task = BlockedTask::block(cur_task);
 
             if times == 1 {
-                (*me).lock.lock();
+                let mut guard = (*me).lock.lock();
                 (*me).awoken = false;
                 match f(task) {
                     Ok(()) => {
                         while !(*me).awoken {
-                            (*me).lock.wait();
+                            guard.wait();
                         }
                     }
                     Err(task) => { cast::forget(task.wake()); }
                 }
-                (*me).lock.unlock();
             } else {
                 let mut iter = task.make_selectable(times);
-                (*me).lock.lock();
+                let mut guard = (*me).lock.lock();
                 (*me).awoken = false;
                 let success = iter.all(|task| {
                     match f(task) {
@@ -216,9 +215,8 @@ fn deschedule(mut ~self, times: uint, mut cur_task: ~Task,
                     }
                 });
                 while success && !(*me).awoken {
-                    (*me).lock.wait();
+                    guard.wait();
                 }
-                (*me).lock.unlock();
             }
             // re-acquire ownership of the task
             cur_task = cast::transmute::<uint, ~Task>(cur_task_dupe);
@@ -235,10 +233,9 @@ fn reawaken(mut ~self, mut to_wake: ~Task) {
             let me = &mut *self as *mut Ops;
             to_wake.put_runtime(self as ~rt::Runtime);
             cast::forget(to_wake);
-            (*me).lock.lock();
+            let mut guard = (*me).lock.lock();
             (*me).awoken = true;
-            (*me).lock.signal();
-            (*me).lock.unlock();
+            guard.signal();
         }
     }
 
@@ -254,12 +251,6 @@ fn local_io<'a>(&'a mut self) -> Option<rtio::LocalIo<'a>> {
     }
 }
 
-impl Drop for Ops {
-    fn drop(&mut self) {
-        unsafe { self.lock.destroy() }
-    }
-}
-
 #[cfg(test)]
 mod tests {
     use std::rt::Runtime;
index 5a5e717363a61a18427cdc6df9a141b0438361cb..8d5338451bd93bbcd708dc7f6ac5cb8bba45b975 100644 (file)
@@ -15,7 +15,7 @@
 #[crate_type = "dylib"];
 #[license = "MIT/ASL2"];
 
-extern mod extra;
+extern crate extra;
 
 pub mod bigint;
 pub mod rational;
index 819f96a391bbfac4f05b94677d706906d6a7f38d..be9fcf4a1e9ae87ef608e4f192d106dc3372f9c5 100644 (file)
@@ -275,7 +275,7 @@ fn add_test_module(cx: &TestCtxt, m: &ast::Mod) -> ast::Mod {
 
 mod __test {
   #[!resolve_unexported]
-  extern mod extra (name = "extra", vers = "...");
+  extern crate extra (name = "extra", vers = "...");
   fn main() {
     #[main];
     extra::test::test_main_static(::os::args(), tests)
index 05087581fd73ae3cdd24164ab2673a095a844b0d..0d615fe19928bd7a0ea897f5bc5ff26a174ccc43 100644 (file)
 #[allow(unknown_features)]; // Note: remove it after a snapshot.
 #[feature(quote)];
 
-extern mod extra;
-extern mod flate;
-extern mod arena;
-extern mod syntax;
-extern mod serialize;
-extern mod sync;
-extern mod getopts;
-extern mod collections;
+extern crate extra;
+extern crate flate;
+extern crate arena;
+extern crate syntax;
+extern crate serialize;
+extern crate sync;
+extern crate getopts;
+extern crate collections;
 
 use back::link;
 use driver::session;
index a80ac38e8ae05b03ef75d3ad44870a719f7a3c82..901e8982c83d2502a499276cf081f5a013466314 100644 (file)
@@ -169,7 +169,7 @@ fn extract_crate_info(i: &ast::ViewItem) -> Option<CrateInfo> {
     match i.node {
         ast::ViewItemExternMod(ident, ref path_opt, id) => {
             let ident = token::get_ident(ident);
-            debug!("resolving extern mod stmt. ident: {:?} path_opt: {:?}",
+            debug!("resolving extern crate stmt. ident: {:?} path_opt: {:?}",
                    ident, path_opt);
             let (name, version) = match *path_opt {
                 Some((ref path_str, _)) => {
index 33625000e4ad0876a52e6348bfb3bcc08a34f399..4febde6d443e0325c23e3fa29e0cf937dd7d0429 100644 (file)
@@ -69,7 +69,7 @@ pub struct CStore {
     intr: @IdentInterner
 }
 
-// Map from NodeId's of local extern mod statements to crate numbers
+// Map from NodeId's of local extern crate statements to crate numbers
 type extern_mod_crate_map = HashMap<ast::NodeId, ast::CrateNum>;
 
 impl CStore {
index cb9e772dcea08dcaeac4119ac18e649f43d3cc91..1d28c781ea0c80019d0326a85eb36e181a9ff55a 100644 (file)
@@ -418,7 +418,7 @@ struct Module {
     imports: RefCell<~[@ImportDirective]>,
 
     // The external module children of this node that were declared with
-    // `extern mod`.
+    // `extern crate`.
     external_module_children: RefCell<HashMap<Name, @Module>>,
 
     // The anonymous children of this node. Anonymous children are pseudo-
@@ -2679,7 +2679,7 @@ fn resolve_module_path_from_root(&mut self,
                         };
                         self.resolve_error(span,
                                               format!("unresolved import. maybe \
-                                                    a missing `extern mod \
+                                                    a missing `extern crate \
                                                     {}`?",
                                                     segment_name));
                         return Failed;
index 69e7dd9f7fb27bce8b4fcd34a96c386dfa359bf2..dc8e786fba24e2a06befd7e2ce97b2ba8d3734e2 100644 (file)
@@ -273,7 +273,15 @@ pub fn decl_rust_fn(ccx: &CrateContext, has_env: bool,
                     llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
                 }
             }
-            _ => {}
+            _ => {
+                // For non-immediate arguments the callee gets its own copy of
+                // the value on the stack, so there are no aliases
+                if !type_is_immediate(ccx, arg_ty) {
+                    unsafe {
+                        llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
+                    }
+                }
+            }
         }
     }
 
index 68be851449a9a8bd47f8089decb04714114cea38..fc5e48a161f1329653829a7dac036cea136f8089 100644 (file)
@@ -599,7 +599,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: &ast::Expr,
                 const_eval::const_uint(i) => i as uint,
                 _ => cx.sess.span_bug(count.span, "count must be integral const expression.")
             };
-            let vs = vec::from_elem(n, const_expr(cx, elem, is_local).first());
+            let vs = vec::from_elem(n, const_expr(cx, elem, is_local).val0());
             let v = if vs.iter().any(|vi| val_ty(*vi) != llunitty) {
                 C_struct(vs, false)
             } else {
index 22ed9b5010f83070b8bb57f7e52de82732f46ae8..0dcbfe491c312e3eb121bc4c0f23bfb660a875ec 100644 (file)
@@ -33,7 +33,6 @@
 use std::cmp;
 use std::hashmap::{HashMap, HashSet};
 use std::ops;
-use std::ptr::to_unsafe_ptr;
 use std::rc::Rc;
 use std::to_bytes;
 use std::to_str::ToStr;
@@ -1137,7 +1136,7 @@ pub fn mk_t(cx: ctxt, st: sty) -> t {
         _ => {}
     };
 
-    let key = intern_key { sty: to_unsafe_ptr(&st) };
+    let key = intern_key { sty: &st };
 
     {
         let mut interner = cx.interner.borrow_mut();
@@ -1234,7 +1233,7 @@ fn sflags(substs: &substs) -> uint {
         flags: flags,
     };
 
-    let sty_ptr = to_unsafe_ptr(&t.sty);
+    let sty_ptr = &t.sty as *sty;
 
     let key = intern_key {
         sty: sty_ptr,
@@ -4605,7 +4604,7 @@ pub fn determine_inherited_purity(parent: (ast::Purity, ast::NodeId),
     // purity inferred for it, then check it under its parent's purity.
     // Otherwise, use its own
     match child_sigil {
-        ast::BorrowedSigil if child.first() == ast::ImpureFn => parent,
+        ast::BorrowedSigil if child.val0() == ast::ImpureFn => parent,
         _ => child
     }
 }
index 7c9448bb73241a6c34166c128bf0db81fce2d842..3668d4d3a2cbaef6a3ce91edbd3398e59abcb050 100644 (file)
@@ -172,21 +172,23 @@ pub fn render(w: &mut io::Writer, s: &str) -> fmt::Result {
 pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
     extern fn block(_ob: *buf, text: *buf, lang: *buf, opaque: *libc::c_void) {
         unsafe {
-            if text.is_null() || lang.is_null() { return }
-            let (test, shouldfail, ignore) =
+            if text.is_null() { return }
+            let (shouldfail, ignore) = if lang.is_null() {
+                (false, false)
+            } else {
                 vec::raw::buf_as_slice((*lang).data,
                                        (*lang).size as uint, |lang| {
                     let s = str::from_utf8(lang).unwrap();
-                    (s.contains("rust"), s.contains("should_fail"),
-                     s.contains("ignore"))
-                });
-            if !test { return }
+                    (s.contains("should_fail"), s.contains("ignore"))
+                })
+            };
+            if ignore { return }
             vec::raw::buf_as_slice((*text).data, (*text).size as uint, |text| {
                 let tests: &mut ::test::Collector = intrinsics::transmute(opaque);
                 let text = str::from_utf8(text).unwrap();
                 let mut lines = text.lines().map(|l| stripped_filtered_line(l).unwrap_or(l));
                 let text = lines.to_owned_vec().connect("\n");
-                tests.add_test(text, ignore, shouldfail);
+                tests.add_test(text, shouldfail);
             })
         }
     }
index 10b22877936144319bdb4af5a5a114b6c71a11ab..11f801550856b019ee98b2d7b09b1ae4432726ff 100644 (file)
@@ -1021,7 +1021,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
             clean::ViewItemItem(ref item) => {
                 match item.inner {
                     clean::ExternMod(ref name, ref src, _) => {
-                        if_ok!(write!(w, "<tr><td><code>extern mod {}",
+                        if_ok!(write!(w, "<tr><td><code>extern crate {}",
                                       name.as_slice()));
                         match *src {
                             Some(ref src) => if_ok!(write!(w, " = \"{}\"",
@@ -1379,11 +1379,11 @@ fn render_methods(w: &mut Writer, it: &clean::Item) -> fmt::Result {
         match c.impls.find(&it.id) {
             Some(v) => {
                 let mut non_trait = v.iter().filter(|p| {
-                    p.n0_ref().trait_.is_none()
+                    p.ref0().trait_.is_none()
                 });
                 let non_trait = non_trait.to_owned_vec();
                 let mut traits = v.iter().filter(|p| {
-                    p.n0_ref().trait_.is_some()
+                    p.ref0().trait_.is_some()
                 });
                 let traits = traits.to_owned_vec();
 
index 73e59c132ebabc71029c6111abe1c0b5b737789d..2c4d553a39f6477fa26243dcd75436a9a02075f5 100644 (file)
 
 #[feature(globs, struct_variant, managed_boxes)];
 
-extern mod syntax;
-extern mod rustc;
-extern mod extra;
-extern mod serialize;
-extern mod sync;
-extern mod getopts;
-extern mod collections;
+extern crate syntax;
+extern crate rustc;
+extern crate extra;
+extern crate serialize;
+extern crate sync;
+extern crate getopts;
+extern crate collections;
 
 use std::local_data;
 use std::io;
@@ -263,7 +263,7 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
     let mut pm = plugins::PluginManager::new(Path::new(path));
     for pass in passes.iter() {
         let plugin = match PASSES.iter().position(|&(p, _, _)| p == *pass) {
-            Some(i) => PASSES[i].n1(),
+            Some(i) => PASSES[i].val1(),
             None => {
                 error!("unknown pass {}, skipping", *pass);
                 continue
index 9f8261b4449b64279446742a80d4d0b0d39d83d5..8b127b6079d9075f18110f41238e780dc3a3fc6d 100644 (file)
@@ -94,7 +94,7 @@ pub fn run(input: &str, matches: &getopts::Matches) -> int {
     0
 }
 
-fn runtest(test: &str, cratename: &str, libs: HashSet<Path>) {
+fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, should_fail: bool) {
     let test = maketest(test, cratename);
     let parsesess = parse::new_parse_sess();
     let input = driver::StrInput(test);
@@ -130,9 +130,10 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>) {
     match out {
         Err(e) => fail!("couldn't run the test: {}", e),
         Ok(out) => {
-            if !out.status.success() {
-                fail!("test executable failed:\n{}",
-                      str::from_utf8(out.error));
+            if should_fail && out.status.success() {
+                fail!("test executable succeeded when it should have failed");
+            } else if !should_fail && !out.status.success() {
+                fail!("test executable failed:\n{}", str::from_utf8(out.error));
             }
         }
     }
@@ -144,10 +145,10 @@ fn maketest(s: &str, cratename: &str) -> ~str {
 #[allow(unused_variable, dead_assignment, unused_mut, attribute_usage, dead_code)];
 ";
     if s.contains("extra") {
-        prog.push_str("extern mod extra;\n");
+        prog.push_str("extern crate extra;\n");
     }
     if s.contains(cratename) {
-        prog.push_str(format!("extern mod {};\n", cratename));
+        prog.push_str(format!("extern crate {};\n", cratename));
     }
     if s.contains("fn main") {
         prog.push_str(s);
@@ -169,7 +170,7 @@ pub struct Collector {
 }
 
 impl Collector {
-    pub fn add_test(&mut self, test: &str, ignore: bool, should_fail: bool) {
+    pub fn add_test(&mut self, test: &str, should_fail: bool) {
         let test = test.to_owned();
         let name = format!("{}_{}", self.names.connect("::"), self.cnt);
         self.cnt += 1;
@@ -180,11 +181,11 @@ pub fn add_test(&mut self, test: &str, ignore: bool, should_fail: bool) {
         self.tests.push(test::TestDescAndFn {
             desc: test::TestDesc {
                 name: test::DynTestName(name),
-                ignore: ignore,
-                should_fail: should_fail,
+                ignore: false,
+                should_fail: false, // compiler failures are test failures
             },
             testfn: test::DynTestFn(proc() {
-                runtest(test, cratename, libs);
+                runtest(test, cratename, libs, should_fail);
             }),
         });
     }
index 8c263c5e5f738231aa9f8075deb549019fc2c0a0..e44f65296f5cc7e96cc6d2a4bafeeff174fdc531 100644 (file)
@@ -42,7 +42,7 @@
 #[feature(macro_rules)];
 #[deny(unused_result, unused_must_use)];
 
-#[cfg(test)] extern mod green;
+#[cfg(test)] extern crate green;
 
 use std::cast;
 use std::io;
index e1f94d8c4df5a2bd99576d93d9b58f4be7d8aecc..a0623059bd71692e1253b713b9159a6c8eeb5c4b 100644 (file)
@@ -58,6 +58,16 @@ pub fn spawn(io_loop: &mut UvIoFactory, config: process::ProcessConfig)
 
         let ret = with_argv(config.program, config.args, |argv| {
             with_env(config.env, |envp| {
+                let mut flags = 0;
+                if config.uid.is_some() {
+                    flags |= uvll::PROCESS_SETUID;
+                }
+                if config.gid.is_some() {
+                    flags |= uvll::PROCESS_SETGID;
+                }
+                if config.detach {
+                    flags |= uvll::PROCESS_DETACHED;
+                }
                 let options = uvll::uv_process_options_t {
                     exit_cb: on_exit,
                     file: unsafe { *argv },
@@ -67,11 +77,11 @@ pub fn spawn(io_loop: &mut UvIoFactory, config: process::ProcessConfig)
                         Some(ref cwd) => cwd.with_ref(|p| p),
                         None => ptr::null(),
                     },
-                    flags: 0,
+                    flags: flags as libc::c_uint,
                     stdio_count: stdio.len() as libc::c_int,
                     stdio: stdio.as_ptr(),
-                    uid: 0,
-                    gid: 0,
+                    uid: config.uid.unwrap_or(0) as uvll::uv_uid_t,
+                    gid: config.gid.unwrap_or(0) as uvll::uv_gid_t,
                 };
 
                 let handle = UvHandle::alloc(None::<Process>, uvll::UV_PROCESS);
index 5b697e0d73d0802fbe14b3233a65c41e18701911..da502ca72de57652d651acfaa5b46e549383e8a8 100644 (file)
@@ -23,7 +23,7 @@
 use std::cast;
 use std::libc::{c_void, c_int};
 use std::rt::task::BlockedTask;
-use std::unstable::sync::LittleLock;
+use std::unstable::mutex::NativeMutex;
 use std::sync::arc::UnsafeArc;
 use mpsc = std::sync::mpsc_queue;
 
@@ -39,7 +39,7 @@ enum Message {
 
 struct State {
     handle: *uvll::uv_async_t,
-    lock: LittleLock, // see comments in async_cb for why this is needed
+    lock: NativeMutex, // see comments in async_cb for why this is needed
     queue: mpsc::Queue<Message>,
 }
 
@@ -112,7 +112,7 @@ pub fn new(loop_: &mut Loop) -> ~QueuePool {
         let handle = UvHandle::alloc(None::<AsyncWatcher>, uvll::UV_ASYNC);
         let state = UnsafeArc::new(State {
             handle: handle,
-            lock: LittleLock::new(),
+            lock: unsafe {NativeMutex::new()},
             queue: mpsc::Queue::new(),
         });
         let q = ~QueuePool {
index c22eefdb3302076bf5777251a3069c3f7a016639..918c5e85857db2b6d950c6f50fd61829e4601d42 100644 (file)
@@ -63,7 +63,7 @@ impl<'a> ToBase64 for &'a [u8] {
      * # Example
      *
      * ```rust
-     * extern mod serialize;
+     * extern crate serialize;
      * use serialize::base64::{ToBase64, STANDARD};
      *
      * fn main () {
@@ -189,7 +189,7 @@ impl<'a> FromBase64 for &'a str {
      * This converts a string literal to base64 and back.
      *
      * ```rust
-     * extern mod serialize;
+     * extern crate serialize;
      * use serialize::base64::{ToBase64, FromBase64, STANDARD};
      * use std::str;
      *
index 409bf4af809928a430e86d2bc479f3a7a90a18c5..08a3dda854e3aed0ed93c62a2a3b2e8b8e2dcc4c 100644 (file)
@@ -28,7 +28,7 @@ impl<'a> ToHex for &'a [u8] {
      * # Example
      *
      * ```rust
-     * extern mod serialize;
+     * extern crate serialize;
      * use serialize::hex::ToHex;
      *
      * fn main () {
@@ -89,7 +89,7 @@ impl<'a> FromHex for &'a str {
      * This converts a string literal to hexadecimal and back.
      *
      * ```rust
-     * extern mod serialize;
+     * extern crate serialize;
      * use serialize::hex::{FromHex, ToHex};
      * use std::str;
      *
index 3b71b2237b17661df9333bbc88bb1909724d3998..7a4b1cff6e47c0643e61867d0c65e699979cd551 100644 (file)
@@ -24,7 +24,7 @@
 
 // test harness access
 #[cfg(test)]
-extern mod extra;
+extern crate extra;
 
 pub use self::serialize::{Decoder, Encoder, Decodable, Encodable,
     DecoderHelpers, EncoderHelpers};
index fe332a60efa4468ec3f37ef8e1df608323114be9..adbd4be316c8b78419834f1b38a4e2b2b86fa1be 100644 (file)
@@ -79,6 +79,7 @@
 use vec::{ImmutableVector, MutableVector};
 use vec;
 use rt::global_heap::malloc_raw;
+use unstable::raw::Slice;
 
 /// The representation of a C String.
 ///
@@ -169,6 +170,7 @@ pub fn owns_buffer(&self) -> bool {
     }
 
     /// Converts the CString into a `&[u8]` without copying.
+    /// Includes the terminating NUL byte.
     ///
     /// # Failure
     ///
@@ -177,7 +179,21 @@ pub fn owns_buffer(&self) -> bool {
     pub fn as_bytes<'a>(&'a self) -> &'a [u8] {
         if self.buf.is_null() { fail!("CString is null!"); }
         unsafe {
-            cast::transmute((self.buf, self.len() + 1))
+            cast::transmute(Slice { data: self.buf, len: self.len() + 1 })
+        }
+    }
+
+    /// Converts the CString into a `&[u8]` without copying.
+    /// Does not include the terminating NUL byte.
+    ///
+    /// # Failure
+    ///
+    /// Fails if the CString is null.
+    #[inline]
+    pub fn as_bytes_no_nul<'a>(&'a self) -> &'a [u8] {
+        if self.buf.is_null() { fail!("CString is null!"); }
+        unsafe {
+            cast::transmute(Slice { data: self.buf, len: self.len() })
         }
     }
 
@@ -189,8 +205,7 @@ pub fn as_bytes<'a>(&'a self) -> &'a [u8] {
     /// Fails if the CString is null.
     #[inline]
     pub fn as_str<'a>(&'a self) -> Option<&'a str> {
-        let buf = self.as_bytes();
-        let buf = buf.slice_to(buf.len()-1); // chop off the trailing NUL
+        let buf = self.as_bytes_no_nul();
         str::from_utf8(buf)
     }
 
@@ -417,7 +432,7 @@ fn test_str_multistring_parsing() {
             let expected = ["zero", "one"];
             let mut it = expected.iter();
             let result = from_c_multistring(ptr as *libc::c_char, None, |c| {
-                let cbytes = c.as_bytes().slice_to(c.len());
+                let cbytes = c.as_bytes_no_nul();
                 assert_eq!(cbytes, it.next().unwrap().as_bytes());
             });
             assert_eq!(result, 2);
@@ -552,6 +567,17 @@ fn test_as_bytes() {
         assert_eq!(c_str.as_bytes(), bytes!("foo", 0xff, 0));
     }
 
+    #[test]
+    fn test_as_bytes_no_nul() {
+        let c_str = "hello".to_c_str();
+        assert_eq!(c_str.as_bytes_no_nul(), bytes!("hello"));
+        let c_str = "".to_c_str();
+        let exp: &[u8] = [];
+        assert_eq!(c_str.as_bytes_no_nul(), exp);
+        let c_str = bytes!("foo", 0xff).to_c_str();
+        assert_eq!(c_str.as_bytes_no_nul(), bytes!("foo", 0xff));
+    }
+
     #[test]
     #[should_fail]
     fn test_as_bytes_fail() {
@@ -559,6 +585,13 @@ fn test_as_bytes_fail() {
         c_str.as_bytes();
     }
 
+    #[test]
+    #[should_fail]
+    fn test_as_bytes_no_nul_fail() {
+        let c_str = unsafe { CString::new(ptr::null(), false) };
+        c_str.as_bytes_no_nul();
+    }
+
     #[test]
     fn test_as_str() {
         let c_str = "hello".to_c_str();
index 3487a92d8491cfa25c3274ba8a35d1716a328de1..6fc0cb71c5c9b0ebded79e9c02c5bd2247b0c797 100644 (file)
@@ -61,7 +61,7 @@
 //! let (port, chan) = Chan::new();
 //! spawn(proc() {
 //!     chan.send(10);
-//! })
+//! });
 //! assert_eq!(port.recv(), 10);
 //!
 //! // Create a shared channel which can be sent along from many tasks
index 77bf2d7a68d36be4c5f6734656043fa68f7f1c1a..832cdca12f0ac616caa7f5347b8f65701a6d4fe7 100644 (file)
@@ -18,6 +18,7 @@
 /// module. You'll also note that the implementation of the shared and stream
 /// channels are quite similar, and this is no coincidence!
 
+use cmp;
 use int;
 use iter::Iterator;
 use kinds::Send;
 use rt::task::{Task, BlockedTask};
 use rt::thread::Thread;
 use sync::atomics;
-use unstable::mutex::Mutex;
+use unstable::mutex::NativeMutex;
 use vec::OwnedVector;
 
 use mpsc = sync::mpsc_queue;
 
 static DISCONNECTED: int = int::MIN;
 static FUDGE: int = 1024;
+#[cfg(test)]
+static MAX_STEALS: int = 5;
+#[cfg(not(test))]
 static MAX_STEALS: int = 1 << 20;
 
 pub struct Packet<T> {
@@ -53,7 +57,7 @@ pub struct Packet<T> {
 
     // this lock protects various portions of this implementation during
     // select()
-    select_lock: Mutex,
+    select_lock: NativeMutex,
 }
 
 pub enum Failure {
@@ -72,10 +76,10 @@ pub fn new() -> Packet<T> {
             channels: atomics::AtomicInt::new(2),
             port_dropped: atomics::AtomicBool::new(false),
             sender_drain: atomics::AtomicInt::new(0),
-            select_lock: unsafe { Mutex::new() },
+            select_lock: unsafe { NativeMutex::new() },
         };
         // see comments in inherit_blocker about why we grab this lock
-        unsafe { p.select_lock.lock() }
+        unsafe { p.select_lock.lock_noguard() }
         return p;
     }
 
@@ -124,7 +128,7 @@ pub fn inherit_blocker(&mut self, task: Option<BlockedTask>) {
         // interfere with this method. After we unlock this lock, we're
         // signifying that we're done modifying self.cnt and self.to_wake and
         // the port is ready for the world to continue using it.
-        unsafe { self.select_lock.unlock() }
+        unsafe { self.select_lock.unlock_noguard() }
     }
 
     pub fn send(&mut self, t: T) -> bool {
@@ -307,7 +311,11 @@ pub fn try_recv(&mut self) -> Result<T, Failure> {
                         DISCONNECTED => {
                             self.cnt.store(DISCONNECTED, atomics::SeqCst);
                         }
-                        n => { self.steals -= n; }
+                        n => {
+                            let m = cmp::min(n, self.steals);
+                            self.steals -= m;
+                            self.cnt.fetch_add(n - m, atomics::SeqCst);
+                        }
                     }
                     assert!(self.steals >= 0);
                 }
@@ -438,8 +446,7 @@ pub fn abort_selection(&mut self, _was_upgrade: bool) -> bool {
         // about looking at and dealing with to_wake. Once we have acquired the
         // lock, we are guaranteed that inherit_blocker is done.
         unsafe {
-            self.select_lock.lock();
-            self.select_lock.unlock();
+            let _guard = self.select_lock.lock();
         }
 
         // Like the stream implementation, we want to make sure that the count
@@ -487,7 +494,6 @@ fn drop(&mut self) {
             assert_eq!(self.cnt.load(atomics::SeqCst), DISCONNECTED);
             assert_eq!(self.to_wake.load(atomics::SeqCst), 0);
             assert_eq!(self.channels.load(atomics::SeqCst), 0);
-            self.select_lock.destroy();
         }
     }
 }
index 9c972a3771c1af9c5d9bdef3586acc5a2f20f311..f1988dbbeeda55595408278952bc6654a829047c 100644 (file)
@@ -17,6 +17,7 @@
 /// High level implementation details can be found in the comment of the parent
 /// module.
 
+use cmp;
 use comm::Port;
 use int;
 use iter::Iterator;
@@ -32,6 +33,9 @@
 use vec::OwnedVector;
 
 static DISCONNECTED: int = int::MIN;
+#[cfg(test)]
+static MAX_STEALS: int = 5;
+#[cfg(not(test))]
 static MAX_STEALS: int = 1 << 20;
 
 pub struct Packet<T> {
@@ -198,11 +202,16 @@ pub fn recv(&mut self) -> Result<T, Failure<T>> {
     pub fn try_recv(&mut self) -> Result<T, Failure<T>> {
         match self.queue.pop() {
             // If we stole some data, record to that effect (this will be
-            // factored into cnt later on). Note that we don't allow steals to
-            // grow without bound in order to prevent eventual overflow of
-            // either steals or cnt as an overflow would have catastrophic
-            // results. Also note that we don't unconditionally set steals to 0
-            // because it can be true that steals > cnt.
+            // factored into cnt later on).
+            //
+            // Note that we don't allow steals to grow without bound in order to
+            // prevent eventual overflow of either steals or cnt as an overflow
+            // would have catastrophic results. Sometimes, steals > cnt, but
+            // other times cnt > steals, so we don't know the relation between
+            // steals and cnt. This code path is executed only rarely, so we do
+            // a pretty slow operation, of swapping 0 into cnt, taking steals
+            // down as much as possible (without going negative), and then
+            // adding back in whatever we couldn't factor into steals.
             Some(data) => {
                 self.steals += 1;
                 if self.steals > MAX_STEALS {
@@ -210,7 +219,11 @@ pub fn try_recv(&mut self) -> Result<T, Failure<T>> {
                         DISCONNECTED => {
                             self.cnt.store(DISCONNECTED, atomics::SeqCst);
                         }
-                        n => { self.steals -= n; }
+                        n => {
+                            let m = cmp::min(n, self.steals);
+                            self.steals -= m;
+                            self.cnt.fetch_add(n - m, atomics::SeqCst);
+                        }
                     }
                     assert!(self.steals >= 0);
                 }
index c8b5d3b2d5a486df13c8f47a2227022fe131e59f..bbf3b3292bf199ef2960c1369bf31f0315f019f1 100644 (file)
@@ -82,7 +82,7 @@
 leverage named parameters. Named parameters are listed at the end of the
 argument list and have the syntax:
 
-```
+```ignore
 identifier '=' expression
 ```
 
 is used (the type's rust-representation is printed). For example, this is an
 invalid format string:
 
-```
+```ignore
 {0:d} {0:s}
 ```
 
 illegal to reference an argument as such. For example, this is another invalid
 format string:
 
-```
+```ignore
 {:.*s} {0:u}
 ```
 
@@ -334,7 +334,7 @@ fn main() {
 The select method is a switch over a `&str` parameter, and the parameter *must*
 be of the type `&str`. An example of the syntax is:
 
-```
+```ignore
 {0, select, male{...} female{...} other{...}}
 ```
 
@@ -353,7 +353,7 @@ fn main() {
 parameter *must* be a `uint`. A plural method in its full glory can be specified
 as:
 
-```
+```ignore
 {0, plural, offset=1 =1{...} two{...} many{...} other{...}}
 ```
 
@@ -381,7 +381,7 @@ fn main() {
 meaning that arguments are surrounded by `{}` instead of the C-like `%`. The
 actual grammar for the formatting syntax is:
 
-```
+```ignore
 format_string := <text> [ format <text> ] *
 format := '{' [ argument ] [ ':' format_spec ] [ ',' function_spec ] '}'
 argument := integer | identifier
@@ -1200,7 +1200,17 @@ fn fmt(&self, f: &mut Formatter) -> Result {
 }
 impl<T> Pointer for *mut T {
     fn fmt(&self, f: &mut Formatter) -> Result {
-        secret_pointer(&(*self as *T), f)
+        secret_pointer::<*T>(&(*self as *T), f)
+    }
+}
+impl<'a, T> Pointer for &'a T {
+    fn fmt(&self, f: &mut Formatter) -> Result {
+        secret_pointer::<*T>(&(&**self as *T), f)
+    }
+}
+impl<'a, T> Pointer for &'a mut T {
+    fn fmt(&self, f: &mut Formatter) -> Result {
+        secret_pointer::<*T>(&(&**self as *T), f)
     }
 }
 
index f8e02c82fcd992e51854ccd7e48deae2d05758c8..1ac599d0654fbd0e162982f839c4af6e265b6c0c 100644 (file)
@@ -56,7 +56,7 @@
 use clone::Clone;
 use cmp::{Eq, Equiv, max};
 use default::Default;
-#[cfg(not(stage0))] use fmt;
+use fmt;
 use hash::Hash;
 use iter;
 use iter::{Iterator, FromIterator, Extendable};
@@ -66,7 +66,7 @@
 use option::{None, Option, Some};
 use rand::Rng;
 use rand;
-#[cfg(not(stage0))] use result::{Ok, Err};
+use result::{Ok, Err};
 use vec::{ImmutableVector, MutableVector, OwnedVector, Items, MutItems};
 use vec_ng;
 use vec_ng::Vec;
@@ -597,7 +597,6 @@ fn clone(&self) -> HashMap<K,V> {
     }
 }
 
-#[cfg(not(stage0))]
 impl<A: fmt::Show + Hash + Eq, B: fmt::Show> fmt::Show for HashMap<A, B> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         if_ok!(write!(f.buf, r"\{"))
@@ -876,7 +875,6 @@ fn clone(&self) -> HashSet<T> {
     }
 }
 
-#[cfg(not(stage0))]
 impl<A: fmt::Show + Hash + Eq> fmt::Show for HashSet<A> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         if_ok!(write!(f.buf, r"\{"))
index bf2c6dbb623f354c270e4a3c32c5b851e260fbae..10e1f88690332a04845711b0344804d33c0f9b81 100644 (file)
 /// # Example
 ///
 /// ```
-/// let reader = PortReader::new(port);
+/// use std::io::PortReader;
+///
+/// let (port, chan) = Chan::new();
+/// # drop(chan);
+/// let mut reader = PortReader::new(port);
 ///
 /// let mut buf = ~[0u8, ..100];
 /// match reader.read(buf) {
-///     Some(nread) => println!("Read {} bytes", nread),
-///     None => println!("At the end of the stream!")
+///     Ok(nread) => println!("Read {} bytes", nread),
+///     Err(e) => println!("read error: {}", e),
 /// }
 /// ```
 pub struct PortReader {
@@ -83,7 +87,12 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
 /// # Example
 ///
 /// ```
-/// let writer = ChanWriter::new(chan);
+/// # #[allow(unused_must_use)];
+/// use std::io::ChanWriter;
+///
+/// let (port, chan) = Chan::new();
+/// # drop(port);
+/// let mut writer = ChanWriter::new(chan);
 /// writer.write("hello, world".as_bytes());
 /// ```
 pub struct ChanWriter {
index 24b3d1cc4de70a3d73cb51e6e7453d366444308c..c99fe587fc0d0b5b9e7e43fa8cdc40727023bc06 100644 (file)
@@ -779,6 +779,13 @@ fn read_i8(&mut self) -> IoResult<i8> {
         self.read_byte().map(|i| i as i8)
     }
 
+    /// Creates a wrapper around a mutable reference to the reader.
+    ///
+    /// This is useful to allow applying adaptors while still
+    /// retaining ownership of the original value.
+    fn by_ref<'a>(&'a mut self) -> RefReader<'a, Self> {
+        RefReader { inner: self }
+    }
 }
 
 impl Reader for ~Reader {
@@ -789,6 +796,14 @@ impl<'a> Reader for &'a mut Reader {
     fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { self.read(buf) }
 }
 
+pub struct RefReader<'a, R> {
+    priv inner: &'a mut R
+}
+
+impl<'a, R: Reader> Reader for RefReader<'a, R> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { self.inner.read(buf) }
+}
+
 fn extend_sign(val: u64, nbytes: uint) -> i64 {
     let shift = (8 - nbytes) * 8;
     (val << shift) as i64 >> shift
@@ -969,6 +984,14 @@ fn write_u8(&mut self, n: u8) -> IoResult<()> {
     fn write_i8(&mut self, n: i8) -> IoResult<()> {
         self.write([n as u8])
     }
+
+    /// Creates a wrapper around a mutable reference to the writer.
+    ///
+    /// This is useful to allow applying wrappers while still
+    /// retaining ownership of the original value.
+    fn by_ref<'a>(&'a mut self) -> RefWriter<'a, Self> {
+        RefWriter { inner: self }
+    }
 }
 
 impl Writer for ~Writer {
@@ -981,6 +1004,16 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.write(buf) }
     fn flush(&mut self) -> IoResult<()> { self.flush() }
 }
 
+pub struct RefWriter<'a, W> {
+    inner: &'a mut W
+}
+
+impl<'a, W: Writer> Writer for RefWriter<'a, W> {
+    fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.inner.write(buf) }
+    fn flush(&mut self) -> IoResult<()> { self.inner.flush() }
+}
+
+
 pub trait Stream: Reader + Writer { }
 
 impl<T: Reader + Writer> Stream for T {}
index 6ce4a6fdc875815ecfeaf5870c2190075f5d868f..23c01aa635444d4675789c0e1b9e72730ed3e0f2 100644 (file)
@@ -91,15 +91,18 @@ impl UnixListener {
     /// # Example
     ///
     /// ```
+    /// # fn main() {}
+    /// # fn foo() {
+    /// # #[allow(unused_must_use)];
     /// use std::io::net::unix::UnixListener;
-    /// use std::io::Listener;
+    /// use std::io::{Listener, Acceptor};
     ///
-    /// let server = Path::new("path/to/my/socket");
-    /// let mut stream = UnixListener::bind(&server);
-    /// for client in stream.incoming() {
-    ///     let mut client = client;
+    /// let server = Path::new("/path/to/my/socket");
+    /// let stream = UnixListener::bind(&server);
+    /// for mut client in stream.listen().incoming() {
     ///     client.write([1, 2, 3, 4]);
     /// }
+    /// # }
     /// ```
     pub fn bind<P: ToCStr>(path: &P) -> IoResult<UnixListener> {
         LocalIo::maybe_raise(|io| {
index b515cd9d31c0eb5048e22a46d112b8104f531daa..6540fcd85d3fd620ecc4c7c1608eebed470d6ee0 100644 (file)
@@ -58,7 +58,21 @@ pub struct ProcessConfig<'a> {
     ///     0 - stdin
     ///     1 - stdout
     ///     2 - stderr
-    io: &'a [StdioContainer]
+    io: &'a [StdioContainer],
+
+    /// Sets the child process's user id. This translates to a `setuid` call in
+    /// the child process. Setting this value on windows will cause the spawn to
+    /// fail. Failure in the `setuid` call on unix will also cause the spawn to
+    /// fail.
+    uid: Option<uint>,
+
+    /// Similar to `uid`, but sets the group id of the child process. This has
+    /// the same semantics as the `uid` field.
+    gid: Option<uint>,
+
+    /// If true, the child process is spawned in a detached state. On unix, this
+    /// means that the child is the leader of a new process group.
+    detach: bool,
 }
 
 /// Describes what to do with a standard io stream for a child process.
@@ -115,6 +129,36 @@ pub fn matches_exit_status(&self, wanted: int) -> bool {
     }
 }
 
+impl<'a> ProcessConfig<'a> {
+    /// Creates a new configuration with blanks as all of the defaults. This is
+    /// useful when using functional struct updates:
+    ///
+    /// ```rust
+    /// use std::io::process::{ProcessConfig, Process};
+    ///
+    /// let config = ProcessConfig {
+    ///     program: "/bin/sh",
+    ///     args: &'static [~"-c", ~"echo hello"],
+    ///     .. ProcessConfig::new()
+    /// };
+    ///
+    /// let p = Process::new(config);
+    /// ```
+    ///
+    pub fn new() -> ProcessConfig<'static> {
+        ProcessConfig {
+            program: "",
+            args: &'static [],
+            env: None,
+            cwd: None,
+            io: &'static [],
+            uid: None,
+            gid: None,
+            detach: false,
+        }
+    }
+}
+
 impl Process {
     /// Creates a new pipe initialized, but not bound to any particular
     /// source/destination
@@ -175,13 +219,10 @@ mod tests {
     // FIXME(#10380)
     #[cfg(unix, not(target_os="android"))]
     iotest!(fn smoke() {
-        let io = ~[];
         let args = ProcessConfig {
             program: "/bin/sh",
             args: &[~"-c", ~"true"],
-            env: None,
-            cwd: None,
-            io: io,
+            .. ProcessConfig::new()
         };
         let p = Process::new(args);
         assert!(p.is_ok());
@@ -192,13 +233,9 @@ mod tests {
     // FIXME(#10380)
     #[cfg(unix, not(target_os="android"))]
     iotest!(fn smoke_failure() {
-        let io = ~[];
         let args = ProcessConfig {
             program: "if-this-is-a-binary-then-the-world-has-ended",
-            args: &[],
-            env: None,
-            cwd: None,
-            io: io,
+            .. ProcessConfig::new()
         };
         match Process::new(args) {
             Ok(..) => fail!(),
@@ -209,13 +246,10 @@ mod tests {
     // FIXME(#10380)
     #[cfg(unix, not(target_os="android"))]
     iotest!(fn exit_reported_right() {
-        let io = ~[];
         let args = ProcessConfig {
             program: "/bin/sh",
             args: &[~"-c", ~"exit 1"],
-            env: None,
-            cwd: None,
-            io: io,
+            .. ProcessConfig::new()
         };
         let p = Process::new(args);
         assert!(p.is_ok());
@@ -225,13 +259,10 @@ mod tests {
 
     #[cfg(unix, not(target_os="android"))]
     iotest!(fn signal_reported_right() {
-        let io = ~[];
         let args = ProcessConfig {
             program: "/bin/sh",
             args: &[~"-c", ~"kill -1 $$"],
-            env: None,
-            cwd: None,
-            io: io,
+            .. ProcessConfig::new()
         };
         let p = Process::new(args);
         assert!(p.is_ok());
@@ -264,9 +295,8 @@ pub fn run_output(args: ProcessConfig) -> ~str {
         let args = ProcessConfig {
             program: "/bin/sh",
             args: &[~"-c", ~"echo foobar"],
-            env: None,
-            cwd: None,
             io: io,
+            .. ProcessConfig::new()
         };
         assert_eq!(run_output(args), ~"foobar\n");
     })
@@ -279,9 +309,9 @@ pub fn run_output(args: ProcessConfig) -> ~str {
         let args = ProcessConfig {
             program: "/bin/sh",
             args: &[~"-c", ~"pwd"],
-            env: None,
             cwd: cwd,
             io: io,
+            .. ProcessConfig::new()
         };
         assert_eq!(run_output(args), ~"/\n");
     })
@@ -294,9 +324,8 @@ pub fn run_output(args: ProcessConfig) -> ~str {
         let args = ProcessConfig {
             program: "/bin/sh",
             args: &[~"-c", ~"read line; echo $line"],
-            env: None,
-            cwd: None,
             io: io,
+            .. ProcessConfig::new()
         };
         let mut p = Process::new(args).unwrap();
         p.io[0].get_mut_ref().write("foobar".as_bytes()).unwrap();
@@ -306,4 +335,58 @@ pub fn run_output(args: ProcessConfig) -> ~str {
         assert_eq!(out, ~"foobar\n");
     })
 
+    // FIXME(#10380)
+    #[cfg(unix, not(target_os="android"))]
+    iotest!(fn detach_works() {
+        let args = ProcessConfig {
+            program: "/bin/sh",
+            args: &[~"-c", ~"true"],
+            detach: true,
+            .. ProcessConfig::new()
+        };
+        let mut p = Process::new(args).unwrap();
+        assert!(p.wait().success());
+    })
+
+    #[cfg(windows)]
+    iotest!(fn uid_fails_on_windows() {
+        let args = ProcessConfig {
+            program: "test",
+            uid: Some(10),
+            .. ProcessConfig::new()
+        };
+        assert!(Process::new(args).is_err());
+    })
+
+    // FIXME(#10380)
+    #[cfg(unix, not(target_os="android"))]
+    iotest!(fn uid_works() {
+        use libc;
+        let args = ProcessConfig {
+            program: "/bin/sh",
+            args: &[~"-c", ~"true"],
+            uid: Some(unsafe { libc::getuid() as uint }),
+            gid: Some(unsafe { libc::getgid() as uint }),
+            .. ProcessConfig::new()
+        };
+        let mut p = Process::new(args).unwrap();
+        assert!(p.wait().success());
+    })
+
+    // FIXME(#10380)
+    #[cfg(unix, not(target_os="android"))]
+    iotest!(fn uid_to_root_fails() {
+        use libc;
+
+        // if we're already root, this isn't a valid test. Most of the bots run
+        // as non-root though (android is an exception).
+        if unsafe { libc::getuid() == 0 } { return }
+        let args = ProcessConfig {
+            program: "/bin/ls",
+            uid: Some(0),
+            gid: Some(0),
+            .. ProcessConfig::new()
+        };
+        assert!(Process::new(args).is_err());
+    })
 }
index 6ac73e7f61e712c78a810bd16968562313786cd6..04ecb479060c4e46f68acfbe7782f64b7c4646a5 100644 (file)
@@ -155,7 +155,7 @@ fn sysctl(name: *mut libc::c_int, namelen: libc::c_uint,
     pub unsafe fn raise_fd_limit() {
         // The strategy here is to fetch the current resource limits, read the kern.maxfilesperproc
         // sysctl value, and bump the soft resource limit for maxfiles up to the sysctl value.
-        use ptr::{to_unsafe_ptr, to_mut_unsafe_ptr, mut_null};
+        use ptr::mut_null;
         use mem::size_of_val;
         use os::last_os_error;
 
@@ -163,9 +163,7 @@ pub unsafe fn raise_fd_limit() {
         let mut mib: [libc::c_int, ..2] = [CTL_KERN, KERN_MAXFILESPERPROC];
         let mut maxfiles: libc::c_int = 0;
         let mut size: libc::size_t = size_of_val(&maxfiles) as libc::size_t;
-        if sysctl(to_mut_unsafe_ptr(&mut mib[0]), 2,
-                  to_mut_unsafe_ptr(&mut maxfiles) as *mut libc::c_void,
-                  to_mut_unsafe_ptr(&mut size),
+        if sysctl(&mut mib[0], 2, &mut maxfiles as *mut libc::c_int as *mut libc::c_void, &mut size,
                   mut_null(), 0) != 0 {
             let err = last_os_error();
             error!("raise_fd_limit: error calling sysctl: {}", err);
@@ -174,7 +172,7 @@ pub unsafe fn raise_fd_limit() {
 
         // Fetch the current resource limits
         let mut rlim = rlimit{rlim_cur: 0, rlim_max: 0};
-        if getrlimit(RLIMIT_NOFILE, to_mut_unsafe_ptr(&mut rlim)) != 0 {
+        if getrlimit(RLIMIT_NOFILE, &mut rlim) != 0 {
             let err = last_os_error();
             error!("raise_fd_limit: error calling getrlimit: {}", err);
             return;
@@ -184,7 +182,7 @@ pub unsafe fn raise_fd_limit() {
         rlim.rlim_cur = ::cmp::min(maxfiles as rlim_t, rlim.rlim_max);
 
         // Set our newly-increased resource limit
-        if setrlimit(RLIMIT_NOFILE, to_unsafe_ptr(&rlim)) != 0 {
+        if setrlimit(RLIMIT_NOFILE, &rlim) != 0 {
             let err = last_os_error();
             error!("raise_fd_limit: error calling setrlimit: {}", err);
             return;
index c4d92b36ecfa60fca8b76463aeb55f4af0c6070f..79ae9faf6295ba861a66ee9f3dd98cbc70353179 100644 (file)
 use vec::bytes::MutableByteVector;
 
 /// Wraps a `Reader`, limiting the number of bytes that can be read from it.
-pub struct LimitReader<'a, R> {
+pub struct LimitReader<R> {
     priv limit: uint,
-    priv inner: &'a mut R
+    priv inner: R
 }
 
-impl<'a, R: Reader> LimitReader<'a, R> {
+impl<R: Reader> LimitReader<R> {
     /// Creates a new `LimitReader`
-    pub fn new<'a>(r: &'a mut R, limit: uint) -> LimitReader<'a, R> {
+    pub fn new(r: R, limit: uint) -> LimitReader<R> {
         LimitReader { limit: limit, inner: r }
     }
+
+    /// Consumes the `LimitReader`, returning the underlying `Reader`.
+    pub fn unwrap(self) -> R { self.inner }
+
+    /// Returns the number of bytes that can be read before the `LimitReader`
+    /// will return EOF.
+    ///
+    /// # Note
+    ///
+    /// The reader may reach EOF after reading fewer bytes than indicated by
+    /// this method if the underlying reader reaches EOF.
+    pub fn limit(&self) -> uint { self.limit }
 }
 
-impl<'a, R: Reader> Reader for LimitReader<'a, R> {
+impl<R: Reader> Reader for LimitReader<R> {
     fn read(&mut self, buf: &mut [u8]) -> io::IoResult<uint> {
         if self.limit == 0 {
             return Err(io::standard_error(io::EndOfFile));
@@ -189,24 +201,35 @@ mod test {
     use prelude::*;
 
     #[test]
-    fn test_bounded_reader_unlimited() {
+    fn test_limit_reader_unlimited() {
         let mut r = MemReader::new(~[0, 1, 2]);
         {
-            let mut r = LimitReader::new(&mut r, 4);
+            let mut r = LimitReader::new(r.by_ref(), 4);
             assert_eq!(~[0, 1, 2], r.read_to_end().unwrap());
         }
     }
 
     #[test]
-    fn test_bound_reader_limited() {
+    fn test_limit_reader_limited() {
         let mut r = MemReader::new(~[0, 1, 2]);
         {
-            let mut r = LimitReader::new(&mut r, 2);
+            let mut r = LimitReader::new(r.by_ref(), 2);
             assert_eq!(~[0, 1], r.read_to_end().unwrap());
         }
         assert_eq!(~[2], r.read_to_end().unwrap());
     }
 
+    #[test]
+    fn test_limit_reader_limit() {
+        let r = MemReader::new(~[0, 1, 2]);
+        let mut r = LimitReader::new(r, 3);
+        assert_eq!(3, r.limit());
+        assert_eq!(0, r.read_byte().unwrap());
+        assert_eq!(2, r.limit());
+        assert_eq!(~[1, 2], r.read_to_end().unwrap());
+        assert_eq!(0, r.limit());
+    }
+
     #[test]
     fn test_null_writer() {
         let mut s = NullWriter;
index d141da68dfd7b187682071d5c396311cd38067e3..e5a89fc42e1521227a2029373d607ffdcafae7ef 100644 (file)
@@ -2611,7 +2611,7 @@ fn test_iterator_size_hint() {
         assert_eq!(vi.size_hint(), (10, Some(10)));
 
         assert_eq!(c.take(5).size_hint(), (5, Some(5)));
-        assert_eq!(c.skip(5).size_hint().second(), None);
+        assert_eq!(c.skip(5).size_hint().val1(), None);
         assert_eq!(c.take_while(|_| false).size_hint(), (0, None));
         assert_eq!(c.skip_while(|_| false).size_hint(), (0, None));
         assert_eq!(c.enumerate().size_hint(), (uint::MAX, None));
index 51e9e9b386474e04e99288241257b85bc517cc5d..61b24f67f66dff3d7dce586e4e41d05185c5c5a8 100644 (file)
@@ -69,7 +69,9 @@ pub mod marker {
     /// Given a struct `S` that includes a type parameter `T`
     /// but does not actually *reference* that type parameter:
     ///
-    /// ```
+    /// ```ignore
+    /// use std::cast;
+    ///
     /// struct S<T> { x: *() }
     /// fn get<T>(s: &S<T>) -> T {
     ///    unsafe {
@@ -109,6 +111,8 @@ pub mod marker {
     /// but does not actually *reference* that type parameter:
     ///
     /// ```
+    /// use std::cast;
+    ///
     /// struct S<T> { x: *() }
     /// fn get<T>(s: &S<T>, v: T) {
     ///    unsafe {
@@ -147,7 +151,8 @@ pub mod marker {
     /// "interior" mutability:
     ///
     /// ```
-    /// struct Cell<T> { priv value: T }
+    /// pub struct Cell<T> { priv value: T }
+    /// # fn main() {}
     /// ```
     ///
     /// The type system would infer that `value` is only read here and
index e0666ef417927006a96240c762e9e6821bbd0748..4452482b7e8ceee4c6c3ced6498d055de746c9ee 100644 (file)
@@ -30,7 +30,7 @@
 //! `std` is imported at the topmost level of every crate by default, as
 //! if the first line of each crate was
 //!
-//!     extern mod std;
+//!     extern crate std;
 //!
 //! This means that the contents of std can be accessed from any context
 //! with the `std::` path prefix, as in `use std::vec`, `use std::task::spawn`,
 // When testing libstd, bring in libuv as the I/O backend so tests can print
 // things and all of the std::io tests have an I/O interface to run on top
 // of
-#[cfg(test)] extern mod rustuv = "rustuv";
-#[cfg(test)] extern mod native = "native";
-#[cfg(test)] extern mod green = "green";
+#[cfg(test)] extern crate rustuv = "rustuv";
+#[cfg(test)] extern crate native = "native";
+#[cfg(test)] extern crate green = "green";
 
 // Make extra accessible for benchmarking
-#[cfg(test)] extern mod extra = "extra";
+#[cfg(test)] extern crate extra = "extra";
 
 // Make std testable by not duplicating lang items. See #2912
-#[cfg(test)] extern mod realstd = "std";
+#[cfg(test)] extern crate realstd = "std";
 #[cfg(test)] pub use kinds = realstd::kinds;
 #[cfg(test)] pub use ops = realstd::ops;
 #[cfg(test)] pub use cmp = realstd::cmp;
index 39383f993924cebf9bca7c6c2176e5bc1daa8de7..7dc4c692f6319559909fb340fa295afd0f06d239 100644 (file)
 pub use libc::funcs::c95::stdio::{fwrite, perror, puts, remove, rewind};
 pub use libc::funcs::c95::stdio::{setbuf, setvbuf, tmpfile, ungetc};
 
-pub use libc::funcs::c95::stdlib::{abs, atof, atoi, calloc, exit};
+pub use libc::funcs::c95::stdlib::{abs, atof, atoi, calloc, exit, _exit};
 pub use libc::funcs::c95::stdlib::{free, getenv, labs, malloc, rand};
 pub use libc::funcs::c95::stdlib::{realloc, srand, strtod, strtol};
 pub use libc::funcs::c95::stdlib::{strtoul, system};
@@ -1769,6 +1769,9 @@ pub mod extra {
             pub static MAX_PROTOCOL_CHAIN: DWORD = 7;
             pub static WSAPROTOCOL_LEN: DWORD = 255;
             pub static INVALID_SOCKET: DWORD = !0;
+
+            pub static DETACHED_PROCESS: DWORD = 0x00000008;
+            pub static CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
         }
         pub mod sysconf {
         }
@@ -3340,6 +3343,7 @@ pub fn strtoul(s: *c_char, endp: **c_char, base: c_int)
                 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
                 pub fn free(p: *mut c_void);
                 pub fn exit(status: c_int) -> !;
+                pub fn _exit(status: c_int) -> !;
                 // Omitted: atexit.
                 pub fn system(s: *c_char) -> c_int;
                 pub fn getenv(s: *c_char) -> *c_char;
index 165a83aa975cd639c149b3fa4c6480f611c8d164..9aa63f15def3100e2a113e69d76cbba149dd3518 100644 (file)
@@ -42,7 +42,7 @@
 `RUST_LOG` environment variable. The value of this environment variable is a
 comma-separated list of logging directives. A logging directive is of the form:
 
-```
+```ignore
 path::to::module=log_level
 ```
 
@@ -65,7 +65,7 @@
 
 Some examples of valid values of `RUST_LOG` are:
 
-```
+```ignore
 hello                // turns on all logging for the 'hello' module
 info                 // turns on all info logging
 hello=debug          // turns on debug logging for 'hello'
index 914cc25250c7f6a5ab087b7d53ce8c430a738541..63196cd4f162efdb4261f007bc01f64567e57140 100644 (file)
@@ -10,8 +10,6 @@
 
 //! Operations on managed box types
 
-use ptr::to_unsafe_ptr;
-
 #[cfg(not(test))] use cmp::*;
 
 /// Returns the refcount of a shared box (as just before calling this)
@@ -24,8 +22,7 @@ pub fn refcount<T>(t: @T) -> uint {
 /// Determine if two shared boxes point to the same object
 #[inline]
 pub fn ptr_eq<T>(a: @T, b: @T) -> bool {
-    let (a_ptr, b_ptr): (*T, *T) = (to_unsafe_ptr(&*a), to_unsafe_ptr(&*b));
-    a_ptr == b_ptr
+    &*a as *T == &*b as *T
 }
 
 #[cfg(not(test))]
index 9951405fa0c2fad406cbd397a9a55742485c1453..f418be262ed571b98e83c0c6d67cfb497d9d83c9 100644 (file)
@@ -867,7 +867,6 @@ fn from_str_radix(val: &str, rdx: uint) -> Option<f32> {
 #[cfg(test)]
 mod tests {
     use f32::*;
-    use prelude::*;
 
     use num::*;
     use num;
index 643dcc5bd4b8e701b2a0a425901c51382577e71e..1b1aaf684706494062a17e0dd2c80040163e685f 100644 (file)
@@ -869,7 +869,6 @@ fn from_str_radix(val: &str, rdx: uint) -> Option<f64> {
 #[cfg(test)]
 mod tests {
     use f64::*;
-    use prelude::*;
 
     use num::*;
     use num;
index 4965d0606115d43012a6ee42811b688a0374ac2d..fe3c18d1c4f542d224ae8bc3f6e78fff1dc11424 100644 (file)
@@ -119,6 +119,8 @@ impl Rem<$T,$T> for $T {
     /// Returns the integer remainder after division, satisfying:
     ///
     /// ```
+    /// # let n = 1;
+    /// # let d = 2;
     /// assert!((n / d) * d + (n % d) == n)
     /// ```
     ///
@@ -194,15 +196,15 @@ impl Integer for $T {
     /// # Examples
     ///
     /// ```
-    /// assert!(( 8).div_floor( 3) ==  2);
-    /// assert!(( 8).div_floor(-3) == -3);
-    /// assert!((-8).div_floor( 3) == -3);
-    /// assert!((-8).div_floor(-3) ==  2);
-    ///
-    /// assert!(( 1).div_floor( 2) ==  0);
-    /// assert!(( 1).div_floor(-2) == -1);
-    /// assert!((-1).div_floor( 2) == -1);
-    /// assert!((-1).div_floor(-2) ==  0);
+    /// assert!(( 8i).div_floor(& 3) ==  2);
+    /// assert!(( 8i).div_floor(&-3) == -3);
+    /// assert!((-8i).div_floor(& 3) == -3);
+    /// assert!((-8i).div_floor(&-3) ==  2);
+    ///
+    /// assert!(( 1i).div_floor(& 2) ==  0);
+    /// assert!(( 1i).div_floor(&-2) == -1);
+    /// assert!((-1i).div_floor(& 2) == -1);
+    /// assert!((-1i).div_floor(&-2) ==  0);
     /// ```
     ///
     #[inline]
@@ -220,21 +222,22 @@ fn div_floor(&self, other: &$T) -> $T {
     /// Integer modulo, satisfying:
     ///
     /// ```
-    /// assert!(n.div_floor(d) * d + n.mod_floor(d) == n)
+    /// # let n = 1i; let d = 1i;
+    /// assert!(n.div_floor(&d) * d + n.mod_floor(&d) == n)
     /// ```
     ///
     /// # Examples
     ///
     /// ```
-    /// assert!(( 8).mod_floor( 3) ==  2);
-    /// assert!(( 8).mod_floor(-3) == -1);
-    /// assert!((-8).mod_floor( 3) ==  1);
-    /// assert!((-8).mod_floor(-3) == -2);
-    ///
-    /// assert!(( 1).mod_floor( 2) ==  1);
-    /// assert!(( 1).mod_floor(-2) == -1);
-    /// assert!((-1).mod_floor( 2) ==  1);
-    /// assert!((-1).mod_floor(-2) == -1);
+    /// assert!(( 8i).mod_floor(& 3) ==  2);
+    /// assert!(( 8i).mod_floor(&-3) == -1);
+    /// assert!((-8i).mod_floor(& 3) ==  1);
+    /// assert!((-8i).mod_floor(&-3) == -2);
+    ///
+    /// assert!(( 1i).mod_floor(& 2) ==  1);
+    /// assert!(( 1i).mod_floor(&-2) == -1);
+    /// assert!((-1i).mod_floor(& 2) ==  1);
+    /// assert!((-1i).mod_floor(&-2) == -1);
     /// ```
     ///
     #[inline]
index c9908dde6e0645e8b3ec6034e1b8981398c6ba60..493069139ef2b9d434e31f3335d810b2ba45fe33 100644 (file)
@@ -45,7 +45,7 @@ pub trait Zero: Add<Self, Self> {
     ///
     /// # Laws
     ///
-    /// ~~~
+    /// ~~~ignore
     /// a + 0 = a       ∀ a ∈ Self
     /// 0 + a = a       ∀ a ∈ Self
     /// ~~~
@@ -71,7 +71,7 @@ pub trait One: Mul<Self, Self> {
     ///
     /// # Laws
     ///
-    /// ~~~
+    /// ~~~ignore
     /// a * 1 = a       ∀ a ∈ Self
     /// 1 * a = a       ∀ a ∈ Self
     /// ~~~
@@ -964,6 +964,8 @@ impl FromPrimitive for $T {
 /// # Example
 ///
 /// ```
+/// use std::num;
+///
 /// let twenty: f32 = num::cast(0x14).unwrap();
 /// assert_eq!(twenty, 20f32);
 /// ```
index 78cae2964570c995ab965af89e55ad728a175acf..719ed62d03d0aaa65707319c5696db53680088d4 100644 (file)
@@ -44,7 +44,6 @@
 use str;
 use str::{Str, StrSlice};
 use fmt;
-use unstable::finally::Finally;
 use sync::atomics::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
 use path::{Path, GenericPath};
 use iter::Iterator;
@@ -53,6 +52,8 @@
 
 #[cfg(unix)]
 use c_str::ToCStr;
+#[cfg(windows)]
+use str::OwnedStr;
 
 /// Delegates to the libc close() function, returning the same return value.
 pub fn close(fd: int) -> int {
@@ -143,25 +144,35 @@ pub fn as_utf16_p<T>(s: &str, f: |*u16| -> T) -> T {
 Serialize access through a global lock.
 */
 fn with_env_lock<T>(f: || -> T) -> T {
-    use unstable::mutex::{Mutex, MUTEX_INIT};
-    use unstable::finally::Finally;
+    use unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
 
-    static mut lock: Mutex = MUTEX_INIT;
+    static mut lock: StaticNativeMutex = NATIVE_MUTEX_INIT;
 
     unsafe {
-        return (|| {
-            lock.lock();
-            f()
-        }).finally(|| lock.unlock());
+        let _guard = lock.lock();
+        f()
     }
 }
 
 /// Returns a vector of (variable, value) pairs for all the environment
 /// variables of the current process.
+///
+/// Invalid UTF-8 bytes are replaced with \uFFFD. See `str::from_utf8_lossy()`
+/// for details.
 pub fn env() -> ~[(~str,~str)] {
+    env_as_bytes().move_iter().map(|(k,v)| {
+        let k = str::from_utf8_lossy(k).into_owned();
+        let v = str::from_utf8_lossy(v).into_owned();
+        (k,v)
+    }).collect()
+}
+
+/// Returns a vector of (variable, value) byte-vector pairs for all the
+/// environment variables of the current process.
+pub fn env_as_bytes() -> ~[(~[u8],~[u8])] {
     unsafe {
         #[cfg(windows)]
-        unsafe fn get_env_pairs() -> ~[~str] {
+        unsafe fn get_env_pairs() -> ~[~[u8]] {
             use c_str;
             use str::StrSlice;
 
@@ -176,13 +187,15 @@ unsafe fn get_env_pairs() -> ~[~str] {
             }
             let mut result = ~[];
             c_str::from_c_multistring(ch as *c_char, None, |cstr| {
-                result.push(cstr.as_str().unwrap().to_owned());
+                result.push(cstr.as_bytes_no_nul().to_owned());
             });
             FreeEnvironmentStringsA(ch);
             result
         }
         #[cfg(unix)]
-        unsafe fn get_env_pairs() -> ~[~str] {
+        unsafe fn get_env_pairs() -> ~[~[u8]] {
+            use c_str::CString;
+
             extern {
                 fn rust_env_pairs() -> **c_char;
             }
@@ -193,20 +206,19 @@ unsafe fn get_env_pairs() -> ~[~str] {
             }
             let mut result = ~[];
             ptr::array_each(environ, |e| {
-                let env_pair = str::raw::from_c_str(e);
-                debug!("get_env_pairs: {}", env_pair);
+                let env_pair = CString::new(e, false).as_bytes_no_nul().to_owned();
                 result.push(env_pair);
             });
             result
         }
 
-        fn env_convert(input: ~[~str]) -> ~[(~str, ~str)] {
+        fn env_convert(input: ~[~[u8]]) -> ~[(~[u8], ~[u8])] {
             let mut pairs = ~[];
             for p in input.iter() {
-                let vs: ~[&str] = p.splitn('=', 1).collect();
-                debug!("splitting: len: {}", vs.len());
-                assert_eq!(vs.len(), 2);
-                pairs.push((vs[0].to_owned(), vs[1].to_owned()));
+                let vs: ~[&[u8]] = p.splitn(1, |b| *b == '=' as u8).collect();
+                let key = vs[0].to_owned();
+                let val = (if vs.len() < 2 { ~[] } else { vs[1].to_owned() });
+                pairs.push((key, val));
             }
             pairs
         }
@@ -220,14 +232,34 @@ fn env_convert(input: ~[~str]) -> ~[(~str, ~str)] {
 #[cfg(unix)]
 /// Fetches the environment variable `n` from the current process, returning
 /// None if the variable isn't set.
+///
+/// Any invalid UTF-8 bytes in the value are replaced by \uFFFD. See
+/// `str::from_utf8_lossy()` for details.
+///
+/// # Failure
+///
+/// Fails if `n` has any interior NULs.
 pub fn getenv(n: &str) -> Option<~str> {
+    getenv_as_bytes(n).map(|v| str::from_utf8_lossy(v).into_owned())
+}
+
+#[cfg(unix)]
+/// Fetches the environment variable `n` byte vector from the current process,
+/// returning None if the variable isn't set.
+///
+/// # Failure
+///
+/// Fails if `n` has any interior NULs.
+pub fn getenv_as_bytes(n: &str) -> Option<~[u8]> {
+    use c_str::CString;
+
     unsafe {
         with_env_lock(|| {
             let s = n.with_c_str(|buf| libc::getenv(buf));
             if s.is_null() {
                 None
             } else {
-                Some(str::raw::from_c_str(s))
+                Some(CString::new(s, false).as_bytes_no_nul().to_owned())
             }
         })
     }
@@ -249,10 +281,21 @@ pub fn getenv(n: &str) -> Option<~str> {
     }
 }
 
+#[cfg(windows)]
+/// Fetches the environment variable `n` byte vector from the current process,
+/// returning None if the variable isn't set.
+pub fn getenv_as_bytes(n: &str) -> Option<~[u8]> {
+    getenv(n).map(|s| s.into_bytes())
+}
+
 
 #[cfg(unix)]
 /// Sets the environment variable `n` to the value `v` for the currently running
 /// process
+///
+/// # Failure
+///
+/// Fails if `n` or `v` have any interior NULs.
 pub fn setenv(n: &str, v: &str) {
     unsafe {
         with_env_lock(|| {
@@ -283,6 +326,10 @@ pub fn setenv(n: &str, v: &str) {
 }
 
 /// Remove a variable from the environment entirely
+///
+/// # Failure
+///
+/// Fails (on unix) if `n` has any interior NULs.
 pub fn unsetenv(n: &str) {
     #[cfg(unix)]
     fn _unsetenv(n: &str) {
@@ -722,10 +769,12 @@ pub fn get_exit_status() -> int {
 }
 
 #[cfg(target_os = "macos")]
-unsafe fn load_argc_and_argv(argc: int, argv: **c_char) -> ~[~str] {
+unsafe fn load_argc_and_argv(argc: int, argv: **c_char) -> ~[~[u8]] {
+    use c_str::CString;
+
     let mut args = ~[];
     for i in range(0u, argc as uint) {
-        args.push(str::raw::from_c_str(*argv.offset(i as int)));
+        args.push(CString::new(*argv.offset(i as int), false).as_bytes_no_nul().to_owned())
     }
     args
 }
@@ -736,7 +785,7 @@ unsafe fn load_argc_and_argv(argc: int, argv: **c_char) -> ~[~str] {
  * Returns a list of the command line arguments.
  */
 #[cfg(target_os = "macos")]
-fn real_args() -> ~[~str] {
+fn real_args_as_bytes() -> ~[~[u8]] {
     unsafe {
         let (argc, argv) = (*_NSGetArgc() as int,
                             *_NSGetArgv() as **c_char);
@@ -747,7 +796,7 @@ fn real_args() -> ~[~str] {
 #[cfg(target_os = "linux")]
 #[cfg(target_os = "android")]
 #[cfg(target_os = "freebsd")]
-fn real_args() -> ~[~str] {
+fn real_args_as_bytes() -> ~[~[u8]] {
     use rt;
 
     match rt::args::clone() {
@@ -756,6 +805,11 @@ fn real_args() -> ~[~str] {
     }
 }
 
+#[cfg(not(windows))]
+fn real_args() -> ~[~str] {
+    real_args_as_bytes().move_iter().map(|v| str::from_utf8_lossy(v).into_owned()).collect()
+}
+
 #[cfg(windows)]
 fn real_args() -> ~[~str] {
     use vec;
@@ -786,6 +840,11 @@ fn real_args() -> ~[~str] {
     return args;
 }
 
+#[cfg(windows)]
+fn real_args_as_bytes() -> ~[~[u8]] {
+    real_args().move_iter().map(|s| s.into_bytes()).collect()
+}
+
 type LPCWSTR = *u16;
 
 #[cfg(windows)]
@@ -803,10 +862,19 @@ fn real_args() -> ~[~str] {
 
 /// Returns the arguments which this program was started with (normally passed
 /// via the command line).
+///
+/// The arguments are interpreted as utf-8, with invalid bytes replaced with \uFFFD.
+/// See `str::from_utf8_lossy` for details.
 pub fn args() -> ~[~str] {
     real_args()
 }
 
+/// Returns the arguments which this program was started with (normally passed
+/// via the command line) as byte vectors.
+pub fn args_as_bytes() -> ~[~[u8]] {
+    real_args_as_bytes()
+}
+
 #[cfg(target_os = "macos")]
 extern {
     // These functions are in crt_externs.h.
index ed0ce20175086028e921520fc944b5b47ae0208e..13496033fd0e539ddaec35b6cadba0dc5717aec4 100644 (file)
@@ -578,8 +578,7 @@ fn container_into_owned_bytes(self) -> ~[u8] {
 impl BytesContainer for CString {
     #[inline]
     fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
-        let s = self.as_bytes();
-        s.slice_to(s.len()-1)
+        self.as_bytes_no_nul()
     }
 }
 
index 3eaa1db87bafdc7464f06231190df99b4372fc30..bd21bb4e75444a5b5fd58ea0dfc3f8e51c1113c5 100644 (file)
 pub use str::{Str, StrVector, StrSlice, OwnedStr, IntoMaybeOwned};
 pub use to_bytes::IterBytes;
 pub use to_str::{ToStr, IntoStr};
-pub use tuple::{CloneableTuple, ImmutableTuple};
-pub use tuple::{ImmutableTuple1, ImmutableTuple2, ImmutableTuple3, ImmutableTuple4};
-pub use tuple::{ImmutableTuple5, ImmutableTuple6, ImmutableTuple7, ImmutableTuple8};
-pub use tuple::{ImmutableTuple9, ImmutableTuple10, ImmutableTuple11, ImmutableTuple12};
 pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
 pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
 pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
index 2ba6f7d4fd64d93fa45c48cb8753269b5d9151e9..037984d9e7fc775d1948f38976431fcd411551ef 100644 (file)
@@ -102,10 +102,10 @@ pub unsafe fn zero_memory<T>(dst: *mut T, count: uint) {
 
 /**
  * Swap the values at two mutable locations of the same type, without
- * deinitialising or copying either one.
+ * deinitialising either. They may overlap.
  */
 #[inline]
-pub unsafe fn swap_ptr<T>(x: *mut T, y: *mut T) {
+pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
     // Give ourselves some scratch space to work with
     let mut tmp: T = mem::uninit();
     let t: *mut T = &mut tmp;
@@ -122,19 +122,19 @@ pub unsafe fn swap_ptr<T>(x: *mut T, y: *mut T) {
 
 /**
  * Replace the value at a mutable location with a new one, returning the old
- * value, without deinitialising or copying either one.
+ * value, without deinitialising either.
  */
 #[inline]
-pub unsafe fn replace_ptr<T>(dest: *mut T, mut src: T) -> T {
+pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
     mem::swap(cast::transmute(dest), &mut src); // cannot overlap
     src
 }
 
 /**
- * Reads the value from `*src` and returns it. Does not copy `*src`.
+ * Reads the value from `*src` and returns it.
  */
 #[inline(always)]
-pub unsafe fn read_ptr<T>(src: *T) -> T {
+pub unsafe fn read<T>(src: *T) -> T {
     let mut tmp: T = mem::uninit();
     copy_nonoverlapping_memory(&mut tmp, src, 1);
     tmp
@@ -145,9 +145,9 @@ pub unsafe fn read_ptr<T>(src: *T) -> T {
  * This currently prevents destructors from executing.
  */
 #[inline(always)]
-pub unsafe fn read_and_zero_ptr<T>(dest: *mut T) -> T {
+pub unsafe fn read_and_zero<T>(dest: *mut T) -> T {
     // Copy the data out from `dest`:
-    let tmp = read_ptr(&*dest);
+    let tmp = read(&*dest);
 
     // Now zero out `dest`:
     zero_memory(dest, 1);
@@ -155,18 +155,6 @@ pub unsafe fn read_and_zero_ptr<T>(dest: *mut T) -> T {
     tmp
 }
 
-/// Transform a region pointer - &T - to an unsafe pointer - *T.
-#[inline]
-pub fn to_unsafe_ptr<T>(thing: &T) -> *T {
-    thing as *T
-}
-
-/// Transform a mutable region pointer - &mut T - to a mutable unsafe pointer - *mut T.
-#[inline]
-pub fn to_mut_unsafe_ptr<T>(thing: &mut T) -> *mut T {
-    thing as *mut T
-}
-
 /**
   Given a **T (pointer to an array of pointers),
   iterate through each *T, up to the provided `len`,
@@ -176,7 +164,7 @@ pub fn to_mut_unsafe_ptr<T>(thing: &mut T) -> *mut T {
 */
 pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: |*T|) {
     debug!("array_each_with_len: before iterate");
-    if arr as uint == 0 {
+    if arr.is_null() {
         fail!("ptr::array_each_with_len failure: arr input is null pointer");
     }
     //let start_ptr = *arr;
@@ -197,7 +185,7 @@ pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: |*T|) {
   Dragons be here.
 */
 pub unsafe fn array_each<T>(arr: **T, cb: |*T|) {
-    if arr as uint == 0 {
+    if arr.is_null()  {
         fail!("ptr::array_each_with_len failure: arr input is null pointer");
     }
     let len = buf_len(arr);
@@ -205,100 +193,74 @@ pub unsafe fn array_each<T>(arr: **T, cb: |*T|) {
     array_each_with_len(arr, len, cb);
 }
 
-#[allow(missing_doc)]
+/// Extension methods for raw pointers.
 pub trait RawPtr<T> {
+    /// Returns the null pointer.
     fn null() -> Self;
+    /// Returns true if the pointer is equal to the null pointer.
     fn is_null(&self) -> bool;
-    fn is_not_null(&self) -> bool;
+    /// Returns true if the pointer is not equal to the null pointer.
+    fn is_not_null(&self) -> bool { !self.is_null() }
+    /// Returns the value of this pointer (ie, the address it points to)
     fn to_uint(&self) -> uint;
+    /// Returns `None` if the pointer is null, or else returns the value wrapped
+    /// in `Some`.
+    ///
+    /// # Safety Notes
+    ///
+    /// While this method is useful for null-safety, it is important to note
+    /// that this is still an unsafe operation because the returned value could
+    /// be pointing to invalid memory.
     unsafe fn to_option(&self) -> Option<&T>;
+    /// Calculates the offset from a pointer. The offset *must* be in-bounds of
+    /// the object, or one-byte-past-the-end.
     unsafe fn offset(self, count: int) -> Self;
 }
 
-/// Extension methods for immutable pointers
 impl<T> RawPtr<T> for *T {
-    /// Returns the null pointer.
     #[inline]
     fn null() -> *T { null() }
 
-    /// Returns true if the pointer is equal to the null pointer.
     #[inline]
     fn is_null(&self) -> bool { *self == RawPtr::null() }
 
-    /// Returns true if the pointer is not equal to the null pointer.
     #[inline]
-    fn is_not_null(&self) -> bool { *self != RawPtr::null() }
+    fn to_uint(&self) -> uint { *self as uint }
 
-    /// Returns the address of this pointer.
     #[inline]
-    fn to_uint(&self) -> uint { *self as uint }
+    unsafe fn offset(self, count: int) -> *T { intrinsics::offset(self, count) }
 
-    ///
-    /// Returns `None` if the pointer is null, or else returns the value wrapped
-    /// in `Some`.
-    ///
-    /// # Safety Notes
-    ///
-    /// While this method is useful for null-safety, it is important to note
-    /// that this is still an unsafe operation because the returned value could
-    /// be pointing to invalid memory.
-    ///
     #[inline]
     unsafe fn to_option(&self) -> Option<&T> {
-        if self.is_null() { None } else {
+        if self.is_null() {
+            None
+        } else {
             Some(cast::transmute(*self))
         }
     }
-
-    /// Calculates the offset from a pointer. The offset *must* be in-bounds of
-    /// the object, or one-byte-past-the-end.
-    #[inline]
-    unsafe fn offset(self, count: int) -> *T { intrinsics::offset(self, count) }
 }
 
-/// Extension methods for mutable pointers
 impl<T> RawPtr<T> for *mut T {
-    /// Returns the null pointer.
     #[inline]
     fn null() -> *mut T { mut_null() }
 
-    /// Returns true if the pointer is equal to the null pointer.
     #[inline]
     fn is_null(&self) -> bool { *self == RawPtr::null() }
 
-    /// Returns true if the pointer is not equal to the null pointer.
     #[inline]
-    fn is_not_null(&self) -> bool { *self != RawPtr::null() }
+    fn to_uint(&self) -> uint { *self as uint }
 
-    /// Returns the address of this pointer.
     #[inline]
-    fn to_uint(&self) -> uint { *self as uint }
+    unsafe fn offset(self, count: int) -> *mut T { intrinsics::offset(self as *T, count) as *mut T }
 
-    ///
-    /// Returns `None` if the pointer is null, or else returns the value wrapped
-    /// in `Some`.
-    ///
-    /// # Safety Notes
-    ///
-    /// While this method is useful for null-safety, it is important to note
-    /// that this is still an unsafe operation because the returned value could
-    /// be pointing to invalid memory.
-    ///
     #[inline]
     unsafe fn to_option(&self) -> Option<&T> {
-        if self.is_null() { None } else {
+        if self.is_null() {
+            None
+        } else {
             Some(cast::transmute(*self))
         }
     }
-
-    /// Calculates the offset from a pointer. The offset *must* be in-bounds of
-    /// the object, or one-byte-past-the-end. An arithmetic overflow is also
-    /// undefined behaviour.
-    ///
-    /// This method should be preferred over `offset` when the guarantee can be
-    /// satisfied, to enable better optimization.
-    #[inline]
-    unsafe fn offset(self, count: int) -> *mut T { intrinsics::offset(self as *T, count) as *mut T }
 }
 
 // Equality for pointers
index 2f1890b02333c4088f67fa14e340bb79f14af4fd..0915d49945dc5a00835f33cf4463e710c9fd90a2 100644 (file)
@@ -20,7 +20,7 @@
 ///
 /// The density function of this distribution is
 ///
-/// ```
+/// ```ignore
 /// f(x) =  x^(k - 1) * exp(-x / θ) / (Γ(k) * θ^k)
 /// ```
 ///
index a1565bc85dede8c4fb5e9bcee0f64e5eedad73ff..ea3d5e0edac0186e3f04214c3a3ff1c0567dc67b 100644 (file)
 */
 
 use cast::transmute;
-use ops::Drop;
-use cmp::{Eq, Ord};
 use clone::{Clone, DeepClone};
+use cmp::{Eq, Ord};
 use kinds::marker;
-use rt::global_heap::exchange_free;
-use ptr::read_ptr;
+use ops::Drop;
 use option::{Option, Some, None};
+use ptr;
+use rt::global_heap::exchange_free;
 
 struct RcBox<T> {
     value: T,
@@ -85,7 +85,7 @@ fn drop(&mut self) {
             if self.ptr != 0 as *mut RcBox<T> {
                 (*self.ptr).strong -= 1;
                 if (*self.ptr).strong == 0 {
-                    read_ptr(self.borrow()); // destroy the contained object
+                    ptr::read(self.borrow()); // destroy the contained object
 
                     // remove the implicit "strong weak" pointer now
                     // that we've destroyed the contents.
index 58c00177b90165578dd5f0bf23000352ee355125..fb2053ddaf61594206962cec3d1f7e158e8c9f1a 100644 (file)
@@ -22,7 +22,6 @@
 use io;
 use iter::Iterator;
 use option::{Some, None, Option};
-use ptr;
 use ptr::RawPtr;
 use reflect;
 use reflect::{MovePtr, align};
@@ -230,7 +229,7 @@ pub fn write_vec_range(&mut self, ptr: *(), len: uint, inner: *TyDesc) -> bool {
     }
 
     pub fn write_unboxed_vec_repr(&mut self, _: uint, v: &raw::Vec<()>, inner: *TyDesc) -> bool {
-        self.write_vec_range(ptr::to_unsafe_ptr(&v.data), v.fill, inner)
+        self.write_vec_range(&v.data, v.fill, inner)
     }
 
     fn write_escaped_char(&mut self, ch: char, is_str: bool) -> bool {
@@ -319,7 +318,7 @@ fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
         if_ok!(self, self.writer.write(['@' as u8]));
         self.write_mut_qualifier(mtbl);
         self.get::<&raw::Box<()>>(|this, b| {
-            let p = ptr::to_unsafe_ptr(&b.data) as *u8;
+            let p = &b.data as *() as *u8;
             this.visit_ptr_inner(p, inner)
         })
     }
@@ -387,7 +386,7 @@ fn visit_evec_fixed(&mut self, n: uint, sz: uint, _align: uint,
                         _: uint, inner: *TyDesc) -> bool {
         let assumed_size = if sz == 0 { n } else { sz };
         self.get::<()>(|this, b| {
-            this.write_vec_range(ptr::to_unsafe_ptr(b), assumed_size, inner)
+            this.write_vec_range(b, assumed_size, inner)
         })
     }
 
@@ -606,7 +605,7 @@ fn visit_self(&mut self) -> bool { true }
 
 pub fn write_repr<T>(writer: &mut io::Writer, object: &T) -> io::IoResult<()> {
     unsafe {
-        let ptr = ptr::to_unsafe_ptr(object) as *u8;
+        let ptr = object as *T as *u8;
         let tydesc = get_tydesc::<T>();
         let u = ReprVisitor(ptr, writer);
         let mut v = reflect::MovePtrAdaptor(u);
index cef03d66923af718a52b5a27e2b0b65750f3ad5c..6f73265978bf4ecc4faa6f428b0aa59787576e4f 100644 (file)
@@ -36,8 +36,8 @@ pub unsafe fn init(argc: int, argv: **u8) { realargs::init(argc, argv) }
 #[cfg(test)]      pub unsafe fn cleanup() { realargs::cleanup() }
 
 /// Take the global arguments from global storage.
-#[cfg(not(test))] pub fn take() -> Option<~[~str]> { imp::take() }
-#[cfg(test)]      pub fn take() -> Option<~[~str]> {
+#[cfg(not(test))] pub fn take() -> Option<~[~[u8]]> { imp::take() }
+#[cfg(test)]      pub fn take() -> Option<~[~[u8]]> {
     match realargs::take() {
         realstd::option::Some(a) => Some(a),
         realstd::option::None => None,
@@ -47,12 +47,12 @@ pub unsafe fn init(argc: int, argv: **u8) { realargs::init(argc, argv) }
 /// Give the global arguments to global storage.
 ///
 /// It is an error if the arguments already exist.
-#[cfg(not(test))] pub fn put(args: ~[~str]) { imp::put(args) }
-#[cfg(test)]      pub fn put(args: ~[~str]) { realargs::put(args) }
+#[cfg(not(test))] pub fn put(args: ~[~[u8]]) { imp::put(args) }
+#[cfg(test)]      pub fn put(args: ~[~[u8]]) { realargs::put(args) }
 
 /// Make a clone of the global arguments.
-#[cfg(not(test))] pub fn clone() -> Option<~[~str]> { imp::clone() }
-#[cfg(test)]      pub fn clone() -> Option<~[~str]> {
+#[cfg(not(test))] pub fn clone() -> Option<~[~[u8]]> { imp::clone() }
+#[cfg(test)]      pub fn clone() -> Option<~[~[u8]]> {
     match realargs::clone() {
         realstd::option::Some(a) => Some(a),
         realstd::option::None => None,
@@ -65,18 +65,14 @@ pub unsafe fn init(argc: int, argv: **u8) { realargs::init(argc, argv) }
 mod imp {
     use cast;
     use clone::Clone;
-    #[cfg(not(test))] use libc;
     use option::{Option, Some, None};
     use ptr::RawPtr;
     use iter::Iterator;
-    #[cfg(not(test))] use str;
-    use unstable::finally::Finally;
-    use unstable::mutex::{Mutex, MUTEX_INIT};
+    use unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
     use mem;
-    #[cfg(not(test))] use vec;
 
     static mut global_args_ptr: uint = 0;
-    static mut lock: Mutex = MUTEX_INIT;
+    static mut lock: StaticNativeMutex = NATIVE_MUTEX_INIT;
 
     #[cfg(not(test))]
     pub unsafe fn init(argc: int, argv: **u8) {
@@ -90,15 +86,15 @@ pub unsafe fn cleanup() {
         lock.destroy();
     }
 
-    pub fn take() -> Option<~[~str]> {
+    pub fn take() -> Option<~[~[u8]]> {
         with_lock(|| unsafe {
             let ptr = get_global_ptr();
             let val = mem::replace(&mut *ptr, None);
-            val.as_ref().map(|s: &~~[~str]| (**s).clone())
+            val.as_ref().map(|s: &~~[~[u8]]| (**s).clone())
         })
     }
 
-    pub fn put(args: ~[~str]) {
+    pub fn put(args: ~[~[u8]]) {
         with_lock(|| unsafe {
             let ptr = get_global_ptr();
             rtassert!((*ptr).is_none());
@@ -106,35 +102,34 @@ pub fn put(args: ~[~str]) {
         })
     }
 
-    pub fn clone() -> Option<~[~str]> {
+    pub fn clone() -> Option<~[~[u8]]> {
         with_lock(|| unsafe {
             let ptr = get_global_ptr();
-            (*ptr).as_ref().map(|s: &~~[~str]| (**s).clone())
+            (*ptr).as_ref().map(|s: &~~[~[u8]]| (**s).clone())
         })
     }
 
     fn with_lock<T>(f: || -> T) -> T {
-        (|| {
-            unsafe {
-                lock.lock();
-                f()
-            }
-        }).finally(|| {
-            unsafe {
-                lock.unlock();
-            }
-        })
+        unsafe {
+            let _guard = lock.lock();
+            f()
+        }
     }
 
-    fn get_global_ptr() -> *mut Option<~~[~str]> {
+    fn get_global_ptr() -> *mut Option<~~[~[u8]]> {
         unsafe { cast::transmute(&global_args_ptr) }
     }
 
     // Copied from `os`.
     #[cfg(not(test))]
-    unsafe fn load_argc_and_argv(argc: int, argv: **u8) -> ~[~str] {
+    unsafe fn load_argc_and_argv(argc: int, argv: **u8) -> ~[~[u8]] {
+        use c_str::CString;
+        use {vec, libc};
+        use vec::CloneableVector;
+
         vec::from_fn(argc as uint, |i| {
-            str::raw::from_c_str(*(argv as **libc::c_char).offset(i as int))
+            let cs = CString::new(*(argv as **libc::c_char).offset(i as int), false);
+            cs.as_bytes_no_nul().to_owned()
         })
     }
 
@@ -149,7 +144,7 @@ fn smoke_test() {
             // Preserve the actual global state.
             let saved_value = take();
 
-            let expected = ~[~"happy", ~"today?"];
+            let expected = ~[bytes!("happy").to_owned(), bytes!("today?").to_owned()];
 
             put(expected.clone());
             assert!(clone() == Some(expected.clone()));
@@ -179,15 +174,15 @@ pub unsafe fn init(_argc: int, _argv: **u8) {
     pub fn cleanup() {
     }
 
-    pub fn take() -> Option<~[~str]> {
+    pub fn take() -> Option<~[~[u8]]> {
         fail!()
     }
 
-    pub fn put(_args: ~[~str]) {
+    pub fn put(_args: ~[~[u8]]) {
         fail!()
     }
 
-    pub fn clone() -> Option<~[~str]> {
+    pub fn clone() -> Option<~[~[u8]]> {
         fail!()
     }
 }
index 571ed77592fcc7a0a94415f5c922174b19222b7a..94f56d42613fd7ee26158db6bb4df7ec6fd8e44b 100644 (file)
@@ -10,8 +10,6 @@
 
 //! Runtime environment settings
 
-// NOTE: remove `POISON_ON_FREE` after a snapshot
-
 use from_str::from_str;
 use option::{Some, None};
 use os;
@@ -23,7 +21,6 @@
 /// This default corresponds to 20M of cache per scheduler (at the default size).
 static mut MAX_CACHED_STACKS: uint = 10;
 static mut DEBUG_BORROW: bool = false;
-static mut POISON_ON_FREE: bool = false;
 
 pub fn init() {
     unsafe {
@@ -43,10 +40,6 @@ pub fn init() {
             Some(_) => DEBUG_BORROW = true,
             None => ()
         }
-        match os::getenv("RUST_POISON_ON_FREE") {
-            Some(_) => POISON_ON_FREE = true,
-            None => ()
-        }
     }
 }
 
@@ -61,7 +54,3 @@ pub fn max_cached_stacks() -> uint {
 pub fn debug_borrow() -> bool {
     unsafe { DEBUG_BORROW }
 }
-
-pub fn poison_on_free() -> bool {
-    unsafe { POISON_ON_FREE }
-}
index 7acce2ecb5ba95baaf3a5c4c2287dc723a00dec8..f3474b9401e1a2562db2549d7e24abc08930a0d5 100644 (file)
@@ -17,7 +17,6 @@
 use option::{Option, None, Some};
 use ptr;
 use ptr::RawPtr;
-use rt::env;
 use rt::global_heap;
 use rt::local::Local;
 use rt::task::Task;
@@ -41,7 +40,6 @@ pub struct MemoryRegion {
 pub struct LocalHeap {
     priv memory_region: MemoryRegion,
 
-    priv poison_on_free: bool,
     priv live_allocs: *mut raw::Box<()>,
 }
 
@@ -54,7 +52,6 @@ pub fn new() -> LocalHeap {
         };
         LocalHeap {
             memory_region: region,
-            poison_on_free: env::poison_on_free(),
             live_allocs: ptr::mut_null(),
         }
     }
index 6f684f23d4760f98834ee352802373260bc7c994..9ea8f6447dd6a96828bb4dbcb4140fcc0a4b42f4 100644 (file)
@@ -88,6 +88,20 @@ pub struct ProcessOptions<'a> {
      * and Process.error() will fail.
      */
     err_fd: Option<c_int>,
+
+    /// The uid to assume for the child process. For more information, see the
+    /// documentation in `io::process::ProcessConfig` about this field.
+    uid: Option<uint>,
+
+    /// The gid to assume for the child process. For more information, see the
+    /// documentation in `io::process::ProcessConfig` about this field.
+    gid: Option<uint>,
+
+    /// Flag as to whether the child process will be the leader of a new process
+    /// group or not. This allows the parent process to exit while the child is
+    /// still running. For more information, see the documentation in
+    /// `io::process::ProcessConfig` about this field.
+    detach: bool,
 }
 
 impl <'a> ProcessOptions<'a> {
@@ -99,6 +113,9 @@ pub fn new<'a>() -> ProcessOptions<'a> {
             in_fd: None,
             out_fd: None,
             err_fd: None,
+            uid: None,
+            gid: None,
+            detach: false,
         }
     }
 }
@@ -128,7 +145,9 @@ impl Process {
      */
     pub fn new(prog: &str, args: &[~str],
                options: ProcessOptions) -> io::IoResult<Process> {
-        let ProcessOptions { env, dir, in_fd, out_fd, err_fd } = options;
+        let ProcessOptions {
+            env, dir, in_fd, out_fd, err_fd, uid, gid, detach
+        } = options;
         let env = env.as_ref().map(|a| a.as_slice());
         let cwd = dir.as_ref().map(|a| a.as_str().unwrap());
         fn rtify(fd: Option<c_int>, input: bool) -> process::StdioContainer {
@@ -145,6 +164,9 @@ fn rtify(fd: Option<c_int>, input: bool) -> process::StdioContainer {
             env: env,
             cwd: cwd,
             io: rtio,
+            uid: uid,
+            gid: gid,
+            detach: detach,
         };
         process::Process::new(rtconfig).map(|p| Process { inner: p })
     }
@@ -302,11 +324,10 @@ pub fn force_destroy(&mut self) -> io::IoResult<()> {
  */
 pub fn process_status(prog: &str, args: &[~str]) -> io::IoResult<ProcessExit> {
     Process::new(prog, args, ProcessOptions {
-        env: None,
-        dir: None,
         in_fd: Some(unsafe { libc::dup(libc::STDIN_FILENO) }),
         out_fd: Some(unsafe { libc::dup(libc::STDOUT_FILENO) }),
-        err_fd: Some(unsafe { libc::dup(libc::STDERR_FILENO) })
+        err_fd: Some(unsafe { libc::dup(libc::STDERR_FILENO) }),
+        .. ProcessOptions::new()
     }).map(|mut p| p.finish())
 }
 
@@ -396,11 +417,10 @@ fn test_pipes() {
         let pipe_err = os::pipe();
 
         let mut process = run::Process::new("cat", [], run::ProcessOptions {
-            dir: None,
-            env: None,
             in_fd: Some(pipe_in.input),
             out_fd: Some(pipe_out.out),
-            err_fd: Some(pipe_err.out)
+            err_fd: Some(pipe_err.out),
+            .. run::ProcessOptions::new()
         }).unwrap();
 
         os::close(pipe_in.input as int);
index 063182ff0e1d9fa1e7dfc69735a9d69720a40cb1..0a7f513581c0db0c31014cae742555b2d040711f 100644 (file)
@@ -567,14 +567,14 @@ fn next(&mut self) -> Option<&'a str> {
 // Helper functions used for Unicode normalization
 fn canonical_sort(comb: &mut [(char, u8)]) {
     use iter::range;
-    use tuple::CloneableTuple;
+    use tuple::Tuple2;
 
     let len = comb.len();
     for i in range(0, len) {
         let mut swapped = false;
         for j in range(1, len-i) {
-            let classA = comb[j-1].second();
-            let classB = comb[j].second();
+            let classA = *comb[j-1].ref1();
+            let classB = *comb[j].ref1();
             if classA != 0 && classB != 0 && classA > classB {
                 comb.swap(j-1, j);
                 swapped = true;
@@ -2011,7 +2011,7 @@ pub trait StrSlice<'a> {
     ///
     /// ## Output
     ///
-    /// ```
+    /// ```ignore
     /// 0: 中
     /// 3: 华
     /// 6: V
index 7feff127d691a029511e7af37995d1b7b6bfc761..7ce760040e65ec0046b1ecc35665761e6cbff202 100644 (file)
@@ -363,7 +363,7 @@ fn mask(&self) -> int { (1 << self.log_size) - 1 }
     // very unsafe method which the caller needs to treat specially in case a
     // race is lost.
     unsafe fn get(&self, i: int) -> T {
-        ptr::read_ptr(self.storage.offset(i & self.mask()))
+        ptr::read(self.storage.offset(i & self.mask()))
     }
 
     // Unsafe because this unsafely overwrites possibly uninitialized or
index 5d8c4a87b39357e1028f1e5036b9fcc48e5d38d8..ceccd918140d6c0283d99d67063f8a35bc72bb7f 100644 (file)
@@ -46,7 +46,7 @@
  *
  * ```
  * spawn(proc() {
- *     log(error, "Hello, World!");
+ *     println!("Hello, World!");
  * })
  * ```
  */
@@ -65,7 +65,6 @@
 use str::{Str, SendStr, IntoMaybeOwned};
 
 #[cfg(test)] use any::{AnyOwnExt, AnyRefExt};
-#[cfg(test)] use ptr;
 #[cfg(test)] use result;
 
 /// Indicates the manner in which a task exited.
@@ -509,10 +508,10 @@ fn avoid_copying_the_body(spawnfn: |v: proc()|) {
     let (p, ch) = Chan::<uint>::new();
 
     let x = ~1;
-    let x_in_parent = ptr::to_unsafe_ptr(&*x) as uint;
+    let x_in_parent = (&*x) as *int as uint;
 
     spawnfn(proc() {
-        let x_in_child = ptr::to_unsafe_ptr(&*x) as uint;
+        let x_in_child = (&*x) as *int as uint;
         ch.send(x_in_child);
     });
 
index 87d59f0979194841bb28f827fc42c7bf8a45fc91..ab14e9f566778664caad83207aa7744b54dbbf7b 100644 (file)
@@ -40,17 +40,6 @@ impl ToStr for () {
     fn to_str(&self) -> ~str { ~"()" }
 }
 
-impl<A:ToStr> ToStr for (A,) {
-    #[inline]
-    fn to_str(&self) -> ~str {
-        match *self {
-            (ref a,) => {
-                format!("({},)", (*a).to_str())
-            }
-        }
-    }
-}
-
 impl<A:ToStr+Hash+Eq, B:ToStr> ToStr for HashMap<A, B> {
     #[inline]
     fn to_str(&self) -> ~str {
@@ -91,36 +80,6 @@ fn to_str(&self) -> ~str {
     }
 }
 
-impl<A:ToStr,B:ToStr> ToStr for (A, B) {
-    #[inline]
-    fn to_str(&self) -> ~str {
-        // FIXME(#4653): this causes an llvm assertion
-        //let &(ref a, ref b) = self;
-        match *self {
-            (ref a, ref b) => {
-                format!("({}, {})", (*a).to_str(), (*b).to_str())
-            }
-        }
-    }
-}
-
-impl<A:ToStr,B:ToStr,C:ToStr> ToStr for (A, B, C) {
-    #[inline]
-    fn to_str(&self) -> ~str {
-        // FIXME(#4653): this causes an llvm assertion
-        //let &(ref a, ref b, ref c) = self;
-        match *self {
-            (ref a, ref b, ref c) => {
-                format!("({}, {}, {})",
-                    (*a).to_str(),
-                    (*b).to_str(),
-                    (*c).to_str()
-                )
-            }
-        }
-    }
-}
-
 impl<'a,A:ToStr> ToStr for &'a [A] {
     #[inline]
     fn to_str(&self) -> ~str {
@@ -178,13 +137,6 @@ fn test_simple_types() {
         assert_eq!((~"hi").to_str(), ~"hi");
     }
 
-    #[test]
-    fn test_tuple_types() {
-        assert_eq!((1, 2).to_str(), ~"(1, 2)");
-        assert_eq!((~"a", ~"b", false).to_str(), ~"(a, b, false)");
-        assert_eq!(((), ((), 100)).to_str(), ~"((), ((), 100))");
-    }
-
     #[test]
     fn test_vectors() {
         let x: ~[int] = ~[];
index 33d23df242ce2dd61a9110f173429773eb8160a5..7a81e69f30ac8b717c8f68f00593692dd0f31c3b 100644 (file)
 use clone::Clone;
 #[cfg(not(test))] use cmp::*;
 #[cfg(not(test))] use default::Default;
-
-/// Method extensions to pairs where both types satisfy the `Clone` bound
-pub trait CloneableTuple<T, U> {
-    /// Return the first element of self
-    fn first(&self) -> T;
-    /// Return the second element of self
-    fn second(&self) -> U;
-    /// Return the results of swapping the two elements of self
-    fn swap(&self) -> (U, T);
-}
-
-impl<T:Clone,U:Clone> CloneableTuple<T, U> for (T, U) {
-    /// Return the first element of self
-    #[inline]
-    fn first(&self) -> T {
-        match *self {
-            (ref t, _) => (*t).clone(),
-        }
-    }
-
-    /// Return the second element of self
-    #[inline]
-    fn second(&self) -> U {
-        match *self {
-            (_, ref u) => (*u).clone(),
-        }
-    }
-
-    /// Return the results of swapping the two elements of self
-    #[inline]
-    fn swap(&self) -> (U, T) {
-        match (*self).clone() {
-            (t, u) => (u, t),
-        }
-    }
-}
-
-/// Method extensions for pairs where the types don't necessarily satisfy the
-/// `Clone` bound
-pub trait ImmutableTuple<T, U> {
-    /// Return a reference to the first element of self
-    fn first_ref<'a>(&'a self) -> &'a T;
-    /// Return a reference to the second element of self
-    fn second_ref<'a>(&'a self) -> &'a U;
-}
-
-impl<T, U> ImmutableTuple<T, U> for (T, U) {
-    #[inline]
-    fn first_ref<'a>(&'a self) -> &'a T {
-        match *self {
-            (ref t, _) => t,
-        }
-    }
-    #[inline]
-    fn second_ref<'a>(&'a self) -> &'a U {
-        match *self {
-            (_, ref u) => u,
-        }
-    }
-}
+use fmt;
+use result::{Ok, Err};
+use to_str::ToStr;
 
 // macro for implementing n-ary tuple functions and operations
-
 macro_rules! tuple_impls {
     ($(
-        ($move_trait:ident, $immutable_trait:ident) {
-            $(($get_fn:ident, $get_ref_fn:ident) -> $T:ident {
-                $move_pattern:pat, $ref_pattern:pat => $ret:expr
+        $Tuple:ident {
+            $(($valN:ident, $refN:ident, $mutN:ident) -> $T:ident {
+                ($($x:ident),+) => $ret:expr
             })+
         }
     )+) => {
         $(
-            pub trait $move_trait<$($T),+> {
-                $(fn $get_fn(self) -> $T;)+
+            pub trait $Tuple<$($T),+> {
+                $(fn $valN(self) -> $T;)+
+                $(fn $refN<'a>(&'a self) -> &'a $T;)+
+                $(fn $mutN<'a>(&'a mut self) -> &'a mut $T;)+
             }
 
-            impl<$($T),+> $move_trait<$($T),+> for ($($T,)+) {
+            impl<$($T),+> $Tuple<$($T),+> for ($($T,)+) {
                 $(
                     #[inline]
-                    fn $get_fn(self) -> $T {
-                        let $move_pattern = self;
-                        $ret
+                    #[allow(unused_variable)]
+                    fn $valN(self) -> $T {
+                        let ($($x,)+) = self; $ret
                     }
-                )+
-            }
 
-            pub trait $immutable_trait<$($T),+> {
-                $(fn $get_ref_fn<'a>(&'a self) -> &'a $T;)+
-            }
+                    #[inline]
+                    #[allow(unused_variable)]
+                    fn $refN<'a>(&'a self) -> &'a $T {
+                        let ($(ref $x,)+) = *self; $ret
+                    }
 
-            impl<$($T),+> $immutable_trait<$($T),+> for ($($T,)+) {
-                $(
                     #[inline]
-                    fn $get_ref_fn<'a>(&'a self) -> &'a $T {
-                        let $ref_pattern = *self;
-                        $ret
+                    #[allow(unused_variable)]
+                    fn $mutN<'a>(&'a mut self) -> &'a mut $T {
+                        let ($(ref mut $x,)+) = *self; $ret
                     }
                 )+
             }
 
             impl<$($T:Clone),+> Clone for ($($T,)+) {
                 fn clone(&self) -> ($($T,)+) {
-                    ($(self.$get_ref_fn().clone(),)+)
+                    ($(self.$refN().clone(),)+)
                 }
             }
 
@@ -125,11 +67,11 @@ fn clone(&self) -> ($($T,)+) {
             impl<$($T:Eq),+> Eq for ($($T,)+) {
                 #[inline]
                 fn eq(&self, other: &($($T,)+)) -> bool {
-                    $(*self.$get_ref_fn() == *other.$get_ref_fn())&&+
+                    $(*self.$refN() == *other.$refN())&&+
                 }
                 #[inline]
                 fn ne(&self, other: &($($T,)+)) -> bool {
-                    $(*self.$get_ref_fn() != *other.$get_ref_fn())||+
+                    $(*self.$refN() != *other.$refN())||+
                 }
             }
 
@@ -137,7 +79,7 @@ fn ne(&self, other: &($($T,)+)) -> bool {
             impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {
                 #[inline]
                 fn equals(&self, other: &($($T,)+)) -> bool {
-                    $(self.$get_ref_fn().equals(other.$get_ref_fn()))&&+
+                    $(self.$refN().equals(other.$refN()))&&+
                 }
             }
 
@@ -145,19 +87,19 @@ fn equals(&self, other: &($($T,)+)) -> bool {
             impl<$($T:Ord + Eq),+> Ord for ($($T,)+) {
                 #[inline]
                 fn lt(&self, other: &($($T,)+)) -> bool {
-                    lexical_ord!(lt, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
+                    lexical_ord!(lt, $(self.$refN(), other.$refN()),+)
                 }
                 #[inline]
                 fn le(&self, other: &($($T,)+)) -> bool {
-                    lexical_ord!(le, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
+                    lexical_ord!(le, $(self.$refN(), other.$refN()),+)
                 }
                 #[inline]
                 fn ge(&self, other: &($($T,)+)) -> bool {
-                    lexical_ord!(ge, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
+                    lexical_ord!(ge, $(self.$refN(), other.$refN()),+)
                 }
                 #[inline]
                 fn gt(&self, other: &($($T,)+)) -> bool {
-                    lexical_ord!(gt, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
+                    lexical_ord!(gt, $(self.$refN(), other.$refN()),+)
                 }
             }
 
@@ -165,7 +107,7 @@ fn gt(&self, other: &($($T,)+)) -> bool {
             impl<$($T:TotalOrd),+> TotalOrd for ($($T,)+) {
                 #[inline]
                 fn cmp(&self, other: &($($T,)+)) -> Ordering {
-                    lexical_cmp!($(self.$get_ref_fn(), other.$get_ref_fn()),+)
+                    lexical_cmp!($(self.$refN(), other.$refN()),+)
                 }
             }
 
@@ -176,6 +118,18 @@ fn default() -> ($($T,)+) {
                     ($({ let x: $T = Default::default(); x},)+)
                 }
             }
+
+            impl<$($T: fmt::Show),+> ToStr for ($($T,)+) {
+                fn to_str(&self) -> ~str {
+                    format!("{}", *self)
+                }
+            }
+
+            impl<$($T: fmt::Show),+> fmt::Show for ($($T,)+) {
+                fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+                    write_tuple!(f.buf, $(self.$refN()),+)
+                }
+            }
         )+
     }
 }
@@ -202,120 +156,120 @@ macro_rules! lexical_cmp {
     ($a:expr, $b:expr) => { ($a).cmp($b) };
 }
 
+macro_rules! write_tuple {
+    ($buf:expr, $x:expr) => (
+        write!($buf, "({},)", *$x)
+    );
+    ($buf:expr, $hd:expr, $($tl:expr),+) => ({
+        if_ok!(write!($buf, "("));
+        if_ok!(write!($buf, "{}", *$hd));
+        $(if_ok!(write!($buf, ", {}", *$tl));)+
+        write!($buf, ")")
+    });
+}
 
 tuple_impls! {
-    (Tuple1, ImmutableTuple1) {
-        (n0, n0_ref) -> A { (a,), (ref a,) => a }
+    Tuple1 {
+        (val0, ref0, mut0) -> A { (a) => a }
     }
-
-    (Tuple2, ImmutableTuple2) {
-        (n0, n0_ref) -> A { (a,_), (ref a,_) => a }
-        (n1, n1_ref) -> B { (_,b), (_,ref b) => b }
+    Tuple2 {
+        (val0, ref0, mut0) -> A { (a, b) => a }
+        (val1, ref1, mut1) -> B { (a, b) => b }
     }
-
-    (Tuple3, ImmutableTuple3) {
-        (n0, n0_ref) -> A { (a,_,_), (ref a,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_), (_,ref b,_) => b }
-        (n2, n2_ref) -> C { (_,_,c), (_,_,ref c) => c }
+    Tuple3 {
+        (val0, ref0, mut0) -> A { (a, b, c) => a }
+        (val1, ref1, mut1) -> B { (a, b, c) => b }
+        (val2, ref2, mut2) -> C { (a, b, c) => c }
     }
-
-    (Tuple4, ImmutableTuple4) {
-        (n0, n0_ref) -> A { (a,_,_,_), (ref a,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_), (_,ref b,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_), (_,_,ref c,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d), (_,_,_,ref d) => d }
+    Tuple4 {
+        (val0, ref0, mut0) -> A { (a, b, c, d) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d) => d }
     }
-
-    (Tuple5, ImmutableTuple5) {
-        (n0, n0_ref) -> A { (a,_,_,_,_), (ref a,_,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_,_), (_,ref b,_,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_,_), (_,_,ref c,_,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d,_), (_,_,_,ref d,_) => d }
-        (n4, n4_ref) -> E { (_,_,_,_,e), (_,_,_,_,ref e) => e }
+    Tuple5 {
+        (val0, ref0, mut0) -> A { (a, b, c, d, e) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d, e) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d, e) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d, e) => d }
+        (val4, ref4, mut4) -> E { (a, b, c, d, e) => e }
     }
-
-    (Tuple6, ImmutableTuple6) {
-        (n0, n0_ref) -> A { (a,_,_,_,_,_), (ref a,_,_,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_,_,_), (_,ref b,_,_,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_,_,_), (_,_,ref c,_,_,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d,_,_), (_,_,_,ref d,_,_) => d }
-        (n4, n4_ref) -> E { (_,_,_,_,e,_), (_,_,_,_,ref e,_) => e }
-        (n5, n5_ref) -> F { (_,_,_,_,_,f), (_,_,_,_,_,ref f) => f }
+    Tuple6 {
+        (val0, ref0, mut0) -> A { (a, b, c, d, e, f) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d, e, f) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d, e, f) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d, e, f) => d }
+        (val4, ref4, mut4) -> E { (a, b, c, d, e, f) => e }
+        (val5, ref5, mut5) -> F { (a, b, c, d, e, f) => f }
     }
-
-    (Tuple7, ImmutableTuple7) {
-        (n0, n0_ref) -> A { (a,_,_,_,_,_,_), (ref a,_,_,_,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_,_,_,_), (_,ref b,_,_,_,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_,_,_,_), (_,_,ref c,_,_,_,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d,_,_,_), (_,_,_,ref d,_,_,_) => d }
-        (n4, n4_ref) -> E { (_,_,_,_,e,_,_), (_,_,_,_,ref e,_,_) => e }
-        (n5, n5_ref) -> F { (_,_,_,_,_,f,_), (_,_,_,_,_,ref f,_) => f }
-        (n6, n6_ref) -> G { (_,_,_,_,_,_,g), (_,_,_,_,_,_,ref g) => g }
+    Tuple7 {
+        (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g) => d }
+        (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g) => e }
+        (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g) => f }
+        (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g) => g }
     }
-
-    (Tuple8, ImmutableTuple8) {
-        (n0, n0_ref) -> A { (a,_,_,_,_,_,_,_), (ref a,_,_,_,_,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_,_,_,_,_), (_,ref b,_,_,_,_,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_,_,_,_,_), (_,_,ref c,_,_,_,_,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d,_,_,_,_), (_,_,_,ref d,_,_,_,_) => d }
-        (n4, n4_ref) -> E { (_,_,_,_,e,_,_,_), (_,_,_,_,ref e,_,_,_) => e }
-        (n5, n5_ref) -> F { (_,_,_,_,_,f,_,_), (_,_,_,_,_,ref f,_,_) => f }
-        (n6, n6_ref) -> G { (_,_,_,_,_,_,g,_), (_,_,_,_,_,_,ref g,_) => g }
-        (n7, n7_ref) -> H { (_,_,_,_,_,_,_,h), (_,_,_,_,_,_,_,ref h) => h }
+    Tuple8 {
+        (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h) => d }
+        (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h) => e }
+        (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h) => f }
+        (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h) => g }
+        (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h) => h }
     }
-
-    (Tuple9, ImmutableTuple9) {
-        (n0, n0_ref) -> A { (a,_,_,_,_,_,_,_,_), (ref a,_,_,_,_,_,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_,_,_,_,_,_), (_,ref b,_,_,_,_,_,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_,_,_,_,_,_), (_,_,ref c,_,_,_,_,_,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d,_,_,_,_,_), (_,_,_,ref d,_,_,_,_,_) => d }
-        (n4, n4_ref) -> E { (_,_,_,_,e,_,_,_,_), (_,_,_,_,ref e,_,_,_,_) => e }
-        (n5, n5_ref) -> F { (_,_,_,_,_,f,_,_,_), (_,_,_,_,_,ref f,_,_,_) => f }
-        (n6, n6_ref) -> G { (_,_,_,_,_,_,g,_,_), (_,_,_,_,_,_,ref g,_,_) => g }
-        (n7, n7_ref) -> H { (_,_,_,_,_,_,_,h,_), (_,_,_,_,_,_,_,ref h,_) => h }
-        (n8, n8_ref) -> I { (_,_,_,_,_,_,_,_,i), (_,_,_,_,_,_,_,_,ref i) => i }
+    Tuple9 {
+        (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i) => d }
+        (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i) => e }
+        (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i) => f }
+        (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i) => g }
+        (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i) => h }
+        (val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i) => i }
     }
-
-    (Tuple10, ImmutableTuple10) {
-        (n0, n0_ref) -> A { (a,_,_,_,_,_,_,_,_,_), (ref a,_,_,_,_,_,_,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_,_,_,_,_,_,_), (_,ref b,_,_,_,_,_,_,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_,_,_,_,_,_,_), (_,_,ref c,_,_,_,_,_,_,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d,_,_,_,_,_,_), (_,_,_,ref d,_,_,_,_,_,_) => d }
-        (n4, n4_ref) -> E { (_,_,_,_,e,_,_,_,_,_), (_,_,_,_,ref e,_,_,_,_,_) => e }
-        (n5, n5_ref) -> F { (_,_,_,_,_,f,_,_,_,_), (_,_,_,_,_,ref f,_,_,_,_) => f }
-        (n6, n6_ref) -> G { (_,_,_,_,_,_,g,_,_,_), (_,_,_,_,_,_,ref g,_,_,_) => g }
-        (n7, n7_ref) -> H { (_,_,_,_,_,_,_,h,_,_), (_,_,_,_,_,_,_,ref h,_,_) => h }
-        (n8, n8_ref) -> I { (_,_,_,_,_,_,_,_,i,_), (_,_,_,_,_,_,_,_,ref i,_) => i }
-        (n9, n9_ref) -> J { (_,_,_,_,_,_,_,_,_,j), (_,_,_,_,_,_,_,_,_,ref j) => j }
+    Tuple10 {
+        (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i, j) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i, j) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i, j) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i, j) => d }
+        (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i, j) => e }
+        (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i, j) => f }
+        (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i, j) => g }
+        (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i, j) => h }
+        (val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i, j) => i }
+        (val9, ref9, mut9) -> J { (a, b, c, d, e, f, g, h, i, j) => j }
     }
-
-    (Tuple11, ImmutableTuple11) {
-        (n0,  n0_ref)  -> A { (a,_,_,_,_,_,_,_,_,_,_), (ref a,_,_,_,_,_,_,_,_,_,_) => a }
-        (n1,  n1_ref)  -> B { (_,b,_,_,_,_,_,_,_,_,_), (_,ref b,_,_,_,_,_,_,_,_,_) => b }
-        (n2,  n2_ref)  -> C { (_,_,c,_,_,_,_,_,_,_,_), (_,_,ref c,_,_,_,_,_,_,_,_) => c }
-        (n3,  n3_ref)  -> D { (_,_,_,d,_,_,_,_,_,_,_), (_,_,_,ref d,_,_,_,_,_,_,_) => d }
-        (n4,  n4_ref)  -> E { (_,_,_,_,e,_,_,_,_,_,_), (_,_,_,_,ref e,_,_,_,_,_,_) => e }
-        (n5,  n5_ref)  -> F { (_,_,_,_,_,f,_,_,_,_,_), (_,_,_,_,_,ref f,_,_,_,_,_) => f }
-        (n6,  n6_ref)  -> G { (_,_,_,_,_,_,g,_,_,_,_), (_,_,_,_,_,_,ref g,_,_,_,_) => g }
-        (n7,  n7_ref)  -> H { (_,_,_,_,_,_,_,h,_,_,_), (_,_,_,_,_,_,_,ref h,_,_,_) => h }
-        (n8,  n8_ref)  -> I { (_,_,_,_,_,_,_,_,i,_,_), (_,_,_,_,_,_,_,_,ref i,_,_) => i }
-        (n9,  n9_ref)  -> J { (_,_,_,_,_,_,_,_,_,j,_), (_,_,_,_,_,_,_,_,_,ref j,_) => j }
-        (n10, n10_ref) -> K { (_,_,_,_,_,_,_,_,_,_,k), (_,_,_,_,_,_,_,_,_,_,ref k) => k }
+    Tuple11 {
+        (val0,  ref0,  mut0)  -> A { (a, b, c, d, e, f, g, h, i, j, k) => a }
+        (val1,  ref1,  mut1)  -> B { (a, b, c, d, e, f, g, h, i, j, k) => b }
+        (val2,  ref2,  mut2)  -> C { (a, b, c, d, e, f, g, h, i, j, k) => c }
+        (val3,  ref3,  mut3)  -> D { (a, b, c, d, e, f, g, h, i, j, k) => d }
+        (val4,  ref4,  mut4)  -> E { (a, b, c, d, e, f, g, h, i, j, k) => e }
+        (val5,  ref5,  mut5)  -> F { (a, b, c, d, e, f, g, h, i, j, k) => f }
+        (val6,  ref6,  mut6)  -> G { (a, b, c, d, e, f, g, h, i, j, k) => g }
+        (val7,  ref7,  mut7)  -> H { (a, b, c, d, e, f, g, h, i, j, k) => h }
+        (val8,  ref8,  mut8)  -> I { (a, b, c, d, e, f, g, h, i, j, k) => i }
+        (val9,  ref9,  mut9)  -> J { (a, b, c, d, e, f, g, h, i, j, k) => j }
+        (val10, ref10, mut10) -> K { (a, b, c, d, e, f, g, h, i, j, k) => k }
     }
-
-    (Tuple12, ImmutableTuple12) {
-        (n0,  n0_ref)  -> A { (a,_,_,_,_,_,_,_,_,_,_,_), (ref a,_,_,_,_,_,_,_,_,_,_,_) => a }
-        (n1,  n1_ref)  -> B { (_,b,_,_,_,_,_,_,_,_,_,_), (_,ref b,_,_,_,_,_,_,_,_,_,_) => b }
-        (n2,  n2_ref)  -> C { (_,_,c,_,_,_,_,_,_,_,_,_), (_,_,ref c,_,_,_,_,_,_,_,_,_) => c }
-        (n3,  n3_ref)  -> D { (_,_,_,d,_,_,_,_,_,_,_,_), (_,_,_,ref d,_,_,_,_,_,_,_,_) => d }
-        (n4,  n4_ref)  -> E { (_,_,_,_,e,_,_,_,_,_,_,_), (_,_,_,_,ref e,_,_,_,_,_,_,_) => e }
-        (n5,  n5_ref)  -> F { (_,_,_,_,_,f,_,_,_,_,_,_), (_,_,_,_,_,ref f,_,_,_,_,_,_) => f }
-        (n6,  n6_ref)  -> G { (_,_,_,_,_,_,g,_,_,_,_,_), (_,_,_,_,_,_,ref g,_,_,_,_,_) => g }
-        (n7,  n7_ref)  -> H { (_,_,_,_,_,_,_,h,_,_,_,_), (_,_,_,_,_,_,_,ref h,_,_,_,_) => h }
-        (n8,  n8_ref)  -> I { (_,_,_,_,_,_,_,_,i,_,_,_), (_,_,_,_,_,_,_,_,ref i,_,_,_) => i }
-        (n9,  n9_ref)  -> J { (_,_,_,_,_,_,_,_,_,j,_,_), (_,_,_,_,_,_,_,_,_,ref j,_,_) => j }
-        (n10, n10_ref) -> K { (_,_,_,_,_,_,_,_,_,_,k,_), (_,_,_,_,_,_,_,_,_,_,ref k,_) => k }
-        (n11, n11_ref) -> L { (_,_,_,_,_,_,_,_,_,_,_,l), (_,_,_,_,_,_,_,_,_,_,_,ref l) => l }
+    Tuple12 {
+        (val0,  ref0,  mut0)  -> A { (a, b, c, d, e, f, g, h, i, j, k, l) => a }
+        (val1,  ref1,  mut1)  -> B { (a, b, c, d, e, f, g, h, i, j, k, l) => b }
+        (val2,  ref2,  mut2)  -> C { (a, b, c, d, e, f, g, h, i, j, k, l) => c }
+        (val3,  ref3,  mut3)  -> D { (a, b, c, d, e, f, g, h, i, j, k, l) => d }
+        (val4,  ref4,  mut4)  -> E { (a, b, c, d, e, f, g, h, i, j, k, l) => e }
+        (val5,  ref5,  mut5)  -> F { (a, b, c, d, e, f, g, h, i, j, k, l) => f }
+        (val6,  ref6,  mut6)  -> G { (a, b, c, d, e, f, g, h, i, j, k, l) => g }
+        (val7,  ref7,  mut7)  -> H { (a, b, c, d, e, f, g, h, i, j, k, l) => h }
+        (val8,  ref8,  mut8)  -> I { (a, b, c, d, e, f, g, h, i, j, k, l) => i }
+        (val9,  ref9,  mut9)  -> J { (a, b, c, d, e, f, g, h, i, j, k, l) => j }
+        (val10, ref10, mut10) -> K { (a, b, c, d, e, f, g, h, i, j, k, l) => k }
+        (val11, ref11, mut11) -> L { (a, b, c, d, e, f, g, h, i, j, k, l) => l }
     }
 }
 
@@ -325,56 +279,37 @@ mod tests {
     use clone::Clone;
     use cmp::*;
 
-    #[test]
-    fn test_tuple_ref() {
-        let x = (~"foo", ~"bar");
-        assert_eq!(x.first_ref(), &~"foo");
-        assert_eq!(x.second_ref(), &~"bar");
-    }
-
-    #[test]
-    fn test_tuple() {
-        assert_eq!((948, 4039.48).first(), 948);
-        assert_eq!((34.5, ~"foo").second(), ~"foo");
-        assert_eq!(('a', 2).swap(), (2, 'a'));
-    }
-
     #[test]
     fn test_clone() {
         let a = (1, ~"2");
         let b = a.clone();
-        assert_eq!(a.first(), b.first());
-        assert_eq!(a.second(), b.second());
+        assert_eq!(a, b);
     }
 
     #[test]
-    fn test_n_tuple() {
-        let t = (0u8, 1u16, 2u32, 3u64, 4u, 5i8, 6i16, 7i32, 8i64, 9i, 10f32, 11f64);
-        assert_eq!(t.n0(), 0u8);
-        assert_eq!(t.n1(), 1u16);
-        assert_eq!(t.n2(), 2u32);
-        assert_eq!(t.n3(), 3u64);
-        assert_eq!(t.n4(), 4u);
-        assert_eq!(t.n5(), 5i8);
-        assert_eq!(t.n6(), 6i16);
-        assert_eq!(t.n7(), 7i32);
-        assert_eq!(t.n8(), 8i64);
-        assert_eq!(t.n9(), 9i);
-        assert_eq!(t.n10(), 10f32);
-        assert_eq!(t.n11(), 11f64);
-
-        assert_eq!(t.n0_ref(), &0u8);
-        assert_eq!(t.n1_ref(), &1u16);
-        assert_eq!(t.n2_ref(), &2u32);
-        assert_eq!(t.n3_ref(), &3u64);
-        assert_eq!(t.n4_ref(), &4u);
-        assert_eq!(t.n5_ref(), &5i8);
-        assert_eq!(t.n6_ref(), &6i16);
-        assert_eq!(t.n7_ref(), &7i32);
-        assert_eq!(t.n8_ref(), &8i64);
-        assert_eq!(t.n9_ref(), &9i);
-        assert_eq!(t.n10_ref(), &10f32);
-        assert_eq!(t.n11_ref(), &11f64);
+    fn test_getters() {
+        macro_rules! test_getter(
+            ($x:expr, $valN:ident, $refN:ident, $mutN:ident,
+             $init:expr, $incr:expr, $result:expr) => ({
+                assert_eq!($x.$valN(), $init);
+                assert_eq!(*$x.$refN(), $init);
+                *$x.$mutN() += $incr;
+                assert_eq!(*$x.$refN(), $result);
+            })
+        )
+        let mut x = (0u8, 1u16, 2u32, 3u64, 4u, 5i8, 6i16, 7i32, 8i64, 9i, 10f32, 11f64);
+        test_getter!(x, val0,  ref0,  mut0,  0,    1,   1);
+        test_getter!(x, val1,  ref1,  mut1,  1,    1,   2);
+        test_getter!(x, val2,  ref2,  mut2,  2,    1,   3);
+        test_getter!(x, val3,  ref3,  mut3,  3,    1,   4);
+        test_getter!(x, val4,  ref4,  mut4,  4,    1,   5);
+        test_getter!(x, val5,  ref5,  mut5,  5,    1,   6);
+        test_getter!(x, val6,  ref6,  mut6,  6,    1,   7);
+        test_getter!(x, val7,  ref7,  mut7,  7,    1,   8);
+        test_getter!(x, val8,  ref8,  mut8,  8,    1,   9);
+        test_getter!(x, val9,  ref9,  mut9,  9,    1,   10);
+        test_getter!(x, val10, ref10, mut10, 10.0, 1.0, 11.0);
+        test_getter!(x, val11, ref11, mut11, 11.0, 1.0, 12.0);
     }
 
     #[test]
@@ -422,4 +357,11 @@ fn test_tuple_cmp() {
         assert_eq!(small.cmp(&big), Less);
         assert_eq!(big.cmp(&small), Greater);
     }
+
+    #[test]
+    fn test_show() {
+        assert_eq!(format!("{}", (1,)), ~"(1,)");
+        assert_eq!(format!("{}", (1, true)), ~"(1, true)");
+        assert_eq!(format!("{}", (1, ~"hi", true)), ~"(1, hi, true)");
+    }
 }
index 8529b69c6eb8a33570b504c33d314b4543ad6ee9..84fa528ebf130746d92a90f7f4d3cbbecd0d295d 100644 (file)
@@ -152,12 +152,12 @@ pub unsafe fn open_internal() -> *u8 {
     }
 
     pub fn check_for_errors_in<T>(f: || -> T) -> Result<T, ~str> {
-        use unstable::mutex::{Mutex, MUTEX_INIT};
-        static mut lock: Mutex = MUTEX_INIT;
+        use unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
+        static mut lock: StaticNativeMutex = NATIVE_MUTEX_INIT;
         unsafe {
             // dlerror isn't thread safe, so we need to lock around this entire
             // sequence
-            lock.lock();
+            let _guard = lock.lock();
             let _old_error = dlerror();
 
             let result = f();
@@ -168,7 +168,7 @@ pub fn check_for_errors_in<T>(f: || -> T) -> Result<T, ~str> {
             } else {
                 Err(str::raw::from_c_str(last_error))
             };
-            lock.unlock();
+
             ret
         }
     }
index 433accecdbcfdbff270ee337aa383265ee08403a..6fb8981b681c3c1dfbcbb60ef98b821425afd332 100644 (file)
 
 # Example
 
- ```
+```
+use std::unstable::finally::Finally;
+# fn always_run_this() {}
+
 (|| {
-    ...
+    // ...
 }).finally(|| {
     always_run_this();
 })
- ```
+```
 */
 
 use ops::Drop;
@@ -69,13 +72,16 @@ fn finally(&self, dtor: ||) -> T {
  * # Example
  *
  * ```
+ * use std::unstable::finally::try_finally;
+ *
  * struct State<'a> { buffer: &'a mut [u8], len: uint }
+ * # let mut buf = [];
  * let mut state = State { buffer: buf, len: 0 };
  * try_finally(
  *     &mut state, (),
  *     |state, ()| {
  *         // use state.buffer, state.len
- *     }
+ *     },
  *     |state| {
  *         // use state.buffer, state.len to cleanup
  *     })
index 3122e925e82d9f5d6fdfdcfc6967d451cee6be05..34ddee46d350e1e48ef16eebb57b816d8f666764 100644 (file)
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! A native mutex and condition variable type
+//! A native mutex and condition variable type.
 //!
 //! This module contains bindings to the platform's native mutex/condition
-//! variable primitives. It provides a single type, `Mutex`, which can be
-//! statically initialized via the `MUTEX_INIT` value. This object serves as both a
-//! mutex and a condition variable simultaneously.
+//! variable primitives. It provides two types: `StaticNativeMutex`, which can
+//! be statically initialized via the `NATIVE_MUTEX_INIT` value, and a simple
+//! wrapper `NativeMutex` that has a destructor to clean up after itself. These
+//! objects serve as both mutexes and condition variables simultaneously.
 //!
-//! The lock is lazily initialized, but it can only be unsafely destroyed. A
-//! statically initialized lock doesn't necessarily have a time at which it can
-//! get deallocated. For this reason, there is no `Drop` implementation of the
-//! mutex, but rather the `destroy()` method must be invoked manually if
-//! destruction of the mutex is desired.
+//! The static lock is lazily initialized, but it can only be unsafely
+//! destroyed. A statically initialized lock doesn't necessarily have a time at
+//! which it can get deallocated. For this reason, there is no `Drop`
+//! implementation of the static mutex, but rather the `destroy()` method must
+//! be invoked manually if destruction of the mutex is desired.
 //!
-//! It is not recommended to use this type for idiomatic rust use. This type is
-//! appropriate where no other options are available, but other rust concurrency
-//! primitives should be used before this type.
+//! The non-static `NativeMutex` type does have a destructor, but cannot be
+//! statically initialized.
+//!
+//! It is not recommended to use this type for idiomatic rust use. These types
+//! are appropriate where no other options are available, but other rust
+//! concurrency primitives should be used before them: the `sync` crate defines
+//! `StaticMutex` and `Mutex` types.
 //!
 //! # Example
 //!
-//!     use std::unstable::mutex::{Mutex, MUTEX_INIT};
+//! ```rust
+//! use std::unstable::mutex::{NativeMutex, StaticNativeMutex, NATIVE_MUTEX_INIT};
+//!
+//! // Use a statically initialized mutex
+//! static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
+//!
+//! unsafe {
+//!     let _guard = LOCK.lock();
+//! } // automatically unlocked here
 //!
-//!     // Use a statically initialized mutex
-//!     static mut lock: Mutex = MUTEX_INIT;
+//! // Use a normally initialized mutex
+//! unsafe {
+//!     let mut lock = NativeMutex::new();
 //!
-//!     unsafe {
-//!         lock.lock();
-//!         lock.unlock();
-//!     }
+//!     {
+//!         let _guard = lock.lock();
+//!     } // unlocked here
 //!
-//!     // Use a normally initialized mutex
-//!     let mut lock = Mutex::new();
-//!     unsafe {
-//!         lock.lock();
-//!         lock.unlock();
-//!         lock.destroy();
-//!     }
+//!     // sometimes the RAII guard isn't appropriate
+//!     lock.lock_noguard();
+//!     lock.unlock_noguard();
+//! } // `lock` is deallocated here
+//! ```
 
 #[allow(non_camel_case_types)];
 
-pub struct Mutex {
+use option::{Option, None, Some};
+use ops::Drop;
+
+/// A native mutex suitable for storing in statics (that is, it has
+/// the `destroy` method rather than a destructor).
+///
+/// Prefer the `NativeMutex` type where possible, since that does not
+/// require manual deallocation.
+pub struct StaticNativeMutex {
     priv inner: imp::Mutex,
 }
 
-pub static MUTEX_INIT: Mutex = Mutex {
+/// A native mutex with a destructor for clean-up.
+///
+/// See `StaticNativeMutex` for a version that is suitable for storing in
+/// statics.
+pub struct NativeMutex {
+    priv inner: StaticNativeMutex
+}
+
+/// Automatically unlocks the mutex that it was created from on
+/// destruction.
+///
+/// Using this makes lock-based code resilient to unwinding/task
+/// failure, because the lock will be automatically unlocked even
+/// then.
+#[must_use]
+pub struct LockGuard<'a> {
+    priv lock: &'a mut StaticNativeMutex
+}
+
+pub static NATIVE_MUTEX_INIT: StaticNativeMutex = StaticNativeMutex {
     inner: imp::MUTEX_INIT,
 };
 
-impl Mutex {
-    /// Creates a new mutex
-    pub unsafe fn new() -> Mutex {
-        Mutex { inner: imp::Mutex::new() }
+impl StaticNativeMutex {
+    /// Creates a new mutex.
+    ///
+    /// Note that a mutex created in this way needs to be explicit
+    /// freed with a call to `destroy` or it will leak.
+    pub unsafe fn new() -> StaticNativeMutex {
+        StaticNativeMutex { inner: imp::Mutex::new() }
     }
 
     /// Acquires this lock. This assumes that the current thread does not
     /// already hold the lock.
-    pub unsafe fn lock(&mut self) { self.inner.lock() }
+    ///
+    /// # Example
+    /// ```rust
+    /// use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
+    /// static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
+    /// unsafe {
+    ///     let _guard = LOCK.lock();
+    ///     // critical section...
+    /// } // automatically unlocked in `_guard`'s destructor
+    /// ```
+    pub unsafe fn lock<'a>(&'a mut self) -> LockGuard<'a> {
+        self.inner.lock();
+
+        LockGuard { lock: self }
+    }
+
+    /// Attempts to acquire the lock. The value returned is `Some` if
+    /// the attempt succeeded.
+    pub unsafe fn trylock<'a>(&'a mut self) -> Option<LockGuard<'a>> {
+        if self.inner.trylock() {
+            Some(LockGuard { lock: self })
+        } else {
+            None
+        }
+    }
 
-    /// Attempts to acquire the lock. The value returned is whether the lock was
-    /// acquired or not
-    pub unsafe fn trylock(&mut self) -> bool { self.inner.trylock() }
+    /// Acquire the lock without creating a `LockGuard`.
+    ///
+    /// These needs to be paired with a call to `.unlock_noguard`. Prefer using
+    /// `.lock`.
+    pub unsafe fn lock_noguard(&mut self) { self.inner.lock() }
+
+    /// Attempts to acquire the lock without creating a
+    /// `LockGuard`. The value returned is whether the lock was
+    /// acquired or not.
+    ///
+    /// If `true` is returned, this needs to be paired with a call to
+    /// `.unlock_noguard`. Prefer using `.trylock`.
+    pub unsafe fn trylock_noguard(&mut self) -> bool {
+        self.inner.trylock()
+    }
 
     /// Unlocks the lock. This assumes that the current thread already holds the
     /// lock.
-    pub unsafe fn unlock(&mut self) { self.inner.unlock() }
+    pub unsafe fn unlock_noguard(&mut self) { self.inner.unlock() }
 
     /// Block on the internal condition variable.
     ///
-    /// This function assumes that the lock is already held
-    pub unsafe fn wait(&mut self) { self.inner.wait() }
+    /// This function assumes that the lock is already held. Prefer
+    /// using `LockGuard.wait` since that guarantees that the lock is
+    /// held.
+    pub unsafe fn wait_noguard(&mut self) { self.inner.wait() }
 
     /// Signals a thread in `wait` to wake up
-    pub unsafe fn signal(&mut self) { self.inner.signal() }
+    pub unsafe fn signal_noguard(&mut self) { self.inner.signal() }
 
     /// This function is especially unsafe because there are no guarantees made
     /// that no other thread is currently holding the lock or waiting on the
@@ -87,6 +166,96 @@ pub unsafe fn signal(&mut self) { self.inner.signal() }
     pub unsafe fn destroy(&mut self) { self.inner.destroy() }
 }
 
+impl NativeMutex {
+    /// Creates a new mutex.
+    ///
+    /// The user must be careful to ensure the mutex is not locked when its is
+    /// being destroyed.
+    pub unsafe fn new() -> NativeMutex {
+        NativeMutex { inner: StaticNativeMutex::new() }
+    }
+
+    /// Acquires this lock. This assumes that the current thread does not
+    /// already hold the lock.
+    ///
+    /// # Example
+    /// ```rust
+    /// use std::unstable::mutex::NativeMutex;
+    /// unsafe {
+    ///     let mut lock = NativeMutex::new();
+    ///
+    ///     {
+    ///         let _guard = lock.lock();
+    ///         // critical section...
+    ///     } // automatically unlocked in `_guard`'s destructor
+    /// }
+    /// ```
+    pub unsafe fn lock<'a>(&'a mut self) -> LockGuard<'a> {
+        self.inner.lock()
+    }
+
+    /// Attempts to acquire the lock. The value returned is `Some` if
+    /// the attempt succeeded.
+    pub unsafe fn trylock<'a>(&'a mut self) -> Option<LockGuard<'a>> {
+        self.inner.trylock()
+    }
+
+    /// Acquire the lock without creating a `LockGuard`.
+    ///
+    /// These needs to be paired with a call to `.unlock_noguard`. Prefer using
+    /// `.lock`.
+    pub unsafe fn lock_noguard(&mut self) { self.inner.lock_noguard() }
+
+    /// Attempts to acquire the lock without creating a
+    /// `LockGuard`. The value returned is whether the lock was
+    /// acquired or not.
+    ///
+    /// If `true` is returned, this needs to be paired with a call to
+    /// `.unlock_noguard`. Prefer using `.trylock`.
+    pub unsafe fn trylock_noguard(&mut self) -> bool {
+        self.inner.trylock_noguard()
+    }
+
+    /// Unlocks the lock. This assumes that the current thread already holds the
+    /// lock.
+    pub unsafe fn unlock_noguard(&mut self) { self.inner.unlock_noguard() }
+
+    /// Block on the internal condition variable.
+    ///
+    /// This function assumes that the lock is already held. Prefer
+    /// using `LockGuard.wait` since that guarantees that the lock is
+    /// held.
+    pub unsafe fn wait_noguard(&mut self) { self.inner.wait_noguard() }
+
+    /// Signals a thread in `wait` to wake up
+    pub unsafe fn signal_noguard(&mut self) { self.inner.signal_noguard() }
+}
+
+impl Drop for NativeMutex {
+    fn drop(&mut self) {
+        unsafe {self.inner.destroy()}
+    }
+}
+
+impl<'a> LockGuard<'a> {
+    /// Block on the internal condition variable.
+    pub unsafe fn wait(&mut self) {
+        self.lock.wait_noguard()
+    }
+
+    /// Signals a thread in `wait` to wake up.
+    pub unsafe fn signal(&mut self) {
+        self.lock.signal_noguard()
+    }
+}
+
+#[unsafe_destructor]
+impl<'a> Drop for LockGuard<'a> {
+    fn drop(&mut self) {
+        unsafe {self.lock.unlock_noguard()}
+    }
+}
+
 #[cfg(unix)]
 mod imp {
     use libc;
@@ -382,30 +551,56 @@ fn InitializeCriticalSectionAndSpinCount(
 mod test {
     use prelude::*;
 
-    use super::{Mutex, MUTEX_INIT};
+    use mem::drop;
+    use super::{StaticNativeMutex, NATIVE_MUTEX_INIT};
     use rt::thread::Thread;
 
     #[test]
-    fn somke_lock() {
-        static mut lock: Mutex = MUTEX_INIT;
+    fn smoke_lock() {
+        static mut lock: StaticNativeMutex = NATIVE_MUTEX_INIT;
         unsafe {
-            lock.lock();
-            lock.unlock();
+            let _guard = lock.lock();
         }
     }
 
     #[test]
-    fn somke_cond() {
-        static mut lock: Mutex = MUTEX_INIT;
+    fn smoke_cond() {
+        static mut lock: StaticNativeMutex = NATIVE_MUTEX_INIT;
         unsafe {
-            lock.lock();
+            let mut guard = lock.lock();
             let t = Thread::start(proc() {
-                lock.lock();
-                lock.signal();
-                lock.unlock();
+                let mut guard = lock.lock();
+                guard.signal();
             });
-            lock.wait();
-            lock.unlock();
+            guard.wait();
+            drop(guard);
+
+            t.join();
+        }
+    }
+
+    #[test]
+    fn smoke_lock_noguard() {
+        static mut lock: StaticNativeMutex = NATIVE_MUTEX_INIT;
+        unsafe {
+            lock.lock_noguard();
+            lock.unlock_noguard();
+        }
+    }
+
+    #[test]
+    fn smoke_cond_noguard() {
+        static mut lock: StaticNativeMutex = NATIVE_MUTEX_INIT;
+        unsafe {
+            lock.lock_noguard();
+            let t = Thread::start(proc() {
+                lock.lock_noguard();
+                lock.signal_noguard();
+                lock.unlock_noguard();
+            });
+            lock.wait_noguard();
+            lock.unlock_noguard();
+
             t.join();
         }
     }
@@ -413,7 +608,7 @@ fn somke_cond() {
     #[test]
     fn destroy_immediately() {
         unsafe {
-            let mut m = Mutex::new();
+            let mut m = StaticNativeMutex::new();
             m.destroy();
         }
     }
index c2fa168a47825bad0857474df67ffbea25a2448e..93322977bc1215c1c80fc1c7713db46a863f358a 100644 (file)
 
 use clone::Clone;
 use kinds::Send;
-use ops::Drop;
-use option::{Option,Some,None};
 use sync::arc::UnsafeArc;
-use unstable::mutex::Mutex;
-
-pub struct LittleLock {
-    priv l: Mutex,
-}
-
-pub struct LittleGuard<'a> {
-    priv l: &'a mut Mutex,
-}
-
-impl Drop for LittleLock {
-    fn drop(&mut self) {
-        unsafe { self.l.destroy(); }
-    }
-}
-
-#[unsafe_destructor]
-impl<'a> Drop for LittleGuard<'a> {
-    fn drop(&mut self) {
-        unsafe { self.l.unlock(); }
-    }
-}
-
-impl LittleLock {
-    pub fn new() -> LittleLock {
-        unsafe { LittleLock { l: Mutex::new() } }
-    }
-
-    pub unsafe fn lock<'a>(&'a mut self) -> LittleGuard<'a> {
-        self.l.lock();
-        LittleGuard { l: &mut self.l }
-    }
-
-    pub unsafe fn try_lock<'a>(&'a mut self) -> Option<LittleGuard<'a>> {
-        if self.l.trylock() {
-            Some(LittleGuard { l: &mut self.l })
-        } else {
-            None
-        }
-    }
-
-    pub unsafe fn signal(&mut self) {
-        self.l.signal();
-    }
-}
-
-impl<'a> LittleGuard<'a> {
-    pub unsafe fn wait(&mut self) {
-        self.l.wait();
-    }
-}
+use unstable::mutex::NativeMutex;
 
 struct ExData<T> {
-    lock: LittleLock,
+    lock: NativeMutex,
     failed: bool,
     data: T,
 }
@@ -95,7 +43,7 @@ fn clone(&self) -> Exclusive<T> {
 impl<T:Send> Exclusive<T> {
     pub fn new(user_data: T) -> Exclusive<T> {
         let data = ExData {
-            lock: LittleLock::new(),
+            lock: unsafe {NativeMutex::new()},
             failed: false,
             data: user_data
         };
@@ -104,8 +52,8 @@ pub fn new(user_data: T) -> Exclusive<T> {
         }
     }
 
-    // Exactly like std::arc::MutexArc,access(), but with the LittleLock
-    // instead of a proper mutex. Same reason for being unsafe.
+    // Exactly like sync::MutexArc.access(). Same reason for being
+    // unsafe.
     //
     // Currently, scheduling operations (i.e., descheduling, receiving on a pipe,
     // accessing the provided condition variable) are prohibited while inside
@@ -131,14 +79,14 @@ pub unsafe fn with_imm<U>(&self, f: |x: &T| -> U) -> U {
     #[inline]
     pub unsafe fn hold_and_signal(&self, f: |x: &mut T|) {
         let rec = self.x.get();
-        let _l = (*rec).lock.lock();
+        let mut guard = (*rec).lock.lock();
         if (*rec).failed {
             fail!("Poisoned Exclusive::new - another task failed inside!");
         }
         (*rec).failed = true;
         f(&mut (*rec).data);
         (*rec).failed = false;
-        (*rec).lock.signal();
+        guard.signal();
     }
 
     #[inline]
index cfe2ad5a08af439be66c523ef57d28b831388b2c..9d9ebad1c69b2934b4ce7b1ef24d740b6f107ea0 100644 (file)
 #[warn(non_camel_case_types)];
 
 use cast;
+use cast::transmute;
 use ops::Drop;
 use clone::{Clone, DeepClone};
 use container::{Container, Mutable};
 use cmp::{Eq, TotalOrd, Ordering, Less, Equal, Greater};
 use cmp;
 use default::Default;
-#[cfg(not(stage0))] use fmt;
+use fmt;
 use iter::*;
 use num::{Integer, CheckedAdd, Saturating, checked_next_power_of_two};
 use option::{None, Option, Some};
-use ptr::to_unsafe_ptr;
 use ptr;
 use ptr::RawPtr;
 use rt::global_heap::{malloc_raw, realloc_raw, exchange_free};
-#[cfg(not(stage0))] use result::{Ok, Err};
+use result::{Ok, Err};
 use mem;
 use mem::size_of;
 use kinds::marker;
@@ -188,7 +188,7 @@ pub fn with_capacity<T>(capacity: uint) -> ~[T] {
         let ptr = malloc_raw(size) as *mut Vec<()>;
         (*ptr).alloc = alloc;
         (*ptr).fill = 0;
-        cast::transmute(ptr)
+        transmute(ptr)
     }
 }
 
@@ -216,7 +216,7 @@ pub fn build<A>(size: Option<uint>, builder: |push: |v: A||) -> ~[A] {
  */
 pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
     unsafe {
-        cast::transmute(Slice { data: s, len: 1 })
+        transmute(Slice { data: s, len: 1 })
     }
 }
 
@@ -225,8 +225,8 @@ pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
  */
 pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
     unsafe {
-        let ptr: *A = cast::transmute(s);
-        cast::transmute(Slice { data: ptr, len: 1 })
+        let ptr: *A = transmute(s);
+        transmute(Slice { data: ptr, len: 1 })
     }
 }
 
@@ -955,7 +955,7 @@ pub trait ImmutableVector<'a, T> {
      *
      * Equivalent to:
      *
-     * ```
+     * ```ignore
      *     if self.len() == 0 { return None }
      *     let head = &self[0];
      *     *self = self.slice_from(1);
@@ -973,7 +973,7 @@ pub trait ImmutableVector<'a, T> {
      *
      * Equivalent to:
      *
-     * ```
+     * ```ignore
      *     if self.len() == 0 { return None; }
      *     let tail = &self[self.len() - 1];
      *     *self = self.slice_to(self.len() - 1);
@@ -991,7 +991,7 @@ fn slice(&self, start: uint, end: uint) -> &'a [T] {
         assert!(start <= end);
         assert!(end <= self.len());
         unsafe {
-            cast::transmute(Slice {
+            transmute(Slice {
                     data: self.as_ptr().offset(start as int),
                     len: (end - start)
                 })
@@ -1109,7 +1109,7 @@ fn flat_map<U>(&self, f: |t: &T| -> ~[U]) -> ~[U] {
 
     #[inline]
     unsafe fn unsafe_ref(self, index: uint) -> &'a T {
-        cast::transmute(self.repr().data.offset(index as int))
+        transmute(self.repr().data.offset(index as int))
     }
 
     #[inline]
@@ -1144,7 +1144,7 @@ fn map<U>(&self, f: |t: &T| -> U) -> ~[U] {
     fn shift_ref(&mut self) -> Option<&'a T> {
         if self.len() == 0 { return None; }
         unsafe {
-            let s: &mut Slice<T> = cast::transmute(self);
+            let s: &mut Slice<T> = transmute(self);
             Some(&*raw::shift_ptr(s))
         }
     }
@@ -1152,7 +1152,7 @@ fn shift_ref(&mut self) -> Option<&'a T> {
     fn pop_ref(&mut self) -> Option<&'a T> {
         if self.len() == 0 { return None; }
         unsafe {
-            let s: &mut Slice<T> = cast::transmute(self);
+            let s: &mut Slice<T> = transmute(self);
             Some(&*raw::pop_ptr(s))
         }
     }
@@ -1417,8 +1417,8 @@ impl<T> OwnedVector<T> for ~[T] {
     #[inline]
     fn move_iter(self) -> MoveItems<T> {
         unsafe {
-            let iter = cast::transmute(self.iter());
-            let ptr = cast::transmute(self);
+            let iter = transmute(self.iter());
+            let ptr = transmute(self);
             MoveItems { allocation: ptr, iter: iter }
         }
     }
@@ -1432,7 +1432,7 @@ fn reserve_exact(&mut self, n: uint) {
         // Only make the (slow) call into the runtime if we have to
         if self.capacity() < n {
             unsafe {
-                let ptr: *mut *mut Vec<()> = cast::transmute(self);
+                let ptr: *mut *mut Vec<()> = transmute(self);
                 let alloc = n * mem::nonzero_size_of::<T>();
                 let size = alloc + mem::size_of::<Vec<()>>();
                 if alloc / mem::nonzero_size_of::<T>() != n || size < alloc {
@@ -1463,14 +1463,14 @@ fn reserve_additional(&mut self, n: uint) {
     #[inline]
     fn capacity(&self) -> uint {
         unsafe {
-            let repr: **Vec<()> = cast::transmute(self);
+            let repr: **Vec<()> = transmute(self);
             (**repr).alloc / mem::nonzero_size_of::<T>()
         }
     }
 
     fn shrink_to_fit(&mut self) {
         unsafe {
-            let ptr: *mut *mut Vec<()> = cast::transmute(self);
+            let ptr: *mut *mut Vec<()> = transmute(self);
             let alloc = (**ptr).fill;
             let size = alloc + mem::size_of::<Vec<()>>();
             *ptr = realloc_raw(*ptr as *mut u8, size) as *mut Vec<()>;
@@ -1481,7 +1481,7 @@ fn shrink_to_fit(&mut self) {
     #[inline]
     fn push(&mut self, t: T) {
         unsafe {
-            let repr: **Vec<()> = cast::transmute(&mut *self);
+            let repr: **Vec<()> = transmute(&mut *self);
             let fill = (**repr).fill;
             if (**repr).alloc <= fill {
                 self.reserve_additional(1);
@@ -1493,10 +1493,10 @@ fn push(&mut self, t: T) {
         // This doesn't bother to make sure we have space.
         #[inline] // really pretty please
         unsafe fn push_fast<T>(this: &mut ~[T], t: T) {
-            let repr: **mut Vec<u8> = cast::transmute(this);
+            let repr: **mut Vec<u8> = transmute(this);
             let fill = (**repr).fill;
             (**repr).fill += mem::nonzero_size_of::<T>();
-            let p = to_unsafe_ptr(&((**repr).data));
+            let p = &((**repr).data) as *u8;
             let p = p.offset(fill as int) as *mut T;
             mem::move_val_init(&mut(*p), t);
         }
@@ -1521,10 +1521,10 @@ fn pop(&mut self) -> Option<T> {
         match self.len() {
             0  => None,
             ln => {
-                let valptr = ptr::to_mut_unsafe_ptr(&mut self[ln - 1u]);
+                let valptr = &mut self[ln - 1u] as *mut T;
                 unsafe {
                     self.set_len(ln - 1u);
-                    Some(ptr::read_ptr(&*valptr))
+                    Some(ptr::read(&*valptr))
                 }
             }
         }
@@ -1568,7 +1568,7 @@ fn remove(&mut self, i: uint) -> Option<T> {
                 let ptr = self.as_mut_ptr().offset(i as int);
                 // copy it out, unsafely having a copy of the value on
                 // the stack and in the vector at the same time.
-                let ret = Some(ptr::read_ptr(ptr as *T));
+                let ret = Some(ptr::read(ptr as *T));
 
                 // Shift everything down to fill in that spot.
                 ptr::copy_memory(ptr, &*ptr.offset(1), len - i - 1);
@@ -1598,7 +1598,7 @@ fn truncate(&mut self, newlen: uint) {
             let p = self.as_mut_ptr();
             // This loop is optimized out for non-drop types.
             for i in range(newlen, oldlen) {
-                ptr::read_and_zero_ptr(p.offset(i as int));
+                ptr::read_and_zero(p.offset(i as int));
             }
         }
         unsafe { self.set_len(newlen); }
@@ -1648,7 +1648,7 @@ fn grow_fn(&mut self, n: uint, op: |uint| -> T) {
 
     #[inline]
     unsafe fn set_len(&mut self, new_len: uint) {
-        let repr: **mut Vec<()> = cast::transmute(self);
+        let repr: **mut Vec<()> = transmute(self);
         (**repr).fill = new_len * mem::nonzero_size_of::<T>();
     }
 }
@@ -1844,7 +1844,7 @@ fn insertion_sort<T>(v: &mut [T], compare: |&T, &T| -> Ordering) {
             // `.offset(j)` is always in bounds.
 
             if i != j {
-                let tmp = ptr::read_ptr(read_ptr);
+                let tmp = ptr::read(read_ptr);
                 ptr::copy_memory(buf_v.offset(j + 1),
                                  &*buf_v.offset(j),
                                  (i - j) as uint);
@@ -2075,7 +2075,7 @@ pub trait MutableVector<'a, T> {
      *
      * Equivalent to:
      *
-     * ```
+     * ```ignore
      *     if self.len() == 0 { return None; }
      *     let head = &mut self[0];
      *     *self = self.mut_slice_from(1);
@@ -2093,7 +2093,7 @@ pub trait MutableVector<'a, T> {
      *
      * Equivalent to:
      *
-     * ```
+     * ```ignore
      *     if self.len() == 0 { return None; }
      *     let tail = &mut self[self.len() - 1];
      *     *self = self.mut_slice_to(self.len() - 1);
@@ -2269,7 +2269,7 @@ fn mut_slice(self, start: uint, end: uint) -> &'a mut [T] {
         assert!(start <= end);
         assert!(end <= self.len());
         unsafe {
-            cast::transmute(Slice {
+            transmute(Slice {
                     data: self.as_mut_ptr().offset(start as int) as *T,
                     len: (end - start)
                 })
@@ -2338,7 +2338,7 @@ fn mut_chunks(self, chunk_size: uint) -> MutChunks<'a, T> {
     fn mut_shift_ref(&mut self) -> Option<&'a mut T> {
         if self.len() == 0 { return None; }
         unsafe {
-            let s: &mut Slice<T> = cast::transmute(self);
+            let s: &mut Slice<T> = transmute(self);
             Some(cast::transmute_mut(&*raw::shift_ptr(s)))
         }
     }
@@ -2346,7 +2346,7 @@ fn mut_shift_ref(&mut self) -> Option<&'a mut T> {
     fn mut_pop_ref(&mut self) -> Option<&'a mut T> {
         if self.len() == 0 { return None; }
         unsafe {
-            let s: &mut Slice<T> = cast::transmute(self);
+            let s: &mut Slice<T> = transmute(self);
             Some(cast::transmute_mut(&*raw::pop_ptr(s)))
         }
     }
@@ -2357,7 +2357,7 @@ fn swap(self, a: uint, b: uint) {
             // them to their raw pointers to do the swap
             let pa: *mut T = &mut self[a];
             let pb: *mut T = &mut self[b];
-            ptr::swap_ptr(pa, pb);
+            ptr::swap(pa, pb);
         }
     }
 
@@ -2385,7 +2385,7 @@ fn move_from(self, mut src: ~[T], start: uint, end: uint) -> uint {
 
     #[inline]
     unsafe fn unsafe_mut_ref(self, index: uint) -> &'a mut T {
-        cast::transmute((self.repr().data as *mut T).offset(index as int))
+        transmute((self.repr().data as *mut T).offset(index as int))
     }
 
     #[inline]
@@ -2484,7 +2484,7 @@ pub unsafe fn from_buf<T>(ptr: *T, elts: uint) -> ~[T] {
 
 /// Unsafe operations
 pub mod raw {
-    use cast;
+    use cast::transmute;
     use ptr;
     use ptr::RawPtr;
     use vec::{with_capacity, MutableVector, OwnedVector};
@@ -2497,7 +2497,7 @@ pub mod raw {
     #[inline]
     pub unsafe fn buf_as_slice<T,U>(p: *T, len: uint, f: |v: &[T]| -> U)
                                -> U {
-        f(cast::transmute(Slice {
+        f(transmute(Slice {
             data: p,
             len: len
         }))
@@ -2514,7 +2514,7 @@ pub unsafe fn mut_buf_as_slice<T,
                                    len: uint,
                                    f: |v: &mut [T]| -> U)
                                    -> U {
-        f(cast::transmute(Slice {
+        f(transmute(Slice {
             data: p as *T,
             len: len
         }))
@@ -2643,7 +2643,6 @@ fn deep_clone_from(&mut self, source: &~[A]) {
     }
 }
 
-#[cfg(not(stage0))]
 impl<'a, T: fmt::Show> fmt::Show for &'a [T] {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         if_ok!(write!(f.buf, "["));
@@ -2660,7 +2659,6 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[cfg(not(stage0))]
 impl<T: fmt::Show> fmt::Show for ~[T] {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         self.as_slice().fmt(f)
@@ -2698,12 +2696,12 @@ fn next(&mut self) -> Option<$elem> {
                             // purposefully don't use 'ptr.offset' because for
                             // vectors with 0-size elements this would return the
                             // same pointer.
-                            cast::transmute(self.ptr as uint + 1)
+                            transmute(self.ptr as uint + 1)
                         } else {
                             self.ptr.offset(1)
                         };
 
-                        Some(cast::transmute(old))
+                        Some(transmute(old))
                     }
                 }
             }
@@ -2726,11 +2724,11 @@ fn next_back(&mut self) -> Option<$elem> {
                     } else {
                         self.end = if mem::size_of::<T>() == 0 {
                             // See above for why 'ptr.offset' isn't used
-                            cast::transmute(self.end as uint - 1)
+                            transmute(self.end as uint - 1)
                         } else {
                             self.end.offset(-1)
                         };
-                        Some(cast::transmute(self.end))
+                        Some(transmute(self.end))
                     }
                 }
             }
@@ -2749,7 +2747,7 @@ fn indexable(&self) -> uint {
     fn idx(&self, index: uint) -> Option<&'a T> {
         unsafe {
             if index < self.indexable() {
-                cast::transmute(self.ptr.offset(index as int))
+                transmute(self.ptr.offset(index as int))
             } else {
                 None
             }
@@ -2895,7 +2893,7 @@ impl<T> Iterator<T> for MoveItems<T> {
     #[inline]
     fn next(&mut self) -> Option<T> {
         unsafe {
-            self.iter.next().map(|x| ptr::read_ptr(x))
+            self.iter.next().map(|x| ptr::read(x))
         }
     }
 
@@ -2909,7 +2907,7 @@ impl<T> DoubleEndedIterator<T> for MoveItems<T> {
     #[inline]
     fn next_back(&mut self) -> Option<T> {
         unsafe {
-            self.iter.next_back().map(|x| ptr::read_ptr(x))
+            self.iter.next_back().map(|x| ptr::read(x))
         }
     }
 }
index 25ba45021b3fa0364bb9571ec92aa5f87e556727..a450aab127bc43be17d36fc4971ef9543aa0ede2 100644 (file)
@@ -22,7 +22,7 @@
 use rt::global_heap::{malloc_raw, realloc_raw};
 use vec::{ImmutableVector, Items, MutableVector};
 use unstable::raw::Slice;
-use ptr::read_ptr;
+use ptr;
 use ptr::RawPtr;
 use libc::{free, c_void};
 
@@ -117,7 +117,7 @@ pub fn pop(&mut self) -> Option<T> {
         } else {
             unsafe {
                 self.len -= 1;
-                Some(read_ptr(self.as_slice().unsafe_ref(self.len())))
+                Some(ptr::read(self.as_slice().unsafe_ref(self.len())))
             }
         }
     }
@@ -147,7 +147,7 @@ pub fn truncate(&mut self, len: uint) {
             let mut i = len;
             // drop any extra elements
             while i < self.len {
-                read_ptr(self.as_slice().unsafe_ref(i));
+                ptr::read(self.as_slice().unsafe_ref(i));
                 i += 1;
             }
         }
@@ -188,7 +188,7 @@ impl<T> Drop for Vec<T> {
     fn drop(&mut self) {
         unsafe {
             for x in self.as_mut_slice().iter() {
-                read_ptr(x);
+                ptr::read(x);
             }
             free(self.ptr as *mut c_void)
         }
@@ -204,7 +204,7 @@ impl<T> Iterator<T> for MoveItems<T> {
     #[inline]
     fn next(&mut self) -> Option<T> {
         unsafe {
-            self.iter.next().map(|x| read_ptr(x))
+            self.iter.next().map(|x| ptr::read(x))
         }
     }
 
@@ -218,7 +218,7 @@ impl<T> DoubleEndedIterator<T> for MoveItems<T> {
     #[inline]
     fn next_back(&mut self) -> Option<T> {
         unsafe {
-            self.iter.next_back().map(|x| read_ptr(x))
+            self.iter.next_back().map(|x| ptr::read(x))
         }
     }
 }
index 3726528a5e9c8d8729474564832ee2880c59e4ba..9ca2f1fd7ffe32430756d4ea8bac5b8b0a9f39ed 100644 (file)
@@ -133,7 +133,7 @@ pub struct StaticMutex {
     /// uint-cast of the native thread waiting for this mutex
     priv native_blocker: uint,
     /// an OS mutex used by native threads
-    priv lock: mutex::Mutex,
+    priv lock: mutex::StaticNativeMutex,
 
     /// A concurrent mpsc queue used by green threads, along with a count used
     /// to figure out when to dequeue and enqueue.
@@ -143,6 +143,7 @@ pub struct StaticMutex {
 
 /// An RAII implementation of a "scoped lock" of a mutex. When this structure is
 /// dropped (falls out of scope), the lock will be unlocked.
+#[must_use]
 pub struct Guard<'a> {
     priv lock: &'a mut StaticMutex,
 }
@@ -150,7 +151,7 @@ pub struct Guard<'a> {
 /// Static initialization of a mutex. This constant can be used to initialize
 /// other mutex constants.
 pub static MUTEX_INIT: StaticMutex = StaticMutex {
-    lock: mutex::MUTEX_INIT,
+    lock: mutex::NATIVE_MUTEX_INIT,
     state: atomics::INIT_ATOMIC_UINT,
     flavor: Unlocked,
     green_blocker: 0,
@@ -288,11 +289,11 @@ pub fn lock<'a>(&'a mut self) -> Guard<'a> {
     // `lock()` function on an OS mutex
     fn native_lock(&mut self, t: ~Task) {
         Local::put(t);
-        unsafe { self.lock.lock(); }
+        unsafe { self.lock.lock_noguard(); }
     }
 
     fn native_unlock(&mut self) {
-        unsafe { self.lock.unlock(); }
+        unsafe { self.lock.unlock_noguard(); }
     }
 
     fn green_lock(&mut self, t: ~Task) {
@@ -441,7 +442,7 @@ pub fn new() -> Mutex {
                 native_blocker: 0,
                 green_cnt: atomics::AtomicUint::new(0),
                 q: q::Queue::new(),
-                lock: unsafe { mutex::Mutex::new() },
+                lock: unsafe { mutex::StaticNativeMutex::new() },
             }
         }
     }
@@ -495,7 +496,7 @@ fn drop(&mut self) {
 
 #[cfg(test)]
 mod test {
-    extern mod native;
+    extern crate native;
     use super::{Mutex, StaticMutex, MUTEX_INIT};
 
     #[test]
index 132cb396ddd392955c52a77589e7450725f4901e..a3025d394dab5a99983e33d2f1a6544bac7673ee 100644 (file)
@@ -1058,7 +1058,7 @@ pub enum ViewItem_ {
     // ident: name used to refer to this crate in the code
     // optional (InternedString,StrStyle): if present, this is a location
     // (containing arbitrary characters) from which to fetch the crate sources
-    // For example, extern mod whatever = "github.com/mozilla/rust"
+    // For example, extern crate whatever = "github.com/mozilla/rust"
     ViewItemExternMod(Ident, Option<(InternedString,StrStyle)>, NodeId),
     ViewItemUse(~[@ViewPath]),
 }
index 468cb1544a25de7c36617c7c744df080f2c8a16d..9e0439e5375c9834d60692c6b8209f0307530ca8 100644 (file)
 
 For example, a type like:
 
+```ignore
     #[deriving(Encodable, Decodable)]
     struct Node {id: uint}
+```
 
 would generate two implementations like:
 
@@ -43,11 +45,14 @@ fn decode(d: &D) -> Node {
 Other interesting scenarios are whe the item has type parameters or
 references other non-built-in types.  A type definition like:
 
+```ignore
     #[deriving(Encodable, Decodable)]
     struct spanned<T> {node: T, span: Span}
+```
 
 would yield functions like:
 
+```ignore
     impl<
         S: Encoder,
         T: Encodable<S>
@@ -73,6 +78,7 @@ fn decode(d: &D) -> spanned<T> {
             })
         }
     }
+```
 */
 
 use ast::{MetaItem, Item, Expr, MutMutable};
index 3db07b05e527db69f81a5c5d11e2cfb10c15bb64..029e87afbe21223fafe958b32c8035e0f2a64a36 100644 (file)
@@ -59,7 +59,7 @@
 an identifier in the source code. For example, the `x`s in the
 following snippet
 
-~~~
+~~~ignore
 struct A { x : int }
 
 struct B(int);
@@ -83,7 +83,7 @@ enum C {
 
 The following simplified `Eq` is used for in-code examples:
 
-~~~
+~~~ignore
 trait Eq {
     fn eq(&self, other: &Self);
 }
@@ -101,7 +101,7 @@ fn eq(&self, other: &int) -> bool {
 
 When generating the `expr` for the `A` impl, the `SubstructureFields` is
 
-~~~
+~~~ignore
 Struct(~[FieldInfo {
            span: <span of x>
            name: Some(<ident of x>),
@@ -112,7 +112,7 @@ fn eq(&self, other: &int) -> bool {
 
 For the `B` impl, called with `B(a)` and `B(b)`,
 
-~~~
+~~~ignore
 Struct(~[FieldInfo {
           span: <span of `int`>,
           name: None,
@@ -126,7 +126,7 @@ fn eq(&self, other: &int) -> bool {
 When generating the `expr` for a call with `self == C0(a)` and `other
 == C0(b)`, the SubstructureFields is
 
-~~~
+~~~ignore
 EnumMatching(0, <ast::Variant for C0>,
              ~[FieldInfo {
                 span: <span of int>
@@ -138,7 +138,7 @@ fn eq(&self, other: &int) -> bool {
 
 For `C1 {x}` and `C1 {x}`,
 
-~~~
+~~~ignore
 EnumMatching(1, <ast::Variant for C1>,
              ~[FieldInfo {
                 span: <span of x>
@@ -150,7 +150,7 @@ fn eq(&self, other: &int) -> bool {
 
 For `C0(a)` and `C1 {x}` ,
 
-~~~
+~~~ignore
 EnumNonMatching(~[(0, <ast::Variant for B0>,
                    ~[(<span of int>, None, <expr for &a>)]),
                   (1, <ast::Variant for B1>,
@@ -164,7 +164,7 @@ fn eq(&self, other: &int) -> bool {
 
 A static method on the above would result in,
 
-~~~~
+~~~~ignore
 StaticStruct(<ast::StructDef of A>, Named(~[(<ident of x>, <span of x>)]))
 
 StaticStruct(<ast::StructDef of B>, Unnamed(~[<span of x>]))
@@ -346,7 +346,9 @@ pub fn expand(&self,
      * Given that we are deriving a trait `Tr` for a type `T<'a, ...,
      * 'z, A, ..., Z>`, creates an impl like:
      *
+     * ```ignore
      *      impl<'a, ..., 'z, A:Tr B1 B2, ..., Z: Tr B1 B2> Tr for T<A, ..., Z> { ... }
+     * ```
      *
      * where B1, B2, ... are the bounds given by `bounds_paths`.'
      *
@@ -620,7 +622,7 @@ fn create_method(&self,
     }
 
     /**
-   ~~~
+   ~~~ignore
     #[deriving(Eq)]
     struct A { x: int, y: int }
 
@@ -719,7 +721,7 @@ fn expand_static_struct_method_body(&self,
     }
 
     /**
-   ~~~
+   ~~~ignore
     #[deriving(Eq)]
     enum A {
         A1
@@ -762,7 +764,7 @@ fn expand_enum_method_body(&self,
     /**
     Creates the nested matches for an enum definition recursively, i.e.
 
-   ~~~
+   ~~~ignore
     match self {
        Variant1 => match other { Variant1 => matching, Variant2 => nonmatching, ... },
        Variant2 => match other { Variant1 => nonmatching, Variant2 => matching, ... },
@@ -1166,7 +1168,7 @@ pub fn cs_fold(use_foldl: bool,
 Call the method that is being derived on all the fields, and then
 process the collected results. i.e.
 
-~~~
+~~~ignore
 f(cx, span, ~[self_1.method(__arg_1_1, __arg_2_1),
               self_2.method(__arg_1_2, __arg_2_2)])
 ~~~
index 78e40a795db1f4bb380f0a1a11887c15102f422c..3cbdad9a71d7e29532b96f9e380f16fc3f04eccf 100644 (file)
 
 #[deny(non_camel_case_types)];
 
-#[cfg(test)] extern mod extra;
-extern mod serialize;
-extern mod term;
-extern mod collections;
+#[cfg(test)] extern crate extra;
+extern crate serialize;
+extern crate term;
+extern crate collections;
 
 pub mod util {
     pub mod interner;
index a02971ae8eaf287246c6ac04290fbe8b5ea62ae7..6cde22fad107cfa293333bf5251eb6e93020585c 100644 (file)
@@ -4528,7 +4528,7 @@ fn parse_opt_abis(&mut self) -> Option<AbiSet> {
     // parse one of the items or view items allowed by the
     // flags; on failure, return IoviNone.
     // NB: this function no longer parses the items inside an
-    // extern mod.
+    // extern crate.
     fn parse_item_or_view_item(&mut self,
                                attrs: ~[Attribute],
                                macros_allowed: bool)
@@ -4566,13 +4566,12 @@ fn parse_item_or_view_item(&mut self,
             let next_is_mod = self.eat_keyword(keywords::Mod);
 
             if next_is_mod || self.eat_keyword(keywords::Crate) {
-                // NOTE(flaper87): Uncomment this when this changes gets into stage0
-                //
-                // if next_is_mod {
-                //    self.span_err(self.span,
-                //                   format!("`extern mod` is obsolete, use `extern crate` instead \
-                //                           to refer to external crates."))
-                // }
+                if next_is_mod {
+                   self.span_err(mk_sp(lo, self.last_span.hi),
+                                 format!("`extern mod` is obsolete, use \
+                                          `extern crate` instead \
+                                          to refer to external crates."))
+                }
                 return self.parse_item_extern_crate(lo, visibility, attrs);
             }
 
@@ -4971,7 +4970,7 @@ fn parse_items_and_view_items(&mut self,
         let mut items = ~[];
 
         // I think this code would probably read better as a single
-        // loop with a mutable three-state-variable (for extern mods,
+        // loop with a mutable three-state-variable (for extern crates,
         // view items, and regular items) ... except that because
         // of macros, I'd like to delay that entire check until later.
         loop {
@@ -4987,12 +4986,12 @@ fn parse_items_and_view_items(&mut self,
                 IoviViewItem(view_item) => {
                     match view_item.node {
                         ViewItemUse(..) => {
-                            // `extern mod` must precede `use`.
+                            // `extern crate` must precede `use`.
                             extern_mod_allowed = false;
                         }
                         ViewItemExternMod(..) if !extern_mod_allowed => {
                             self.span_err(view_item.span,
-                                          "\"extern mod\" declarations are not allowed here");
+                                          "\"extern crate\" declarations are not allowed here");
                         }
                         ViewItemExternMod(..) => {}
                     }
@@ -5020,7 +5019,7 @@ fn parse_items_and_view_items(&mut self,
                 IoviViewItem(view_item) => {
                     attrs = self.parse_outer_attributes();
                     self.span_err(view_item.span,
-                                  "`use` and `extern mod` declarations must precede items");
+                                  "`use` and `extern crate` declarations must precede items");
                 }
                 IoviItem(item) => {
                     attrs = self.parse_outer_attributes();
@@ -5060,7 +5059,7 @@ fn parse_foreign_items(&mut self, first_item_attrs: ~[Attribute],
                 IoviViewItem(view_item) => {
                     // I think this can't occur:
                     self.span_err(view_item.span,
-                                  "`use` and `extern mod` declarations must precede items");
+                                  "`use` and `extern crate` declarations must precede items");
                 }
                 IoviItem(item) => {
                     // FIXME #5668: this will occur for a macro invocation:
index bb2f345ac2883810b708457cfd204dbd752e1905..ceaa7d1a9a151febce4ec36a07806afbbab4101c 100644 (file)
@@ -2061,7 +2061,7 @@ pub fn print_view_item(s: &mut State, item: &ast::ViewItem) -> io::IoResult<()>
     if_ok!(print_visibility(s, item.vis));
     match item.node {
         ast::ViewItemExternMod(id, ref optional_path, _) => {
-            if_ok!(head(s, "extern mod"));
+            if_ok!(head(s, "extern crate"));
             if_ok!(print_ident(s, id));
             for &(ref p, style) in optional_path.iter() {
                 if_ok!(space(&mut s.s));
index 36b267c7eb74173b3a405b1cff3f2f6541bd8897..180838d41325c38d95a56d82f9c3f13e3f4c1c56 100644 (file)
@@ -61,8 +61,8 @@ fn main() {
 
 // test harness access
 #[cfg(test)]
-extern mod extra;
-extern mod serialize;
+extern crate extra;
+extern crate serialize;
 
 use std::str;
 use std::vec;
index fd5308383c575472edb2163d823dc6670bf59609..800b56fe6af21ffd8e56aee8cf12dd758f5bbdf1 160000 (submodule)
--- a/src/libuv
+++ b/src/libuv
@@ -1 +1 @@
-Subproject commit fd5308383c575472edb2163d823dc6670bf59609
+Subproject commit 800b56fe6af21ffd8e56aee8cf12dd758f5bbdf1
index ca0809cb0901a358ec09507dc868d66f6a79d1b4..961455b9093bec909c45d1a1bd83f99b09b3b9f4 100644 (file)
@@ -1,2 +1,2 @@
 # Change the contents of this file to force a full rebuild of libuv
-2013-12-23
+2014-02-16
index 2db884fdb6436d2df391db5fdab3c688924638bb..f3011aaea10b9307ef2fb9b675769dda1db0f3a0 100644 (file)
@@ -1,3 +1,11 @@
+S 2014-02-14 18477ac
+  freebsd-x86_64 102df7dfab2a1c59d9e2f16a3f02f368310dd022
+  linux-i386 fcf5891e9b3c7c9ef5ee5ea37e62089346099425
+  linux-x86_64 d7c2df185fd2e25b4b8f5b2caad277b5ba664b81
+  macos-i386 c15faa408339ceebbb68e952e9bf7f2624ceb9e0
+  macos-x86_64 445c6759db5e69250b8a8631ea7751d1474e4250
+  winnt-i386 f78a892f47627f34233e44c2ff4a00b68063a2ce
+
 S 2014-02-12 c62f6ce
   freebsd-x86_64 737a423c5f803119ff5a692eac432fa9d0c595a8
   linux-i386 a7e90e27e8b6a3fa79ddc15f0ed217ccbade875d
index c80fb8ee9e9653caac08b9a5d4f27a611326e314..aa263f34841bbffcc7a33ec9d889e5301a07b2c6 100644 (file)
@@ -13,6 +13,6 @@
 #[crate_id="crateresolve4b#0.1"];
 #[crate_type = "lib"];
 
-extern mod crateresolve4a = "crateresolve4a#0.2";
+extern crate crateresolve4a = "crateresolve4a#0.2";
 
 pub fn f() -> int { crateresolve4a::g() }
index 019b6047e63ddf1453846e046abf83d2cf8605e4..e72a6cb163f32f54d56fb6f8e215cc403244ca1b 100644 (file)
@@ -13,6 +13,6 @@
 #[crate_id="crateresolve4b#0.2"];
 #[crate_type = "lib"];
 
-extern mod crateresolve4a = "crateresolve4a#0.1";
+extern crate crateresolve4a = "crateresolve4a#0.1";
 
 pub fn g() -> int { crateresolve4a::f() }
index 6b85d28b2889b1214655a5a16461f59d65be5e41..5cf5c6d178d94afbfbd139d13a9ca412be981ec7 100644 (file)
 
 // These both have the same version but differ in other metadata
 pub mod a {
-    extern mod cr_1 (name = "crateresolve_calories", vers = "0.1", calories="100");
+    extern crate cr_1 (name = "crateresolve_calories", vers = "0.1", calories="100");
     pub fn f() -> int { cr_1::f() }
 }
 
 pub mod b {
-    extern mod cr_2 (name = "crateresolve_calories", vers = "0.1", calories="200");
+    extern crate cr_2 (name = "crateresolve_calories", vers = "0.1", calories="200");
     pub fn f() -> int { cr_2::f() }
 }
index 39328f28beace641cb5708c6ef7db8c8f14a5951..54219de810707ac151bf5e7aa5b514bb598bd1dd 100644 (file)
@@ -9,11 +9,6 @@
 // except according to those terms.
 
 #[crate_id="crateresolve_calories#0.1"];
-// NOTE: remove after the next snapshot
-#[link(name = "crateresolve_calories",
-       vers = "0.1",
-       calories = "100")];
-
 #[crate_type = "lib"];
 
 pub fn f() -> int { 100 }
index edf90589db799b29af612050e8ce30a5b925dc7b..3b949b48613e46e5b35a4bfee6ca1e279f12aaef 100644 (file)
@@ -9,11 +9,6 @@
 // except according to those terms.
 
 #[crate_id="crateresolve_calories#0.1"];
-// NOTE: remove after the next snapshot
-#[link(name = "crateresolve_calories",
-       vers = "0.1",
-       calories = "200")];
-
 #[crate_type = "lib"];
 
 pub fn f() -> int { 200 }
index 054e0bf7c3229f39bb0986fb29d9cb9bf5cdf320..177b735ead7a106e54ea5c30d7eb855f1e0284fe 100644 (file)
@@ -13,4 +13,4 @@
 #[crate_id="b#0.1"];
 #[crate_type = "lib"];
 
-extern mod a;
+extern crate a;
index e932a9c29ea6a0d25e19620c7ce424042c0e09cb..701c9f643ff4796cc8205529a3618de4918129c2 100644 (file)
@@ -11,7 +11,7 @@
 #[crate_id="issue_2526#0.2"];
 #[crate_type = "lib"];
 
-extern mod extra;
+extern crate extra;
 
 struct arc_destruct<T> {
   _data: int,
index 15dde899ce374c2de5bdd1d99ab9c97af96f9173..5c5a80e5d00238da52c07e208246d5d04656f8ba 100644 (file)
@@ -12,7 +12,7 @@
 #[crate_id="req"];
 #[crate_type = "lib"];
 
-extern mod extra;
+extern crate extra;
 
 use std::cell::RefCell;
 use std::hashmap::HashMap;
index 7d80c5b937eea950aa29ec87db2843d7149a3b76..d1a6755c1e941e422064b12215649af0a3bf4780 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-fast windows doesn't like extern mod
+// ignore-fast windows doesn't like extern crate
 // aux-build:issue-9906.rs
 
 pub use other::FooBar;
index 2931245bb12bdf1e648706c40eae9b43021c2d86..1ec6ab906968f01f1e68d865ec83e27a2e955661 100644 (file)
@@ -10,7 +10,7 @@
 
 #[crate_type = "lib"];
 
-extern mod issue2378a;
+extern crate issue2378a;
 
 use issue2378a::maybe;
 
index 4008402441b5d953f8f1c7ba2974ac6b3c344e52..077f39502173047077fe82d5cd11d402d21afdfe 100644 (file)
@@ -11,7 +11,7 @@
 #[crate_id="c#0.1"];
 #[crate_type = "lib"];
 
-extern mod a;
+extern crate a;
 
 use a::to_strz;
 
index 92c20e8d9e39b45d7a7cf9e4fd7d2568ee07a874..36af01fe6c600e349ac9585e4d71879c03abcc21 100644 (file)
@@ -11,7 +11,7 @@
 #[allow(unused_imports)];
 #[feature(globs)];
 
-extern mod issue_2316_a;
+extern crate issue_2316_a;
 
 pub mod cloth {
     use issue_2316_a::*;
index eecbb325630d352c1c59d5fec5fcffe42cc88a8b..1a0fb8fe62990c8dc4afdde51699c7772ffac081 100644 (file)
@@ -12,7 +12,7 @@
 
 #[feature(macro_registrar)];
 
-extern mod syntax;
+extern crate syntax;
 
 use std::any::Any;
 use std::local_data;
index 2867e0f81430691ef80672a8ffa567e8c915c87c..b8baffcfea5fcbc4c3feb562a7f91c045b3e9870 100644 (file)
@@ -12,7 +12,7 @@
 
 #[feature(globs, macro_registrar, macro_rules, quote)];
 
-extern mod syntax;
+extern crate syntax;
 
 use syntax::ast::{Name, TokenTree};
 use syntax::codemap::Span;
index ce839daa3a09b5b71a44d2c29c1685f40eddec45..d59d7f2a6136c87b6b489a93215776d9f3f833b2 100644 (file)
@@ -8,6 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod pub_use_xcrate1;
+extern crate pub_use_xcrate1;
 
 pub use pub_use_xcrate1::Foo;
index 145f84e558fb869de585c7d47584bccf8ddb6ecc..6a8c03ec6ad349a322093d9d59b5fb672904c1fb 100644 (file)
@@ -10,7 +10,7 @@
 
 // aux-build:trait_default_method_xc_aux.rs
 
-extern mod aux = "trait_default_method_xc_aux";
+extern crate aux = "trait_default_method_xc_aux";
 use aux::A;
 
 pub struct a_struct { x: int }
index ed3874b1a6fcd69b658c1ad9ea56f640e6eb893c..61b3ccd1f54f68b53cf48435b55850ca0df4dad1 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
-extern mod collections;
+extern crate extra;
+extern crate collections;
 
 use extra::time;
 use collections::TreeMap;
index 2d63a6a241ea0fbb9159559738117e1dbfe9c39a..41c48d92692a53c89a23bac28404667676677a9d 100644 (file)
@@ -10,8 +10,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
-extern mod collections;
+extern crate extra;
+extern crate collections;
 
 use collections::bitv::BitvSet;
 use collections::TreeSet;
index 743472af5ce3faa33821d5642c62474d7e44ab49..9c29b691173963d5e407a46e51248d2ce7454e2b 100644 (file)
@@ -12,7 +12,7 @@
 
 #[feature(macro_rules)];
 
-extern mod extra;
+extern crate extra;
 
 use extra::time::precise_time_s;
 use std::mem::swap;
index b766be88d2309047aac82666d5a26e905429cbde..ae1ae0a436775fa1fd1f69ca16bb708936da0d01 100644 (file)
@@ -18,7 +18,7 @@
 // different scalability characteristics compared to the select
 // version.
 
-extern mod extra;
+extern crate extra;
 
 use std::comm;
 use std::os;
index 89e0bcf33263833f067c05524901f62f542f0f98..ca06e96f0c0ee918356dd5a66b56300e6a0a89b1 100644 (file)
@@ -14,7 +14,7 @@
 //
 // I *think* it's the same, more or less.
 
-extern mod extra;
+extern crate extra;
 
 use std::os;
 use std::task;
index 4b505ec8117622b81d4cd3cc939d40e078fd2dd4..5dcccf8d861b6ba8f4790607abb123b4487bb92f 100644 (file)
@@ -15,8 +15,8 @@
 
 // This also serves as a pipes test, because Arcs are implemented with pipes.
 
-extern mod extra;
-extern mod sync;
+extern crate extra;
+extern crate sync;
 
 use sync::Arc;
 use sync::MutexArc;
index 23b4f00b280da976a2d7b90fb8562ef36b7b95d9..3d619f2e31381d916a6874c470f5282dd9f967ee 100644 (file)
@@ -15,8 +15,8 @@
 
 // This also serves as a pipes test, because Arcs are implemented with pipes.
 
-extern mod extra;
-extern mod sync;
+extern crate extra;
+extern crate sync;
 
 use sync::RWArc;
 use sync::Future;
index e9e59924acc7254908bbd79a2d4bd0a54792bf93..42918ae5aa006f6c9cf44d516f320250492301c8 100644 (file)
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Perlin noise benchmark from https://gist.github.com/1170424
+// Multi-language Perlin noise benchmark.
+// See https://github.com/nsf/pnoise for timings and alternative implementations.
 
-use std::f64;
-use std::rand::Rng;
-use std::rand;
+use std::f32::consts::PI;
+use std::rand::{Rng, StdRng};
 
 struct Vec2 {
     x: f32,
     y: f32,
 }
 
-#[inline(always)]
 fn lerp(a: f32, b: f32, v: f32) -> f32 { a * (1.0 - v) + b * v }
 
-#[inline(always)]
 fn smooth(v: f32) -> f32 { v * v * (3.0 - 2.0 * v) }
 
-fn random_gradient<R:Rng>(r: &mut R) -> Vec2 {
-    let v = 2.0 * f64::consts::PI * r.gen();
-    Vec2 {
-        x: v.cos() as f32,
-        y: v.sin() as f32,
-    }
+fn random_gradient<R: Rng>(r: &mut R) -> Vec2 {
+    let v = PI * 2.0 * r.gen();
+    Vec2 { x: v.cos(), y: v.sin() }
 }
 
 fn gradient(orig: Vec2, grad: Vec2, p: Vec2) -> f32 {
-    let sp = Vec2 {x: p.x - orig.x, y: p.y - orig.y};
-    grad.x * sp.x + grad.y * sp.y
+    (p.x - orig.x) * grad.x + (p.y - orig.y) * grad.y
 }
 
 struct Noise2DContext {
     rgradients: [Vec2, ..256],
-    permutations: [int, ..256],
+    permutations: [i32, ..256],
 }
 
 impl Noise2DContext {
-    pub fn new() -> Noise2DContext {
-        let mut r = rand::rng();
-        let mut rgradients = [ Vec2 { x: 0.0, y: 0.0 }, ..256 ];
-        for i in range(0, 256) {
-            rgradients[i] = random_gradient(&mut r);
-        }
-        let mut permutations = [ 0, ..256 ];
-        for i in range(0, 256) {
-            permutations[i] = i;
+    fn new() -> Noise2DContext {
+        let mut rng = StdRng::new();
+
+        let mut rgradients = [Vec2 { x: 0.0, y: 0.0 }, ..256];
+        for x in rgradients.mut_iter() {
+            *x = random_gradient(&mut rng);
         }
-        r.shuffle_mut(permutations);
 
-        Noise2DContext {
-            rgradients: rgradients,
-            permutations: permutations,
+        let mut permutations = [0i32, ..256];
+        for (i, x) in permutations.mut_iter().enumerate() {
+            *x = i as i32;
         }
+        rng.shuffle_mut(permutations);
+
+        Noise2DContext { rgradients: rgradients, permutations: permutations }
     }
 
-    #[inline(always)]
-    pub fn get_gradient(&self, x: int, y: int) -> Vec2 {
+    fn get_gradient(&self, x: i32, y: i32) -> Vec2 {
         let idx = self.permutations[x & 255] + self.permutations[y & 255];
         self.rgradients[idx & 255]
     }
 
-    #[inline]
-    pub fn get_gradients(&self,
-                         gradients: &mut [Vec2, ..4],
-                         origins: &mut [Vec2, ..4],
-                         x: f32,
-                         y: f32) {
+    fn get_gradients(&self, x: f32, y: f32) -> ([Vec2, ..4], [Vec2, ..4]) {
         let x0f = x.floor();
         let y0f = y.floor();
-        let x0 = x0f as int;
-        let y0 = y0f as int;
+        let x1f = x0f + 1.0;
+        let y1f = y0f + 1.0;
+
+        let x0 = x0f as i32;
+        let y0 = y0f as i32;
         let x1 = x0 + 1;
         let y1 = y0 + 1;
 
-        gradients[0] = self.get_gradient(x0, y0);
-        gradients[1] = self.get_gradient(x1, y0);
-        gradients[2] = self.get_gradient(x0, y1);
-        gradients[3] = self.get_gradient(x1, y1);
-
-        origins[0] = Vec2 {x: x0f + 0.0, y: y0f + 0.0};
-        origins[1] = Vec2 {x: x0f + 1.0, y: y0f + 0.0};
-        origins[2] = Vec2 {x: x0f + 0.0, y: y0f + 1.0};
-        origins[3] = Vec2 {x: x0f + 1.0, y: y0f + 1.0};
+        ([self.get_gradient(x0, y0), self.get_gradient(x1, y0),
+          self.get_gradient(x0, y1), self.get_gradient(x1, y1)],
+         [Vec2 { x: x0f, y: y0f }, Vec2 { x: x1f, y: y0f },
+          Vec2 { x: x0f, y: y1f }, Vec2 { x: x1f, y: y1f }])
     }
 
-    #[inline]
-    pub fn get(&self, x: f32, y: f32) -> f32 {
+    fn get(&self, x: f32, y: f32) -> f32 {
         let p = Vec2 {x: x, y: y};
-        let mut gradients = [ Vec2 { x: 0.0, y: 0.0 }, ..4 ];
-        let mut origins = [ Vec2 { x: 0.0, y: 0.0 }, ..4 ];
-        self.get_gradients(&mut gradients, &mut origins, x, y);
+        let (gradients, origins) = self.get_gradients(x, y);
+
         let v0 = gradient(origins[0], gradients[0], p);
         let v1 = gradient(origins[1], gradients[1], p);
         let v2 = gradient(origins[2], gradients[2], p);
         let v3 = gradient(origins[3], gradients[3], p);
+
         let fx = smooth(x - origins[0].x);
         let vx0 = lerp(v0, v1, fx);
         let vx1 = lerp(v2, v3, fx);
         let fy = smooth(y - origins[0].y);
+
         lerp(vx0, vx1, fy)
     }
 }
 
 fn main() {
-    let symbols = [" ", "░", "▒", "▓", "█", "█"];
+    let symbols = [' ', '░', '▒', '▓', '█', '█'];
     let mut pixels = [0f32, ..256*256];
-    let n2d = ~Noise2DContext::new();
-    for _ in range(0, 100u) {
+    let n2d = Noise2DContext::new();
+
+    for _ in range(0, 100) {
         for y in range(0, 256) {
             for x in range(0, 256) {
-                let v = n2d.get(
-                    x as f32 * 0.1f32,
-                    y as f32 * 0.1f32
-                ) * 0.5f32 + 0.5f32;
-                pixels[y*256+x] = v;
-            };
-        };
-    };
+                let v = n2d.get(x as f32 * 0.1, y as f32 * 0.1);
+                pixels[y*256+x] = v * 0.5 + 0.5;
+            }
+        }
+    }
 
     for y in range(0, 256) {
         for x in range(0, 256) {
-            print!("{}", symbols[(pixels[y*256+x] / 0.2f32) as int]);
+            let idx = (pixels[y*256+x] / 0.2) as uint;
+            print!("{:c}", symbols[idx]);
         }
-        println!("");
+        print!("\n");
     }
 }
index b42644f39cb30d7ce84456c2f9e81c909c0cb048..0cecb5d752724af1cc61a836d8b6236359049e9d 100644 (file)
@@ -17,7 +17,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::os;
 use std::uint;
index 59f5afa47dafd130151c709a82212d2065ffcb4a..0512c2a3c967c4da5947d4834fac14e41d6f050b 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::os;
 use std::uint;
index 20ecee5499fdddde2e42a13f7a5c3b06bc1b1930..40e6a0a7beda2fe0150f2a203c80525023830636 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::task::spawn;
 use std::os;
index a7f86b01b3fffdd40c85e8773bb9ad923e4f4203..d308ed6a7d1d70ea21c2d5a3c2edb578476f3f22 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::os;
 
index c0e22f207b8f9c0a8e4b9065a2cd0be86e6b1736..18df07868727e1a372e1432945057d4984a4f230 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod sync;
-extern mod arena;
+extern crate sync;
+extern crate arena;
 
 use std::iter::range_step;
 use sync::Future;
index 5c237b306fbd820424da02f8b9e22fc40e703a0f..a6bbea0ac14da759acc2b7882e69aec2e77a6d8e 100644 (file)
@@ -10,7 +10,7 @@
 
 // chameneos
 
-extern mod extra;
+extern crate extra;
 
 use std::option;
 use std::os;
index 12e78629386259b6de999fefe65c8ab684aae366..f0c3517a0b88e79f4a27a81348d94dcdc2b85b32 100644 (file)
@@ -51,7 +51,7 @@ impl<'a> Iterator<u8> for AAGen<'a> {
     fn next(&mut self) -> Option<u8> {
         let r = self.rng.gen();
         self.data.iter()
-            .skip_while(|pc| pc.n0() < r)
+            .skip_while(|pc| pc.val0() < r)
             .map(|&(_, c)| c)
             .next()
     }
index d7a9dd86f4dddc050fd59ac0a52161b0856e1601..4a4b2e8e875caf909920b0927572530ee68e1939 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::os;
 
index 6f7630ebe8ac774a5a7a5d174e36d1b10a3d443e..737e5c98214c900e3c659cebd1f026a0fdaeacf6 100644 (file)
@@ -13,7 +13,7 @@
 // ignore-pretty the `let to_child` line gets an extra newline
 // multi tasking k-nucleotide
 
-extern mod extra;
+extern crate extra;
 
 use std::cmp::Ord;
 use std::comm;
index bdad46bad2e80bcfc2bb529bc2e28c22dd6ea1ad..9190ff69347eb4a2b5ff7403b6f56147e8891599 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-test
 
-extern mod extra;
+extern crate extra;
 
 use std::cast::transmute;
 use std::i32::range;
index 7f4fd3cf94ce1320fbbf43131da6bd9e1d29fd23..48aaa7d5b0ab07b49c093c410dbbe377c1f739f2 100644 (file)
@@ -18,8 +18,8 @@
 
 */
 
-extern mod extra;
-extern mod getopts;
+extern crate extra;
+extern crate getopts;
 
 use extra::time;
 use std::os;
index 33f20cf0d1f9bb8b216809acd792da558665929b..93ef2b7bb82510cac24c6309e894ad33c6f19911 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod num;
+extern crate num;
 
 use std::from_str::FromStr;
 use std::num::One;
index a6e6713e137b11d47fba1b67b4aad51a72e87eaa..02b3cfae1f4fd7ea5a9badfa7c944b1f43ec48aa 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-test arcs no longer unwrap
 
-extern mod sync;
+extern crate sync;
 
 use std::from_str::FromStr;
 use std::iter::count;
index 58f667b929ff491a80cac88dbd2b228833b93535..6f9c6abea1b4703bbeb4084bdd8a91eb4c156978 100644 (file)
@@ -10,8 +10,8 @@
 
 // Microbenchmark for the smallintmap library
 
-extern mod extra;
-extern mod collections;
+extern crate extra;
+extern crate collections;
 
 use collections::SmallIntMap;
 use std::os;
index 371e07bc7d94124b677f63e69ad8c8e4cbfa40a5..a4041ae1816444dd395a0953a4739883211ce6e5 100644 (file)
@@ -12,7 +12,7 @@
 
 #[feature(managed_boxes)];
 
-extern mod extra;
+extern crate extra;
 
 use std::io;
 use std::io::stdio::StdReader;
index 42b564edbc521142517109e4e9e89c2df67cac72..51eb65b1d5c7ed7beed723a61c8946523f002f46 100644 (file)
@@ -10,8 +10,8 @@
 
 #[feature(managed_boxes)];
 
-extern mod extra;
-extern mod collections;
+extern crate extra;
+extern crate collections;
 
 use collections::list::{List, Cons, Nil};
 use extra::time::precise_time_s;
@@ -90,8 +90,8 @@ fn recurse_or_fail(depth: int, st: Option<State>) {
             State {
                 managed: @Cons((), st.managed),
                 unique: ~Cons((), @*st.unique),
-                tuple: (@Cons((), st.tuple.first()),
-                        ~Cons((), @*st.tuple.second())),
+                tuple: (@Cons((), st.tuple.ref0().clone()),
+                        ~Cons((), @*st.tuple.ref1().clone())),
                 vec: st.vec + &[@Cons((), *st.vec.last().unwrap())],
                 res: r(@Cons((), st.res._l))
             }
index ca1e0293f8ee7ad07ceb5ff6e71d3c429da42b88..a7a0243853018c573f7e9de31ab36c01cfa2d355 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast aux-build
 // aux-build:ambig_impl_2_lib.rs
-extern mod ambig_impl_2_lib;
+extern crate ambig_impl_2_lib;
 use ambig_impl_2_lib::me;
 trait me {
     fn me(&self) -> uint;
index 5c55f10ab4f2a8c7ed8bf46e659e05f19556cc20..151f4940d5702937dbed732b640c89ba0993252c 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod sync;
+extern crate sync;
 use sync::RWArc;
 
 fn main() {
index c9cd13278822567145669ac7f9fb0f8715f5fa1e..71d42d46e7c5f4409cfdcef5b76561610c8fb0f1 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // error-pattern: lifetime of return value does not outlive the function call
-extern mod sync;
+extern crate sync;
 use sync::RWArc;
 fn main() {
     let x = ~RWArc::new(1);
index 653f37d96d473d8bb41cb12cfcc808d59c3e6ff3..1787cd5d0b46c47b0ed0668ffad3e3908882c4ea 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod sync;
+extern crate sync;
 use sync::RWArc;
 fn main() {
     let x = ~RWArc::new(1);
index 4bb7653d23e5c44d8d5c61dff4fe018b61fa3d5c..cccca050696a34682891a1c28887debcfb44788c 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod sync;
+extern crate sync;
 use sync::RWArc;
 fn main() {
     let x = ~RWArc::new(1);
index 1410308107e948ac31473b689fe38933e28003a7..a08cb055020a531dfc8d3321a2b33dc886f794c7 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // error-pattern: lifetime of variable does not enclose its declaration
-extern mod sync;
+extern crate sync;
 use sync::RWArc;
 fn main() {
     let x = ~RWArc::new(1);
index 68226d96a18ef89af256de47ac1cb6d5d91e84cf..8f93d672b90161fd77e0aeedfc5d62f794532887 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // error-pattern: lifetime of variable does not enclose its declaration
-extern mod sync;
+extern crate sync;
 use sync::RWArc;
 fn main() {
     let x = ~RWArc::new(1);
diff --git a/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs b/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs
new file mode 100644 (file)
index 0000000..6106644
--- /dev/null
@@ -0,0 +1,19 @@
+// 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.
+
+// verify that an error is raised when trying to move out of a
+// borrowed path.
+
+fn main() {
+    let a = ~~2;
+    let b = &a;
+
+    let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed
+}
index 34dc69d7ecada5eef8c70363b05e45529085c70a..bd85141171eb4aabf37536c4dc5364512e47d676 100644 (file)
@@ -15,7 +15,7 @@
 // Test for traits inheriting from the builtin kinds cross-crate.
 // Mostly tests correctness of metadata.
 
-extern mod trait_superkinds_in_metadata;
+extern crate trait_superkinds_in_metadata;
 use trait_superkinds_in_metadata::{RequiresRequiresFreezeAndSend, RequiresFreeze};
 
 struct X<T>(T);
index e2a36ae1361e6dc236d84c4cc12385c32b7c2ac7..dcecbd5658de33e64cb8b892c187e4fb5023ad9a 100644 (file)
@@ -14,7 +14,7 @@
 // Tests that methods that implement a trait cannot be invoked
 // unless the trait is imported.
 
-extern mod coherence_inherent_cc_lib;
+extern crate coherence_inherent_cc_lib;
 
 mod Import {
     // Trait is in scope here:
index 3a1f696193e96a94cea05034f190f91ab1737222..6c7722bbd254df5df8b101b9748fa013caafb29f 100644 (file)
@@ -12,7 +12,7 @@
 // 'conflicting implementations' error message.
 
 // aux-build:trait_impl_conflict.rs
-extern mod trait_impl_conflict;
+extern crate trait_impl_conflict;
 use trait_impl_conflict::Foo;
 
 impl<A> Foo for A {
index c7aa2d3240816e51448807ddd256f81f9df1b24c..8c3dbda68020128c12036867b328b50b97c02f4e 100644 (file)
@@ -13,7 +13,7 @@
 // aux-build:crateresolve1-3.rs
 // error-pattern:multiple matching crates for `crateresolve1`
 
-extern mod crateresolve1;
+extern crate crateresolve1;
 
 fn main() {
 }
index b1565d4b3a1503d399cf195d99ca85d0f41c4aa2..c5e9d1281526d9585c7f9142c2fba696cca36500 100644 (file)
 // aux-build:crateresolve2-3.rs
 // error-pattern:using multiple versions of crate `crateresolve2`
 
-extern mod crateresolve2 = "crateresolve2#0.1";
+extern crate crateresolve2 = "crateresolve2#0.1";
 
 mod m {
-    pub extern mod crateresolve2 = "crateresolve2#0.2";
+    pub extern crate crateresolve2 = "crateresolve2#0.2";
 }
 
 fn main() {
index 127b7575a7e0c089ce4b34bfd5373bdf1feb76e2..124696630cc089f802e8d31a99444bca9de6d10a 100644 (file)
@@ -12,8 +12,8 @@
 // aux-build:crateresolve5-1.rs
 // aux-build:crateresolve5-2.rs
 
-extern mod cr5_1 = "crateresolve5#0.1";
-extern mod cr5_2 = "crateresolve5#0.2";
+extern crate cr5_1 = "crateresolve5#0.1";
+extern crate cr5_2 = "crateresolve5#0.2";
 
 
 fn main() {
index 983156f9b4ffbb9654bb30b1f3182647e7e1782c..89839c06f3baae981489647d2defbc14a2ad797a 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index e5ceef886e1d3af7b627b206113f9c4e8f37714f..4c47e77dd8178fb0b2d3a124cc97e45bba9515d8 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index fd763df311c67340382e54649be58e59b98670ba..1a2eb3fc6403e776391271b46b303d1ddc1fd43f 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index d444c5e3161684a4d5320e26a5eebc1a7576961a..03fb284b50b8310b07167adf0553efb9994307be 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 0dc6266bec41b0919e3dbbf0227fe22ce1d2641f..7cee7b8ee0d0a326ef421140262183f7e594183b 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 #[deriving(Clone)]
 struct Error;
index 5b210d0ff7964181c538c787157b38b3c785dad9..c18ebe1758d3ea72d190bb713a00581f8081227a 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 #[deriving(Clone)]
 struct Error;
index f063ed58dce5b1a33547300aef2f6d005aea1fb9..7d33cd1a28df1ef398857dc92f8e8c532928205b 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 #[deriving(Clone)]
 struct Error;
index 1b053897c0e016899ec25f14b1d1cc7879616005..42dd608f61781780202ebb4db97b44c8dc784720 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 #[deriving(Clone)]
 struct Error;
index 7c2edd8cb7bff2217daaff0f83c0d2ad589c7984..21da9fef3982fd6a96f29382470391827a194665 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index e0269a6aad3b2e4f26a97188664c3da0c6a24fc6..2cfc7e2a259a3b3fed03303328a7da7fbc87dc92 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index abedb3e660f18ddbbe56cecb3bf8142f0ac821ed..ce3d84a2e9b410f8049048b289b0a81d2234e48b 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 3486d96205b4d75ea59793f20798b12b43edaae1..c59a81fd147c64a6ef0d0c3f22ec181e4ff7c53d 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 32d2e78eabcefaf141313c4a97e25693b82be6ac..b797a0d7790a3854f677abc46454d646989f9537 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index acc46a1002af1170cae9b0e3f23b7b6b86ff91ab..fb4d850ed11e2d29f14aad4a16babd6e5618522f 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 933da411db8b723d399949efa83372737c10a2c0..e3e442e70cf99d3ffa667d8f8a84dd33b6d10676 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index c310965cfa1b9559a87b8978c99ddf127f2db7bf..41e6c2c9e8dad7970c3f801f39d0ced5aeca6d38 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 327ac73ff2d980d611e9f41669268f7915d268d7..2caf68a26fcc24f51426d3b64582336f83fb2212 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 2a482f872c59a99429d86c19f9d9e5c5538a1235..c783befa3919c9b3aee04439bcf31af18e58ca10 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index ae0732e4db63484873fc0e51a69efe185052c32a..615112c129e220edaa3952d9bd40a11a2a918f10 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index ef29ce082923d9930a43f649f2bd00ead61722d3..a1943941e4171ffb9db59865705ab6e709d86369 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 2ce4d49e721537c89600904484501aed38cf033d..00d9c1de5c55f438758b5cab21e9fb8f6f978e11 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 3f6738fd306d4a9cf5cd31d425094067fd605b3d..c61a7c76bfb16de5248997e1db3c030244559f23 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 582c95b746b7a45cce817b83be675de4b65b8389..e22b51d19e56ef5b676176bfdc1060127079391b 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 92efe01fa3863120457a732d95a17cbd3ff3396c..fffbd49a2bb3858a51daa51ba559d7f5d94b4db5 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 7eff82f9d13ff39548d55a7c60a99a10ed50417a..45afd4454e86b98a1ba79d6112bb13be57731350 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 600a0400350dbea8ace9f00b164dcf8e9b380d74..1a199974eba0fbd89481659e23795613bed4f7d7 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 8e55609a515d83c6644258c8781f2d7c90432bc0..f054e9e7e77f655239f331ab19998d77f23182a9 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 968f0420687c57bb16a7e999b17c6b44ba85b5dc..38b8d55bcd83a16c1c5dd41f69b615795a8a61d2 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 8c53d1167f12ff21b36744349b8150d89e9eaa6d..66e5ef57a00b5555827efd00825302427920dea1 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 16d49954dce7ab214184678fa44a208118d9b10b..dd0be2dc04a6588e345937351c66222b2bac4540 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index fe598906c02880d098b4a95473bf492f71dfe889..76bcd3325624010ba0ed4e562b3f11f8abdb8e3d 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 #[deriving(TotalEq)]
 struct Error;
index 6bccd22c45f8e82710f3583a7306e584d358b3d1..303e35108feea1c388a981ffa56823eaf85ec45e 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 #[deriving(TotalEq)]
 struct Error;
index 4ff48824a7bace0137cef20dd1de1a62667299f0..bbcc3ae7e047a775cc7dd3fcca1663b1422c9a0b 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 #[deriving(TotalEq)]
 struct Error;
index 08e2c9bcd7d9a03aa780eb1e38b7f9c832d5ae80..4e8697749e76e519ad2131145f26bece8a3c082f 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 #[deriving(TotalEq)]
 struct Error;
index 2892938926b498a5b5cdc38ac78de481e0328f69..7256b1179dbf4f359f77ac7adde56c7258a50642 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 43d84a593edaede08af05c9c04e75defe3fb4981..d483a86fddbb864a5168c7960ff62feaaafb98db 100644 (file)
@@ -11,7 +11,7 @@
 // This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
 
 #[feature(struct_variant)];
-extern mod extra;
+extern crate extra;
 
 
 struct Error;
index 5b634818d44367d32e91cc83ae5970a0b954475d..244ae47a277e73471ba2637a4d01cbd85e7dc2b3 100644 (file)
@@ -11,7 +11,7 @@
 // issue 7327
 
 // ignore-fast #7103
-extern mod sync;
+extern crate sync;
 use sync::Arc;
 
 struct A { y: Arc<int>, x: Arc<int> }
index 69a90275ec78baf49e6200babd9ea3fadc3f1149..e44efc140a5e309a1b876d3c1797f9a3a5141169 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod sync;
+extern crate sync;
 
 use sync::Future;
 
index 96814e11049e0f4e9b7535365266f74d4bee9c30..f37a6aa354a5fa7e0de0478f80e027066ed9009b 100644 (file)
@@ -12,7 +12,7 @@
 
 #[feature(struct_variant)];
 
-extern mod bäz; //~ ERROR non-ascii idents
+extern crate bäz; //~ ERROR non-ascii idents
 
 use föö::bar; //~ ERROR non-ascii idents
 
index 3a801e1351ac96a4e34023c591e316b5c1b1ccf9..416a7691ceb5fbfc65fa83f41b86c7b6c60530fc 100644 (file)
@@ -12,6 +12,6 @@
 
 #[phase(syntax)]
 //~^ ERROR compile time crate loading is experimental and possibly buggy
-extern mod macro_crate_test;
+extern crate macro_crate_test;
 
 fn main() {}
index a000b91dfdea31b182ad0deb5f2a09e78c424a5d..59c44bff3c79d846d1ded404a09b4c2811884daa 100644 (file)
@@ -11,4 +11,4 @@
 #[simd]
 pub struct i64x2(i64, i64); //~ ERROR: SIMD types are experimental
 
-fn main() {}
\ No newline at end of file
+fn main() {}
index 9ca91f067ba03c775c590f15c079f696a79995c1..ecc584d81b0e10d5d9afef848fad14a72fd3c190 100644 (file)
@@ -10,7 +10,7 @@
 
 // aux-build:private_trait_xc.rs
 
-extern mod private_trait_xc;
+extern crate private_trait_xc;
 
 struct Bar;
 
index 641403fb85a148eb913883981857c78c2c8baa60..038b2b0d87624a680a803ade94f98b21c0c7e130 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 fn siphash(k0 : u64) {
 
index a0b78a4bc79b17699f4d0c6a085b19d6af09112a..392cc2f3c9006a3f40ca08ab8693f4163a4e0bc5 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 fn siphash<T>() {
 
index c5ee9e8bb90e1b9330a4b524f44e47941839acee..95c0eb711e8f72fdc17a99341c4457c38c2e5ea0 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 trait siphash {
     fn result(&self) -> u64;
index 56ade814db0207bf60ff70c2a245ec00064e4365..7bb1faf514a04f50b5feec83687e29090cac36f5 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 trait SipHash {
     fn reset(&self);
index 5f3af86545462ddfd8bbfd413952a80ae825d73a..799f5b4d5320cb5777dfcc6c0edaf641c873db7f 100644 (file)
@@ -8,11 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::ptr;
-
 enum bottom { }
 
 fn main() {
-    let x = ptr::to_unsafe_ptr(&()) as *bottom;
+    let x = &() as *() as *bottom;
     match x { } //~ ERROR non-exhaustive patterns
 }
index df18a5ad2d321000edb57db00e6d87dfe7577de3..5d292531b49ff7dc2faaa6e9383e8ffe7e5b5309 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // aux-build:issue_3907.rs
-extern mod issue_3907;
+extern crate issue_3907;
 
 type Foo = issue_3907::Foo; //~ ERROR: reference to trait
 
index 9d4c3cfa6784e4c21d3275bad4fcf0723eb3c325..6c85a97f7f57fe6106d1d0aefedea138b5641ad6 100644 (file)
@@ -10,7 +10,7 @@
 
 //aux-build:issue_5844_aux.rs
 
-extern mod issue_5844_aux;
+extern crate issue_5844_aux;
 
 fn main () {
     issue_5844_aux::rand(); //~ ERROR: requires unsafe
index b8292d617525e92fb2d7c70bd780d61f36966e4b..da90c4ee7531e92f83758f6482ab429b694950f6 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub extern mod std; //~ ERROR: `pub` visibility is not allowed
-priv extern mod std; //~ ERROR: unnecessary visibility qualifier
-extern mod std;
+pub extern crate std; //~ ERROR: `pub` visibility is not allowed
+priv extern crate std; //~ ERROR: unnecessary visibility qualifier
+extern crate std;
 
 pub use std::bool;
 priv use std::bool; //~ ERROR: unnecessary visibility qualifier
index 84a17078116998321e500a13a717621f94e7b54c..f45f654229f5449a223e33d55bc5a6ccb9bba511 100644 (file)
@@ -18,7 +18,7 @@
 #[allow(dead_code)];
 
 mod cross_crate {
-    extern mod lint_stability;
+    extern crate lint_stability;
     use self::lint_stability::*;
 
     fn test() {
index b74c1d61eb8143cb5f1590e62bf63d7bcb5970ab..63c66e53c5ee8909ccb4fb9c5f47405fbccd3d54 100644 (file)
@@ -10,4 +10,4 @@
 
 fn main() {
     log_syntax!() //~ ERROR `log_syntax!` is not stable enough
-}
\ No newline at end of file
+}
index e111393d9a75457263a69002163ab32e93861ab0..aaf89807ced318a3af490e6a22e2408c4fc9651b 100644 (file)
@@ -15,7 +15,7 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod macro_crate_test;
+extern crate macro_crate_test;
 
 fn main() {
     assert_eq!(3, unexported_macro!()); //~ ERROR macro undefined: 'unexported_macro'
index 83538fcf454e875ebef94e292775ac34f5c9175b..3301eb145ce271df34693d6b28d11af83c6d872e 100644 (file)
@@ -11,6 +11,6 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod doesnt_exist; //~ ERROR can't find crate
+extern crate doesnt_exist; //~ ERROR can't find crate
 
 fn main() {}
index 7c01ddb6c93319af69e1b6f1e4b0e14863dd8a18..97a2b00ba424c0ce0d747ab303d2db22a8929099 100644 (file)
@@ -12,7 +12,7 @@
 // temporary kinds wound up being stored in a cache and used later.
 // See middle::ty::type_contents() for more information.
 
-extern mod extra;
+extern crate extra;
 
 struct List { key: int, next: Option<~List> }
 
index cdfdd29410e76a1d719ed54d796520621adc0ffa..34c56f98404d31aed246fb4777aae49886d0e0e3 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod sync;
+extern crate sync;
 
 use std::task;
 use sync::MutexArc;
index cc529abd6f94f2d0c8dfb4892177596b2588f9b9..8df156d8332fed3a341757f0770fa45734fb78fd 100644 (file)
@@ -10,7 +10,7 @@
 
 // error-pattern: use of moved value
 
-extern mod sync;
+extern crate sync;
 use sync::Arc;
 
 use std::task;
index 204a0e1cdd4a077bb15a3528fe901a319bc1c950..b387d3a1719e9f2bd4f2d83db8dfa9a0acddbb71 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod sync;
+extern crate sync;
 use sync::Arc;
 
 use std::task;
index 3add0134d002ab24a3c1fdd5e79221a8e17c0d2b..7091995fa7729459d1fe7c5d1cfbf43df7b449d8 100644 (file)
@@ -10,7 +10,7 @@
 
 // aux-build:noexporttypelib.rs
 
-extern mod noexporttypelib;
+extern crate noexporttypelib;
 
 fn main() {
     // Here, the type returned by foo() is not exported.
index a7e4f8de43704500553ddd13d6c96de68d97337a..675dcf95595a8e09a351de0b773bc15c2e7d58f5 100644 (file)
@@ -12,7 +12,7 @@
 // This program would segfault if it were legal.
 
 #[feature(once_fns)];
-extern mod sync;
+extern crate sync;
 use sync::Arc;
 
 fn foo(blk: proc()) {
index 8b168dd67870ecfc5507348c5fced6999ee866e9..48dd484c1c26be7f670107d9f82a315bbb052f8f 100644 (file)
@@ -12,7 +12,7 @@
 // This program would segfault if it were legal.
 
 #[feature(once_fns)];
-extern mod sync;
+extern crate sync;
 use sync::Arc;
 
 fn foo(blk: once ||) {
index 4fa6b6af7949e4545e4737aa7282e53dbef175dc..804ea46b4266f8852be0a52a71d753730eb17102 100644 (file)
@@ -11,7 +11,7 @@
 // Testing guarantees provided by once functions.
 // This program would segfault if it were legal.
 
-extern mod sync;
+extern crate sync;
 use sync::Arc;
 
 fn foo(blk: ||) {
index a26733ebcee662b24b121eba10c77a812753a7bf..e58c4b146858835faa860d4910c183b653ab865a 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-extern mod extra;
+extern crate extra;
 
 enum bar { t1((), Option<~[int]>), t2, }
 
index b3e907f913f0ca07181efa5aae59aab49956018c..b687a225754e03da2ff36a19f30692e0755d36d1 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 // error-pattern: mismatched types
 
index 8561006fbe966bcabefad46e7a6c9aee00a2f443..8efa910f7c6aac74da2744f80866d84fa2f87889 100644 (file)
@@ -15,7 +15,7 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod macro_crate_test;
+extern crate macro_crate_test;
 
 fn main() {
     macro_crate_test::foo();
index 4e5645c00c7c4d320ce35fcb4534cffd574755ca..2e79c0f46adb5e3f7a1a066853f64383883bc4f0 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 // aux-build:cci_class_5.rs
-extern mod cci_class_5;
+extern crate cci_class_5;
 use cci_class_5::kitties::cat;
 
 fn main() {
index 0b46e8d0a8206d037e3f828237fdc9006491fb3f..0993ac9a64ad377c01912cb5cc59ccf83313ce83 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // aux-build:cci_class.rs
-extern mod cci_class;
+extern crate cci_class;
 use cci_class::kitties::cat;
 
 fn main() {
index d6c614b707045d077a0817989a0b32f89818a201..5a252eb2975275f63e02c59c26494e83e63cc20d 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-test
 // aux-build:private_variant_xc.rs
 
-extern mod private_variant_xc;
+extern crate private_variant_xc;
 
 pub fn main() {
     let _ = private_variant_xc::Bar;
index 86f1a97b1d64c3fbfa753c67e52cc559731affac..4afbe7ed48b1c2db141ee8a26cb26dde4efef712 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-test
 // aux-build:private_variant_1.rs
 
-extern mod private_variant_1;
+extern crate private_variant_1;
 
 fn main() {
     let _x = private_variant_1::super_sekrit::baz; //~ ERROR baz is private
index cc3513b8fe6231f6feeafc03582f85bdd11cd3a9..d45759e38d99e4e5085f841209166fd8a59fe6e0 100644 (file)
@@ -12,8 +12,8 @@
 
 #[feature(quote)];
 
-extern mod extra;
-extern mod syntax;
+extern crate extra;
+extern crate syntax;
 
 use io::*;
 
index 165a1e2663cbd8cc77a8b12c8817ade3648482c8..b5c2dee61c73699d95e5d5d9de8cf05e59da02c5 100644 (file)
@@ -12,8 +12,8 @@
 
 #[feature(quote)];
 
-extern mod extra;
-extern mod syntax;
+extern crate extra;
+extern crate syntax;
 
 use extra::io::*;
 
index 1aafd9057c266809770ea7c8e08dabaa8fc12f62..8453ace2b51d9eb2e703e1152f4001967ef2fbb9 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 mod argparse {
-    extern mod extra;
+    extern crate extra;
 
     pub struct Flag<'a> {
         name: &'a str,
index a6ab41a3d6b7446b1644b9fe14f8fcb1809b3aa9..f543d442a23914e4ce2e88fcdeae796e4a020cdd 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 fn main() {
 trait seq { }
 
index 8db2c686f30ac7d36873f5c79537dbc15d910fa8..e82c49d977f67ba3e98f54f90c6a6438061aea36 100644 (file)
@@ -10,7 +10,7 @@
 
 // error-pattern: mismatched types
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 24a2b561a8b0b1962caac732b2b74efe695725d9..98b37242c03a64ad3491ac5c604ec85b82c955ac 100644 (file)
@@ -10,7 +10,7 @@
 
 // aux-build:static_priv_by_default.rs
 
-extern mod static_priv_by_default;
+extern crate static_priv_by_default;
 
 mod child {
     pub mod childs_child {
index 423d182dd69202aca3ee8c21d71ce01049477e7e..2141099c7aa0ecbb6843068cb563ebe99f695dcb 100644 (file)
@@ -10,7 +10,7 @@
 
 // aux-build:static_priv_by_default.rs
 
-extern mod static_priv_by_default;
+extern crate static_priv_by_default;
 
 mod child {
     pub mod childs_child {
index f31690047854f5017c59f2c689d186dff0142572..d298d331a3f871cb7f4ec821028711978725129b 100644 (file)
@@ -10,7 +10,7 @@
 
 // aux-build:struct-field-privacy.rs
 
-extern mod xc = "struct-field-privacy";
+extern crate xc = "struct-field-privacy";
 
 struct A {
     a: int,
index 06b8ad6259b6ba4a728d154fb86b36cc299652d0..4ba1c5c7cfeec458e2525486c38b70a23ec43e41 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // error-pattern: lifetime of variable does not enclose its declaration
-extern mod sync;
+extern crate sync;
 use sync::Mutex;
 
 fn main() {
index 52466c122dd7f76a1d19e9230e50e1655d430ec1..697858f40da6084b761f1005317c464de2d26e56 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // error-pattern: lifetime of method receiver does not outlive the method call
-extern mod sync;
+extern crate sync;
 use sync::RWLock;
 fn main() {
     let x = ~RWLock::new();
index cb6c11537c60985e0fc74cc521481d6a924c7ce1..30ed0912f6a8a9242b1f683ae1e6687fc7a7b8cf 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // error-pattern: cannot infer
-extern mod sync;
+extern crate sync;
 use sync::RWLock;
 fn main() {
     let x = ~RWLock::new();
index 71a9dd100c395b129da55e0126defd1e17fd6002..09b4e34ea8c135b99608252e93a5dd1aaf5cfd82 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // error-pattern: lifetime of variable does not enclose its declaration
-extern mod sync;
+extern crate sync;
 use sync::RWLock;
 fn main() {
     let x = ~RWLock::new();
index 53966bf48a4939f2388e0331220819ec36797ec3..0fca360d0ce3d76bf48c122b3cb8158e1e931392 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // error-pattern: lifetime of variable does not enclose its declaration
-extern mod sync;
+extern crate sync;
 use sync::RWLock;
 fn main() {
     let x = ~RWLock::new();
index 61594e642bf0484deb7a1744328e7dbb88ba4d9a..920726a4870135a92329c8dcb38bf81bdca37ef7 100644 (file)
@@ -15,7 +15,7 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod fourcc;
+extern crate fourcc;
 
 fn main() {
     let val = fourcc!("foo"); //~ ERROR string literal with len != 4 in fourcc!
index bfc755eda33beb41ea7743b71150896c76180584..08ee57a2d94eae25cee2d69616d58ac7f731933b 100644 (file)
@@ -15,7 +15,7 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod fourcc;
+extern crate fourcc;
 
 fn main() {
     let val = fourcc!("foo ", bork); //~ ERROR invalid endian directive in fourcc!
index 7b090e3e94705a975da9bea51d61ca4a9c44397d..af49d9988d890a72cd67f8f7936584db1175d3af 100644 (file)
@@ -15,7 +15,7 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod fourcc;
+extern crate fourcc;
 
 fn main() {
     let v = fourcc!("fooλ"); //~ ERROR fourcc! literal character out of range 0-255
index 5f6446c683c7867649f5402cc30d73246b856bdd..b4195ed9bc88bac14e5086e9f37fba6ef52b227e 100644 (file)
@@ -15,7 +15,7 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod fourcc;
+extern crate fourcc;
 
 fn main() {
     let val = fourcc!(foo); //~ ERROR non-literal in fourcc!
index 48c6d218df498fe3447fecf55ec5dda6efa5ef5e..1997b7ad8e7629a74cadda212d4cd63b8d1c2662 100644 (file)
@@ -15,7 +15,7 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod fourcc;
+extern crate fourcc;
 
 fn main() {
     let val = fourcc!(45f32); //~ ERROR unsupported literal in fourcc!
index f2b1203511cb607f9eaf7f7e1629bf4fb98ab1e4..a39ffa64dfd769fb537afff5d2e622258512828a 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 use extra; //~ ERROR unresolved import (maybe you meant `extra::*`?)
 
 fn main() {}
index fc69c34c1183be9c381b3ce3b6e163dff70d7900..cb009163697f76eb99f3f85e828d95a29a41b19f 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use foo::bar; //~ ERROR unresolved import. maybe a missing `extern mod foo`?
+use foo::bar; //~ ERROR unresolved import. maybe a missing `extern crate foo`?
               //~^ ERROR failed to resolve import `foo::bar`
 use x = bar::baz; //~ ERROR unresolved import: there is no `baz` in `bar`
                   //~^ ERROR failed to resolve import `bar::baz`
index a4db5457750cd86372d5be2281fa027971cf09bb..d45387ed1a25bc42dbd6c8206c75231e3dfee611 100644 (file)
@@ -10,7 +10,7 @@
 
 // aux-build:use_from_trait_xc.rs
 
-extern mod use_from_trait_xc;
+extern crate use_from_trait_xc;
 
 use use_from_trait_xc::Trait::foo;  //~ ERROR cannot import from a trait or type implementation
 //~^ ERROR failed to resolve import
index dc8250d4134fe532a13a6d7ca0dab5cf0ca2b60d..0d84a59fc9ec3d983c50c7acfca20de83edb4948 100644 (file)
@@ -10,6 +10,6 @@
 
 // error-pattern:can't find crate for `extra`
 
-extern mod extra = "fake-crate";
+extern crate extra = "fake-crate";
 
 fn main() { }
index 61d18a4a2f7e584b9d335f3d00910a182b326e22..9cb84c5400adc313ad92a41bb31d3f42f025c7f3 100644 (file)
@@ -10,4 +10,4 @@
 
 // error-pattern:can't find crate for `std`
 
-extern mod std = "std#bogus";
+extern crate std = "std#bogus";
index c7c96809eecb383301a3bd534a3368e6a41baa71..d4b25b6baeb41950d47e254aed3867f0bbf60c62 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 fn f() {
 }
 
-use extra::net;    //~ ERROR `use` and `extern mod` declarations must precede items
+use extra::net;    //~ ERROR `use` and `extern crate` declarations must precede items
 
 fn main() {
 }
index 4d77e9d2ea4059044bc3eb544f3ab1cbd8a5d129..503c8da70be4106b6de856a50bf111506a5847b6 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:xc_private_method_lib.rs
 
-extern mod xc_private_method_lib;
+extern crate xc_private_method_lib;
 
 fn main() {
     let _ = xc_private_method_lib::Struct::static_meth_struct();
index d9879fcaba886584bad4110a548bae290b91e646..978ec39a06e1ff8e702103f8b86650561eb083a1 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:xc_private_method_lib.rs
 
-extern mod xc_private_method_lib;
+extern crate xc_private_method_lib;
 
 fn main() {
     let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct();
index 8dd05cd00da2c510e102c267c3eba338e36e188a..70b2ea87ac180ae583b55d1ae9ded8a566ebd215 100644 (file)
@@ -10,7 +10,7 @@
 
 // aux-build:static_priv_by_default.rs
 
-extern mod static_priv_by_default;
+extern crate static_priv_by_default;
 
 fn foo<T>() {}
 
index e71a0f05dffc5c24336de3ae80e5b2b5b536cd0a..cccb7e500213f4871ce96b61639ae27d4fbfbe75 100644 (file)
@@ -13,7 +13,7 @@
 // Make sure that when we have cross-crate unit structs we don't accidentally
 // make values out of cross-crate structs that aren't unit.
 
-extern mod xcrate_unit_struct;
+extern crate xcrate_unit_struct;
 
 fn main() {
     let _ = xcrate_unit_struct::StructWithFields; //~ ERROR: unresolved name
index c348c1a430185d8675d08ef1d2d241a3719c80af..026293e7524260f4cfc7a0947001b4c721f7dca9 100644 (file)
@@ -14,6 +14,6 @@
 #[feature(asm)];
 
 #[cfg = r#"just parse this"#]
-extern mod blah = r##"blah"##;
+extern crate blah = r##"blah"##;
 
 fn main() { unsafe { asm!(r###"blah"###); } }
index f007e03041c14909b7780269f2a3975cf45d2189..d51a2728d3aa32d5f9ea2ee2a0c5a9e9a9246626 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 // error-pattern:moop
-extern mod extra;
+extern crate extra;
 fn main() { fail!("moop"); }
index 3bc9014a74c045e1713b56228c733e1e71e9a0e2..ada9e698e657ed023a860336946b6407ca73f478 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 // error-pattern:meh
-extern mod extra;
+extern crate extra;
 
 fn main() { let str_var: ~str = ~"meh"; fail!("{}", str_var); }
index 3c9397fc07ff34e6ac06b26ba208c1ec251f329b..f3e8c9d298ce46da6c876ff0562e221282e83885 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 // error-pattern:moop
-extern mod extra;
+extern crate extra;
 
 fn main() { for _ in range(0u, 10u) { fail!("moop"); } }
index 16f54e929236a16c978f35b9ddd673c89c6fa7a8..41221b526f390794d9add71c3e2a7c37e0cd68ef 100644 (file)
@@ -10,7 +10,7 @@
 
 // error-pattern:explicit failure
 
-extern mod sync;
+extern crate sync;
 use sync::Arc;
 
 enum e<T> { e(Arc<T>) }
index 38df85e5ce686231bf4ee28b29b0698b080dc453..fb5fdffffeca544e0f73a7bb9b8cf55a392a7a45 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-test linked failure
 // error-pattern:1 == 2
 
-extern mod extra;
+extern crate extra;
 
 use std::comm;
 use std::task;
index f998e0cab7605285f2a2034f3eea73ba0fc64f70..08ab065598de4fe90e9166dd7561c3d1eb9a1465 100644 (file)
@@ -16,7 +16,7 @@
 // See the hack in upcall_call_shim_on_c_stack where it messes
 // with the stack limit.
 
-extern mod extra;
+extern crate extra;
 
 use std::libc;
 use std::task;
index c5c563a7aaca0c2099728ed19a6a3d7765ab11eb..b15be7402312e063cc7423d5653ca12428f9b2cc 100644 (file)
@@ -13,7 +13,7 @@
 
 // Just testing unwinding
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 297674bb266fcc3659e2a5d592d8ce34ca4a192a..7cd19410bfc49e0e2b05853349e15f579fa0f5d3 100644 (file)
@@ -13,7 +13,7 @@
 
 // Just testing unwinding
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 03e7b420c85e7618c03ce180d42c6e17bd9799db..da00bdf5e0aefeb575a75c810d4d7e0aa892c63d 100644 (file)
@@ -13,7 +13,7 @@
 
 #[no_uv];
 
-extern mod native;
+extern crate native;
 
 #[start]
 fn start(argc: int, argv: **u8) -> int {
index 427e606147d50d6a3278829bbce6b3e1c7b00d41..c25eef44683c3e0a56d38c0a928d20e155eb3b95 100644 (file)
@@ -12,7 +12,7 @@
 // compile-flags:--test
 // check-stdout
 
-extern mod extra;
+extern crate extra;
 
 mod m {
     pub fn exported() { }
index f52193b7376045ee0ffc99cc7633f90c4551b6fe..01bc966e90ad2bc27b2a5e23512c8a22b873e124 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-test linked failure
 // error-pattern:explicit
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 94119cc0278dab39aff0fb42326c403acaafe35e..920474ea9bd58bbddc1aa548b3eca558fcb2e122 100644 (file)
@@ -12,8 +12,8 @@
 #[crate_type="dylib"];
 #[no_uv];
 
-extern mod rustuv;
-extern mod green;
+extern crate rustuv;
+extern crate green;
 
 #[no_mangle] // this needs to get called from C
 pub extern "C" fn foo(argc: int, argv: **u8) -> int {
index 2a783606d944acd2ac5589e5776135b0a97c4655..2bc0dbb777031e625331c2db1721edf5e5074669 100644 (file)
@@ -12,7 +12,7 @@
 #[crate_type="dylib"];
 #[no_uv];
 
-extern mod native;
+extern crate native;
 
 #[no_mangle] // this needs to get called from C
 pub extern "C" fn foo(argc: int, argv: **u8) -> int {
index fa21dfac47cdc8e55198cfc041ed32bca52f60cd..37b120decd1a8a1ef43e426c1d158da5f7a18d3d 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod foo;
+extern crate foo;
 
 fn main() {
     foo::rsfoo();
index fa21dfac47cdc8e55198cfc041ed32bca52f60cd..37b120decd1a8a1ef43e426c1d158da5f7a18d3d 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod foo;
+extern crate foo;
 
 fn main() {
     foo::rsfoo();
index fa21dfac47cdc8e55198cfc041ed32bca52f60cd..37b120decd1a8a1ef43e426c1d158da5f7a18d3d 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod foo;
+extern crate foo;
 
 fn main() {
     foo::rsfoo();
index fa21dfac47cdc8e55198cfc041ed32bca52f60cd..37b120decd1a8a1ef43e426c1d158da5f7a18d3d 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod foo;
+extern crate foo;
 
 fn main() {
     foo::rsfoo();
index 98e9a9ee95071c93ea2104f0526d0be9716c791d..9adeaa1a20a107ddb1f1df5e97b0efc3fa92c141 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 #[crate_type = "dylib"];
-extern mod m1;
+extern crate m1;
 
 pub fn m2() { m1::m1() }
index b963a4c4f0aef2a27bc729a8d30e97035b7a4212..0a284e52445c86eb769a22b90cb890b3e7ddc1e0 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 #[crate_type = "dylib"];
-extern mod m2;
+extern crate m2;
 
 pub fn m3() { m2::m2() }
index ea2975d6b6ee3b30e931cbc13f7ae1bf89f42eca..6c2a66858028e04988ef470b1885001db8c7586c 100644 (file)
@@ -8,6 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod m3;
+extern crate m3;
 
 fn main() { m3::m3() }
index 61ee2481c2cd17549d71a0955f8e67c617b42e9a..e12ac9e01dc17ecaa8b256aaab05723524f09176 100644 (file)
@@ -8,6 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod lib;
+extern crate lib;
 
 fn main() {}
index 9aafd086480299c4d6afc7e4903a6570454781cc..ae5cce0224528c4e4e817f3a3776a99039a2b305 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #[crate_type = "dylib"];
-extern mod both;
+extern crate both;
 
 use std::cast;
 
index 5d21c01c63137031c698440b7a4fb3a956d91640..ed8675eb7064fa508450a8bebebde0a1c8f17f77 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod dylib;
-extern mod both;
+extern crate dylib;
+extern crate both;
 
 use std::cast;
 
index 8bdff1d8f08dfebcc765ef82d018569ebde8b0df..08a972ef8e6e2f0b55a136f92f598980b453b03c 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 #[crate_type = "dylib"];
-extern mod rlib;
+extern crate rlib;
 
 pub fn dylib() { rlib::rlib() }
index 9a97ddfd1b594a28340254d560506202e272e1f0..5e1a4274756c309672643e3a541b4f1670c3e973 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod dylib;
-extern mod rlib;
+extern crate dylib;
+extern crate rlib;
 
 fn main() {
     dylib::dylib();
index 2c22cea09aa29ab61e5f09a6b7a2072e8d7c3ce5..858ef492acef598fa85c0adf1c281679ff2a7195 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod bar;
+extern crate bar;
 
 fn main() {
     bar::bar();
index 2c22cea09aa29ab61e5f09a6b7a2072e8d7c3ce5..858ef492acef598fa85c0adf1c281679ff2a7195 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod bar;
+extern crate bar;
 
 fn main() {
     bar::bar();
index 612e59d10827d1920fe6d62ac322c0d2a398cbf8..40c1575d0695c74537a60dc0af216154d1c45ba6 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 #[crate_type = "rlib"];
-extern mod m1;
+extern crate m1;
 
 pub fn m2() { m1::m1() }
index 7545eed6f01b2fdbc777ba2ac7d6c3bf83f31562..3d3be554757bb7a3fce7d0f6494c15a450c72de9 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 #[crate_type = "rlib"];
-extern mod m2;
+extern crate m2;
 
 pub fn m3() { m2::m2() }
index ea2975d6b6ee3b30e931cbc13f7ae1bf89f42eca..6c2a66858028e04988ef470b1885001db8c7586c 100644 (file)
@@ -8,6 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod m3;
+extern crate m3;
 
 fn main() { m3::m3() }
index 2c22cea09aa29ab61e5f09a6b7a2072e8d7c3ce5..858ef492acef598fa85c0adf1c281679ff2a7195 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod bar;
+extern crate bar;
 
 fn main() {
     bar::bar();
index 2c22cea09aa29ab61e5f09a6b7a2072e8d7c3ce5..858ef492acef598fa85c0adf1c281679ff2a7195 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod bar;
+extern crate bar;
 
 fn main() {
     bar::bar();
index c47d20583936b3c60604d1bdbe06ce84c5b106ae..08777490f212b2e83ba2dfcf39981650f6a003c9 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod lib;
+extern crate lib;
 
 use std::task;
 
index a71cc465e88dc6b3b08510e94ff8a5f74e12fab1..80ebf54559fbebf188b82df1d8843390a64568aa 100644 (file)
@@ -16,6 +16,6 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod macro_crate_outlive_expansion_phase;
+extern crate macro_crate_outlive_expansion_phase;
 
 pub fn main() {}
index b9077ab59d7011977408c7c5dadb0f4a86c45464..6738bd245e34118c14ca8b2614fb1f21f362fced 100644 (file)
@@ -16,7 +16,7 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod macro_crate_test;
+extern crate macro_crate_test;
 
 pub fn main() {
     assert_eq!(1, make_a_1!());
index 662ecfb46d3456f70ff10df8902935ca1d132795..0e31cbd2e955ce83200951192a04ef9144bfadfb 100644 (file)
@@ -13,8 +13,8 @@
 
 #[feature(quote)];
 
-extern mod extra;
-extern mod syntax;
+extern crate extra;
+extern crate syntax;
 
 use std::io::*;
 
index 114e62fb80a437634ac2b90d63a5e1fcc4df3946..b11515ac24bd98c7cd551ab5db31aa63e78e413e 100644 (file)
@@ -13,7 +13,7 @@
 #[feature(quote)];
 #[feature(managed_boxes)];
 
-extern mod syntax;
+extern crate syntax;
 
 use syntax::ext::base::ExtCtxt;
 
index a27b4e302388c58d4c94c7945103e08e4a3f75e7..ac8d361bf5aa40a064b28a262e7177b2550f2213 100644 (file)
@@ -13,7 +13,7 @@
 #[feature(quote)];
 #[deny(unused_variable)];
 
-extern mod syntax;
+extern crate syntax;
 
 use syntax::ext::base::ExtCtxt;
 
index ab25946b643819d0c180da98ca3612168b672fe7..a6f118d77faab96c4780dc40850e83136b29e948 100644 (file)
@@ -16,7 +16,7 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod fourcc;
+extern crate fourcc;
 
 static static_val: u32 = fourcc!("foo ");
 static static_val_be: u32 = fourcc!("foo ", big);
index 7187438cc6d274e6e0232006f361059ae22ad458..8cadf4825f684a51f0a1eb30fa051c45a3701178 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // ignore-pretty
 // aux-build:anon-extern-mod-cross-crate-1.rs
-extern mod anonexternmod;
+extern crate anonexternmod;
 
 use anonexternmod::rust_get_test_int;
 
index c7b35c7f366fd5b762ee178cd1f60e23b9e03b22..c66a8a9d2ca45c050a12777cc3119256ba0381b9 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast - check-fast doesn't understand aux-build
 // aux-build:anon_trait_static_method_lib.rs
 
-extern mod anon_trait_static_method_lib;
+extern crate anon_trait_static_method_lib;
 use anon_trait_static_method_lib::Foo;
 
 pub fn main() {
index 316f8fa0f61f439ae6ee70a5a4b5385a635fbd1c..30d4315f081ac10e9b1a40e34a5f7cb22e7cd0aa 100644 (file)
@@ -11,7 +11,7 @@
 // error-pattern:expected item
 
 #[foo = "bar"]
-extern mod extra;
+extern crate extra;
 
 pub fn main() {
 }
index 0721544aa0dc8a861c78362d69bef11a028ccaf9..0d099841c0b3934798c3f02b8be59a6d5cb448ac 100644 (file)
@@ -12,7 +12,7 @@
 
 mod m {
     #[foo = "bar"]
-    extern mod extra;
+    extern crate extra;
 }
 
 pub fn main() {
index 6c511bcdaf08b1594a8936997878b0642a4114ba..caf9a92bba3b462f7b64f70ff4732dab603e7b5d 100644 (file)
@@ -13,7 +13,7 @@
 
 #[feature(managed_boxes)];
 
-extern mod extra;
+extern crate extra;
 
 // These tests used to be separate files, but I wanted to refactor all
 // the common code.
index 698b7b43d08346105eb96fe4a3b453f650f7beaf..e8cbd03743441f2826c4a10b122fd0fe0fe9613a 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // ignore-fast
-extern mod sync;
+extern crate sync;
 use sync::Arc;
 fn dispose(_x: Arc<bool>) { }
 
index 6525e8797508d43d68525ef66cf6411c640fedcc..20b3ca0b3bae7d79137267231fc9dab007cd212b 100644 (file)
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod collections;
+extern crate collections;
 use collections::Bitv;
 
 fn bitv_test() {
index 5d5a5843a646f13b2acf55cc02239a089303c56a..c149afb87822c8ef8972bedbb7613703486d04cd 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 fn asSendfn(f: proc() -> uint) -> uint {
    return f();
index fe1be6d06db83cce39d251bba32657a582da970c..4aedb4e96cfa32f845ed258724f8c3d77ff525bd 100644 (file)
 
 #[feature(managed_boxes)];
 
-use std::ptr;
-
 fn borrow(x: &int, f: |x: &int|) {
     f(x)
 }
 
 fn test1(x: @~int) {
     borrow(&*(*x).clone(), |p| {
-        let x_a = ptr::to_unsafe_ptr(&**x);
+        let x_a = &**x as *int;
         assert!((x_a as uint) != (p as *int as uint));
         assert_eq!(unsafe{*x_a}, *p);
     })
index e789727c4fe29e42eb656baff6de06fc0d41bd92..5cdda81c43604d436c5ff20dd0edf0205392b502 100644 (file)
@@ -14,8 +14,6 @@
 
 #[feature(managed_boxes)];
 
-use std::ptr;
-
 fn borrow(x: &int, f: |x: &int|) {
     let before = *x;
     f(x);
@@ -29,12 +27,11 @@ pub fn main() {
     let mut x = @F {f: ~3};
     borrow(x.f, |b_x| {
         assert_eq!(*b_x, 3);
-        assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x)));
+        assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
         x = @F {f: ~4};
 
-        info!("ptr::to_unsafe_ptr(*b_x) = {:x}",
-               ptr::to_unsafe_ptr(&(*b_x)) as uint);
+        info!("&*b_x = {:p}", &(*b_x));
         assert_eq!(*b_x, 3);
-        assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(*b_x)));
+        assert!(&(*x.f) as *int != &(*b_x) as *int);
     })
 }
index 8ac654ffbddba2f52ef62b3a1b42079f510d50e6..3050d6fa0113005172c991a250f4ed45877a0240 100644 (file)
@@ -14,8 +14,6 @@
 
 #[feature(managed_boxes)];
 
-use std::ptr;
-
 fn borrow(x: &int, f: |x: &int|) {
     let before = *x;
     f(x);
@@ -29,12 +27,11 @@ pub fn main() {
     let mut x = ~@F{f: ~3};
     borrow(x.f, |b_x| {
         assert_eq!(*b_x, 3);
-        assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x)));
+        assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
         *x = @F{f: ~4};
 
-        info!("ptr::to_unsafe_ptr(*b_x) = {:x}",
-               ptr::to_unsafe_ptr(&(*b_x)) as uint);
+        info!("&*b_x = {:p}", &(*b_x));
         assert_eq!(*b_x, 3);
-        assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(*b_x)));
+        assert!(&(*x.f) as *int != &(*b_x) as *int);
     })
 }
index 9ce8daa966cf671ba6e4728f1494621a5d77ec16..76dfbffc09c0667d61df085d755fe1291766e791 100644 (file)
@@ -14,8 +14,6 @@
 
 #[feature(managed_boxes)];
 
-use std::ptr;
-
 fn borrow(x: &int, f: |x: &int|) {
     let before = *x;
     f(x);
@@ -27,12 +25,11 @@ pub fn main() {
     let mut x = @3;
     borrow(x, |b_x| {
         assert_eq!(*b_x, 3);
-        assert_eq!(ptr::to_unsafe_ptr(&(*x)), ptr::to_unsafe_ptr(&(*b_x)));
+        assert_eq!(&(*x) as *int, &(*b_x) as *int);
         x = @22;
 
-        info!("ptr::to_unsafe_ptr(*b_x) = {:x}",
-               ptr::to_unsafe_ptr(&(*b_x)) as uint);
+        info!("&*b_x = {:p}", &(*b_x));
         assert_eq!(*b_x, 3);
-        assert!(ptr::to_unsafe_ptr(&(*x)) != ptr::to_unsafe_ptr(&(*b_x)));
+        assert!(&(*x) as *int != &(*b_x) as *int);
     })
 }
index 065ef1dd42379af46dd88da9c13f02ee95b39689..00e59f5132db7eac0901b4ae8266fddc95a7f264 100644 (file)
@@ -14,8 +14,6 @@
 
 #[feature(managed_boxes)];
 
-use std::ptr;
-
 fn borrow(x: &int, f: |x: &int|) {
     let before = *x;
     f(x);
@@ -29,12 +27,11 @@ pub fn main() {
     let mut x = @F {f: ~3};
     borrow((*x).f, |b_x| {
         assert_eq!(*b_x, 3);
-        assert_eq!(ptr::to_unsafe_ptr(&(*x.f)), ptr::to_unsafe_ptr(&(*b_x)));
+        assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
         x = @F {f: ~4};
 
-        info!("ptr::to_unsafe_ptr(*b_x) = {:x}",
-               ptr::to_unsafe_ptr(&(*b_x)) as uint);
+        info!("&*b_x = {:p}", &(*b_x));
         assert_eq!(*b_x, 3);
-        assert!(ptr::to_unsafe_ptr(&(*x.f)) != ptr::to_unsafe_ptr(&(*b_x)));
+        assert!(&(*x.f) as *int != &(*b_x) as *int);
     })
 }
index ce633b118bb7a53ceb84ce7d69b6c8caeef05649..b67edf245b2d9af883bd4b090774a631b7cd8fcd 100644 (file)
@@ -15,7 +15,7 @@
 // Tests "capabilities" granted by traits with super-builtin-kinds,
 // even when using them cross-crate.
 
-extern mod trait_superkinds_in_metadata;
+extern crate trait_superkinds_in_metadata;
 use trait_superkinds_in_metadata::{RequiresRequiresFreezeAndSend, RequiresFreeze};
 
 #[deriving(Eq)]
index eeb4d7f6dd516d3699a2f307280c383b6f132365..8cecd5019a395aa3cb40e2ebbd39770fa36f6efa 100644 (file)
@@ -14,7 +14,7 @@
 
 // Tests (correct) usage of trait super-builtin-kinds cross-crate.
 
-extern mod trait_superkinds_in_metadata;
+extern crate trait_superkinds_in_metadata;
 use trait_superkinds_in_metadata::{RequiresRequiresFreezeAndSend, RequiresFreeze};
 use trait_superkinds_in_metadata::{RequiresPod};
 
diff --git a/src/test/run-pass/cap-clause-move.rs b/src/test/run-pass/cap-clause-move.rs
deleted file mode 100644 (file)
index 1fa7862..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 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::ptr;
-
-pub fn main() {
-    let x = ~3;
-    let y = ptr::to_unsafe_ptr(&(*x)) as uint;
-    let snd_move: proc() -> uint = proc() ptr::to_unsafe_ptr(&(*x)) as uint;
-    assert_eq!(snd_move(), y);
-
-    let x = ~4;
-    let y = ptr::to_unsafe_ptr(&(*x)) as uint;
-    let lam_move: proc() -> uint = proc() ptr::to_unsafe_ptr(&(*x)) as uint;
-    assert_eq!(lam_move(), y);
-}
index 37557d0ab7d2addf2fe9bbf77af48c9d0fd6e4ba..2473911483ce812aabee043c8c5fcda7003f635a 100644 (file)
@@ -13,7 +13,7 @@
 // exec-env:RUST_LOG=info
 
 #[no_uv];
-extern mod native;
+extern crate native;
 
 use std::fmt;
 use std::io::{PortReader, ChanWriter};
index c7e3de71fe2be84c70f76e626c4a1de11254f7a8..cb77c63d4511a740f8cddbd5cd1656f7632867c5 100644 (file)
@@ -13,7 +13,7 @@
 
 #[feature(managed_boxes)];
 
-extern mod cci_borrow_lib;
+extern crate cci_borrow_lib;
 use cci_borrow_lib::foo;
 
 pub fn main() {
index f72f06e2a7b3b5d488226d8e01489bcbb1d59107..fa96f65243ead3fb1053f4b956cf4d8c815a5077 100644 (file)
@@ -14,7 +14,7 @@
 // This test makes sure we can do cross-crate inlining on functions
 // that use capture clauses.
 
-extern mod cci_capture_clause;
+extern crate cci_capture_clause;
 
 pub fn main() {
     cci_capture_clause::foo(()).recv()
index f297b54c54d4b2ead0f1304774f5030620873be7..e5e1736044c5db738765f58b443ac6d0f3e307d1 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast - check-fast doesn't understand aux-build
 // aux-build:cci_impl_lib.rs
 
-extern mod cci_impl_lib;
+extern crate cci_impl_lib;
 use cci_impl_lib::uint_helpers;
 
 pub fn main() {
index ce9687e6b9a03708b54d2c8ba1b7562db4732353..41717177f75bc8b7b6b1158c0c18e17825b64d3a 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast - check-fast doesn't understand aux-build
 // aux-build:cci_iter_lib.rs
 
-extern mod cci_iter_lib;
+extern crate cci_iter_lib;
 
 pub fn main() {
     //let bt0 = sys::rusti::frame_address(1u32);
index f5f00e4c279d79b104aa5a587a2ac23496256bfe..3810f7919ac267dcf53fb02536675b3ccc568e32 100644 (file)
@@ -13,7 +13,7 @@
 
 #[feature(globs, managed_boxes)];
 
-extern mod cci_nested_lib;
+extern crate cci_nested_lib;
 use cci_nested_lib::*;
 
 pub fn main() {
index d0e97b98351273eb642f5bc3b816be0de08fb36a..faa2a350117043241a73b214922ccc680b9df3da 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast - check-fast doesn't understand aux-build
 // aux-build:cci_no_inline_lib.rs
 
-extern mod cci_no_inline_lib;
+extern crate cci_no_inline_lib;
 use cci_no_inline_lib::iter;
 
 pub fn main() {
index 977d8a2b0a77a05c6fc547f6c5e24cfb556ed2f2..08951dfd50e2e968543c087e9cb5be0bf440332c 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:cfg_inner_static.rs
 // ignore-fast
 
-extern mod cfg_inner_static;
+extern crate cfg_inner_static;
 
 pub fn main() {
     cfg_inner_static::foo();
index d9fa5507cf12182fb55efedbfe2a8a33c7524e13..746342ae97345272dda99c6043960cc6eaaf0438 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 // aux-build:cci_class_cast.rs
-extern mod cci_class_cast;
+extern crate cci_class_cast;
 use std::to_str::ToStr;
 use cci_class_cast::kitty::cat;
 
index 908c3afda12315b8b0e37ec32fb7a3ba8e2c7508..caa4a3b2feb6f9e349f2942039cd96695ea43cbc 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 // aux-build:cci_class_trait.rs
-extern mod cci_class_trait;
+extern crate cci_class_trait;
 use cci_class_trait::animals::noisy;
 
 struct cat {
index 41143d7ade6e7f796d1d927a73e349e5595b6381..8ee367d281f2c92f0032a60aa9e8dc41a6a632a8 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 // aux-build:cci_class_2.rs
-extern mod cci_class_2;
+extern crate cci_class_2;
 use cci_class_2::kitties::cat;
 
 pub fn main() {
index 2975843ae577011a5401e55098dc12ef1b6b14be..ca3b491844f127e5f94b21d8d7a982a5afd6fb6b 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 // aux-build:cci_class_3.rs
-extern mod cci_class_3;
+extern crate cci_class_3;
 use cci_class_3::kitties::cat;
 
 pub fn main() {
index bc9e73b35653ff82e00b42f80813ebf933aff8a2..671d7a403531bbe50c1a820d0b6f12ed01f1c848 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 // aux-build:cci_class_6.rs
-extern mod cci_class_6;
+extern crate cci_class_6;
 use cci_class_6::kitties::cat;
 
 pub fn main() {
index 8c7e0e3febb93053999042205dfec2bb84d4dc88..2e1d19b9dda2d86044a3c5bdd9bd156623994bc6 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 // aux-build:cci_class_4.rs
-extern mod cci_class_4;
+extern crate cci_class_4;
 use cci_class_4::kitties::cat;
 
 pub fn main() {
index 8546f79c1e8a6ef6442ab51a203da7e84f7aa3cb..6d816e725b9b9030b0133ae2a9007e33d621f397 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 // aux-build:cci_class.rs
-extern mod cci_class;
+extern crate cci_class;
 use cci_class::kitties::cat;
 
 pub fn main() {
index 6fab709543a0aff7c3aa8c5bcbc5bad07e7e5576..091cebcc0633bac955bcc2c2611a46445caebfdc 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 use std::task::spawn;
 
 struct Pair {
index 4f8db9a3ca2d8e3a5ef8f6914e58d00f1e77125a..c8dc98baac6be8d647ad748ea09443baf4417463 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:cci_const.rs
 
-extern mod cci_const;
+extern crate cci_const;
 static foo: &'static str = cci_const::foopy;
 static a: uint = cci_const::uint_val;
 static b: uint = cci_const::uint_expr + 5;
index 22d2c908b37bbb80e5cc1a60f623198d132660f3..75a0bac0293cacd4502a0bb227228ef1bac9ee44 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:cci_const.rs
 
-extern mod cci_const;
+extern crate cci_const;
 use cci_const::bar;
 static foo: extern "C" fn() = bar;
 
index 6dce262dd9a888e7d6415a7c2e51ced421aa7cff..87363c0e55e869ae3dbb366a88aef639366d7184 100644 (file)
@@ -8,13 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::ptr;
-
 type Big = [u64, ..8];
 struct Pair<'a> { a: int, b: &'a Big }
 static x: &'static Big = &([13, 14, 10, 13, 11, 14, 14, 15]);
 static y: &'static Pair<'static> = &Pair {a: 15, b: x};
 
 pub fn main() {
-    assert_eq!(ptr::to_unsafe_ptr(x), ptr::to_unsafe_ptr(y.b));
+    assert_eq!(x as *Big, y.b as *Big);
 }
index 0993105c512612bec3210eb6de7202c47b397611..1b563d33433c353c91f250751b1de7f18c5c189f 100644 (file)
@@ -17,7 +17,7 @@
 // ignore-fast
 // aux-build:crate-method-reexport-grrrrrrr2.rs
 
-extern mod crate_method_reexport_grrrrrrr2;
+extern crate crate_method_reexport_grrrrrrr2;
 
 pub fn main() {
     use crate_method_reexport_grrrrrrr2::rust::add;
index dec983a180fb27fe4f9c229388f007a92cff2d1b..bf13e66690cd1eb8cc97e08e1764d2e816ac96b6 100644 (file)
@@ -13,7 +13,7 @@
 // aux-build:crateresolve1-2.rs
 // aux-build:crateresolve1-3.rs
 
-extern mod crateresolve1 = "crateresolve1#0.2";
+extern crate crateresolve1 = "crateresolve1#0.2";
 
 pub fn main() {
     assert_eq!(crateresolve1::f(), 20);
index 97bcd56178f9ca3dfdc81958cdd3a78b33363251..1419d68ad6837a02761dd976953715549dedd430 100644 (file)
 // aux-build:crateresolve2-3.rs
 
 mod a {
-    extern mod crateresolve2 = "crateresolve2#0.1";
+    extern crate crateresolve2 = "crateresolve2#0.1";
     pub fn f() { assert!(crateresolve2::f() == 10); }
 }
 
 mod b {
-    extern mod crateresolve2 = "crateresolve2#0.2";
+    extern crate crateresolve2 = "crateresolve2#0.2";
     pub fn f() { assert!(crateresolve2::f() == 20); }
 }
 
 mod c {
-    extern mod crateresolve2 = "crateresolve2#0.3";
+    extern crate crateresolve2 = "crateresolve2#0.3";
     pub fn f() { assert!(crateresolve2::f() == 30); }
 }
 
index 4f87b9bb02f41ba10ad89d2c18136366b6c97c0b..fd83c8f515a5145cc848cf8d61d5d5b5453a62fa 100644 (file)
 // as long as no name collision on invoked functions.
 
 mod a {
-    extern mod crateresolve3 = "crateresolve3#0.1";
+    extern crate crateresolve3 = "crateresolve3#0.1";
     pub fn f() { assert!(crateresolve3::f() == 10); }
 }
 
 mod b {
-    extern mod crateresolve3 = "crateresolve3#0.2";
+    extern crate crateresolve3 = "crateresolve3#0.2";
     pub fn f() { assert!(crateresolve3::g() == 20); }
 }
 
index 3e2d19f2a8dd969215a22e7be3428f5e5feb9b92..3243c909e03a926e57bb93de90334954cb17139c 100644 (file)
 // aux-build:crateresolve4b-2.rs
 
 pub mod a {
-    extern mod crateresolve4b = "crateresolve4b#0.1";
+    extern crate crateresolve4b = "crateresolve4b#0.1";
     pub fn f() { assert!(crateresolve4b::f() == 20); }
 }
 
 pub mod b {
-    extern mod crateresolve4b = "crateresolve4b#0.2";
+    extern crate crateresolve4b = "crateresolve4b#0.2";
     pub fn f() { assert!(crateresolve4b::g() == 10); }
 }
 
index 24a9f2286b4aaa4456eaab02457f68e1490e5c84..ca690b9089bb53e0f59315669787669a42d5794f 100644 (file)
@@ -12,8 +12,8 @@
 // aux-build:crateresolve5-1.rs
 // aux-build:crateresolve5-2.rs
 
-extern mod cr5_1 = "crateresolve5#0.1";
-extern mod cr5_2 = "crateresolve5#0.2";
+extern crate cr5_1 = "crateresolve5#0.1";
+extern crate cr5_2 = "crateresolve5#0.2";
 
 pub fn main() {
     // Structural types can be used between two versions of the same crate
index 4d1cba92f807928382506826a103974f14ccb994..46ccb01f66048980d3e25ce61bf0498c0ac13e80 100644 (file)
@@ -13,8 +13,8 @@
 
 #[crate_id="crateresolve8#0.1"];
 
-extern mod crateresolve8 = "crateresolve8#0.1";
-//extern mod crateresolve8(vers = "0.1");
+extern crate crateresolve8 = "crateresolve8#0.1";
+//extern crate crateresolve8(vers = "0.1");
 
 pub fn main() {
     assert_eq!(crateresolve8::f(), 20);
index 1949c07ce59c972f28f019d5043ed5ed9c59026a..9e3a43469f2ef7d475df298ddd48c49b277994ce 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:cci_const.rs
 
-extern mod cci_const;
+extern crate cci_const;
 
 pub fn main() {
     let x = cci_const::uint_val;
index ddebd5da114ec7b0e6a91ab507e594fe2f5a3a75..8988ee52b1649b9f7d0094ac5ededd88ee5698ab 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:newtype_struct_xc.rs
 
-extern mod newtype_struct_xc;
+extern crate newtype_struct_xc;
 
 pub fn main() {
     let x = newtype_struct_xc::Au(21);
index 177459c0321bc59ae8a6337e8cf797ee9e98d2e1..50ccac793c265c07f8a56d792dbdc0321ffd6869 100644 (file)
@@ -16,7 +16,7 @@
 
 #[feature(struct_variant, managed_boxes)];
 
-extern mod serialize;
+extern crate serialize;
 
 use std::io::MemWriter;
 use std::rand::{random, Rand};
index ca53636b0a62970b685c28d10fa34fe854b39f2f..544a8c2b00af84bb51d2b01c239b68eb743fb615 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-fast #7103 `extern mod` does not work on check-fast
+// ignore-fast #7103 `extern crate` does not work on check-fast
 // ignore-pretty - does not converge
 
 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
@@ -21,7 +21,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod serialize; // {En,De}codable
+extern crate serialize; // {En,De}codable
 mod submod {
     // if any of these are implemented without global calls for any
     // function calls, then being in a submodule will (correctly)
index 4362792ceebaa1fb41776986945469f318a5fa0e..c710eb5eafb0f248bca5dcb3d8bdb9adfd0c327d 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-test
 
-extern mod extra;
+extern crate extra;
 
 use list = extra::oldmap::chained;
 use extra::list;
index 0a975e3f89d5cf6e205a9e6f181205f505f6df19..b50fd7cbb34cd515248ef8fcee2d8960c632f9e1 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:anon-extern-mod-cross-crate-1.rs
 // aux-build:anon-extern-mod-cross-crate-1.rs
-extern mod anonexternmod;
+extern crate anonexternmod;
 
 pub fn main() { }
 
index 3c8dd33ae9c356111c05e9979522c8f45c88b3f2..5763c61379865a88fef04703b0a2b908a1b2420a 100644 (file)
@@ -9,12 +9,10 @@
 // except according to those terms.
 
 use std::cast;
-use std::ptr;
 use std::mem;
 
 fn addr_of<T>(ptr: &T) -> uint {
-    let ptr = ptr::to_unsafe_ptr(ptr);
-    ptr as uint
+    ptr as *T as uint
 }
 
 fn is_aligned<T>(ptr: &T) -> bool {
index fb533a3de585814d2feebd475560b8f505902e80..a3c5256c2d3651fa94867df3b6158d80cfc00b72 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 /**
  * A function that returns a hash of a value
index dc00bce141cc55532e23e84be82fe362ec581105..ce805fcf7371393cc79b2e3b045abfa95ed2c530 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:explicit_self_xcrate.rs
 
-extern mod explicit_self_xcrate;
+extern crate explicit_self_xcrate;
 use explicit_self_xcrate::{Foo, Bar};
 
 pub fn main() {
index 92726f9a2a8efca64af192ab9a56cb7e4d93273e..b895466cf7ebe7cb8e0d0ee757e09ff6e16ceeba 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast: aux-build not compatible with fast
 // aux-build:extern_calling_convention.rs
 
-extern mod extern_calling_convention;
+extern crate extern_calling_convention;
 
 use extern_calling_convention::foo;
 
index 30ea3bc260ca72dacd7c6ab065efc75ec53a484c..ccd79600a15a71edf6876d8e18f21fda6bc159be 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 //aux-build:extern-crosscrate-source.rs
 
-extern mod externcallback = "externcallback#0.1";
+extern crate externcallback = "externcallback#0.1";
 
 fn fact(n: uint) -> uint {
     unsafe {
index 8949734b80e484f80729ba8eb5ed573462e55c83..1c5df4acf73c755e1cc9f5c8cdacb399ad5130fc 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 extern crate extra;
-extern mod mystd = "std";
+extern crate mystd = "std";
 
 pub fn main() {}
index 87c53f5ff573f6976e7058ba7067f1c928b326b1..f228c0c099253c65a50ccdb6ab9d6e8e6f319292 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:extern_mod_ordering_lib.rs
 // ignore-fast
 
-extern mod extern_mod_ordering_lib;
+extern crate extern_mod_ordering_lib;
 
 use extern_mod_ordering_lib::extern_mod_ordering_lib;
 
index ff798991c8785f034b06d7a5a50561fa5c8eec63..fdea2716d5f2963a699b70e86c5d26a385514808 100644 (file)
@@ -12,7 +12,7 @@
 
 #[allow(unused_imports)];
 
-extern mod extra;
+extern crate extra;
 use extra::json::Object;
 
 pub fn main() {
index 9035176a267b15388a141b8bb7b077991d86896f..66c84d52745cdbf7c9c62e4847689f4052d79ab5 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::num::Float;
 
index aeba5c0ec97e139143c37aebed9d1d95e301fcd0..b9d8d622731d3b6bfd3727d7c0e63e0c24fbfb07 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 mod libc {
     use std::libc::{c_char, size_t};
index 2fc6570f77dbdbff752eb57aecfaf8472f11ea51..412e780f8a23b51acf8a2155f5309f7fd1a2b697 100644 (file)
@@ -15,7 +15,7 @@
 
 #[allow(default_type_param_usage)];
 
-extern mod default_type_params_xc;
+extern crate default_type_params_xc;
 
 struct Vec<T, A = default_type_params_xc::Heap>;
 
index d62050e0f86760cb167f4025392af13e4ebf0c58..55ecf919b7240f80ca087c08793a991884d998f5 100644 (file)
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod getopts;
+extern crate getopts;
 
 use getopts::{optopt, getopts};
 
index 4d889b7f00d0a0daf0d1784fbef64b52d3dda623..c1e6f04e67d0d0759361cc20d864b793f0fd88e9 100644 (file)
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-fast check-fast doesn't like 'extern mod extra'
+// ignore-fast check-fast doesn't like 'extern crate extra'
 // ignore-win32 TempDir may cause IoError on windows: #10462
 
-extern mod extra;
-extern mod glob;
+extern crate extra;
+extern crate glob;
 
 use glob::glob;
 use extra::tempfile::TempDir;
index efdc9e8655c43c0a3156b6cc5e4e616fc3b87f9d..9665d4d684d9c2701ed43b15dbdbe2091228333b 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:impl_privacy_xc_1.rs
 // ignore-fast
 
-extern mod impl_privacy_xc_1;
+extern crate impl_privacy_xc_1;
 
 pub fn main() {
     let fish = impl_privacy_xc_1::Fish { x: 1 };
index 829c7eb5f29b01e014bd8aa9545a90656ac3f305..8e67a5c74c5d8ae349c844a36bb296665fafa60a 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:impl_privacy_xc_2.rs
 // ignore-fast
 
-extern mod impl_privacy_xc_2;
+extern crate impl_privacy_xc_2;
 
 pub fn main() {
     let fish1 = impl_privacy_xc_2::Fish { x: 1 };
index 1815497d205cd8d27afd41e23325d202cc7ec2c2..f2117efb0bbe66c6490815d3c3867059f9b952f2 100644 (file)
@@ -13,7 +13,7 @@
 #[feature(globs)];
 #[allow(dead_assignment)];
 
-extern mod extra;
+extern crate extra;
 use std::vec::*;
 
 pub fn main() {
index ff3937784b8c6e9ce781b8f89e83885382f1a02f..50091c94a76b613844b04bb107c25f5bc113c922 100644 (file)
@@ -14,7 +14,7 @@
 */
 // ignore-test
 
-extern mod extra;
+extern crate extra;
 
 fn loopy(n: int) {
     if n > 0 { spawn(proc() { loopy(n - 1) }); spawn(proc() { loopy(n - 1) }); }
index ec5fea3b6ed355b96a666723c2956063a3e03cd1..3e04a8a3922e3b8e3b57c9fe291b4b148e30753b 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:inner_static.rs
 // ignore-fast
 
-extern mod inner_static;
+extern crate inner_static;
 
 pub fn main() {
     let a = inner_static::A::<()>;
index 9554ed20e0506defdeeb697e746cfeab2eee0df8..7fda83a14bb6196fc5ea7f8ac30a54ff915ea467 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast - check-fast doesn't understand aux-build
 // aux-build:cci_intrinsic.rs
 
-extern mod cci_intrinsic;
+extern crate cci_intrinsic;
 use cci_intrinsic::atomic_xchg;
 
 pub fn main() {
index 0a805ecc382b77257d010d4a4895c7df0468181f..9c62f5052b2a6df45962ab09f9d7268e5f4943e2 100644 (file)
@@ -12,7 +12,7 @@
 
 #[feature(globs)];
 
-extern mod extra;
+extern crate extra;
 
 mod rusti {
     extern "rust-intrinsic" {
index d2fd1555228d8f63fdcd6eb089bd9bed25ea5bf8..def9a590a83586593447a367f9badf775dcbdaf4 100644 (file)
@@ -16,7 +16,7 @@
 // successfully (and safely) invoke external, cdecl
 // functions from outside the crate.
 
-extern mod foreign_lib;
+extern crate foreign_lib;
 
 pub fn main() {
     unsafe {
index da1460085c0ace297002d0e4a921b237278449f9..bde8b194c40ab8609593017b8d117c4fa77bc9d3 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast - check-fast doesn't understand aux-build
 // aux-build:issue_10031_aux.rs
-extern mod issue_10031_aux;
+extern crate issue_10031_aux;
 
 pub fn main() {
     let _ = issue_10031_aux::Wrap(());
index 3529551de81f7524e37744220765cf98a8c8b711..94964fbc89bc7b609c19ea3bdc4c1fa09d30ab2b 100644 (file)
@@ -33,7 +33,10 @@ pub fn main () {
         args : &[~"child"],
         env : None,
         cwd : None,
-        io : &[]
+        io : &[],
+        uid: None,
+        gid: None,
+        detach: false,
     };
 
     let mut p = process::Process::new(config).unwrap();
index 74062be6d82672509c2ea62d8f17418a867fa265..23f1834fe87365cfaa306513b59cc04b66a89575 100644 (file)
@@ -11,6 +11,6 @@
 // aux-build:issue-11224.rs
 // ignore-fast
 
-extern mod unused = "issue-11224";
+extern crate unused = "issue-11224";
 
 pub fn main() {}
index 212bbba944150f49146040c4f5a83fce34ccc85a..ea0e66151449a3f73aabacc0df516d887d6b6ee7 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:issue-11225-1.rs
 // ignore-fast
 
-extern mod foo = "issue-11225-1";
+extern crate foo = "issue-11225-1";
 
 pub fn main() {
     foo::foo(1);
index 2fe729067fbeb9c210af390da2e0d8597c14d8d9..95ed77eba049b82166428e16ddfd3fa2d1313ddf 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:issue-11225-2.rs
 // ignore-fast
 
-extern mod foo = "issue-11225-2";
+extern crate foo = "issue-11225-2";
 
 pub fn main() {
     foo::foo(1);
index cc859ff3be5848349935455092d30b563277a91f..8dd64b1dbc9b39c135af000bfc4b2d1377d9a7bc 100644 (file)
@@ -12,7 +12,7 @@
 // aux-build:issue_2316_a.rs
 // aux-build:issue_2316_b.rs
 
-extern mod issue_2316_b;
+extern crate issue_2316_b;
 use issue_2316_b::cloth;
 
 pub fn main() {
index 3d36c1e2d58c77179232f6b032ec9110ffce0324..f312a1b080a2eff52197618e6d81694291c93c00 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:issue-2380.rs
 
-extern mod a;
+extern crate a;
 
 pub fn main() {
     a::f::<()>();
index 2798d247c9d8528e32cf77bf0abd145ab288958d..5b13be23f8ae12645c8c1180c858b8b488b1181c 100644 (file)
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod collections;
+extern crate collections;
 use collections::RingBuf;
 use collections::Deque;
 
index e51f6caa8d3e42a251655d787ef2244a73c4a198..86cd1576bb01a4811e750d9e9e95fc442818d91d 100644 (file)
@@ -12,6 +12,6 @@
 // aux-build:issue-2414-a.rs
 // aux-build:issue-2414-b.rs
 
-extern mod b;
+extern crate b;
 
 pub fn main() {}
index 7d1b77d2db9aabb5f879c659cfa272f1bca281ed..b025f80a888a387c22b5187d5398397f9ea97f1b 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:issue_2472_b.rs
 // ignore-fast
 
-extern mod issue_2472_b;
+extern crate issue_2472_b;
 
 use issue_2472_b::{S, T};
 
index c58e214113c712c4ee8078b7fa077dd1f97301e6..b10871f78d4425045c13aafe03dab77317294257 100644 (file)
@@ -14,7 +14,7 @@
 #[feature(globs)];
 #[allow(unused_imports)];
 
-extern mod issue_2526;
+extern crate issue_2526;
 use issue_2526::*;
 
 pub fn main() {}
index 48976a9524021dbc913e5152eb2b2ff14cde22d8..68f2fd95cdefa5b1078ef40daf426d1a40a2ea52 100644 (file)
@@ -13,7 +13,7 @@
 // ignore-fast
 // aux-build:issue-2631-a.rs
 
-extern mod req;
+extern crate req;
 
 use req::request;
 use std::cell::RefCell;
index 142a5cb6500e8eb7c5e1d249afef13c3adb65d3d..ef20c481eb9c346893d61514b2adab28538d6892 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast: aux-build not compatible with fast
 // aux-build:issue_2723_a.rs
 
-extern mod issue_2723_a;
+extern crate issue_2723_a;
 use issue_2723_a::f;
 
 pub fn main() {
index 1ac3c4b0fbc21807c5e655f2befcbf2f2e9a4a7a..a9ac81be0ba49bb8ced5f80bfd84aaffbe4d91bc 100644 (file)
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use extra::json;
 use std::hashmap::HashMap;
index 31a51c826c410fe81f7462911cd2a163155caee7..2816609ef97dce5e10ef433c52edc6b9fcca42b3 100644 (file)
@@ -14,7 +14,7 @@
 
 /// Map representation
 
-extern mod extra;
+extern crate extra;
 
 use std::io;
 use std::to_str;
index 9b667ab433b10c4ef9b902cb0d2d0185910eb2a1..94e7297f179931f4d6eddf0e842bb03038e99472 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::vec;
 
index af45c88d22e6b192e1522a83a640d42ff6c64894..0ffbdc3c5b8974b77dbfa0a08e18492e3140e993 100644 (file)
@@ -13,7 +13,7 @@
 
 #[feature(managed_boxes)];
 
-extern mod socketlib;
+extern crate socketlib;
 
 use socketlib::socket;
 use std::libc;
index b790f73271707ffef1aba7d9b57518057232e4fb..374607326dfef3080e083d722e430b02892d540c 100644 (file)
@@ -11,7 +11,7 @@
 // except according to those terms.
 
 // rustc --test ignores2.rs && ./ignores2
-extern mod extra;
+extern crate extra;
 
 use std::path::{Path};
 use std::path;
index 9e20de16ae1bb02caa4990562693fc9818a4b6e9..e7089a6a21e5f0110632f00be290a486d9ba5da1 100644 (file)
@@ -10,7 +10,7 @@
 
 #[feature(managed_boxes)];
 
-extern mod extra;
+extern crate extra;
 
 enum Token {
     Text(@~str),
index f60d8b2de64a1b14abecd3e13f76e08ad8259a75..8e5dd762c630f6e4e9bd0fef68768c16706fe600 100644 (file)
@@ -16,7 +16,7 @@
 // However the extra library is designed to be optional (for code that must run on constrained
 //  environments like embedded devices or special environments like kernel code) so it must
 // be explicitly linked in.
-extern mod extra;
+extern crate extra;
 
 // Extern mod controls linkage. Use controls the visibility of names to modules that are
 // already linked in. Using WriterUtil allows us to use the write_line method.
index ace27c5ea11f61ad56e2f17bd20aacf367721a26..b216ca9a1ca30ba146a85774b5ba1237ed94b2ec 100644 (file)
@@ -11,7 +11,7 @@
 #[allow(unnecessary_allocation)];
 
 // rustc --test match_borrowed_str.rs.rs && ./match_borrowed_str.rs
-extern mod extra;
+extern crate extra;
 
 fn compare(x: &str, y: &str) -> bool
 {
index 9f6b1578b9575b74f8cd6daf67ce3bc87a5afe39..fe9c5d5491fee84e7c42dcd6f3288db8266f46a2 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::comm::Chan;
 use std::task;
index deb0c8ebb7fcaa9118170a550cc494b26e56a96e..a50287de97eabe5f04f06b5d1be9b14f9371c47e 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 // aux-build:issue_3979_traits.rs
-extern mod issue_3979_traits;
+extern crate issue_3979_traits;
 use issue_3979_traits::{Positioned, Movable};
 
 struct Point { x: int, y: int }
index 7f9f48b742ad490e5d420373a8013944564e6b1e..9c472e9c39aa24fd1dadeb14a3ac572ab69b4a87 100644 (file)
@@ -11,8 +11,8 @@
 
 // ignore-fast
 
-extern mod extra;
-extern mod serialize;
+extern crate extra;
+extern crate serialize;
 
 use extra::json;
 use serialize::Decodable;
index 476aa8a07120f171ce2db93f5119f72b7a436c90..3b9cabf664a4332a402f46a798c788d81aa6b6e2 100644 (file)
@@ -13,8 +13,8 @@
 // Issue #4036: Test for an issue that arose around fixing up type inference
 // byproducts in vtable records.
 
-extern mod extra;
-extern mod serialize;
+extern crate extra;
+extern crate serialize;
 use extra::json;
 use serialize::Decodable;
 
index 3615e9cb839227f0afbd371b4dc8e49c62014eae..508b4dc0b5178f17543ca8346c54599ad26f9502 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:issue-4208-cc.rs
 // ignore-fast - check-fast hates cross-crate tests
 
-extern mod numeric;
+extern crate numeric;
 use numeric::{sin, Angle};
 
 fn foo<T, A:Angle<T>>(theta: A) -> T { sin(&theta) }
index 085f2476c5d01cc73c8251a40fe2b2fc4c91eddf..f6c29658e6a31e7b56b3933c7bed5472a07a18cb 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // ignore-test needs networking
 
-extern mod extra;
+extern crate extra;
 
 use extra::net::tcp::TcpSocketBuf;
 
index 6a5f0772fcf8565db1c23a2e46e962a0334cff0c..9781f4aba7e651bad1400f416d8e5db71b9f0b02 100644 (file)
@@ -11,5 +11,5 @@
 // ignore-fast check-fast doesn't like aux-build
 // aux-build:issue-4545.rs
 
-extern mod somelib = "issue-4545";
+extern crate somelib = "issue-4545";
 pub fn main() { somelib::mk::<int>(); }
index 953956337b644dcbca2689cf45419803536bc5d3..ca62b7bb8952b33423ad02cd25b1d71cb06f9f34 100644 (file)
@@ -13,7 +13,7 @@
 
 #[feature(managed_boxes)];
 
-extern mod foo = "issue-5521";
+extern crate foo = "issue-5521";
 
 fn foo(a: foo::map) {
     if false {
index 5e56a45622efa9ceae7b1affa71bc28dd193b9f5..6d84268fb418d2e4f3702dbbf0bfe69373da67ff 100644 (file)
@@ -12,7 +12,7 @@
 // ignore-fast
 
 #[crate_id="issue-6919"];
-extern mod issue6919_3;
+extern crate issue6919_3;
 
 pub fn main() {
     issue6919_3::D.k;
index 7c44e5781442984bb9d97915b1b821f5faff20f2..a20ab1ca9e449ee52608121d681db34d3db868f5 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:issue-7178.rs
 
-extern mod cross_crate_self = "issue-7178";
+extern crate cross_crate_self = "issue-7178";
 
 pub fn main() {
     let _ = cross_crate_self::Foo::new(&1i);
index 3f3f1d7e1d71c20f7dd4c740a729104c7c0ccdba..450c83515162deeb50f9e893eecdd7a3b85515fd 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast check-fast doesn't like aux-build
 // aux-build:issue-8044.rs
 
-extern mod minimal = "issue-8044";
+extern crate minimal = "issue-8044";
 use minimal::{BTree, leaf};
 
 pub fn main() {
index 765852654f9a20b72f585d998b7e5664b2411ce2..715c25feff3f3be184245bd0f30753daa9dbdceb 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:issue-8259.rs
 
-extern mod other = "issue-8259";
+extern crate other = "issue-8259";
 static a: other::Foo<'static> = other::A;
 
 pub fn main() {}
index e750066199adfaea0da3b08998bf101484876a85..e47d3b8edce90c41238dd96d809b32bd98e7cec8 100644 (file)
@@ -11,6 +11,6 @@
 // aux-build:issue_8401.rs
 // ignore-fast
 
-extern mod issue_8401;
+extern crate issue_8401;
 
 pub fn main() {}
index 230dce1615158544dbf8b08ff51bf798e50e35d7..d22de5ce4c80a121de2d23a404eda128248b4bae 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 
-extern mod green;
+extern crate green;
 
 static mut DROP: int = 0i;
 static mut DROP_S: int = 0i;
index b5aef4b73ac1d079e83cfcb39c3b00ca4cc2b4ae..ea9d7edecd1cd7b36e97951e60c86bd3e7547745 100644 (file)
@@ -11,6 +11,6 @@
 // ignore-fast check-fast doesn't like aux-build
 // aux-build:issue_9123.rs
 
-extern mod issue_9123;
+extern crate issue_9123;
 
 pub fn main() {}
index 8f5978d356ee30cb4f19443ecce376c2d588d45b..8cded636338c94fff976af787bfcbb29d80f187c 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:issue_9188.rs
 // ignore-fast check-fast doesn't like aux-build
 
-extern mod issue_9188;
+extern crate issue_9188;
 
 pub fn main() {
     let a = issue_9188::bar();
index ea1958a14bb79582c4fb3d36f6721e1fc09e345f..c32cab9638cc14c4f998362b277e5c5494d3cf8e 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-fast check-fast doesn't like extern mod
+// ignore-fast check-fast doesn't like extern crate
 // aux-build:issue-9906.rs
 
-extern mod testmod = "issue-9906";
+extern crate testmod = "issue-9906";
 
 pub fn main() {
     testmod::foo();
index c076979060c9030a02537f29ae064bd130c25964..468fcdca6bd03990eeee14152f7fbaaa53c64fce 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-fast check-fast doesn't like extern mod
+// ignore-fast check-fast doesn't like extern crate
 // aux-build:issue-9968.rs
 
-extern mod lib = "issue-9968";
+extern crate lib = "issue-9968";
 
 use lib::{Trait, Struct};
 
index c4d76808013d9ea89c9414b6bae3185d1f6557c7..481b6a2723b73c41a1d4890b30a3d338ea15bf28 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast - check-fail fast doesn't under aux-build
 // aux-build:issue2170lib.rs
-extern mod issue2170lib;
+extern crate issue2170lib;
 
 pub fn main() {
    // let _ = issue2170lib::rsrc(2i32);
index 27098d471d1c36a4397b07860c1d3e5a2cc17339..17733361de42117b8b12fcb033c1261a4f7a05b6 100644 (file)
@@ -12,8 +12,8 @@
 // aux-build:issue2378b.rs
 // ignore-fast - check-fast doesn't understand aux-build
 
-extern mod issue2378a;
-extern mod issue2378b;
+extern crate issue2378a;
+extern crate issue2378b;
 
 use issue2378a::{just};
 use issue2378b::{two_maybes};
index 86b4624c34ece214a3416d95fead36cd6552d484..4144e0c85c85353d095f647f5b34f388cb1639c3 100644 (file)
@@ -11,5 +11,5 @@
 // ignore-fast - check-fast doesn't understand aux-build
 // aux-build:issue_3136_a.rc
 
-extern mod issue_3136_a;
+extern crate issue_3136_a;
 pub fn main() {}
index 48ee1fe70d0979721f1d75349fe998d20850eccb..09a6693eb4c5af5a74d44b049c4b3e27a937e4d9 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:issue_9155.rs
 // ignore-fast check-fast doesn't like the aux-build
 
-extern mod issue_9155;
+extern crate issue_9155;
 
 struct Baz;
 
index 133660e28d2ace642bbded922744032d396ce22e..8ea06e510803dc03bc232d6a609fd05463bb17e3 100644 (file)
@@ -140,7 +140,7 @@ fn f() { }
 }
 
 mod test_distinguish_syntax_ext {
-    extern mod extra;
+    extern crate extra;
 
     pub fn f() {
         format!("test{}", "s");
index f9165ce309f671031d86783d214b84db92eb8030..7799bd701621798c308872de2a7e4247a26bb09c 100644 (file)
@@ -16,7 +16,7 @@
 
 // Tests that metadata serialization works for the `Pod` kind.
 
-extern mod kinds_in_metadata;
+extern crate kinds_in_metadata;
 
 use kinds_in_metadata::f;
 
index 9ac2b710995d66ba519a3b8214874ba51f5ceadc..e4c0d023298d0779279b0b949fe60c99548ac43b 100644 (file)
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 // aux-build:linkage-visibility.rs
-// ignore-fast check-fast doesn't like 'extern mod'
+// ignore-fast check-fast doesn't like 'extern crate'
 // ignore-android: FIXME(#10379)
 // ignore-win32: std::unstable::dynamic_lib does not work on win32 well
 
-extern mod foo = "linkage-visibility";
+extern crate foo = "linkage-visibility";
 
 pub fn main() {
     foo::test();
index 24eb48e92cd0e67472f18be097c9e60939af8019..05c5a7a67f563794fc0fa9db4aa4750ff809899f 100644 (file)
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod collections;
+extern crate collections;
 use collections::list;
 
 #[deriving(Clone)]
index f140a73a776b168a0c73dc1f0079cfb670c24e62..68afcc98bba8b273ec4e69e615feeaca5bf079ad 100644 (file)
@@ -22,7 +22,7 @@
 // longer happens by enabling logging for *this* crate and then invoking a
 // function in an external crate which will fail when logging is enabled.
 
-extern mod logging_right_crate;
+extern crate logging_right_crate;
 
 pub fn main() {
     // this function fails if logging is turned on
index e4886ba115c94459d9672173b6be174e396a73e5..9c33ff59dacdcc12b7eeea4243544394514692cf 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-test linked failure
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 08529bb2d009e8305e4c05c0914d2b1446a9adcb..2c2ffd50eae9b9476bb7d0d49e63f784bed21dd8 100644 (file)
@@ -14,7 +14,7 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod macro_crate_def_only;
+extern crate macro_crate_def_only;
 
 pub fn main() {
     assert_eq!(5, make_a_5!());
index e31a78e604f87ba6f9ef76d7fe1d27f0220646ed..14c6423ce40cc8357fc482f19fc9166f71218730 100644 (file)
@@ -15,7 +15,7 @@
 #[feature(phase)];
 
 #[phase(syntax)]
-extern mod macro_export_inner_module;
+extern crate macro_export_inner_module;
 
 pub fn main() {
     assert_eq!(1, foo!());
index 0f01985f274ad25f37f7ed61021f553a866207b4..90768fdc6c90366fc136d0c815f44786ec3252d7 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-extern mod extra;
+extern crate extra;
 
 fn foo<T>(y: Option<T>) {
     let mut x: int;
index 5e03b47d1b1dcc1fcb6332e930ed478aeecfb45b..3bedd340fea25e71316c2045cddfbdd70236879c 100644 (file)
@@ -10,7 +10,7 @@
 
 #[feature(managed_boxes)];
 
-extern mod extra;
+extern crate extra;
 
 trait Serializer {
 }
index c04199dad3e1251bc331c6b0f2fafc892fb55996..ba1128978d38b662c1284c0ce69aa7711adfb55a 100644 (file)
@@ -12,7 +12,7 @@
 
 // This test will call __morestack with various minimum stack sizes
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 46308e02e78585fe5a11a33b148087d139b1d13c..2bd1eb7fd4bff3df8a9974eee2cc4ff57794aabc 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 #[deriving(Clone)]
 struct Triple {
index e915cf6aed79881229c0668cd3d36489a8fbb725..2819d9bd76e40981bec676288f18cbdf57f22795 100644 (file)
@@ -10,7 +10,7 @@
 
 #[feature(managed_boxes)];
 
-extern mod extra;
+extern crate extra;
 
 struct Triple { x: int, y: int, z: int }
 
index 48621cf03be6a9f070fe35e3d36df2218bc59a5e..660fb447bb0e5401890ec727c927b65d179efba7 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 struct Triple {a: int, b: int, c: int}
 
index ec66e72ac6979edf125f883a1ab46a4ba031cc70..67b071af0a27ed3ea2e7c44f3c4dba30c8b23c47 100644 (file)
@@ -10,7 +10,7 @@
 
 #[feature(managed_boxes)];
 
-extern mod extra;
+extern crate extra;
 
 struct Triple { a: int, b: int, c: int }
 
index b3ea2b365634c44c2cde6687b11cc937e1c7288b..abccd11d8b9812e73000e1521efae017ccfe9848 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:moves_based_on_type_lib.rs
 
-extern mod moves_based_on_type_lib;
+extern crate moves_based_on_type_lib;
 use moves_based_on_type_lib::f;
 
 pub fn main() {
index 9779db91a9c8a818a039fa1ead081aa42119be09..f512a4659853a9a21306f95ea98f93debf40cfd5 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 fn grow(v: &mut ~[int]) {
     v.push(1);
index 319b2be52e5bc8eced6c669311d1c6ce7c4f04d5..18a64c8bd5be83e01d8607dc402dd6dfa40f001d 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // ignore-android (FIXME #11419)
 
-extern mod native;
+extern crate native;
 
 static mut set: bool = false;
 
index 121847ef3cb28d55b70f4f02a3f0b31eeb741f79..5fe1cd7fa558aef4809b46428dd742829090bb47 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:nested_item.rs
 // ignore-fast
 
-extern mod nested_item;
+extern crate nested_item;
 
 pub fn main() {
     assert_eq!(2, nested_item::foo::<()>());
index 812bf4d600bcbc1275cefa508f5f41cabc807187..9aec3f2c4f7e7c2bd44ed7de3bda7dfaf77fb0b7 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:newtype_struct_xc.rs
 
-extern mod newtype_struct_xc;
+extern crate newtype_struct_xc;
 use newtype_struct_xc::Au;
 
 fn f() -> Au {
index 6f5da821a108bbce19fef6f575da2287e32676d8..98a55f29758253f71c9c5a93b4fb97cc422c833a 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:newtype_struct_xc.rs
 
-extern mod newtype_struct_xc;
+extern crate newtype_struct_xc;
 
 pub fn main() {
     let _ = newtype_struct_xc::Au(2);
index f5394481172a8e9af84076dc9ee3ed639d6d5fdd..f149b8645d4cde5eef6b993c55374f1619074df1 100644 (file)
@@ -14,7 +14,7 @@
 // This tests that crates which link to std can also be linked to crates with
 // #[no_std] that have no lang items.
 
-extern mod no_std_crate;
+extern crate no_std_crate;
 
 pub fn main() {
     no_std_crate::foo();
index a22814af23e6724f46fb36a64fa5b5eea7cae8b3..7e734a7d9e2626ab3238be8ba48913618735324d 100644 (file)
@@ -18,7 +18,7 @@
 
 #[no_std];
 
-extern mod no_std_crate;
+extern crate no_std_crate;
 
 // This is an unfortunate thing to have to do on linux :(
 #[cfg(target_os = "linux")]
index 60b018fde7ab60aa3f59302f378df15038cfb0ee..cb08c81d9e0ed260fff0eaf33edef98b6312ee48 100644 (file)
@@ -12,7 +12,7 @@
 
 #[feature(managed_boxes)];
 
-extern mod collections;
+extern crate collections;
 
 use collections::list::{List, Cons, Nil, head, is_empty};
 
index 7f0b22ed1d0abb76a1e06aebae3531a33b4120a2..5067a6c4f926f47f523a3be16ea8f6c67120c266 100644 (file)
@@ -13,7 +13,7 @@
 // ignore-fast
 
 #[feature(once_fns)];
-extern mod sync;
+extern crate sync;
 use sync::Arc;
 
 fn foo(blk: proc()) {
index 4d344a9b7b6ff58503c58b8dc31a739618cfba4b..ffee1e400afff0eb2b3d0d5743725513fc3bf1e6 100644 (file)
@@ -13,7 +13,7 @@
 // ignore-fast
 
 #[feature(once_fns)];
-extern mod sync;
+extern crate sync;
 use sync::Arc;
 
 fn foo(blk: once ||) {
index 13142c7bff87be3be81076d4ae62b821a5207ed8..2ee90eb2c4c6b9b69f1f97bd09bbe2bff82b3ca8 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:packed.rs
 
-extern mod packed;
+extern crate packed;
 
 use std::mem;
 
index a829dd3fbc540020cc6f3c8edcada58effc47f83..a7b8297487d0011db7d0fe3c7bd13438b7d5dd48 100644 (file)
@@ -27,7 +27,7 @@
 #[feature(phase)];
 
 #[phase(syntax, link)]
-extern mod macro_crate_test;
+extern crate macro_crate_test;
 
 fn main() {
     assert_eq!(1, make_a_1!());
index eed01b6d00a871d8fc0e35d9b9de5a5634505e81..876d9d2a6908de848256d5c728d658c8338fa2b6 100644 (file)
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod arena;
+extern crate arena;
 use arena::Arena;
 
 pub fn main() {
index 23a6104af7dc08efcd7a1f7d4dbae53c862c38c3..5f8da9ddaffca6caa35c11e062794d46bed78f38 100644 (file)
@@ -12,7 +12,7 @@
 // This checks that preemption works.
 
 // note: halfway done porting to modern rust
-extern mod extra;
+extern crate extra;
 
 use std::comm;
 use extra::comm;
index 46a520ae21ce3bf87cde4bf179fd67601a3bc3bf..4c7160a8eee038445a3fde605059e71afdf04a21 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:priv-impl-prim-ty.rs
 
-extern mod bar = "priv-impl-prim-ty";
+extern crate bar = "priv-impl-prim-ty";
 
 pub fn main() {
     bar::frob(1i);
index a2845d020b28404e6bf34d31f7f5c420cbacdcb0..e9450d1e77dc06201c25ed6e58155593ac061a6e 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:privacy_reexport.rs
 
-extern mod privacy_reexport;
+extern crate privacy_reexport;
 
 pub fn main() {
     privacy_reexport::bar::frob();
diff --git a/src/test/run-pass/process-detach.rs b/src/test/run-pass/process-detach.rs
new file mode 100644 (file)
index 0000000..91f77ca
--- /dev/null
@@ -0,0 +1,56 @@
+// 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.
+
+// ignore-fast
+// ignore-win32
+// ignore-android
+
+// This test ensures that the 'detach' field on processes does the right thing.
+// By detaching the child process, they should be put into a separate process
+// group. We test this by spawning a detached process, then killing our own
+// group with a signal.
+//
+// Note that the first thing we do is put ourselves in our own process group so
+// we don't interfere with other running tests.
+
+use std::libc;
+use std::io::process;
+use std::io::signal::{Listener, Interrupt};
+
+fn main() {
+    unsafe { libc::setsid(); }
+
+    let config = process::ProcessConfig {
+        program : "/bin/sh",
+        args : &[~"-c", ~"read a"],
+        io : &[process::CreatePipe(true, false)],
+        detach: true,
+        .. process::ProcessConfig::new()
+    };
+
+    // we shouldn't die because of an interrupt
+    let mut l = Listener::new();
+    l.register(Interrupt).unwrap();
+
+    // spawn the child
+    let mut p = process::Process::new(config).unwrap();
+
+    // send an interrupt to everyone in our process group
+    unsafe { libc::funcs::posix88::signal::kill(0, libc::SIGINT); }
+
+    // Wait for the child process to die (terminate it's stdin and the read
+    // should fail).
+    drop(p.io[0].take());
+    match p.wait() {
+        process::ExitStatus(..) => {}
+        process::ExitSignal(..) => fail!()
+    }
+}
+
index 0a25840c3936edd2df470aaeb0f75471d52a6948..2d4f5f743b8b91e3f80855dd0df371fde45f3849 100644 (file)
@@ -12,7 +12,7 @@
 // aux-build:pub_use_xcrate1.rs
 // aux-build:pub_use_xcrate2.rs
 
-extern mod pub_use_xcrate2;
+extern crate pub_use_xcrate2;
 
 use pub_use_xcrate2::Foo;
 
index 3672d05f87adce3e3da5238df92036f7caf1dff9..87185e39aa99670eafce3ac1a9407a5479e91ac1 100644 (file)
@@ -13,7 +13,7 @@
 
 #[allow(unused_imports)];
 
-extern mod pub_use_mods_xcrate;
+extern crate pub_use_mods_xcrate;
 use pub_use_mods_xcrate::a::c;
 
 pub fn main(){}
index c5f27ab5e5b1222b811bf4c61572d1febd575583..0c22fcb44e9c33413f0c9ef841b93dde8dbbdf4c 100644 (file)
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 // aux-build:reexport-should-still-link.rs
-// ignore-fast check-fast doesn't like extern mod
+// ignore-fast check-fast doesn't like extern crate
 
-extern mod foo = "reexport-should-still-link";
+extern crate foo = "reexport-should-still-link";
 
 pub fn main() {
     foo::bar();
index 330776ca0467e7cf5e7a83355c14eb0240f51cd6..b3a7cf7442865b8870e1c5e78549c790996732ce 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 // aux-build:reexported_static_methods.rs
-extern mod reexported_static_methods;
+extern crate reexported_static_methods;
 
 use reexported_static_methods::Foo;
 use reexported_static_methods::Baz;
index e20717553c4c48618683bb098c922f8e6dc041ff..975dcab1902513d15e16913de5c30b12a36927b8 100644 (file)
@@ -11,7 +11,7 @@
 // This test verifies that temporary lifetime is correctly computed
 // for static objects in enclosing scopes.
 
-extern mod extra;
+extern crate extra;
 use std::cmp::Eq;
 
 fn f<T:Eq>(o: &mut Option<T>) {
index 43a8b452537bf2fd3b2b50fffceb3a6d4da05fe5..738a4899f273007781c3ccc1dc2281a06a5bc440 100644 (file)
@@ -16,7 +16,7 @@
 // - Multiple lifetime parameters
 // - Arenas
 
-extern mod arena;
+extern crate arena;
 
 use arena::Arena;
 use std::hashmap::HashMap;
index 83f77baf568611c8418fecdc8c20fedaf9f25713..3f14d7befac2791bd0ce146c77997ae3b1350a17 100644 (file)
@@ -12,7 +12,7 @@
 // because it needs TempDir, which is in extra
 
 // ignore-fast
-extern mod extra;
+extern crate extra;
 
 use extra::tempfile::TempDir;
 use std::os;
index 11f9252f22f5a07246f5fd1df9d704357e12e103..5116dcb8dc8ebefd3df8a406a2bdf3d74178fe00 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // ignore-test linked failure
-extern mod extra;
+extern crate extra;
 
 use std::comm;
 use std::task;
index 1b7d7bf0b4b570d51f81e9b0973eab844545f4c6..1543d34ae88b9b4337e8ebaf275eac7f316f0c60 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod collections;
+extern crate collections;
 
 use std::clone::{Clone, DeepClone};
 use std::cmp::{TotalEq, Ord, TotalOrd, Equiv};
index d95f032e8143838ce67082137b335f72c9fa6b67..002736693788a808b1810c925a53e83cab7940f3 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index dc68777e033b0f91659bc9495c765aa023fa39cf..083d2e167a0757e54beb71f4cfa07b06831ee7ee 100644 (file)
@@ -10,9 +10,7 @@
 
 // Issue #2040
 
-use std::ptr;
-
 pub fn main() {
     let foo = 1;
-    assert_eq!(ptr::to_unsafe_ptr(&foo), ptr::to_unsafe_ptr(&foo));
+    assert_eq!(&foo as *int, &foo as *int);
 }
index c3e87d27ef2102d2014375c9b0b02a13b4401558..33f4c9d9a982a3f61e70d6e2da93a2d42b19cc78 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 
-extern mod extra;
+extern crate extra;
 
 use extra::tempfile;
 use std::io::File;
index a6b1c649ddfcf24b7be28efaad67fc76e1c5f02d..f679de04ba29e6ee611985ff9e93dcb9aeca5957 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:static_fn_inline_xc_aux.rs
 
-extern mod mycore = "static_fn_inline_xc_aux";
+extern crate mycore = "static_fn_inline_xc_aux";
 
 use mycore::num;
 
index 6c0a6461057f9904827c3ffc287935ed130a509a..5643429d8e38ba093809d1727ed4b326bb8454e0 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:static_fn_trait_xc_aux.rs
 // ignore-fast
 
-extern mod mycore = "static_fn_trait_xc_aux";
+extern crate mycore = "static_fn_trait_xc_aux";
 
 use mycore::num;
 
index 22a7c0aa3919ee0f8b9749dfc298b2f1958fdd3a..8471b633792235c6af26723450f244f4b5f40ee0 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 // aux-build:static-function-pointer-aux.rs
-extern mod aux = "static-function-pointer-aux";
+extern crate aux = "static-function-pointer-aux";
 
 fn f(x: int) -> int { x }
 
index 343155cc99fa3c342d010e8e127860d3494a3c28..db3f61567d8b8c16344c1f8b76d9ec22a288c96a 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:static-methods-crate.rs
 
-extern mod static_methods_crate;
+extern crate static_methods_crate;
 
 use static_methods_crate::read;
 
index 9228434735af3b5cbc641c12fb78f1075303a379..c7b17d91a8fc6a17e86fc256d07426b21288448a 100644 (file)
@@ -15,7 +15,7 @@
 // ignore-fast
 // aux-build:static_mut_xc.rs
 
-extern mod static_mut_xc;
+extern crate static_mut_xc;
 
 unsafe fn static_bound(_: &'static int) {}
 
index bede746f5690bb1fb8fd1bdb106a6f1e40589df7..c6ff57ac4e80418f2aa76584925616ddab558d39 100644 (file)
@@ -10,7 +10,7 @@
 
 
 
-extern mod extra;
+extern crate extra;
 
 fn test1() {
     let mut s: ~str = ~"hello";
index 59736829a231fdb4c114c90015b209380296cf00..3c5a860d6c83273aad8ed96700a9463aa04ef744 100644 (file)
@@ -10,7 +10,7 @@
 
 
 
-extern mod extra;
+extern crate extra;
 
 pub fn main() {
     let a: ~str = ~"this \
index 68f1e21571c315d9ef8c8e0ff1c1319e1a63f6e7..34a818879d0b6dc2212c4fb6f084e1e130425302 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 pub fn main() {
     // Make sure we properly handle repeated self-appends.
index f7db1ae37b89217a416212b8e249396fb133c692..31ba7149c29b46e585df3ead025c0bb129c95ad9 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:struct_destructuring_cross_crate.rs
 
-extern mod struct_destructuring_cross_crate;
+extern crate struct_destructuring_cross_crate;
 
 pub fn main() {
     let x = struct_destructuring_cross_crate::S { x: 1, y: 2 };
index bb3d07581bc6ec420468a829395f0eb45c74d8a8..c9cd64161b7e705be33da7166ac4659d554d8603 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast - check-fast doesn't understand aux-build
 // aux-build:struct_variant_xc_aux.rs
-extern mod struct_variant_xc_aux;
+extern crate struct_variant_xc_aux;
 
 use struct_variant_xc_aux::Variant;
 
index 42f3089a87a193f43f083c017910900b27e2f60c..d9cf585ad6c0a293cf8835d67aa9695c7fa68f75 100644 (file)
@@ -25,7 +25,7 @@ pub fn main() {
 
 fn do_swap(test: &mut TestDescAndFn) {
     unsafe {
-        ptr::swap_ptr(test, test);
+        ptr::swap(test, test);
     }
 }
 
index ee88670ca14f89f3e9f6d6f64ee3d8377dc6a6f1..f02e3a17813f9428ecf6e306c04ae128b9413aba 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 8e7250f6ab4a464d9ab1789eac767918339a4314..1c64cf9cff5c643b385dcee625d945674e7566c5 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 4392419d26da4f912907a46ca57602e4998328db..3d6e841d318737d33f07e38a5b693d0df128b5a9 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index f6f6f3ba240cfd2dcaf1b3ef685442e5d35a1e9d..8092fb6d4ad2d271c22d1351457ac43a5e4491a4 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 53386c2f8454042b75dd298bde9258872cf7c38d..6f22eb97c511353b3a02b1aab2484a862e612e5e 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index b1cde6b93578c010bf7cf95da89d6ea3bb64001d..4e4d38b9605ad68981199769b33b5e1b92bff30a 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 4f9285d30b9e07063008ac447f4eba2efbec1c44..70a59c5b85dc46564599babc825337c1abc125a5 100644 (file)
@@ -12,7 +12,7 @@
 
 // This test is specifically about spawning temporary closures.
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index f5374e7df05a90b948f06cd320714a8d2b945ae2..732d72c11fec22037fc0c1a7695da330c253647a 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index c63bf12db2b33a1015acbfe4afdc8da0eab11b9e..64ccf4f3df87388c423e4c01a2cab6801d292808 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 pub fn main() { test00(); }
 
index ff43a80adaca1ecba4efb3e4ce795287db9e8419..e72e5677776d05863693401d601358f845f71553 100644 (file)
@@ -12,7 +12,7 @@
 
 #[allow(dead_assignment)];
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index d275aec5894ffe2d54ebbe4cf3f7e85aaff05058..4a053b0c47a3a3479e03fe8e9b4a1ba17928a9a9 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 3277400704910cd7b8432d7f26b71c0ceca27827..f5fe5be0d7613a83849a5f22aaca6ac08905808c 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-extern mod extra;
+extern crate extra;
 
 // rustboot can't transmit nils across channels because they don't have
 // any size, but rustc currently can because they do have size. Whether
index b60e3f2a4eebab39f77d92e56e6f0a77581d629a..54aac31c7dee58ef0f6c3f0a398fe791458fc69b 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 1ed0c23fd7a4ce4cb8c4e1ffb629922558bded70..944c498ede37fd1436aeec696d2bf0a173b6d1ff 100644 (file)
@@ -8,17 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::ptr;
 use std::task;
 
 pub fn main() {
     let (p, ch) = Chan::<uint>::new();
 
     let x = ~1;
-    let x_in_parent = ptr::to_unsafe_ptr(&(*x)) as uint;
+    let x_in_parent = &(*x) as *int as uint;
 
     task::spawn(proc() {
-        let x_in_child = ptr::to_unsafe_ptr(&(*x)) as uint;
+        let x_in_child = &(*x) as *int as uint;
         ch.send(x_in_child);
     });
 
index 077a0c46ecbf8a3afaaa243fe55de9fcfad2d7ef..d42ce9793e0fa9a7c854cf0a2c3aab06edd9f592 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-fast check-fast doesn't like 'extern mod'
+// ignore-fast check-fast doesn't like 'extern crate'
 // ignore-win32 TempDir may cause IoError on windows: #10463
 
 // These tests are here to exercise the functionality of the `tempfile` module.
@@ -19,7 +19,7 @@
 // they're in a different location than before. Hence, these tests are all run
 // serially here.
 
-extern mod extra;
+extern crate extra;
 
 use extra::tempfile::TempDir;
 use std::io::fs;
index aaedb2d322be10aadedc6b5152889298883bfec9..b63573f6103bad3689d114ad5c96e39ad3f8e5cb 100644 (file)
@@ -13,7 +13,7 @@
 // Issue #787
 // Don't try to clean up uninitialized locals
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 89579c541d250b56024df33a0620a82827abef03..eee667fdb04110d2d1b5314c772d3af5cb172d6f 100644 (file)
@@ -11,7 +11,7 @@
 // compile-flags: --test --cfg ignorecfg
 // ignore-fast
 
-extern mod extra;
+extern crate extra;
 
 #[test]
 #[ignore(cfg(ignorecfg))]
index 42810f3e0ee6624347abeceadf8d336ce0e3ba5e..cdef159b3996d81a7764bee6385a290c940abb75 100644 (file)
@@ -12,7 +12,7 @@
 // ignore-fast
 // ignore-win32 #10872
 
-extern mod extra;
+extern crate extra;
 
 // Building as a test runner means that a synthetic main will be run,
 // not ours
index 7df9dac219a1f5deb06347ffedbf1ce4f20c6769..3e1d5b3684dc320147c4e9c7c535fb755a3c4840 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 4989a13957ae27dd95bbee9d20b77b29e418cdf2..fa94f1012d026f13d379f7921ba29afd38a28dfd 100644 (file)
@@ -15,7 +15,7 @@
 
 // ignore-fast
 
-extern mod sync;
+extern crate sync;
 
 use sync::Arc;
 use std::task;
index 777881f9360eb91c7e7a1f72473284901c2a5df9..ccd7c9b8a3af2c49ede475951b01d5688c1dcc48 100644 (file)
@@ -13,8 +13,8 @@
 // aux-build:trait_default_method_xc_aux_2.rs
 
 
-extern mod aux = "trait_default_method_xc_aux";
-extern mod aux2 = "trait_default_method_xc_aux_2";
+extern crate aux = "trait_default_method_xc_aux";
+extern crate aux2 = "trait_default_method_xc_aux_2";
 use aux::A;
 use aux2::{a_struct, welp};
 
index 7ad658527c9092dc6231f29695566fffd19e03dc..c0344136059dfdff60b06736057de8f644c44562 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:trait_default_method_xc_aux.rs
 
-extern mod aux = "trait_default_method_xc_aux";
+extern crate aux = "trait_default_method_xc_aux";
 use aux::{A, TestEquality, Something};
 use aux::B;
 
index 4f5b6a783f5137df34528f038205ec389015e022..bf6c429b6c80eae00d8a199acf895698657a9ae0 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:trait_inheritance_auto_xc_2_aux.rs
 
-extern mod aux = "trait_inheritance_auto_xc_2_aux";
+extern crate aux = "trait_inheritance_auto_xc_2_aux";
 
 // aux defines impls of Foo, Bar and Baz for A
 use aux::{Foo, Bar, Baz, A};
index dfaddea86c21c3540300c3a0a130b64475ef76f5..ef72611e76f152c025f54666b0a3731a219d2c9f 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:trait_inheritance_auto_xc_aux.rs
 
-extern mod aux = "trait_inheritance_auto_xc_aux";
+extern crate aux = "trait_inheritance_auto_xc_aux";
 
 use aux::{Foo, Bar, Baz, Quux};
 
index 1915a136afcafcf93ff02bcab1cdc75653012a0d..cdc0c5a80a9ba593b57202762cdf3e79db9f09f5 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:trait_inheritance_cross_trait_call_xc_aux.rs
 
-extern mod aux = "trait_inheritance_cross_trait_call_xc_aux";
+extern crate aux = "trait_inheritance_cross_trait_call_xc_aux";
 
 use aux::Foo;
 
index 49457d521613d59edb10bf1ad050e3685110424a..b7d5f9c6fd68de076c6a09ce8fbb73a3fbce9c4e 100644 (file)
@@ -10,7 +10,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::cmp::{Eq, Ord};
 use std::num::NumCast;
index eccafcf5be8840e3417712d3fb24e9d6bb6ae667..5e6dc7c67c8e6bb76d5cc281411f4642fd08fde3 100644 (file)
@@ -12,7 +12,7 @@
 
 // A more complex example of numeric extensions
 
-extern mod extra;
+extern crate extra;
 
 use std::cmp::{Eq, Ord};
 
index 838a5a337a34778279aa378bb5a3923dc13daca2..faadc68f135bd54baaa66fe69718ce14eb959991 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast - check-fast doesn't understand aux-build
 // aux-build:trait_inheritance_overloading_xc.rs
 
-extern mod trait_inheritance_overloading_xc;
+extern crate trait_inheritance_overloading_xc;
 use trait_inheritance_overloading_xc::{MyNum, MyInt};
 
 fn f<T:MyNum>(x: T, y: T) -> (T, T, T) {
index e50abf06ddfd73acaeeaab962905848d0d9b5e0c..62cda8ed82d7516ea451e68577db97bb3e92e8cc 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-test FIXME: #3907
 // aux-build:trait_typedef_cc.rs
-extern mod trait_typedef_cc;
+extern crate trait_typedef_cc;
 
 type Foo = trait_typedef_cc::Foo;
 
index 2cdff23050db31ed859acc8e08ccc361df8c2c65..970a5c5011b2eed144ef49a9015d965e29dfaa3c 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod std;
+extern crate std;
 use std::mem::size_of;
 
 struct t {a: u8, b: i8}
index 1a386a0c76f5984298e71938465c90b88a913546..71e19b51c726613a9dc5fd91c48a560f7fef2c2d 100644 (file)
@@ -12,8 +12,8 @@
 // aux-build:typeid-intrinsic.rs
 // aux-build:typeid-intrinsic2.rs
 
-extern mod other1 = "typeid-intrinsic";
-extern mod other2 = "typeid-intrinsic2";
+extern crate other1 = "typeid-intrinsic";
+extern crate other2 = "typeid-intrinsic2";
 
 use std::unstable::intrinsics;
 use std::unstable::intrinsics::TypeId;
index 8bdce601b285c5581455fb7c1edbfc7ade3234b3..fc0d4ce4b897b10c5364c714bec62f4b998fd1ab 100644 (file)
@@ -11,7 +11,7 @@
 // Tests that the tail expr in null() has its type
 // unified with the type *T, and so the type variable
 // in that type gets resolved.
-extern mod extra;
+extern crate extra;
 
 use std::cast;
 
index 53836a6e17dfbb9e589a7dde3ef606db0fc7245d..9efa6c1b9646ad754a64b2cf2d831a3d43901367 100644 (file)
@@ -11,7 +11,6 @@
 #[feature(managed_boxes)];
 
 use std::cell::RefCell;
-use std::ptr;
 
 enum maybe_pointy {
     none,
@@ -24,7 +23,7 @@ struct Pointy {
 }
 
 fn make_uniq_closure<A:Send>(a: A) -> proc() -> uint {
-    let result: proc() -> uint = proc() ptr::to_unsafe_ptr(&a) as uint;
+    let result: proc() -> uint = proc() &a as *A as uint;
     result
 }
 
index 173919608de016a781784f89f855851e63e09398..beaf76cafbcde717336ea3c8e93b454e93522257 100644 (file)
@@ -10,7 +10,7 @@
 
 #[feature(managed_boxes)];
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index e643a20436e0cb4fc21b5cf379fe7f9936df827a..8143188b9770fd71aa17e70ac49219ae0734383a 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-fast
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index 38e5a122a12ac832303ef310edd66cda4735f448..176eb02105f72115620d4407191a0fadb4933e6e 100644 (file)
@@ -10,7 +10,7 @@
 
 #[feature(managed_boxes)];
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index e2e64d72575966d2bba62c84c8c8471f8d98167a..dabe8c3450b8637324da1a9f20e00c6403ffae51 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::task;
 
index d9f40e5f1f3d8c9a482b0c2c5e5920b82dbc938c..9c53dde21ddbbefcc254862a343731de868c1586 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 // Issue #1706
-extern mod stdlib = "extra";
+extern crate stdlib = "extra";
 
 pub fn main() {}
index a8646441e74bd911c665c50e6f110e719de4fe97..1d65a0a5e9e8c32276be1e78d43e8c26c8932226 100644 (file)
@@ -15,9 +15,9 @@
 #[allow(unused_imports)];
 
 #[no_std];
-extern mod std;
-extern mod zed = "std";
-extern mod bar = "std#0.10-pre";
+extern crate std;
+extern crate zed = "std";
+extern crate bar = "std#0.10-pre";
 
 
 use std::str;
index a041cfc333440b08aa931fbe0e4b7e5676ec25be..9cb11c10e3ea808da926007f2152c358e871a3eb 100644 (file)
@@ -11,7 +11,7 @@
 // aux-build:inline_dtor.rs
 // ignore-fast
 
-extern mod inline_dtor;
+extern crate inline_dtor;
 
 pub fn main() {
     let _x = inline_dtor::Foo;
index 4c86b5eb2bec8ca6541ae2ea92cff14ce74d7638..3066a247e4e6b7f26aba34fbff6d499a3035c7e3 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 use std::str;
 
index ce70643cfc68e1b228bfff08b6515b137e11b666..e9fcfaaf2837fca86141828639fa901c4128086b 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern crate extra;
 
 fn test_heap_to_heap() {
     // a spills onto the heap
index 01ffdc1f2eff015a34b9e03a2e6645c763bf5ae8..b231b859a066d6320b5d1021ecbdd97fd11e14a0 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast check-fast doesn't like aux-build
 // aux-build:xcrate_address_insignificant.rs
 
-extern mod foo = "xcrate_address_insignificant";
+extern crate foo = "xcrate_address_insignificant";
 
 pub fn main() {
     assert_eq!(foo::foo::<f64>(), foo::bar());
index b1335d35728264aac9ba9df0d162d6636d3c3e4a..d3184968ee6145af336cdabf1b04a4ad694b1afd 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:xcrate_static_addresses.rs
 
-extern mod xcrate_static_addresses;
+extern crate xcrate_static_addresses;
 
 use other = xcrate_static_addresses;
 
index a26a3ebeb8c5283997bc559da9b7cf3b1d040fc3..b5aae62841f71230d20c293ebd2c4a84f7897f0c 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-fast
 // aux-build:xcrate-trait-lifetime-param.rs
 
-extern mod other = "xcrate-trait-lifetime-param";
+extern crate other = "xcrate-trait-lifetime-param";
 
 struct Reader<'a> {
     b : &'a [u8]
index 927881d7c17f7f36f584a3450ba12640f5e106f0..3a440037cf82e491252613a2a23293bba3dccdfd 100644 (file)
@@ -10,7 +10,7 @@
 
 // aux-build:xcrate_unit_struct.rs
 // ignore-fast
-extern mod xcrate_unit_struct;
+extern crate xcrate_unit_struct;
 
 static s1: xcrate_unit_struct::Struct = xcrate_unit_struct::Struct;
 static s2: xcrate_unit_struct::Unit = xcrate_unit_struct::Unit;