]> git.lizzy.rs Git - rust.git/commitdiff
Rename fail! to panic!
authorSteve Klabnik <steve@steveklabnik.com>
Thu, 9 Oct 2014 19:17:22 +0000 (15:17 -0400)
committerSteve Klabnik <steve@steveklabnik.com>
Wed, 29 Oct 2014 15:43:07 +0000 (11:43 -0400)
https://github.com/rust-lang/rfcs/pull/221

The current terminology of "task failure" often causes problems when
writing or speaking about code. You often want to talk about the
possibility of an operation that returns a Result "failing", but cannot
because of the ambiguity with task failure. Instead, you have to speak
of "the failing case" or "when the operation does not succeed" or other
circumlocutions.

Likewise, we use a "Failure" header in rustdoc to describe when
operations may fail the task, but it would often be helpful to separate
out a section describing the "Err-producing" case.

We have been steadily moving away from task failure and toward Result as
an error-handling mechanism, so we should optimize our terminology
accordingly: Result-producing functions should be easy to describe.

To update your code, rename any call to `fail!` to `panic!` instead.
Assuming you have not created your own macro named `panic!`, this
will work on UNIX based systems:

    grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g'

You can of course also do this by hand.

[breaking-change]

506 files changed:
src/compiletest/compiletest.rs
src/compiletest/header.rs
src/compiletest/runtest.rs
src/compiletest/util.rs
src/doc/complement-design-faq.md
src/doc/complement-lang-faq.md
src/doc/guide-ffi.md
src/doc/guide-macros.md
src/doc/guide-tasks.md
src/doc/guide-testing.md
src/doc/guide-unsafe.md
src/doc/guide.md
src/doc/reference.md
src/doc/rustdoc.md
src/grammar/verify.rs
src/liballoc/arc.rs
src/liballoc/boxed.rs
src/libarena/lib.rs
src/libcollections/btree/node.rs
src/libcollections/dlist.rs
src/libcollections/lib.rs
src/libcollections/ringbuf.rs
src/libcollections/slice.rs
src/libcollections/smallintmap.rs
src/libcollections/str.rs
src/libcollections/string.rs
src/libcollections/treemap.rs
src/libcollections/trie.rs
src/libcollections/vec.rs
src/libcore/atomic.rs
src/libcore/cell.rs
src/libcore/char.rs
src/libcore/failure.rs [deleted file]
src/libcore/finally.rs
src/libcore/fmt/float.rs
src/libcore/fmt/num.rs
src/libcore/lib.rs
src/libcore/macros.rs
src/libcore/num/mod.rs
src/libcore/option.rs
src/libcore/panicking.rs [new file with mode: 0644]
src/libcore/ptr.rs
src/libcore/result.rs
src/libcore/str.rs
src/libcoretest/any.rs
src/libcoretest/finally.rs
src/libcoretest/iter.rs
src/libcoretest/option.rs
src/libcoretest/result.rs
src/libgetopts/lib.rs
src/libgreen/basic.rs
src/libgreen/context.rs
src/libgreen/lib.rs
src/libgreen/sched.rs
src/libgreen/simple.rs
src/libgreen/stack.rs
src/libgreen/task.rs
src/liblog/lib.rs
src/libnative/io/file_unix.rs
src/libnative/io/pipe_windows.rs
src/libnative/io/process.rs
src/libnative/io/timer_unix.rs
src/libnative/lib.rs
src/libnative/task.rs
src/librand/distributions/mod.rs
src/librand/lib.rs
src/librbml/lib.rs
src/libregex/compile.rs
src/libregex/lib.rs
src/libregex/parse.rs
src/libregex/re.rs
src/libregex/test/bench.rs
src/libregex/test/mod.rs
src/libregex/test/tests.rs
src/librustc/back/write.rs
src/librustc/driver/config.rs
src/librustc/driver/mod.rs
src/librustc/driver/pretty.rs
src/librustc/lint/builtin.rs
src/librustc/lint/context.rs
src/librustc/metadata/creader.rs
src/librustc/metadata/decoder.rs
src/librustc/metadata/filesearch.rs
src/librustc/metadata/tydecode.rs
src/librustc/middle/astencode.rs
src/librustc/middle/borrowck/gather_loans/move_error.rs
src/librustc/middle/borrowck/mod.rs
src/librustc/middle/dataflow.rs
src/librustc/middle/def.rs
src/librustc/middle/lang_items.rs
src/librustc/middle/liveness.rs
src/librustc/middle/region.rs
src/librustc/middle/resolve.rs
src/librustc/middle/subst.rs
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/adt.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/build.rs
src/librustc/middle/trans/cabi_arm.rs
src/librustc/middle/trans/cabi_mips.rs
src/librustc/middle/trans/cabi_x86_64.rs
src/librustc/middle/trans/callee.rs
src/librustc/middle/trans/cleanup.rs
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/context.rs
src/librustc/middle/trans/doc.rs
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/foreign.rs
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/intrinsic.rs
src/librustc/middle/trans/meth.rs
src/librustc/middle/trans/tvec.rs
src/librustc/middle/trans/type_.rs
src/librustc/middle/trans/type_of.rs
src/librustc/middle/ty.rs
src/librustc/middle/typeck/astconv.rs
src/librustc/middle/typeck/check/_match.rs
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/check/vtable.rs
src/librustc/middle/typeck/coherence/mod.rs
src/librustc/middle/typeck/collect.rs
src/librustc/middle/typeck/infer/glb.rs
src/librustc/middle/typeck/infer/mod.rs
src/librustc/middle/typeck/infer/region_inference/mod.rs
src/librustc/middle/typeck/infer/test.rs
src/librustc/middle/typeck/infer/type_variable.rs
src/librustc/middle/typeck/infer/unify.rs
src/librustc/middle/typeck/variance.rs
src/librustc/middle/weak_lang_items.rs
src/librustc/plugin/registry.rs
src/librustc/util/snapshot_vec.rs
src/librustc_back/archive.rs
src/librustc_back/rpath.rs
src/librustc_back/sha2.rs
src/librustc_back/svh.rs
src/librustdoc/clean/inline.rs
src/librustdoc/clean/mod.rs
src/librustdoc/flock.rs
src/librustdoc/html/format.rs
src/librustdoc/html/render.rs
src/librustdoc/lib.rs
src/librustdoc/test.rs
src/librustdoc/visit_ast.rs
src/librustrt/args.rs
src/librustrt/c_str.rs
src/librustrt/lib.rs
src/librustrt/local_data.rs
src/librustrt/mutex.rs
src/librustrt/stack_overflow.rs
src/librustrt/task.rs
src/librustrt/thread.rs
src/librustrt/unwind.rs
src/libserialize/base64.rs
src/libserialize/json.rs
src/libstd/ascii.rs
src/libstd/c_vec.rs
src/libstd/collections/hashmap/map.rs
src/libstd/collections/hashmap/table.rs
src/libstd/dynamic_lib.rs
src/libstd/failure.rs
src/libstd/io/buffered.rs
src/libstd/io/comm_adapters.rs
src/libstd/io/extensions.rs
src/libstd/io/fs.rs
src/libstd/io/mem.rs
src/libstd/io/mod.rs
src/libstd/io/net/pipe.rs
src/libstd/io/net/tcp.rs
src/libstd/io/net/udp.rs
src/libstd/io/process.rs
src/libstd/io/result.rs
src/libstd/io/stdio.rs
src/libstd/io/test.rs
src/libstd/io/timer.rs
src/libstd/lib.rs
src/libstd/macros.rs
src/libstd/num/strconv.rs
src/libstd/os.rs
src/libstd/path/windows.rs
src/libstd/rand/mod.rs
src/libstd/rand/os.rs
src/libstd/rand/reader.rs
src/libstd/rt/backtrace.rs
src/libstd/rt/mod.rs
src/libstd/rt/util.rs
src/libstd/sync/future.rs
src/libstd/sync/task_pool.rs
src/libstd/task.rs
src/libstd/time/duration.rs
src/libsync/comm/mod.rs
src/libsync/comm/oneshot.rs
src/libsync/comm/select.rs
src/libsync/comm/shared.rs
src/libsync/comm/sync.rs
src/libsync/deque.rs
src/libsync/lock.rs
src/libsync/mpsc_queue.rs
src/libsync/raw.rs
src/libsync/spsc_queue.rs
src/libsyntax/ast.rs
src/libsyntax/ast_map/blocks.rs
src/libsyntax/ast_map/mod.rs
src/libsyntax/ast_util.rs
src/libsyntax/codemap.rs
src/libsyntax/diagnostic.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/mtwt.rs
src/libsyntax/ext/quote.rs
src/libsyntax/ext/tt/macro_parser.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/fold.rs
src/libsyntax/parse/lexer/comments.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pp.rs
src/libsyntax/print/pprust.rs
src/libsyntax/util/small_vector.rs
src/libsyntax/visit.rs
src/libterm/terminfo/parm.rs
src/libtest/lib.rs
src/libtime/lib.rs
src/test/auxiliary/cci_nested_lib.rs
src/test/auxiliary/issue_2723_a.rs
src/test/auxiliary/logging_right_crate.rs
src/test/auxiliary/regions-bounded-method-type-parameters-cross-crate-lib.rs
src/test/auxiliary/static-methods-crate.rs
src/test/auxiliary/weak-lang-items.rs
src/test/bench/core-std.rs
src/test/bench/shootout-chameneos-redux.rs
src/test/bench/shootout-k-nucleotide.rs
src/test/bench/shootout-meteor.rs
src/test/bench/shootout-pfib.rs
src/test/bench/sudoku.rs
src/test/bench/task-perf-alloc-unwind.rs
src/test/bench/task-perf-jargon-metal-smoke.rs
src/test/compile-fail/bad-bang-ann.rs
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs
src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs
src/test/compile-fail/bind-by-move-no-guards.rs
src/test/compile-fail/borrowck-anon-fields-variant.rs
src/test/compile-fail/borrowck-autoref-3261.rs
src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs
src/test/compile-fail/borrowck-borrow-from-stack-variable.rs
src/test/compile-fail/borrowck-closures-unique.rs
src/test/compile-fail/borrowck-lend-flow-if.rs
src/test/compile-fail/borrowck-lend-flow-loop.rs
src/test/compile-fail/borrowck-lend-flow.rs
src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs
src/test/compile-fail/borrowck-ref-into-rvalue.rs
src/test/compile-fail/borrowck-vec-pattern-element-loan.rs
src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs
src/test/compile-fail/closure-that-fails.rs
src/test/compile-fail/coherence-blanket-conflicts-with-specific-multidispatch.rs
src/test/compile-fail/dead-code-closure-bang.rs
src/test/compile-fail/deref-non-pointer.rs
src/test/compile-fail/fail-no-dead-code-core.rs
src/test/compile-fail/fail-no-dead-code.rs
src/test/compile-fail/fail-simple.rs
src/test/compile-fail/generic-lifetime-trait-impl.rs
src/test/compile-fail/issue-10392-2.rs
src/test/compile-fail/issue-10392.rs
src/test/compile-fail/issue-11844.rs
src/test/compile-fail/issue-12116.rs
src/test/compile-fail/issue-12187-1.rs
src/test/compile-fail/issue-12187-2.rs
src/test/compile-fail/issue-13466.rs
src/test/compile-fail/issue-2149.rs
src/test/compile-fail/issue-2150.rs
src/test/compile-fail/issue-2151.rs
src/test/compile-fail/issue-2330.rs
src/test/compile-fail/issue-2354.rs
src/test/compile-fail/issue-2611-4.rs
src/test/compile-fail/issue-2611-5.rs
src/test/compile-fail/issue-3021.rs
src/test/compile-fail/issue-3601.rs
src/test/compile-fail/issue-3668.rs
src/test/compile-fail/issue-5500-1.rs
src/test/compile-fail/issue-6458-1.rs
src/test/compile-fail/issue-897-2.rs
src/test/compile-fail/issue-897.rs
src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs
src/test/compile-fail/lint-unused-unsafe.rs
src/test/compile-fail/lint-visible-private-types.rs
src/test/compile-fail/liveness-use-after-send.rs
src/test/compile-fail/match-join.rs
src/test/compile-fail/moves-based-on-type-exprs.rs
src/test/compile-fail/moves-based-on-type-match-bindings.rs
src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs
src/test/compile-fail/non-exhaustive-match-nested.rs
src/test/compile-fail/not-enough-arguments.rs
src/test/compile-fail/pattern-tyvar-2.rs
src/test/compile-fail/pattern-tyvar.rs
src/test/compile-fail/qquote-1.rs
src/test/compile-fail/qquote-2.rs
src/test/compile-fail/regions-fn-bound.rs
src/test/compile-fail/regions-fn-subtyping-return-static.rs
src/test/compile-fail/regions-fn-subtyping.rs
src/test/compile-fail/regions-free-region-ordering-callee.rs
src/test/compile-fail/tag-that-dare-not-speak-its-name.rs
src/test/compile-fail/tag-type-args.rs
src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs
src/test/compile-fail/unused-result.rs
src/test/debuginfo/basic-types-metadata.rs
src/test/pretty/issue-929.rs
src/test/run-fail/args-fail.rs
src/test/run-fail/binop-fail.rs
src/test/run-fail/bug-2470-bounds-check-overflow-2.rs
src/test/run-fail/bug-2470-bounds-check-overflow-3.rs
src/test/run-fail/bug-2470-bounds-check-overflow.rs
src/test/run-fail/bug-811.rs
src/test/run-fail/by-value-self-objects-fail.rs
src/test/run-fail/die-macro-expr.rs
src/test/run-fail/die-macro-pure.rs
src/test/run-fail/die-macro.rs
src/test/run-fail/doublefail.rs
src/test/run-fail/explicit-fail-msg.rs
src/test/run-fail/explicit-fail.rs
src/test/run-fail/expr-fn-fail.rs
src/test/run-fail/expr-if-fail-fn.rs
src/test/run-fail/expr-if-fail.rs
src/test/run-fail/expr-match-fail-fn.rs
src/test/run-fail/expr-match-fail.rs
src/test/run-fail/extern-fail.rs
src/test/run-fail/fail-arg.rs
src/test/run-fail/fail-macro-any-wrapped.rs
src/test/run-fail/fail-macro-any.rs
src/test/run-fail/fail-macro-explicit.rs
src/test/run-fail/fail-macro-fmt.rs
src/test/run-fail/fail-macro-owned.rs
src/test/run-fail/fail-macro-static.rs
src/test/run-fail/fail-main.rs
src/test/run-fail/fail-non-utf8.rs
src/test/run-fail/fail-parens.rs
src/test/run-fail/fail-task-name-none.rs
src/test/run-fail/fail-task-name-owned.rs
src/test/run-fail/fail-task-name-send-str.rs
src/test/run-fail/fail-task-name-static.rs
src/test/run-fail/fmt-fail.rs
src/test/run-fail/for-each-loop-fail.rs
src/test/run-fail/glob-use-std.rs
src/test/run-fail/if-check-fail.rs
src/test/run-fail/if-cond-bot.rs
src/test/run-fail/issue-12920.rs
src/test/run-fail/issue-13202.rs
src/test/run-fail/issue-2444.rs
src/test/run-fail/issue-3029.rs
src/test/run-fail/issue-948.rs
src/test/run-fail/main-fail.rs
src/test/run-fail/match-bot-fail.rs
src/test/run-fail/match-disc-bot.rs
src/test/run-fail/match-wildcards.rs
src/test/run-fail/native-failure.rs
src/test/run-fail/rhs-type.rs
src/test/run-fail/rt-set-exit-status-fail.rs
src/test/run-fail/rt-set-exit-status-fail2.rs
src/test/run-fail/rt-set-exit-status.rs
src/test/run-fail/run-unexported-tests.rs
src/test/run-fail/str-overrun.rs
src/test/run-fail/task-spawn-barefn.rs
src/test/run-fail/test-fail.rs
src/test/run-fail/tls-exit-status.rs
src/test/run-fail/too-much-recursion-unwinding.rs
src/test/run-fail/unique-fail.rs
src/test/run-fail/unwind-interleaved.rs
src/test/run-fail/unwind-rec.rs
src/test/run-fail/unwind-rec2.rs
src/test/run-fail/unwind-unique.rs
src/test/run-fail/vec-overrun.rs
src/test/run-fail/while-body-fails.rs
src/test/run-fail/while-fail.rs
src/test/run-make/static-unwinding/main.rs
src/test/run-pass/attr-main-2.rs
src/test/run-pass/backtrace.rs
src/test/run-pass/binary-minus-without-space.rs
src/test/run-pass/bind-by-move.rs
src/test/run-pass/borrowck-macro-interaction-issue-6304.rs
src/test/run-pass/byte-literals.rs
src/test/run-pass/cell-does-not-clone.rs
src/test/run-pass/class-impl-very-parameterized-trait.rs
src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs
src/test/run-pass/closure-return-bang.rs
src/test/run-pass/conditional-compile.rs
src/test/run-pass/conditional-debug-macro-off.rs
src/test/run-pass/conditional-debug-macro-on.rs
src/test/run-pass/const-big-enum.rs
src/test/run-pass/const-enum-byref-self.rs
src/test/run-pass/const-enum-byref.rs
src/test/run-pass/const-enum-ptr.rs
src/test/run-pass/const-enum-structlike.rs
src/test/run-pass/const-enum-vec-index.rs
src/test/run-pass/const-enum-vec-ptr.rs
src/test/run-pass/const-enum-vector.rs
src/test/run-pass/const-nullary-enum.rs
src/test/run-pass/core-run-destroy.rs
src/test/run-pass/deriving-cmp-shortcircuit.rs
src/test/run-pass/die-macro.rs
src/test/run-pass/drop-trait-enum.rs
src/test/run-pass/dst-deref-mut.rs
src/test/run-pass/enum-alignment.rs
src/test/run-pass/enum-nullable-simplifycfg-misopt.rs
src/test/run-pass/expr-if-fail-all.rs
src/test/run-pass/expr-if-fail.rs
src/test/run-pass/expr-match-fail-all.rs
src/test/run-pass/expr-match-fail.rs
src/test/run-pass/expr-match-generic-unique1.rs
src/test/run-pass/expr-match-generic-unique2.rs
src/test/run-pass/expr-match-generic.rs
src/test/run-pass/expr-match-struct.rs
src/test/run-pass/expr-match-unique.rs
src/test/run-pass/fail-during-tld-destroy.rs
src/test/run-pass/fail-in-dtor-drops-fields.rs
src/test/run-pass/for-loop-fail.rs
src/test/run-pass/getopts_ref.rs
src/test/run-pass/hygienic-labels.rs
src/test/run-pass/if-bot.rs
src/test/run-pass/if-check.rs
src/test/run-pass/if-let.rs
src/test/run-pass/inherent-trait-method-order.rs
src/test/run-pass/issue-10392.rs
src/test/run-pass/issue-10734.rs
src/test/run-pass/issue-11552.rs
src/test/run-pass/issue-11709.rs
src/test/run-pass/issue-13259-windows-tcb-trash.rs
src/test/run-pass/issue-14865.rs
src/test/run-pass/issue-1516.rs
src/test/run-pass/issue-2311-2.rs
src/test/run-pass/issue-2312.rs
src/test/run-pass/issue-2611-3.rs
src/test/run-pass/issue-2718.rs
src/test/run-pass/issue-2904.rs
src/test/run-pass/issue-3895.rs
src/test/run-pass/issue-4016.rs
src/test/run-pass/issue-4241.rs
src/test/run-pass/issue-5521.rs
src/test/run-pass/issue-6128.rs
src/test/run-pass/issue-6449.rs
src/test/run-pass/issue-8351-1.rs
src/test/run-pass/issue-8351-2.rs
src/test/run-pass/last-use-in-block.rs
src/test/run-pass/logging-enabled-debug.rs
src/test/run-pass/logging-enabled.rs
src/test/run-pass/logging-right-crate.rs
src/test/run-pass/loop-no-reinit-needed-post-bot.rs
src/test/run-pass/macro-interpolation.rs
src/test/run-pass/match-bot-2.rs
src/test/run-pass/match-bot.rs
src/test/run-pass/match-enum-struct-0.rs
src/test/run-pass/match-enum-struct-1.rs
src/test/run-pass/match-pattern-lit.rs
src/test/run-pass/match-pipe-binding.rs
src/test/run-pass/match-range.rs
src/test/run-pass/match-ref-binding-in-guard-3256.rs
src/test/run-pass/match-str.rs
src/test/run-pass/match-struct-0.rs
src/test/run-pass/negative.rs
src/test/run-pass/nested-block-comment.rs
src/test/run-pass/nested-class.rs
src/test/run-pass/nested-matchs.rs
src/test/run-pass/nested-pattern.rs
src/test/run-pass/no-landing-pads.rs
src/test/run-pass/nullable-pointer-iotareduction.rs
src/test/run-pass/option-unwrap.rs
src/test/run-pass/overload-index-operator.rs
src/test/run-pass/overloaded-autoderef.rs
src/test/run-pass/overloaded-deref.rs
src/test/run-pass/parse-fail.rs
src/test/run-pass/process-detach.rs
src/test/run-pass/regions-bot.rs
src/test/run-pass/regions-dependent-addr-of.rs
src/test/run-pass/regions-early-bound-trait-param.rs
src/test/run-pass/regions-return-interior-of-option.rs
src/test/run-pass/ret-bang.rs
src/test/run-pass/return-from-closure.rs
src/test/run-pass/running-with-no-runtime.rs
src/test/run-pass/sepcomp-unwind.rs
src/test/run-pass/signal-exit-status.rs
src/test/run-pass/size-and-align.rs
src/test/run-pass/slice-fail-2.rs
src/test/run-pass/syntax-extension-cfg.rs
src/test/run-pass/task-stderr.rs
src/test/run-pass/tcp-accept-stress.rs
src/test/run-pass/tcp-connect-timeouts.rs
src/test/run-pass/tcp-stress.rs
src/test/run-pass/tempfile.rs
src/test/run-pass/terminate-in-initializer.rs
src/test/run-pass/test-runner-hides-main.rs
src/test/run-pass/trans-tag-static-padding.rs
src/test/run-pass/typeck-macro-interaction-issue-8852.rs
src/test/run-pass/unique-containing-tag.rs
src/test/run-pass/unique-decl.rs
src/test/run-pass/unique-pat.rs
src/test/run-pass/unit-like-struct-drop-run.rs
src/test/run-pass/unix-process-spawn-errno.rs
src/test/run-pass/unreachable-code-1.rs
src/test/run-pass/unreachable-code.rs
src/test/run-pass/unwind-resource.rs
src/test/run-pass/unwind-unique.rs
src/test/run-pass/use-uninit-match2.rs
src/test/run-pass/vec-matching-autoslice.rs
src/test/run-pass/vec-matching.rs
src/test/run-pass/vector-sort-failure-safe.rs
src/test/run-pass/weird-exprs.rs
src/test/run-pass/while-label.rs
src/test/run-pass/writealias.rs

index 018d77b67cdd6b8d95bfc608ace968a2b7455590..caf1c8c314dbb1186722eddb92d0a12d5f91b811 100644 (file)
@@ -41,7 +41,7 @@ pub fn main() {
     let config = parse_config(args);
 
     if config.valgrind_path.is_none() && config.force_valgrind {
-        fail!("Can't find Valgrind to run Valgrind tests");
+        panic!("Can't find Valgrind to run Valgrind tests");
     }
 
     log_config(&config);
@@ -94,20 +94,20 @@ pub fn parse_config(args: Vec<String> ) -> Config {
         let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
         println!("{}", getopts::usage(message.as_slice(), groups.as_slice()));
         println!("");
-        fail!()
+        panic!()
     }
 
     let matches =
         &match getopts::getopts(args_.as_slice(), groups.as_slice()) {
           Ok(m) => m,
-          Err(f) => fail!("{}", f)
+          Err(f) => panic!("{}", f)
         };
 
     if matches.opt_present("h") || matches.opt_present("help") {
         let message = format!("Usage: {} [OPTIONS]  [TESTNAME...]", argv0);
         println!("{}", getopts::usage(message.as_slice(), groups.as_slice()));
         println!("");
-        fail!()
+        panic!()
     }
 
     fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
@@ -120,7 +120,7 @@ fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
             Ok(re) => Some(re),
             Err(e) => {
                 println!("failed to parse filter /{}/: {}", s, e);
-                fail!()
+                panic!()
             }
         }
     } else {
@@ -263,7 +263,7 @@ pub fn run_tests(config: &Config) {
     let res = test::run_tests_console(&opts, tests.into_iter().collect());
     match res {
         Ok(true) => {}
-        Ok(false) => fail!("Some tests failed"),
+        Ok(false) => panic!("Some tests failed"),
         Err(e) => {
             println!("I/O failure during tests: {}", e);
         }
index a9c984d8061df8f6d97feee053cfd47eeb3f3cee..b7b94ca6d0df5673dabdb43dd06eb646bb8336cc 100644 (file)
@@ -305,7 +305,7 @@ fn parse_exec_env(line: &str) -> Option<(String, String)> {
               let end = strs.pop().unwrap();
               (strs.pop().unwrap(), end)
           }
-          n => fail!("Expected 1 or 2 strings, not {}", n)
+          n => panic!("Expected 1 or 2 strings, not {}", n)
         }
     })
 }
@@ -350,7 +350,7 @@ pub fn gdb_version_to_int(version_string: &str) -> int {
     let components: Vec<&str> = version_string.trim().split('.').collect();
 
     if components.len() != 2 {
-        fail!("{}", error_string);
+        panic!("{}", error_string);
     }
 
     let major: int = FromStr::from_str(components[0]).expect(error_string);
index 34129dedbd8271c3a1c6d13294ef2bcd00f4dfe1..a9edad3add61e47babf1862a5f50101cff4abed0 100644 (file)
@@ -39,7 +39,7 @@ pub fn run(config: Config, testfile: String) {
 
         "arm-linux-androideabi" => {
             if !config.adb_device_status {
-                fail!("android device not available");
+                panic!("android device not available");
             }
         }
 
@@ -316,7 +316,7 @@ fn compare_source(expected: &str, actual: &str) {
 ------------------------------------------\n\
 \n",
                      expected, actual);
-            fail!();
+            panic!();
         }
     }
 
@@ -1453,7 +1453,7 @@ fn maybe_dump_to_stdout(config: &Config, out: &str, err: &str) {
 
 fn error(err: &str) { println!("\nerror: {}", err); }
 
-fn fatal(err: &str) -> ! { error(err); fail!(); }
+fn fatal(err: &str) -> ! { error(err); panic!(); }
 
 fn fatal_proc_rec(err: &str, proc_res: &ProcRes) -> ! {
     print!("\n\
@@ -1471,7 +1471,7 @@ fn fatal_proc_rec(err: &str, proc_res: &ProcRes) -> ! {
 \n",
              err, proc_res.status, proc_res.cmdline, proc_res.stdout,
              proc_res.stderr);
-    fail!();
+    panic!();
 }
 
 fn _arm_exec_compiled_test(config: &Config,
index 22b5600d5bfcc197e61b9d844805e194be1a0c3c..a116cc33690db101236ef9d512e12ec1c6759045 100644 (file)
@@ -31,7 +31,7 @@ pub fn get_os(triple: &str) -> &'static str {
             return os
         }
     }
-    fail!("Cannot determine OS from triple");
+    panic!("Cannot determine OS from triple");
 }
 
 #[cfg(target_os = "windows")]
index 6cdaf96d3f50e3c7dc19fce994ac23887d32e094..9a2531f094c17e5b0e2773b4fd2292278970ce5a 100644 (file)
@@ -94,9 +94,9 @@ code should need to run is a stack.
 
 `match` being exhaustive has some useful properties. First, if every
 possibility is covered by the `match`, adding further variants to the `enum`
-in the future will prompt a compilation failure, rather than runtime failure.
+in the future will prompt a compilation failure, rather than runtime panic.
 Second, it makes cost explicit. In general, only safe way to have a
-non-exhaustive match would be to fail the task if nothing is matched, though
+non-exhaustive match would be to panic the task if nothing is matched, though
 it could fall through if the type of the `match` expression is `()`. This sort
 of hidden cost and special casing is against the language's philosophy. It's
 easy to ignore certain cases by using the `_` wildcard:
index 8db7ba9424fc128beb9c1e4bdcb06f3cdf7bc15e..0a8f9b2ffaa6548f5d74485e7ed7bd992cfeb1ce 100644 (file)
@@ -65,14 +65,15 @@ Data values in the language can only be constructed through a fixed set of initi
 * There is no global inter-crate namespace; all name management occurs within a crate.
  * Using another crate binds the root of _its_ namespace into the user's namespace.
 
-## Why is failure unwinding non-recoverable within a task? Why not try to "catch exceptions"?
+## Why is panic unwinding non-recoverable within a task? Why not try to "catch exceptions"?
 
 In short, because too few guarantees could be made about the dynamic environment of the catch block, as well as invariants holding in the unwound heap, to be able to safely resume; we believe that other methods of signalling and logging errors are more appropriate, with tasks playing the role of a "hard" isolation boundary between separate heaps.
 
 Rust provides, instead, three predictable and well-defined options for handling any combination of the three main categories of "catch" logic:
 
 * Failure _logging_ is done by the integrated logging subsystem.
-* _Recovery_ after a failure is done by trapping a task failure from _outside_ the task, where other tasks are known to be unaffected.
+* _Recovery_ after a panic is done by trapping a task panic from _outside_
+  the task, where other tasks are known to be unaffected.
 * _Cleanup_ of resources is done by RAII-style objects with destructors.
 
 Cleanup through RAII-style destructors is more likely to work than in catch blocks anyways, since it will be better tested (part of the non-error control paths, so executed all the time).
index 0b0a6b7b697170ba6d21ef2addabe37997ac9120..3a87271ede7d85572c4ac36225f8678bdaf1c6c0 100644 (file)
@@ -191,7 +191,7 @@ the stack of the task which is spawned.
 
 Foreign libraries often hand off ownership of resources to the calling code.
 When this occurs, we must use Rust's destructors to provide safety and guarantee
-the release of these resources (especially in the case of failure).
+the release of these resources (especially in the case of panic).
 
 # Callbacks from C code to Rust functions
 
index ed4e924ce8a8af0728b36db7645fea7aec9c0c00..ae020037bc594ee6c2eb37156e57ac5cac3cd6a3 100644 (file)
@@ -240,7 +240,7 @@ match x {
                 // complicated stuff goes here
                 return result + val;
             },
-            _ => fail!("Didn't get good_2")
+            _ => panic!("Didn't get good_2")
         }
     }
     _ => return 0 // default value
@@ -284,7 +284,7 @@ macro_rules! biased_match (
 biased_match!((x)       ~ (Good1(g1, val)) else { return 0 };
               binds g1, val )
 biased_match!((g1.body) ~ (Good2(result) )
-                  else { fail!("Didn't get good_2") };
+                  else { panic!("Didn't get good_2") };
               binds result )
 // complicated stuff goes here
 return result + val;
@@ -397,7 +397,7 @@ macro_rules! biased_match (
 # fn f(x: T1) -> uint {
 biased_match!(
     (x)       ~ (Good1(g1, val)) else { return 0 };
-    (g1.body) ~ (Good2(result) ) else { fail!("Didn't get Good2") };
+    (g1.body) ~ (Good2(result) ) else { panic!("Didn't get Good2") };
     binds val, result )
 // complicated stuff goes here
 return result + val;
index 1d1e9171b8f500ccd577082d4bcd20891809e316..4eaca64560ca21d3b677c7d891d96f57996e2034 100644 (file)
@@ -8,10 +8,10 @@ relates to the Rust type system, and introduce the fundamental library
 abstractions for constructing concurrent programs.
 
 Tasks provide failure isolation and recovery. When a fatal error occurs in Rust
-code as a result of an explicit call to `fail!()`, an assertion failure, or
+code as a result of an explicit call to `panic!()`, an assertion failure, or
 another invalid operation, the runtime system destroys the entire task. Unlike
 in languages such as Java and C++, there is no way to `catch` an exception.
-Instead, tasks may monitor each other for failure.
+Instead, tasks may monitor each other to see if they panic.
 
 Tasks use Rust's type system to provide strong memory safety guarantees.  In
 particular, the type system guarantees that tasks cannot induce a data race
@@ -317,19 +317,19 @@ spawn(proc() {
 # }
 ```
 
-# Handling task failure
+# Handling task panics
 
-Rust has a built-in mechanism for raising exceptions. The `fail!()` macro
-(which can also be written with an error string as an argument: `fail!(
-~reason)`) and the `assert!` construct (which effectively calls `fail!()` if a
+Rust has a built-in mechanism for raising exceptions. The `panic!()` macro
+(which can also be written with an error string as an argument: `panic!(
+~reason)`) and the `assert!` construct (which effectively calls `panic!()` if a
 boolean expression is false) are both ways to raise exceptions. When a task
 raises an exception, the task unwinds its stack—running destructors and
 freeing memory along the way—and then exits. Unlike exceptions in C++,
-exceptions in Rust are unrecoverable within a single task: once a task fails,
+exceptions in Rust are unrecoverable within a single task: once a task panics,
 there is no way to "catch" the exception.
 
-While it isn't possible for a task to recover from failure, tasks may notify
-each other of failure. The simplest way of handling task failure is with the
+While it isn't possible for a task to recover from panicking, tasks may notify
+each other if they panic. The simplest way of handling a panic is with the
 `try` function, which is similar to `spawn`, but immediately blocks and waits
 for the child task to finish. `try` returns a value of type
 `Result<T, Box<Any + Send>>`. `Result` is an `enum` type with two variants:
@@ -346,7 +346,7 @@ let result: Result<int, Box<std::any::Any + Send>> = task::try(proc() {
     if some_condition() {
         calculate_result()
     } else {
-        fail!("oops!");
+        panic!("oops!");
     }
 });
 assert!(result.is_err());
@@ -355,18 +355,18 @@ assert!(result.is_err());
 Unlike `spawn`, the function spawned using `try` may return a value, which
 `try` will dutifully propagate back to the caller in a [`Result`] enum. If the
 child task terminates successfully, `try` will return an `Ok` result; if the
-child task fails, `try` will return an `Error` result.
+child task panics, `try` will return an `Error` result.
 
 [`Result`]: std/result/index.html
 
-> *Note:* A failed task does not currently produce a useful error
+> *Note:* A panicked task does not currently produce a useful error
 > value (`try` always returns `Err(())`). In the
 > future, it may be possible for tasks to intercept the value passed to
-> `fail!()`.
+> `panic!()`.
 
-But not all failures are created equal. In some cases you might need to abort
+But not all panics are created equal. In some cases you might need to abort
 the entire program (perhaps you're writing an assert which, if it trips,
 indicates an unrecoverable logic error); in other cases you might want to
-contain the failure at a certain boundary (perhaps a small piece of input from
+contain the panic at a certain boundary (perhaps a small piece of input from
 the outside world, which you happen to be processing in parallel, is malformed
 such that the processing task cannot proceed).
index 07813855d9b9bb1e95a61bd7301f84c14c3927aa..9d15f55f33f69c3b46ac4d3c2e5cc3cb5b3c6a63 100644 (file)
@@ -49,7 +49,7 @@ value. To run the tests in a crate, it must be compiled with the
 `--test` flag: `rustc myprogram.rs --test -o myprogram-tests`. Running
 the resulting executable will run all the tests in the crate. A test
 is considered successful if its function returns; if the task running
-the test fails, through a call to `fail!`, a failed `assert`, or some
+the test fails, through a call to `panic!`, a failed `assert`, or some
 other (`assert_eq`, ...) means, then the test fails.
 
 When compiling a crate with the `--test` flag `--cfg test` is also
@@ -77,7 +77,7 @@ test on windows you can write `#[cfg_attr(windows, ignore)]`.
 
 Tests that are intended to fail can be annotated with the
 `should_fail` attribute. The test will be run, and if it causes its
-task to fail then the test will be counted as successful; otherwise it
+task to panic then the test will be counted as successful; otherwise it
 will be counted as a failure. For example:
 
 ~~~test_harness
index 7756abc8020142b31f1fcd9e484b4e938de0a996..cade043a7931fa708e3c18d0cb95c671d6e88d89 100644 (file)
@@ -182,7 +182,7 @@ code:
 - implement the `Drop` for resource clean-up via a destructor, and use
   RAII (Resource Acquisition Is Initialization). This reduces the need
   for any manual memory management by users, and automatically ensures
-  that clean-up is always run, even when the task fails.
+  that clean-up is always run, even when the task panics.
 - ensure that any data stored behind a raw pointer is destroyed at the
   appropriate time.
 
@@ -504,7 +504,7 @@ The second of these three functions, `eh_personality`, is used by the
 failure mechanisms of the compiler. This is often mapped to GCC's
 personality function (see the
 [libstd implementation](std/rt/unwind/index.html) for more
-information), but crates which do not trigger failure can be assured
+information), but crates which do not trigger a panic can be assured
 that this function is never called. The final function, `fail_fmt`, is
 also used by the failure mechanisms of the compiler.
 
index 87a010c799e1c811bdeefefd670a2bdc72f48b04..53ed2af9cd9aa30694f41c936e6e4c5903d2b7ee 100644 (file)
@@ -5213,17 +5213,17 @@ immediately.
 
 ## Success and failure
 
-Tasks don't always succeed, they can also fail. A task that wishes to fail
-can call the `fail!` macro, passing a message:
+Tasks don't always succeed, they can also panic. A task that wishes to panic 
+can call the `panic!` macro, passing a message:
 
 ```{rust}
 spawn(proc() {
-    fail!("Nope.");
+    panic!("Nope.");
 });
 ```
 
-If a task fails, it is not possible for it to recover. However, it can
-notify other tasks that it has failed. We can do this with `task::try`:
+If a task panics, it is not possible for it to recover. However, it can
+notify other tasks that it has panicked. We can do this with `task::try`:
 
 ```{rust}
 use std::task;
@@ -5233,14 +5233,14 @@ let result = task::try(proc() {
     if rand::random() {
         println!("OK");
     } else {
-        fail!("oops!");
+        panic!("oops!");
     }
 });
 ```
 
-This task will randomly fail or succeed. `task::try` returns a `Result`
+This task will randomly panic or succeed. `task::try` returns a `Result`
 type, so we can handle the response like any other computation that may
-fail.
+panic.
 
 # Macros
 
index 11bf895341b90619a4c36308b224e55ecbbf1cf3..d83d3cbb1ebca7af54b537690ce039166aef1306 100644 (file)
@@ -817,15 +817,15 @@ mod math {
     type Complex = (f64, f64);
     fn sin(f: f64) -> f64 {
         /* ... */
-# fail!();
+# panic!();
     }
     fn cos(f: f64) -> f64 {
         /* ... */
-# fail!();
+# panic!();
     }
     fn tan(f: f64) -> f64 {
         /* ... */
-# fail!();
+# panic!();
     }
 }
 ```
@@ -1194,12 +1194,12 @@ output slot type would normally be. For example:
 ```
 fn my_err(s: &str) -> ! {
     println!("{}", s);
-    fail!();
+    panic!();
 }
 ```
 
 We call such functions "diverging" because they never return a value to the
-caller. Every control path in a diverging function must end with a `fail!()` or
+caller. Every control path in a diverging function must end with a `panic!()` or
 a call to another diverging function on every control path. The `!` annotation
 does *not* denote a type. Rather, the result type of a diverging function is a
 special type called $\bot$ ("bottom") that unifies with any type. Rust has no
@@ -1212,7 +1212,7 @@ were declared without the `!` annotation, the following code would not
 typecheck:
 
 ```
-# fn my_err(s: &str) -> ! { fail!() }
+# fn my_err(s: &str) -> ! { panic!() }
 
 fn f(i: int) -> int {
    if i == 42 {
@@ -2259,7 +2259,7 @@ These types help drive the compiler's analysis
   : Allocate memory on the exchange heap.
 * `closure_exchange_malloc`
   : ___Needs filling in___
-* `fail_`
+* `panic`
   : Abort the program with an error.
 * `fail_bounds_check`
   : Abort the program with a bounds check error.
@@ -2866,11 +2866,11 @@ be assigned to.
 
 Indices are zero-based, and may be of any integral type. Vector access is
 bounds-checked at run-time. When the check fails, it will put the task in a
-_failing state_.
+_panicked state_.
 
 ```{should-fail}
 ([1, 2, 3, 4])[0];
-(["a", "b"])[10]; // fails
+(["a", "b"])[10]; // panics
 ```
 
 ### Unary operator expressions
@@ -3300,9 +3300,9 @@ enum List<X> { Nil, Cons(X, Box<List<X>>) }
 let x: List<int> = Cons(10, box Cons(11, box Nil));
 
 match x {
-    Cons(_, box Nil) => fail!("singleton list"),
+    Cons(_, box Nil) => panic!("singleton list"),
     Cons(..)         => return,
-    Nil              => fail!("empty list")
+    Nil              => panic!("empty list")
 }
 ```
 
@@ -3373,7 +3373,7 @@ match x {
         return;
     }
     _ => {
-        fail!();
+        panic!();
     }
 }
 ```
@@ -3395,7 +3395,7 @@ fn is_sorted(list: &List) -> bool {
         Cons(x, ref r @ box Cons(_, _)) => {
             match *r {
                 box Cons(y, _) => (x <= y) && is_sorted(&**r),
-                _ => fail!()
+                _ => panic!()
             }
         }
     }
@@ -3459,7 +3459,7 @@ may refer to the variables bound within the pattern they follow.
 let message = match maybe_digit {
   Some(x) if x < 10 => process_digit(x),
   Some(x) => process_other(x),
-  None => fail!()
+  None => panic!()
 };
 ```
 
@@ -4091,7 +4091,7 @@ cause transitions between the states. The lifecycle states of a task are:
 
 * running
 * blocked
-* failing
+* panicked 
 * dead
 
 A task begins its lifecycle &mdash; once it has been spawned &mdash; in the
@@ -4103,21 +4103,21 @@ it makes a blocking communication call. When the call can be completed &mdash;
 when a message arrives at a sender, or a buffer opens to receive a message
 &mdash; then the blocked task will unblock and transition back to *running*.
 
-A task may transition to the *failing* state at any time, due being killed by
-some external event or internally, from the evaluation of a `fail!()` macro.
-Once *failing*, a task unwinds its stack and transitions to the *dead* state.
+A task may transition to the *panicked* state at any time, due being killed by
+some external event or internally, from the evaluation of a `panic!()` macro.
+Once *panicking*, a task unwinds its stack and transitions to the *dead* state.
 Unwinding the stack of a task is done by the task itself, on its own control
 stack. If a value with a destructor is freed during unwinding, the code for the
 destructor is run, also on the task's control stack. Running the destructor
 code causes a temporary transition to a *running* state, and allows the
 destructor code to cause any subsequent state transitions. The original task
-of unwinding and failing thereby may suspend temporarily, and may involve
+of unwinding and panicking thereby may suspend temporarily, and may involve
 (recursive) unwinding of the stack of a failed destructor. Nonetheless, the
 outermost unwinding activity will continue until the stack is unwound and the
 task transitions to the *dead* state. There is no way to "recover" from task
-failure. Once a task has temporarily suspended its unwinding in the *failing*
-state, failure occurring from within this destructor results in *hard* failure.
-A hard failure currently results in the process aborting.
+panics. Once a task has temporarily suspended its unwinding in the *panicking*
+state, a panic occurring from within this destructor results in *hard* panic.
+A hard panic currently results in the process aborting.
 
 A task in the *dead* state cannot transition to other states; it exists only to
 have its termination status inspected by other tasks, and/or to await
index f5fbad960a3f5a0b0250de42ba50099af4332ea4..4b995631467b5fe3e90fbb667cad99fe72bcae3e 100644 (file)
@@ -169,7 +169,7 @@ directive.
 
 ~~~md
 ```should_fail
-// This code block is expected to generate a failure when run
+// This code block is expected to generate a panic when run
 ```
 ~~~
 
@@ -189,7 +189,7 @@ were passed to the compiler using the `test_harness` directive.
 ```test_harness
 #[test]
 fn foo() {
-    fail!("oops! (will run & register as failure)")
+    panic!("oops! (will run & register as a failed test)")
 }
 ```
 ~~~
index fef7d3510e7a3972e1faf764e9c5b0fe0aa8a661..a4345e061640db7a38cee5783f350956d2a2ab6c 100644 (file)
@@ -131,7 +131,7 @@ fn str_to_binop(s: &str) -> BinOpToken {
         "|"     => token::Or,
         "<<"    => token::Shl,
         ">>"    => token::Shr,
-        _       => fail!("Bad binop str `{}`", s),
+        _       => panic!("Bad binop str `{}`", s),
     }
 }
 
@@ -276,7 +276,7 @@ macro_rules! matches (
                                 warn!("Different names for {} and {}", rustc_tok, antlr_tok);
                             }
                         }
-                        _ => fail!("{} is not {}", antlr_tok, rustc_tok)
+                        _ => panic!("{} is not {}", antlr_tok, rustc_tok)
                     },)*
                     ref c => assert!(c == &antlr_tok.tok, "{} is not {}", rustc_tok, antlr_tok)
                 }
index cc6f2d76eaf2fa35e9796da74013b06fd5e59d07..f543826fe01878a2ff58ab70dfccb4a20523bc4b 100644 (file)
@@ -227,9 +227,9 @@ fn drop(&mut self) {
 impl<T: Sync + Send> Weak<T> {
     /// Attempts to upgrade this weak reference to a strong reference.
     ///
-    /// This method will fail to upgrade this reference if the strong reference
-    /// count has already reached 0, but if there are still other active strong
-    /// references this function will return a new strong reference to the data.
+    /// This method will not upgrade this reference if the strong reference count has already
+    /// reached 0, but if there are still other active strong references this function will return
+    /// a new strong reference to the data.
     pub fn upgrade(&self) -> Option<Arc<T>> {
         // We use a CAS loop to increment the strong count instead of a
         // fetch_add because once the count hits 0 is must never be above 0.
index 168d0daeb3845d915a2fb734c6bcca442a768fa2..09404af70273381330b2701b4b16531744f775f5 100644 (file)
@@ -148,11 +148,11 @@ fn any_move() {
 
         match a.downcast::<uint>() {
             Ok(a) => { assert!(a == box 8u); }
-            Err(..) => fail!()
+            Err(..) => panic!()
         }
         match b.downcast::<Test>() {
             Ok(a) => { assert!(a == box Test); }
-            Err(..) => fail!()
+            Err(..) => panic!()
         }
 
         let a = box 8u as Box<Any>;
index 1cd6f7f66851fad944b3724a29483b7781185713..924dd5ffed62cd300c4e5d3190ce046efbad844d 100644 (file)
@@ -69,7 +69,7 @@ unsafe fn as_ptr(&self) -> *const u8 {
 /// element). When the arena is destroyed, it iterates through all of its
 /// chunks, and uses the tydesc information to trace through the objects,
 /// calling the destructors on them. One subtle point that needs to be
-/// addressed is how to handle failures while running the user provided
+/// addressed is how to handle panics while running the user provided
 /// initializer function. It is important to not run the destructor on
 /// uninitialized objects, but how to detect them is somewhat subtle. Since
 /// `alloc()` can be invoked recursively, it is not sufficient to simply exclude
@@ -162,7 +162,7 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
 
 // We encode whether the object a tydesc describes has been
 // initialized in the arena in the low bit of the tydesc pointer. This
-// is necessary in order to properly do cleanup if a failure occurs
+// is necessary in order to properly do cleanup if a panic occurs
 // during an initializer.
 #[inline]
 fn bitpack_tydesc_ptr(p: *const TyDesc, is_done: bool) -> uint {
@@ -337,10 +337,9 @@ fn test_arena_destructors_fail() {
         // things interesting.
         arena.alloc(|| { [0u8, 1u8, 2u8] });
     }
-    // Now, fail while allocating
+    // Now, panic while allocating
     arena.alloc::<Rc<int>>(|| {
-        // Now fail.
-        fail!();
+        panic!();
     });
 }
 
index 4da362952b67c8fadec70ee436f7897644944da8..6b491096e7da47c9d74805030aba2db07d6ef004 100644 (file)
@@ -68,7 +68,7 @@ pub struct Node<K, V> {
 
 impl<K: Ord, V> Node<K, V> {
     /// Searches for the given key in the node. If it finds an exact match,
-    /// `Found` will be yielded with the matching index. If it fails to find an exact match,
+    /// `Found` will be yielded with the matching index. If it doesn't find an exact match,
     /// `GoDown` will be yielded with the index of the subtree the key must lie in.
     pub fn search(&self, key: &K) -> SearchResult {
         // FIXME(Gankro): Tune when to search linear or binary based on B (and maybe K/V).
index e751084addd77d72323b52a9c857ec20d934be15..22d487bd3a0dbf36c15204578915395b234acab0 100644 (file)
@@ -760,11 +760,11 @@ pub fn check_links<T>(list: &DList<T>) {
         loop {
             match (last_ptr, node_ptr.prev.resolve_immut()) {
                 (None   , None      ) => {}
-                (None   , _         ) => fail!("prev link for list_head"),
+                (None   , _         ) => panic!("prev link for list_head"),
                 (Some(p), Some(pptr)) => {
                     assert_eq!(p as *const Node<T>, pptr as *const Node<T>);
                 }
-                _ => fail!("prev link is none, not good"),
+                _ => panic!("prev link is none, not good"),
             }
             match node_ptr.next {
                 Some(ref next) => {
index e1806dae31dbe56b7595111a23cf6cea39a32a6e..20ad5b6334f323cf2ff39619bc4b33f4e19b6309 100644 (file)
@@ -527,8 +527,8 @@ pub fn fixme_14344_be_sure_to_link_to_collections() {}
 
 #[cfg(not(test))]
 mod std {
-    pub use core::fmt;      // necessary for fail!()
-    pub use core::option;   // necessary for fail!()
+    pub use core::fmt;      // necessary for panic!()
+    pub use core::option;   // necessary for panic!()
     pub use core::clone;    // deriving(Clone)
     pub use core::cmp;      // deriving(Eq, Ord, etc.)
     pub use hash;           // deriving(Hash)
index e32e8145d172e2087edb08907062510b275da049..5f05ab7a9069394916c31ed5f669cf59bbe323d5 100644 (file)
@@ -152,7 +152,7 @@ pub fn with_capacity(n: uint) -> RingBuf<T> {
     pub fn get_mut<'a>(&'a mut self, i: uint) -> &'a mut T {
         let idx = self.raw_index(i);
         match *self.elts.get_mut(idx) {
-            None => fail!(),
+            None => panic!(),
             Some(ref mut v) => v
         }
     }
@@ -460,7 +460,7 @@ impl<A> Index<uint, A> for RingBuf<A> {
     fn index<'a>(&'a self, i: &uint) -> &'a A {
         let idx = self.raw_index(*i);
         match self.elts[idx] {
-            None => fail!(),
+            None => panic!(),
             Some(ref v) => v,
         }
     }
index a3fcd890eb2a64f76491c02cb14b523b3eafa4e9..3f60a6d633097bf6bf7bfce73057e23825c42a42 100644 (file)
@@ -1181,7 +1181,7 @@ fn test_element_swaps() {
                 3 => assert!(v == [2, 3, 1]),
                 4 => assert!(v == [2, 1, 3]),
                 5 => assert!(v == [1, 2, 3]),
-                _ => fail!(),
+                _ => panic!(),
             }
         }
     }
@@ -1391,7 +1391,7 @@ fn test_sort() {
             }
         }
 
-        // shouldn't fail/crash
+        // shouldn't panic
         let mut v: [uint, .. 0] = [];
         v.sort();
 
@@ -1545,7 +1545,7 @@ fn test_slice_2() {
     #[should_fail]
     fn test_from_fn_fail() {
         Vec::from_fn(100, |v| {
-            if v == 50 { fail!() }
+            if v == 50 { panic!() }
             box 0i
         });
     }
@@ -1562,7 +1562,7 @@ struct S {
         impl Clone for S {
             fn clone(&self) -> S {
                 self.f.set(self.f.get() + 1);
-                if self.f.get() == 10 { fail!() }
+                if self.f.get() == 10 { panic!() }
                 S { f: self.f, boxes: self.boxes.clone() }
             }
         }
@@ -1577,7 +1577,7 @@ fn test_grow_fn_fail() {
         let mut v = vec![];
         v.grow_fn(100, |i| {
             if i == 50 {
-                fail!()
+                panic!()
             }
             (box 0i, Rc::new(0i))
         })
@@ -1591,7 +1591,7 @@ fn test_permute_fail() {
         let mut i = 0u;
         for _ in v.permutations() {
             if i == 2 {
-                fail!()
+                panic!()
             }
             i += 1;
         }
@@ -2189,7 +2189,7 @@ fn iterator(b: &mut Bencher) {
                 sum += *x;
             }
             // sum == 11806, to stop dead code elimination.
-            if sum == 0 {fail!()}
+            if sum == 0 {panic!()}
         })
     }
 
index 498f86a8bf1e41e493c9679ec9d6c42f314c1579..3b509f37c47053b85531d75a22703c6e4bb09bf2 100644 (file)
@@ -511,7 +511,7 @@ fn test_find_mut() {
         assert!(m.insert(5, 14));
         let new = 100;
         match m.find_mut(&5) {
-            None => fail!(), Some(x) => *x = new
+            None => panic!(), Some(x) => *x = new
         }
         assert_eq!(m.find(&5), Some(&new));
     }
index 9cd8bde4a95b373485bbf9333759269ed40d0108..5dd3be4ec8fd4daff1ac9d1f80b790efdf5e9553 100644 (file)
@@ -1367,7 +1367,7 @@ fn test_as_bytes_fail() {
         // original problem code path anymore.)
         let s = String::from_str("");
         let _bytes = s.as_bytes();
-        fail!();
+        panic!();
     }
 
     #[test]
@@ -1586,7 +1586,7 @@ fn test_chars_decoding() {
             let len = c.encode_utf8(bytes).unwrap_or(0);
             let s = ::core::str::from_utf8(bytes[..len]).unwrap();
             if Some(c) != s.chars().next() {
-                fail!("character {:x}={} does not decode correctly", c as u32, c);
+                panic!("character {:x}={} does not decode correctly", c as u32, c);
             }
         }
     }
@@ -1598,7 +1598,7 @@ fn test_chars_rev_decoding() {
             let len = c.encode_utf8(bytes).unwrap_or(0);
             let s = ::core::str::from_utf8(bytes[..len]).unwrap();
             if Some(c) != s.chars().rev().next() {
-                fail!("character {:x}={} does not decode correctly", c as u32, c);
+                panic!("character {:x}={} does not decode correctly", c as u32, c);
             }
         }
     }
index c44a03b05cd35d7f3f6664dc68f0d871e1757cb6..b61f26688a2ee3cb78fba64e7a5d00e675d53b0a 100644 (file)
@@ -504,7 +504,7 @@ pub fn as_bytes<'a>(&'a self) -> &'a [u8] {
     /// assert_eq!(s.as_slice(), "he");
     /// ```
     #[inline]
-    #[unstable = "the failure conventions for strings are under development"]
+    #[unstable = "the panic conventions for strings are under development"]
     pub fn truncate(&mut self, new_len: uint) {
         assert!(self.as_slice().is_char_boundary(new_len));
         self.vec.truncate(new_len)
@@ -545,10 +545,10 @@ pub fn pop(&mut self) -> Option<char> {
     /// This is a O(n) operation as it requires copying every element in the
     /// buffer.
     ///
-    /// # Failure
+    /// # Panics
     ///
     /// If `idx` does not lie on a character boundary, then this function will
-    /// fail.
+    /// panic.
     ///
     /// # Example
     ///
@@ -559,7 +559,7 @@ pub fn pop(&mut self) -> Option<char> {
     /// assert_eq!(s.remove(0), Some('o'));
     /// assert_eq!(s.remove(0), None);
     /// ```
-    #[unstable = "the failure semantics of this function and return type \
+    #[unstable = "the panic semantics of this function and return type \
                   may change"]
     pub fn remove(&mut self, idx: uint) -> Option<char> {
         let len = self.len();
@@ -582,11 +582,11 @@ pub fn remove(&mut self, idx: uint) -> Option<char> {
     /// This is a O(n) operation as it requires copying every element in the
     /// buffer.
     ///
-    /// # Failure
+    /// # Panics
     ///
     /// If `idx` does not lie on a character boundary or is out of bounds, then
-    /// this function will fail.
-    #[unstable = "the failure semantics of this function are uncertain"]
+    /// this function will panic.
+    #[unstable = "the panic semantics of this function are uncertain"]
     pub fn insert(&mut self, idx: uint, ch: char) {
         let len = self.len();
         assert!(idx <= len);
index ee01cd343c3ae52e3b66524a46b272c3a7e98427..feb4c11a061a576be42e63e9d4b4ee6441b6c0b1 100644 (file)
@@ -490,7 +490,7 @@ pub fn find_with<'a>(&'a self, f:|&K| -> Ordering) -> Option<&'a V> {
     /// let new_ua = "Safari/156.0";
     /// match t.find_with_mut(|k| "User-Agent".cmp(k)) {
     ///    Some(x) => *x = new_ua,
-    ///    None => fail!(),
+    ///    None => panic!(),
     /// }
     ///
     /// assert_eq!(t.find(&"User-Agent"), Some(&new_ua));
@@ -1616,7 +1616,7 @@ fn heir_swap<K: Ord, V>(node: &mut Box<TreeNode<K, V>>,
       }
     }
     return match node.take() {
-        Some(box TreeNode{value, ..}) => Some(value), None => fail!()
+        Some(box TreeNode{value, ..}) => Some(value), None => panic!()
     };
 }
 
@@ -1726,7 +1726,7 @@ fn test_find_mut() {
         assert!(m.insert(5, 14));
         let new = 100;
         match m.find_mut(&5) {
-          None => fail!(), Some(x) => *x = new
+          None => panic!(), Some(x) => *x = new
         }
         assert_eq!(m.find(&5), Some(&new));
     }
@@ -1739,7 +1739,7 @@ fn test_find_with_mut() {
         assert!(m.insert("t5", 14));
         let new = 100;
         match m.find_with_mut(|k| "t5".cmp(k)) {
-          None => fail!(), Some(x) => *x = new
+          None => panic!(), Some(x) => *x = new
         }
         assert_eq!(m.find_with(|k| "t5".cmp(k)), Some(&new));
     }
index 1b5c5dbc0a20bab1cc080dd369a8fabbcb4d2361..d02190e08247e0ca1c2deafd2e68e4f9d28c1102 100644 (file)
@@ -834,7 +834,7 @@ fn insert<T>(count: &mut uint, child: &mut Child<T>, key: uint, value: T,
             *child = Internal(new);
             return ret;
         }
-        _ => fail!("unreachable code"),
+        _ => panic!("unreachable code"),
     }
 }
 
@@ -844,7 +844,7 @@ fn remove<T>(count: &mut uint, child: &mut Child<T>, key: uint,
       External(stored, _) if stored == key => {
         match mem::replace(child, Nothing) {
             External(_, value) => (Some(value), true),
-            _ => fail!()
+            _ => panic!()
         }
       }
       External(..) => (None, false),
@@ -1057,7 +1057,7 @@ fn test_find_mut() {
         assert!(m.insert(5u, 14i));
         let new = 100;
         match m.find_mut(&5) {
-            None => fail!(), Some(x) => *x = new
+            None => panic!(), Some(x) => *x = new
         }
         assert_eq!(m.find(&5), Some(&new));
     }
index dd9883ecaae84b510181c3b5b283aa52501b88bb..759f9ec7d3f0361780f7edb0eb5c08f5327f5a12 100644 (file)
@@ -583,7 +583,7 @@ pub fn capacity(&self) -> uint {
     pub fn reserve_additional(&mut self, extra: uint) {
         if self.cap - self.len < extra {
             match self.len.checked_add(&extra) {
-                None => fail!("Vec::reserve_additional: `uint` overflow"),
+                None => panic!("Vec::reserve_additional: `uint` overflow"),
                 Some(new_cap) => self.reserve(new_cap)
             }
         }
@@ -699,12 +699,12 @@ pub fn into_boxed_slice(mut self) -> Box<[T]> {
     /// vec.truncate(2);
     /// assert_eq!(vec, vec![1, 2]);
     /// ```
-    #[unstable = "waiting on failure semantics"]
+    #[unstable = "waiting on panic semantics"]
     pub fn truncate(&mut self, len: uint) {
         unsafe {
             // drop any extra elements
             while len < self.len {
-                // decrement len before the read(), so a failure on Drop doesn't
+                // decrement len before the read(), so a panic on Drop doesn't
                 // re-drop the just-failed value.
                 self.len -= 1;
                 ptr::read(self.as_slice().unsafe_get(self.len));
@@ -960,9 +960,9 @@ pub fn swap_remove(&mut self, index: uint) -> Option<T> {
     /// Inserts an element at position `index` within the vector, shifting all
     /// elements after position `i` one position to the right.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// Fails if `index` is not between `0` and the vector's length (both
+    /// Panics if `index` is not between `0` and the vector's length (both
     /// bounds inclusive).
     ///
     /// # Example
@@ -974,7 +974,7 @@ pub fn swap_remove(&mut self, index: uint) -> Option<T> {
     /// vec.insert(4, 5);
     /// assert_eq!(vec, vec![1, 4, 2, 3, 5]);
     /// ```
-    #[unstable = "failure semantics need settling"]
+    #[unstable = "panic semantics need settling"]
     pub fn insert(&mut self, index: uint, element: T) {
         let len = self.len();
         assert!(index <= len);
@@ -1011,7 +1011,7 @@ pub fn insert(&mut self, index: uint, element: T) {
     /// // v is unchanged:
     /// assert_eq!(v, vec![1, 3]);
     /// ```
-    #[unstable = "failure semantics need settling"]
+    #[unstable = "panic semantics need settling"]
     pub fn remove(&mut self, index: uint) -> Option<T> {
         let len = self.len();
         if index < len {
@@ -1353,7 +1353,7 @@ pub fn contains(&self, x: &T) -> bool {
     pub fn dedup(&mut self) {
         unsafe {
             // Although we have a mutable reference to `self`, we cannot make
-            // *arbitrary* changes. The `PartialEq` comparisons could fail, so we
+            // *arbitrary* changes. The `PartialEq` comparisons could panic, so we
             // must ensure that the vector is in a valid state at all time.
             //
             // The way that we handle this is by using swaps; we iterate
@@ -1520,7 +1520,7 @@ fn push(&mut self, value: T) {
         if self.len == self.cap {
             let old_size = self.cap * mem::size_of::<T>();
             let size = max(old_size, 2 * mem::size_of::<T>()) * 2;
-            if old_size > size { fail!("capacity overflow") }
+            if old_size > size { panic!("capacity overflow") }
             unsafe {
                 self.ptr = alloc_or_realloc(self.ptr, old_size, size);
             }
@@ -1877,7 +1877,7 @@ pub fn map_in_place<U>(self, f: |T| -> U) -> Vec<U> {
                     // +-+-+-+-+-+-+-+-+-+
                     //          |         |
                     //          end_u     end_t
-                    // We must not fail here, one cell is marked as `T`
+                    // We must not panic here, one cell is marked as `T`
                     // although it is not `T`.
 
                     pv.start_t = pv.start_t.offset(1);
@@ -1888,9 +1888,9 @@ pub fn map_in_place<U>(self, f: |T| -> U) -> Vec<U> {
                     // +-+-+-+-+-+-+-+-+-+
                     //          |         |
                     //          end_u     end_t
-                    // We may fail again.
+                    // We may panic again.
 
-                    // The function given by the user might fail.
+                    // The function given by the user might panic.
                     let u = f(t);
 
                     ptr::write(pv.end_u, u);
@@ -1901,7 +1901,7 @@ pub fn map_in_place<U>(self, f: |T| -> U) -> Vec<U> {
                     // +-+-+-+-+-+-+-+-+-+
                     //          |         |
                     //          end_u     end_t
-                    // We should not fail here, because that would leak the `U`
+                    // We should not panic here, because that would leak the `U`
                     // pointed to by `end_u`.
 
                     pv.end_u = pv.end_u.offset(1);
@@ -1912,7 +1912,7 @@ pub fn map_in_place<U>(self, f: |T| -> U) -> Vec<U> {
                     // +-+-+-+-+-+-+-+-+-+
                     //            |       |
                     //            end_u   end_t
-                    // We may fail again.
+                    // We may panic again.
                 }
             }
 
@@ -1926,10 +1926,10 @@ pub fn map_in_place<U>(self, f: |T| -> U) -> Vec<U> {
             //              end_u
             // Extract `vec` and prevent the destructor of
             // `PartialVecNonZeroSized` from running. Note that none of the
-            // function calls can fail, thus no resources can be leaked (as the
+            // function calls can panic, thus no resources can be leaked (as the
             // `vec` member of `PartialVec` is the only one which holds
             // allocations -- and it is returned from this function. None of
-            // this can fail.
+            // this can panic.
             unsafe {
                 let vec_len = pv.vec.len();
                 let vec_cap = pv.vec.capacity();
@@ -1953,24 +1953,24 @@ pub fn map_in_place<U>(self, f: |T| -> U) -> Vec<U> {
             while pv.num_t != 0 {
                 unsafe {
                     // Create a `T` out of thin air and decrement `num_t`. This
-                    // must not fail between these steps, as otherwise a
+                    // must not panic between these steps, as otherwise a
                     // destructor of `T` which doesn't exist runs.
                     let t = mem::uninitialized();
                     pv.num_t -= 1;
 
-                    // The function given by the user might fail.
+                    // The function given by the user might panic.
                     let u = f(t);
 
                     // Forget the `U` and increment `num_u`. This increment
                     // cannot overflow the `uint` as we only do this for a
                     // number of times that fits into a `uint` (and start with
-                    // `0`). Again, we should not fail between these steps.
+                    // `0`). Again, we should not panic between these steps.
                     mem::forget(u);
                     pv.num_u += 1;
                 }
             }
             // Create a `Vec` from our `PartialVecZeroSized` and make sure the
-            // destructor of the latter will not run. None of this can fail.
+            // destructor of the latter will not run. None of this can panic.
             let mut result = Vec::new();
             unsafe { result.set_len(pv.num_u); }
             result
@@ -2292,7 +2292,7 @@ impl Drop for BadElem {
             fn drop(&mut self) {
                 let BadElem(ref mut x) = *self;
                 if *x == 0xbadbeef {
-                    fail!("BadElem failure: 0xbadbeef")
+                    panic!("BadElem panic: 0xbadbeef")
                 }
             }
         }
index cc6fe06665bc823cc5dc23f070eb7bc6036f4a3e..f272465e796260d268a39946575b295b9d5fd45e 100644 (file)
@@ -599,8 +599,8 @@ unsafe fn atomic_store<T>(dst: *mut T, val: T, order:Ordering) {
         Release => intrinsics::atomic_store_rel(dst, val),
         Relaxed => intrinsics::atomic_store_relaxed(dst, val),
         SeqCst  => intrinsics::atomic_store(dst, val),
-        Acquire => fail!("there is no such thing as an acquire store"),
-        AcqRel  => fail!("there is no such thing as an acquire/release store"),
+        Acquire => panic!("there is no such thing as an acquire store"),
+        AcqRel  => panic!("there is no such thing as an acquire/release store"),
     }
 }
 
@@ -610,8 +610,8 @@ unsafe fn atomic_load<T>(dst: *const T, order:Ordering) -> T {
         Acquire => intrinsics::atomic_load_acq(dst),
         Relaxed => intrinsics::atomic_load_relaxed(dst),
         SeqCst  => intrinsics::atomic_load(dst),
-        Release => fail!("there is no such thing as a release load"),
-        AcqRel  => fail!("there is no such thing as an acquire/release load"),
+        Release => panic!("there is no such thing as a release load"),
+        AcqRel  => panic!("there is no such thing as an acquire/release load"),
     }
 }
 
@@ -737,7 +737,7 @@ pub fn fence(order: Ordering) {
             Release => intrinsics::atomic_fence_rel(),
             AcqRel  => intrinsics::atomic_fence_acqrel(),
             SeqCst  => intrinsics::atomic_fence(),
-            Relaxed => fail!("there is no such thing as a relaxed fence")
+            Relaxed => panic!("there is no such thing as a relaxed fence")
         }
     }
 }
index 8a4b9f6e51b60bef2cec0cf3714d826bbc540277..9d3fa9deed7739025b8ce2c56197aebb731c105b 100644 (file)
@@ -31,7 +31,7 @@
 //! tracked statically, at compile time. Because `RefCell` borrows are
 //! dynamic it is possible to attempt to borrow a value that is
 //! already mutably borrowed; when this happens it results in task
-//! failure.
+//! panic.
 //!
 //! # When to choose interior mutability
 //!
 //!         // Recursive call to return the just-cached value.
 //!         // Note that if we had not let the previous borrow
 //!         // of the cache fall out of scope then the subsequent
-//!         // recursive borrow would cause a dynamic task failure.
+//!         // recursive borrow would cause a dynamic task panic.
 //!         // This is the major hazard of using `RefCell`.
 //!         self.minimum_spanning_tree()
 //!     }
@@ -281,7 +281,7 @@ pub fn try_borrow<'a>(&'a self) -> Option<Ref<'a, T>> {
     pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
         match self.try_borrow() {
             Some(ptr) => ptr,
-            None => fail!("RefCell<T> already mutably borrowed")
+            None => panic!("RefCell<T> already mutably borrowed")
         }
     }
 
@@ -314,7 +314,7 @@ pub fn try_borrow_mut<'a>(&'a self) -> Option<RefMut<'a, T>> {
     pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
         match self.try_borrow_mut() {
             Some(ptr) => ptr,
-            None => fail!("RefCell<T> already borrowed")
+            None => panic!("RefCell<T> already borrowed")
         }
     }
 
index f507556909c8f14f4c001ffe7533d3bf07c5d46d..5d9553cbbbd570acfa5c904f434163a967934b48 100644 (file)
@@ -120,7 +120,7 @@ pub fn is_digit_radix(c: char, radix: uint) -> bool {
 #[inline]
 pub fn to_digit(c: char, radix: uint) -> Option<uint> {
     if radix > 36 {
-        fail!("to_digit: radix is too high (maximum 36)");
+        panic!("to_digit: radix is too high (maximum 36)");
     }
     let val = match c {
       '0' ... '9' => c as uint - ('0' as uint),
@@ -147,7 +147,7 @@ pub fn to_digit(c: char, radix: uint) -> Option<uint> {
 #[inline]
 pub fn from_digit(num: uint, radix: uint) -> Option<char> {
     if radix > 36 {
-        fail!("from_digit: radix is too high (maximum 36)");
+        panic!("from_digit: radix is to high (maximum 36)");
     }
     if num < radix {
         unsafe {
diff --git a/src/libcore/failure.rs b/src/libcore/failure.rs
deleted file mode 100644 (file)
index 9b63d32..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-// 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.
-
-//! Failure support for libcore
-//!
-//! The core library cannot define failure, but it does *declare* failure. This
-//! means that the functions inside of libcore are allowed to fail, but to be
-//! useful an upstream crate must define failure for libcore to use. The current
-//! interface for failure is:
-//!
-//! ```ignore
-//! fn fail_impl(fmt: &fmt::Arguments, &(&'static str, uint)) -> !;
-//! ```
-//!
-//! This definition allows for failing with any general message, but it does not
-//! allow for failing with a `~Any` value. The reason for this is that libcore
-//! is not allowed to allocate.
-//!
-//! This module contains a few other failure functions, but these are just the
-//! necessary lang items for the compiler. All failure is funneled through this
-//! one function. Currently, the actual symbol is declared in the standard
-//! library, but the location of this may change over time.
-
-#![allow(dead_code, missing_doc)]
-
-use fmt;
-use intrinsics;
-
-#[cold] #[inline(never)] // this is the slow path, always
-#[lang="fail"]
-pub fn fail(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
-    let (expr, file, line) = *expr_file_line;
-    let ref file_line = (file, line);
-    format_args!(|args| -> () {
-        fail_fmt(args, file_line);
-    }, "{}", expr);
-
-    unsafe { intrinsics::abort() }
-}
-
-#[cold] #[inline(never)]
-#[lang="fail_bounds_check"]
-fn fail_bounds_check(file_line: &(&'static str, uint),
-                     index: uint, len: uint) -> ! {
-    format_args!(|args| -> () {
-        fail_fmt(args, file_line);
-    }, "index out of bounds: the len is {} but the index is {}", len, index);
-    unsafe { intrinsics::abort() }
-}
-
-#[cold] #[inline(never)]
-pub fn fail_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
-    #[allow(ctypes)]
-    extern {
-        #[lang = "fail_fmt"]
-        fn fail_impl(fmt: &fmt::Arguments, file: &'static str,
-                        line: uint) -> !;
-
-    }
-    let (file, line) = *file_line;
-    unsafe { fail_impl(fmt, file, line) }
-}
index 9b59b410e7cc450022c10031e83dd50859068f96..a17169f62c8be16b36c9477b06025b6e46cce42f 100644 (file)
@@ -60,7 +60,7 @@ fn finally(&mut self, dtor: ||) -> T {
 
 /**
  * The most general form of the `finally` functions. The function
- * `try_fn` will be invoked first; whether or not it fails, the
+ * `try_fn` will be invoked first; whether or not it panics, the
  * function `finally_fn` will be invoked next. The two parameters
  * `mutate` and `drop` are used to thread state through the two
  * closures. `mutate` is used for any shared, mutable state that both
@@ -69,7 +69,7 @@ fn finally(&mut self, dtor: ||) -> T {
  *
  * **WARNING:** While shared, mutable state between the try and finally
  * function is often necessary, one must be very careful; the `try`
- * function could have failed at any point, so the values of the shared
+ * function could have panicked at any point, so the values of the shared
  * state may be inconsistent.
  *
  * # Example
index 343ab7cfd28b98e7ec9733dc11a10f7dd5aa3166..79191c5a2b426183ee0cf11253e8b5f2ad101188 100644 (file)
@@ -94,7 +94,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
     assert!(2 <= radix && radix <= 36);
     match exp_format {
         ExpDec if radix >= DIGIT_E_RADIX       // decimal exponent 'e'
-          => fail!("float_to_str_bytes_common: radix {} incompatible with \
+          => panic!("float_to_str_bytes_common: radix {} incompatible with \
                     use of 'e' as decimal exponent", radix),
         _ => ()
     }
@@ -127,7 +127,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
         ExpDec => {
             let (exp, exp_base) = match exp_format {
                 ExpDec => (num.abs().log10().floor(), cast::<f64, T>(10.0f64).unwrap()),
-                ExpNone => fail!("unreachable"),
+                ExpNone => panic!("unreachable"),
             };
 
             (num / exp_base.powf(exp), cast::<T, i32>(exp).unwrap())
@@ -299,7 +299,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
             buf[end] = match exp_format {
                 ExpDec if exp_upper => 'E',
                 ExpDec if !exp_upper => 'e',
-                _ => fail!("unreachable"),
+                _ => panic!("unreachable"),
             } as u8;
             end += 1;
 
index e57c499948362576932b274fd6721d0f1c1374af..22d8ba63b20ecd3e4bbf6a56846238c18a471dc4 100644 (file)
@@ -92,7 +92,7 @@ fn prefix(&self) -> &'static str { $prefix }
             fn digit(&self, x: u8) -> u8 {
                 match x {
                     $($x => $conv,)+
-                    x => fail!("number not in the range 0..{}: {}", self.base() - 1, x),
+                    x => panic!("number not in the range 0..{}: {}", self.base() - 1, x),
                 }
             }
         }
@@ -126,7 +126,7 @@ fn digit(&self, x: u8) -> u8 {
         match x {
             x @  0 ... 9 => b'0' + x,
             x if x < self.base() => b'a' + (x - 10),
-            x => fail!("number not in the range 0..{}: {}", self.base() - 1, x),
+            x => panic!("number not in the range 0..{}: {}", self.base() - 1, x),
         }
     }
 }
index 62a4fbd2e08cdc5a3c1e287b94d0d601bfd19e83..6370e55332efb75faa848fb2a4e68f78f6059a8b 100644 (file)
@@ -40,8 +40,8 @@
 //!
 //! * `rust_begin_unwind` - This function takes three arguments, a
 //!   `&fmt::Arguments`, a `&str`, and a `uint`. These three arguments dictate
-//!   the failure message, the file at which failure was invoked, and the line.
-//!   It is up to consumers of this core library to define this failure
+//!   the panic message, the file at which panic was invoked, and the line.
+//!   It is up to consumers of this core library to define this panic
 //!   function; it is only required to never return.
 
 // Since libcore defines many fundamental lang items, all tests live in a
 pub mod bool;
 pub mod cell;
 pub mod char;
-pub mod failure;
+pub mod panicking;
 pub mod finally;
 pub mod iter;
 pub mod option;
 
 #[doc(hidden)]
 mod core {
-    pub use failure;
+    pub use panicking;
 }
 
 #[doc(hidden)]
index 17fcf0254575df3f81824492ee6327d7b6f035a8..9ba67bb2e47dca2d283c17bbfd1f97a44f86873c 100644 (file)
 
 #![macro_escape]
 
-/// Entry point of failure, for details, see std::macros
+/// Entry point of task panic, for details, see std::macros
 #[macro_export]
-macro_rules! fail(
+macro_rules! panic(
     () => (
-        fail!("{}", "explicit failure")
+        panic!("{}", "explicit panic")
     );
     ($msg:expr) => ({
         static _MSG_FILE_LINE: (&'static str, &'static str, uint) = ($msg, file!(), line!());
-        ::core::failure::fail(&_MSG_FILE_LINE)
+        ::core::panicking::panic(&_MSG_FILE_LINE)
     });
     ($fmt:expr, $($arg:tt)*) => ({
         // a closure can't have return type !, so we need a full
@@ -31,7 +31,7 @@ macro_rules! fail(
         // as returning !. We really do want this to be inlined, however,
         // because it's just a tiny wrapper. Small wins (156K to 149K in size)
         // were seen when forcing this to be inlined, and that number just goes
-        // up with the number of calls to fail!()
+        // up with the number of calls to panic!()
         //
         // The leading _'s are to avoid dead code warnings if this is
         // used inside a dead function. Just `#[allow(dead_code)]` is
@@ -40,7 +40,7 @@ macro_rules! fail(
         #[inline(always)]
         fn _run_fmt(fmt: &::std::fmt::Arguments) -> ! {
             static _FILE_LINE: (&'static str, uint) = (file!(), line!());
-            ::core::failure::fail_fmt(fmt, &_FILE_LINE)
+            ::core::panicking::panic_fmt(fmt, &_FILE_LINE)
         }
         format_args!(_run_fmt, $fmt, $($arg)*)
     });
@@ -51,12 +51,12 @@ fn _run_fmt(fmt: &::std::fmt::Arguments) -> ! {
 macro_rules! assert(
     ($cond:expr) => (
         if !$cond {
-            fail!(concat!("assertion failed: ", stringify!($cond)))
+            panic!(concat!("assertion failed: ", stringify!($cond)))
         }
     );
     ($cond:expr, $($arg:tt)*) => (
         if !$cond {
-            fail!($($arg)*)
+            panic!($($arg)*)
         }
     );
 )
@@ -78,7 +78,7 @@ macro_rules! assert_eq(
         let c1 = $cond1;
         let c2 = $cond2;
         if c1 != c2 || c2 != c1 {
-            fail!("expressions not equal, left: {}, right: {}", c1, c2);
+            panic!("expressions not equal, left: {}, right: {}", c1, c2);
         }
     })
 )
@@ -130,4 +130,4 @@ macro_rules! write(
 )
 
 #[macro_export]
-macro_rules! unreachable( () => (fail!("unreachable code")) )
+macro_rules! unreachable( () => (panic!("unreachable code")) )
index 3dceb42e206532681616b253a62fd5f4b7421322..525d588d70f1dfab3929f6fff3e04bce3f65a5d6 100644 (file)
@@ -1349,7 +1349,7 @@ pub trait CheckedMul: Mul<Self, Self> {
 checked_impl!(CheckedMul, checked_mul, i32, intrinsics::i32_mul_with_overflow)
 checked_impl!(CheckedMul, checked_mul, i64, intrinsics::i64_mul_with_overflow)
 
-/// Performs division that returns `None` instead of failing on division by zero and instead of
+/// Performs division that returns `None` instead of panicking on division by zero and instead of
 /// wrapping around on underflow and overflow.
 pub trait CheckedDiv: Div<Self, Self> {
     /// Divides two numbers, checking for underflow, overflow and division by zero. If any of that
index dd55c92097e940b2b1fcebd49ea25962d12e7194..522eb8336376e28327c3448dc38167665bb4145a 100644 (file)
@@ -291,9 +291,9 @@ pub fn as_mut_slice<'r>(&'r mut self) -> &'r mut [T] {
 
     /// Unwraps an option, yielding the content of a `Some`
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// Fails if the value is a `None` with a custom failure message provided by
+    /// Fails if the value is a `None` with a custom panic message provided by
     /// `msg`.
     ///
     /// # Example
@@ -312,19 +312,19 @@ pub fn as_mut_slice<'r>(&'r mut self) -> &'r mut [T] {
     pub fn expect(self, msg: &str) -> T {
         match self {
             Some(val) => val,
-            None => fail!("{}", msg),
+            None => panic!("{}", msg),
         }
     }
 
     /// Returns the inner `T` of a `Some(T)`.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// Fails if the self value equals `None`.
+    /// Panics if the self value equals `None`.
     ///
     /// # Safety note
     ///
-    /// In general, because this function may fail, its use is discouraged.
+    /// In general, because this function may panic, its use is discouraged.
     /// Instead, prefer to use pattern matching and handle the `None`
     /// case explicitly.
     ///
@@ -344,7 +344,7 @@ pub fn expect(self, msg: &str) -> T {
     pub fn unwrap(self) -> T {
         match self {
             Some(val) => val,
-            None => fail!("called `Option::unwrap()` on a `None` value"),
+            None => panic!("called `Option::unwrap()` on a `None` value"),
         }
     }
 
diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs
new file mode 100644 (file)
index 0000000..cda21b6
--- /dev/null
@@ -0,0 +1,69 @@
+// 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.
+
+//! Panic support for libcore
+//!
+//! The core library cannot define panicking, but it does *declare* panicking. This
+//! means that the functions inside of libcore are allowed to panic, but to be
+//! useful an upstream crate must define panicking for libcore to use. The current
+//! interface for panicking is:
+//!
+//! ```ignore
+//! fn panic_impl(fmt: &fmt::Arguments, &(&'static str, uint)) -> !;
+//! ```
+//!
+//! This definition allows for panicking with any general message, but it does not
+//! allow for failing with a `Box<Any>` value. The reason for this is that libcore
+//! is not allowed to allocate.
+//!
+//! This module contains a few other panicking functions, but these are just the
+//! necessary lang items for the compiler. All panics are funneled through this
+//! one function. Currently, the actual symbol is declared in the standard
+//! library, but the location of this may change over time.
+
+#![allow(dead_code, missing_doc)]
+
+use fmt;
+use intrinsics;
+
+#[cold] #[inline(never)] // this is the slow path, always
+#[lang="panic"]
+pub fn panic(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
+    let (expr, file, line) = *expr_file_line;
+    let ref file_line = (file, line);
+    format_args!(|args| -> () {
+        panic_fmt(args, file_line);
+    }, "{}", expr);
+
+    unsafe { intrinsics::abort() }
+}
+
+#[cold] #[inline(never)]
+#[lang="panic_bounds_check"]
+fn panic_bounds_check(file_line: &(&'static str, uint),
+                     index: uint, len: uint) -> ! {
+    format_args!(|args| -> () {
+        panic_fmt(args, file_line);
+    }, "index out of bounds: the len is {} but the index is {}", len, index);
+    unsafe { intrinsics::abort() }
+}
+
+#[cold] #[inline(never)]
+pub fn panic_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
+    #[allow(ctypes)]
+    extern {
+        #[lang = "panic_fmt"]
+        fn panic_impl(fmt: &fmt::Arguments, file: &'static str,
+                        line: uint) -> !;
+
+    }
+    let (file, line) = *file_line;
+    unsafe { panic_impl(fmt, file, line) }
+}
index f0cd8402b1424384c46102d37041d8251a65d206..5e2f5529e8d4971d80b149fb0ea65e97ba7a5405 100644 (file)
@@ -76,7 +76,7 @@
 //!     unsafe {
 //!         let my_num: *mut int = libc::malloc(mem::size_of::<int>() as libc::size_t) as *mut int;
 //!         if my_num.is_null() {
-//!             fail!("failed to allocate memory");
+//!             panic!("failed to allocate memory");
 //!         }
 //!         libc::free(my_num as *mut libc::c_void);
 //!     }
index 27bb649d1d99bfaa5c43a89675ea1c002d7307cc..82da972f68a3568ca0785ea664b105a3073e22be 100644 (file)
 //! warning (by default, controlled by the `unused_must_use` lint).
 //!
 //! You might instead, if you don't want to handle the error, simply
-//! fail, by converting to an `Option` with `ok`, then asserting
-//! success with `expect`. This will fail if the write fails, proving
+//! panic, by converting to an `Option` with `ok`, then asserting
+//! success with `expect`. This will panic if the write fails, proving
 //! a marginally useful message indicating why:
 //!
 //! ```{.no_run}
 //! let mut t = Timer::new().ok().expect("failed to create timer!");
 //! ```
 //!
-//! # `Result` vs. `fail!`
+//! # `Result` vs. `panic!`
 //!
-//! `Result` is for recoverable errors; `fail!` is for unrecoverable
-//! errors. Callers should always be able to avoid failure if they
+//! `Result` is for recoverable errors; `panic!` is for unrecoverable
+//! errors. Callers should always be able to avoid panics if they
 //! take the proper precautions, for example, calling `is_some()`
 //! on an `Option` type before calling `unwrap`.
 //!
-//! The suitability of `fail!` as an error handling mechanism is
+//! The suitability of `panic!` as an error handling mechanism is
 //! limited by Rust's lack of any way to "catch" and resume execution
-//! from a thrown exception. Therefore using failure for error
-//! handling requires encapsulating fallible code in a task. Calling
-//! the `fail!` macro, or invoking `fail!` indirectly should be
-//! avoided as an error reporting strategy. Failure is only for
-//! unrecoverable errors and a failing task is typically the sign of
+//! from a thrown exception. Therefore using panics for error
+//! handling requires encapsulating code that may panic in a task.
+//! Calling the `panic!` macro, or invoking `panic!` indirectly should be
+//! avoided as an error reporting strategy. Panics is only for
+//! unrecoverable errors and a panicking task is typically the sign of
 //! a bug.
 //!
 //! A module that instead returns `Results` is alerting the caller
-//! that failure is possible, and providing precise control over how
+//! that panics are possible, and providing precise control over how
 //! it is handled.
 //!
-//! Furthermore, failure may not be recoverable at all, depending on
-//! the context. The caller of `fail!` should assume that execution
-//! will not resume after failure, that failure is catastrophic.
+//! Furthermore, panics may not be recoverable at all, depending on
+//! the context. The caller of `panic!` should assume that execution
+//! will not resume after the panic, that a panic is catastrophic.
 
 #![stable]
 
@@ -764,9 +764,9 @@ pub fn unwrap_or_else(self, op: |E| -> T) -> T {
 impl<T, E: Show> Result<T, E> {
     /// Unwraps a result, yielding the content of an `Ok`.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// Fails if the value is an `Err`, with a custom failure message provided
+    /// Panics if the value is an `Err`, with a custom panic message provided
     /// by the `Err`'s value.
     ///
     /// # Example
@@ -778,7 +778,7 @@ impl<T, E: Show> Result<T, E> {
     ///
     /// ```{.should_fail}
     /// let x: Result<uint, &str> = Err("emergency failure");
-    /// x.unwrap(); // fails with `emergency failure`
+    /// x.unwrap(); // panics with `emergency failure`
     /// ```
     #[inline]
     #[unstable = "waiting for conventions"]
@@ -786,7 +786,7 @@ pub fn unwrap(self) -> T {
         match self {
             Ok(t) => t,
             Err(e) =>
-                fail!("called `Result::unwrap()` on an `Err` value: {}", e)
+                panic!("called `Result::unwrap()` on an `Err` value: {}", e)
         }
     }
 }
@@ -794,16 +794,16 @@ pub fn unwrap(self) -> T {
 impl<T: Show, E> Result<T, E> {
     /// Unwraps a result, yielding the content of an `Err`.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// Fails if the value is an `Ok`, with a custom failure message provided
+    /// Panics if the value is an `Ok`, with a custom panic message provided
     /// by the `Ok`'s value.
     ///
     /// # Example
     ///
     /// ```{.should_fail}
     /// let x: Result<uint, &str> = Ok(2u);
-    /// x.unwrap_err(); // fails with `2`
+    /// x.unwrap_err(); // panics with `2`
     /// ```
     ///
     /// ```
@@ -815,7 +815,7 @@ impl<T: Show, E> Result<T, E> {
     pub fn unwrap_err(self) -> E {
         match self {
             Ok(t) =>
-                fail!("called `Result::unwrap_err()` on an `Ok` value: {}", t),
+                panic!("called `Result::unwrap_err()` on an `Ok` value: {}", t),
             Err(e) => e
         }
     }
index 0c2415753faf0b681254ed6e95636b1d1f947a83..ff1db992844d6f3382ec1e7389e03dd0802db6cb 100644 (file)
@@ -1460,7 +1460,7 @@ pub trait StrSlice for Sized? {
     ///
     /// assert_eq!(s.slice(1, 9), "öwe 老");
     ///
-    /// // these will fail:
+    /// // these will panic:
     /// // byte 2 lies within `ö`:
     /// // s.slice(2, 3);
     ///
@@ -1832,7 +1832,7 @@ pub trait StrSlice for Sized? {
 #[inline(never)]
 fn slice_error_fail(s: &str, begin: uint, end: uint) -> ! {
     assert!(begin <= end);
-    fail!("index {} and/or {} in `{}` do not lie on character boundary",
+    panic!("index {} and/or {} in `{}` do not lie on character boundary",
           begin, end, s);
 }
 
@@ -1986,8 +1986,8 @@ fn slice_chars(&self, begin: uint, end: uint) -> &str {
         if end_byte.is_none() && count == end { end_byte = Some(self.len()) }
 
         match (begin_byte, end_byte) {
-            (None, _) => fail!("slice_chars: `begin` is beyond end of string"),
-            (_, None) => fail!("slice_chars: `end` is beyond end of string"),
+            (None, _) => panic!("slice_chars: `begin` is beyond end of string"),
+            (_, None) => panic!("slice_chars: `end` is beyond end of string"),
             (Some(a), Some(b)) => unsafe { raw::slice_bytes(self, a, b) }
         }
     }
index 9656a6caba08c845d5037d32138609e8a7b16eb7..7c832e90ed96bac6bcf18e6aaa92ecbdcd577134 100644 (file)
@@ -56,12 +56,12 @@ fn any_downcast_ref() {
 
     match a.downcast_ref::<uint>() {
         Some(&5) => {}
-        x => fail!("Unexpected value {}", x)
+        x => panic!("Unexpected value {}", x)
     }
 
     match a.downcast_ref::<Test>() {
         None => {}
-        x => fail!("Unexpected value {}", x)
+        x => panic!("Unexpected value {}", x)
     }
 }
 
@@ -79,7 +79,7 @@ fn any_downcast_mut() {
             assert_eq!(*x, 5u);
             *x = 612;
         }
-        x => fail!("Unexpected value {}", x)
+        x => panic!("Unexpected value {}", x)
     }
 
     match b_r.downcast_mut::<uint>() {
@@ -87,27 +87,27 @@ fn any_downcast_mut() {
             assert_eq!(*x, 7u);
             *x = 413;
         }
-        x => fail!("Unexpected value {}", x)
+        x => panic!("Unexpected value {}", x)
     }
 
     match a_r.downcast_mut::<Test>() {
         None => (),
-        x => fail!("Unexpected value {}", x)
+        x => panic!("Unexpected value {}", x)
     }
 
     match b_r.downcast_mut::<Test>() {
         None => (),
-        x => fail!("Unexpected value {}", x)
+        x => panic!("Unexpected value {}", x)
     }
 
     match a_r.downcast_mut::<uint>() {
         Some(&612) => {}
-        x => fail!("Unexpected value {}", x)
+        x => panic!("Unexpected value {}", x)
     }
 
     match b_r.downcast_mut::<uint>() {
         Some(&413) => {}
-        x => fail!("Unexpected value {}", x)
+        x => panic!("Unexpected value {}", x)
     }
 }
 
index 5da004086d27f84dfe97922cba49f27c9911d976..032f5f7194117e8d8596075b1b8c18c4382a2d75 100644 (file)
@@ -35,7 +35,7 @@ fn test_fail() {
         &mut i, (),
         |i, ()| {
             *i = 10;
-            fail!();
+            panic!();
         },
         |i| {
             assert!(failing());
index 476a2b50fcc8130b5f746391440a0c4a9fb4ccd7..98db377b0d576aa46cc18b56ca7d9714f0620070 100644 (file)
@@ -373,7 +373,7 @@ fn test_all() {
     assert!(v.iter().all(|&x| x < 10));
     assert!(!v.iter().all(|&x| x % 2 == 0));
     assert!(!v.iter().all(|&x| x > 100));
-    assert!(v.slice_or_fail(&0, &0).iter().all(|_| fail!()));
+    assert!(v.slice_or_fail(&0, &0).iter().all(|_| panic!()));
 }
 
 #[test]
@@ -382,7 +382,7 @@ fn test_any() {
     assert!(v.iter().any(|&x| x < 10));
     assert!(v.iter().any(|&x| x % 2 == 0));
     assert!(!v.iter().any(|&x| x > 100));
-    assert!(!v.slice_or_fail(&0, &0).iter().any(|_| fail!()));
+    assert!(!v.slice_or_fail(&0, &0).iter().any(|_| panic!()));
 }
 
 #[test]
@@ -528,13 +528,13 @@ fn test_rposition() {
 
 #[test]
 #[should_fail]
-fn test_rposition_fail() {
+fn test_rposition_panic() {
     let v = [(box 0i, box 0i), (box 0i, box 0i),
              (box 0i, box 0i), (box 0i, box 0i)];
     let mut i = 0i;
     v.iter().rposition(|_elt| {
         if i == 2 {
-            fail!()
+            panic!()
         }
         i += 1;
         false
@@ -678,12 +678,12 @@ fn test_random_access_cycle() {
 fn test_double_ended_range() {
     assert!(range(11i, 14).rev().collect::<Vec<int>>() == vec![13i, 12, 11]);
     for _ in range(10i, 0).rev() {
-        fail!("unreachable");
+        panic!("unreachable");
     }
 
     assert!(range(11u, 14).rev().collect::<Vec<uint>>() == vec![13u, 12, 11]);
     for _ in range(10u, 0).rev() {
-        fail!("unreachable");
+        panic!("unreachable");
     }
 }
 
index 71e9270fe4b0cba6df22453a51f7f3533e51477e..18444fc424082d4d56e4a44dd109b089b0b3733c 100644 (file)
@@ -139,14 +139,14 @@ fn test_unwrap() {
 
 #[test]
 #[should_fail]
-fn test_unwrap_fail1() {
+fn test_unwrap_panic1() {
     let x: Option<int> = None;
     x.unwrap();
 }
 
 #[test]
 #[should_fail]
-fn test_unwrap_fail2() {
+fn test_unwrap_panic2() {
     let x: Option<String> = None;
     x.unwrap();
 }
@@ -233,7 +233,7 @@ fn test_collect() {
     assert!(v == None);
 
     // test that it does not take more elements than it needs
-    let mut functions = [|| Some(()), || None, || fail!()];
+    let mut functions = [|| Some(()), || None, || panic!()];
 
     let v: Option<Vec<()>> = functions.iter_mut().map(|f| (*f)()).collect();
 
index 1cb72bd9eac78b3cca4d5def36e2602a4fe928e8..92124e2f299cd9c730ac793a6e468ca3ef2e8311 100644 (file)
@@ -81,7 +81,7 @@ fn test_collect() {
     assert!(v == Err(2));
 
     // test that it does not take more elements than it needs
-    let mut functions = [|| Ok(()), || Err(1i), || fail!()];
+    let mut functions = [|| Ok(()), || Err(1i), || panic!()];
 
     let v: Result<Vec<()>, int> = functions.iter_mut().map(|f| (*f)()).collect();
     assert!(v == Err(1));
@@ -113,7 +113,7 @@ fn handler(msg: &'static str) -> int {
         if msg == "I got this." {
             50i
         } else {
-            fail!("BadBad")
+            panic!("BadBad")
         }
     }
 
@@ -126,12 +126,12 @@ fn handler(msg: &'static str) -> int {
 
 #[test]
 #[should_fail]
-pub fn test_unwrap_or_else_failure() {
+pub fn test_unwrap_or_else_panic() {
     fn handler(msg: &'static str) -> int {
         if msg == "I got this." {
             50i
         } else {
-            fail!("BadBad")
+            panic!("BadBad")
         }
     }
 
index a73f7ddf7f7edf1a26634b508a8c9a244f2a96a6..24b7802097409cedecb09e0a0f48d5a05b5e30a5 100644 (file)
@@ -61,7 +61,7 @@
 //!     ];
 //!     let matches = match getopts(args.tail(), opts) {
 //!         Ok(m) => { m }
-//!         Err(f) => { fail!(f.to_string()) }
+//!         Err(f) => { panic!(f.to_string()) }
 //!     };
 //!     if matches.opt_present("h") {
 //!         print_usage(program.as_slice(), opts);
@@ -243,7 +243,7 @@ pub fn long_to_short(&self) -> Opt {
         } = (*self).clone();
 
         match (short_name.len(), long_name.len()) {
-            (0,0) => fail!("this long-format option was given no name"),
+            (0,0) => panic!("this long-format option was given no name"),
             (0,_) => Opt {
                 name: Long((long_name)),
                 hasarg: hasarg,
@@ -269,7 +269,7 @@ pub fn long_to_short(&self) -> Opt {
                     }
                 )
             },
-            (_,_) => fail!("something is wrong with the long-form opt")
+            (_,_) => panic!("something is wrong with the long-form opt")
         }
     }
 }
@@ -278,7 +278,7 @@ impl Matches {
     fn opt_vals(&self, nm: &str) -> Vec<Optval> {
         match find_opt(self.opts.as_slice(), Name::from_str(nm)) {
             Some(id) => self.vals[id].clone(),
-            None => fail!("No option '{}' defined", nm)
+            None => panic!("No option '{}' defined", nm)
         }
     }
 
@@ -530,8 +530,10 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 /// Parse command line arguments according to the provided options.
 ///
 /// On success returns `Ok(Matches)`. Use methods such as `opt_present`
-/// `opt_str`, etc. to interrogate results.  Returns `Err(Fail_)` on
-/// failure: use the `Show` implementation of `Fail_` to display
+/// `opt_str`, etc. to interrogate results.
+/// # Failure
+///
+/// Returns `Err(Fail_)` on failure: use the `Show` implementation of `Fail_` to display
 /// information about it.
 pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
     let opts: Vec<Opt> = optgrps.iter().map(|x| x.long_to_short()).collect();
@@ -688,7 +690,7 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String {
                 row.push_str(short_name.as_slice());
                 row.push(' ');
             }
-            _ => fail!("the short name should only be 1 ascii char long"),
+            _ => panic!("the short name should only be 1 ascii char long"),
         }
 
         // long option
@@ -852,7 +854,7 @@ enum LengthLimit {
 
             (B, Cr, UnderLim) => { B }
             (B, Cr, OverLim)  if (i - last_start + 1) > lim
-                            => fail!("word starting with {} longer than limit!",
+                            => panic!("word starting with {} longer than limit!",
                                     ss.slice(last_start, i + 1)),
             (B, Cr, OverLim)  => {
                 *cont = it(ss.slice(slice_start, last_end));
@@ -951,7 +953,7 @@ fn test_reqopt() {
             assert!(m.opt_present("t"));
             assert_eq!(m.opt_str("t").unwrap(), "20".to_string());
           }
-          _ => { fail!("test_reqopt failed (long arg)"); }
+          _ => { panic!("test_reqopt failed (long arg)"); }
         }
         let short_args = vec!("-t".to_string(), "20".to_string());
         match getopts(short_args.as_slice(), opts.as_slice()) {
@@ -961,7 +963,7 @@ fn test_reqopt() {
             assert!((m.opt_present("t")));
             assert_eq!(m.opt_str("t").unwrap(), "20".to_string());
           }
-          _ => { fail!("test_reqopt failed (short arg)"); }
+          _ => { panic!("test_reqopt failed (short arg)"); }
         }
     }
 
@@ -972,7 +974,7 @@ fn test_reqopt_missing() {
         let rs = getopts(args.as_slice(), opts.as_slice());
         match rs {
           Err(f) => check_fail_type(f, OptionMissing_),
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -983,12 +985,12 @@ fn test_reqopt_no_arg() {
         let rs = getopts(long_args.as_slice(), opts.as_slice());
         match rs {
           Err(f) => check_fail_type(f, ArgumentMissing_),
-          _ => fail!()
+          _ => panic!()
         }
         let short_args = vec!("-t".to_string());
         match getopts(short_args.as_slice(), opts.as_slice()) {
           Err(f) => check_fail_type(f, ArgumentMissing_),
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -999,7 +1001,7 @@ fn test_reqopt_multi() {
         let rs = getopts(args.as_slice(), opts.as_slice());
         match rs {
           Err(f) => check_fail_type(f, OptionDuplicated_),
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1016,7 +1018,7 @@ fn test_optopt() {
             assert!((m.opt_present("t")));
             assert_eq!(m.opt_str("t").unwrap(), "20".to_string());
           }
-          _ => fail!()
+          _ => panic!()
         }
         let short_args = vec!("-t".to_string(), "20".to_string());
         match getopts(short_args.as_slice(), opts.as_slice()) {
@@ -1026,7 +1028,7 @@ fn test_optopt() {
             assert!((m.opt_present("t")));
             assert_eq!(m.opt_str("t").unwrap(), "20".to_string());
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1040,7 +1042,7 @@ fn test_optopt_missing() {
             assert!(!m.opt_present("test"));
             assert!(!m.opt_present("t"));
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1051,12 +1053,12 @@ fn test_optopt_no_arg() {
         let rs = getopts(long_args.as_slice(), opts.as_slice());
         match rs {
           Err(f) => check_fail_type(f, ArgumentMissing_),
-          _ => fail!()
+          _ => panic!()
         }
         let short_args = vec!("-t".to_string());
         match getopts(short_args.as_slice(), opts.as_slice()) {
           Err(f) => check_fail_type(f, ArgumentMissing_),
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1067,7 +1069,7 @@ fn test_optopt_multi() {
         let rs = getopts(args.as_slice(), opts.as_slice());
         match rs {
           Err(f) => check_fail_type(f, OptionDuplicated_),
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1082,7 +1084,7 @@ fn test_optflag() {
             assert!(m.opt_present("test"));
             assert!(m.opt_present("t"));
           }
-          _ => fail!()
+          _ => panic!()
         }
         let short_args = vec!("-t".to_string());
         match getopts(short_args.as_slice(), opts.as_slice()) {
@@ -1090,7 +1092,7 @@ fn test_optflag() {
             assert!(m.opt_present("test"));
             assert!(m.opt_present("t"));
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1104,7 +1106,7 @@ fn test_optflag_missing() {
             assert!(!m.opt_present("test"));
             assert!(!m.opt_present("t"));
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1117,7 +1119,7 @@ fn test_optflag_long_arg() {
           Err(f) => {
             check_fail_type(f, UnexpectedArgument_);
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1128,7 +1130,7 @@ fn test_optflag_multi() {
         let rs = getopts(args.as_slice(), opts.as_slice());
         match rs {
           Err(f) => check_fail_type(f, OptionDuplicated_),
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1143,7 +1145,7 @@ fn test_optflag_short_arg() {
 
             assert!(m.free[0] == "20".to_string());
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1157,7 +1159,7 @@ fn test_optflagmulti_short1() {
           Ok(ref m) => {
             assert_eq!(m.opt_count("v"), 1);
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1170,7 +1172,7 @@ fn test_optflagmulti_short2a() {
           Ok(ref m) => {
             assert_eq!(m.opt_count("v"), 2);
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1183,7 +1185,7 @@ fn test_optflagmulti_short2b() {
           Ok(ref m) => {
             assert_eq!(m.opt_count("v"), 2);
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1196,7 +1198,7 @@ fn test_optflagmulti_long1() {
           Ok(ref m) => {
             assert_eq!(m.opt_count("verbose"), 1);
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1209,7 +1211,7 @@ fn test_optflagmulti_long2() {
           Ok(ref m) => {
             assert_eq!(m.opt_count("verbose"), 2);
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1224,7 +1226,7 @@ fn test_optflagmulti_mix() {
             assert_eq!(m.opt_count("verbose"), 4);
             assert_eq!(m.opt_count("v"), 4);
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1241,7 +1243,7 @@ fn test_optmulti() {
             assert!((m.opt_present("t")));
             assert_eq!(m.opt_str("t").unwrap(), "20".to_string());
           }
-          _ => fail!()
+          _ => panic!()
         }
         let short_args = vec!("-t".to_string(), "20".to_string());
         match getopts(short_args.as_slice(), opts.as_slice()) {
@@ -1251,7 +1253,7 @@ fn test_optmulti() {
             assert!((m.opt_present("t")));
             assert_eq!(m.opt_str("t").unwrap(), "20".to_string());
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1265,7 +1267,7 @@ fn test_optmulti_missing() {
             assert!(!m.opt_present("test"));
             assert!(!m.opt_present("t"));
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1276,12 +1278,12 @@ fn test_optmulti_no_arg() {
         let rs = getopts(long_args.as_slice(), opts.as_slice());
         match rs {
           Err(f) => check_fail_type(f, ArgumentMissing_),
-          _ => fail!()
+          _ => panic!()
         }
         let short_args = vec!("-t".to_string());
         match getopts(short_args.as_slice(), opts.as_slice()) {
           Err(f) => check_fail_type(f, ArgumentMissing_),
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1300,7 +1302,7 @@ fn test_optmulti_multi() {
               assert!(pair[0] == "20".to_string());
               assert!(pair[1] == "30".to_string());
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1311,12 +1313,12 @@ fn test_unrecognized_option() {
         let rs = getopts(long_args.as_slice(), opts.as_slice());
         match rs {
           Err(f) => check_fail_type(f, UnrecognizedOption_),
-          _ => fail!()
+          _ => panic!()
         }
         let short_args = vec!("-u".to_string());
         match getopts(short_args.as_slice(), opts.as_slice()) {
           Err(f) => check_fail_type(f, UnrecognizedOption_),
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1365,7 +1367,7 @@ fn test_combined() {
             assert!(pair[1] == "-60 70".to_string());
             assert!((!m.opt_present("notpresent")));
           }
-          _ => fail!()
+          _ => panic!()
         }
     }
 
@@ -1379,7 +1381,7 @@ fn test_multi() {
         let matches_single = &match getopts(args_single.as_slice(),
                                             opts.as_slice()) {
           result::Ok(m) => m,
-          result::Err(_) => fail!()
+          result::Err(_) => panic!()
         };
         assert!(matches_single.opts_present(["e".to_string()]));
         assert!(matches_single.opts_present(["encrypt".to_string(), "e".to_string()]));
@@ -1399,7 +1401,7 @@ fn test_multi() {
         let matches_both = &match getopts(args_both.as_slice(),
                                           opts.as_slice()) {
           result::Ok(m) => m,
-          result::Err(_) => fail!()
+          result::Err(_) => panic!()
         };
         assert!(matches_both.opts_present(["e".to_string()]));
         assert!(matches_both.opts_present(["encrypt".to_string()]));
@@ -1424,7 +1426,7 @@ fn test_nospace() {
                      optmulti("M", "", "something", "MMMM"));
         let matches = &match getopts(args.as_slice(), opts.as_slice()) {
           result::Ok(m) => m,
-          result::Err(_) => fail!()
+          result::Err(_) => panic!()
         };
         assert!(matches.opts_present(["L".to_string()]));
         assert_eq!(matches.opts_str(["L".to_string()]).unwrap(), "foo".to_string());
@@ -1440,7 +1442,7 @@ fn test_nospace_conflict() {
                      optflagmulti("v", "verbose", "Verbose"));
         let matches = &match getopts(args.as_slice(), opts.as_slice()) {
           result::Ok(m) => m,
-          result::Err(e) => fail!( "{}", e )
+          result::Err(e) => panic!( "{}", e )
         };
         assert!(matches.opts_present(["L".to_string()]));
         assert_eq!(matches.opts_str(["L".to_string()]).unwrap(), "verbose".to_string());
index b592ba477c2a16bfcdfafce0246306c305db35e4..b476f46833bdb04e8df531807b4f3826a228e3cf 100644 (file)
@@ -73,13 +73,13 @@ fn message(&mut self, message: Message) {
             RunRemote(i) => {
                 match self.remotes.iter_mut().find(|& &(id, _)| id == i) {
                     Some(&(_, ref mut f)) => f.call(),
-                    None => fail!("bad remote: {}", i),
+                    None => panic!("bad remote: {}", i),
                 }
             }
             RemoveRemote(i) => {
                 match self.remotes.iter().position(|&(id, _)| id == i) {
                     Some(i) => { self.remotes.remove(i).unwrap(); }
-                    None => fail!("bad remote: {}", i),
+                    None => panic!("bad remote: {}", i),
                 }
             }
         }
index a665d41aadf96531ec64a067366fb98358201547..2d3e85cc833f3460a4ebb4b5f30332ef4269dded 100644 (file)
@@ -102,14 +102,14 @@ pub fn swap(out_context: &mut Context, in_context: &Context) {
             // Right before we switch to the new context, set the new context's
             // stack limit in the OS-specified TLS slot. This also  means that
             // we cannot call any more rust functions after record_stack_bounds
-            // returns because they would all likely fail due to the limit being
+            // returns because they would all likely panic due to the limit being
             // invalid for the current task. Lucky for us `rust_swap_registers`
             // is a C function so we don't have to worry about that!
             match in_context.stack_bounds {
                 Some((lo, hi)) => stack::record_rust_managed_stack_bounds(lo, hi),
                 // If we're going back to one of the original contexts or
                 // something that's possibly not a "normal task", then reset
-                // the stack limit to 0 to make morestack never fail
+                // the stack limit to 0 to make morestack never panic
                 None => stack::record_rust_managed_stack_bounds(0, uint::MAX),
             }
             rust_swap_registers(out_regs, in_regs);
index 5435a6f74d38bc33ef54a42663b5a09e415b56e4..fcebfeac292987f4c12c24d3766a817daf0da1fa 100644 (file)
 //! drop(handle);
 //!
 //! // Required to shut down this scheduler pool.
-//! // The task will fail if `shutdown` is not called.
+//! // The task will panic if `shutdown` is not called.
 //! pool.shutdown();
 //! # }
 //! ```
@@ -511,7 +511,7 @@ fn decrement(&mut self) {
 impl Drop for SchedPool {
     fn drop(&mut self) {
         if self.threads.len() > 0 {
-            fail!("dropping a M:N scheduler pool that wasn't shut down");
+            panic!("dropping a M:N scheduler pool that wasn't shut down");
         }
     }
 }
index c465aad3e3b5be7f59cd350efbe62f26a672b25c..b1c2695ac7d276826e88774487925455a33becbb 100644 (file)
@@ -761,7 +761,7 @@ pub fn switch_running_tasks_and_then(self: Box<Scheduler>,
         // task-local lock around this block. The resumption of the task in
         // context switching will bounce on the lock, thereby waiting for this
         // block to finish, eliminating the race mentioned above.
-        // fail!("should never return!");
+        // panic!("should never return!");
         //
         // To actually maintain a handle to the lock, we use an unsafe pointer
         // to it, but we're guaranteed that the task won't exit until we've
@@ -806,7 +806,7 @@ pub fn terminate_current_task(mut self: Box<Scheduler>,
             coroutine.recycle(&mut sched.stack_pool);
             sched.task_state.decrement();
         });
-        fail!("should never return!");
+        panic!("should never return!");
     }
 
     pub fn run_task(self: Box<Scheduler>,
@@ -1054,7 +1054,7 @@ fn sched_id() -> uint {
                 task.put_runtime(green);
                 return ret;
             }
-            None => fail!()
+            None => panic!()
         }
     }
 
@@ -1202,8 +1202,8 @@ fn on_appropriate_sched() -> bool {
                     }))) => {
                         *id == sched_id
                     }
-                    TypeGreen(None) => { fail!("task without home"); }
-                    TypeSched => { fail!("expected green task"); }
+                    TypeGreen(None) => { panic!("task without home"); }
+                    TypeSched => { panic!("expected green task"); }
                 };
                 task.put();
                 ret
index 686a039d6d600758d9b348b95b1bac12e6d74892..6c33e7cc619fde8c5874783ae9e0e8b5b505f732 100644 (file)
@@ -67,23 +67,23 @@ fn reawaken(mut self: Box<SimpleTask>, mut to_wake: Box<Task>) {
         }
     }
 
-    // These functions are all unimplemented and fail as a result. This is on
+    // These functions are all unimplemented and panic as a result. This is on
     // purpose. A "simple task" is just that, a very simple task that can't
     // really do a whole lot. The only purpose of the task is to get us off our
     // feet and running.
-    fn yield_now(self: Box<SimpleTask>, _cur_task: Box<Task>) { fail!() }
-    fn maybe_yield(self: Box<SimpleTask>, _cur_task: Box<Task>) { fail!() }
+    fn yield_now(self: Box<SimpleTask>, _cur_task: Box<Task>) { panic!() }
+    fn maybe_yield(self: Box<SimpleTask>, _cur_task: Box<Task>) { panic!() }
     fn spawn_sibling(self: Box<SimpleTask>,
                      _cur_task: Box<Task>,
                      _opts: TaskOpts,
                      _f: proc():Send) {
-        fail!()
+        panic!()
     }
     fn local_io<'a>(&'a mut self) -> Option<rtio::LocalIo<'a>> { None }
-    fn stack_bounds(&self) -> (uint, uint) { fail!() }
-    fn stack_guard(&self) -> Option<uint> { fail!() }
+    fn stack_bounds(&self) -> (uint, uint) { panic!() }
+    fn stack_guard(&self) -> Option<uint> { panic!() }
     fn can_block(&self) -> bool { true }
-    fn wrap(self: Box<SimpleTask>) -> Box<Any+'static> { fail!() }
+    fn wrap(self: Box<SimpleTask>) -> Box<Any+'static> { panic!() }
 }
 
 pub fn task() -> Box<Task> {
index cccf0ec698779af0e0962f5b395e9464e36a7d5f..7d6c82cb0c325f9c64c9b6979419a9cc83e335c2 100644 (file)
@@ -24,7 +24,7 @@ pub struct Stack {
 // Try to use MAP_STACK on platforms that support it (it's what we're doing
 // anyway), but some platforms don't support it at all. For example, it appears
 // that there's a bug in freebsd that MAP_STACK implies MAP_FIXED (so it always
-// fails): http://lists.freebsd.org/pipermail/freebsd-bugs/2011-July/044840.html
+// panics): http://lists.freebsd.org/pipermail/freebsd-bugs/2011-July/044840.html
 //
 // DragonFly BSD also seems to suffer from the same problem. When MAP_STACK is
 // used, it returns the same `ptr` multiple times.
@@ -37,7 +37,7 @@ pub struct Stack {
 static STACK_FLAGS: libc::c_int = 0;
 
 impl Stack {
-    /// Allocate a new stack of `size`. If size = 0, this will fail. Use
+    /// Allocate a new stack of `size`. If size = 0, this will panic. Use
     /// `dummy_stack` if you want a zero-sized stack.
     pub fn new(size: uint) -> Stack {
         // Map in a stack. Eventually we might be able to handle stack
@@ -47,7 +47,7 @@ pub fn new(size: uint) -> Stack {
         let stack = match MemoryMap::new(size, [MapReadable, MapWritable,
                                          MapNonStandardFlags(STACK_FLAGS)]) {
             Ok(map) => map,
-            Err(e) => fail!("mmap for stack of size {} failed: {}", size, e)
+            Err(e) => panic!("mmap for stack of size {} failed: {}", size, e)
         };
 
         // Change the last page to be inaccessible. This is to provide safety;
@@ -55,7 +55,7 @@ pub fn new(size: uint) -> Stack {
         // page. It isn't guaranteed, but that's why FFI is unsafe. buf.data is
         // guaranteed to be aligned properly.
         if !protect_last_page(&stack) {
-            fail!("Could not memory-protect guard page. stack={}, errno={}",
+            panic!("Could not memory-protect guard page. stack={}, errno={}",
                   stack.data(), errno());
         }
 
index f151e00f56d567c1c2febab9f4929d31a988ed58..0c549fa66c10335752ea794950eab537384d6457 100644 (file)
@@ -443,7 +443,7 @@ fn spawn_sibling(mut self: Box<GreenTask>,
         self.put_task(cur_task);
 
         // First, set up a bomb which when it goes off will restore the local
-        // task unless its disarmed. This will allow us to gracefully fail from
+        // task unless its disarmed. This will allow us to gracefully panic from
         // inside of `configure` which allocates a new task.
         struct Bomb { inner: Option<Box<GreenTask>> }
         impl Drop for Bomb {
@@ -529,11 +529,11 @@ fn smoke() {
     }
 
     #[test]
-    fn smoke_fail() {
+    fn smoke_panic() {
         let (tx, rx) = channel::<int>();
         spawn_opts(TaskOpts::new(), proc() {
             let _tx = tx;
-            fail!()
+            panic!()
         });
         assert_eq!(rx.recv_opt(), Err(()));
     }
@@ -550,11 +550,11 @@ fn smoke_opts() {
     }
 
     #[test]
-    fn smoke_opts_fail() {
+    fn smoke_opts_panic() {
         let mut opts = TaskOpts::new();
         let (tx, rx) = channel();
         opts.on_exit = Some(proc(r) tx.send(r));
-        spawn_opts(opts, proc() { fail!() });
+        spawn_opts(opts, proc() { panic!() });
         assert!(rx.recv().is_err());
     }
 
@@ -597,7 +597,7 @@ fn spawn_inherits() {
                     Some(ops) => {
                         task.put_runtime(ops);
                     }
-                    None => fail!(),
+                    None => panic!(),
                 }
                 Local::put(task);
                 tx.send(());
index 9d5080522c26ea9bf3f27328c6740235d966f6d1..832f61d8d663d6cfaabd956e03f3a2710e8bbc61 100644 (file)
@@ -255,7 +255,7 @@ fn log(&mut self, record: &LogRecord) {
                        record.level,
                        record.module_path,
                        record.args) {
-            Err(e) => fail!("failed to log: {}", e),
+            Err(e) => panic!("failed to log: {}", e),
             Ok(()) => {}
         }
     }
@@ -263,9 +263,9 @@ fn log(&mut self, record: &LogRecord) {
 
 impl Drop for DefaultLogger {
     fn drop(&mut self) {
-        // FIXME(#12628): is failure the right thing to do?
+        // FIXME(#12628): is panicking the right thing to do?
         match self.handle.flush() {
-            Err(e) => fail!("failed to flush a logger: {}", e),
+            Err(e) => panic!("failed to flush a logger: {}", e),
             Ok(()) => {}
         }
     }
index 88f5061bbef1713f7d3c1456402b3e9e96f66aac..f616295c73d1b1aafbcf7e6b61b684ea97d6e4ef 100644 (file)
@@ -523,7 +523,7 @@ fn test_file_desc() {
                 assert_eq!(buf[2], 's' as u8);
                 assert_eq!(buf[3], 't' as u8);
             }
-            r => fail!("invalid read: {}", r)
+            r => panic!("invalid read: {}", r),
         }
 
         assert!(writer.inner_read(buf).is_err());
@@ -547,7 +547,7 @@ fn test_cfile() {
                     assert_eq!(buf[2], 's' as u8);
                     assert_eq!(buf[3], 't' as u8);
                 }
-                r => fail!("invalid read: {}", r)
+                r => panic!("invalid read: {}", r)
             }
         }
     }
index bc08ede39f7695ec80accd63bb11ea6c1a34b397..f764470f37d89051743484485c322383adb79875 100644 (file)
@@ -710,7 +710,7 @@ pub fn native_accept(&mut self) -> IoResult<UnixStream> {
         if new_handle == libc::INVALID_HANDLE_VALUE {
             let ret = Err(super::last_error());
             // If our disconnection fails, then there's not really a whole lot
-            // that we can do, so fail the task.
+            // that we can do, so panic
             let err = unsafe { libc::DisconnectNamedPipe(handle) };
             assert!(err != 0);
             return ret;
index d69042175f7ccbecd215edf3d5a58aa6f7c0c346..fed4a46b9df7fc8376e0bf6a44e0871fa337c84f 100644 (file)
@@ -600,7 +600,7 @@ unsafe fn set_cloexec(fd: c_int) {
                             handle: ptr::null_mut()
                         })
                     }
-                    Ok(..) => fail!("short read on the cloexec pipe"),
+                    Ok(..) => panic!("short read on the cloexec pipe"),
                 };
             }
             // And at this point we've reached a special time in the life of the
@@ -944,7 +944,7 @@ fn waitpid(pid: pid_t, deadline: u64) -> IoResult<rtio::ProcessExit> {
     let mut status = 0 as c_int;
     if deadline == 0 {
         return match retry(|| unsafe { c::waitpid(pid, &mut status, 0) }) {
-            -1 => fail!("unknown waitpid error: {}", super::last_error().code),
+            -1 => panic!("unknown waitpid error: {}", super::last_error().code),
             _ => Ok(translate_status(status)),
         }
     }
@@ -1069,7 +1069,7 @@ fn waitpid_helper(input: libc::c_int,
                     continue
                 }
 
-                n => fail!("error in select {} ({})", os::errno(), n),
+                n => panic!("error in select {} ({})", os::errno(), n),
             }
 
             // Process any pending messages
@@ -1149,7 +1149,7 @@ fn drain(fd: libc::c_int) -> bool {
                 n if n > 0 => { ret = true; }
                 0 => return true,
                 -1 if util::wouldblock() => return ret,
-                n => fail!("bad read {} ({})", os::last_os_error(), n),
+                n => panic!("bad read {} ({})", os::last_os_error(), n),
             }
         }
     }
@@ -1172,7 +1172,7 @@ fn drain(fd: libc::c_int) -> bool {
         } {
             1 => {}
             -1 if util::wouldblock() => {} // see above comments
-            n => fail!("bad error on write fd: {} {}", n, os::errno()),
+            n => panic!("bad error on write fd: {} {}", n, os::errno()),
         }
     }
 }
@@ -1192,7 +1192,7 @@ fn waitpid_os(pid: pid_t) -> Option<rtio::ProcessExit> {
         }) {
             n if n == pid => Some(translate_status(status)),
             0 => None,
-            n => fail!("unknown waitpid error `{}`: {}", n,
+            n => panic!("unknown waitpid error `{}`: {}", n,
                        super::last_error().code),
         }
     }
index 6f57a5e88ba14f1c337cd0a9a26417b18d31cdea..38895f2a8f96a90b56061600e70a3f6a142af893 100644 (file)
@@ -194,7 +194,7 @@ fn signal(active: &mut Vec<Box<Inner>>,
             }
 
             -1 if os::errno() == libc::EINTR as int => {}
-            n => fail!("helper thread failed in select() with error: {} ({})",
+            n => panic!("helper thread panicked in select() with error: {} ({})",
                        n, os::last_os_error())
         }
     }
@@ -227,7 +227,7 @@ pub fn sleep(ms: u64) {
         };
         while unsafe { libc::nanosleep(&to_sleep, &mut to_sleep) } != 0 {
             if os::errno() as int != libc::EINTR as int {
-                fail!("failed to sleep, but not because of EINTR?");
+                panic!("failed to sleep, but not because of EINTR?");
             }
         }
     }
index c99143f0a5d7b05d844f011ea5510c35dafb26a8..4da088cccb334e6955f9c2a2d580736fc5cef285 100644 (file)
@@ -142,7 +142,7 @@ pub fn start(argc: int, argv: *const *const u8, main: proc()) -> int {
         exit_code = Some(run(main.take().unwrap()));
     }).destroy());
     unsafe { rt::cleanup(); }
-    // If the exit code wasn't set, then the task block must have failed.
+    // If the exit code wasn't set, then the task block must have panicked.
     return exit_code.unwrap_or(rt::DEFAULT_ERROR_CODE);
 }
 
index 455656c09d493279a45975b40c99c53e6771f094..e702c12bdffe384cf2e7e5d38bc920c4334a152d 100644 (file)
@@ -297,11 +297,11 @@ fn smoke() {
     }
 
     #[test]
-    fn smoke_fail() {
+    fn smoke_panic() {
         let (tx, rx) = channel::<()>();
         spawn(proc() {
             let _tx = tx;
-            fail!()
+            panic!()
         });
         assert_eq!(rx.recv_opt(), Err(()));
     }
@@ -318,11 +318,11 @@ fn smoke_opts() {
     }
 
     #[test]
-    fn smoke_opts_fail() {
+    fn smoke_opts_panic() {
         let mut opts = TaskOpts::new();
         let (tx, rx) = channel();
         opts.on_exit = Some(proc(r) tx.send(r));
-        NativeSpawner.spawn(opts, proc() { fail!() });
+        NativeSpawner.spawn(opts, proc() { panic!() });
         assert!(rx.recv().is_err());
     }
 
@@ -365,7 +365,7 @@ fn spawn_inherits() {
                     Some(ops) => {
                         task.put_runtime(ops);
                     }
-                    None => fail!(),
+                    None => panic!(),
                 }
                 Local::put(task);
                 tx.send(());
index 89c8e90f2c38b35afb285b5b201af80b214934ca..06bd04814c00b4784069f3a5abf5a5c15e8c960d 100644 (file)
@@ -129,7 +129,7 @@ pub fn new<'a>(items: &'a mut [Weighted<T>]) -> WeightedChoice<'a, T> {
         for item in items.iter_mut() {
             running_total = match running_total.checked_add(&item.weight) {
                 Some(n) => n,
-                None => fail!("WeightedChoice::new called with a total weight \
+                None => panic!("WeightedChoice::new called with a total weight \
                                larger than a uint can contain")
             };
 
index ebaa0349f5b72a221823a8b092aecc2117224ffa..405b70492a3aa4c9a0f722ca1a03cdb05aa75d17 100644 (file)
@@ -92,7 +92,7 @@ fn next_u64(&mut self) -> u64 {
     /// not be relied upon.
     ///
     /// This method should guarantee that `dest` is entirely filled
-    /// with new data, and may fail if this is impossible
+    /// with new data, and may panic if this is impossible
     /// (e.g. reading past the end of a file that is being used as the
     /// source of randomness).
     ///
@@ -375,7 +375,7 @@ fn next_u32(&mut self) -> u32 {
 }
 
 impl SeedableRng<[u32, .. 4]> for XorShiftRng {
-    /// Reseed an XorShiftRng. This will fail if `seed` is entirely 0.
+    /// Reseed an XorShiftRng. This will panic if `seed` is entirely 0.
     fn reseed(&mut self, seed: [u32, .. 4]) {
         assert!(!seed.iter().all(|&x| x == 0),
                 "XorShiftRng.reseed called with an all zero seed.");
@@ -386,7 +386,7 @@ fn reseed(&mut self, seed: [u32, .. 4]) {
         self.w = seed[3];
     }
 
-    /// Create a new XorShiftRng. This will fail if `seed` is entirely 0.
+    /// Create a new XorShiftRng. This will panic if `seed` is entirely 0.
     fn from_seed(seed: [u32, .. 4]) -> XorShiftRng {
         assert!(!seed.iter().all(|&x| x == 0),
                 "XorShiftRng::from_seed called with an all zero seed.");
@@ -446,7 +446,7 @@ fn rand<R: Rng>(rng: &mut R) -> XorShiftRng {
 
 #[cfg(not(test))]
 mod std {
-    pub use core::{option, fmt}; // fail!()
+    pub use core::{option, fmt}; // panic!()
 }
 
 #[cfg(test)]
index 07474a9f105876b259de3128ee1fdcd59b367741..3410a8745b1f4a481dd705f0f38bc9893d59e74d 100644 (file)
@@ -244,7 +244,7 @@ pub fn get_doc<'a>(d: Doc<'a>, tg: uint) -> Doc<'a> {
             Some(d) => d,
             None => {
                 error!("failed to find block with tag {}", tg);
-                fail!();
+                panic!();
             }
         }
     }
index a32dfcf5d2a2b89121332272a8ab45c81cb3a323..53d2ea62a2ad060e4617ee87d8c22561fb539776 100644 (file)
@@ -240,13 +240,13 @@ fn empty_split(&mut self) -> InstIdx {
     /// Sets the left and right locations of a `Split` instruction at index
     /// `i` to `pc1` and `pc2`, respectively.
     /// If the instruction at index `i` isn't a `Split` instruction, then
-    /// `fail!` is called.
+    /// `panic!` is called.
     #[inline]
     fn set_split(&mut self, i: InstIdx, pc1: InstIdx, pc2: InstIdx) {
         let split = self.insts.get_mut(i);
         match *split {
             Split(_, _) => *split = Split(pc1, pc2),
-            _ => fail!("BUG: Invalid split index."),
+            _ => panic!("BUG: Invalid split index."),
         }
     }
 
@@ -260,13 +260,13 @@ fn empty_jump(&mut self) -> InstIdx {
 
     /// Sets the location of a `Jump` instruction at index `i` to `pc`.
     /// If the instruction at index `i` isn't a `Jump` instruction, then
-    /// `fail!` is called.
+    /// `panic!` is called.
     #[inline]
     fn set_jump(&mut self, i: InstIdx, pc: InstIdx) {
         let jmp = self.insts.get_mut(i);
         match *jmp {
             Jump(_) => *jmp = Jump(pc),
-            _ => fail!("BUG: Invalid jump index."),
+            _ => panic!("BUG: Invalid jump index."),
         }
     }
 }
index bb6df26dab4f5ddf4b349a860ce87f4207771388..691dd2a3a6ced434fb2f101c32b03213434241c7 100644 (file)
@@ -31,7 +31,7 @@
 //! use regex::Regex;
 //! let re = match Regex::new(r"^\d{4}-\d{2}-\d{2}$") {
 //!     Ok(re) => re,
-//!     Err(err) => fail!("{}", err),
+//!     Err(err) => panic!("{}", err),
 //! };
 //! assert_eq!(re.is_match("2014-01-01"), true);
 //! ```
index 1d1d1a0e9c5cab3668f09052cdff7d8187d392aa..e62fc3602c21609aa3a7c5167fdd73426a3d2e3c 100644 (file)
@@ -117,7 +117,7 @@ fn paren(&self) -> bool {
     fn flags(&self) -> Flags {
         match *self {
             Paren(flags, _, _) => flags,
-            _ => fail!("Cannot get flags from {}", self),
+            _ => panic!("Cannot get flags from {}", self),
         }
     }
 
@@ -125,7 +125,7 @@ fn capture(&self) -> Option<uint> {
         match *self {
             Paren(_, 0, _) => None,
             Paren(_, c, _) => Some(c),
-            _ => fail!("Cannot get capture group from {}", self),
+            _ => panic!("Cannot get capture group from {}", self),
         }
     }
 
@@ -139,7 +139,7 @@ fn capture_name(&self) -> Option<String> {
                     Some(name.clone())
                 }
             }
-            _ => fail!("Cannot get capture name from {}", self),
+            _ => panic!("Cannot get capture name from {}", self),
         }
     }
 
@@ -153,7 +153,7 @@ fn bar(&self) -> bool {
     fn unwrap(self) -> Result<Ast, Error> {
         match self {
             Expr(x) => Ok(x),
-            _ => fail!("Tried to unwrap non-AST item: {}", self),
+            _ => panic!("Tried to unwrap non-AST item: {}", self),
         }
     }
 }
@@ -321,7 +321,7 @@ fn push_repeater(&mut self, c: char) -> Result<(), Error> {
         }
         let rep: Repeater = match c {
             '?' => ZeroOne, '*' => ZeroMore, '+' => OneMore,
-            _ => fail!("Not a valid repeater operator."),
+            _ => panic!("Not a valid repeater operator."),
         };
 
         match self.peek(1) {
@@ -393,7 +393,7 @@ fn parse_class(&mut self) -> Result<(), Error> {
                             continue
                         }
                         Some(ast) =>
-                            fail!("Expected Class AST but got '{}'", ast),
+                            panic!("Expected Class AST but got '{}'", ast),
                         // Just drop down and try to add as a regular character.
                         None => {},
                     },
@@ -408,7 +408,7 @@ fn parse_class(&mut self) -> Result<(), Error> {
                             return self.err(
                                 "\\A, \\z, \\b and \\B are not valid escape \
                                  sequences inside a character class."),
-                        ast => fail!("Unexpected AST item '{}'", ast),
+                        ast => panic!("Unexpected AST item '{}'", ast),
                     }
                 }
                 _ => {},
index eebe9b85e3b9daaf070898df0ef56cf5ec990b41..d352739f853e969615e8acacfa621a11f7c67810 100644 (file)
@@ -76,7 +76,7 @@ pub fn is_match(regex: &str, text: &str) -> Result<bool, parse::Error> {
 /// # use regex::Regex;
 /// let re = match Regex::new("[0-9]{3}-[0-9]{3}-[0-9]{4}") {
 ///     Ok(re) => re,
-///     Err(err) => fail!("{}", err),
+///     Err(err) => panic!("{}", err),
 /// };
 /// assert_eq!(re.find("phone: 111-222-3333"), Some((7, 19)));
 /// ```
index be8e12b09f020e757b1348512a789ddbbd76f22d..e1c24a902fa10deb19da5f74d735c638c99ebc54 100644 (file)
@@ -15,7 +15,7 @@
 use regex::{Regex, NoExpand};
 
 fn bench_assert_match(b: &mut Bencher, re: Regex, text: &str) {
-    b.iter(|| if !re.is_match(text) { fail!("no match") });
+    b.iter(|| if !re.is_match(text) { panic!("no match") });
 }
 
 #[bench]
@@ -143,7 +143,7 @@ macro_rules! throughput(
         fn $name(b: &mut Bencher) {
             let text = gen_text($size);
             b.bytes = $size;
-            b.iter(|| if $regex.is_match(text.as_slice()) { fail!("match") });
+            b.iter(|| if $regex.is_match(text.as_slice()) { panic!("match") });
         }
     );
 )
index 96c600b0fda3a4a50f0a5dc04345b1b604d322c1..7f014b4eb68a699817393a27e1c59d158b1dc7be 100644 (file)
@@ -30,7 +30,7 @@ macro_rules! regex(
     ($re:expr) => (
         match ::regex::Regex::new($re) {
             Ok(re) => re,
-            Err(err) => fail!("{}", err),
+            Err(err) => panic!("{}", err),
         }
     );
 )
index 088425c08885533916fb2b0abb8f735b93cf2cce..f93a3d51251f9c884a20cd75b8b4aacbdaa5a0d3 100644 (file)
@@ -75,7 +75,7 @@ fn $name() {
             let re = $re;
             match Regex::new(re) {
                 Err(_) => {},
-                Ok(_) => fail!("Regex '{}' should cause a parse error.", re),
+                Ok(_) => panic!("Regex '{}' should cause a parse error.", re),
             }
         }
     );
@@ -133,7 +133,7 @@ fn $name() {
                 sgot = sgot[0..sexpect.len()]
             }
             if sexpect != sgot {
-                fail!("For RE '{}' against '{}', expected '{}' but got '{}'",
+                panic!("For RE '{}' against '{}', expected '{}' but got '{}'",
                       $re, text, sexpect, sgot);
             }
         }
index 474e8e45d94c265893097b637c6f5566e9ab9c0f..1a53db89196b8fbdb7f79376f5006faa4476ecdb 100644 (file)
@@ -85,7 +85,7 @@ struct Diagnostic {
 
 // We use an Arc instead of just returning a list of diagnostics from the
 // child task because we need to make sure that the messages are seen even
-// if the child task fails (for example, when `fatal` is called).
+// if the child task panics (for example, when `fatal` is called).
 #[deriving(Clone)]
 struct SharedEmitter {
     buffer: Arc<Mutex<Vec<Diagnostic>>>,
@@ -133,7 +133,7 @@ fn emit(&mut self, cmsp: Option<(&codemap::CodeMap, codemap::Span)>,
 
     fn custom_emit(&mut self, _cm: &codemap::CodeMap,
                    _sp: diagnostic::RenderSpan, _msg: &str, _lvl: Level) {
-        fail!("SharedEmitter doesn't support custom_emit");
+        panic!("SharedEmitter doesn't support custom_emit");
     }
 }
 
@@ -897,19 +897,19 @@ fn run_work_multithreaded(sess: &Session,
         futures.push(future);
     }
 
-    let mut failed = false;
+    let mut panicked = false;
     for future in futures.into_iter() {
         match future.unwrap() {
             Ok(()) => {},
             Err(_) => {
-                failed = true;
+                panicked = true;
             },
         }
         // Display any new diagnostics.
         diag_emitter.dump(sess.diagnostic().handler());
     }
-    if failed {
-        sess.fatal("aborting due to worker thread failure");
+    if panicked {
+        sess.fatal("aborting due to worker thread panic");
     }
 }
 
index 1f44808275f6cf961913060b9978dd79f75b87c7..43687a31453d013a4fd4dd515620e24cf6703542 100644 (file)
@@ -898,7 +898,7 @@ fn test_switch_implies_cfg_test() {
         let matches =
             &match getopts(["--test".to_string()], optgroups().as_slice()) {
               Ok(m) => m,
-              Err(f) => fail!("test_switch_implies_cfg_test: {}", f)
+              Err(f) => panic!("test_switch_implies_cfg_test: {}", f)
             };
         let registry = diagnostics::registry::Registry::new([]);
         let sessopts = build_session_options(matches);
@@ -916,7 +916,7 @@ fn test_switch_implies_cfg_test_unless_cfg_test() {
                            optgroups().as_slice()) {
               Ok(m) => m,
               Err(f) => {
-                fail!("test_switch_implies_cfg_test_unless_cfg_test: {}", f)
+                panic!("test_switch_implies_cfg_test_unless_cfg_test: {}", f)
               }
             };
         let registry = diagnostics::registry::Registry::new([]);
index 4a2e209f56282a26fc2929a6fd404612cd002175..fbdc0db166524df8a971c43f932d0b65b9be00d4 100644 (file)
@@ -269,7 +269,7 @@ fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
             println!("Compiler plugins can provide additional lints and lint groups. To see a \
                       listing of these, re-run `rustc -W help` with a crate filename.");
         }
-        (false, _, _) => fail!("didn't load lint plugins but got them anyway!"),
+        (false, _, _) => panic!("didn't load lint plugins but got them anyway!"),
         (true, 0, 0) => println!("This crate does not load any lint plugins or lint groups."),
         (true, l, g) => {
             if l > 0 {
@@ -424,7 +424,7 @@ fn parse_crate_attrs(sess: &Session, input: &Input) ->
 pub fn early_error(msg: &str) -> ! {
     let mut emitter = diagnostic::EmitterWriter::stderr(diagnostic::Auto, None);
     emitter.emit(None, msg, None, diagnostic::Fatal);
-    fail!(diagnostic::FatalError);
+    panic!(diagnostic::FatalError);
 }
 
 pub fn early_warn(msg: &str) {
@@ -466,7 +466,7 @@ pub fn monitor(f: proc():Send) {
     match task.try(f) {
         Ok(()) => { /* fallthrough */ }
         Err(value) => {
-            // Task failed without emitting a fatal diagnostic
+            // Task panicked without emitting a fatal diagnostic
             if !value.is::<diagnostic::FatalError>() {
                 let mut emitter = diagnostic::EmitterWriter::stderr(diagnostic::Auto, None);
 
@@ -475,13 +475,13 @@ pub fn monitor(f: proc():Send) {
                 if !value.is::<diagnostic::ExplicitBug>() {
                     emitter.emit(
                         None,
-                        "unexpected failure",
+                        "unexpected panic",
                         None,
                         diagnostic::Bug);
                 }
 
                 let xs = [
-                    "the compiler hit an unexpected failure path. this is a bug.".to_string(),
+                    "the compiler unexpectedly panicked. this is a bug.".to_string(),
                     format!("we would appreciate a bug report: {}",
                             BUG_REPORT_URL),
                     "run with `RUST_BACKTRACE=1` for a backtrace".to_string(),
@@ -503,11 +503,11 @@ pub fn monitor(f: proc():Send) {
                 }
             }
 
-            // Fail so the process returns a failure code, but don't pollute the
+            // Panic so the process returns a failure code, but don't pollute the
             // output with some unnecessary failure messages, we've already
             // printed everything that we needed to.
             io::stdio::set_stderr(box io::util::NullWriter);
-            fail!();
+            panic!();
         }
     }
 }
index 19cd03f10a781738859532c4e84d1bd39e861f34..0a7cfdeeadc2abb63ebd81b3755312881e3dc9be 100644 (file)
@@ -444,7 +444,7 @@ pub fn pretty_print_input(sess: Session,
             let r = io::File::create(&p);
             match r {
                 Ok(w) => box w as Box<Writer+'static>,
-                Err(e) => fail!("print-print failed to open {} due to {}",
+                Err(e) => panic!("print-print failed to open {} due to {}",
                                 p.display(), e),
             }
         }
index 99ca5770a8a2f690f2966cbd78c28fabf4b486ee..35754fc584ffd02d6bf6db31a2a04bf0127b75a8 100644 (file)
@@ -190,7 +190,7 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
                                     return;
                                 }
                             }
-                            _ => fail!()
+                            _ => panic!()
                         };
                     },
                     ty::ty_uint(t) => {
@@ -201,7 +201,7 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
                         let lit_val: u64 = match lit.node {
                             ast::LitByte(_v) => return,  // _v is u8, within range by definition
                             ast::LitInt(v, _) => v,
-                            _ => fail!()
+                            _ => panic!()
                         };
                         if  lit_val < min || lit_val > max {
                             cx.span_lint(OVERFLOWING_LITERALS, e.span,
@@ -216,7 +216,7 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
                                 Some(f) => f,
                                 None => return
                             },
-                            _ => fail!()
+                            _ => panic!()
                         };
                         if lit_val < min || lit_val > max {
                             cx.span_lint(OVERFLOWING_LITERALS, e.span,
@@ -237,7 +237,7 @@ fn is_valid<T:cmp::PartialOrd>(binop: ast::BinOp, v: T,
                 ast::BiGt => v >= min && v <  max,
                 ast::BiGe => v >  min && v <= max,
                 ast::BiEq | ast::BiNe => v >= min && v <= max,
-                _ => fail!()
+                _ => panic!()
             }
         }
 
@@ -301,7 +301,7 @@ fn check_limits(tcx: &ty::ctxt, binop: ast::BinOp,
                             ast::LitInt(v, ast::UnsuffixedIntLit(ast::Minus)) => -(v as i64),
                             _ => return true
                         },
-                        _ => fail!()
+                        _ => panic!()
                     };
                     is_valid(norm_binop, lit_val, min, max)
                 }
@@ -312,7 +312,7 @@ fn check_limits(tcx: &ty::ctxt, binop: ast::BinOp,
                             ast::LitInt(v, _) => v,
                             _ => return true
                         },
-                        _ => fail!()
+                        _ => panic!()
                     };
                     is_valid(norm_binop, lit_val, min, max)
                 }
@@ -353,7 +353,7 @@ fn check_def(&mut self, sp: Span, ty_id: ast::NodeId, path_id: ast::NodeId) {
             def::DefTy(..) => {
                 let tty = match self.cx.tcx.ast_ty_to_ty_cache.borrow().find(&ty_id) {
                     Some(&ty::atttce_resolved(t)) => t,
-                    _ => fail!("ast_ty_to_ty_cache was incomplete after typeck!")
+                    _ => panic!("ast_ty_to_ty_cache was incomplete after typeck!")
                 };
 
                 if !ty::is_ffi_safe(self.cx.tcx, tty) {
index 4cdca9e536595e62138612239dda93b0384d88f7..8e4095df45a8fa5e9457f94a7bbc0e9d70507dae 100644 (file)
@@ -166,7 +166,7 @@ pub fn register_group(&mut self, sess: Option<&Session>,
     fn register_renamed(&mut self, old_name: &str, new_name: &str) {
         let target = match self.by_name.find_equiv(&new_name) {
             Some(&Id(lint_id)) => lint_id.clone(),
-            _ => fail!("invalid lint renaming of {} to {}", old_name, new_name)
+            _ => panic!("invalid lint renaming of {} to {}", old_name, new_name)
         };
         self.by_name.insert(old_name.to_string(), Renamed(new_name.to_string(), target));
     }
@@ -388,7 +388,7 @@ pub fn raw_emit_lint(sess: &Session, lint: &'static Lint,
             format!("{} [-{} {}]", msg,
                     match level {
                         Warn => 'W', Deny => 'D', Forbid => 'F',
-                        Allow => fail!()
+                        Allow => panic!()
                     }, name.replace("_", "-"))
         },
         Node(src) => {
index e2d997a93fe0410b980c68d67c51c71a9fb0bdfe..43d0156d72770f8e080341a783936ed7334ee1c1 100644 (file)
@@ -174,7 +174,7 @@ fn extract_crate_info(e: &Env, i: &ast::ViewItem) -> Option<CrateInfo> {
 pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
     let err = |s: &str| {
         match (sp, sess) {
-            (_, None) => fail!("{}", s),
+            (_, None) => panic!("{}", s),
             (Some(sp), Some(sess)) => sess.span_err(sp, s),
             (None, Some(sess)) => sess.err(s),
         }
index fd71e4f7b1fbacfa430e10cf241e8ca46c64c495..e9e7d1de59db38bf4fe2b6acaaebf35bc535949d 100644 (file)
@@ -94,7 +94,7 @@ fn eq_item(bytes: &[u8], item_id: ast::NodeId) -> bool {
 
 fn find_item<'a>(item_id: ast::NodeId, items: rbml::Doc<'a>) -> rbml::Doc<'a> {
     match maybe_find_item(item_id, items) {
-       None => fail!("lookup_item: id not found: {}", item_id),
+       None => panic!("lookup_item: id not found: {}", item_id),
        Some(d) => d
     }
 }
@@ -153,7 +153,7 @@ fn item_family(item: rbml::Doc) -> Family {
       'S' => Struct,
       'g' => PublicField,
       'N' => InheritedField,
-       c => fail!("unexpected family char: {}", c)
+       c => panic!("unexpected family char: {}", c)
     }
 }
 
@@ -164,7 +164,7 @@ fn item_visibility(item: rbml::Doc) -> ast::Visibility {
             match reader::doc_as_u8(visibility_doc) as char {
                 'y' => ast::Public,
                 'i' => ast::Inherited,
-                _ => fail!("unknown visibility character")
+                _ => panic!("unknown visibility character")
             }
         }
     }
@@ -707,7 +707,7 @@ fn get_mutability(ch: u8) -> ast::Mutability {
         match ch as char {
             'i' => ast::MutImmutable,
             'm' => ast::MutMutable,
-            _ => fail!("unknown mutability character: `{}`", ch as char),
+            _ => panic!("unknown mutability character: `{}`", ch as char),
         }
     }
 
@@ -725,7 +725,7 @@ fn get_mutability(ch: u8) -> ast::Mutability {
                 ty::ReEmpty,
                 get_mutability(string.as_bytes()[1]))
         }
-        _ => fail!("unknown self type code: `{}`", explicit_self_kind as char)
+        _ => panic!("unknown self type code: `{}`", explicit_self_kind as char)
     }
 }
 
@@ -739,7 +739,7 @@ pub fn get_impl_items(cdata: Cmd, impl_id: ast::NodeId)
         match item_sort(doc) {
             'r' | 'p' => impl_items.push(ty::MethodTraitItemId(def_id)),
             't' => impl_items.push(ty::TypeTraitItemId(def_id)),
-            _ => fail!("unknown impl item sort"),
+            _ => panic!("unknown impl item sort"),
         }
         true
     });
@@ -760,7 +760,7 @@ pub fn get_trait_item_name_and_kind(intr: Rc<IdentInterner>,
         }
         't' => (name, TypeTraitItemKind),
         c => {
-            fail!("get_trait_item_name_and_kind(): unknown trait item kind \
+            panic!("get_trait_item_name_and_kind(): unknown trait item kind \
                    in metadata: `{}`", c)
         }
     }
@@ -811,7 +811,7 @@ pub fn get_impl_or_trait_item(intr: Rc<IdentInterner>,
                 container: container,
             }))
         }
-        _ => fail!("unknown impl/trait item sort"),
+        _ => panic!("unknown impl/trait item sort"),
     }
 }
 
@@ -825,7 +825,7 @@ pub fn get_trait_item_def_ids(cdata: Cmd, id: ast::NodeId)
         match item_sort(mth) {
             'r' | 'p' => result.push(ty::MethodTraitItemId(def_id)),
             't' => result.push(ty::TypeTraitItemId(def_id)),
-            _ => fail!("unknown trait item sort"),
+            _ => panic!("unknown trait item sort"),
         }
         true
     });
@@ -937,7 +937,7 @@ pub fn get_static_methods_if_impl(intr: Rc<IdentInterner>,
                 match item_family(impl_method_doc) {
                     StaticMethod => fn_style = ast::NormalFn,
                     UnsafeStaticMethod => fn_style = ast::UnsafeFn,
-                    _ => fail!()
+                    _ => panic!()
                 }
 
                 static_impl_methods.push(StaticMethodInfo {
@@ -998,7 +998,7 @@ fn struct_field_family_to_visibility(family: Family) -> ast::Visibility {
     match family {
       PublicField => ast::Public,
       InheritedField => ast::Inherited,
-      _ => fail!()
+      _ => panic!()
     }
 }
 
@@ -1207,7 +1207,7 @@ pub fn translate_def_id(cdata: Cmd, did: ast::DefId) -> ast::DefId {
                 node: did.node,
             }
         }
-        None => fail!("didn't find a crate in the cnum_map")
+        None => panic!("didn't find a crate in the cnum_map")
     }
 }
 
@@ -1314,7 +1314,7 @@ pub fn get_dylib_dependency_formats(cdata: Cmd)
         let cnum = from_str(cnum).unwrap();
         let cnum = match cdata.cnum_map.find(&cnum) {
             Some(&n) => n,
-            None => fail!("didn't find a crate in the cnum_map")
+            None => panic!("didn't find a crate in the cnum_map")
         };
         result.push((cnum, if link == "d" {
             cstore::RequireDynamic
index 34aa9310ef236e6f2ead31fa0536b121f8ad5d4f..98ce6942d4818e5fae8f6e6ec6e6d27d367af25c 100644 (file)
@@ -187,13 +187,13 @@ fn canonicalize(path: Option<Path>) -> Option<Path> {
         path.and_then(|path|
             match myfs::realpath(&path) {
                 Ok(canon) => Some(canon),
-                Err(e) => fail!("failed to get realpath: {}", e),
+                Err(e) => panic!("failed to get realpath: {}", e),
             })
     }
 
     match canonicalize(os::self_exe_name()) {
         Some(mut p) => { p.pop(); p.pop(); p }
-        None => fail!("can't determine value for sysroot")
+        None => panic!("can't determine value for sysroot")
     }
 }
 
index 60fb490e270b3c0193c6ba8205a4dc644675fb1d..a52d02ccca77375e17c7a9840ebc63440d778a23 100644 (file)
@@ -260,7 +260,7 @@ fn parse_region_substs(st: &mut PState, conv: conv_did) -> subst::RegionSubsts {
                 parse_vec_per_param_space(
                     st, |st| parse_region(st, |x,y| conv(x,y))))
         }
-        _ => fail!("parse_bound_region: bad input")
+        _ => panic!("parse_bound_region: bad input")
     }
 }
 
@@ -282,7 +282,7 @@ fn parse_bound_region(st: &mut PState, conv: conv_did) -> ty::BoundRegion {
             ty::BrFresh(id)
         }
         'e' => ty::BrEnv,
-        _ => fail!("parse_bound_region: bad input")
+        _ => panic!("parse_bound_region: bad input")
     }
 }
 
@@ -327,7 +327,7 @@ fn parse_region(st: &mut PState, conv: conv_did) -> ty::Region {
       'e' => {
         ty::ReStatic
       }
-      _ => fail!("parse_region: bad input")
+      _ => panic!("parse_region: bad input")
     }
 }
 
@@ -335,7 +335,7 @@ fn parse_opt<T>(st: &mut PState, f: |&mut PState| -> T) -> Option<T> {
     match next(st) {
       'n' => None,
       's' => Some(f(st)),
-      _ => fail!("parse_opt: bad input")
+      _ => panic!("parse_opt: bad input")
     }
 }
 
@@ -374,7 +374,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
           'D' => return ty::mk_mach_int(ast::TyI64),
           'f' => return ty::mk_mach_float(ast::TyF32),
           'F' => return ty::mk_mach_float(ast::TyF64),
-          _ => fail!("parse_ty: bad numeric type")
+          _ => panic!("parse_ty: bad numeric type")
         }
       }
       'c' => return ty::mk_char(),
@@ -474,7 +474,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
       'e' => {
           return ty::mk_err();
       }
-      c => { fail!("unexpected char in type string: {}", c);}
+      c => { panic!("unexpected char in type string: {}", c);}
     }
 }
 
@@ -527,7 +527,7 @@ fn parse_fn_style(c: char) -> FnStyle {
     match c {
         'u' => UnsafeFn,
         'n' => NormalFn,
-        _ => fail!("parse_fn_style: bad fn_style {}", c)
+        _ => panic!("parse_fn_style: bad fn_style {}", c)
     }
 }
 
@@ -543,7 +543,7 @@ fn parse_onceness(c: char) -> ast::Onceness {
     match c {
         'o' => ast::Once,
         'm' => ast::Many,
-        _ => fail!("parse_onceness: bad onceness")
+        _ => panic!("parse_onceness: bad onceness")
     }
 }
 
@@ -587,7 +587,7 @@ fn parse_sig(st: &mut PState, conv: conv_did) -> ty::FnSig {
     let variadic = match next(st) {
         'V' => true,
         'N' => false,
-        r => fail!(format!("bad variadic: {}", r)),
+        r => panic!(format!("bad variadic: {}", r)),
     };
     let output = match peek(st) {
         'z' => {
@@ -609,7 +609,7 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId {
     while colon_idx < len && buf[colon_idx] != ':' as u8 { colon_idx += 1u; }
     if colon_idx == len {
         error!("didn't find ':' when parsing def id");
-        fail!();
+        panic!();
     }
 
     let crate_part = buf[0u..colon_idx];
@@ -617,12 +617,12 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId {
 
     let crate_num = match uint::parse_bytes(crate_part, 10u) {
        Some(cn) => cn as ast::CrateNum,
-       None => fail!("internal error: parse_def_id: crate number expected, found {}",
+       None => panic!("internal error: parse_def_id: crate number expected, found {}",
                      crate_part)
     };
     let def_num = match uint::parse_bytes(def_part, 10u) {
        Some(dn) => dn as ast::NodeId,
-       None => fail!("internal error: parse_def_id: id expected, found {}",
+       None => panic!("internal error: parse_def_id: id expected, found {}",
                      def_part)
     };
     ast::DefId { krate: crate_num, node: def_num }
@@ -688,7 +688,7 @@ fn parse_builtin_bounds(st: &mut PState, _conv: conv_did) -> ty::BuiltinBounds {
                 return builtin_bounds;
             }
             c => {
-                fail!("parse_bounds: bad builtin bounds ('{}')", c)
+                panic!("parse_bounds: bad builtin bounds ('{}')", c)
             }
         }
     }
@@ -714,7 +714,7 @@ fn parse_bounds(st: &mut PState, conv: conv_did) -> ty::ParamBounds {
                 return param_bounds;
             }
             c => {
-                fail!("parse_bounds: bad bounds ('{}')", c)
+                panic!("parse_bounds: bad bounds ('{}')", c)
             }
         }
     }
index aa88de756552385cf1b3dcd0a3f237ca00ee3365..f6d85a8eb018f68ccb2c746aa997148b84adac7d 100644 (file)
@@ -341,7 +341,7 @@ fn fold_block(&mut self, blk: P<ast::Block>) -> P<ast::Block> {
                             ast::DeclItem(_) => false,
                         }
                     }
-                    ast::StmtMac(..) => fail!("unexpanded macro in astencode")
+                    ast::StmtMac(..) => panic!("unexpanded macro in astencode")
                 };
                 if use_stmt {
                     Some(stmt)
@@ -795,7 +795,7 @@ fn read_vtable_origin(&mut self,
                   3 => {
                     typeck::vtable_error
                   }
-                  _ => fail!("bad enum variant")
+                  _ => panic!("bad enum variant")
                 })
             })
         }).unwrap()
@@ -1488,7 +1488,7 @@ fn read_method_origin(&mut self, dcx: &DecodeContext)
                         }).unwrap()
                     }
 
-                    _ => fail!("..")
+                    _ => panic!("..")
                 })
             })
         }).unwrap()
@@ -1618,7 +1618,7 @@ fn read_auto_adjustment(&mut self, dcx: &DecodeContext) -> ty::AutoAdjustment {
 
                         ty::AdjustDerefRef(auto_deref_ref)
                     }
-                    _ => fail!("bad enum variant for ty::AutoAdjustment")
+                    _ => panic!("bad enum variant for ty::AutoAdjustment")
                 })
             })
         }).unwrap()
@@ -1695,7 +1695,7 @@ fn read_autoref(&mut self, dcx: &DecodeContext) -> ty::AutoRef {
 
                         ty::AutoUnsafe(m, a)
                     }
-                    _ => fail!("bad enum variant for ty::AutoRef")
+                    _ => panic!("bad enum variant for ty::AutoRef")
                 })
             })
         }).unwrap()
@@ -1736,7 +1736,7 @@ fn read_unsize_kind(&mut self, dcx: &DecodeContext) -> ty::UnsizeKind {
                                                      substs: substs };
                         ty::UnsizeVtable(ty_trait, self_ty)
                     }
-                    _ => fail!("bad enum variant for ty::UnsizeKind")
+                    _ => panic!("bad enum variant for ty::UnsizeKind")
                 })
             })
         }).unwrap()
@@ -1762,7 +1762,7 @@ fn read_unboxed_closure(&mut self, dcx: &DecodeContext)
                 0 => ty::FnUnboxedClosureKind,
                 1 => ty::FnMutUnboxedClosureKind,
                 2 => ty::FnOnceUnboxedClosureKind,
-                _ => fail!("bad enum variant for ty::UnboxedClosureKind"),
+                _ => panic!("bad enum variant for ty::UnboxedClosureKind"),
             })
         }).unwrap();
         ty::UnboxedClosure {
@@ -2032,6 +2032,6 @@ fn new_int_alist<B>() -> alist<int, B> {
         assert!(pprust::item_to_string(&*item_out) ==
                 pprust::item_to_string(&*item_exp));
       }
-      _ => fail!()
+      _ => panic!()
     }
 }
index 887c6bc3e3fdfb48c34e3424fe5bb43c4f368b84..9d4d9fcf9a9d74714975ff7848e028c5940d06d7 100644 (file)
@@ -133,10 +133,10 @@ fn report_cannot_move_out_of(bccx: &BorrowckCtxt, move_from: mc::cmt) {
                                  which defines the `Drop` trait",
                                 b.ty.user_string(bccx.tcx)).as_slice());
                 },
-                _ => fail!("this path should not cause illegal move")
+                _ => panic!("this path should not cause illegal move")
             }
         }
-        _ => fail!("this path should not cause illegal move")
+        _ => panic!("this path should not cause illegal move")
     }
 }
 
index b09e9105f3f6be4102905f05b1fd38fc56bc8329..ae8e975e843b00e4ca50f7ae1c64503775256003 100644 (file)
@@ -284,9 +284,9 @@ pub fn closure_to_block(closure_id: ast::NodeId,
             ast::ExprProc(_, ref block) |
             ast::ExprFnBlock(_, _, ref block) |
             ast::ExprUnboxedFn(_, _, _, ref block) => { block.id }
-            _ => fail!("encountered non-closure id: {}", closure_id)
+            _ => panic!("encountered non-closure id: {}", closure_id)
         },
-        _ => fail!("encountered non-expr id: {}", closure_id)
+        _ => panic!("encountered non-expr id: {}", closure_id)
     }
 }
 
index d5557dfeeff1a37463ab675f9e504a53dcc3f6b2..612c9a00bbef40ee0a4efe6b8e1c5aaee5d84743 100644 (file)
@@ -88,7 +88,7 @@ struct PropagationContext<'a, 'b: 'a, 'tcx: 'b, O: 'a> {
 fn to_cfgidx_or_die(id: ast::NodeId, index: &NodeMap<CFGIndex>) -> CFGIndex {
     let opt_cfgindex = index.find(&id).map(|&i|i);
     opt_cfgindex.unwrap_or_else(|| {
-        fail!("nodeid_to_index does not have entry for NodeId {}", id);
+        panic!("nodeid_to_index does not have entry for NodeId {}", id);
     })
 }
 
index 3facf0b0c0a49220e4db51565b6a13ef9b67cbda..f88269ccac947fedc3583f299966cb6582837f11 100644 (file)
@@ -74,7 +74,7 @@ pub fn def_id(&self) -> ast::DefId {
                 local_def(id)
             }
 
-            DefPrimTy(_) => fail!()
+            DefPrimTy(_) => panic!()
         }
     }
 
index f2d1a5e1d927243d17a099a802286afc97ee7b21..08202897558fb69f13146d4e9cdbe1350cd248ec 100644 (file)
@@ -264,18 +264,18 @@ pub fn collect_language_items(krate: &ast::Crate,
 
     StrEqFnLangItem,                 "str_eq",                  str_eq_fn;
 
-    // A number of failure-related lang items. The `fail` item corresponds to
-    // divide-by-zero and various failure cases with `match`. The
-    // `fail_bounds_check` item is for indexing arrays.
+    // A number of panic-related lang items. The `panic` item corresponds to
+    // divide-by-zero and various panic cases with `match`. The
+    // `panic_bounds_check` item is for indexing arrays.
     //
     // The `begin_unwind` lang item has a predefined symbol name and is sort of
     // a "weak lang item" in the sense that a crate is not required to have it
     // defined to use it, but a final product is required to define it
     // somewhere. Additionally, there are restrictions on crates that use a weak
     // lang item, but do not have it defined.
-    FailFnLangItem,                  "fail",                    fail_fn;
-    FailBoundsCheckFnLangItem,       "fail_bounds_check",       fail_bounds_check_fn;
-    FailFmtLangItem,                 "fail_fmt",                fail_fmt;
+    PanicFnLangItem,                 "panic",                   panic_fn;
+    PanicBoundsCheckFnLangItem,      "panic_bounds_check",      panic_bounds_check_fn;
+    PanicFmtLangItem,                "panic_fmt",               panic_fmt;
 
     ExchangeMallocFnLangItem,        "exchange_malloc",         exchange_malloc_fn;
     ExchangeFreeFnLangItem,          "exchange_free",           exchange_free_fn;
index 4e2ee03877c1e30b87725210dab2a9fee16feab8..f9810120d211b6bbb6bd9d342f68454e890381da 100644 (file)
@@ -93,7 +93,7 @@
  * These are described in the `specials` struct:
  *
  * - `exit_ln`: a live node that is generated to represent every 'exit' from
- *   the function, whether it be by explicit return, fail, or other means.
+ *   the function, whether it be by explicit return, panic, or other means.
  *
  * - `fallthrough_ln`: a live node that represents a fallthrough
  *
@@ -400,7 +400,7 @@ fn visit_fn(ir: &mut IrMaps,
     visit::walk_fn(&mut fn_maps, fk, decl, body, sp);
 
     // Special nodes and variables:
-    // - exit_ln represents the end of the fn, either by return or fail
+    // - exit_ln represents the end of the fn, either by return or panic
     // - implicit_ret_var is a pseudo-variable that represents
     //   an implicit return
     let specials = Specials {
index ad297309c088003885756fe16760c5b9fc0ddf34..32e373f5851c069cc678129e8ef297a4b307ab74 100644 (file)
@@ -157,7 +157,7 @@ pub fn encl_scope(&self, id: ast::NodeId) -> ast::NodeId {
         //! Returns the narrowest scope that encloses `id`, if any.
         match self.scope_map.borrow().find(&id) {
             Some(&r) => r,
-            None => { fail!("no enclosing scope for id {}", id); }
+            None => { panic!("no enclosing scope for id {}", id); }
         }
     }
 
@@ -167,7 +167,7 @@ pub fn var_scope(&self, var_id: ast::NodeId) -> ast::NodeId {
          */
         match self.var_map.borrow().find(&var_id) {
             Some(&r) => r,
-            None => { fail!("no enclosing scope for id {}", var_id); }
+            None => { panic!("no enclosing scope for id {}", var_id); }
         }
     }
 
index fad4ef4f15f6b2983d4aea9c1cc302855f39958e..7af4739d409156b3b6b1d6ec58f315758aee369e 100644 (file)
@@ -728,7 +728,7 @@ fn get_module_if_available(&self) -> Option<Rc<Module>> {
     fn get_module(&self) -> Rc<Module> {
         match self.get_module_if_available() {
             None => {
-                fail!("get_module called on a node with no module \
+                panic!("get_module called on a node with no module \
                        definition!")
             }
             Some(module_def) => module_def
@@ -1910,7 +1910,7 @@ fn handle_external_def(&mut self,
           DefLocal(..) | DefPrimTy(..) | DefTyParam(..) |
           DefUse(..) | DefUpvar(..) | DefRegion(..) |
           DefTyParamBinder(..) | DefLabel(..) | DefSelfTy(..) => {
-            fail!("didn't expect `{}`", def);
+            panic!("didn't expect `{}`", def);
           }
         }
     }
@@ -2618,7 +2618,7 @@ fn get_binding(this: &mut Resolver,
             }
             UnboundResult => { /* Continue. */ }
             UnknownResult => {
-                fail!("value result should be known at this point");
+                panic!("value result should be known at this point");
             }
         }
         match type_result {
@@ -2641,7 +2641,7 @@ fn get_binding(this: &mut Resolver,
             }
             UnboundResult => { /* Continue. */ }
             UnknownResult => {
-                fail!("type result should be known at this point");
+                panic!("type result should be known at this point");
             }
         }
 
@@ -5161,7 +5161,7 @@ fn resolve_bare_identifier_pattern(&mut self, name: Name, span: Span)
                         target.bindings.value_def.borrow());
                 match *target.bindings.value_def.borrow() {
                     None => {
-                        fail!("resolved name in the value namespace to a \
+                        panic!("resolved name in the value namespace to a \
                               set of name bindings with no def?!");
                     }
                     Some(def) => {
@@ -5191,7 +5191,7 @@ fn resolve_bare_identifier_pattern(&mut self, name: Name, span: Span)
             }
 
             Indeterminate => {
-                fail!("unexpected indeterminate result");
+                panic!("unexpected indeterminate result");
             }
             Failed(err) => {
                 match err {
@@ -5389,7 +5389,7 @@ fn resolve_module_relative_path(&mut self,
                                                  msg.as_slice()));
                 return None;
             }
-            Indeterminate => fail!("indeterminate unexpected"),
+            Indeterminate => panic!("indeterminate unexpected"),
             Success((resulting_module, resulting_last_private)) => {
                 containing_module = resulting_module;
                 last_private = resulting_last_private;
@@ -5451,7 +5451,7 @@ fn resolve_crate_relative_path(&mut self,
             }
 
             Indeterminate => {
-                fail!("indeterminate unexpected");
+                panic!("indeterminate unexpected");
             }
 
             Success((resulting_module, resulting_last_private)) => {
@@ -5537,7 +5537,7 @@ fn resolve_item_by_name_in_lexical_scope(&mut self,
                 }
             }
             Indeterminate => {
-                fail!("unexpected indeterminate result");
+                panic!("unexpected indeterminate result");
             }
             Failed(err) => {
                 match err {
@@ -6155,7 +6155,7 @@ fn finalize_import(&mut self, id: NodeId, span: Span) {
                 type_used: _
             }) => (v, t),
             Some(_) => {
-                fail!("we should only have LastImport for `use` directives")
+                panic!("we should only have LastImport for `use` directives")
             }
             _ => return,
         };
index 237f4e950ceee42a301bb9735a407138e652172c..b986d4dd591f382c80198502dc3b925c90a382e2 100644 (file)
@@ -177,7 +177,7 @@ pub fn regions<'a>(&'a self) -> &'a VecPerParamSpace<ty::Region> {
          */
 
         match self.regions {
-            ErasedRegions => fail!("Erased regions only expected in trans"),
+            ErasedRegions => panic!("Erased regions only expected in trans"),
             NonerasedRegions(ref r) => r
         }
     }
@@ -190,7 +190,7 @@ pub fn mut_regions<'a>(&'a mut self) -> &'a mut VecPerParamSpace<ty::Region> {
          */
 
         match self.regions {
-            ErasedRegions => fail!("Erased regions only expected in trans"),
+            ErasedRegions => panic!("Erased regions only expected in trans"),
             NonerasedRegions(ref mut r) => r
         }
     }
@@ -249,7 +249,7 @@ pub fn from_uint(u: uint) -> ParamSpace {
             0 => TypeSpace,
             1 => SelfSpace,
             2 => FnSpace,
-            _ => fail!("Invalid ParamSpace: {}", u)
+            _ => panic!("Invalid ParamSpace: {}", u)
         }
     }
 }
index 2379a5e7f53a2e6f8a04db11175a5c35cdf7394f..f53b5331eddeb7a2624abc37ff50571272f9745f 100644 (file)
@@ -235,7 +235,7 @@ fn eq(self, other: ConstantExpr<'a>, tcx: &ty::ctxt) -> bool {
         let ConstantExpr(other_expr) = other;
         match const_eval::compare_lit_exprs(tcx, expr, other_expr) {
             Some(val1) => val1 == 0,
-            None => fail!("compare_list_exprs: type mismatch"),
+            None => panic!("compare_list_exprs: type mismatch"),
         }
     }
 }
@@ -734,7 +734,7 @@ fn is_infallible(&self) -> bool {
     fn handle_fail(&self, bcx: Block) {
         match *self {
             Infallible =>
-                fail!("attempted to fail in an infallible failure handler!"),
+                panic!("attempted to panic in a non-panicking panic handler!"),
             JumpToBasicBlock(basic_block) =>
                 Br(bcx, basic_block),
             Unreachable =>
index 2525da8863f557924c30a16e769e347950a03a38..1f737cae86f9241e679b8369fcb09fc0c191f84f 100644 (file)
@@ -586,7 +586,7 @@ fn generic_type_of(cx: &CrateContext,
                                  Type::array(&Type::i64(cx), align_units),
                 a if a.count_ones() == 1 => Type::array(&Type::vector(&Type::i32(cx), a / 4),
                                                               align_units),
-                _ => fail!("unsupported enum alignment: {}", align)
+                _ => panic!("unsupported enum alignment: {}", align)
             };
             assert_eq!(machine::llalign_of_min(cx, pad_ty), align);
             assert_eq!(align_s % discr_size, 0);
index 16ff2f901f6d59b73a3f74787a62068baf819aba..ae8f944cab100d9dbc07d44e6a65b0c8f6e4d3cf 100644 (file)
@@ -291,7 +291,7 @@ pub fn decl_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str) -> ValueRef {
              RustCall,
              Some(llenvironment_type))
         }
-        _ => fail!("expected closure or fn")
+        _ => panic!("expected closure or fn")
     };
 
     let llfty = type_of_rust_fn(ccx, env, inputs.as_slice(), output, abi);
@@ -2349,7 +2349,7 @@ fn register_fn(ccx: &CrateContext,
         ty::ty_bare_fn(ref f) => {
             assert!(f.abi == Rust || f.abi == RustCall);
         }
-        _ => fail!("expected bare rust fn")
+        _ => panic!("expected bare rust fn")
     };
 
     let llfn = decl_rust_fn(ccx, node_type, sym.as_slice());
@@ -2744,7 +2744,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
                     llfn
                 }
 
-                _ => fail!("get_item_val: weird result in table")
+                _ => panic!("get_item_val: weird result in table")
             };
 
             match attr::first_attr_value_str_by_name(i.attrs.as_slice(),
@@ -2811,7 +2811,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
             let args = match v.node.kind {
                 ast::TupleVariantKind(ref args) => args,
                 ast::StructVariantKind(_) => {
-                    fail!("struct variant kind unexpected in get_item_val")
+                    panic!("struct variant kind unexpected in get_item_val")
                 }
             };
             assert!(args.len() != 0u);
@@ -2827,7 +2827,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
                 ast::ItemEnum(_, _) => {
                     register_fn(ccx, (*v).span, sym, id, ty)
                 }
-                _ => fail!("NodeVariant, shouldn't happen")
+                _ => panic!("NodeVariant, shouldn't happen")
             };
             set_inline_hint(llfn);
             llfn
index 025b5f368ecae3bdbd0c5cc3b67cd74a5cf62032..895f03ec2c79de7ccb4f9625c739d44d8e497a5b 100644 (file)
@@ -30,7 +30,7 @@ pub fn terminate(cx: Block, _: &str) {
 
 pub fn check_not_terminated(cx: Block) {
     if cx.terminated.get() {
-        fail!("already terminated!");
+        panic!("already terminated!");
     }
 }
 
@@ -45,7 +45,7 @@ pub fn B<'blk, 'tcx>(cx: Block<'blk, 'tcx>) -> Builder<'blk, 'tcx> {
 // terminated, we're saying that trying to add any further statements in the
 // block is an error. On the other hand, if something is unreachable, that
 // means that the block was terminated in some way that we don't want to check
-// for (fail/break/return statements, call to diverging functions, etc), and
+// for (panic/break/return statements, call to diverging functions, etc), and
 // further instructions to the block should simply be ignored.
 
 pub fn RetVoid(cx: Block) {
index ccfc79ac0c5002bec9ce1074297c366250d6df6f..d8cf8dbb7959f3331a19d55601b7238f479819c1 100644 (file)
@@ -50,7 +50,7 @@ fn ty_align(ty: Type) -> uint {
             let elt = ty.element_type();
             ty_align(elt)
         }
-        _ => fail!("ty_align: unhandled type")
+        _ => panic!("ty_align: unhandled type")
     }
 }
 
@@ -80,7 +80,7 @@ fn ty_size(ty: Type) -> uint {
             let eltsz = ty_size(elt);
             len * eltsz
         }
-        _ => fail!("ty_size: unhandled type")
+        _ => panic!("ty_size: unhandled type")
     }
 }
 
index 90bd1521705f029bc0e5e7ad967a395e3fbb367d..9f51e153a0fc9baa54ceda10187f611d641bbe80 100644 (file)
@@ -50,7 +50,7 @@ fn ty_align(ty: Type) -> uint {
             let elt = ty.element_type();
             ty_align(elt)
         }
-        _ => fail!("ty_size: unhandled type")
+        _ => panic!("ty_size: unhandled type")
     }
 }
 
@@ -80,7 +80,7 @@ fn ty_size(ty: Type) -> uint {
             let eltsz = ty_size(elt);
             len * eltsz
         }
-        _ => fail!("ty_size: unhandled type")
+        _ => panic!("ty_size: unhandled type")
     }
 }
 
index 1b8a354259ad785977df301be29db8335658ca6b..54fd20ff995b5b04ff3eb1c92eb80f0f738ca7f9 100644 (file)
@@ -111,7 +111,7 @@ fn ty_align(ty: Type) -> uint {
                 let elt = ty.element_type();
                 ty_align(elt)
             }
-            _ => fail!("ty_size: unhandled type")
+            _ => panic!("ty_size: unhandled type")
         }
     }
 
@@ -140,7 +140,7 @@ fn ty_size(ty: Type) -> uint {
                 let eltsz = ty_size(elt);
                 len * eltsz
             }
-            _ => fail!("ty_size: unhandled type")
+            _ => panic!("ty_size: unhandled type")
         }
     }
 
@@ -235,7 +235,7 @@ fn classify(ty: Type,
                     i += 1u;
                 }
             }
-            _ => fail!("classify: unhandled type")
+            _ => panic!("classify: unhandled type")
         }
     }
 
@@ -328,7 +328,7 @@ fn llvec_len(cls: &[RegClass]) -> uint {
             SSEDs => {
                 tys.push(Type::f64(ccx));
             }
-            _ => fail!("llregtype: unhandled class")
+            _ => panic!("llregtype: unhandled class")
         }
         i += 1u;
     }
index 54f41b79b01307542594e468a34598b3f1a006f5..1f4a0dadc0209e20f2c19729b419997482b28c17 100644 (file)
@@ -689,9 +689,9 @@ pub fn trans_call_inner<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 
     // Introduce a temporary cleanup scope that will contain cleanups
     // for the arguments while they are being evaluated. The purpose
-    // this cleanup is to ensure that, should a failure occur while
+    // this cleanup is to ensure that, should a panic occur while
     // evaluating argument N, the values for arguments 0...N-1 are all
-    // cleaned up. If no failure occurs, the values are handed off to
+    // cleaned up. If no panic occurs, the values are handed off to
     // the callee, and hence none of the cleanups in this temporary
     // scope will ever execute.
     let fcx = bcx.fcx;
@@ -704,7 +704,7 @@ pub fn trans_call_inner<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let (abi, ret_ty) = match ty::get(callee_ty).sty {
         ty::ty_bare_fn(ref f) => (f.abi, f.sig.output),
         ty::ty_closure(ref f) => (f.abi, f.sig.output),
-        _ => fail!("expected bare rust fn or closure in trans_call_inner")
+        _ => panic!("expected bare rust fn or closure in trans_call_inner")
     };
 
     let (llfn, llenv, llself) = match callee.data {
@@ -847,7 +847,7 @@ pub fn trans_call_inner<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         let mut llargs = Vec::new();
         let arg_tys = match args {
             ArgExprs(a) => a.iter().map(|x| expr_ty(bcx, &**x)).collect(),
-            _ => fail!("expected arg exprs.")
+            _ => panic!("expected arg exprs.")
         };
         bcx = trans_args(bcx,
                          args,
@@ -1141,7 +1141,7 @@ pub fn trans_arg_datum<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                 bcx, arg_datum.to_appropriate_datum(bcx));
 
             // Technically, ownership of val passes to the callee.
-            // However, we must cleanup should we fail before the
+            // However, we must cleanup should we panic before the
             // callee is actually invoked.
             val = arg_datum.add_clean(bcx.fcx, arg_cleanup_scope);
         }
index 827df48071af9221da0309ad38bed8b90d62e80d..e5825d7a38f1538988cdda83f51eaa2adfd7982f 100644 (file)
@@ -477,7 +477,7 @@ fn schedule_clean_in_custom_scope(&self,
     fn needs_invoke(&self) -> bool {
         /*!
          * Returns true if there are pending cleanups that should
-         * execute on failure.
+         * execute on panic.
          */
 
         self.scopes.borrow().iter().rev().any(|s| s.needs_invoke())
@@ -485,8 +485,8 @@ fn needs_invoke(&self) -> bool {
 
     fn get_landing_pad(&'blk self) -> BasicBlockRef {
         /*!
-         * Returns a basic block to branch to in the event of a failure.
-         * This block will run the failure cleanups and eventually
+         * Returns a basic block to branch to in the event of a panic.
+         * This block will run the panic cleanups and eventually
          * invoke the LLVM `Resume` instruction.
          */
 
@@ -497,7 +497,7 @@ fn get_landing_pad(&'blk self) -> BasicBlockRef {
         let orig_scopes_len = self.scopes_len();
         assert!(orig_scopes_len > 0);
 
-        // Remove any scopes that do not have cleanups on failure:
+        // Remove any scopes that do not have cleanups on panic:
         let mut popped_scopes = vec!();
         while !self.top_scope(|s| s.needs_invoke()) {
             debug!("top scope does not need invoke");
index 5d386b0a706b5b34bcdbc174804e80f757e27922..60b107c049f412c9cefa031ca3882de4eb623b81 100644 (file)
@@ -603,7 +603,7 @@ pub fn C_int<I: AsI64>(ccx: &CrateContext, i: I) -> ValueRef {
     match machine::llbitsize_of_real(ccx, ccx.int_type()) {
         32 => assert!(v < (1<<31) && v >= -(1<<31)),
         64 => {},
-        n => fail!("unsupported target size: {}", n)
+        n => panic!("unsupported target size: {}", n)
     }
 
     C_integral(ccx.int_type(), v as u64, true)
@@ -615,7 +615,7 @@ pub fn C_uint<I: AsU64>(ccx: &CrateContext, i: I) -> ValueRef {
     match machine::llbitsize_of_real(ccx, ccx.int_type()) {
         32 => assert!(v < (1<<32)),
         64 => {},
-        n => fail!("unsupported target size: {}", n)
+        n => panic!("unsupported target size: {}", n)
     }
 
     C_integral(ccx.int_type(), v, false)
index 64ad88630f4604ce6613912e63034d4e6023ffa0..955fcbfab842f93655bb3e3b748b4ee04f4c3d9b 100644 (file)
@@ -453,7 +453,7 @@ fn new(shared: &SharedCrateContext,
     /// Create a dummy `CrateContext` from `self` and  the provided
     /// `SharedCrateContext`.  This is somewhat dangerous because `self` may
     /// not actually be an element of `shared.local_ccxs`, which can cause some
-    /// operations to `fail` unexpectedly.
+    /// operations to panic unexpectedly.
     ///
     /// This is used in the `LocalCrateContext` constructor to allow calling
     /// functions that expect a complete `CrateContext`, even before the local
@@ -527,7 +527,7 @@ pub fn get_intrinsic(&self, key: & &'static str) -> ValueRef {
         }
         match declare_intrinsic(self, key) {
             Some(v) => return v,
-            None => fail!()
+            None => panic!()
         }
     }
 
index d6df0d88a769ffde6ea60bfef002905f3bcf2920..013483d0003c31e5ca4c43a5181afeffd286e819 100644 (file)
@@ -132,7 +132,7 @@ fn foo() -> Box<int> { ... }
 ## The Cleanup module
 
 The cleanup module tracks what values need to be cleaned up as scopes
-are exited, either via failure or just normal control flow. The basic
+are exited, either via panic or just normal control flow. The basic
 idea is that the function context maintains a stack of cleanup scopes
 that are pushed/popped as we traverse the AST tree. There is typically
 at least one cleanup scope per AST node; some AST nodes may introduce
@@ -142,9 +142,9 @@ fn foo() -> Box<int> { ... }
 Typically, when a scope is popped, we will also generate the code for
 each of its cleanups at that time. This corresponds to a normal exit
 from a block (for example, an expression completing evaluation
-successfully without failure). However, it is also possible to pop a
+successfully without panic). However, it is also possible to pop a
 block *without* executing its cleanups; this is typically used to
-guard intermediate values that must be cleaned up on failure, but not
+guard intermediate values that must be cleaned up on panic, but not
 if everything goes right. See the section on custom scopes below for
 more details.
 
@@ -170,7 +170,7 @@ fn foo() -> Box<int> { ... }
 byproducts that need to be freed, then you should use temporary custom
 scopes to ensure that those byproducts will get freed on unwind.  For
 example, an expression like `box foo()` will first allocate a box in the
-heap and then call `foo()` -- if `foo()` should fail, this box needs
+heap and then call `foo()` -- if `foo()` should panic, this box needs
 to be *shallowly* freed.
 
 ### Long-distance jumps
@@ -178,13 +178,13 @@ fn foo() -> Box<int> { ... }
 In addition to popping a scope, which corresponds to normal control
 flow exiting the scope, we may also *jump out* of a scope into some
 earlier scope on the stack. This can occur in response to a `return`,
-`break`, or `continue` statement, but also in response to failure. In
+`break`, or `continue` statement, but also in response to panic. In
 any of these cases, we will generate a series of cleanup blocks for
 each of the scopes that is exited. So, if the stack contains scopes A
 ... Z, and we break out of a loop whose corresponding cleanup scope is
 X, we would generate cleanup blocks for the cleanups in X, Y, and Z.
 After cleanup is done we would branch to the exit point for scope X.
-But if failure should occur, we would generate cleanups for all the
+But if panic should occur, we would generate cleanups for all the
 scopes from A to Z and then resume the unwind process afterwards.
 
 To avoid generating tons of code, we cache the cleanup blocks that we
@@ -211,7 +211,7 @@ fn foo() -> Box<int> { ... }
 
 Custom cleanup scopes are used for a variety of purposes. The most
 common though is to handle temporary byproducts, where cleanup only
-needs to occur on failure. The general strategy is to push a custom
+needs to occur on panic. The general strategy is to push a custom
 cleanup scope, schedule *shallow* cleanups into the custom scope, and
 then pop the custom scope (without transing the cleanups) when
 execution succeeds normally. This way the cleanups are only trans'd on
@@ -229,7 +229,7 @@ fn foo() -> Box<int> { ... }
 5. Pop the scope C.
 6. Return the box as an rvalue.
 
-This way, if a failure occurs while transing `expr`, the custom
+This way, if a panic occurs while transing `expr`, the custom
 cleanup scope C is pushed and hence the box will be freed. The trans
 code for `expr` itself is responsible for freeing any other byproducts
 that may be in play.
index 7d64c42a00030986ccd3baac5a35dd209c37995b..4d004c85f6e5f1ce47b3c93e23bef00d0a8426cd 100644 (file)
@@ -1263,7 +1263,7 @@ pub fn with_field_tys<R>(tcx: &ty::ctxt,
      * Helper for enumerating the field types of structs, enums, or records.
      * The optional node ID here is the node ID of the path identifying the enum
      * variant in use. If none, this cannot possibly an enum variant (so, if it
-     * is and `node_id_opt` is none, this function fails).
+     * is and `node_id_opt` is none, this function panics).
      */
 
     match ty::get(ty).sty {
@@ -1421,7 +1421,7 @@ pub fn trans_adt<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
     };
 
     // This scope holds intermediates that must be cleaned should
-    // failure occur before the ADT as a whole is ready.
+    // panic occur before the ADT as a whole is ready.
     let custom_cleanup_scope = fcx.push_custom_cleanup_scope();
 
     // First we trans the base, if we have one, to the dest
index aa195837b67d4a3a5178c07d95910a566d03fce6..d979024c1607666be5405e8c52e19bb063402913 100644 (file)
@@ -551,7 +551,7 @@ pub fn decl_rust_fn_with_foreign_abi(ccx: &CrateContext,
             let c = llvm_calling_convention(ccx, fn_ty.abi);
             c.unwrap_or(llvm::CCallConv)
         }
-        _ => fail!("expected bare fn in decl_rust_fn_with_foreign_abi")
+        _ => panic!("expected bare fn in decl_rust_fn_with_foreign_abi")
     };
     let llfn = base::decl_fn(ccx, name, cconv, llfn_ty, ty::FnConverging(ty::mk_nil()));
     add_argument_attributes(&tys, llfn);
@@ -575,7 +575,7 @@ pub fn register_rust_fn_with_foreign_abi(ccx: &CrateContext,
             let c = llvm_calling_convention(ccx, fn_ty.abi);
             c.unwrap_or(llvm::CCallConv)
         }
-        _ => fail!("expected bare fn in register_rust_fn_with_foreign_abi")
+        _ => panic!("expected bare fn in register_rust_fn_with_foreign_abi")
     };
     let llfn = base::register_fn_llvmty(ccx, sp, sym, node_id, cconv, llfn_ty);
     add_argument_attributes(&tys, llfn);
index e914dbcc082a672333cd82a8018f637ad7e11d07..fb85e6198666726d1bad7c346059f782b86e8ba0 100644 (file)
@@ -244,7 +244,7 @@ fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     adt::fold_variants(bcx, &*repr, struct_data, |variant_cx, st, value| {
         // Be sure to put all of the fields into a scope so we can use an invoke
         // instruction to call the user destructor but still call the field
-        // destructors if the user destructor fails.
+        // destructors if the user destructor panics.
         let field_scope = variant_cx.fcx.push_custom_cleanup_scope();
 
         // Class dtors have no explicit args, so the params should
index 0ddd4894cfa28201055a890c938e4ca4bfb5692e..2455970b6a64d37616734e4056192ca85ca66100 100644 (file)
@@ -147,7 +147,7 @@ pub fn trans_intrinsic_call<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, node: ast::N
 
     let ret_ty = match ty::get(callee_ty).sty {
         ty::ty_bare_fn(ref f) => f.sig.output,
-        _ => fail!("expected bare_fn in trans_intrinsic_call")
+        _ => panic!("expected bare_fn in trans_intrinsic_call")
     };
     let foreign_item = tcx.map.expect_foreign_item(node);
     let name = token::get_ident(foreign_item.ident);
index bab11c30204cc77dca17e2752c8f944fddb72335..db433167298cea8db4b8a8a13174c861122c0c1f 100644 (file)
@@ -193,7 +193,7 @@ pub fn trans_static_method_callee(bcx: Block,
                 };
                 ident.name
             }
-            _ => fail!("callee is not a trait method")
+            _ => panic!("callee is not a trait method")
         }
     } else {
         csearch::get_item_path(bcx.tcx(), method_id).last().unwrap().name()
index 0dcc69a6686567ed96ae6a3033e8c5a8294f11bb..5c8287c0030d43b804c9ce75e4e1940055f1bade 100644 (file)
@@ -315,7 +315,7 @@ pub fn write_content<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                         return bcx;
                     }
 
-                    // Some cleanup would be required in the case in which failure happens
+                    // Some cleanup would be required in the case in which panic happens
                     // during a copy. But given that copy constructors are not overridable,
                     // this can only happen as a result of OOM. So we just skip out on the
                     // cleanup since things would *probably* be broken at that point anyways.
index 6acbde3b2adc95ad7088d9a10cae731a62b484e9..f08fd20314a6635fc99d326bb541f6da57c04445 100644 (file)
@@ -308,7 +308,7 @@ pub fn float_width(&self) -> uint {
             Double => 64,
             X86_FP80 => 80,
             FP128 | PPC_FP128 => 128,
-            _ => fail!("llvm_float_width called on a non-float type")
+            _ => panic!("llvm_float_width called on a non-float type")
         }
     }
 }
index 64ab86721bcc7cec9eacd633022358e1a8280d24..649dbbacc698447789e7e9de9fd8d9b31ec8e480 100644 (file)
@@ -237,7 +237,7 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type {
             cx.sess().bug(format!("fictitious type {} in sizing_type_of()",
                                   ppaux::ty_to_string(cx.tcx(), t)).as_slice())
         }
-        ty::ty_vec(_, None) | ty::ty_trait(..) | ty::ty_str => fail!("unreachable")
+        ty::ty_vec(_, None) | ty::ty_trait(..) | ty::ty_str => panic!("unreachable")
     };
 
     cx.llsizingtypes().borrow_mut().insert(t, llsizingty);
@@ -266,7 +266,7 @@ fn type_of_unsize_info(cx: &CrateContext, t: ty::t) -> Type {
         match ty::get(ty::unsized_part_of_type(cx.tcx(), t)).sty {
             ty::ty_str | ty::ty_vec(..) => Type::uint_from_ty(cx, ast::TyU),
             ty::ty_trait(_) => Type::vtable_ptr(cx),
-            _ => fail!("Unexpected type returned from unsized_part_of_type : {}",
+            _ => panic!("Unexpected type returned from unsized_part_of_type : {}",
                        t.repr(cx.tcx()))
         }
     }
index 6666b85879a89d330136b426f2c0d149cf118fdc..edb67f7fddf8b3f971dd7538964dbf0f11b27204 100644 (file)
@@ -2083,7 +2083,7 @@ pub fn simd_type(cx: &ctxt, ty: t) -> t {
             let fields = lookup_struct_fields(cx, did);
             lookup_field_type(cx, did, fields[0].id, substs)
         }
-        _ => fail!("simd_type called on invalid type")
+        _ => panic!("simd_type called on invalid type")
     }
 }
 
@@ -2093,7 +2093,7 @@ pub fn simd_size(cx: &ctxt, ty: t) -> uint {
             let fields = lookup_struct_fields(cx, did);
             fields.len()
         }
-        _ => fail!("simd_size called on invalid type")
+        _ => panic!("simd_size called on invalid type")
     }
 }
 
@@ -2564,7 +2564,7 @@ fn tc_ty(cx: &ctxt,
                 // the current crate; therefore, the only type parameters that
                 // could be in scope are those defined in the current crate.
                 // If this assertion fails, it is likely because of a
-                // failure in the cross-crate inlining code to translate a
+                // failure of the cross-crate inlining code to translate a
                 // def-id.
                 assert_eq!(p.def_id.krate, ast::LOCAL_CRATE);
 
@@ -3097,7 +3097,7 @@ pub fn unsized_part_of_type(cx: &ctxt, ty: t) -> t {
         _ => {
             assert!(type_is_sized(cx, ty),
                     "unsized_part_of_type failed even though ty is unsized");
-            fail!("called unsized_part_of_type with sized ty");
+            panic!("called unsized_part_of_type with sized ty");
         }
     }
 }
@@ -3229,7 +3229,7 @@ pub fn fn_is_variadic(fty: t) -> bool {
         ty_bare_fn(ref f) => f.sig.variadic,
         ty_closure(ref f) => f.sig.variadic,
         ref s => {
-            fail!("fn_is_variadic() called on non-fn type: {}", s)
+            panic!("fn_is_variadic() called on non-fn type: {}", s)
         }
     }
 }
@@ -3239,7 +3239,7 @@ pub fn ty_fn_sig(fty: t) -> FnSig {
         ty_bare_fn(ref f) => f.sig.clone(),
         ty_closure(ref f) => f.sig.clone(),
         ref s => {
-            fail!("ty_fn_sig() called on non-fn type: {}", s)
+            panic!("ty_fn_sig() called on non-fn type: {}", s)
         }
     }
 }
@@ -3249,7 +3249,7 @@ pub fn ty_fn_abi(fty: t) -> abi::Abi {
     match get(fty).sty {
         ty_bare_fn(ref f) => f.abi,
         ty_closure(ref f) => f.abi,
-        _ => fail!("ty_fn_abi() called on non-fn type"),
+        _ => panic!("ty_fn_abi() called on non-fn type"),
     }
 }
 
@@ -3259,7 +3259,7 @@ pub fn ty_fn_args(fty: t) -> Vec<t> {
         ty_bare_fn(ref f) => f.sig.inputs.clone(),
         ty_closure(ref f) => f.sig.inputs.clone(),
         ref s => {
-            fail!("ty_fn_args() called on non-fn type: {}", s)
+            panic!("ty_fn_args() called on non-fn type: {}", s)
         }
     }
 }
@@ -3273,7 +3273,7 @@ pub fn ty_closure_store(fty: t) -> TraitStore {
             UniqTraitStore
         }
         ref s => {
-            fail!("ty_closure_store() called on non-closure type: {}", s)
+            panic!("ty_closure_store() called on non-closure type: {}", s)
         }
     }
 }
@@ -3283,7 +3283,7 @@ pub fn ty_fn_ret(fty: t) -> FnOutput {
         ty_bare_fn(ref f) => f.sig.output,
         ty_closure(ref f) => f.sig.output,
         ref s => {
-            fail!("ty_fn_ret() called on non-fn type: {}", s)
+            panic!("ty_fn_ret() called on non-fn type: {}", s)
         }
     }
 }
@@ -3735,7 +3735,7 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
             // Special case `Box<T>` for now:
             let definition = match tcx.def_map.borrow().find(&place.id) {
                 Some(&def) => def,
-                None => fail!("no def for place"),
+                None => panic!("no def for place"),
             };
             let def_id = definition.def_id();
             if tcx.lang_items.exchange_heap() == Some(def_id) {
@@ -3760,7 +3760,7 @@ pub fn stmt_node_id(s: &ast::Stmt) -> ast::NodeId {
       ast::StmtDecl(_, id) | StmtExpr(_, id) | StmtSemi(_, id) => {
         return id;
       }
-      ast::StmtMac(..) => fail!("unexpanded macro in trans")
+      ast::StmtMac(..) => panic!("unexpanded macro in trans")
     }
 }
 
@@ -4068,7 +4068,7 @@ fn lookup_locally_or_in_crate_store<V:Clone>(
     }
 
     if def_id.krate == ast::LOCAL_CRATE {
-        fail!("No def'n found for {} in tcx.{}", def_id, descr);
+        panic!("No def'n found for {} in tcx.{}", def_id, descr);
     }
     let v = load_external();
     map.insert(def_id, v.clone());
index 42990ac79c005e52cee389ba6bb681fbca2383a0..da1e7e24571a6e45552b8bb151455b59d3324b5d 100644 (file)
@@ -937,7 +937,7 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
                                     tcx.map.node_to_string(id.node)).as_slice());
                     }
                     def::DefPrimTy(_) => {
-                        fail!("DefPrimTy arm missed in previous ast_ty_to_prim_ty call");
+                        panic!("DefPrimTy arm missed in previous ast_ty_to_prim_ty call");
                     }
                     def::DefAssociatedTy(trait_type_id) => {
                         let path_str = tcx.map.path_to_string(
index d9f8625504daf518683d238ed426dc5b6114d1dd..97c6cf24f0e1900a31efa8ab15699897dbae3b0c 100644 (file)
@@ -259,7 +259,7 @@ pub fn check_match(fcx: &FnCtxt,
     // bottom the type lattice, and we'll be moving up the lattice as
     // we process each arm. (Note that any match with 0 arms is matching
     // on any empty type and is therefore unreachable; should the flow
-    // of execution reach it, we will fail, so bottom is an appropriate
+    // of execution reach it, we will panic, so bottom is an appropriate
     // type in that case)
     let result_ty = arms.iter().fold(fcx.infcx().next_diverging_ty_var(), |result_ty, arm| {
         check_expr(fcx, &*arm.body);
index 6ace73931bfe86886d920700babc0270a07115e6..7527160c825ae17cc7f7229e50ef23069ef9a59a 100644 (file)
@@ -916,7 +916,7 @@ fn default_method_hack(self_mt: ty::mt) -> bool {
             // FIXME(#6129). Default methods can't deal with autoref.
             //
             // I am a horrible monster and I pray for death. Currently
-            // the default method code fails when you try to reborrow
+            // the default method code panics when you try to reborrow
             // because it is not handling types correctly. In lieu of
             // fixing that, I am introducing this horrible hack. - ndm
             self_mt.mutbl == MutImmutable && ty::type_is_self(self_mt.ty)
@@ -1034,7 +1034,7 @@ fn auto_slice_trait(&self, ty: ty::t, autoderefs: uint) -> Option<MethodResult>
                         ty::mk_rptr(tcx, r, ty::mt{ ty: tr, mutbl: m })
                     })
             }
-            _ => fail!("Expected ty_trait in auto_slice_trait")
+            _ => panic!("Expected ty_trait in auto_slice_trait")
         }
     }
 
@@ -1767,7 +1767,7 @@ fn to_source(&self) -> CandidateSource {
                 ImplSource(def_id)
             }
             MethodStaticUnboxedClosure(..) => {
-                fail!("MethodStaticUnboxedClosure only used in trans")
+                panic!("MethodStaticUnboxedClosure only used in trans")
             }
             MethodTypeParam(ref param) => {
                 TraitSource(param.trait_ref.def_id)
index 08a1e95fd90a1fd7aea5aa1a72c7487d59443b38..a5624dcc2fcd3f9b503d2579d4663e60d4eed690 100644 (file)
@@ -100,7 +100,7 @@ pub fn check_object_cast(fcx: &FnCtxt,
     fn object_trait<'a>(t: &'a ty::t) -> &'a ty::TyTrait {
         match ty::get(*t).sty {
             ty::ty_trait(ref ty_trait) => &**ty_trait,
-            _ => fail!("expected ty_trait")
+            _ => panic!("expected ty_trait")
         }
     }
 
index 92fc61cf4c034e2c5b16ae681e9ac4bb029cddf0..a569053507cf88ff96d8ef7ef565e70e066177a2 100644 (file)
@@ -90,7 +90,7 @@ fn get_base_type(inference_context: &InferCtxt,
                    get(original_type).sty);
             None
         }
-        ty_trait(..) => fail!("should have been caught")
+        ty_trait(..) => panic!("should have been caught")
     }
 }
 
@@ -116,7 +116,7 @@ fn get_base_type_def_id(inference_context: &InferCtxt,
                             Some(def_id)
                         }
                         _ => {
-                            fail!("get_base_type() returned a type that wasn't an \
+                            panic!("get_base_type() returned a type that wasn't an \
                                    enum, struct, or trait");
                         }
                     }
@@ -125,7 +125,7 @@ fn get_base_type_def_id(inference_context: &InferCtxt,
                     Some(def_id)
                 }
                 _ => {
-                    fail!("get_base_type() returned a type that wasn't an \
+                    panic!("get_base_type() returned a type that wasn't an \
                            enum, struct, or trait");
                 }
             }
index 4c85418669fbb789175a7d3ebd11fec15a245c87..847d8e88bde88b25c8a5fed7e14e631e15777dfc 100644 (file)
@@ -1593,7 +1593,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::Item)
             return pty;
         }
         ast::ItemImpl(..) | ast::ItemMod(_) |
-        ast::ItemForeignMod(_) | ast::ItemMac(_) => fail!(),
+        ast::ItemForeignMod(_) | ast::ItemMac(_) => panic!(),
     }
 }
 
index 83ca67f33bc31a7a7e5a47a4af97138619b622f9..fbf2918c2921af615a48b22314310b3b45e54290 100644 (file)
@@ -210,7 +210,7 @@ fn generalize_region(this: &Glb,
 
             // NB---I do not believe this algorithm computes
             // (necessarily) the GLB.  As written it can
-            // spuriously fail.  In particular, if there is a case
+            // spuriously fail. In particular, if there is a case
             // like: |fn(&a)| and fn(fn(&b)), where a and b are
             // free, it will return fn(&c) where c = GLB(a,b).  If
             // however this GLB is not defined, then the result is
index fc508db3b2ebd967d4602fc0b6cd9ea49fc70e17..d2a77f906b5356954a205746c63f69599369e59d 100644 (file)
@@ -603,7 +603,7 @@ pub fn commit_if_ok<T,E>(&self, f: || -> Result<T,E>) -> Result<T,E> {
         self.commit_unconditionally(|| self.try(|| f()))
     }
 
-    /// Execute `f`, unroll bindings on failure
+    /// Execute `f`, unroll bindings on panic
     pub fn try<T,E>(&self, f: || -> Result<T,E>) -> Result<T,E> {
         debug!("try()");
         let snapshot = self.start_snapshot();
index b4704b2a27c97f5d959d16a6173b4e92399fd5e9..80213d43ec4378a43e7eee7058e6e97c009ae875 100644 (file)
@@ -273,7 +273,7 @@ pub fn rollback_to(&self, snapshot: RegionSnapshot) {
         while undo_log.len() > snapshot.length + 1 {
             match undo_log.pop().unwrap() {
                 OpenSnapshot => {
-                    fail!("Failure to observe stack discipline");
+                    panic!("Failure to observe stack discipline");
                 }
                 Mark | CommitedSnapshot => { }
                 AddVar(vid) => {
@@ -916,7 +916,7 @@ fn intersect_scopes(&self,
         // We want to generate the intersection of two
         // scopes or two free regions.  So, if one of
         // these scopes is a subscope of the other, return
-        // it.  Otherwise fail.
+        // it. Otherwise fail.
         debug!("intersect_scopes(scope_a={}, scope_b={}, region_a={}, region_b={})",
                scope_a, scope_b, region_a, region_b);
         match self.tcx.region_maps.nearest_common_ancestor(scope_a, scope_b) {
index cad648a8ddbb9a53c934e57d4d85b336856fa7f9..5b1ee7c64b4a37c7ffe8ca8160b8ea896b4380f8 100644 (file)
@@ -67,7 +67,7 @@ fn remove_message(e: &mut ExpectErrorEmitter, msg: &str, lvl: Level) {
             e.messages.remove(i);
         }
         None => {
-            fail!("Unexpected error: {} Expected: {}",
+            panic!("Unexpected error: {} Expected: {}",
                   msg, e.messages);
         }
     }
@@ -169,7 +169,7 @@ pub fn lookup_item(&self, names: &[String]) -> ast::NodeId {
         return match search_mod(self, &self.infcx.tcx.map.krate().module, 0, names) {
             Some(id) => id,
             None => {
-                fail!("no item found: `{}`", names.connect("::"));
+                panic!("no item found: `{}`", names.connect("::"));
             }
         };
 
@@ -218,7 +218,7 @@ fn search(this: &Env,
     pub fn make_subtype(&self, a: ty::t, b: ty::t) -> bool {
         match infer::mk_subty(self.infcx, true, infer::Misc(DUMMY_SP), a, b) {
             Ok(_) => true,
-            Err(ref e) => fail!("Encountered error: {}",
+            Err(ref e) => panic!("Encountered error: {}",
                                 ty::type_err_to_str(self.infcx.tcx, e))
         }
     }
@@ -232,7 +232,7 @@ pub fn is_subtype(&self, a: ty::t, b: ty::t) -> bool {
 
     pub fn assert_subtype(&self, a: ty::t, b: ty::t) {
         if !self.is_subtype(a, b) {
-            fail!("{} is not a subtype of {}, but it should be",
+            panic!("{} is not a subtype of {}, but it should be",
                   self.ty_to_string(a),
                   self.ty_to_string(b));
         }
@@ -240,7 +240,7 @@ pub fn assert_subtype(&self, a: ty::t, b: ty::t) {
 
     pub fn assert_not_subtype(&self, a: ty::t, b: ty::t) {
         if self.is_subtype(a, b) {
-            fail!("{} is a subtype of {}, but it shouldn't be",
+            panic!("{} is a subtype of {}, but it shouldn't be",
                   self.ty_to_string(a),
                   self.ty_to_string(b));
         }
@@ -315,7 +315,7 @@ pub fn resolve_regions(&self) {
     pub fn make_lub_ty(&self, t1: ty::t, t2: ty::t) -> ty::t {
         match self.lub().tys(t1, t2) {
             Ok(t) => t,
-            Err(ref e) => fail!("unexpected error computing LUB: {}",
+            Err(ref e) => panic!("unexpected error computing LUB: {}",
                                 ty::type_err_to_str(self.infcx.tcx, e))
         }
     }
@@ -327,7 +327,7 @@ pub fn check_lub(&self, t1: ty::t, t2: ty::t, t_lub: ty::t) {
                 self.assert_eq(t, t_lub);
             }
             Err(ref e) => {
-                fail!("unexpected error in LUB: {}",
+                panic!("unexpected error in LUB: {}",
                       ty::type_err_to_str(self.infcx.tcx, e))
             }
         }
@@ -341,7 +341,7 @@ pub fn check_glb(&self, t1: ty::t, t2: ty::t, t_glb: ty::t) {
                self.ty_to_string(t_glb));
         match self.glb().tys(t1, t2) {
             Err(e) => {
-                fail!("unexpected error computing LUB: {}", e)
+                panic!("unexpected error computing LUB: {}", e)
             }
             Ok(t) => {
                 self.assert_eq(t, t_glb);
@@ -358,7 +358,7 @@ pub fn check_no_lub(&self, t1: ty::t, t2: ty::t) {
         match self.lub().tys(t1, t2) {
             Err(_) => {}
             Ok(t) => {
-                fail!("unexpected success computing LUB: {}", self.ty_to_string(t))
+                panic!("unexpected success computing LUB: {}", self.ty_to_string(t))
             }
         }
     }
@@ -368,7 +368,7 @@ pub fn check_no_glb(&self, t1: ty::t, t2: ty::t) {
         match self.glb().tys(t1, t2) {
             Err(_) => {}
             Ok(t) => {
-                fail!("unexpected success computing GLB: {}", self.ty_to_string(t))
+                panic!("unexpected success computing GLB: {}", self.ty_to_string(t))
             }
         }
     }
index deeb90503df2157d9cc9d5eec971548374396ba7..63094ceaabdf962e701ad0e08f5cbfbf3a0301aa 100644 (file)
@@ -102,7 +102,7 @@ pub fn instantiate_and_push(
 
         let relations = match old_value {
             Bounded(b) => b,
-            Known(_) => fail!("Asked to instantiate variable that is \
+            Known(_) => panic!("Asked to instantiate variable that is \
                                already instantiated")
         };
 
@@ -172,7 +172,7 @@ fn reverse(&mut self,
 
 fn relations<'a>(v: &'a mut TypeVariableData) -> &'a mut Vec<Relation> {
     match v.value {
-        Known(_) => fail!("var_sub_var: variable is known"),
+        Known(_) => panic!("var_sub_var: variable is known"),
         Bounded(ref mut relations) => relations
     }
 }
index 301582d55d6eb0bbfc6fca57126e468bbe6bf485..d93e985190cffccacc7a5afa3eaa3b962cda4571 100644 (file)
@@ -245,7 +245,7 @@ pub fn unify(&mut self,
 
 impl<K,V> sv::SnapshotVecDelegate<VarValue<K,V>,()> for Delegate {
     fn reverse(&mut self, _: &mut Vec<VarValue<K,V>>, _: ()) {
-        fail!("Nothing to reverse");
+        panic!("Nothing to reverse");
     }
 }
 
index 8e4aea4463ee37633ab7abe1be3453236b01f078..c8214a743de73338245a17712afef8daa64db50a 100644 (file)
@@ -572,7 +572,7 @@ fn find_binding_for_lifetime(&self, param_id: ast::NodeId) -> ast::NodeId {
         match tcx.named_region_map.find(&param_id) {
             Some(&rl::DefEarlyBoundRegion(_, _, lifetime_decl_id))
                 => lifetime_decl_id,
-            Some(_) => fail!("should not encounter non early-bound cases"),
+            Some(_) => panic!("should not encounter non early-bound cases"),
 
             // The lookup should only fail when `param_id` is
             // itself a lifetime binding: use it as the decl_id.
@@ -597,11 +597,11 @@ fn is_to_be_inferred(&self, param_id: ast::NodeId) -> bool {
             assert!(is_lifetime(&tcx.map, param_id));
             let parent_id = tcx.map.get_parent(decl_id);
             let parent = tcx.map.find(parent_id).unwrap_or_else(
-                || fail!("tcx.map missing entry for id: {}", parent_id));
+                || panic!("tcx.map missing entry for id: {}", parent_id));
 
             let is_inferred;
             macro_rules! cannot_happen { () => { {
-                fail!("invalid parent: {:s} for {:s}",
+                panic!("invalid parent: {:s} for {:s}",
                       tcx.map.node_to_string(parent_id),
                       tcx.map.node_to_string(param_id));
             } } }
index 79faf3aa147ed1b6a466bbdb5d85a0177be59937..e107ac73d79953abada2ca9709972f0e667582de 100644 (file)
@@ -118,7 +118,7 @@ fn visit_foreign_item(&mut self, i: &ast::ForeignItem) {
 ) )
 
 weak_lang_items!(
-    fail_fmt,           FailFmtLangItem,            rust_begin_unwind;
+    panic_fmt,          PanicFmtLangItem,            rust_begin_unwind;
     stack_exhausted,    StackExhaustedLangItem,     rust_stack_exhausted;
     eh_personality,     EhPersonalityLangItem,      rust_eh_personality;
 )
index 88e6f0ad186c6cd2bed5752bf11e248c8f9a1df0..99e870a901e0893240a9acb87a6ccf4559d041f4 100644 (file)
@@ -64,7 +64,7 @@ pub fn register_syntax_extension(&mut self, name: ast::Name, extension: SyntaxEx
             Decorator(ext) => Decorator(ext),
             Modifier(ext) => Modifier(ext),
             // there's probably a nicer way to signal this:
-            LetSyntaxTT(_, _) => fail!("can't register a new LetSyntax!"),
+            LetSyntaxTT(_, _) => panic!("can't register a new LetSyntax!"),
         }));
     }
 
index 7a7c8f8d94f72da590b5e53f2b9a19253e42c90f..8885d86d4da3637602e8d9372dd77ed342039fe4 100644 (file)
@@ -148,7 +148,7 @@ pub fn rollback_to(&mut self, snapshot: Snapshot) {
             match self.undo_log.pop().unwrap() {
                 OpenSnapshot => {
                     // This indicates a failure to obey the stack discipline.
-                    fail!("Cannot rollback an uncommitted snapshot");
+                    panic!("Cannot rollback an uncommitted snapshot");
                 }
 
                 CommittedSnapshot => {
index 060dda5934f8e3f7d0f454815fe04eb5ec6b5bc4..2e58a8dab3b3905289a3ee4b96f50e292f2b6f99 100644 (file)
@@ -91,7 +91,7 @@ fn run_ar(handler: &ErrorHandler, maybe_ar_prog: &Option<String>,
             handler.err(format!("could not exec `{}`: {}", ar.as_slice(),
                              e).as_slice());
             handler.abort_if_errors();
-            fail!("rustc::back::archive::run_ar() should not reach this point");
+            panic!("rustc::back::archive::run_ar() should not reach this point");
         }
     }
 }
index a7a234dc18ac51f8739708612a872dce88371dbb..4c62ba54ac427c00e1ac3ee7ef060ded5ec8dda6 100644 (file)
@@ -206,7 +206,7 @@ fn test_rpath_relative() {
             os: abi::OsLinux,
             used_crates: Vec::new(),
             out_filename: Path::new("bin/rustc"),
-            get_install_prefix_lib_path: || fail!(),
+            get_install_prefix_lib_path: || panic!(),
             realpath: |p| Ok(p.clone())
         };
         let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
@@ -220,7 +220,7 @@ fn test_rpath_relative() {
             os: abi::OsFreebsd,
             used_crates: Vec::new(),
             out_filename: Path::new("bin/rustc"),
-            get_install_prefix_lib_path: || fail!(),
+            get_install_prefix_lib_path: || panic!(),
             realpath: |p| Ok(p.clone())
         };
         let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
@@ -234,7 +234,7 @@ fn test_rpath_relative() {
             os: abi::OsDragonfly,
             used_crates: Vec::new(),
             out_filename: Path::new("bin/rustc"),
-            get_install_prefix_lib_path: || fail!(),
+            get_install_prefix_lib_path: || panic!(),
             realpath: |p| Ok(p.clone())
         };
         let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
@@ -248,7 +248,7 @@ fn test_rpath_relative() {
             os: abi::OsMacos,
             used_crates: Vec::new(),
             out_filename: Path::new("bin/rustc"),
-            get_install_prefix_lib_path: || fail!(),
+            get_install_prefix_lib_path: || panic!(),
             realpath: |p| Ok(p.clone())
         };
         let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
index bf8d993964ff9b3ccd08f3533973347e8edbf2fa..96a15213c5ed6ffcedc40da07d28827f8cc7b4a0 100644 (file)
@@ -59,18 +59,18 @@ fn to_bits(self) -> (u64, u64) {
     }
 }
 
-/// Adds the specified number of bytes to the bit count. fail!() if this would cause numeric
+/// Adds the specified number of bytes to the bit count. panic!() if this would cause numeric
 /// overflow.
 fn add_bytes_to_bits<T: Int + CheckedAdd + ToBits>(bits: T, bytes: T) -> T {
     let (new_high_bits, new_low_bits) = bytes.to_bits();
 
     if new_high_bits > Zero::zero() {
-        fail!("numeric overflow occurred.")
+        panic!("numeric overflow occurred.")
     }
 
     match bits.checked_add(&new_low_bits) {
         Some(x) => return x,
-        None => fail!("numeric overflow occurred.")
+        None => panic!("numeric overflow occurred.")
     }
 }
 
index 3c28cac6c6f7c1e9186ae56796016f018e979c2a..01a5767aeb2560b5fa5b3f60d6825b5c4c5252d1 100644 (file)
@@ -347,7 +347,7 @@ fn visit_mac(&mut self, macro: &Mac) {
             } else {
                 // It is not possible to observe any kind of macro
                 // invocation at this stage except `macro_rules!`.
-                fail!("reached macro somehow: {}",
+                panic!("reached macro somehow: {}",
                       pprust::to_string(|pp_state| pp_state.print_mac(macro)));
             }
 
index 4ef72361701f2bf4e2ab5294bc382fbbb671554d..967e1fbb70021eb885abf9887f12127d609b4318 100644 (file)
@@ -174,7 +174,7 @@ fn build_external_function(cx: &DocContext, tcx: &ty::ctxt,
     clean::Function {
         decl: match ty::get(t.ty).sty {
             ty::ty_bare_fn(ref f) => (did, &f.sig).clean(cx),
-            _ => fail!("bad function"),
+            _ => panic!("bad function"),
         },
         generics: (&t.generics, subst::FnSpace).clean(cx),
         fn_style: style,
@@ -308,7 +308,7 @@ fn build_impl(cx: &DocContext, tcx: &ty::ctxt,
                             generics: generics,
                         })
                     }
-                    _ => fail!("not a tymethod"),
+                    _ => panic!("not a tymethod"),
                 };
                 Some(item)
             }
@@ -382,7 +382,7 @@ fn fill_in(cx: &DocContext, tcx: &ty::ctxt, did: ast::DefId,
                 decoder::DlDef(..) => {}
                 // All impls were inlined above
                 decoder::DlImpl(..) => {}
-                decoder::DlField => fail!("unimplemented field"),
+                decoder::DlField => panic!("unimplemented field"),
             }
         });
     }
index c4d7e85904cb31e745dd0d30e1ff801c74eff622..7c8f4ba8f65c7bb5f345142e4b0947cba142835a 100644 (file)
@@ -1259,7 +1259,7 @@ fn clean(&self, cx: &DocContext) -> Type {
             TyBareFn(ref barefn) => BareFunction(box barefn.clean(cx)),
             TyParen(ref ty) => ty.clean(cx),
             TyBot => Bottom,
-            ref x => fail!("Unimplemented type {}", x),
+            ref x => panic!("Unimplemented type {}", x),
         }
     }
 }
@@ -1354,9 +1354,9 @@ fn clean(&self, cx: &DocContext) -> Type {
 
             ty::ty_unboxed_closure(..) => Primitive(Unit), // FIXME(pcwalton)
 
-            ty::ty_infer(..) => fail!("ty_infer"),
-            ty::ty_open(..) => fail!("ty_open"),
-            ty::ty_err => fail!("ty_err"),
+            ty::ty_infer(..) => panic!("ty_infer"),
+            ty::ty_open(..) => panic!("ty_open"),
+            ty::ty_err => panic!("ty_err"),
         }
     }
 }
@@ -2068,9 +2068,9 @@ fn name_from_pat(p: &ast::Pat) -> String {
                   which is silly in function arguments");
             "()".to_string()
         },
-        PatRange(..) => fail!("tried to get argument name from PatRange, \
+        PatRange(..) => panic!("tried to get argument name from PatRange, \
                               which is not allowed in function arguments"),
-        PatVec(..) => fail!("tried to get argument name from pat_vec, \
+        PatVec(..) => panic!("tried to get argument name from pat_vec, \
                              which is not allowed in function arguments"),
         PatMac(..) => {
             warn!("can't document the name of a function argument \
@@ -2092,7 +2092,7 @@ fn resolve_type(cx: &DocContext, path: Path,
     debug!("searching for {} in defmap", id);
     let def = match tcx.def_map.borrow().find(&id) {
         Some(&k) => k,
-        None => fail!("unresolved id not in defmap")
+        None => panic!("unresolved id not in defmap")
     };
 
     match def {
index ef921a84cfb8eea5f7a240ddc3b63b36ef989f62..a89b20c949b4040b2a14c4f674a06e5b1a3a9d57 100644 (file)
@@ -128,7 +128,7 @@ pub fn new(p: &Path) -> Lock {
             };
             if ret == -1 {
                 unsafe { libc::close(fd); }
-                fail!("could not lock `{}`", p.display())
+                panic!("could not lock `{}`", p.display())
             }
             Lock { fd: fd }
         }
@@ -197,7 +197,7 @@ pub fn new(p: &Path) -> Lock {
                                   ptr::null_mut())
             };
             if handle == libc::INVALID_HANDLE_VALUE {
-                fail!("create file error: {}", os::last_os_error());
+                panic!("create file error: {}", os::last_os_error());
             }
             let mut overlapped: libc::OVERLAPPED = unsafe { mem::zeroed() };
             let ret = unsafe {
@@ -206,7 +206,7 @@ pub fn new(p: &Path) -> Lock {
             };
             if ret == 0 {
                 unsafe { libc::CloseHandle(handle); }
-                fail!("could not lock `{}`: {}", p.display(),
+                panic!("could not lock `{}`: {}", p.display(),
                       os::last_os_error())
             }
             Lock { handle: handle }
index ca8a6cd0c401073993e21f3f6ceed63269feea42..f9177c8d61578797a79a5af5f234f287edcb591c 100644 (file)
@@ -499,7 +499,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                 }
             }
             clean::Unique(..) => {
-                fail!("should have been cleaned")
+                panic!("should have been cleaned")
             }
         }
     }
index 6e515f611986e70ad8a9ac59b37bc95a0a64eb35..b7dfd811574a3c1e955b22fe2654143c80775c66 100644 (file)
@@ -1042,7 +1042,7 @@ impl Context {
     /// sure it always points to the top (relatively)
     fn recurse<T>(&mut self, s: String, f: |&mut Context| -> T) -> T {
         if s.len() == 0 {
-            fail!("Unexpected empty destination: {}", self.current);
+            panic!("Unexpected empty destination: {}", self.current);
         }
         let prev = self.dst.clone();
         self.dst.push(s.as_slice());
index ad79faebd45c5635d33ba3a7f4b4385ee90e203c..5f404238beb30dda938e463612fc9eea68aa0989 100644 (file)
@@ -243,13 +243,13 @@ pub fn main_args(args: &[String]) -> int {
         Some("html") | None => {
             match html::render::run(krate, &external_html, output.unwrap_or(Path::new("doc"))) {
                 Ok(()) => {}
-                Err(e) => fail!("failed to generate documentation: {}", e),
+                Err(e) => panic!("failed to generate documentation: {}", e),
             }
         }
         Some("json") => {
             match json_output(krate, res, output.unwrap_or(Path::new("doc.json"))) {
                 Ok(()) => {}
-                Err(e) => fail!("failed to write json: {}", e),
+                Err(e) => panic!("failed to write json: {}", e),
             }
         }
         Some(s) => {
@@ -480,7 +480,7 @@ fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> ,
     };
     let crate_json = match json::from_str(crate_json_str.as_slice()) {
         Ok(j) => j,
-        Err(e) => fail!("Rust generated JSON is invalid: {}", e)
+        Err(e) => panic!("Rust generated JSON is invalid: {}", e)
     };
 
     json.insert("crate".to_string(), crate_json);
index 685d76bb5200b82f0252a5b29bddc15a6639e5ab..642abf924ae71ddde749533891b1bbab8a0572b1 100644 (file)
@@ -192,15 +192,15 @@ fn runtest(test: &str, cratename: &str, libs: Vec<Path>, externs: core::Externs,
     cmd.env(DynamicLibrary::envvar(), newpath.as_slice());
 
     match cmd.output() {
-        Err(e) => fail!("couldn't run the test: {}{}", e,
+        Err(e) => panic!("couldn't run the test: {}{}", e,
                         if e.kind == io::PermissionDenied {
                             " - maybe your tempdir is mounted with noexec?"
                         } else { "" }),
         Ok(out) => {
             if should_fail && out.status.success() {
-                fail!("test executable succeeded when it should have failed");
+                panic!("test executable succeeded when it should have failed");
             } else if !should_fail && !out.status.success() {
-                fail!("test executable failed:\n{}",
+                panic!("test executable failed:\n{}",
                       str::from_utf8(out.error.as_slice()));
             }
         }
index 8e377037a9713e42db97f5aab17e0bff32456ca4..1cafc38f826c96542552ad22bea00f7131c75807 100644 (file)
@@ -249,7 +249,7 @@ fn resolve_id(&mut self, id: ast::NodeId, renamed: Option<ast::Ident>,
                                 self.visit_item(&**i, None, om);
                             }
                         }
-                        _ => { fail!("glob not mapped to a module"); }
+                        _ => { panic!("glob not mapped to a module"); }
                     }
                 } else {
                     self.visit_item(it, renamed, om);
@@ -353,7 +353,7 @@ pub fn visit_item(&mut self, item: &ast::Item,
                 om.foreigns.push(fm.clone());
             }
             ast::ItemMac(_) => {
-                fail!("rustdoc: macros should be gone, after expansion");
+                panic!("rustdoc: macros should be gone, after expansion");
             }
         }
     }
index 3138c9be99247ab5fb88e1ccd75f5ddd394ead9d..20a63f655b8ff9d2166ac7e7a6c862b0d869e1be 100644 (file)
@@ -160,14 +160,14 @@ pub fn cleanup() {
     }
 
     pub fn take() -> Option<Vec<Vec<u8>>> {
-        fail!()
+        panic!()
     }
 
     pub fn put(_args: Vec<Vec<u8>>) {
-        fail!()
+        panic!()
     }
 
     pub fn clone() -> Option<Vec<Vec<u8>>> {
-        fail!()
+        panic!()
     }
 }
index 6a33777a413c5d5fa8394c47e18271095b913856..ddb4df4fdc5386479c34954e84dd63c4620fc33a 100644 (file)
@@ -101,7 +101,7 @@ impl Clone for CString {
     fn clone(&self) -> CString {
         let len = self.len() + 1;
         let buf = unsafe { libc::malloc(len as libc::size_t) } as *mut libc::c_char;
-        if buf.is_null() { fail!("out of memory") }
+        if buf.is_null() { panic!("out of memory") }
         unsafe { ptr::copy_nonoverlapping_memory(buf, self.buf, len); }
         CString { buf: buf as *const libc::c_char, owns_buffer_: true }
     }
@@ -394,7 +394,7 @@ fn to_c_str(&self) -> CString {
     unsafe fn to_c_str_unchecked(&self) -> CString {
         let self_len = self.len();
         let buf = libc::malloc(self_len as libc::size_t + 1) as *mut u8;
-        if buf.is_null() { fail!("out of memory") }
+        if buf.is_null() { panic!("out of memory") }
 
         ptr::copy_memory(buf, self.as_ptr(), self_len);
         *buf.offset(self_len as int) = 0;
index 972497f98188309f3aa0ec481e9c053f683966ff..9a8bd3cdfc81cc6e35b555fff82adceb554fdc44 100644 (file)
@@ -101,7 +101,7 @@ fn spawn_sibling(self: Box<Self>,
     fn wrap(self: Box<Self>) -> Box<Any+'static>;
 }
 
-/// The default error code of the rust runtime if the main task fails instead
+/// The default error code of the rust runtime if the main task panics instead
 /// of exiting cleanly.
 pub const DEFAULT_ERROR_CODE: int = 101;
 
index 8d5c49d767f1584f41e735acb65219397b19d9e5..5d9e20b07de9aaa6610c6c016f58f626dc453160 100644 (file)
@@ -134,7 +134,7 @@ unsafe fn get_local_map<'a>() -> Option<&'a mut Map> {
             *slot = Some(TreeMap::new());
             match *slot {
                 Some(ref mut map_ptr) => { return Some(map_ptr) }
-                None => fail!("unreachable code"),
+                None => panic!("unreachable code"),
             }
         }
     }
@@ -161,12 +161,12 @@ impl<T: 'static> KeyValue<T> {
     /// If this key is already present in TLD, then the previous value is
     /// replaced with the provided data, and then returned.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// This function will fail if the key is present in TLD and currently on
+    /// This function will panic if the key is present in TLD and currently on
     /// loan with the `get` method.
     ///
-    /// It will also fail if there is no local task (because the current thread
+    /// It will also panic if there is no local task (because the current thread
     /// is not owned by the runtime).
     ///
     /// # Example
@@ -181,7 +181,7 @@ impl<T: 'static> KeyValue<T> {
     pub fn replace(&'static self, data: Option<T>) -> Option<T> {
         let map = match unsafe { get_local_map() } {
             Some(map) => map,
-            None => fail!("must have a local task to insert into TLD"),
+            None => panic!("must have a local task to insert into TLD"),
         };
         let keyval = key_to_key_value(self);
 
@@ -233,7 +233,7 @@ pub fn replace(&'static self, data: Option<T>) -> Option<T> {
                     }
                     _ => {
                         // Refcount is 2+, which means we have a live borrow.
-                        fail!("TLD value cannot be replaced because it is already borrowed");
+                        panic!("TLD value cannot be replaced because it is already borrowed");
                     }
                 }
             }
@@ -369,7 +369,7 @@ fn new<T>(value: T) -> TLDValue {
         unsafe fn d<T>(p: *mut ()) {
             let value_box = p as *mut TLDValueBox<T>;
             debug_assert!(*(*value_box).refcount.get() < 2, "TLDValue destructed while borrowed");
-            // use a RAII type here to ensure we always deallocate even if we fail while
+            // use a RAII type here to ensure we always deallocate even if we panic while
             // running the destructor for the value.
             struct Guard<T> {
                 p: *mut TLDValueBox<T>
@@ -495,7 +495,7 @@ fn test_tls_overwrite_multiple_types() {
 
     #[test]
     #[should_fail]
-    fn test_tls_cleanup_on_failure() {
+    fn test_tls_cleanup_on_panic() {
         static STR_KEY: Key<String> = &KeyValueKey;
         static BOX_KEY: Key<Box<int>> = &KeyValueKey;
         static INT_KEY: Key<int> = &KeyValueKey;
@@ -505,11 +505,11 @@ fn test_tls_cleanup_on_failure() {
             STR_KEY.replace(Some("string data".to_string()));
             BOX_KEY.replace(Some(box 2));
             INT_KEY.replace(Some(42));
-            fail!();
+            panic!();
         });
         // Not quite nondeterministic.
         INT_KEY.replace(Some(31337));
-        fail!();
+        panic!();
     }
 
     #[test]
index 838dfd6b7abe6b5807dfc0e6e5df06b5ebae1743..6a6e2e40ec8888e3f07dd04e1626e117665b844d 100644 (file)
@@ -81,7 +81,7 @@ pub struct NativeMutex {
 /// destruction.
 ///
 /// Using this makes lock-based code resilient to unwinding/task
-/// failure, because the lock will be automatically unlocked even
+/// panic, because the lock will be automatically unlocked even
 /// then.
 #[must_use]
 pub struct LockGuard<'a> {
index aaaeb8846ccafd3a699bbb25aa401e726d6d57c6..d01b4a3a4b34c87f44c0ef5c3104f8f8de6edf8f 100644 (file)
@@ -116,7 +116,7 @@ pub unsafe fn init() {
         PAGE_SIZE = info.dwPageSize as uint;
 
         if AddVectoredExceptionHandler(0, vectored_handler) == ptr::null_mut() {
-            fail!("failed to install exception handler");
+            panic!("failed to install exception handler");
         }
 
         mem::forget(make_handler());
@@ -127,7 +127,7 @@ pub unsafe fn cleanup() {
 
     pub unsafe fn make_handler() -> Handler {
         if SetThreadStackGuarantee(&mut 0x5000) == 0 {
-            fail!("failed to reserve stack space for exception handling");
+            panic!("failed to reserve stack space for exception handling");
         }
 
         super::Handler { _data: 0i as *mut libc::c_void }
@@ -232,7 +232,7 @@ unsafe fn term(signum: libc::c_int) -> ! {
     pub unsafe fn init() {
         let psize = libc::sysconf(libc::consts::os::sysconf::_SC_PAGESIZE);
         if psize == -1 {
-            fail!("failed to get page size");
+            panic!("failed to get page size");
         }
 
         PAGE_SIZE = psize as uint;
@@ -260,7 +260,7 @@ pub unsafe fn make_handler() -> Handler {
                              -1,
                              0);
         if alt_stack == MAP_FAILED {
-            fail!("failed to allocate an alternative stack");
+            panic!("failed to allocate an alternative stack");
         }
 
         let mut stack: sigaltstack = mem::zeroed();
index 5eb28412abdab2dccf6d85c90f775f05426dec8f..ad3b1dc7e1695e8e0b2f513ae4cb96312907da5d 100644 (file)
@@ -53,7 +53,7 @@
 ///
 /// * `run` - This function will execute a closure inside the context of a task.
 ///           Failure is caught and handled via the task's on_exit callback. If
-///           this fails, the task is still returned, but it can no longer be
+///           this panics, the task is still returned, but it can no longer be
 ///           used, it is poisoned.
 ///
 /// * `destroy` - This is a required function to call to destroy a task. If a
 /// // Create a task using a native runtime
 /// let task = native::task::new((0, uint::MAX), 0);
 ///
-/// // Run some code, catching any possible failures
+/// // Run some code, catching any possible panic
 /// let task = task.run(|| {
 ///     // Run some code inside this task
 ///     println!("Hello with a native runtime!");
 /// });
 ///
-/// // Run some code again, catching the failure
+/// // Run some code again, catching the panic
 /// let task = task.run(|| {
-///     fail!("oh no, what to do!");
+///     panic!("oh no, what to do!");
 /// });
 ///
-/// // Now that the task is failed, it can never be used again
+/// // Now that the task has panicked, it can never be used again
 /// assert!(task.is_destroyed());
 ///
 /// // Deallocate the resources associated with this task
@@ -114,7 +114,7 @@ enum TaskState {
 pub struct TaskOpts {
     /// Invoke this procedure with the result of the task when it finishes.
     pub on_exit: Option<proc(Result): Send>,
-    /// A name for the task-to-be, for identification in failure messages
+    /// A name for the task-to-be, for identification in panic messages
     pub name: Option<SendStr>,
     /// The size of the stack for the spawned task
     pub stack_size: Option<uint>,
@@ -122,7 +122,7 @@ pub struct TaskOpts {
 
 /// Indicates the manner in which a task exited.
 ///
-/// A task that completes without failing is considered to exit successfully.
+/// A task that completes without panicking is considered to exit successfully.
 ///
 /// If you wish for this result's delivery to block until all
 /// children tasks complete, recommend using a result future.
@@ -138,7 +138,7 @@ pub enum BlockedTask {
     Shared(Arc<AtomicUint>),
 }
 
-/// Per-task state related to task death, killing, failure, etc.
+/// Per-task state related to task death, killing, panic, etc.
 pub struct Death {
     pub on_exit: Option<proc(Result):Send>,
     marker: marker::NoCopy,
@@ -175,15 +175,15 @@ pub fn new() -> Task {
     /// try/catch). Invoking this function is quite cheap.
     ///
     /// If the closure `f` succeeds, then the returned task can be used again
-    /// for another invocation of `run`. If the closure `f` fails then `self`
+    /// for another invocation of `run`. If the closure `f` panics then `self`
     /// will be internally destroyed along with all of the other associated
     /// resources of this task. The `on_exit` callback is invoked with the
-    /// cause of failure (not returned here). This can be discovered by querying
+    /// cause of panic (not returned here). This can be discovered by querying
     /// `is_destroyed()`.
     ///
     /// Note that it is possible to view partial execution of the closure `f`
     /// because it is not guaranteed to run to completion, but this function is
-    /// guaranteed to return if it fails. Care should be taken to ensure that
+    /// guaranteed to return if it panicks. Care should be taken to ensure that
     /// stack references made by `f` are handled appropriately.
     ///
     /// It is invalid to call this function with a task that has been previously
@@ -212,7 +212,7 @@ pub fn run(mut self: Box<Task>, f: ||) -> Box<Task> {
         // recursive invocations of run(). If there's no one else, then
         // relinquish ownership of ourselves back into TLS.
         if Local::exists(None::<Task>) {
-            fail!("cannot run a task recursively inside another");
+            panic!("cannot run a task recursively inside another");
         }
         self.state = Armed;
         Local::put(self);
@@ -226,7 +226,7 @@ pub fn run(mut self: Box<Task>, f: ||) -> Box<Task> {
         let result = unsafe { unwind::try(f) };
 
         // After running the closure given return the task back out if it ran
-        // successfully, or clean up the task if it failed.
+        // successfully, or clean up the task if it panicked.
         let task: Box<Task> = Local::take();
         match result {
             Ok(()) => task,
@@ -275,7 +275,7 @@ fn cleanup(self: Box<Task>, result: Result) -> Box<Task> {
         //    There is a test for this at fail-during-tld-destroy.rs.
         //
         // 2. One failure in destruction is tolerable, so long as the task
-        //    didn't originally fail while it was running.
+        //    didn't originally panic while it was running.
         //
         // And with all that in mind, we attempt to clean things up!
         let mut task = self.run(|| {
@@ -290,7 +290,7 @@ fn cleanup(self: Box<Task>, result: Result) -> Box<Task> {
             drop(tld);
         });
 
-        // If the above `run` block failed, then it must be the case that the
+        // If the above `run` block panicked, then it must be the case that the
         // task had previously succeeded. This also means that the code below
         // was recursively run via the `run` method invoking this method. In
         // this case, we just make sure the world is as we thought, and return.
@@ -306,7 +306,7 @@ fn cleanup(self: Box<Task>, result: Result) -> Box<Task> {
 
         // FIXME: this is running in a seriously constrained context. If this
         //        allocates TLD then it will likely abort the runtime. Similarly,
-        //        if this fails, this will also likely abort the runtime.
+        //        if this panics, this will also likely abort the runtime.
         //
         //        This closure is currently limited to a channel send via the
         //        standard library's task interface, but this needs
@@ -490,7 +490,7 @@ pub fn reawaken(self) {
     }
 
     // This assertion has two flavours because the wake involves an atomic op.
-    // In the faster version, destructors will fail dramatically instead.
+    // In the faster version, destructors will panic dramatically instead.
     #[cfg(not(test))] pub fn trash(self) { }
     #[cfg(test)]      pub fn trash(self) { assert!(self.wake().is_none()); }
 
@@ -570,7 +570,7 @@ fn unwind() {
         let result = task::try(proc()());
         rtdebug!("trying first assert");
         assert!(result.is_ok());
-        let result = task::try::<()>(proc() fail!());
+        let result = task::try::<()>(proc() panic!());
         rtdebug!("trying second assert");
         assert!(result.is_err());
     }
index 50b570091ada146246270bb266165966bb440db5..9f3f45ba0981c47b1c0f40507cbd7137547d8af5 100644 (file)
@@ -235,7 +235,7 @@ pub unsafe fn create(stack: uint, p: Box<proc():Send>) -> rust_thread {
         if ret as uint == 0 {
             // be sure to not leak the closure
             let _p: Box<proc():Send> = mem::transmute(arg);
-            fail!("failed to spawn native thread: {}", ret);
+            panic!("failed to spawn native thread: {}", ret);
         }
         return ret;
     }
@@ -327,15 +327,15 @@ unsafe fn get_stack_start() -> *mut libc::c_void {
         unsafe fn get_stack_start() -> *mut libc::c_void {
             let mut attr: libc::pthread_attr_t = mem::zeroed();
             if pthread_getattr_np(pthread_self(), &mut attr) != 0 {
-                fail!("failed to get thread attributes");
+                panic!("failed to get thread attributes");
             }
             let mut stackaddr = ptr::null_mut();
             let mut stacksize = 0;
             if pthread_attr_getstack(&attr, &mut stackaddr, &mut stacksize) != 0 {
-                fail!("failed to get stack information");
+                panic!("failed to get stack information");
             }
             if pthread_attr_destroy(&mut attr) != 0 {
-                fail!("failed to destroy thread attributes");
+                panic!("failed to destroy thread attributes");
             }
             stackaddr
         }
@@ -343,7 +343,7 @@ unsafe fn get_stack_start() -> *mut libc::c_void {
         pub unsafe fn init() {
             let psize = libc::sysconf(libc::consts::os::sysconf::_SC_PAGESIZE);
             if psize == -1 {
-                fail!("failed to get page size");
+                panic!("failed to get page size");
             }
 
             PAGE_SIZE = psize as uint;
@@ -361,7 +361,7 @@ pub unsafe fn init() {
                               0);
 
             if result != stackaddr || result == MAP_FAILED {
-                fail!("failed to allocate a guard page");
+                panic!("failed to allocate a guard page");
             }
 
             let offset = if cfg!(target_os = "linux") {
@@ -387,22 +387,22 @@ pub unsafe fn current() -> uint {
         pub unsafe fn current() -> uint {
             let mut attr: libc::pthread_attr_t = mem::zeroed();
             if pthread_getattr_np(pthread_self(), &mut attr) != 0 {
-                fail!("failed to get thread attributes");
+                panic!("failed to get thread attributes");
             }
             let mut guardsize = 0;
             if pthread_attr_getguardsize(&attr, &mut guardsize) != 0 {
-                fail!("failed to get stack guard page");
+                panic!("failed to get stack guard page");
             }
             if guardsize == 0 {
-                fail!("there is no guard page");
+                panic!("there is no guard page");
             }
             let mut stackaddr = ptr::null_mut();
             let mut stacksize = 0;
             if pthread_attr_getstack(&attr, &mut stackaddr, &mut stacksize) != 0 {
-                fail!("failed to get stack information");
+                panic!("failed to get stack information");
             }
             if pthread_attr_destroy(&mut attr) != 0 {
-                fail!("failed to destroy thread attributes");
+                panic!("failed to destroy thread attributes");
             }
 
             stackaddr as uint + guardsize as uint
@@ -433,7 +433,7 @@ pub unsafe fn create(stack: uint, p: Box<proc():Send>) -> rust_thread {
             },
             errno => {
                 // This cannot really happen.
-                fail!("pthread_attr_setstacksize() error: {}", errno);
+                panic!("pthread_attr_setstacksize() error: {}", errno);
             },
         };
 
@@ -444,7 +444,7 @@ pub unsafe fn create(stack: uint, p: Box<proc():Send>) -> rust_thread {
         if ret != 0 {
             // be sure to not leak the closure
             let _p: Box<proc():Send> = mem::transmute(arg);
-            fail!("failed to spawn native thread: {}", ret);
+            panic!("failed to spawn native thread: {}", ret);
         }
         native
     }
index 9483beca1c39d781878413f1da5d92ffba88d776..96a584492aeda684a648951114e9cc2f855e13a1 100644 (file)
@@ -115,11 +115,11 @@ pub fn unwinding(&self) -> bool {
     }
 }
 
-/// Invoke a closure, capturing the cause of failure if one occurs.
+/// Invoke a closure, capturing the cause of panic if one occurs.
 ///
-/// This function will return `None` if the closure did not fail, and will
-/// return `Some(cause)` if the closure fails. The `cause` returned is the
-/// object with which failure was originally invoked.
+/// This function will return `None` if the closure did not panic, and will
+/// return `Some(cause)` if the closure panics. The `cause` returned is the
+/// object with which panic was originally invoked.
 ///
 /// This function also is unsafe for a variety of reasons:
 ///
@@ -489,9 +489,9 @@ extern "C" fn inner(
     }
 }
 
-// Entry point of failure from the libcore crate
+// Entry point of panic from the libcore crate
 #[cfg(not(test))]
-#[lang = "fail_fmt"]
+#[lang = "panic_fmt"]
 pub extern fn rust_begin_unwind(msg: &fmt::Arguments,
                                 file: &'static str, line: uint) -> ! {
     begin_unwind_fmt(msg, &(file, line))
@@ -500,7 +500,7 @@ extern "C" fn inner(
 /// The entry point for unwinding with a formatted message.
 ///
 /// This is designed to reduce the amount of code required at the call
-/// site as much as possible (so that `fail!()` has as low an impact
+/// site as much as possible (so that `panic!()` has as low an impact
 /// on (e.g.) the inlining of other functions as possible), by moving
 /// the actual formatting into this shared place.
 #[inline(never)] #[cold]
@@ -509,7 +509,7 @@ pub fn begin_unwind_fmt(msg: &fmt::Arguments, file_line: &(&'static str, uint))
 
     // We do two allocations here, unfortunately. But (a) they're
     // required with the current scheme, and (b) we don't handle
-    // failure + OOM properly anyway (see comment in begin_unwind
+    // panic + OOM properly anyway (see comment in begin_unwind
     // below).
 
     struct VecWriter<'a> { v: &'a mut Vec<u8> }
@@ -528,15 +528,15 @@ fn write(&mut self, buf: &[u8]) -> fmt::Result {
     begin_unwind_inner(msg, file_line)
 }
 
-/// This is the entry point of unwinding for fail!() and assert!().
+/// This is the entry point of unwinding for panic!() and assert!().
 #[inline(never)] #[cold] // avoid code bloat at the call sites as much as possible
 pub fn begin_unwind<M: Any + Send>(msg: M, file_line: &(&'static str, uint)) -> ! {
     // Note that this should be the only allocation performed in this code path.
-    // Currently this means that fail!() on OOM will invoke this code path,
-    // but then again we're not really ready for failing on OOM anyway. If
+    // Currently this means that panic!() on OOM will invoke this code path,
+    // but then again we're not really ready for panic on OOM anyway. If
     // we do start doing this, then we should propagate this allocation to
     // be performed in the parent of this task instead of the task that's
-    // failing.
+    // panicking.
 
     // see below for why we do the `Any` coercion here.
     begin_unwind_inner(box msg, file_line)
@@ -549,11 +549,11 @@ pub fn begin_unwind<M: Any + Send>(msg: M, file_line: &(&'static str, uint)) ->
 /// we need the `Any` object anyway, we're not just creating it to
 /// avoid being generic.)
 ///
-/// Do this split took the LLVM IR line counts of `fn main() { fail!()
+/// Do this split took the LLVM IR line counts of `fn main() { panic!()
 /// }` from ~1900/3700 (-O/no opts) to 180/590.
 #[inline(never)] #[cold] // this is the slow path, please never inline this
 fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) -> ! {
-    // First, invoke call the user-defined callbacks triggered on task failure.
+    // First, invoke call the user-defined callbacks triggered on task panic.
     //
     // By the time that we see a callback has been registered (by reading
     // MAX_CALLBACKS), the actual callback itself may have not been stored yet,
@@ -584,7 +584,7 @@ fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) ->
     };
 
     if task.unwinder.unwinding {
-        // If a task fails while it's already unwinding then we
+        // If a task panics while it's already unwinding then we
         // have limited options. Currently our preference is to
         // just abort. In the future we may consider resuming
         // unwinding or otherwise exiting the task cleanly.
@@ -603,7 +603,7 @@ fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) ->
 /// Register a callback to be invoked when a task unwinds.
 ///
 /// This is an unsafe and experimental API which allows for an arbitrary
-/// callback to be invoked when a task fails. This callback is invoked on both
+/// callback to be invoked when a task panics. This callback is invoked on both
 /// the initial unwinding and a double unwinding if one occurs. Additionally,
 /// the local `Task` will be in place for the duration of the callback, and
 /// the callback must ensure that it remains in place once the callback returns.
index 19dcc3c132cd7328a26db09a303ef35ce92b757b..c999157b89a8ffb5d334d343994a230274c059de 100644 (file)
@@ -144,7 +144,7 @@ fn to_base64(&self, config: Config) -> String {
                     v.push(b'=');
                 }
             }
-            _ => fail!("Algebra is broken, please alert the math police")
+            _ => panic!("Algebra is broken, please alert the math police")
         }
 
         unsafe {
index 73b4773fb3ff948f129da4229e9ef840b75f2c8e..99c60dde0ac59c44e70c982364e9b3beae37dca1 100644 (file)
@@ -1229,7 +1229,7 @@ fn bump_index(&mut self) {
         let len = self.stack.len();
         let idx = match *self.stack.last().unwrap() {
             InternalIndex(i) => { i + 1 }
-            _ => { fail!(); }
+            _ => { panic!(); }
         };
         *self.stack.get_mut(len - 1) = InternalIndex(idx);
     }
@@ -1814,7 +1814,7 @@ pub fn build(&mut self) -> Result<Json, BuilderError> {
         match self.token {
             None => {}
             Some(Error(e)) => { return Err(e); }
-            ref tok => { fail!("unexpected token {}", tok.clone()); }
+            ref tok => { panic!("unexpected token {}", tok.clone()); }
         }
         result
     }
@@ -1874,7 +1874,7 @@ fn build_object(&mut self) -> Result<Json, BuilderError> {
             }
             let key = match self.parser.stack().top() {
                 Some(Key(k)) => { k.to_string() }
-                _ => { fail!("invalid state"); }
+                _ => { panic!("invalid state"); }
             };
             match self.build_value() {
                 Ok(value) => { values.insert(key, value); }
@@ -3015,9 +3015,9 @@ fn check_err<T: Decodable<Decoder, DecoderError>>(to_parse: &'static str,
             Ok(json) => Decodable::decode(&mut Decoder::new(json))
         };
         match res {
-            Ok(_) => fail!("`{}` parsed & decoded ok, expecting error `{}`",
+            Ok(_) => panic!("`{}` parsed & decoded ok, expecting error `{}`",
                               to_parse, expected),
-            Err(ParseError(e)) => fail!("`{}` is not valid json: {}",
+            Err(ParseError(e)) => panic!("`{}` is not valid json: {}",
                                            to_parse, e),
             Err(e) => {
                 assert_eq!(e, expected);
@@ -3226,7 +3226,7 @@ fn test_encode_hashmap_with_numeric_key() {
         let bytes = mem_buf.unwrap();
         let json_str = from_utf8(bytes.as_slice()).unwrap();
         match from_str(json_str) {
-            Err(_) => fail!("Unable to parse json_str: {}", json_str),
+            Err(_) => panic!("Unable to parse json_str: {}", json_str),
             _ => {} // it parsed and we are good to go
         }
     }
@@ -3247,7 +3247,7 @@ fn test_prettyencode_hashmap_with_numeric_key() {
         let bytes = mem_buf.unwrap();
         let json_str = from_utf8(bytes.as_slice()).unwrap();
         match from_str(json_str) {
-            Err(_) => fail!("Unable to parse json_str: {}", json_str),
+            Err(_) => panic!("Unable to parse json_str: {}", json_str),
             _ => {} // it parsed and we are good to go
         }
     }
@@ -3315,7 +3315,7 @@ fn test_hashmap_with_numeric_key_can_handle_double_quote_delimited_key() {
         use Decodable;
         let json_str = "{\"1\":true}";
         let json_obj = match from_str(json_str) {
-            Err(_) => fail!("Unable to parse json_str: {}", json_str),
+            Err(_) => panic!("Unable to parse json_str: {}", json_str),
             Ok(o) => o
         };
         let mut decoder = Decoder::new(json_obj);
@@ -3328,7 +3328,7 @@ fn test_hashmap_with_numeric_key_will_error_with_string_keys() {
         use Decodable;
         let json_str = "{\"a\":true}";
         let json_obj = match from_str(json_str) {
-            Err(_) => fail!("Unable to parse json_str: {}", json_str),
+            Err(_) => panic!("Unable to parse json_str: {}", json_str),
             Ok(o) => o
         };
         let mut decoder = Decoder::new(json_obj);
@@ -3347,7 +3347,7 @@ fn assert_stream_equal(src: &str,
             };
             let (ref expected_evt, ref expected_stack) = expected[i];
             if !parser.stack().is_equal_to(expected_stack.as_slice()) {
-                fail!("Parser stack is not equal to {}", expected_stack);
+                panic!("Parser stack is not equal to {}", expected_stack);
             }
             assert_eq!(&evt, expected_evt);
             i+=1;
index 6b6b08c5e6e3aefa4115d89eed695e1e892d4124..33c8e94e32b60915e7390fccbe26992799b79113 100644 (file)
@@ -138,7 +138,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 /// Trait for converting into an ascii type.
 pub trait AsciiCast<T> {
-    /// Convert to an ascii type, fail on non-ASCII input.
+    /// Convert to an ascii type, panic on non-ASCII input.
     #[inline]
     fn to_ascii(&self) -> T {
         assert!(self.is_ascii());
@@ -649,16 +649,16 @@ fn test_ascii_to_bytes() {
     }
 
     #[test] #[should_fail]
-    fn test_ascii_vec_fail_u8_slice()  { (&[127u8, 128u8, 255u8]).to_ascii(); }
+    fn test_ascii_vec_panic_u8_slice()  { (&[127u8, 128u8, 255u8]).to_ascii(); }
 
     #[test] #[should_fail]
-    fn test_ascii_vec_fail_str_slice() { "zoä华".to_ascii(); }
+    fn test_ascii_vec_panic_str_slice() { "zoä华".to_ascii(); }
 
     #[test] #[should_fail]
-    fn test_ascii_fail_u8_slice() { 255u8.to_ascii(); }
+    fn test_ascii_panic_u8_slice() { 255u8.to_ascii(); }
 
     #[test] #[should_fail]
-    fn test_ascii_fail_char_slice() { 'λ'.to_ascii(); }
+    fn test_ascii_panic_char_slice() { 'λ'.to_ascii(); }
 
     #[test]
     fn test_opt() {
index 7ec25acb17308af454bb12f65c99d1ec08bc667d..bb7de168898f0b820a5f42064521bf950c2e1778 100644 (file)
@@ -169,7 +169,7 @@ mod tests {
     fn malloc(n: uint) -> CVec<u8> {
         unsafe {
             let mem = libc::malloc(n as libc::size_t);
-            if mem.is_null() { fail!("out of memory") }
+            if mem.is_null() { panic!("out of memory") }
 
             CVec::new_with_dtor(mem as *mut u8, n,
                 proc() { libc::free(mem as *mut libc::c_void); })
@@ -189,7 +189,7 @@ fn test_basic() {
 
     #[test]
     #[should_fail]
-    fn test_fail_at_null() {
+    fn test_panic_at_null() {
         unsafe {
             CVec::new(ptr::null_mut::<u8>(), 9);
         }
@@ -213,7 +213,7 @@ fn test_overrun_set() {
     fn test_unwrap() {
         unsafe {
             let cv = CVec::new_with_dtor(1 as *mut int, 0,
-                proc() { fail!("Don't run this destructor!") });
+                proc() { panic!("Don't run this destructor!") });
             let p = cv.unwrap();
             assert_eq!(p, 1 as *mut int);
         }
index ac0d117e02a114d732ebd7633dab0136b315ac4f..6562a644988e6f32d4be9c72e532629eba97b431 100644 (file)
@@ -120,8 +120,7 @@ fn reserve(&mut self, new_capacity: uint) {
 // is also memory and cache pressure that this would entail that would be very
 // difficult to properly see in a microbenchmark.
 //
-// Future Improvements (FIXME!)
-// ============================
+// ## Future Improvements (FIXME!)
 //
 // Allow the load factor to be changed dynamically and/or at initialization.
 //
@@ -129,8 +128,7 @@ fn reserve(&mut self, new_capacity: uint) {
 // underlying table? This is exactly the use case for 'realloc', and may
 // be worth exploring.
 //
-// Future Optimizations (FIXME!)
-// =============================
+// ## Future Optimizations (FIXME!)
 //
 // Another possible design choice that I made without any real reason is
 // parameterizing the raw table over keys and values. Technically, all we need
@@ -473,7 +471,7 @@ fn insert_hashed_ordered(&mut self, hash: SafeHash, k: K, v: V) {
             };
             buckets.next();
         }
-        fail!("Internal HashMap error: Out of space.");
+        panic!("Internal HashMap error: Out of space.");
     }
 }
 
@@ -829,7 +827,8 @@ fn insert_or_replace_with<'a>(&'a mut self,
     }
 
     /// Retrieves a mutable value for the given key.
-    /// See [`find_mut`](../trait.MutableMap.html#tymethod.find_mut) for a non-failing alternative.
+    /// See [`find_mut`](../trait.MutableMap.html#tymethod.find_mut) for a non-panicking
+    /// alternative.
     ///
     /// # Failure
     ///
@@ -856,7 +855,7 @@ fn insert_or_replace_with<'a>(&'a mut self,
     pub fn get_mut<'a>(&'a mut self, k: &K) -> &'a mut V {
         match self.find_mut(k) {
             Some(v) => v,
-            None => fail!("no entry found for key")
+            None => panic!("no entry found for key")
         }
     }
 
@@ -1625,7 +1624,7 @@ fn test_find_mut() {
         assert!(m.insert(5i, 14i));
         let new = 100;
         match m.find_mut(&5) {
-            None => fail!(), Some(x) => *x = new
+            None => panic!(), Some(x) => *x = new
         }
         assert_eq!(m.find(&5), Some(&new));
     }
@@ -1746,7 +1745,7 @@ fn test_find() {
         assert!(m.find(&1i).is_none());
         m.insert(1i, 2i);
         match m.find(&1) {
-            None => fail!(),
+            None => panic!(),
             Some(v) => assert_eq!(*v, 2)
         }
     }
@@ -1759,12 +1758,12 @@ fn test_find_copy() {
         for i in range(1i, 10000) {
             m.insert(i, i + 7);
             match m.find_copy(&i) {
-                None => fail!(),
+                None => panic!(),
                 Some(v) => assert_eq!(v, i + 7)
             }
             for j in range(1i, i/100) {
                 match m.find_copy(&j) {
-                    None => fail!(),
+                    None => panic!(),
                     Some(v) => assert_eq!(v, j + 7)
                 }
             }
index ee64a7931c06242d887e9f222da7e5443606e3c3..ca20c3ddb74f02f1b36cad22c2f3ec2b8add85c7 100644 (file)
@@ -470,7 +470,7 @@ impl<K, V, M> BucketState<K, V, M> {
     pub fn expect_full(self) -> FullBucket<K, V, M> {
         match self {
             Full(full) => full,
-            Empty(..) => fail!("Expected full bucket")
+            Empty(..) => panic!("Expected full bucket")
         }
     }
 }
index ed8ff821f5cad67ffb9fe8cf8d4676de555b1019..c2f27caad1d9c6758690b4a3b7b3abe75d5862b4 100644 (file)
@@ -44,7 +44,7 @@ fn drop(&mut self) {
             }
         }) {
             Ok(()) => {},
-            Err(str) => fail!("{}", str)
+            Err(str) => panic!("{}", str)
         }
     }
 }
@@ -168,13 +168,13 @@ fn test_loading_cosine() {
         // statically linked in
         let none: Option<Path> = None; // appease the typechecker
         let libm = match DynamicLibrary::open(none) {
-            Err(error) => fail!("Could not load self as module: {}", error),
+            Err(error) => panic!("Could not load self as module: {}", error),
             Ok(libm) => libm
         };
 
         let cosine: extern fn(libc::c_double) -> libc::c_double = unsafe {
             match libm.symbol("cos") {
-                Err(error) => fail!("Could not load function cos: {}", error),
+                Err(error) => panic!("Could not load function cos: {}", error),
                 Ok(cosine) => mem::transmute::<*mut u8, _>(cosine)
             }
         };
@@ -183,7 +183,7 @@ fn test_loading_cosine() {
         let expected_result = 1.0;
         let result = cosine(argument);
         if result != expected_result {
-            fail!("cos({}) != {} but equaled {} instead", argument,
+            panic!("cos({}) != {} but equaled {} instead", argument,
                    expected_result, result)
         }
     }
@@ -199,7 +199,7 @@ fn test_errors_do_not_crash() {
         let path = Path::new("/dev/null");
         match DynamicLibrary::open(Some(&path)) {
             Err(_) => {}
-            Ok(_) => fail!("Successfully opened the empty library.")
+            Ok(_) => panic!("Successfully opened the empty library.")
         }
     }
 }
index a7de84184ff5db719651ce22e92fb55a5d61c1f5..077599743564151b5b72ec5cd43184d26d71044c 100644 (file)
@@ -51,11 +51,11 @@ pub fn on_fail(obj: &Any + Send, file: &'static str, line: uint) {
     // all times. This means that this `exists` will return true almost all of
     // the time. There are border cases, however, when the runtime has
     // *almost* set up the local task, but hasn't quite gotten there yet. In
-    // order to get some better diagnostics, we print on failure and
+    // order to get some better diagnostics, we print on panic and
     // immediately abort the whole process if there is no local task
     // available.
     if !Local::exists(None::<Task>) {
-        let _ = writeln!(&mut err, "failed at '{}', {}:{}", msg, file, line);
+        let _ = writeln!(&mut err, "panicked at '{}', {}:{}", msg, file, line);
         if backtrace::log_enabled() {
             let _ = backtrace::write(&mut err);
         } else {
@@ -76,9 +76,9 @@ pub fn on_fail(obj: &Any + Send, file: &'static str, line: uint) {
 
         match local_stderr.replace(None) {
             Some(mut stderr) => {
-                // FIXME: what to do when the task printing fails?
+                // FIXME: what to do when the task printing panics?
                 let _ = writeln!(stderr,
-                                 "task '{}' failed at '{}', {}:{}\n",
+                                 "task '{}' panicked at '{}', {}:{}\n",
                                  n, msg, file, line);
                 if backtrace::log_enabled() {
                     let _ = backtrace::write(&mut *stderr);
@@ -86,7 +86,7 @@ pub fn on_fail(obj: &Any + Send, file: &'static str, line: uint) {
                 local_stderr.replace(Some(stderr));
             }
             None => {
-                let _ = writeln!(&mut err, "task '{}' failed at '{}', {}:{}",
+                let _ = writeln!(&mut err, "task '{}' panicked at '{}', {}:{}",
                                  n, msg, file, line);
                 if backtrace::log_enabled() {
                     let _ = backtrace::write(&mut err);
@@ -94,8 +94,8 @@ pub fn on_fail(obj: &Any + Send, file: &'static str, line: uint) {
             }
         }
 
-        // If this is a double failure, make sure that we printed a backtrace
-        // for this failure.
+        // If this is a double panic, make sure that we printed a backtrace
+        // for this panic.
         if unwinding && !backtrace::log_enabled() {
             let _ = backtrace::write(&mut err);
         }
index 95c44e6a3fc89c94712e0611a12f3d42b534a521..9cd8dbcc509498fe2b6974d64e92d5b2483040c5 100644 (file)
@@ -183,7 +183,7 @@ pub fn get_ref<'a>(&'a self) -> &'a W { self.inner.as_ref().unwrap() }
     ///
     /// The buffer is flushed before returning the writer.
     pub fn unwrap(mut self) -> W {
-        // FIXME(#12628): is failing the right thing to do if flushing fails?
+        // FIXME(#12628): is panicking the right thing to do if flushing panicks?
         self.flush_buf().unwrap();
         self.inner.take().unwrap()
     }
@@ -214,7 +214,7 @@ fn flush(&mut self) -> IoResult<()> {
 impl<W: Writer> Drop for BufferedWriter<W> {
     fn drop(&mut self) {
         if self.inner.is_some() {
-            // dtors should not fail, so we ignore a failed flush
+            // dtors should not panic, so we ignore a panicked flush
             let _ = self.flush_buf();
         }
     }
@@ -612,7 +612,7 @@ fn test_chars() {
 
     #[test]
     #[should_fail]
-    fn dont_fail_in_drop_on_failed_flush() {
+    fn dont_panic_in_drop_on_panicked_flush() {
         struct FailFlushWriter;
 
         impl Writer for FailFlushWriter {
@@ -623,9 +623,8 @@ fn flush(&mut self) -> IoResult<()> { Err(io::standard_error(EndOfFile)) }
         let writer = FailFlushWriter;
         let _writer = BufferedWriter::new(writer);
 
-        // Trigger failure. If writer fails *again* due to the flush
-        // error then the process will abort.
-        fail!();
+        // If writer panics *again* due to the flush error then the process will abort.
+        panic!();
     }
 
     #[bench]
index bd9577c8cfc8cf3dcf8a1d70e8a46c7800ce34c7..07f4ebda2d41aa4f4d60ba53bcd696dcb62e0f96 100644 (file)
@@ -188,14 +188,14 @@ fn test_rx_reader() {
         assert_eq!(a, buf.as_slice());
 
         match reader.read(buf.as_mut_slice()) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => assert_eq!(e.kind, io::EndOfFile),
         }
         assert_eq!(a, buf.as_slice());
 
-        // Ensure it continues to fail in the same way.
+        // Ensure it continues to panic in the same way.
         match reader.read(buf.as_mut_slice()) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => assert_eq!(e.kind, io::EndOfFile),
         }
         assert_eq!(a, buf.as_slice());
@@ -218,7 +218,7 @@ fn test_rx_buffer() {
         assert_eq!(Ok("hello world\n".to_string()), reader.read_line());
         assert_eq!(Ok("how are you?".to_string()), reader.read_line());
         match reader.read_line() {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => assert_eq!(e.kind, io::EndOfFile),
         }
     }
@@ -232,12 +232,12 @@ fn test_chan_writer() {
         let wanted = vec![0u8, 0u8, 0u8, 42u8];
         let got = match task::try(proc() { rx.recv() }) {
             Ok(got) => got,
-            Err(_) => fail!(),
+            Err(_) => panic!(),
         };
         assert_eq!(wanted, got);
 
         match writer.write_u8(1) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => assert_eq!(e.kind, io::BrokenPipe),
         }
     }
index 57741db5ae2182bd4b27574cc798910bf9e694b7..a595921fcf72d549a347d9918a2ede003010f6e0 100644 (file)
@@ -70,7 +70,7 @@ fn next(&mut self) -> Option<IoResult<u8>> {
 ///
 /// * `n`: The value to convert.
 /// * `size`: The size of the value, in bytes. This must be 8 or less, or task
-///           failure occurs. If this is less than 8, then a value of that
+///           panic occurs. If this is less than 8, then a value of that
 ///           many bytes is produced. For example, if `size` is 4, then a
 ///           32-bit byte representation is produced.
 /// * `f`: A callback that receives the value.
@@ -109,7 +109,7 @@ pub fn u64_to_le_bytes<T>(n: u64, size: uint, f: |v: &[u8]| -> T) -> T {
 ///
 /// * `n`: The value to convert.
 /// * `size`: The size of the value, in bytes. This must be 8 or less, or task
-///           failure occurs. If this is less than 8, then a value of that
+///           panic occurs. If this is less than 8, then a value of that
 ///           many bytes is produced. For example, if `size` is 4, then a
 ///           32-bit byte representation is produced.
 /// * `f`: A callback that receives the value.
@@ -146,7 +146,7 @@ pub fn u64_to_be_bytes<T>(n: u64, size: uint, f: |v: &[u8]| -> T) -> T {
 /// * `data`: The buffer in which to extract the value.
 /// * `start`: The offset at which to extract the value.
 /// * `size`: The size of the value in bytes to extract. This must be 8 or
-///           less, or task failure occurs. If this is less than 8, then only
+///           less, or task panic occurs. If this is less than 8, then only
 ///           that many bytes are parsed. For example, if `size` is 4, then a
 ///           32-bit value is parsed.
 pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
@@ -156,7 +156,7 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
     assert!(size <= 8u);
 
     if data.len() - start < size {
-        fail!("index out of bounds");
+        panic!("index out of bounds");
     }
 
     let mut buf = [0u8, ..8];
index 8632fc63e52f87d79865dfe8c01cee79a51d691c..f749d6c823ea3b399055b0b1fda3105b879cead7 100644 (file)
@@ -105,7 +105,7 @@ impl File {
     ///
     /// let file = match File::open_mode(&p, Open, ReadWrite) {
     ///     Ok(f) => f,
-    ///     Err(e) => fail!("file error: {}", e),
+    ///     Err(e) => panic!("file error: {}", e),
     /// };
     /// // do some stuff with that file
     ///
@@ -957,13 +957,13 @@ mod test {
     macro_rules! check( ($e:expr) => (
         match $e {
             Ok(t) => t,
-            Err(e) => fail!("{} failed with: {}", stringify!($e), e),
+            Err(e) => panic!("{} failed with: {}", stringify!($e), e),
         }
     ) )
 
     macro_rules! error( ($e:expr, $s:expr) => (
         match $e {
-            Ok(val) => fail!("Unexpected success. Should've been: {}", $s),
+            Ok(val) => panic!("Unexpected success. Should've been: {}", $s),
             Err(ref err) => assert!(err.to_string().as_slice().contains($s.as_slice()),
                                     format!("`{}` did not contain `{}`", err, $s))
         }
@@ -1013,7 +1013,7 @@ fn file_test_io_smoke_test() {
             let mut read_stream = File::open_mode(filename, Open, Read);
             let mut read_buf = [0, .. 1028];
             let read_str = match check!(read_stream.read(read_buf)) {
-                -1|0 => fail!("shouldn't happen"),
+                -1|0 => panic!("shouldn't happen"),
                 n => str::from_utf8(read_buf[..n]).unwrap().to_string()
             };
             assert_eq!(read_str.as_slice(), message);
@@ -1241,7 +1241,7 @@ fn file_test_directoryinfo_readdir() {
                 check!(File::open(f).read(mem));
                 let read_str = str::from_utf8(mem).unwrap();
                 let expected = match n {
-                    None|Some("") => fail!("really shouldn't happen.."),
+                    None|Some("") => panic!("really shouldn't happen.."),
                     Some(n) => format!("{}{}", prefix, n),
                 };
                 assert_eq!(expected.as_slice(), read_str);
@@ -1371,7 +1371,7 @@ fn copy_file_does_not_exist() {
                     from.display(), to.display()));
 
         match copy(&from, &to) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(..) => {
                 assert!(!from.exists());
                 assert!(!to.exists());
@@ -1400,7 +1400,7 @@ fn copy_file_dst_dir() {
 
         check!(File::create(&out));
         match copy(&out, tmpdir.path()) {
-            Ok(..) => fail!(), Err(..) => {}
+            Ok(..) => panic!(), Err(..) => {}
         }
     }
 
@@ -1424,7 +1424,7 @@ fn copy_file_src_dir() {
         let out = tmpdir.join("out");
 
         match copy(tmpdir.path(), &out) {
-            Ok(..) => fail!(), Err(..) => {}
+            Ok(..) => panic!(), Err(..) => {}
         }
         assert!(!out.exists());
     }
@@ -1475,7 +1475,7 @@ fn symlink_noexist() {
     fn readlink_not_symlink() {
         let tmpdir = tmpdir();
         match readlink(tmpdir.path()) {
-            Ok(..) => fail!("wanted a failure"),
+            Ok(..) => panic!("wanted a failure"),
             Err(..) => {}
         }
     }
@@ -1501,12 +1501,12 @@ fn links_work() {
 
         // can't link to yourself
         match link(&input, &input) {
-            Ok(..) => fail!("wanted a failure"),
+            Ok(..) => panic!("wanted a failure"),
             Err(..) => {}
         }
         // can't link to something that doesn't exist
         match link(&tmpdir.join("foo"), &tmpdir.join("bar")) {
-            Ok(..) => fail!("wanted a failure"),
+            Ok(..) => panic!("wanted a failure"),
             Err(..) => {}
         }
     }
@@ -1522,7 +1522,7 @@ fn chmod_works() {
         assert!(!check!(stat(&file)).perm.contains(io::USER_WRITE));
 
         match chmod(&tmpdir.join("foo"), io::USER_RWX) {
-            Ok(..) => fail!("wanted a failure"),
+            Ok(..) => panic!("wanted a panic"),
             Err(..) => {}
         }
 
@@ -1580,7 +1580,7 @@ fn open_flavors() {
         let tmpdir = tmpdir();
 
         match File::open_mode(&tmpdir.join("a"), io::Open, io::Read) {
-            Ok(..) => fail!(), Err(..) => {}
+            Ok(..) => panic!(), Err(..) => {}
         }
 
         // Perform each one twice to make sure that it succeeds the second time
@@ -1615,7 +1615,7 @@ fn open_flavors() {
             let mut f = check!(File::open_mode(&tmpdir.join("h"), io::Open,
                                                io::Read));
             match f.write("wut".as_bytes()) {
-                Ok(..) => fail!(), Err(..) => {}
+                Ok(..) => panic!(), Err(..) => {}
             }
         }
         assert!(check!(stat(&tmpdir.join("h"))).size == 3,
@@ -1653,7 +1653,7 @@ fn utime_noexist() {
         let tmpdir = tmpdir();
 
         match change_file_times(&tmpdir.join("a"), 100, 200) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(..) => {}
         }
     }
index dd4a3e0593594100dacb97bcf0f56ef26a1acf4f..2f6dd7e47955fd703b5e0dc76f7861c125c573e4 100644 (file)
@@ -409,7 +409,7 @@ fn test_buf_writer_error() {
         writer.write([0]).unwrap();
 
         match writer.write([0, 0]) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => assert_eq!(e.kind, io::OtherIoError),
         }
     }
@@ -510,7 +510,7 @@ fn test_read_whole_string_bad() {
         let buf = [0xff];
         let mut r = BufReader::new(buf);
         match r.read_to_string() {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(..) => {}
         }
     }
index 8592d48974a25f8c143a202cb01b2dbf4fddbc58..7826a6dd9c68e88927ff0d4107150ce096a24fc7 100644 (file)
@@ -1730,7 +1730,7 @@ pub enum FileType {
 /// # fn foo() {
 /// let info = match Path::new("foo.txt").stat() {
 ///     Ok(stat) => stat,
-///     Err(e) => fail!("couldn't read foo.txt: {}", e),
+///     Err(e) => panic!("couldn't read foo.txt: {}", e),
 /// };
 ///
 /// println!("byte size: {}", info.size);
index e0cf761fdbd7e7bde3bd436796b1e77a7b47346c..112094d1d39b366477ee2754f9ec99327872a8fb 100644 (file)
@@ -269,13 +269,13 @@ pub fn smalltest(server: proc(UnixStream):Send, client: proc(UnixStream):Send) {
         spawn(proc() {
             match UnixStream::connect(&path2) {
                 Ok(c) => client(c),
-                Err(e) => fail!("failed connect: {}", e),
+                Err(e) => panic!("failed connect: {}", e),
             }
         });
 
         match acceptor.accept() {
             Ok(c) => server(c),
-            Err(e) => fail!("failed accept: {}", e),
+            Err(e) => panic!("failed accept: {}", e),
         }
     }
 
@@ -283,7 +283,7 @@ pub fn smalltest(server: proc(UnixStream):Send, client: proc(UnixStream):Send) {
     fn bind_error() {
         let path = "path/to/nowhere";
         match UnixListener::bind(&path) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => {
                 assert!(e.kind == PermissionDenied || e.kind == FileNotFound ||
                         e.kind == InvalidInput);
@@ -299,7 +299,7 @@ fn connect_error() {
             "path/to/nowhere"
         };
         match UnixStream::connect(&path) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => {
                 assert!(e.kind == FileNotFound || e.kind == OtherIoError);
             }
@@ -358,7 +358,7 @@ fn accept_lots() {
 
         let mut acceptor = match UnixListener::bind(&path1).listen() {
             Ok(a) => a,
-            Err(e) => fail!("failed listen: {}", e),
+            Err(e) => panic!("failed listen: {}", e),
         };
 
         spawn(proc() {
@@ -366,7 +366,7 @@ fn accept_lots() {
                 let mut stream = UnixStream::connect(&path2);
                 match stream.write([100]) {
                     Ok(..) => {}
-                    Err(e) => fail!("failed write: {}", e)
+                    Err(e) => panic!("failed write: {}", e)
                 }
             }
         });
@@ -376,7 +376,7 @@ fn accept_lots() {
             let mut buf = [0];
             match client.read(buf) {
                 Ok(..) => {}
-                Err(e) => fail!("failed read/accept: {}", e),
+                Err(e) => panic!("failed read/accept: {}", e),
             }
             assert_eq!(buf[0], 100);
         }
@@ -531,10 +531,10 @@ fn accept_timeout() {
             match a.accept() {
                 Ok(..) => break,
                 Err(ref e) if e.kind == TimedOut => {}
-                Err(e) => fail!("error: {}", e),
+                Err(e) => panic!("error: {}", e),
             }
             ::task::deschedule();
-            if i == 1000 { fail!("should have a pending connection") }
+            if i == 1000 { panic!("should have a pending connection") }
         }
         drop(l);
 
@@ -659,9 +659,9 @@ fn readwrite_timeouts() {
             match s.write([0, .. 128 * 1024]) {
                 Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
                 Err(IoError { kind: TimedOut, .. }) => break,
-                Err(e) => fail!("{}", e),
+                Err(e) => panic!("{}", e),
            }
-           if i == 1000 { fail!("should have filled up?!"); }
+           if i == 1000 { panic!("should have filled up?!"); }
         }
 
         // I'm not sure as to why, but apparently the write on windows always
@@ -687,7 +687,7 @@ fn read_timeouts() {
             while amt < 100 * 128 * 1024 {
                 match s.read([0, ..128 * 1024]) {
                     Ok(n) => { amt += n; }
-                    Err(e) => fail!("{}", e),
+                    Err(e) => panic!("{}", e),
                 }
             }
             let _ = rx.recv_opt();
@@ -722,9 +722,9 @@ fn write_timeouts() {
             match s.write([0, .. 128 * 1024]) {
                 Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
                 Err(IoError { kind: TimedOut, .. }) => break,
-                Err(e) => fail!("{}", e),
+                Err(e) => panic!("{}", e),
            }
-           if i == 1000 { fail!("should have filled up?!"); }
+           if i == 1000 { panic!("should have filled up?!"); }
         }
 
         tx.send(());
index d6528ce977e9821e8c9c7412b40c24fca6052894..09804ef57031384425c3669532410afd2e3612ee 100644 (file)
@@ -471,7 +471,7 @@ impl TcpAcceptor {
     ///         match socket {
     ///             Ok(s) => { /* handle s */ }
     ///             Err(ref e) if e.kind == EndOfFile => break, // closed
-    ///             Err(e) => fail!("unexpected error: {}", e),
+    ///             Err(e) => panic!("unexpected error: {}", e),
     ///         }
     ///     }
     /// });
@@ -532,7 +532,7 @@ mod test {
     #[test]
     fn bind_error() {
         match TcpListener::bind("0.0.0.0", 1) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => assert_eq!(e.kind, PermissionDenied),
         }
     }
@@ -540,7 +540,7 @@ fn bind_error() {
     #[test]
     fn connect_error() {
         match TcpStream::connect("0.0.0.0", 1) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => assert_eq!(e.kind, ConnectionRefused),
         }
     }
@@ -708,7 +708,7 @@ fn read_eof_twice_ip4() {
         assert!(nread.is_err());
 
         match stream.read(buf) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(ref e) => {
                 assert!(e.kind == NotConnected || e.kind == EndOfFile,
                         "unknown kind: {}", e.kind);
@@ -734,7 +734,7 @@ fn read_eof_twice_ip6() {
         assert!(nread.is_err());
 
         match stream.read(buf) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(ref e) => {
                 assert!(e.kind == NotConnected || e.kind == EndOfFile,
                         "unknown kind: {}", e.kind);
@@ -1082,7 +1082,7 @@ fn double_bind() {
         let listener = TcpListener::bind(ip_str.as_slice(), port).unwrap().listen();
         assert!(listener.is_ok());
         match TcpListener::bind(ip_str.as_slice(), port).listen() {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => {
                 assert!(e.kind == ConnectionRefused || e.kind == OtherIoError,
                         "unknown error: {} {}", e, e.kind);
@@ -1266,10 +1266,10 @@ fn accept_timeout() {
                 match a.accept() {
                     Ok(..) => break,
                     Err(ref e) if e.kind == TimedOut => {}
-                    Err(e) => fail!("error: {}", e),
+                    Err(e) => panic!("error: {}", e),
                 }
                 ::task::deschedule();
-                if i == 1000 { fail!("should have a pending connection") }
+                if i == 1000 { panic!("should have a pending connection") }
             }
         }
 
@@ -1373,9 +1373,9 @@ fn readwrite_timeouts() {
             match s.write([0, .. 128 * 1024]) {
                 Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
                 Err(IoError { kind: TimedOut, .. }) => break,
-                Err(e) => fail!("{}", e),
+                Err(e) => panic!("{}", e),
            }
-           if i == 1000 { fail!("should have filled up?!"); }
+           if i == 1000 { panic!("should have filled up?!"); }
         }
         assert_eq!(s.write([0]).err().unwrap().kind, TimedOut);
 
@@ -1398,7 +1398,7 @@ fn read_timeouts() {
             while amt < 100 * 128 * 1024 {
                 match s.read([0, ..128 * 1024]) {
                     Ok(n) => { amt += n; }
-                    Err(e) => fail!("{}", e),
+                    Err(e) => panic!("{}", e),
                 }
             }
             let _ = rx.recv_opt();
@@ -1435,9 +1435,9 @@ fn write_timeouts() {
             match s.write([0, .. 128 * 1024]) {
                 Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
                 Err(IoError { kind: TimedOut, .. }) => break,
-                Err(e) => fail!("{}", e),
+                Err(e) => panic!("{}", e),
            }
-           if i == 1000 { fail!("should have filled up?!"); }
+           if i == 1000 { panic!("should have filled up?!"); }
         }
         assert_eq!(s.write([0]).err().unwrap().kind, TimedOut);
 
index 7d9eea3a73279bf535fdeb6cc8cb230fe6bf6718..ad9ed090a5ba667cbed3d866b36c452e53532c84 100644 (file)
@@ -43,7 +43,7 @@
 ///     let addr = SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 34254 };
 ///     let mut socket = match UdpSocket::bind(addr) {
 ///         Ok(s) => s,
-///         Err(e) => fail!("couldn't bind socket: {}", e),
+///         Err(e) => panic!("couldn't bind socket: {}", e),
 ///     };
 ///
 ///     let mut buf = [0, ..10];
@@ -271,7 +271,7 @@ mod test {
     fn bind_error() {
         let addr = SocketAddr { ip: Ipv4Addr(0, 0, 0, 0), port: 1 };
         match UdpSocket::bind(addr) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => assert_eq!(e.kind, PermissionDenied),
         }
     }
@@ -289,7 +289,7 @@ fn socket_smoke_test_ip4() {
                     rx1.recv();
                     client.send_to([99], server_ip).unwrap()
                 }
-                Err(..) => fail!()
+                Err(..) => panic!()
             }
             tx2.send(());
         });
@@ -304,10 +304,10 @@ fn socket_smoke_test_ip4() {
                         assert_eq!(buf[0], 99);
                         assert_eq!(src, client_ip);
                     }
-                    Err(..) => fail!()
+                    Err(..) => panic!()
                 }
             }
-            Err(..) => fail!()
+            Err(..) => panic!()
         }
         rx2.recv();
     }
@@ -324,7 +324,7 @@ fn socket_smoke_test_ip6() {
                     rx.recv();
                     client.send_to([99], server_ip).unwrap()
                 }
-                Err(..) => fail!()
+                Err(..) => panic!()
             }
         });
 
@@ -338,10 +338,10 @@ fn socket_smoke_test_ip6() {
                         assert_eq!(buf[0], 99);
                         assert_eq!(src, client_ip);
                     }
-                    Err(..) => fail!()
+                    Err(..) => panic!()
                 }
             }
-            Err(..) => fail!()
+            Err(..) => panic!()
         }
     }
 
@@ -362,7 +362,7 @@ fn stream_smoke_test_ip4() {
                         let mut stream = client.connect(server_ip);
                         stream.write(val).unwrap();
                     }
-                    Err(..) => fail!()
+                    Err(..) => panic!()
                 }
             };
             rx1.recv();
@@ -382,10 +382,10 @@ fn stream_smoke_test_ip4() {
                         assert_eq!(nread, 1);
                         assert_eq!(buf[0], 99);
                     }
-                    Err(..) => fail!(),
+                    Err(..) => panic!(),
                 }
             }
-            Err(..) => fail!()
+            Err(..) => panic!()
         }
         rx2.recv();
     }
@@ -406,7 +406,7 @@ fn stream_smoke_test_ip6() {
                     rx1.recv();
                     stream.write([99]).unwrap();
                 }
-                Err(..) => fail!()
+                Err(..) => panic!()
             }
             tx2.send(());
         });
@@ -422,10 +422,10 @@ fn stream_smoke_test_ip6() {
                         assert_eq!(nread, 1);
                         assert_eq!(buf[0], 99);
                     }
-                    Err(..) => fail!()
+                    Err(..) => panic!()
                 }
             }
-            Err(..) => fail!()
+            Err(..) => panic!()
         }
         rx2.recv();
     }
@@ -535,7 +535,7 @@ fn udp_clone_two_write() {
             rx.recv();
             match sock2.recv_from(buf) {
                 Ok(..) => {}
-                Err(e) => fail!("failed receive: {}", e),
+                Err(e) => panic!("failed receive: {}", e),
             }
             serv_tx.send(());
         });
@@ -612,7 +612,7 @@ fn send_to_timeout() {
             match a.send_to([0, ..4*1024], addr2) {
                 Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
                 Err(IoError { kind: TimedOut, .. }) => break,
-                Err(e) => fail!("other error: {}", e),
+                Err(e) => panic!("other error: {}", e),
             }
         }
     }
index 88f8434b9576e12dcfe9fd8380bc482e40991871..36d235907046d3537072b5866de4f11e6819c93c 100644 (file)
@@ -56,7 +56,7 @@
 ///
 /// let mut child = match Command::new("/bin/cat").arg("file.txt").spawn() {
 ///     Ok(child) => child,
-///     Err(e) => fail!("failed to execute child: {}", e),
+///     Err(e) => panic!("failed to execute child: {}", e),
 /// };
 ///
 /// let contents = child.stdout.as_mut().unwrap().read_to_end();
@@ -145,7 +145,7 @@ fn eq(&self, other: &EnvKey) -> bool {
 ///
 /// let mut process = match Command::new("sh").arg("-c").arg("echo hello").spawn() {
 ///   Ok(p) => p,
-///   Err(e) => fail!("failed to execute process: {}", e),
+///   Err(e) => panic!("failed to execute process: {}", e),
 /// };
 ///
 /// let output = process.stdout.as_mut().unwrap().read_to_end();
@@ -372,7 +372,7 @@ fn to_rtio(p: StdioContainer) -> rtio::StdioContainer {
     ///
     /// let output = match Command::new("cat").arg("foot.txt").output() {
     ///     Ok(output) => output,
-    ///     Err(e) => fail!("failed to execute process: {}", e),
+    ///     Err(e) => panic!("failed to execute process: {}", e),
     /// };
     ///
     /// println!("status: {}", output.status);
@@ -393,7 +393,7 @@ pub fn output(&self) -> IoResult<ProcessOutput> {
     ///
     /// let status = match Command::new("ls").status() {
     ///     Ok(status) => status,
-    ///     Err(e) => fail!("failed to execute process: {}", e),
+    ///     Err(e) => panic!("failed to execute process: {}", e),
     /// };
     ///
     /// println!("process exited with: {}", status);
@@ -691,7 +691,7 @@ fn smoke() {
     #[test]
     fn smoke_failure() {
         match Command::new("if-this-is-a-binary-then-the-world-has-ended").spawn() {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(..) => {}
         }
     }
@@ -714,7 +714,7 @@ fn signal_reported_right() {
         let mut p = p.unwrap();
         match p.wait().unwrap() {
             process::ExitSignal(1) => {},
-            result => fail!("not terminated by signal 1 (instead, {})", result),
+            result => panic!("not terminated by signal 1 (instead, {})", result),
         }
     }
 
@@ -815,7 +815,7 @@ fn test_process_status() {
     fn test_process_output_fail_to_start() {
         match Command::new("/no-binary-by-this-name-should-exist").output() {
             Err(e) => assert_eq!(e.kind, FileNotFound),
-            Ok(..) => fail!()
+            Ok(..) => panic!()
         }
     }
 
@@ -1063,7 +1063,7 @@ fn test_zero() {
             }
             timer::sleep(Duration::milliseconds(100));
         }
-        fail!("never saw the child go away");
+        panic!("never saw the child go away");
     }
 
     #[test]
@@ -1121,7 +1121,7 @@ fn dont_close_fd_on_command_spawn() {
 
         let mut fdes = match file::open(&path.to_c_str(), Truncate, Write) {
             Ok(f) => f,
-            Err(_) => fail!("failed to open file descriptor"),
+            Err(_) => panic!("failed to open file descriptor"),
         };
 
         let mut cmd = pwd_cmd();
index 03637079241d6cb542d4626f02ee821dd8ca76a7..40793d98ee3b893eac11d6eb10cbf81f96b4b255 100644 (file)
@@ -96,11 +96,11 @@ fn test_option_writer_error() {
             Err(io::standard_error(io::EndOfFile));
 
         match writer.write([0, 0, 0]) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => assert_eq!(e.kind, io::EndOfFile),
         }
         match writer.flush() {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => assert_eq!(e.kind, io::EndOfFile),
         }
     }
@@ -122,7 +122,7 @@ fn test_option_reader_error() {
         let mut buf = [];
 
         match reader.read(buf) {
-            Ok(..) => fail!(),
+            Ok(..) => panic!(),
             Err(e) => assert_eq!(e.kind, io::EndOfFile),
         }
     }
index 93037f765d635c2d582e7ce2a4be1f0b2066caee..5fd4faff6d2500f75486043e230ca5703bc0560d 100644 (file)
@@ -176,8 +176,8 @@ pub fn set_stdout(stdout: Box<Writer + Send>) -> Option<Box<Writer + Send>> {
 /// Resets the task-local stderr handle to the specified writer
 ///
 /// This will replace the current task's stderr handle, returning the old
-/// handle. Currently, the stderr handle is used for printing failure messages
-/// during task failure.
+/// handle. Currently, the stderr handle is used for printing panic messages
+/// during task panic.
 ///
 /// Note that this does not need to be called for all new tasks; the default
 /// output handle is to the process's stderr stream.
@@ -212,7 +212,7 @@ fn with_task_stdout(f: |&mut Writer| -> IoResult<()>) {
     };
     match result {
         Ok(()) => {}
-        Err(e) => fail!("failed printing to stdout: {}", e),
+        Err(e) => panic!("failed printing to stdout: {}", e),
     }
 }
 
@@ -415,7 +415,7 @@ fn capture_stderr() {
         let (mut r, w) = (ChanReader::new(rx), ChanWriter::new(tx));
         spawn(proc() {
             ::realstd::io::stdio::set_stderr(box w);
-            fail!("my special message");
+            panic!("my special message");
         });
         let s = r.read_to_string().unwrap();
         assert!(s.as_slice().contains("my special message"));
index 9b4333a6d8298753892921cb5cedc9d33971dc90..6571dc41585bb76ff55825399841dfbe090b9665 100644 (file)
@@ -139,14 +139,14 @@ pub unsafe fn raise_fd_limit() {
         if sysctl(&mut mib[0], 2, &mut maxfiles as *mut libc::c_int as *mut libc::c_void, &mut size,
                   null_mut(), 0) != 0 {
             let err = last_os_error();
-            fail!("raise_fd_limit: error calling sysctl: {}", err);
+            panic!("raise_fd_limit: error calling sysctl: {}", err);
         }
 
         // Fetch the current resource limits
         let mut rlim = rlimit{rlim_cur: 0, rlim_max: 0};
         if getrlimit(RLIMIT_NOFILE, &mut rlim) != 0 {
             let err = last_os_error();
-            fail!("raise_fd_limit: error calling getrlimit: {}", err);
+            panic!("raise_fd_limit: error calling getrlimit: {}", err);
         }
 
         // Bump the soft limit to the smaller of kern.maxfilesperproc and the hard limit
@@ -155,7 +155,7 @@ pub unsafe fn raise_fd_limit() {
         // Set our newly-increased resource limit
         if setrlimit(RLIMIT_NOFILE, &rlim) != 0 {
             let err = last_os_error();
-            fail!("raise_fd_limit: error calling setrlimit: {}", err);
+            panic!("raise_fd_limit: error calling setrlimit: {}", err);
         }
     }
 }
index a657989fe1244486b225b7f669be6d44e8ef748d..d16199da77fcdf3de982dfbe84a3aba07c9b2065 100644 (file)
@@ -340,7 +340,7 @@ fn sleep() {
     fn oneshot_fail() {
         let mut timer = Timer::new().unwrap();
         let _rx = timer.oneshot(Duration::milliseconds(1));
-        fail!();
+        panic!();
     }
 
     #[test]
@@ -348,14 +348,14 @@ fn oneshot_fail() {
     fn period_fail() {
         let mut timer = Timer::new().unwrap();
         let _rx = timer.periodic(Duration::milliseconds(1));
-        fail!();
+        panic!();
     }
 
     #[test]
     #[should_fail]
     fn normal_fail() {
         let _timer = Timer::new().unwrap();
-        fail!();
+        panic!();
     }
 
     #[test]
index c47cd02599485ff5b40ba14c6def549fa4a518af..5451d07ab468536355f9af84f5e17e9f5e7b78de 100644 (file)
@@ -91,7 +91,7 @@
 //! Finally, the [`prelude`](prelude/index.html) defines a
 //! common set of traits, types, and functions that are made available
 //! to all code by default. [`macros`](macros/index.html) contains
-//! all the standard macros, such as `assert!`, `fail!`, `println!`,
+//! all the standard macros, such as `assert!`, `panic!`, `println!`,
 //! and `format!`, also available to all Rust code.
 
 #![crate_name = "std"]
@@ -261,7 +261,7 @@ mod std {
     pub use io; // used for println!()
     pub use local_data; // used for local_data_key!()
     pub use option; // used for bitflags!{}
-    pub use rt; // used for fail!()
+    pub use rt; // used for panic!()
     pub use vec; // used for vec![]
 
     // The test runner calls ::std::os::args() but really wants realstd
index 1ad3d6eed942068bdb1758434ec19a37e2144749..9e0530a76f2577e197f0d72cae54264ff51dfdd6 100644 (file)
 #![experimental]
 #![macro_escape]
 
-/// The entry point for failure of rust tasks.
+/// The entry point for panic of Rust tasks.
 ///
-/// This macro is used to inject failure into a rust task, causing the task to
-/// unwind and fail entirely. Each task's failure can be reaped as the
-/// `Box<Any>` type, and the single-argument form of the `fail!` macro will be
+/// This macro is used to inject panic into a Rust task, causing the task to
+/// unwind and panic entirely. Each task's panic can be reaped as the
+/// `Box<Any>` type, and the single-argument form of the `panic!` macro will be
 /// the value which is transmitted.
 ///
-/// The multi-argument form of this macro fails with a string and has the
+/// The multi-argument form of this macro panics with a string and has the
 /// `format!` syntax for building a string.
 ///
 /// # Example
 ///
 /// ```should_fail
 /// # #![allow(unreachable_code)]
-/// fail!();
-/// fail!("this is a terrible mistake!");
-/// fail!(4i); // fail with the value of 4 to be collected elsewhere
-/// fail!("this is a {} {message}", "fancy", message = "message");
+/// panic!();
+/// panic!("this is a terrible mistake!");
+/// panic!(4i); // panic with the value of 4 to be collected elsewhere
+/// panic!("this is a {} {message}", "fancy", message = "message");
 /// ```
 #[macro_export]
-macro_rules! fail(
+macro_rules! panic(
     () => ({
-        fail!("explicit failure")
+        panic!("explicit panic")
     });
     ($msg:expr) => ({
         // static requires less code at runtime, more constant data
@@ -57,7 +57,7 @@ macro_rules! fail(
         // as returning !. We really do want this to be inlined, however,
         // because it's just a tiny wrapper. Small wins (156K to 149K in size)
         // were seen when forcing this to be inlined, and that number just goes
-        // up with the number of calls to fail!()
+        // up with the number of calls to panic!()
         //
         // The leading _'s are to avoid dead code warnings if this is
         // used inside a dead function. Just `#[allow(dead_code)]` is
@@ -74,13 +74,13 @@ fn _run_fmt(fmt: &::std::fmt::Arguments) -> ! {
 
 /// Ensure that a boolean expression is `true` at runtime.
 ///
-/// This will invoke the `fail!` macro if the provided expression cannot be
+/// This will invoke the `panic!` macro if the provided expression cannot be
 /// evaluated to `true` at runtime.
 ///
 /// # Example
 ///
 /// ```
-/// // the failure message for these assertions is the stringified value of the
+/// // the panic message for these assertions is the stringified value of the
 /// // expression given.
 /// assert!(true);
 /// # fn some_computation() -> bool { true }
@@ -96,12 +96,12 @@ fn _run_fmt(fmt: &::std::fmt::Arguments) -> ! {
 macro_rules! assert(
     ($cond:expr) => (
         if !$cond {
-            fail!(concat!("assertion failed: ", stringify!($cond)))
+            panic!(concat!("assertion failed: ", stringify!($cond)))
         }
     );
     ($cond:expr, $($arg:expr),+) => (
         if !$cond {
-            fail!($($arg),+)
+            panic!($($arg),+)
         }
     );
 )
@@ -109,7 +109,7 @@ macro_rules! assert(
 /// Asserts that two expressions are equal to each other, testing equality in
 /// both directions.
 ///
-/// On failure, this macro will print the values of the expressions.
+/// On panic, this macro will print the values of the expressions.
 ///
 /// # Example
 ///
@@ -126,7 +126,7 @@ macro_rules! assert_eq(
                 // check both directions of equality....
                 if !((*given_val == *expected_val) &&
                      (*expected_val == *given_val)) {
-                    fail!("assertion failed: `(left == right) && (right == left)` \
+                    panic!("assertion failed: `(left == right) && (right == left)` \
                            (left: `{}`, right: `{}`)", *given_val, *expected_val)
                 }
             }
@@ -136,7 +136,7 @@ macro_rules! assert_eq(
 
 /// Ensure that a boolean expression is `true` at runtime.
 ///
-/// This will invoke the `fail!` macro if the provided expression cannot be
+/// This will invoke the `panic!` macro if the provided expression cannot be
 /// evaluated to `true` at runtime.
 ///
 /// Unlike `assert!`, `debug_assert!` statements can be disabled by passing
@@ -147,7 +147,7 @@ macro_rules! assert_eq(
 /// # Example
 ///
 /// ```
-/// // the failure message for these assertions is the stringified value of the
+/// // the panic message for these assertions is the stringified value of the
 /// // expression given.
 /// debug_assert!(true);
 /// # fn some_expensive_computation() -> bool { true }
@@ -167,7 +167,7 @@ macro_rules! debug_assert(
 /// Asserts that two expressions are equal to each other, testing equality in
 /// both directions.
 ///
-/// On failure, this macro will print the values of the expressions.
+/// On panic, this macro will print the values of the expressions.
 ///
 /// Unlike `assert_eq!`, `debug_assert_eq!` statements can be disabled by
 /// passing `--cfg ndebug` to the compiler. This makes `debug_assert_eq!`
@@ -186,7 +186,7 @@ macro_rules! debug_assert_eq(
     ($($arg:tt)*) => (if cfg!(not(ndebug)) { assert_eq!($($arg)*); })
 )
 
-/// A utility macro for indicating unreachable code. It will fail if
+/// A utility macro for indicating unreachable code. It will panic if
 /// executed. This is occasionally useful to put after loops that never
 /// terminate normally, but instead directly return from a function.
 ///
@@ -211,14 +211,14 @@ macro_rules! debug_assert_eq(
 /// ```
 #[macro_export]
 macro_rules! unreachable(
-    () => (fail!("internal error: entered unreachable code"))
+    () => (panic!("internal error: entered unreachable code"))
 )
 
-/// A standardised placeholder for marking unfinished code. It fails with the
+/// A standardised placeholder for marking unfinished code. It panics with the
 /// message `"not yet implemented"` when executed.
 #[macro_export]
 macro_rules! unimplemented(
-    () => (fail!("not yet implemented"))
+    () => (panic!("not yet implemented"))
 )
 
 /// Use the syntax described in `std::fmt` to create a value of type `String`.
index af66e6ca9349003891635ece3de9f761ec614592..6e0d81a63c951da37baf427828407f05a05a5567 100644 (file)
@@ -264,10 +264,10 @@ pub fn float_to_str_bytes_common<T:NumCast+Zero+One+PartialEq+PartialOrd+Float+
     assert!(2 <= radix && radix <= 36);
     match exp_format {
         ExpDec if radix >= DIGIT_E_RADIX       // decimal exponent 'e'
-          => fail!("float_to_str_bytes_common: radix {} incompatible with \
+          => panic!("float_to_str_bytes_common: radix {} incompatible with \
                     use of 'e' as decimal exponent", radix),
         ExpBin if radix >= DIGIT_P_RADIX       // binary exponent 'p'
-          => fail!("float_to_str_bytes_common: radix {} incompatible with \
+          => panic!("float_to_str_bytes_common: radix {} incompatible with \
                     use of 'p' as binary exponent", radix),
         _ => ()
     }
@@ -553,19 +553,19 @@ pub fn from_str_bytes_common<T:NumCast+Zero+One+PartialEq+PartialOrd+Div<T,T>+
         ) -> Option<T> {
     match exponent {
         ExpDec if radix >= DIGIT_E_RADIX       // decimal exponent 'e'
-          => fail!("from_str_bytes_common: radix {} incompatible with \
+          => panic!("from_str_bytes_common: radix {} incompatible with \
                     use of 'e' as decimal exponent", radix),
         ExpBin if radix >= DIGIT_P_RADIX       // binary exponent 'p'
-          => fail!("from_str_bytes_common: radix {} incompatible with \
+          => panic!("from_str_bytes_common: radix {} incompatible with \
                     use of 'p' as binary exponent", radix),
         _ if special && radix >= DIGIT_I_RADIX // first digit of 'inf'
-          => fail!("from_str_bytes_common: radix {} incompatible with \
+          => panic!("from_str_bytes_common: radix {} incompatible with \
                     special values 'inf' and 'NaN'", radix),
         _ if (radix as int) < 2
-          => fail!("from_str_bytes_common: radix {} to low, \
+          => panic!("from_str_bytes_common: radix {} to low, \
                     must lie in the range [2, 36]", radix),
         _ if (radix as int) > 36
-          => fail!("from_str_bytes_common: radix {} to high, \
+          => panic!("from_str_bytes_common: radix {} to high, \
                     must lie in the range [2, 36]", radix),
         _ => ()
     }
index e758dec6bff9485a2aadf63d2b3449247d166619..c7994ae84e8482f2cbf3597f1d5f54992ddbe0d0 100644 (file)
@@ -96,7 +96,7 @@ pub fn getcwd() -> Path {
     let mut buf = [0 as c_char, ..BUF_BYTES];
     unsafe {
         if libc::getcwd(buf.as_mut_ptr(), buf.len() as libc::size_t).is_null() {
-            fail!()
+            panic!()
         }
         Path::new(CString::new(buf.as_ptr(), false))
     }
@@ -130,7 +130,7 @@ pub fn getcwd() -> Path {
     let mut buf = [0 as u16, ..BUF_BYTES];
     unsafe {
         if libc::GetCurrentDirectoryW(buf.len() as DWORD, buf.as_mut_ptr()) == 0 as DWORD {
-            fail!();
+            panic!();
         }
     }
     Path::new(String::from_utf16(::str::truncate_utf16_at_nul(buf))
@@ -238,7 +238,7 @@ unsafe fn get_env_pairs() -> Vec<Vec<u8>> {
             };
             let ch = GetEnvironmentStringsW();
             if ch as uint == 0 {
-                fail!("os::env() failure getting env string from OS: {}",
+                panic!("os::env() failure getting env string from OS: {}",
                        os::last_os_error());
             }
             // Here, we lossily decode the string as UTF16.
@@ -280,7 +280,7 @@ unsafe fn get_env_pairs() -> Vec<Vec<u8>> {
             }
             let mut environ = rust_env_pairs();
             if environ as uint == 0 {
-                fail!("os::env() failure getting env string from OS: {}",
+                panic!("os::env() failure getting env string from OS: {}",
                        os::last_os_error());
             }
             let mut result = Vec::new();
@@ -1009,7 +1009,7 @@ fn __xpg_strerror_r(errnum: c_int,
         let p = buf.as_mut_ptr();
         unsafe {
             if strerror_r(errnum as c_int, p, buf.len() as libc::size_t) < 0 {
-                fail!("strerror_r failure");
+                panic!("strerror_r failure");
             }
 
             ::string::raw::from_buf(p as *const u8)
@@ -1079,9 +1079,9 @@ pub fn last_os_error() -> String {
  * Sets the process exit code
  *
  * Sets the exit code returned by the process if all supervised tasks
- * terminate successfully (without failing). If the current root task fails
+ * terminate successfully (without panicking). If the current root task panics
  * and is supervised by the scheduler then any user-specified exit status is
- * ignored and the process exits with the default failure status.
+ * ignored and the process exits with the default panic status.
  *
  * Note that this is not synchronized against modifications of other threads.
  */
@@ -1185,7 +1185,7 @@ fn real_args_as_bytes() -> Vec<Vec<u8>> {
 
     match rt::args::clone() {
         Some(args) => args,
-        None => fail!("process arguments not initialized")
+        None => panic!("process arguments not initialized")
     }
 }
 
@@ -1511,12 +1511,12 @@ pub fn granularity() -> uint {
 
 #[cfg(unix)]
 impl Drop for MemoryMap {
-    /// Unmap the mapping. Fails the task if `munmap` fails.
+    /// Unmap the mapping. Panics the task if `munmap` panics.
     fn drop(&mut self) {
         if self.len == 0 { /* workaround for dummy_stack */ return; }
 
         unsafe {
-            // `munmap` only fails due to logic errors
+            // `munmap` only panics due to logic errors
             libc::munmap(self.data as *mut c_void, self.len as libc::size_t);
         }
     }
@@ -2098,7 +2098,7 @@ fn memory_map_rw() {
             os::MapWritable
         ]) {
             Ok(chunk) => chunk,
-            Err(msg) => fail!("{}", msg)
+            Err(msg) => panic!("{}", msg)
         };
         assert!(chunk.len >= 16);
 
@@ -2147,7 +2147,7 @@ fn lseek_(fd: c_int, size: uint) {
             MapOffset(size / 2)
         ]) {
             Ok(chunk) => chunk,
-            Err(msg) => fail!("{}", msg)
+            Err(msg) => panic!("{}", msg)
         };
         assert!(chunk.len > 0);
 
index 4456cf96094285dd89297676e0b2638f856e7e23..1897c8638cc69e3c4a68e4b174ebefbf0e450df8 100644 (file)
@@ -1343,7 +1343,7 @@ fn test_null_byte() {
 
     #[test]
     #[should_fail]
-    fn test_not_utf8_fail() {
+    fn test_not_utf8_panics() {
         Path::new(b"hello\x80.txt");
     }
 
index 29eae0ced5412d0663ab53407edd89839748b011..d1c655cb4d0bb1186cea212a2856b182fee5a7e9 100644 (file)
@@ -297,7 +297,7 @@ fn from_seed(seed: &'a [uint]) -> StdRng {
 pub fn weak_rng() -> XorShiftRng {
     match OsRng::new() {
         Ok(mut r) => r.gen(),
-        Err(e) => fail!("weak_rng: failed to create seeded RNG: {}", e)
+        Err(e) => panic!("weak_rng: failed to create seeded RNG: {}", e)
     }
 }
 
@@ -308,7 +308,7 @@ impl reseeding::Reseeder<StdRng> for TaskRngReseeder {
     fn reseed(&mut self, rng: &mut StdRng) {
         *rng = match StdRng::new() {
             Ok(r) => r,
-            Err(e) => fail!("could not reseed task_rng: {}", e)
+            Err(e) => panic!("could not reseed task_rng: {}", e)
         }
     }
 }
@@ -339,7 +339,7 @@ pub fn task_rng() -> TaskRng {
         None => {
             let r = match StdRng::new() {
                 Ok(r) => r,
-                Err(e) => fail!("could not initialize task_rng: {}", e)
+                Err(e) => panic!("could not initialize task_rng: {}", e)
             };
             let rng = reseeding::ReseedingRng::new(r,
                                                    TASK_RNG_RESEED_THRESHOLD,
@@ -445,7 +445,7 @@ fn test_fill_bytes_default() {
             // use this to get nicer error messages.
             for (i, &byte) in v.iter().enumerate() {
                 if byte == 0 {
-                    fail!("byte {} of {} is zero", i, n)
+                    panic!("byte {} of {} is zero", i, n)
                 }
             }
         }
@@ -472,14 +472,14 @@ fn test_gen_range() {
 
     #[test]
     #[should_fail]
-    fn test_gen_range_fail_int() {
+    fn test_gen_range_panic_int() {
         let mut r = task_rng();
         r.gen_range(5i, -2);
     }
 
     #[test]
     #[should_fail]
-    fn test_gen_range_fail_uint() {
+    fn test_gen_range_panic_uint() {
         let mut r = task_rng();
         r.gen_range(5u, 2u);
     }
index 91308be21edbd6905ca61676e5f531a8734714f0..424fd039fd4c45f8f0dbc8b0d39f23d34c972fba 100644 (file)
@@ -120,7 +120,7 @@ fn fill_bytes(&mut self, v: &mut [u8]) {
                 SecRandomCopyBytes(kSecRandomDefault, v.len() as size_t, v.as_mut_ptr())
             };
             if ret == -1 {
-                fail!("couldn't generate random bytes: {}", os::last_os_error());
+                panic!("couldn't generate random bytes: {}", os::last_os_error());
             }
         }
     }
@@ -208,7 +208,7 @@ fn fill_bytes(&mut self, v: &mut [u8]) {
                                v.as_mut_ptr())
             };
             if ret == 0 {
-                fail!("couldn't generate random bytes: {}", os::last_os_error());
+                panic!("couldn't generate random bytes: {}", os::last_os_error());
             }
         }
     }
@@ -219,7 +219,7 @@ fn drop(&mut self) {
                 CryptReleaseContext(self.hcryptprov, 0)
             };
             if ret == 0 {
-                fail!("couldn't release context: {}", os::last_os_error());
+                panic!("couldn't release context: {}", os::last_os_error());
             }
         }
     }
index 8ca1cec3e0ae9675a16ef8aaa02dba8308d969bd..4f2205312373c20b0d9141520b9f52af743dda44 100644 (file)
@@ -18,7 +18,9 @@
 /// An RNG that reads random bytes straight from a `Reader`. This will
 /// work best with an infinite reader, but this is not required.
 ///
-/// It will fail if it there is insufficient data to fulfill a request.
+/// # Panics
+///
+/// It will panic if it there is insufficient data to fulfill a request.
 ///
 /// # Example
 ///
@@ -65,7 +67,7 @@ fn fill_bytes(&mut self, v: &mut [u8]) {
         if v.len() == 0 { return }
         match self.reader.read_at_least(v.len(), v) {
             Ok(_) => {}
-            Err(e) => fail!("ReaderRng.fill_bytes error: {}", e)
+            Err(e) => panic!("ReaderRng.fill_bytes error: {}", e)
         }
     }
 }
index e05e533be56c572aaa5931fe36049b07c9471a97..5bd3927727574ff3b56eb39fa70bf6a436559824 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Simple backtrace functionality (to print on failure)
+//! Simple backtrace functionality (to print on panic)
 
 #![allow(non_camel_case_types)]
 
@@ -265,7 +265,7 @@ fn backtrace(buf: *mut *mut libc::c_void,
 
         // while it doesn't requires lock for work as everything is
         // local, it still displays much nicer backtraces when a
-        // couple of tasks fail simultaneously
+        // couple of tasks panic simultaneously
         static LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
         let _g = unsafe { LOCK.lock() };
 
@@ -327,7 +327,7 @@ struct Context<'a> {
             // FindEnclosingFunction on non-osx platforms. In doing so, we get a
             // slightly more accurate stack trace in the process.
             //
-            // This is often because failure involves the last instruction of a
+            // This is often because panic involves the last instruction of a
             // function being "call std::rt::begin_unwind", with no ret
             // instructions after it. This means that the return instruction
             // pointer points *outside* of the calling function, and by
index a91c6c572e686c0f8ff073b342846f8c3a9b08ce..e36d4ce8d4b7414b140c85bdf53bfa9922e985dd 100644 (file)
@@ -67,7 +67,7 @@
 pub use rustrt::{Stdio, Stdout, Stderr, begin_unwind, begin_unwind_fmt};
 pub use rustrt::{bookkeeping, at_exit, unwind, DEFAULT_ERROR_CODE, Runtime};
 
-// Simple backtrace functionality (to print on failure)
+// Simple backtrace functionality (to print on panic)
 pub mod backtrace;
 
 // Just stuff
index ec301369804ed78f30d4286e548440a489470521..56f2dbf667a7c30680aab7af33acd92be95240a6 100644 (file)
@@ -62,7 +62,7 @@ pub fn default_sched_threads() -> uint {
             let opt_n: Option<uint> = FromStr::from_str(nstr.as_slice());
             match opt_n {
                 Some(n) if n > 0 => n,
-                _ => fail!("`RUST_THREADS` is `{}`, should be a positive integer", nstr)
+                _ => panic!("`RUST_THREADS` is `{}`, should be a positive integer", nstr)
             }
         }
         None => {
index 621c08fe7bcc0bc68da5838ff632bfe9cbef10c8..3607050943270db02c37deacaa19ef294d30d815 100644 (file)
@@ -58,7 +58,7 @@ pub fn unwrap(mut self) -> A {
         let state = replace(&mut self.state, Evaluating);
         match state {
             Forced(v) => v,
-            _ => fail!( "Logic error." ),
+            _ => panic!( "Logic error." ),
         }
     }
 
@@ -70,10 +70,10 @@ pub fn get_ref<'a>(&'a mut self) -> &'a A {
         */
         match self.state {
             Forced(ref v) => return v,
-            Evaluating => fail!("Recursive forcing of future!"),
+            Evaluating => panic!("Recursive forcing of future!"),
             Pending(_) => {
                 match replace(&mut self.state, Evaluating) {
-                    Forced(_) | Evaluating => fail!("Logic error."),
+                    Forced(_) | Evaluating => panic!("Logic error."),
                     Pending(f) => {
                         self.state = Forced(f());
                         self.get_ref()
@@ -132,7 +132,7 @@ pub fn spawn(blk: proc():Send -> A) -> Future<A> {
         let (tx, rx) = channel();
 
         spawn(proc() {
-            // Don't fail if the other end has hung up
+            // Don't panic if the other end has hung up
             let _ = tx.send_opt(blk());
         });
 
@@ -193,8 +193,8 @@ fn test_spawn() {
 
     #[test]
     #[should_fail]
-    fn test_futurefail() {
-        let mut f = Future::spawn(proc() fail!());
+    fn test_future_panic() {
+        let mut f = Future::spawn(proc() panic!());
         let _x: String = f.get();
     }
 
@@ -211,7 +211,7 @@ fn test_sendable_future() {
     }
 
     #[test]
-    fn test_dropped_future_doesnt_fail() {
+    fn test_dropped_future_doesnt_panic() {
         struct Bomb(Sender<bool>);
 
         local_data_key!(LOCAL: Bomb)
@@ -224,13 +224,13 @@ fn drop(&mut self) {
         }
 
         // Spawn a future, but drop it immediately. When we receive the result
-        // later on, we should never view the task as having failed.
+        // later on, we should never view the task as having panicked.
         let (tx, rx) = channel();
         drop(Future::spawn(proc() {
             LOCAL.replace(Some(Bomb(tx)));
         }));
 
-        // Make sure the future didn't fail the task.
+        // Make sure the future didn't panic the task.
         assert!(!rx.recv());
     }
 }
index a00eeb1f938389afb640722cf94cf25abbec8ba4..d4a60fb584457e90088b73fa9739837af669d3ef 100644 (file)
@@ -42,9 +42,9 @@ impl<T> TaskPool<T> {
     /// `init_fn_factory` returns a function which, given the index of the
     /// task, should return local data to be kept around in that task.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// This function will fail if `n_tasks` is less than 1.
+    /// This function will panic if `n_tasks` is less than 1.
     pub fn new(n_tasks: uint,
                init_fn_factory: || -> proc(uint):Send -> T)
                -> TaskPool<T> {
@@ -96,7 +96,7 @@ fn test_task_pool() {
 
 #[test]
 #[should_fail]
-fn test_zero_tasks_failure() {
+fn test_zero_tasks_panic() {
     let f: || -> proc(uint):Send -> uint = || { proc(i) i };
     TaskPool::new(0, f);
 }
index 1d1e6ae4febfdc8f8ffb514c41a8ca83b8d8bc62..c79b8715c06c2757ade5974950b6c4a773499fb7 100644 (file)
 //! using the atomically-reference-counted container,
 //! [`Arc`](../../std/sync/struct.Arc.html).
 //!
-//! Fatal logic errors in Rust cause *task failure*, during which
+//! Fatal logic errors in Rust cause *task panic*, during which
 //! a task will unwind the stack, running destructors and freeing
-//! owned resources. Task failure is unrecoverable from within
-//! the failing task (i.e. there is no 'try/catch' in Rust), but
-//! failure may optionally be detected from a different task. If
-//! the main task fails the application will exit with a non-zero
+//! owned resources. Task panic is unrecoverable from within
+//! the panicking task (i.e. there is no 'try/catch' in Rust), but
+//! panic may optionally be detected from a different task. If
+//! the main task panics the application will exit with a non-zero
 //! exit code.
 //!
 //! # Basic task scheduling
@@ -123,7 +123,7 @@ fn spawn(self, opts: task::TaskOpts, f: proc():Send) {
         let tb: Option<Box<Task>> = Local::try_take();
         match tb {
             Some(t) => t.spawn_sibling(opts, f),
-            None => fail!("need a local task to spawn a sibling task"),
+            None => panic!("need a local task to spawn a sibling task"),
         };
     }
 }
@@ -140,7 +140,7 @@ fn spawn(self, opts: task::TaskOpts, f: proc():Send) {
 // sidestep that whole issue by making builders uncopyable and making
 // the run function move them in.
 pub struct TaskBuilder<S = SiblingSpawner> {
-    // A name for the task-to-be, for identification in failure messages
+    // A name for the task-to-be, for identification in panic messages
     name: Option<SendStr>,
     // The size of the stack for the spawned task
     stack_size: Option<uint>,
@@ -173,7 +173,7 @@ pub fn new() -> TaskBuilder<SiblingSpawner> {
 
 impl<S: Spawner> TaskBuilder<S> {
     /// Name the task-to-be. Currently the name is used for identification
-    /// only in failure messages.
+    /// only in panic messages.
     #[unstable = "IntoMaybeOwned will probably change."]
     pub fn named<T: IntoMaybeOwned<'static>>(mut self, name: T) -> TaskBuilder<S> {
         self.name = Some(name.into_maybe_owned());
@@ -269,10 +269,10 @@ pub fn spawn(self, f: proc():Send) {
     ///
     /// # Return value
     ///
-    /// If the child task executes successfully (without failing) then the
+    /// If the child task executes successfully (without panicking) then the
     /// future returns `result::Ok` containing the value returned by the
-    /// function. If the child task fails then the future returns `result::Err`
-    /// containing the argument to `fail!(...)` as an `Any` trait object.
+    /// function. If the child task panics then the future returns `result::Err`
+    /// containing the argument to `panic!(...)` as an `Any` trait object.
     #[experimental = "Futures are experimental."]
     pub fn try_future<T:Send>(self, f: proc():Send -> T)
                               -> Future<Result<T, Box<Any + Send>>> {
@@ -293,7 +293,7 @@ pub fn try_future<T:Send>(self, f: proc():Send -> T)
     }
 
     /// Execute a function in a newly-spawnedtask and block until the task
-    /// completes or fails. Equivalent to `.try_future(f).unwrap()`.
+    /// completes or panics. Equivalent to `.try_future(f).unwrap()`.
     #[unstable = "Error type may change."]
     pub fn try<T:Send>(self, f: proc():Send -> T) -> Result<T, Box<Any + Send>> {
         self.try_future(f).unwrap()
@@ -313,7 +313,7 @@ pub fn spawn(f: proc(): Send) {
 }
 
 /// Execute a function in a newly-spawned task and return either the return
-/// value of the function or an error if the task failed.
+/// value of the function or an error if the task panicked.
 ///
 /// This is equivalent to `TaskBuilder::new().try`.
 #[unstable = "Error type may change."]
@@ -355,8 +355,8 @@ pub fn deschedule() {
     task.yield_now();
 }
 
-/// True if the running task is currently failing (e.g. will return `true` inside a
-/// destructor that is run while unwinding the stack after a call to `fail!()`).
+/// True if the running task is currently panicking (e.g. will return `true` inside a
+/// destructor that is run while unwinding the stack after a call to `panic!()`).
 #[unstable = "May move to a different module."]
 pub fn failing() -> bool {
     use rt::task::Task;
@@ -420,7 +420,7 @@ fn test_try_future() {
         assert!(result.unwrap().is_ok());
 
         let result = TaskBuilder::new().try_future(proc() -> () {
-            fail!();
+            panic!();
         });
         assert!(result.unwrap().is_err());
     }
@@ -431,17 +431,17 @@ fn test_try_success() {
             "Success!".to_string()
         }).as_ref().map(|s| s.as_slice()) {
             result::Ok("Success!") => (),
-            _ => fail!()
+            _ => panic!()
         }
     }
 
     #[test]
-    fn test_try_fail() {
+    fn test_try_panic() {
         match try(proc() {
-            fail!()
+            panic!()
         }) {
             result::Err(_) => (),
-            result::Ok(()) => fail!()
+            result::Ok(()) => panic!()
         }
     }
 
@@ -541,37 +541,37 @@ fn test_simple_newsched_spawn() {
     }
 
     #[test]
-    fn test_try_fail_message_static_str() {
+    fn test_try_panic_message_static_str() {
         match try(proc() {
-            fail!("static string");
+            panic!("static string");
         }) {
             Err(e) => {
                 type T = &'static str;
                 assert!(e.is::<T>());
                 assert_eq!(*e.downcast::<T>().unwrap(), "static string");
             }
-            Ok(()) => fail!()
+            Ok(()) => panic!()
         }
     }
 
     #[test]
-    fn test_try_fail_message_owned_str() {
+    fn test_try_panic_message_owned_str() {
         match try(proc() {
-            fail!("owned string".to_string());
+            panic!("owned string".to_string());
         }) {
             Err(e) => {
                 type T = String;
                 assert!(e.is::<T>());
                 assert_eq!(*e.downcast::<T>().unwrap(), "owned string".to_string());
             }
-            Ok(()) => fail!()
+            Ok(()) => panic!()
         }
     }
 
     #[test]
-    fn test_try_fail_message_any() {
+    fn test_try_panic_message_any() {
         match try(proc() {
-            fail!(box 413u16 as Box<Any + Send>);
+            panic!(box 413u16 as Box<Any + Send>);
         }) {
             Err(e) => {
                 type T = Box<Any + Send>;
@@ -580,19 +580,19 @@ fn test_try_fail_message_any() {
                 assert!(any.is::<u16>());
                 assert_eq!(*any.downcast::<u16>().unwrap(), 413u16);
             }
-            Ok(()) => fail!()
+            Ok(()) => panic!()
         }
     }
 
     #[test]
-    fn test_try_fail_message_unit_struct() {
+    fn test_try_panic_message_unit_struct() {
         struct Juju;
 
         match try(proc() {
-            fail!(Juju)
+            panic!(Juju)
         }) {
             Err(ref e) if e.is::<Juju>() => {}
-            Err(_) | Ok(()) => fail!()
+            Err(_) | Ok(()) => panic!()
         }
     }
 
index 751eb00bfaeccf65add80c63bd92f7de3bebba80..c8b01ce1055bdbddbb3ee23a46c342d21a275a32 100644 (file)
@@ -107,7 +107,7 @@ pub fn minutes(minutes: i64) -> Duration {
     pub fn seconds(seconds: i64) -> Duration {
         let d = Duration { secs: seconds, nanos: 0 };
         if d < MIN || d > MAX {
-            fail!("Duration::seconds out of bounds");
+            panic!("Duration::seconds out of bounds");
         }
         d
     }
index ddfd1088a41a844e8537b8074f8811796dc8c9e7..247f50d666e1402000ba4a3bcec7f49262f96576 100644 (file)
 //! ## Failure Propagation
 //!
 //! In addition to being a core primitive for communicating in rust, channels
-//! are the points at which failure is propagated among tasks.  Whenever the one
+//! are the points at which panics are propagated among tasks.  Whenever the one
 //! half of channel is closed, the other half will have its next operation
-//! `fail!`. The purpose of this is to allow propagation of failure among tasks
+//! `panic!`. The purpose of this is to allow propagation of panics among tasks
 //! that are linked to one another via channels.
 //!
 //! There are methods on both of senders and receivers to perform their
-//! respective operations without failing, however.
+//! respective operations without panicking, however.
 //!
 //! ## Runtime Requirements
 //!
 //! }
 //! ```
 //!
-//! Propagating failure:
+//! Propagating panics:
 //!
 //! ```should_fail
-//! // The call to recv() will fail!() because the channel has already hung
+//! // The call to recv() will panic!() because the channel has already hung
 //! // up (or been deallocated)
 //! let (tx, rx) = channel::<int>();
 //! drop(tx);
@@ -506,7 +506,7 @@ pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) {
 /// becomes  "rendezvous channel" where each send will not return until a recv
 /// is paired with it.
 ///
-/// As with asynchronous channels, all senders will fail in `send` if the
+/// As with asynchronous channels, all senders will panic in `send` if the
 /// `Receiver` has been destroyed.
 ///
 /// # Example
@@ -550,25 +550,25 @@ fn new(inner: Flavor<T>) -> Sender<T> {
     ///
     /// Rust channels are infinitely buffered so this method will never block.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// This function will fail if the other end of the channel has hung up.
+    /// This function will panic if the other end of the channel has hung up.
     /// This means that if the corresponding receiver has fallen out of scope,
-    /// this function will trigger a fail message saying that a message is
+    /// this function will trigger a panic message saying that a message is
     /// being sent on a closed channel.
     ///
-    /// Note that if this function does *not* fail, it does not mean that the
+    /// Note that if this function does *not* panic, it does not mean that the
     /// data will be successfully received. All sends are placed into a queue,
     /// so it is possible for a send to succeed (the other end is alive), but
     /// then the other end could immediately disconnect.
     ///
-    /// The purpose of this functionality is to propagate failure among tasks.
-    /// If failure is not desired, then consider using the `send_opt` method
+    /// The purpose of this functionality is to propagate panicks among tasks.
+    /// If a panic is not desired, then consider using the `send_opt` method
     #[experimental = "this function is being considered candidate for removal \
                       to adhere to the general guidelines of rust"]
     pub fn send(&self, t: T) {
         if self.send_opt(t).is_err() {
-            fail!("sending on a closed channel");
+            panic!("sending on a closed channel");
         }
     }
 
@@ -585,9 +585,9 @@ pub fn send(&self, t: T) {
     ///
     /// Like `send`, this method will never block.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// This method will never fail, it will return the message back to the
+    /// This method will never panic, it will return the message back to the
     /// caller if the other end is disconnected
     ///
     /// # Example
@@ -634,7 +634,7 @@ pub fn send_opt(&self, t: T) -> Result<(), T> {
                             }
                             oneshot::UpDisconnected => (a, Err(t)),
                             oneshot::UpWoke(task) => {
-                                // This send cannot fail because the task is
+                                // This send cannot panic because the task is
                                 // asleep (we're looking at it), so the receiver
                                 // can't go away.
                                 (*a.get()).send(t).ok().unwrap();
@@ -731,20 +731,20 @@ fn new(inner: Arc<UnsafeCell<sync::Packet<T>>>) -> SyncSender<T> {
     /// time. If the buffer size is 0, however, it can be guaranteed that the
     /// receiver has indeed received the data if this function returns success.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// Similarly to `Sender::send`, this function will fail if the
+    /// Similarly to `Sender::send`, this function will panic if the
     /// corresponding `Receiver` for this channel has disconnected. This
-    /// behavior is used to propagate failure among tasks.
+    /// behavior is used to propagate panics among tasks.
     ///
-    /// If failure is not desired, you can achieve the same semantics with the
-    /// `SyncSender::send_opt` method which will not fail if the receiver
+    /// If a panic is not desired, you can achieve the same semantics with the
+    /// `SyncSender::send_opt` method which will not panic if the receiver
     /// disconnects.
     #[experimental = "this function is being considered candidate for removal \
                       to adhere to the general guidelines of rust"]
     pub fn send(&self, t: T) {
         if self.send_opt(t).is_err() {
-            fail!("sending on a closed channel");
+            panic!("sending on a closed channel");
         }
     }
 
@@ -756,9 +756,9 @@ pub fn send(&self, t: T) {
     /// is returned back to the callee. This function is similar to `try_send`,
     /// except that it will block if the channel is currently full.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// This function cannot fail.
+    /// This function cannot panic.
     #[unstable = "this function may be renamed to send() in the future"]
     pub fn send_opt(&self, t: T) -> Result<(), T> {
         unsafe { (*self.inner.get()).send(t) }
@@ -774,9 +774,9 @@ pub fn send_opt(&self, t: T) -> Result<(), T> {
     /// See `SyncSender::send` for notes about guarantees of whether the
     /// receiver has received the data or not if this function is successful.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// This function cannot fail
+    /// This function cannot panic
     #[unstable = "the return type of this function is candidate for \
                   modification"]
     pub fn try_send(&self, t: T) -> Result<(), TrySendError<T>> {
@@ -814,13 +814,13 @@ fn new(inner: Flavor<T>) -> Receiver<T> {
     /// on the channel from its paired `Sender` structure. This receiver will
     /// be woken up when data is ready, and the data will be returned.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// Similar to channels, this method will trigger a task failure if the
+    /// Similar to channels, this method will trigger a task panic if the
     /// other end of the channel has hung up (been deallocated). The purpose of
-    /// this is to propagate failure among tasks.
+    /// this is to propagate panicks among tasks.
     ///
-    /// If failure is not desired, then there are two options:
+    /// If a panic is not desired, then there are two options:
     ///
     /// * If blocking is still desired, the `recv_opt` method will return `None`
     ///   when the other end hangs up
@@ -832,7 +832,7 @@ fn new(inner: Flavor<T>) -> Receiver<T> {
     pub fn recv(&self) -> T {
         match self.recv_opt() {
             Ok(t) => t,
-            Err(()) => fail!("receiving on a closed channel"),
+            Err(()) => panic!("receiving on a closed channel"),
         }
     }
 
@@ -845,7 +845,9 @@ pub fn recv(&self) -> T {
     /// This is useful for a flavor of "optimistic check" before deciding to
     /// block on a receiver.
     ///
-    /// This function cannot fail.
+    /// # Panics
+    ///
+    /// This function cannot panic.
     #[unstable = "the return type of this function may be altered"]
     pub fn try_recv(&self) -> Result<T, TryRecvError> {
         // If a thread is spinning in try_recv, we should take the opportunity
@@ -899,15 +901,15 @@ pub fn try_recv(&self) -> Result<T, TryRecvError> {
         }
     }
 
-    /// Attempt to wait for a value on this receiver, but does not fail if the
+    /// Attempt to wait for a value on this receiver, but does not panic if the
     /// corresponding channel has hung up.
     ///
     /// This implementation of iterators for ports will always block if there is
-    /// not data available on the receiver, but it will not fail in the case
+    /// not data available on the receiver, but it will not panic in the case
     /// that the channel has been deallocated.
     ///
     /// In other words, this function has the same semantics as the `recv`
-    /// method except for the failure aspect.
+    /// method except for the panic aspect.
     ///
     /// If the channel has hung up, then `Err` is returned. Otherwise `Ok` of
     /// the value found on the receiver is returned.
@@ -947,7 +949,7 @@ pub fn recv_opt(&self) -> Result<T, ()> {
     }
 
     /// Returns an iterator which will block waiting for messages, but never
-    /// `fail!`. It will return `None` when the channel has hung up.
+    /// `panic!`. It will return `None` when the channel has hung up.
     #[unstable]
     pub fn iter<'a>(&'a self) -> Messages<'a, T> {
         Messages { rx: self }
@@ -1191,7 +1193,7 @@ pub fn stress_factor() -> uint {
                 assert_eq!(rx.recv(), 1);
             }
             match rx.try_recv() {
-                Ok(..) => fail!(),
+                Ok(..) => panic!(),
                 _ => {}
             }
             dtx.send(());
@@ -1287,7 +1289,7 @@ fn no_runtime() {
     } #[should_fail])
 
     test!(fn oneshot_single_thread_recv_chan_close() {
-        // Receiving on a closed chan will fail
+        // Receiving on a closed chan will panic
         let res = task::try(proc() {
             let (tx, rx) = channel::<int>();
             drop(tx);
@@ -1711,7 +1713,7 @@ pub fn stress_factor() -> uint {
                 assert_eq!(rx.recv(), 1);
             }
             match rx.try_recv() {
-                Ok(..) => fail!(),
+                Ok(..) => panic!(),
                 _ => {}
             }
             dtx.send(());
@@ -1747,7 +1749,7 @@ pub fn stress_factor() -> uint {
     } #[should_fail])
 
     test!(fn oneshot_single_thread_recv_chan_close() {
-        // Receiving on a closed chan will fail
+        // Receiving on a closed chan will panic
         let res = task::try(proc() {
             let (tx, rx) = sync_channel::<int>(0);
             drop(tx);
index 053b5dc4c8a7478454cefee3514d9543857597fa..447585fb2e08760cf905a8fb5505cdcb20abbe8e 100644 (file)
@@ -94,7 +94,7 @@ pub fn send(&mut self, t: T) -> Result<(), T> {
         // Sanity check
         match self.upgrade {
             NothingSent => {}
-            _ => fail!("sending on a oneshot that's already sent on "),
+            _ => panic!("sending on a oneshot that's already sent on "),
         }
         assert!(self.data.is_none());
         self.data = Some(t);
@@ -203,7 +203,7 @@ pub fn upgrade(&mut self, up: Receiver<T>) -> UpgradeResult {
         let prev = match self.upgrade {
             NothingSent => NothingSent,
             SendUsed => SendUsed,
-            _ => fail!("upgrading again"),
+            _ => panic!("upgrading again"),
         };
         self.upgrade = GoUp(up);
 
index 669c1c958b8842461f410a1337b9e2d13e9c888a..f826664308429128fca793331e6e656bd90c5931 100644 (file)
@@ -102,7 +102,7 @@ pub trait Packet {
 
 impl Select {
     /// Creates a new selection structure. This set is initially empty and
-    /// `wait` will fail!() if called.
+    /// `wait` will panic!() if called.
     ///
     /// Usage of this struct directly can sometimes be burdensome, and usage is
     /// rather much easier through the `select!` macro.
@@ -353,17 +353,17 @@ macro_rules! select {
         tx1.send(1);
         select! (
             foo = rx1.recv() => { assert_eq!(foo, 1); },
-            _bar = rx2.recv() => { fail!() }
+            _bar = rx2.recv() => { panic!() }
         )
         tx2.send(2);
         select! (
-            _foo = rx1.recv() => { fail!() },
+            _foo = rx1.recv() => { panic!() },
             bar = rx2.recv() => { assert_eq!(bar, 2) }
         )
         drop(tx1);
         select! (
             foo = rx1.recv_opt() => { assert_eq!(foo, Err(())); },
-            _bar = rx2.recv() => { fail!() }
+            _bar = rx2.recv() => { panic!() }
         )
         drop(tx2);
         select! (
@@ -379,10 +379,10 @@ macro_rules! select {
         let (tx5, rx5) = channel::<int>();
         tx5.send(4);
         select! (
-            _foo = rx1.recv() => { fail!("1") },
-            _foo = rx2.recv() => { fail!("2") },
-            _foo = rx3.recv() => { fail!("3") },
-            _foo = rx4.recv() => { fail!("4") },
+            _foo = rx1.recv() => { panic!("1") },
+            _foo = rx2.recv() => { panic!("2") },
+            _foo = rx3.recv() => { panic!("3") },
+            _foo = rx4.recv() => { panic!("4") },
             foo = rx5.recv() => { assert_eq!(foo, 4); }
         )
     })
@@ -393,7 +393,7 @@ macro_rules! select {
         drop(tx2);
 
         select! (
-            _a1 = rx1.recv_opt() => { fail!() },
+            _a1 = rx1.recv_opt() => { panic!() },
             a2 = rx2.recv_opt() => { assert_eq!(a2, Err(())); }
         )
     })
@@ -412,12 +412,12 @@ macro_rules! select {
 
         select! (
             a = rx1.recv() => { assert_eq!(a, 1); },
-            _b = rx2.recv() => { fail!() }
+            _b = rx2.recv() => { panic!() }
         )
         tx3.send(1);
         select! (
             a = rx1.recv_opt() => { assert_eq!(a, Err(())); },
-            _b = rx2.recv() => { fail!() }
+            _b = rx2.recv() => { panic!() }
         )
     })
 
@@ -488,7 +488,7 @@ macro_rules! select {
         tx3.send(());
         select!(
             _i1 = rx1.recv() => {},
-            _i2 = rx2.recv() => fail!()
+            _i2 = rx2.recv() => panic!()
         )
         tx3.send(());
     })
@@ -509,7 +509,7 @@ macro_rules! select {
         tx3.send(());
         select!(
             _i1 = rx1.recv() => {},
-            _i2 = rx2.recv() => fail!()
+            _i2 = rx2.recv() => panic!()
         )
         tx3.send(());
     })
index cfd045d08821af814a61728f27d90c529a94fb4b..a82efe76289bfb7d6b7aceec23ffa67a094d622e 100644 (file)
@@ -299,7 +299,7 @@ pub fn try_recv(&mut self) -> Result<T, Failure> {
                     Thread::yield_now();
                     match self.queue.pop() {
                         mpsc::Data(t) => { data = t; break }
-                        mpsc::Empty => fail!("inconsistent => empty"),
+                        mpsc::Empty => panic!("inconsistent => empty"),
                         mpsc::Inconsistent => {}
                     }
                 }
@@ -358,7 +358,7 @@ pub fn drop_chan(&mut self) {
         match self.channels.fetch_sub(1, atomic::SeqCst) {
             1 => {}
             n if n > 1 => return,
-            n => fail!("bad number of channels left {}", n),
+            n => panic!("bad number of channels left {}", n),
         }
 
         match self.cnt.swap(DISCONNECTED, atomic::SeqCst) {
index 528a15cf6d7658a10bb26332d814e10794eee340..bbb4813f5f90f965c2268d772de1cbbeb64fb9c6 100644 (file)
@@ -19,7 +19,7 @@
 /// which means that every successful send is paired with a successful recv.
 ///
 /// This flavor of channels defines a new `send_opt` method for channels which
-/// is the method by which a message is sent but the task does not fail if it
+/// is the method by which a message is sent but the task does not panic if it
 /// cannot be delivered.
 ///
 /// Another major difference is that send() will *always* return back the data
@@ -193,7 +193,7 @@ pub fn send(&self, t: T) -> Result<(), T> {
             // success, someone's about to receive our buffered data.
             BlockedReceiver(task) => { wakeup(task, guard); Ok(()) }
 
-            BlockedSender(..) => fail!("lolwut"),
+            BlockedSender(..) => panic!("lolwut"),
         }
     }
 
index 09fa8920a07d7daff55f56213b3417af62bfcae5..31889a36dd7abdb87e5d649ed63246dac70e278b 100644 (file)
@@ -467,7 +467,7 @@ fn stealpush_large() {
             while left > 0 {
                 match s.steal() {
                     Data((1, 10)) => { left -= 1; }
-                    Data(..) => fail!(),
+                    Data(..) => panic!(),
                     Abort | Empty => {}
                 }
             }
@@ -497,7 +497,7 @@ fn stampede(w: Worker<Box<int>>, s: Stealer<Box<int>>,
                             Data(box 20) => {
                                 (*unsafe_remaining).fetch_sub(1, SeqCst);
                             }
-                            Data(..) => fail!(),
+                            Data(..) => panic!(),
                             Abort | Empty => {}
                         }
                     }
@@ -508,7 +508,7 @@ fn stampede(w: Worker<Box<int>>, s: Stealer<Box<int>>,
         while remaining.load(SeqCst) > 0 {
             match w.pop() {
                 Some(box 20) => { remaining.fetch_sub(1, SeqCst); }
-                Some(..) => fail!(),
+                Some(..) => panic!(),
                 None => {}
             }
         }
@@ -556,7 +556,7 @@ fn stress() {
                 loop {
                     match s.steal() {
                         Data(2) => { HITS.fetch_add(1, SeqCst); }
-                        Data(..) => fail!(),
+                        Data(..) => panic!(),
                         _ if DONE.load(SeqCst) => break,
                         _ => {}
                     }
@@ -571,7 +571,7 @@ fn stress() {
                 match w.pop() {
                     None => {}
                     Some(2) => { HITS.fetch_add(1, SeqCst); },
-                    Some(_) => fail!(),
+                    Some(_) => panic!(),
                 }
             } else {
                 expected += 1;
@@ -583,7 +583,7 @@ fn stress() {
             match w.pop() {
                 None => {}
                 Some(2) => { HITS.fetch_add(1, SeqCst); },
-                Some(_) => fail!(),
+                Some(_) => panic!(),
             }
         }
         DONE.store(true, SeqCst);
@@ -618,7 +618,7 @@ fn no_starvation() {
                             Data((1, 2)) => {
                                 (*thread_box).fetch_add(1, SeqCst);
                             }
-                            Data(..) => fail!(),
+                            Data(..) => panic!(),
                             _ if DONE.load(SeqCst) => break,
                             _ => {}
                         }
@@ -635,7 +635,7 @@ fn no_starvation() {
                     match w.pop() {
                         None => {}
                         Some((1, 2)) => myhit = true,
-                        Some(_) => fail!(),
+                        Some(_) => panic!(),
                     }
                 } else {
                     w.push((1, 2));
index 78a7d128be5f3ac504639f72d4e1fe41dda91864..a9b0b7c48034f31cee3ddf084a358b2c11dcb928 100644 (file)
 //!
 //! The wrappers in this module build on the primitives from `sync::raw` to
 //! provide safe interfaces around using the primitive locks. These primitives
-//! implement a technique called "poisoning" where when a task failed with a
-//! held lock, all future attempts to use the lock will fail.
+//! implement a technique called "poisoning" where when a task panicked with a
+//! held lock, all future attempts to use the lock will panic.
 //!
-//! For example, if two tasks are contending on a mutex and one of them fails
-//! after grabbing the lock, the second task will immediately fail because the
+//! For example, if two tasks are contending on a mutex and one of them panics
+//! after grabbing the lock, the second task will immediately panic because the
 //! lock is now poisoned.
 
 use core::prelude::*;
@@ -43,7 +43,7 @@ fn failing() -> bool {
 impl<'a> PoisonOnFail<'a> {
     fn check(flag: bool, name: &str) {
         if flag {
-            fail!("Poisoned {} - another task failed inside!", name);
+            panic!("Poisoned {} - another task failed inside!", name);
         }
     }
 
@@ -99,10 +99,10 @@ impl<'a> Condvar<'a> {
     ///
     /// wait() is equivalent to wait_on(0).
     ///
-    /// # Failure
+    /// # Panics
     ///
     /// A task which is killed while waiting on a condition variable will wake
-    /// up, fail, and unlock the associated lock as it unwinds.
+    /// up, panic, and unlock the associated lock as it unwinds.
     #[inline]
     pub fn wait(&self) { self.wait_on(0) }
 
@@ -213,12 +213,12 @@ pub fn new_with_condvars(user_data: T, num_condvars: uint) -> Mutex<T> {
     /// when dropped. All concurrent tasks attempting to lock the mutex will
     /// block while the returned value is still alive.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// Failing while inside the Mutex will unlock the Mutex while unwinding, so
+    /// Panicking while inside the Mutex will unlock the Mutex while unwinding, so
     /// that other tasks won't block forever. It will also poison the Mutex:
     /// any tasks that subsequently try to access it (including those already
-    /// blocked on the mutex) will also fail immediately.
+    /// blocked on the mutex) will also panic immediately.
     #[inline]
     pub fn lock<'a>(&'a self) -> MutexGuard<'a, T> {
         let guard = self.lock.lock();
@@ -317,11 +317,11 @@ pub fn new_with_condvars(user_data: T, num_condvars: uint) -> RWLock<T> {
     /// Access the underlying data mutably. Locks the rwlock in write mode;
     /// other readers and writers will block.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// Failing while inside the lock will unlock the lock while unwinding, so
+    /// Panicking while inside the lock will unlock the lock while unwinding, so
     /// that other tasks won't block forever. As Mutex.lock, it will also poison
-    /// the lock, so subsequent readers and writers will both also fail.
+    /// the lock, so subsequent readers and writers will both also panic.
     #[inline]
     pub fn write<'a>(&'a self) -> RWLockWriteGuard<'a, T> {
         let guard = self.lock.write();
@@ -496,7 +496,7 @@ fn test_arc_condvar_poison() {
             let lock = arc2.lock();
             lock.cond.signal();
             // Parent should fail when it wakes up.
-            fail!();
+            panic!();
         });
 
         let lock = arc.lock();
@@ -546,7 +546,7 @@ fn drop(&mut self) {
                 }
             }
             let _u = Unwinder { i: arc2 };
-            fail!();
+            panic!();
         });
         let lock = arc.lock();
         assert_eq!(*lock, 2);
@@ -661,7 +661,7 @@ fn drop(&mut self) {
                 }
             }
             let _u = Unwinder { i: arc2 };
-            fail!();
+            panic!();
         });
         let lock = arc.read();
         assert_eq!(*lock, 2);
index ac2acf3d7d4d2f0770f749e7814347e4ddda5291..69dc2fe8e607e359113aded9253306e76709dc01 100644 (file)
@@ -177,7 +177,7 @@ fn test() {
         let q = Queue::new();
         match q.pop() {
             Empty => {}
-            Inconsistent | Data(..) => fail!()
+            Inconsistent | Data(..) => panic!()
         }
         let (tx, rx) = channel();
         let q = Arc::new(q);
index 81ae8dbb98f1ae19e0ec452fafea19722b33c66d..4fd62ac3a1da04d6cfc9a391248011ac36305174 100644 (file)
@@ -216,10 +216,10 @@ pub struct Condvar<'a> {
 impl<'a> Condvar<'a> {
     /// Atomically drop the associated lock, and block until a signal is sent.
     ///
-    /// # Failure
+    /// # Panics
     ///
     /// A task which is killed while waiting on a condition variable will wake
-    /// up, fail, and unlock the associated lock as it unwinds.
+    /// up, panic, and unlock the associated lock as it unwinds.
     pub fn wait(&self) { self.wait_on(0) }
 
     /// As wait(), but can specify which of multiple condition variables to
@@ -228,7 +228,7 @@ pub fn wait(&self) { self.wait_on(0) }
     ///
     /// The associated lock must have been initialised with an appropriate
     /// number of condvars. The condvar_id must be between 0 and num_condvars-1
-    /// or else this call will fail.
+    /// or else this call will panic.
     ///
     /// wait() is equivalent to wait_on(0).
     pub fn wait_on(&self, condvar_id: uint) {
@@ -324,7 +324,7 @@ pub fn broadcast_on(&self, condvar_id: uint) -> uint {
     }
 }
 
-// Checks whether a condvar ID was out of bounds, and fails if so, or does
+// Checks whether a condvar ID was out of bounds, and panics if so, or does
 // something else next on success.
 #[inline]
 fn check_cvar_bounds<U>(
@@ -335,9 +335,9 @@ fn check_cvar_bounds<U>(
                      -> U {
     match out_of_bounds {
         Some(0) =>
-            fail!("{} with illegal ID {} - this lock has no condvars!", act, id),
+            panic!("{} with illegal ID {} - this lock has no condvars!", act, id),
         Some(length) =>
-            fail!("{} with illegal ID {} - ID must be less than {}", act, id, length),
+            panic!("{} with illegal ID {} - ID must be less than {}", act, id, length),
         None => blk()
     }
 }
@@ -367,9 +367,9 @@ pub struct SemaphoreGuard<'a> {
 impl Semaphore {
     /// Create a new semaphore with the specified count.
     ///
-    /// # Failure
+    /// # Panics
     ///
-    /// This function will fail if `count` is negative.
+    /// This function will panic if `count` is negative.
     pub fn new(count: int) -> Semaphore {
         Semaphore { sem: Sem::new(count, ()) }
     }
@@ -396,8 +396,9 @@ pub fn access<'a>(&'a self) -> SemaphoreGuard<'a> {
 /// A blocking, bounded-waiting, mutual exclusion lock with an associated
 /// FIFO condition variable.
 ///
-/// # Failure
-/// A task which fails while holding a mutex will unlock the mutex as it
+/// # Panics
+///
+/// A task which panicks while holding a mutex will unlock the mutex as it
 /// unwinds.
 pub struct Mutex {
     sem: Sem<Vec<WaitQueue>>,
@@ -421,7 +422,7 @@ pub fn new() -> Mutex { Mutex::new_with_condvars(1) }
     /// Create a new mutex, with a specified number of associated condvars. This
     /// will allow calling wait_on/signal_on/broadcast_on with condvar IDs
     /// between 0 and num_condvars-1. (If num_condvars is 0, lock_cond will be
-    /// allowed but any operations on the condvar will fail.)
+    /// allowed but any operations on the condvar will panic.)
     pub fn new_with_condvars(num_condvars: uint) -> Mutex {
         Mutex { sem: Sem::new_and_signal(1, num_condvars) }
     }
@@ -443,9 +444,9 @@ pub fn lock<'a>(&'a self) -> MutexGuard<'a> {
 
 /// A blocking, no-starvation, reader-writer lock with an associated condvar.
 ///
-/// # Failure
+/// # Panics
 ///
-/// A task which fails while holding an rwlock will unlock the rwlock as it
+/// A task which panics while holding an rwlock will unlock the rwlock as it
 /// unwinds.
 pub struct RWLock {
     order_lock:  Semaphore,
@@ -835,13 +836,13 @@ fn test_mutex_cond_no_waiter() {
     fn test_mutex_killed_simple() {
         use std::any::Any;
 
-        // Mutex must get automatically unlocked if failed/killed within.
+        // Mutex must get automatically unlocked if panicked/killed within.
         let m = Arc::new(Mutex::new());
         let m2 = m.clone();
 
         let result: result::Result<(), Box<Any + Send>> = task::try(proc() {
             let _lock = m2.lock();
-            fail!();
+            panic!();
         });
         assert!(result.is_err());
         // child task must have finished by the time try returns
@@ -1075,13 +1076,13 @@ fn test_rwlock_cond_broadcast() {
     fn rwlock_kill_helper(mode1: RWLockMode, mode2: RWLockMode) {
         use std::any::Any;
 
-        // Mutex must get automatically unlocked if failed/killed within.
+        // Mutex must get automatically unlocked if panicked/killed within.
         let x = Arc::new(RWLock::new());
         let x2 = x.clone();
 
         let result: result::Result<(), Box<Any + Send>> = task::try(proc() {
             lock_rwlock_in_mode(&x2, mode1, || {
-                fail!();
+                panic!();
             })
         });
         assert!(result.is_err());
index 9cd64d46bad85e5175ffa37a17dd0ab3d59150f9..ef0ceb141458b23b5203adea2a4ab626e698f625 100644 (file)
@@ -369,7 +369,7 @@ fn stress_bound(bound: uint) {
                     loop {
                         match consumer.pop() {
                             Some(1i) => break,
-                            Some(_) => fail!(),
+                            Some(_) => panic!(),
                             None => {}
                         }
                     }
index a4f060cd9fc1e10d230590242a6141ba5deb3b4b..3bd25d245e175d814fe27db28e19ed0540239e3e 100644 (file)
@@ -84,7 +84,7 @@ fn eq(&self, other: &Ident) -> bool {
             // one example and its non-hygienic counterpart would be:
             //      syntax::parse::token::Token::mtwt_eq
             //      syntax::ext::tt::macro_parser::token_name_eq
-            fail!("not allowed to compare these idents: {}, {}. \
+            panic!("not allowed to compare these idents: {}, {}. \
                    Probably related to issue \\#6993", self, other);
         }
     }
index 8280f34615fc2406051478c3a8e4c578e641381d..187d94d1fa7809b58cc5226f31178265df624cec 100644 (file)
@@ -198,17 +198,17 @@ fn handle<A>(self,
                         ident: i.ident, decl: &**decl, style: style, body: &**block,
                         generics: generics, abi: abi, id: i.id, span: i.span
                     }),
-                _ => fail!("item FnLikeNode that is not fn-like"),
+                _ => panic!("item FnLikeNode that is not fn-like"),
             },
             ast_map::NodeTraitItem(t) => match *t {
                 ast::ProvidedMethod(ref m) => method(&**m),
-                _ => fail!("trait method FnLikeNode that is not fn-like"),
+                _ => panic!("trait method FnLikeNode that is not fn-like"),
             },
             ast_map::NodeImplItem(ii) => {
                 match *ii {
                     ast::MethodImplItem(ref m) => method(&**m),
                     ast::TypeImplItem(_) => {
-                        fail!("impl method FnLikeNode that is not fn-like")
+                        panic!("impl method FnLikeNode that is not fn-like")
                     }
                 }
             }
@@ -217,9 +217,9 @@ fn handle<A>(self,
                     closure(ClosureParts::new(&**decl, &**block, e.id, e.span)),
                 ast::ExprProc(ref decl, ref block) =>
                     closure(ClosureParts::new(&**decl, &**block, e.id, e.span)),
-                _ => fail!("expr FnLikeNode that is not fn-like"),
+                _ => panic!("expr FnLikeNode that is not fn-like"),
             },
-            _ => fail!("other FnLikeNode that is not fn-like"),
+            _ => panic!("other FnLikeNode that is not fn-like"),
         }
     }
 }
index b82a4a0b9971852dd8bc181d420b7d98ef2aacb3..915c2d1b3188cbcba6cf6e8b140331b73ec7fc2b 100644 (file)
@@ -263,12 +263,12 @@ pub fn krate(&self) -> &'ast Crate {
         &self.forest.krate
     }
 
-    /// Retrieve the Node corresponding to `id`, failing if it cannot
+    /// Retrieve the Node corresponding to `id`, panicking if it cannot
     /// be found.
     pub fn get(&self, id: NodeId) -> Node<'ast> {
         match self.find(id) {
             Some(node) => node,
-            None => fail!("couldn't find node id {} in the AST map", id)
+            None => panic!("couldn't find node id {} in the AST map", id)
         }
     }
 
@@ -308,7 +308,7 @@ pub fn get_foreign_abi(&self, id: NodeId) -> abi::Abi {
         };
         match abi {
             Some(abi) => abi,
-            None => fail!("expected foreign mod or inlined parent, found {}",
+            None => panic!("expected foreign mod or inlined parent, found {}",
                           self.node_to_string(parent))
         }
     }
@@ -324,7 +324,7 @@ pub fn get_foreign_vis(&self, id: NodeId) -> Visibility {
     pub fn expect_item(&self, id: NodeId) -> &'ast Item {
         match self.find(id) {
             Some(NodeItem(item)) => item,
-            _ => fail!("expected item, found {}", self.node_to_string(id))
+            _ => panic!("expected item, found {}", self.node_to_string(id))
         }
     }
 
@@ -333,37 +333,37 @@ pub fn expect_struct(&self, id: NodeId) -> &'ast StructDef {
             Some(NodeItem(i)) => {
                 match i.node {
                     ItemStruct(ref struct_def, _) => &**struct_def,
-                    _ => fail!("struct ID bound to non-struct")
+                    _ => panic!("struct ID bound to non-struct")
                 }
             }
             Some(NodeVariant(variant)) => {
                 match variant.node.kind {
                     StructVariantKind(ref struct_def) => &**struct_def,
-                    _ => fail!("struct ID bound to enum variant that isn't struct-like"),
+                    _ => panic!("struct ID bound to enum variant that isn't struct-like"),
                 }
             }
-            _ => fail!(format!("expected struct, found {}", self.node_to_string(id))),
+            _ => panic!(format!("expected struct, found {}", self.node_to_string(id))),
         }
     }
 
     pub fn expect_variant(&self, id: NodeId) -> &'ast Variant {
         match self.find(id) {
             Some(NodeVariant(variant)) => variant,
-            _ => fail!(format!("expected variant, found {}", self.node_to_string(id))),
+            _ => panic!(format!("expected variant, found {}", self.node_to_string(id))),
         }
     }
 
     pub fn expect_foreign_item(&self, id: NodeId) -> &'ast ForeignItem {
         match self.find(id) {
             Some(NodeForeignItem(item)) => item,
-            _ => fail!("expected foreign item, found {}", self.node_to_string(id))
+            _ => panic!("expected foreign item, found {}", self.node_to_string(id))
         }
     }
 
     pub fn expect_expr(&self, id: NodeId) -> &'ast Expr {
         match self.find(id) {
             Some(NodeExpr(expr)) => expr,
-            _ => fail!("expected expr, found {}", self.node_to_string(id))
+            _ => panic!("expected expr, found {}", self.node_to_string(id))
         }
     }
 
@@ -388,7 +388,7 @@ pub fn get_path_elem(&self, id: NodeId) -> PathElem {
                                 PathName(ident.name)
                             }
                             MethMac(_) => {
-                                fail!("no path elem for {}", node)
+                                panic!("no path elem for {}", node)
                             }
                         }
                     }
@@ -402,13 +402,13 @@ pub fn get_path_elem(&self, id: NodeId) -> PathElem {
                         MethDecl(ident, _, _, _, _, _, _, _) => {
                             PathName(ident.name)
                         }
-                        MethMac(_) => fail!("no path elem for {}", node),
+                        MethMac(_) => panic!("no path elem for {}", node),
                     }
                 }
                 TypeTraitItem(ref m) => PathName(m.ident.name),
             },
             NodeVariant(v) => PathName(v.node.name.name),
-            _ => fail!("no path elem for {}", node)
+            _ => panic!("no path elem for {}", node)
         }
     }
 
@@ -533,7 +533,7 @@ pub fn opt_span(&self, id: NodeId) -> Option<Span> {
 
     pub fn span(&self, id: NodeId) -> Span {
         self.opt_span(id)
-            .unwrap_or_else(|| fail!("AstMap.span: could not find span for id {}", id))
+            .unwrap_or_else(|| panic!("AstMap.span: could not find span for id {}", id))
     }
 
     pub fn def_id_span(&self, def_id: DefId, fallback: Span) -> Span {
@@ -666,7 +666,7 @@ impl Named for Method {
     fn name(&self) -> Name {
         match self.node {
             MethDecl(i, _, _, _, _, _, _, _) => i.name,
-            MethMac(_) => fail!("encountered unexpanded method macro."),
+            MethMac(_) => panic!("encountered unexpanded method macro."),
         }
     }
 }
@@ -1018,9 +1018,9 @@ fn print_node(&mut self, node: &Node) -> IoResult<()> {
             // these cases do not carry enough information in the
             // ast_map to reconstruct their full structure for pretty
             // printing.
-            NodeLocal(_)       => fail!("cannot print isolated Local"),
-            NodeArg(_)         => fail!("cannot print isolated Arg"),
-            NodeStructCtor(_)  => fail!("cannot print isolated StructCtor"),
+            NodeLocal(_)       => panic!("cannot print isolated Local"),
+            NodeArg(_)         => panic!("cannot print isolated Arg"),
+            NodeStructCtor(_)  => panic!("cannot print isolated StructCtor"),
         }
     }
 }
index d5a460dc9dba1812f61a5be4043f8e2adbf805ed..7e1716e6b18171a3de9df2fb3ebf9713f504d10c 100644 (file)
@@ -43,7 +43,7 @@ pub fn stmt_id(s: &Stmt) -> NodeId {
       StmtDecl(_, id) => id,
       StmtExpr(_, id) => id,
       StmtSemi(_, id) => id,
-      StmtMac(..) => fail!("attempted to analyze unexpanded stmt")
+      StmtMac(..) => panic!("attempted to analyze unexpanded stmt")
     }
 }
 
@@ -233,7 +233,7 @@ pub fn trait_method_to_ty_method(method: &Method) -> TypeMethod {
                 abi: abi,
             }
         },
-        MethMac(_) => fail!("expected non-macro method declaration")
+        MethMac(_) => panic!("expected non-macro method declaration")
     }
 }
 
@@ -246,7 +246,7 @@ pub fn trait_item_to_ty_method(method: &TraitItem) -> TypeMethod {
         RequiredMethod(ref m) => (*m).clone(),
         ProvidedMethod(ref m) => trait_method_to_ty_method(&**m),
         TypeTraitItem(_) => {
-            fail!("trait_method_to_ty_method(): expected method but found \
+            panic!("trait_method_to_ty_method(): expected method but found \
                    typedef")
         }
     }
@@ -615,7 +615,7 @@ pub fn walk_pat(pat: &Pat, it: |&Pat| -> bool) -> bool {
             slice.iter().all(|p| walk_pat(&**p, |p| it(p))) &&
             after.iter().all(|p| walk_pat(&**p, |p| it(p)))
         }
-        PatMac(_) => fail!("attempted to analyze unexpanded pattern"),
+        PatMac(_) => panic!("attempted to analyze unexpanded pattern"),
         PatWild(_) | PatLit(_) | PatRange(_, _) | PatIdent(_, _, _) |
         PatEnum(_, _) => {
             true
@@ -725,7 +725,7 @@ fn $meth_name<'a>(&'a self) -> $field_ty {
             match self.node {
                 $field_pat => $result,
                 MethMac(_) => {
-                    fail!("expected an AST without macro invocations");
+                    panic!("expected an AST without macro invocations");
                 }
             }
         }
index 4df334a3f2c70cbee997387aba9f67c6f053466e..7d303644020a47fdbb34da6bf192804b843f7d5c 100644 (file)
@@ -425,7 +425,7 @@ pub fn span_to_snippet(&self, sp: Span) -> Option<String> {
 
         // FIXME #8256: this used to be an assert but whatever precondition
         // it's testing isn't true for all spans in the AST, so to allow the
-        // caller to not have to fail (and it can't catch it since the CodeMap
+        // caller to not have to panic (and it can't catch it since the CodeMap
         // isn't sendable), return None
         if begin.fm.start_pos != end.fm.start_pos {
             None
@@ -441,7 +441,7 @@ pub fn get_filemap(&self, filename: &str) -> Rc<FileMap> {
                 return fm.clone();
             }
         }
-        fail!("asking for {} which we don't know about", filename);
+        panic!("asking for {} which we don't know about", filename);
     }
 
     pub fn lookup_byte_offset(&self, bpos: BytePos) -> FileMapAndBytePos {
@@ -503,13 +503,13 @@ fn lookup_filemap_idx(&self, pos: BytePos) -> uint {
                 break;
             }
             if a == 0 {
-                fail!("position {} does not resolve to a source location",
+                panic!("position {} does not resolve to a source location",
                       pos.to_uint());
             }
             a -= 1;
         }
         if a >= len {
-            fail!("position {} does not resolve to a source location",
+            panic!("position {} does not resolve to a source location",
                   pos.to_uint())
         }
 
index 3da1b1f3175f273bda78c6c4d6ec84246ace6d70..e24aa0f0b95870cda55c2218312247cd08a962c3 100644 (file)
@@ -63,7 +63,7 @@ fn custom_emit(&mut self, cm: &codemap::CodeMap,
                    sp: RenderSpan, msg: &str, lvl: Level);
 }
 
-/// This structure is used to signify that a task has failed with a fatal error
+/// This structure is used to signify that a task has panicked with a fatal error
 /// from the diagnostics. You can use this with the `Any` trait to figure out
 /// how a rustc task died (if so desired).
 pub struct FatalError;
@@ -83,7 +83,7 @@ pub struct SpanHandler {
 impl SpanHandler {
     pub fn span_fatal(&self, sp: Span, msg: &str) -> ! {
         self.handler.emit(Some((&self.cm, sp)), msg, Fatal);
-        fail!(FatalError);
+        panic!(FatalError);
     }
     pub fn span_err(&self, sp: Span, msg: &str) {
         self.handler.emit(Some((&self.cm, sp)), msg, Error);
@@ -113,7 +113,7 @@ pub fn fileline_note(&self, sp: Span, msg: &str) {
     }
     pub fn span_bug(&self, sp: Span, msg: &str) -> ! {
         self.handler.emit(Some((&self.cm, sp)), msg, Bug);
-        fail!(ExplicitBug);
+        panic!(ExplicitBug);
     }
     pub fn span_unimpl(&self, sp: Span, msg: &str) -> ! {
         self.span_bug(sp, format!("unimplemented {}", msg).as_slice());
@@ -134,7 +134,7 @@ pub struct Handler {
 impl Handler {
     pub fn fatal(&self, msg: &str) -> ! {
         self.emit.borrow_mut().emit(None, msg, None, Fatal);
-        fail!(FatalError);
+        panic!(FatalError);
     }
     pub fn err(&self, msg: &str) {
         self.emit.borrow_mut().emit(None, msg, None, Error);
@@ -172,7 +172,7 @@ pub fn help(&self, msg: &str) {
     }
     pub fn bug(&self, msg: &str) -> ! {
         self.emit.borrow_mut().emit(None, msg, None, Bug);
-        fail!(ExplicitBug);
+        panic!(ExplicitBug);
     }
     pub fn unimpl(&self, msg: &str) -> ! {
         self.bug(format!("unimplemented {}", msg).as_slice());
@@ -367,7 +367,7 @@ fn emit(&mut self,
 
         match error {
             Ok(()) => {}
-            Err(e) => fail!("failed to print diagnostics: {}", e),
+            Err(e) => panic!("failed to print diagnostics: {}", e),
         }
     }
 
@@ -375,7 +375,7 @@ fn custom_emit(&mut self, cm: &codemap::CodeMap,
                    sp: RenderSpan, msg: &str, lvl: Level) {
         match emit(self, cm, sp, msg, None, lvl, true) {
             Ok(()) => {}
-            Err(e) => fail!("failed to print diagnostics: {}", e),
+            Err(e) => panic!("failed to print diagnostics: {}", e),
         }
     }
 }
index 39b710e0d5725779a8ce1348d5bc1769b730e7c7..87406081aae97123dce8c23eaecb69404cac1007 100644 (file)
@@ -741,7 +741,7 @@ fn expand_arm(arm: ast::Arm, fld: &mut MacroExpander) -> ast::Arm {
     // expand pats... they might contain macro uses:
     let expanded_pats = arm.pats.move_map(|pat| fld.fold_pat(pat));
     if expanded_pats.len() == 0 {
-        fail!("encountered match arm with 0 patterns");
+        panic!("encountered match arm with 0 patterns");
     }
     // all of the pats must have the same set of bindings, so use the
     // first one to extract them and generate new names:
@@ -1621,7 +1621,7 @@ fn run_renaming_test(t: &RenamingTest, test_idx: uint) {
                     // good lord, you can't make a path with 0 segments, can you?
                     let final_varref_ident = match varref.segments.last() {
                         Some(pathsegment) => pathsegment.identifier,
-                        None => fail!("varref with 0 path segments?")
+                        None => panic!("varref with 0 path segments?")
                     };
                     let varref_name = mtwt::resolve(final_varref_ident);
                     let varref_idents : Vec<ast::Ident>
@@ -1688,7 +1688,7 @@ fn run_renaming_test(t: &RenamingTest, test_idx: uint) {
         let cxbinds: &[&ast::Ident] = cxbinds.as_slice();
         let cxbind = match cxbinds {
             [b] => b,
-            _ => fail!("expected just one binding for ext_cx")
+            _ => panic!("expected just one binding for ext_cx")
         };
         let resolved_binding = mtwt::resolve(*cxbind);
         let varrefs = crate_varrefs(&cr);
index b4f8b9f82284980335fca8de2552bb61e951eac0..840468176ab0310c0c75e5591084e847edcac0a6 100644 (file)
@@ -211,7 +211,7 @@ fn resolve_internal(id: Ident,
                     resolvedthis
                 }
             }
-            IllegalCtxt => fail!("expected resolvable context, got IllegalCtxt")
+            IllegalCtxt => panic!("expected resolvable context, got IllegalCtxt")
         }
     };
     resolve_table.insert(key, resolved);
@@ -250,7 +250,7 @@ fn marksof_internal(ctxt: SyntaxContext,
                     loopvar = tl;
                 }
             }
-            IllegalCtxt => fail!("expected resolvable context, got IllegalCtxt")
+            IllegalCtxt => panic!("expected resolvable context, got IllegalCtxt")
         }
     }
 }
@@ -261,7 +261,7 @@ pub fn outer_mark(ctxt: SyntaxContext) -> Mrk {
     with_sctable(|sctable| {
         match (*sctable.table.borrow())[ctxt as uint] {
             Mark(mrk, _) => mrk,
-            _ => fail!("can't retrieve outer mark when outside is not a mark")
+            _ => panic!("can't retrieve outer mark when outside is not a mark")
         }
     })
 }
@@ -342,7 +342,7 @@ fn refold_test_sc(mut sc: SyntaxContext, table : &SCTable) -> Vec<TestSC> {
                     sc = tail;
                     continue;
                 }
-                IllegalCtxt => fail!("expected resolvable context, got IllegalCtxt")
+                IllegalCtxt => panic!("expected resolvable context, got IllegalCtxt")
             }
         }
     }
index dc7a495523f22da858d9ee95c9f4aa65168f70a4..a95a737720a96bb3097414b741fc02899c9bd267 100644 (file)
@@ -366,7 +366,7 @@ fn parse_item(&self, s: String) -> P<ast::Item> {
                 Some(ast) => ast,
                 None => {
                     error!("parse error");
-                    fail!()
+                    panic!()
                 }
             }
         }
@@ -598,7 +598,7 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P<ast::Expr> {
                                 vec!(mk_name(cx, sp, ident.ident())));
         }
 
-        token::Interpolated(_) => fail!("quote! with interpolated token"),
+        token::Interpolated(_) => panic!("quote! with interpolated token"),
 
         _ => ()
     }
@@ -635,7 +635,7 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P<ast::Expr> {
         token::Dollar       => "Dollar",
         token::Underscore   => "Underscore",
         token::Eof          => "Eof",
-        _                   => fail!(),
+        _                   => panic!(),
     };
     mk_token_path(cx, sp, name)
 }
@@ -662,7 +662,7 @@ fn mk_tt(cx: &ExtCtxt, _: Span, tt: &ast::TokenTree) -> Vec<P<ast::Stmt>> {
                 .chain(mk_tt(cx, sp, &close.to_tt()).into_iter())
                 .collect()
         },
-        ast::TtSequence(..) => fail!("TtSequence in quote!"),
+        ast::TtSequence(..) => panic!("TtSequence in quote!"),
         ast::TtNonterminal(sp, ident) => {
             // tt.extend($ident.to_tokens(ext_cx).into_iter())
 
index 073bebcb3f6ff9da353a756fa2c09f9bbbae7ee3..9260a45adb954075e849229176d808c4eb222830 100644 (file)
@@ -395,7 +395,7 @@ pub fn parse(sess: &ParseSess,
                                 token::get_ident(name),
                                 token::get_ident(bind))).to_string()
                       }
-                      _ => fail!()
+                      _ => panic!()
                     } }).collect::<Vec<String>>().connect(" or ");
                 return Error(sp, format!(
                     "local ambiguity: multiple parsing options: \
@@ -421,7 +421,7 @@ pub fn parse(sess: &ParseSess,
                         parse_nt(&mut rust_parser, name_string.get()))));
                     ei.idx += 1u;
                   }
-                  _ => fail!()
+                  _ => panic!()
                 }
                 cur_eis.push(ei);
 
index 20428e50c7f1f50c9c6fa9b79426890e00e3d518..85bd5cde3044f1e61c22811ef3e16a89beb5b14c 100644 (file)
@@ -39,7 +39,7 @@ impl<'a> ParserAnyMacro<'a> {
     /// silently drop anything. `allow_semi` is so that "optional"
     /// semicolons at the end of normal expressions aren't complained
     /// about e.g. the semicolon in `macro_rules! kapow( () => {
-    /// fail!(); } )` doesn't get picked up by .parse_expr(), but it's
+    /// panic!(); } )` doesn't get picked up by .parse_expr(), but it's
     /// allowed to be there.
     fn ensure_complete_parse(&self, allow_semi: bool) {
         let mut parser = self.parser.borrow_mut();
index 967ad3a897cdeac1a1b0576889f8fcf622b30b8a..47ca66b0b4923cd868aa40966878dae5075b85b0 100644 (file)
@@ -171,7 +171,7 @@ fn fold_local(&mut self, l: P<Local>) -> P<Local> {
     }
 
     fn fold_mac(&mut self, _macro: Mac) -> Mac {
-        fail!("fold_mac disabled by default");
+        panic!("fold_mac disabled by default");
         // NB: see note about macros above.
         // if you really want a folder that
         // works on macros, use this
@@ -1404,7 +1404,7 @@ macro_rules! assert_pred (
                 let a_val = $a;
                 let b_val = $b;
                 if !(pred_val(a_val.as_slice(),b_val.as_slice())) {
-                    fail!("expected args satisfying {}, got {} and {}",
+                    panic!("expected args satisfying {}, got {} and {}",
                           $predname, a_val, b_val);
                 }
             }
index 3814ecfbe5bc65cd9b28d62dcad8c79ab69bf286..5a7679570bf8d7b7011650566291ab357e7d649e 100644 (file)
@@ -142,7 +142,7 @@ fn horizontal_trim(lines: Vec<String> ) -> Vec<String> {
         return lines.connect("\n");
     }
 
-    fail!("not a doc-comment: {}", comment);
+    panic!("not a doc-comment: {}", comment);
 }
 
 fn push_blank_line_comment(rdr: &StringReader, comments: &mut Vec<Comment>) {
@@ -322,7 +322,7 @@ fn consume_comment(rdr: &mut StringReader,
         read_block_comment(rdr, code_to_the_left, comments);
     } else if rdr.curr_is('#') && rdr.nextch_is('!') {
         read_shebang_comment(rdr, code_to_the_left, comments);
-    } else { fail!(); }
+    } else { panic!(); }
     debug!("<<< consume comment");
 }
 
index b439353ad956646e712f91c5b7c279239569cf04..3a6cf610b4f8b058b0d026b21c7dd9e9bb3609f5 100644 (file)
@@ -555,8 +555,8 @@ fn bump_expecting_char<'a,D:fmt::Show>(r: &mut StringReader<'a>,
                                                whence: &str) {
             match r.curr {
                 Some(r_c) if r_c == c => r.bump(),
-                Some(r_c) => fail!("expected {}, hit {}, {}", described_c, r_c, whence),
-                None      => fail!("expected {}, hit EOF, {}", described_c, whence),
+                Some(r_c) => panic!("expected {}, hit {}, {}", described_c, r_c, whence),
+                None      => panic!("expected {}, hit EOF, {}", described_c, whence),
             }
         }
 
@@ -577,7 +577,7 @@ fn bump_expecting_char<'a,D:fmt::Show>(r: &mut StringReader<'a>,
         self.scan_digits(base);
         let encoded_name : u32 = self.with_str_from(start_bpos, |s| {
             num::from_str_radix(s, 10).unwrap_or_else(|| {
-                fail!("expected digits representing a name, got `{}`, {}, range [{},{}]",
+                panic!("expected digits representing a name, got `{}`, {}, range [{},{}]",
                       s, whence, start_bpos, self.last_pos);
             })
         });
@@ -595,7 +595,7 @@ fn bump_expecting_char<'a,D:fmt::Show>(r: &mut StringReader<'a>,
         self.scan_digits(base);
         let encoded_ctxt : ast::SyntaxContext = self.with_str_from(start_bpos, |s| {
             num::from_str_radix(s, 10).unwrap_or_else(|| {
-                fail!("expected digits representing a ctxt, got `{}`, {}", s, whence);
+                panic!("expected digits representing a ctxt, got `{}`, {}", s, whence);
             })
         });
 
@@ -1542,7 +1542,7 @@ fn mk_ident(id: &str, style: token::IdentStyle) -> token::Token {
         let mut lexer = setup(&sh, "/* /* */ */'a'".to_string());
         match lexer.next_token().tok {
             token::Comment => { },
-            _ => fail!("expected a comment!")
+            _ => panic!("expected a comment!")
         }
         assert_eq!(lexer.next_token().tok, token::LitChar(token::intern("a")));
     }
index e60da0867f7553792f3c2f3b981ee4a98ef4e6b1..c731f3965a0c907eb7d6d1b8dc9fede35de9802d 100644 (file)
@@ -65,7 +65,7 @@ pub fn reserve_node_ids(&self, count: ast::NodeId) -> ast::NodeId {
 
         match v.checked_add(&count) {
             Some(next) => { self.node_id.set(next); }
-            None => fail!("Input too large, ran out of node ids!")
+            None => panic!("Input too large, ran out of node ids!")
         }
 
         v
@@ -381,7 +381,7 @@ pub fn char_lit(lit: &str) -> (char, int) {
             '0' => Some('\0'),
             _ => { None }
         },
-        _ => fail!("lexer accepted invalid char escape `{}`", lit)
+        _ => panic!("lexer accepted invalid char escape `{}`", lit)
     };
 
     match c {
@@ -434,7 +434,7 @@ fn eat<'a>(it: &mut iter::Peekable<(uint, char), str::CharOffsets<'a>>) {
                 match c {
                     '\\' => {
                         let ch = chars.peek().unwrap_or_else(|| {
-                            fail!("{}", error(i).as_slice())
+                            panic!("{}", error(i).as_slice())
                         }).val1();
 
                         if ch == '\n' {
@@ -442,11 +442,11 @@ fn eat<'a>(it: &mut iter::Peekable<(uint, char), str::CharOffsets<'a>>) {
                         } else if ch == '\r' {
                             chars.next();
                             let ch = chars.peek().unwrap_or_else(|| {
-                                fail!("{}", error(i).as_slice())
+                                panic!("{}", error(i).as_slice())
                             }).val1();
 
                             if ch != '\n' {
-                                fail!("lexer accepted bare CR");
+                                panic!("lexer accepted bare CR");
                             }
                             eat(&mut chars);
                         } else {
@@ -460,11 +460,11 @@ fn eat<'a>(it: &mut iter::Peekable<(uint, char), str::CharOffsets<'a>>) {
                     },
                     '\r' => {
                         let ch = chars.peek().unwrap_or_else(|| {
-                            fail!("{}", error(i).as_slice())
+                            panic!("{}", error(i).as_slice())
                         }).val1();
 
                         if ch != '\n' {
-                            fail!("lexer accepted bare CR");
+                            panic!("lexer accepted bare CR");
                         }
                         chars.next();
                         res.push('\n');
@@ -494,7 +494,7 @@ pub fn raw_str_lit(lit: &str) -> String {
             Some(c) => {
                 if c == '\r' {
                     if *chars.peek().unwrap() != '\n' {
-                        fail!("lexer accepted bare CR");
+                        panic!("lexer accepted bare CR");
                     }
                     chars.next();
                     res.push('\n');
@@ -553,11 +553,11 @@ pub fn byte_lit(lit: &str) -> (u8, uint) {
                 match ::std::num::from_str_radix::<u64>(lit.slice(2, 4), 16) {
                     Some(c) =>
                         if c > 0xFF {
-                            fail!(err(2))
+                            panic!(err(2))
                         } else {
                             return (c as u8, 4)
                         },
-                    None => fail!(err(3))
+                    None => panic!(err(3))
                 }
             }
         };
@@ -594,7 +594,7 @@ fn eat<'a, I: Iterator<(uint, u8)>>(it: &mut iter::Peekable<(uint, u8), I>) {
                     b'\r' => {
                         chars.next();
                         if chars.peek().expect(em.as_slice()).val1() != b'\n' {
-                            fail!("lexer accepted bare CR");
+                            panic!("lexer accepted bare CR");
                         }
                         eat(&mut chars);
                     }
@@ -612,7 +612,7 @@ fn eat<'a, I: Iterator<(uint, u8)>>(it: &mut iter::Peekable<(uint, u8), I>) {
             Some((i, b'\r')) => {
                 let em = error(i);
                 if chars.peek().expect(em.as_slice()).val1() != b'\n' {
-                    fail!("lexer accepted bare CR");
+                    panic!("lexer accepted bare CR");
                 }
                 chars.next();
                 res.push(b'\n');
@@ -813,7 +813,7 @@ fn string_to_tts_macro () {
                               ast::TtToken(_, token::Ident(name, token::Plain))],
                              &ast::Delimiter { token: token::RParen, .. })
                             if name.as_str() == "a" => {},
-                            _ => fail!("value 3: {}", **first_delimed),
+                            _ => panic!("value 3: {}", **first_delimed),
                         }
                         let (ref second_open, ref second_tts, ref second_close) = **second_delimed;
                         match (second_open, second_tts.as_slice(), second_close) {
@@ -822,13 +822,13 @@ fn string_to_tts_macro () {
                               ast::TtToken(_, token::Ident(name, token::Plain))],
                              &ast::Delimiter { token: token::RParen, .. })
                             if name.as_str() == "a" => {},
-                            _ => fail!("value 4: {}", **second_delimed),
+                            _ => panic!("value 4: {}", **second_delimed),
                         }
                     },
-                    _ => fail!("value 2: {}", **macro_delimed),
+                    _ => panic!("value 2: {}", **macro_delimed),
                 }
             },
-            _ => fail!("value: {}",tts),
+            _ => panic!("value: {}",tts),
         }
     }
 
index 654de709566ae3b408b20213ecb3315a04977217..8ef3a559bf41abda8fbac7a372d4ed1e8eb6f6bc 100644 (file)
@@ -5746,7 +5746,7 @@ fn parse_items_and_view_items(&mut self,
                     break;
                 }
                 IoviForeignItem(_) => {
-                    fail!();
+                    panic!();
                 }
             }
             attrs = self.parse_outer_attributes();
@@ -5769,7 +5769,7 @@ fn parse_items_and_view_items(&mut self,
                     items.push(item)
                 }
                 IoviForeignItem(_) => {
-                    fail!();
+                    panic!();
                 }
             }
         }
index 65efd4f00425b744f43ea8dc47226ee545aee653..57c72ca77c616072695867235d9981986c7fa63f 100644 (file)
@@ -600,7 +600,7 @@ pub fn print(&mut self, x: Token, l: int) -> io::IoResult<()> {
           }
           Eof => {
             // Eof should never get here.
-            fail!();
+            panic!();
           }
         }
     }
index a52987f5bd174b24f540589d342c9c2e7814923a..d347d0199a724797a79615cf7b520b8d8edb0889 100644 (file)
@@ -1072,7 +1072,7 @@ pub fn print_struct(&mut self,
                     Inconsistent, struct_def.fields.as_slice(),
                     |s, field| {
                         match field.node.kind {
-                            ast::NamedField(..) => fail!("unexpected named field"),
+                            ast::NamedField(..) => panic!("unexpected named field"),
                             ast::UnnamedField(vis) => {
                                 try!(s.print_visibility(vis));
                                 try!(s.maybe_print_comment(field.span.lo));
@@ -1093,7 +1093,7 @@ pub fn print_struct(&mut self,
 
             for field in struct_def.fields.iter() {
                 match field.node.kind {
-                    ast::UnnamedField(..) => fail!("unexpected unnamed field"),
+                    ast::UnnamedField(..) => panic!("unexpected unnamed field"),
                     ast::NamedField(ident, visibility) => {
                         try!(self.hardbreak_if_not_bol());
                         try!(self.maybe_print_comment(field.span.lo));
@@ -1440,7 +1440,7 @@ fn print_else(&mut self, els: Option<&ast::Expr>) -> IoResult<()> {
                     }
                     // BLEAH, constraints would be great here
                     _ => {
-                        fail!("print_if saw if with weird alternative");
+                        panic!("print_if saw if with weird alternative");
                     }
                 }
             }
index 60ba5f6615b92e22dacdf67743b6748960d69f80..422c2d5c75bd7cefe836cd69ffd3d72cb20a2539 100644 (file)
@@ -99,7 +99,7 @@ pub fn get<'a>(&'a self, idx: uint) -> &'a T {
         match self.repr {
             One(ref v) if idx == 0 => v,
             Many(ref vs) => &vs[idx],
-            _ => fail!("out of bounds access")
+            _ => panic!("out of bounds access")
         }
     }
 
@@ -110,10 +110,10 @@ pub fn expect_one(self, err: &'static str) -> T {
                 if v.len() == 1 {
                     v.into_iter().next().unwrap()
                 } else {
-                    fail!(err)
+                    panic!(err)
                 }
             }
-            _ => fail!(err)
+            _ => panic!(err)
         }
     }
 
index f2d56f53d22caef7098f0ca490d870222d075586..bec72e88f99b98560010a38a53a8c5421d562c62 100644 (file)
@@ -103,7 +103,7 @@ fn visit_explicit_self(&mut self, es: &'v ExplicitSelf) {
         walk_explicit_self(self, es)
     }
     fn visit_mac(&mut self, _macro: &'v Mac) {
-        fail!("visit_mac disabled by default");
+        panic!("visit_mac disabled by default");
         // NB: see note about macros above.
         // if you really want a visitor that
         // works on macros, use this
index 586f420dc3e002fff1848b424a504bd073d04348..a3482dc85c63bcdb5a3351d9589393851a859d44 100644 (file)
@@ -474,7 +474,7 @@ fn from_char(c: char) -> FormatOp {
             'x' => FormatHex,
             'X' => FormatHEX,
             's' => FormatString,
-            _ => fail!("bad FormatOp char")
+            _ => panic!("bad FormatOp char")
         }
     }
     fn to_char(self) -> char {
index 307c4b27886a400d5e580a293f6f718ef5b3f695..81d0bb76d1497babe4c89f8ea0e58bd28425529d 100644 (file)
@@ -130,7 +130,7 @@ pub trait TDynBenchFn {
 }
 
 // A function that runs a test. If the function returns successfully,
-// the test succeeds; if the function fails then the test fails. We
+// the test succeeds; if the function panics then the test fails. We
 // may need to come up with a more clever definition of test in order
 // to support isolation of tests into tasks.
 pub enum TestFn {
@@ -235,18 +235,18 @@ pub fn test_main(args: &[String], tests: Vec<TestDescAndFn> ) {
     let opts =
         match parse_opts(args) {
             Some(Ok(o)) => o,
-            Some(Err(msg)) => fail!("{}", msg),
+            Some(Err(msg)) => panic!("{}", msg),
             None => return
         };
     match run_tests_console(&opts, tests) {
         Ok(true) => {}
-        Ok(false) => fail!("Some tests failed"),
-        Err(e) => fail!("io error when running tests: {}", e),
+        Ok(false) => panic!("Some tests failed"),
+        Err(e) => panic!("io error when running tests: {}", e),
     }
 }
 
 // A variant optimized for invocation with a static test vector.
-// This will fail (intentionally) when fed any dynamic tests, because
+// This will panic (intentionally) when fed any dynamic tests, because
 // it is copying the static values out into a dynamic vector and cannot
 // copy dynamic values. It is doing this because from this point on
 // a ~[TestDescAndFn] is used in order to effect ownership-transfer
@@ -257,7 +257,7 @@ pub fn test_main_static(args: &[String], tests: &[TestDescAndFn]) {
         match t.testfn {
             StaticTestFn(f) => TestDescAndFn { testfn: StaticTestFn(f), desc: t.desc.clone() },
             StaticBenchFn(f) => TestDescAndFn { testfn: StaticBenchFn(f), desc: t.desc.clone() },
-            _ => fail!("non-static tests passed to test::test_main_static")
+            _ => panic!("non-static tests passed to test::test_main_static")
         }
     }).collect();
     test_main(args, owned_tests)
@@ -352,7 +352,7 @@ fn usage(binary: &str) {
     #[bench]       - Indicates a function is a benchmark to be run. This
                      function takes one argument (test::Bencher).
     #[should_fail] - This function (also labeled with #[test]) will only pass if
-                     the code causes a failure (an assertion failure or fail!)
+                     the code causes a failure (an assertion failure or panic!)
     #[ignore]      - When applied to a function which is already attributed as a
                      test, then the test runner will ignore these tests during
                      normal test runs. Running with --ignored will run these
@@ -445,7 +445,7 @@ pub fn opt_shard(maybestr: Option<String>) -> Option<(uint,uint)> {
                    it.next()) {
                 (Some(a), Some(b), None) => {
                     if a <= 0 || a > b {
-                        fail!("tried to run shard {a}.{b}, but {a} is out of bounds \
+                        panic!("tried to run shard {a}.{b}, but {a} is out of bounds \
                               (should be between 1 and {b}", a=a, b=b)
                     }
                     Some((a, b))
@@ -964,7 +964,7 @@ fn get_concurrency() -> uint {
             let opt_n: Option<uint> = FromStr::from_str(s.as_slice());
             match opt_n {
                 Some(n) if n > 0 => n,
-                _ => fail!("RUST_TEST_TASKS is `{}`, should be a positive integer.", s)
+                _ => panic!("RUST_TEST_TASKS is `{}`, should be a positive integer.", s)
             }
         }
         None => {
@@ -1120,7 +1120,7 @@ pub fn new() -> MetricMap {
     ///
     /// # Failure
     ///
-    /// This function will fail if the path does not exist or the path does not
+    /// This function will panic if the path does not exist or the path does not
     /// contain a valid metric map.
     pub fn load(p: &Path) -> MetricMap {
         assert!(p.exists());
@@ -1129,7 +1129,7 @@ pub fn load(p: &Path) -> MetricMap {
         let mut decoder = json::Decoder::new(value);
         MetricMap(match Decodable::decode(&mut decoder) {
             Ok(t) => t,
-            Err(e) => fail!("failure decoding JSON: {}", e)
+            Err(e) => panic!("failure decoding JSON: {}", e)
         })
     }
 
@@ -1401,7 +1401,7 @@ mod tests {
 
     #[test]
     pub fn do_not_run_ignored_tests() {
-        fn f() { fail!(); }
+        fn f() { panic!(); }
         let desc = TestDescAndFn {
             desc: TestDesc {
                 name: StaticTestName("whatever"),
@@ -1435,7 +1435,7 @@ fn f() { }
 
     #[test]
     fn test_should_fail() {
-        fn f() { fail!(); }
+        fn f() { panic!(); }
         let desc = TestDescAndFn {
             desc: TestDesc {
                 name: StaticTestName("whatever"),
@@ -1472,7 +1472,7 @@ fn first_free_arg_should_be_a_filter() {
         let args = vec!("progname".to_string(), "some_regex_filter".to_string());
         let opts = match parse_opts(args.as_slice()) {
             Some(Ok(o)) => o,
-            _ => fail!("Malformed arg in first_free_arg_should_be_a_filter")
+            _ => panic!("Malformed arg in first_free_arg_should_be_a_filter")
         };
         assert!(opts.filter.expect("should've found filter").is_match("some_regex_filter"))
     }
@@ -1484,7 +1484,7 @@ fn parse_ignored_flag() {
                         "--ignored".to_string());
         let opts = match parse_opts(args.as_slice()) {
             Some(Ok(o)) => o,
-            _ => fail!("Malformed arg in parse_ignored_flag")
+            _ => panic!("Malformed arg in parse_ignored_flag")
         };
         assert!((opts.run_ignored));
     }
index ee06c3f6caa347d0844529cfd9f0f8a6114d0d8f..590d0bfdcabc42cd610254846f262046074cead8 100644 (file)
@@ -1305,7 +1305,7 @@ fn test_strptime() {
             == Err(InvalidTime));
 
         match strptime("Fri Feb 13 15:31:30.01234 2009", format) {
-          Err(e) => fail!(e),
+          Err(e) => panic!(e),
           Ok(ref tm) => {
             assert!(tm.tm_sec == 30_i32);
             assert!(tm.tm_min == 31_i32);
@@ -1324,7 +1324,7 @@ fn test_strptime() {
         fn test(s: &str, format: &str) -> bool {
             match strptime(s, format) {
               Ok(ref tm) => tm.strftime(format).unwrap() == s.to_string(),
-              Err(e) => fail!(e)
+              Err(e) => panic!(e)
             }
         }
 
index bbaf7991fd3cc5510c99ed9e1a5f1bc7529c2537..44d001d45fda24656063404ee45a7692a693251c 100644 (file)
@@ -38,7 +38,7 @@ pub fn alist_get<A:Clone + 'static,
             return entry.value.clone();
         }
     }
-    fail!();
+    panic!();
 }
 
 #[inline]
index 16b743baa3d1323e901e236b7f7fb32916ebd3e0..bd8857ceef7ea4f55f14b0fa3bb6b9f06edad684 100644 (file)
@@ -10,5 +10,5 @@
 
 
 pub unsafe fn f(xs: Vec<int> ) {
-    xs.iter().map(|_x| { unsafe fn q() { fail!(); } }).collect::<Vec<()>>();
+    xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::<Vec<()>>();
 }
index 6bc5b677a2730ac62c650641affe6ce3ba01403a..fad70a917980d66735b0e8ecbc2319208561745b 100644 (file)
@@ -12,6 +12,6 @@
 #[phase(plugin, link)] extern crate log;
 
 pub fn foo<T>() {
-    fn death() -> int { fail!() }
+    fn death() -> int { panic!() }
     debug!("{}", (||{ death() })());
 }
index 000e42b9703566de3eb358f77012dabbfd4f04ec..9c0716e2cc2a5e7e92786906e996817858d2d54b 100644 (file)
@@ -36,7 +36,7 @@ pub trait IntoMaybeOwned<'a> {
 }
 
 impl<'a> IntoMaybeOwned<'a> for Inv<'a> {
-    fn into_maybe_owned(self) -> MaybeOwned<'a> { fail!() }
-    fn into_inv(self) -> Inv<'a> { fail!() }
-    fn bigger_region<'b:'a>(self, b: Inv<'b>) { fail!() }
+    fn into_maybe_owned(self) -> MaybeOwned<'a> { panic!() }
+    fn into_inv(self) -> Inv<'a> { panic!() }
+    fn bigger_region<'b:'a>(self, b: Inv<'b>) { panic!() }
 }
index eef2fdbfea9d9114a1168b51e3b4bb6093d8f220..811d8f116923980eb5cabe6f0fc7a536b609bfa4 100644 (file)
@@ -36,6 +36,6 @@ fn readMaybe(s: String) -> Option<bool> {
 pub fn read<T:read>(s: String) -> T {
     match read::readMaybe(s) {
       Some(x) => x,
-      _ => fail!("read failed!")
+      _ => panic!("read panicked!")
     }
 }
index c998e362d7e34f96a3a93a3a16da8fd6d8e9e265..6a1f8588b60d74002f10cf696f5d4820c97c0a82 100644 (file)
@@ -28,7 +28,7 @@ fn drop(&mut self) {}
 
 pub fn foo() {
     let _a = A;
-    fail!("wut");
+    panic!("wut");
 }
 
 mod std {
index 404e2e31b05770560b83b9c657d3545f54a4cbaf..39057215b5e6909b1146caed37946b2c559140b9 100644 (file)
@@ -145,7 +145,7 @@ fn is_utf8_ascii() {
     for _ in range(0u, 20000) {
         v.push('b' as u8);
         if !str::is_utf8(v.as_slice()) {
-            fail!("is_utf8 failed");
+            panic!("is_utf8 panicked");
         }
     }
 }
@@ -156,7 +156,7 @@ fn is_utf8_multibyte() {
     for _ in range(0u, 5000) {
         v.push_all(s.as_bytes());
         if !str::is_utf8(v.as_slice()) {
-            fail!("is_utf8 failed");
+            panic!("is_utf8 panicked");
         }
     }
 }
index 4ed0de2a13883699f2ca6c684a7c0a53dd8f6c66..abcd9f90333438473b78e555b1eceae061d5250e 100644 (file)
@@ -90,7 +90,7 @@ fn show_digit(nn: uint) -> &'static str {
         7 => {" seven"}
         8 => {" eight"}
         9 => {" nine"}
-        _ => {fail!("expected digits from 0 to 9...")}
+        _ => {panic!("expected digits from 0 to 9...")}
     }
 }
 
index 1799504eb4782eb29f9728add818c8ec969b5823..d0e6aacdbb2ad0c30a026322913d760808b26087 100644 (file)
@@ -225,7 +225,7 @@ fn pack_symbol(c: u8) -> u8 {
         'C' => 1,
         'G' => 2,
         'T' => 3,
-        _ => fail!("{}", c as char),
+        _ => panic!("{}", c as char),
     }
 }
 
index 8e8378641853bbe30994bc9447028b595e0953e1..6e80c07a1a2aa583c08f76873ad07410308bc27c 100644 (file)
@@ -207,7 +207,7 @@ fn get_id(m: u64) -> u8 {
     for id in range(0u8, 10) {
         if m & (1 << (id + 50) as uint) != 0 {return id;}
     }
-    fail!("{:016x} does not have a valid identifier", m);
+    panic!("{:016x} does not have a valid identifier", m);
 }
 
 // Converts a list of mask to a Vec<u8>.
index 91b9e058e8feacee390c12f2963103fe8e698986..425b2e3e7140bbb9171a7e6484c94cb4a4867331 100644 (file)
@@ -61,7 +61,7 @@ fn parse_opts(argv: Vec<String> ) -> Config {
       Ok(ref m) => {
           return Config {stress: m.opt_present("stress")}
       }
-      Err(_) => { fail!(); }
+      Err(_) => { panic!(); }
     }
 }
 
index 01c412c6d3195420ecb903608f56d782e34415bf..ae7594ea8a20e74b29cd49e0c71f19ebdfadbcd3 100644 (file)
@@ -83,7 +83,7 @@ pub fn read(mut reader: BufferedReader<StdReader>) -> Sudoku {
                     from_str::<uint>(comps[2]).unwrap() as u8;
             }
             else {
-                fail!("Invalid sudoku file");
+                panic!("Invalid sudoku file");
             }
         }
         return Sudoku::new(g)
@@ -123,7 +123,7 @@ pub fn solve(&mut self) {
                 ptr = ptr + 1u;
             } else {
                 // no: redo this field aft recoloring pred; unless there is none
-                if ptr == 0u { fail!("No solution found for this sudoku"); }
+                if ptr == 0u { panic!("No solution found for this sudoku"); }
                 ptr = ptr - 1u;
             }
         }
index bdeee5fb6e0bf6b6ca47968d72d630e5189ed6d7..5d96c90197cce0390f442855c6f65033e9d3cf00 100644 (file)
@@ -39,7 +39,7 @@ fn run(repeat: int, depth: int) {
     for _ in range(0, repeat) {
         println!("starting {:.4f}", precise_time_s());
         task::try(proc() {
-            recurse_or_fail(depth, None)
+            recurse_or_panic(depth, None)
         });
         println!("stopping {:.4f}", precise_time_s());
     }
@@ -70,10 +70,10 @@ fn r(l: Box<nillist>) -> r {
     }
 }
 
-fn recurse_or_fail(depth: int, st: Option<State>) {
+fn recurse_or_panic(depth: int, st: Option<State>) {
     if depth == 0 {
         println!("unwinding {:.4f}", precise_time_s());
-        fail!();
+        panic!();
     } else {
         let depth = depth - 1;
 
@@ -96,6 +96,6 @@ fn recurse_or_fail(depth: int, st: Option<State>) {
             }
         };
 
-        recurse_or_fail(depth, Some(st));
+        recurse_or_panic(depth, Some(st));
     }
 }
index 9ebdbf0682d79d5e6e374e4bc54a80b413bf9da9..3d2822e14597ff4d8400eb88144d19ac367c1d61 100644 (file)
@@ -51,6 +51,6 @@ fn main() {
     let (tx, rx) = channel();
     child_generation(from_str::<uint>(args[1].as_slice()).unwrap(), tx);
     if rx.recv_opt().is_err() {
-        fail!("it happened when we slumbered");
+        panic!("it happened when we slumbered");
     }
 }
index 69200ffedf9bb78d930dd8ae703b0484786947a9..7e8142dbb2908de386b67d3b067ceaaf3fc8c9f1 100644 (file)
@@ -11,7 +11,7 @@
 // Tests that a function with a ! annotation always actually fails
 
 fn bad_bang(i: uint) -> ! { //~ ERROR computation may converge in a function marked as diverging
-    if i < 0u { } else { fail!(); }
+    if i < 0u { } else { panic!(); }
 }
 
 fn main() { bad_bang(5u); }
index 87904399e032fca326f83f5ee3eedeff52e9ad3e..2a5c7136dc377ba5475ca833b219db6d89768125 100644 (file)
@@ -20,6 +20,6 @@ fn main() {
     let x = Some((X { x: () }, X { x: () }));
     match x {
         Some((ref _y, _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
-        None => fail!()
+        None => panic!()
     }
 }
index ba011d289255f7b47bb89400d3b68e5d1ee7fb7f..ae568a5277ce8d0e0215fdc3dfc22c1ec2813223 100644 (file)
@@ -22,6 +22,6 @@ fn main() {
     let x = some2(X { x: () }, X { x: () });
     match x {
         some2(ref _y, _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
-        none2 => fail!()
+        none2 => panic!()
     }
 }
index 6858b7200db6ce8527bcda458fd35ab1f02a57b4..8c7542fbe6b3d02c1c84aefdb3957891eff73a7c 100644 (file)
@@ -20,6 +20,6 @@ fn main() {
     let x = Some((X { x: () }, X { x: () }));
     match x {
         Some((_y, ref _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
-        None => fail!()
+        None => panic!()
     }
 }
index 5602aff5cadcfd1b7441dd25b1cc9c8361b5b008..18534db0dd5a074450bc65b564b45f591d2d5980 100644 (file)
@@ -13,8 +13,8 @@ fn main() {
     let x = Some(rx);
     tx.send(false);
     match x {
-        Some(z) if z.recv() => { fail!() }, //~ ERROR cannot bind by-move into a pattern guard
+        Some(z) if z.recv() => { panic!() }, //~ ERROR cannot bind by-move into a pattern guard
         Some(z) => { assert!(!z.recv()); },
-        None => fail!()
+        None => panic!()
     }
 }
index 12624a49f7a295508a0e954c32f85eeeed1b080f..3e0cd05cba346b89d98a94e28f058327c932272a 100644 (file)
@@ -20,12 +20,12 @@ fn distinct_variant() {
 
     let a = match y {
       Y(ref mut a, _) => a,
-      X => fail!()
+      X => panic!()
     };
 
     let b = match y {
       Y(_, ref mut b) => b,
-      X => fail!()
+      X => panic!()
     };
 
     *a += 1;
@@ -37,12 +37,12 @@ fn same_variant() {
 
     let a = match y {
       Y(ref mut a, _) => a,
-      X => fail!()
+      X => panic!()
     };
 
     let b = match y {
       Y(ref mut b, _) => b, //~ ERROR cannot borrow
-      X => fail!()
+      X => panic!()
     };
 
     *a += 1;
index 2a2a3dee1dfa6724cb9462dfc9807c3ebc0788ce..4c6088969f3595a8c31fcb56f2ce2e55a3f4ae3b 100644 (file)
@@ -28,7 +28,7 @@ fn main() {
                     x = X(Left((0,0)));
                     (*f)()
                 },
-                _ => fail!()
+                _ => panic!()
             }
         })
 }
index 208f58f6b54c1956b35d071ddfa2932bdd32a1c4..c071691c94707c0a27c8b2578096fb89495c829d 100644 (file)
@@ -19,7 +19,7 @@ struct Bar {
   int2: int,
 }
 
-fn make_foo() -> Box<Foo> { fail!() }
+fn make_foo() -> Box<Foo> { panic!() }
 
 fn borrow_same_field_twice_mut_mut() {
     let mut foo = make_foo();
index cdcf50c906e3655234f3a9cdd276d505a8e99355..3a85b45ad126dffe44dcaede60251ddfb7ed67fc 100644 (file)
@@ -18,7 +18,7 @@ struct Bar {
   int2: int,
 }
 
-fn make_foo() -> Foo { fail!() }
+fn make_foo() -> Foo { panic!() }
 
 fn borrow_same_field_twice_mut_mut() {
     let mut foo = make_foo();
index 61c77ce7bbaa9ac2acaa571ac4e126775d3ae845..febc84ccd44613c8fb7401c8c852cad9c880ca8b 100644 (file)
@@ -43,7 +43,7 @@ fn d(x: &mut int) {
 }
 
 fn e(x: &mut int) {
-    let c1: || = || x = fail!(); //~ ERROR closure cannot assign to immutable local variable
+    let c1: || = || x = panic!(); //~ ERROR closure cannot assign to immutable local variable
 }
 
 fn main() {
index e556b1bc184e3e207bdf9cc64c455e8f63bde492..8a7ecde700ae6f7cbab94f64f68d198002007978 100644 (file)
@@ -17,9 +17,9 @@
 
 fn borrow(_v: &int) {}
 fn borrow_mut(_v: &mut int) {}
-fn cond() -> bool { fail!() }
-fn for_func(_f: || -> bool) { fail!() }
-fn produce<T>() -> T { fail!(); }
+fn cond() -> bool { panic!() }
+fn for_func(_f: || -> bool) { panic!() }
+fn produce<T>() -> T { panic!(); }
 
 fn inc(v: &mut Box<int>) {
     *v = box() (**v + 1);
index 12e1240d10d633ed60cd64f8dfca1c5c2d409278..6adcfad33f46c58c582f7ffe1d14538f2cefa762 100644 (file)
@@ -17,8 +17,8 @@
 
 fn borrow(_v: &int) {}
 fn borrow_mut(_v: &mut int) {}
-fn cond() -> bool { fail!() }
-fn produce<T>() -> T { fail!(); }
+fn cond() -> bool { panic!() }
+fn produce<T>() -> T { panic!(); }
 
 fn inc(v: &mut Box<int>) {
     *v = box() (**v + 1);
index 7ad2d9040940ceca723de4e88e9060fca3d2e457..de8c7d9def4e1b709f2441091e18a809c0a42384 100644 (file)
@@ -17,9 +17,9 @@
 
 fn borrow(_v: &int) {}
 fn borrow_mut(_v: &mut int) {}
-fn cond() -> bool { fail!() }
-fn for_func(_f: || -> bool) { fail!() }
-fn produce<T>() -> T { fail!(); }
+fn cond() -> bool { panic!() }
+fn for_func(_f: || -> bool) { panic!() }
+fn produce<T>() -> T { panic!(); }
 
 fn inc(v: &mut Box<int>) {
     *v = box() (**v + 1);
index 30d57d4d755f04ade8515289684b84ab6950fe1a..376832ada4ef5b433cdc38dab5ed796b41353137 100644 (file)
@@ -16,7 +16,7 @@ fn f(x: &mut Either<int,f64>, y: &Either<int,f64>) -> int {
                 *x = Right(1.0);
                 *z
             }
-            _ => fail!()
+            _ => panic!()
         }
     }
 
index ba1d3a9ddba795c749f2e6b5a4660cbfcf71cbc8..726d4bcdf1d083a222c2680b15e8a1dc49f6fc00 100644 (file)
@@ -14,7 +14,7 @@ fn main() {
         Some(ref m) => { //~ ERROR borrowed value does not live long enough
             msg = m;
         },
-        None => { fail!() }
+        None => { panic!() }
     }
     println!("{}", *msg);
 }
index d256b033298ed988d7d6b292eaaed6b426b2cfdf..4a5418a4f20c21b3dca027a7bb4415a47514a64d 100644 (file)
@@ -15,7 +15,7 @@ fn a<'a>() -> &'a [int] {
     let vec: &[int] = vec.as_slice(); //~ ERROR does not live long enough
     let tail = match vec {
         [_, tail..] => tail,
-        _ => fail!("a")
+        _ => panic!("a")
     };
     tail
 }
@@ -25,7 +25,7 @@ fn b<'a>() -> &'a [int] {
     let vec: &[int] = vec.as_slice(); //~ ERROR does not live long enough
     let init = match vec {
         [init.., _] => init,
-        _ => fail!("b")
+        _ => panic!("b")
     };
     init
 }
@@ -35,7 +35,7 @@ fn c<'a>() -> &'a [int] {
     let vec: &[int] = vec.as_slice(); //~ ERROR does not live long enough
     let slice = match vec {
         [_, slice.., _] => slice,
-        _ => fail!("c")
+        _ => panic!("c")
     };
     slice
 }
index 2c9cf7d1b65be0abf147be7a86b1e360afb9a0f9..852eb172c59d10335e37783a4c0f94092c84ea57 100644 (file)
@@ -13,7 +13,7 @@ fn a<'a>() -> &'a int {
     let vec: &[int] = vec.as_slice(); //~ ERROR `vec` does not live long enough
     let tail = match vec {
         [_a, tail..] => &tail[0],
-        _ => fail!("foo")
+        _ => panic!("foo")
     };
     tail
 }
index 05317e9c6b029970ccd59d05e5b4ef2a5a80b0cc..7a1ebed0a82acb433a9d128ae54485fce6fe090b 100644 (file)
@@ -12,8 +12,8 @@ fn foo(f: || -> !) {}
 
 fn main() {
     // Type inference didn't use to be able to handle this:
-    foo(|| fail!());
-    foo(|| -> ! fail!());
+    foo(|| panic!());
+    foo(|| -> ! panic!());
     foo(|| 22i); //~ ERROR computation may converge in a function marked as diverging
     foo(|| -> ! 22i); //~ ERROR computation may converge in a function marked as diverging
     let x = || -> ! 1i; //~ ERROR computation may converge in a function marked as diverging
index 578de06b74780da03fd72c4cda87673aab1a1012..da2e6200eb65f222a90d753236204aeb3f6d4eb2 100644 (file)
@@ -20,7 +20,7 @@ trait MyTrait<T> {
 
 impl<T> MyTrait<T> for T { //~ ERROR E0119
     fn get(&self) -> T {
-        fail!()
+        panic!()
     }
 }
 
index 96e8378a35df8e8e6da67e7a73cb9c5114827a49..3179b1815609f9bbc87a94874dd485e69262d786 100644 (file)
@@ -11,7 +11,7 @@
 #![deny(unreachable_code)]
 
 fn main() {
-    let x: || -> ! = || fail!();
+    let x: || -> ! = || panic!();
     x();
     println!("Foo bar"); //~ ERROR: unreachable statement
 }
index 7b1b0f6243ac4321b22ebd7470b7d8be4441979e..1c711c0145d90f936d11a375c3294ad47f9956d8 100644 (file)
@@ -10,6 +10,6 @@
 
 fn main() {
   match *1 { //~ ERROR: cannot be dereferenced
-      _ => { fail!(); }
+      _ => { panic!(); }
   }
 }
index 58ecdec538e0bc2a25c6f4d834d3333a72b87ac0..49a927b9879e491eb62c98b8f71aebd2f5c217c7 100644 (file)
 fn foo() { //~ ERROR function is never used
 
     // none of these should have any dead_code exposed to the user
-    fail!();
+    panic!();
 
-    fail!("foo");
+    panic!("foo");
 
-    fail!("bar {}", "baz")
+    panic!("bar {}", "baz")
 }
 
 
index 897710609fd41685e750b7ea1c1bbcf850dd9e82..6e5d3a313556e3809e85324e6e03f2b68bb61b8d 100644 (file)
 fn foo() { //~ ERROR function is never used
 
     // none of these should have any dead_code exposed to the user
-    fail!();
+    panic!();
 
-    fail!("foo");
+    panic!("foo");
 
-    fail!("bar {}", "baz")
+    panic!("bar {}", "baz")
 }
 
 
index 19c1aa1ba204f7109406577b9d6e6386c0402e18..97b709592a9c9434487e739fb6804aeaeac595c4 100644 (file)
@@ -11,5 +11,5 @@
 
 // error-pattern:unexpected token
 fn main() {
-  fail!(@);
+  panic!(@);
 }
index 8b52324848bf4409d101d22347823ff9f7e44209..651072d2118e5f3648070ef49d6018883d2ead93 100644 (file)
@@ -23,7 +23,7 @@ trait Foo<'a> {
 }
 
 impl<'a> Foo<'a> for &'a str {
-    fn bar<T: Bar<'a>>(self) -> &'a str { fail!() } //~ ERROR lifetime
+    fn bar<T: Bar<'a>>(self) -> &'a str { panic!() } //~ ERROR lifetime
 }
 
 fn main() {
index 8d7125d7fdd3a991c1ea2f6ca541b057f7c94fec..2cbb59cc15a204a2e7ae84e2d0ef580c57939144 100644 (file)
@@ -10,7 +10,7 @@
 
 struct A { foo: int }
 
-fn a() -> A { fail!() }
+fn a() -> A { panic!() }
 
 fn main() {
     let A { .., } = a(); //~ ERROR: expected `}`
index 455704376d6f946d5ffe7a883bc97e6d365d6b5c..4d0e02c6310c202670c4cbdb62fe624422d47c8d 100644 (file)
@@ -10,7 +10,7 @@
 
 struct A { foo: int }
 
-fn a() -> A { fail!() }
+fn a() -> A { panic!() }
 
 fn main() {
     let A { , } = a(); //~ ERROR: expected ident
index e5400bf60c361c227b70986c24c9e09b9a2ea5c0..55c12b051b94d85bc49e0b3380e1228e7c03a299 100644 (file)
@@ -13,7 +13,7 @@ fn main() {
     match a {
         Ok(a) => //~ ERROR: mismatched types
             println!("{}",a),
-        None => fail!()
+        None => panic!()
     }
 }
 
index a80e405d05ca2ee077b2a613df28c9079cb43926..cc0841a6856caa3bcc4d9d1fc36f7bfaa14a88d4 100644 (file)
@@ -18,7 +18,7 @@ fn tail(source_list: &IntList) -> IntList {
         &Cons(val, box ref next_list) => tail(next_list),
         &Cons(val, box Nil)           => Cons(val, box Nil),
         //~^ ERROR: unreachable pattern
-        _                          => fail!()
+        _                          => panic!()
     }
 }
 
index 356d95452b3e1788789d9acfcdedd8b038479455..74423b041dda327b231e43c827ad48575bcdc59d 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 fn new<T>() -> &'static T {
-    fail!()
+    panic!()
 }
 
 fn main() {
index a67d9dee9768f206e9e0ed6e9c1632f5c969b4c3..af5c8b45a483e4ad118bd3f97ed1415dcf320705 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 fn new<'r, T>() -> &'r T {
-    fail!()
+    panic!()
 }
 
 fn main() {
index 14cc0a82df5b24105f8e2db6f8ea12e66362f88f..e150c1a0f2fc83f8484419a5fc311f5ca9f416e0 100644 (file)
@@ -16,6 +16,6 @@ pub fn main() {
     // tricked into looking up a non-existing second type parameter.
     let _x: uint = match Some(1u) {
         Ok(u) => u, //~ ERROR  mismatched types: expected `core::option::Option<uint>`
-        Err(e) => fail!(e)  //~ ERROR mismatched types: expected `core::option::Option<uint>`
+        Err(e) => panic!(e)  //~ ERROR mismatched types: expected `core::option::Option<uint>`
     };
 }
index 19d210f190595ea8ca7899e5bed01303a86a94f6..e64d674b7c862f1c379c33f447c614a461950d13 100644 (file)
@@ -15,7 +15,7 @@ trait vec_monad<A> {
 
 impl<A> vec_monad<A> for Vec<A> {
     fn bind<B>(&self, f: |A| -> Vec<B> ) {
-        let mut r = fail!();
+        let mut r = panic!();
         for elt in self.iter() { r = r + f(*elt); }
         //~^ ERROR the type of this value must be known
         //~^^ ERROR not implemented
index 7457a1020cee1c31c7fdf01bfaa6663fdb5497c9..468fed1eff5ad8d73825f10ea2a2d7dd58777203 100644 (file)
@@ -14,7 +14,7 @@
 
 fn fail_len(v: Vec<int> ) -> uint {
     let mut i = 3;
-    fail!();
+    panic!();
     for x in v.iter() { i += 1u; }
     //~^ ERROR: unreachable statement
     return i;
index 5559ba344ed17a44e61bc775f65e77413276e033..fbd8f9163b5df9a9a5238ac36adc09e9e57414b4 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 fn main() {
-    let x = fail!();
+    let x = panic!();
     x.clone(); //~ ERROR the type of this value must be known in this context
 }
index e46dbaf0ae0e638cc41bbcb82594355a241e5a0c..6291b0240533f2170a02dee2ef9fe7949215a830 100644 (file)
@@ -16,7 +16,7 @@ trait channel<T> {
 
 // `chan` is not a trait, it's an enum
 impl chan for int { //~ ERROR `chan` is not a trait
-    fn send(&self, v: int) { fail!() }
+    fn send(&self, v: int) { panic!() }
 }
 
 fn main() {
index a2bb56fdf5f65b38b0cb4c15ca839924cb8ee556..93f38a50b05821f32972530a46f94aae91eb7ee3 100644 (file)
@@ -10,8 +10,8 @@
 
 fn foo() { //~ NOTE Did you mean to close this delimiter?
   match Some(x) {
-      Some(y) { fail!(); }
-      None    { fail!(); }
+      Some(y) { panic!(); }
+      None    { panic!(); }
 }
 
 fn bar() {
index 42b70c28be6045cdd944be8771bb50fdf392e394..70ffa86359d5a5a2d9ffe38a43301183f1f12681 100644 (file)
@@ -20,7 +20,7 @@ struct E {
 }
 
 impl A for E {
-  fn b<F: Sync, G>(_x: F) -> F { fail!() } //~ ERROR type parameter 0 requires `Sync`
+  fn b<F: Sync, G>(_x: F) -> F { panic!() } //~ ERROR type parameter 0 requires `Sync`
 }
 
 fn main() {}
index 9b8346da5c5d932dc2886938037bb32cbe931fb3..2eda5d67edd8e5409353dd8a6b9dc84bc07a34cb 100644 (file)
@@ -21,7 +21,7 @@ struct E {
 
 impl A for E {
   // n.b. The error message is awful -- see #3404
-  fn b<F:Clone,G>(&self, _x: G) -> G { fail!() } //~ ERROR method `b` has an incompatible type
+  fn b<F:Clone,G>(&self, _x: G) -> G { panic!() } //~ ERROR method `b` has an incompatible type
 }
 
 fn main() {}
index d44d81b7fe01d1d7a399c901461cacb8ff2ad4ef..578f100eba40b967e84c5ae098acdbb0606cfe6c 100644 (file)
@@ -23,7 +23,7 @@ fn reset(&self) {
            //~^ ERROR unresolved name `k0`.
         }
     }
-    fail!();
+    panic!();
 }
 
 fn main() {}
index dd27314e14fa3e03f7674c3c68f8ea7985d998c4..2716d49fe69a8d3171883f8d94e6e493dcde7b54 100644 (file)
@@ -38,6 +38,6 @@ fn main() {
         box Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns
             box HTMLImageElement(ref d) if d.image.is_some() => { true }
         },
-        _ => fail!("WAT") //~ ERROR unreachable pattern
+        _ => panic!("WAT") //~ ERROR unreachable pattern
     };
 }
index cccf730095bdfad0ba5ad1a0902c717d934322bd..9c31dc1e38ef8ff312193b105a73e9346e9d0153 100644 (file)
@@ -17,7 +17,7 @@ impl PTrait for P {
    fn getChildOption(&self) -> Option<Box<P>> {
        static childVal: Box<P> = self.child.get();
        //~^ ERROR attempt to use a non-constant value in a constant
-       fail!();
+       panic!();
    }
 }
 
index e1779a1db8697203fd7e2bc3d09a788cd4c4de54..0edcfa8a5477d19178891e0275c672f5b904bfe3 100644 (file)
@@ -16,5 +16,5 @@ fn main() {
     let a = 5;
     let _iter = TrieMapIterator{node: &a};
     _iter.node = & //~ ERROR cannot assign to immutable field
-    fail!()
+    panic!()
 }
index cb3ffae5dbae3df047b03159c3daeed3e38a0259..52a57fa2f4411322505b2d23f188990230f8b305 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 fn foo<T>(t: T) {}
-fn main() { foo(fail!()) }
+fn main() { foo(panic!()) }
     //~^ ERROR type annotations required
index e6b97b727a7e9f078be1114ea736a06c8aa61385..659b1426bd3f99a86d830adc8ee3c21b2b1f7179 100644 (file)
@@ -10,7 +10,7 @@
 
 #![deny(unreachable_code)]
 
-fn g() -> ! { fail!(); }
+fn g() -> ! { panic!(); }
 fn f() -> ! {
     return g(); //~ ERROR `return` in a function declared as diverging
     g();
index 944546d0b4a61e53fdd8debef92f3f0c634b6638..b9cfbd695b0473049a1963b7c321c43051f41e84 100644 (file)
@@ -11,8 +11,8 @@
 #![deny(unreachable_code)]
 
 fn f() -> ! {
-    return fail!(); //~ ERROR `return` in a function declared as diverging
-    fail!(); // the unreachable statement error is in <std macro>, at this line, there
+    return panic!(); //~ ERROR `return` in a function declared as diverging
+    panic!(); // the unreachable statement error is in <std macro>, at this line, there
              // only is a note
 }
 
index 5fa8c5db5b01c95a9dd9f73c17ad3e6cbae96c82..849f337743b77d86e42512594afab680ba8a0fb1 100644 (file)
 // Lifetime annotation needed because we have no arguments.
 fn f() -> &int {    //~ ERROR missing lifetime specifier
 //~^ NOTE there is no value for it to be borrowed from
-    fail!()
+    panic!()
 }
 
 // Lifetime annotation needed because we have two by-reference parameters.
 fn g(_x: &int, _y: &int) -> &int {    //~ ERROR missing lifetime specifier
 //~^ NOTE the signature does not say whether it is borrowed from `_x` or `_y`
-    fail!()
+    panic!()
 }
 
 struct Foo<'a> {
@@ -28,7 +28,7 @@ struct Foo<'a> {
 // and one on the reference.
 fn h(_x: &Foo) -> &int { //~ ERROR missing lifetime specifier
 //~^ NOTE the signature does not say which one of `_x`'s 2 elided lifetimes it is borrowed from
-    fail!()
+    panic!()
 }
 
 fn main() {}
index 8ae3f1fdd0d74bc76efe6ba3a745d1885edb2771..df3feefa881f3f28231da76f42a16c03d62c80c4 100644 (file)
@@ -20,7 +20,7 @@ mod foo {
     }
 }
 
-fn callback<T>(_f: || -> T) -> T { fail!() }
+fn callback<T>(_f: || -> T) -> T { panic!() }
 unsafe fn unsf() {}
 
 fn bad1() { unsafe {} }                  //~ ERROR: unnecessary `unsafe` block
@@ -50,7 +50,7 @@ fn good2() {
        sure that when purity is inherited that the source of the unsafe-ness
        is tracked correctly */
     unsafe {
-        unsafe fn what() -> Vec<String> { fail!() }
+        unsafe fn what() -> Vec<String> { panic!() }
 
         callback(|| {
             what();
index 4a4032d2ab932ddbddb3e99fc7e81d8f86427492..55ffdcd7f9fb314a51b242411976726a07c5fd67 100644 (file)
 pub struct Public<T>;
 
 impl Private<Public<int>> {
-    pub fn a(&self) -> Private<int> { fail!() }
-    fn b(&self) -> Private<int> { fail!() }
+    pub fn a(&self) -> Private<int> { panic!() }
+    fn b(&self) -> Private<int> { panic!() }
 
-    pub fn c() -> Private<int> { fail!() }
-    fn d() -> Private<int> { fail!() }
+    pub fn c() -> Private<int> { panic!() }
+    fn d() -> Private<int> { panic!() }
 }
 impl Private<int> {
-    pub fn e(&self) -> Private<int> { fail!() }
-    fn f(&self) -> Private<int> { fail!() }
+    pub fn e(&self) -> Private<int> { panic!() }
+    fn f(&self) -> Private<int> { panic!() }
 }
 
 impl Public<Private<int>> {
-    pub fn a(&self) -> Private<int> { fail!() }
-    fn b(&self) -> Private<int> { fail!() }
+    pub fn a(&self) -> Private<int> { panic!() }
+    fn b(&self) -> Private<int> { panic!() }
 
-    pub fn c() -> Private<int> { fail!() } //~ ERROR private type in exported type signature
-    fn d() -> Private<int> { fail!() }
+    pub fn c() -> Private<int> { panic!() } //~ ERROR private type in exported type signature
+    fn d() -> Private<int> { panic!() }
 }
 impl Public<int> {
-    pub fn e(&self) -> Private<int> { fail!() } //~ ERROR private type in exported type signature
-    fn f(&self) -> Private<int> { fail!() }
+    pub fn e(&self) -> Private<int> { panic!() } //~ ERROR private type in exported type signature
+    fn f(&self) -> Private<int> { panic!() }
 }
 
 pub fn x(_: Private<int>) {} //~ ERROR private type in exported type signature
@@ -70,39 +70,39 @@ enum Qux {
 }
 
 pub trait PubTrait {
-    fn foo(&self) -> Private<int> { fail!( )} //~ ERROR private type in exported type signature
+    fn foo(&self) -> Private<int> { panic!( )} //~ ERROR private type in exported type signature
     fn bar(&self) -> Private<int>; //~ ERROR private type in exported type signature
     fn baz() -> Private<int>; //~ ERROR private type in exported type signature
 }
 
 impl PubTrait for Public<int> {
-    fn bar(&self) -> Private<int> { fail!() }
-    fn baz() -> Private<int> { fail!() }
+    fn bar(&self) -> Private<int> { panic!() }
+    fn baz() -> Private<int> { panic!() }
 }
 impl PubTrait for Public<Private<int>> {
-    fn bar(&self) -> Private<int> { fail!() }
-    fn baz() -> Private<int> { fail!() }
+    fn bar(&self) -> Private<int> { panic!() }
+    fn baz() -> Private<int> { panic!() }
 }
 
 impl PubTrait for Private<int> {
-    fn bar(&self) -> Private<int> { fail!() }
-    fn baz() -> Private<int> { fail!() }
+    fn bar(&self) -> Private<int> { panic!() }
+    fn baz() -> Private<int> { panic!() }
 }
 impl PubTrait for (Private<int>,) {
-    fn bar(&self) -> Private<int> { fail!() }
-    fn baz() -> Private<int> { fail!() }
+    fn bar(&self) -> Private<int> { panic!() }
+    fn baz() -> Private<int> { panic!() }
 }
 
 
 trait PrivTrait {
-    fn foo(&self) -> Private<int> { fail!( )}
+    fn foo(&self) -> Private<int> { panic!( )}
     fn bar(&self) -> Private<int>;
 }
 impl PrivTrait for Private<int> {
-    fn bar(&self) -> Private<int> { fail!() }
+    fn bar(&self) -> Private<int> { panic!() }
 }
 impl PrivTrait for (Private<int>,) {
-    fn bar(&self) -> Private<int> { fail!() }
+    fn bar(&self) -> Private<int> { panic!() }
 }
 
 pub trait ParamTrait<T> {
@@ -111,14 +111,14 @@ pub trait ParamTrait<T> {
 
 impl ParamTrait<Private<int>> //~ ERROR private type in exported type signature
    for Public<int> {
-    fn foo() -> Private<int> { fail!() }
+    fn foo() -> Private<int> { panic!() }
 }
 
 impl ParamTrait<Private<int>> for Private<int> {
-    fn foo() -> Private<int> { fail!( )}
+    fn foo() -> Private<int> { panic!( )}
 }
 
 impl<T: ParamTrait<Private<int>>>  //~ ERROR private type in exported type signature
      ParamTrait<T> for Public<i8> {
-    fn foo() -> T { fail!() }
+    fn foo() -> T { panic!() }
 }
index 54d0b2d00c776c8f308585a8f3b407477afcccdb..1ad696503e7f9994b5467479ace60a69a27422fc 100644 (file)
@@ -11,7 +11,7 @@
 fn send<T:Send + std::fmt::Show>(ch: _chan<T>, data: T) {
     println!("{}", ch);
     println!("{}", data);
-    fail!();
+    panic!();
 }
 
 #[deriving(Show)]
@@ -24,4 +24,4 @@ fn test00_start(ch: _chan<Box<int>>, message: Box<int>, _count: Box<int>) {
     println!("{}", message); //~ ERROR use of moved value: `message`
 }
 
-fn main() { fail!(); }
+fn main() { panic!(); }
index de44a005fc33ad599c66f92421b86a550a23a0e5..8064ef0e427a37e6b300db3e92af6e2612146037 100644 (file)
 // a good test that we merge paths correctly in the presence of a
 // variable that's used before it's declared
 
-fn my_fail() -> ! { fail!(); }
+fn my_panic() -> ! { panic!(); }
 
 fn main() {
-    match true { false => { my_fail(); } true => { } }
+    match true { false => { my_panic(); } true => { } }
 
     println!("{}", x); //~ ERROR unresolved name `x`.
     let x: int;
index 1d6dc504ab43b7baaea5f1e4310a4660fd98a890..678808f166cde90c7f094e97b7e14241aea31357 100644 (file)
@@ -13,7 +13,7 @@
 
 
 struct Foo<A> { f: A }
-fn guard(_s: String) -> bool {fail!()}
+fn guard(_s: String) -> bool {panic!()}
 fn touch<A>(_a: &A) {}
 
 fn f10() {
index 65ae25396c8d625502a099a354afc2676ab1e144..7d209467caf2a6f75cadb25948a6625c02c163d4 100644 (file)
@@ -13,7 +13,7 @@
 // terms of the binding, not the discriminant.
 
 struct Foo<A> { f: A }
-fn guard(_s: String) -> bool {fail!()}
+fn guard(_s: String) -> bool {panic!()}
 fn touch<A>(_a: &A) {}
 
 fn f10() {
index ff5ad2c5e193604a0cc2ecdfef7ebb503c673cbd..2a73b769895eeeb75be648157400f0bc3d73d75d 100644 (file)
@@ -31,7 +31,7 @@ fn innocent_looking_victim() {
                     //~^ ERROR: cannot borrow `*f` as mutable because
                     println!("{}", msg);
                 },
-                None => fail!("oops"),
+                None => panic!("oops"),
             }
         }
     })
index 439c82a6df08b19f858cd68de06f24abe731a74d..eb946a90c376c5d3ef4f700ffc27f2988caa903a 100644 (file)
@@ -23,7 +23,7 @@ fn match_nested_vecs<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'s
 fn main() {
     let x = a(c);
     match x { //~ ERROR non-exhaustive patterns: `a(c)` not covered
-        a(d) => { fail!("hello"); }
-        b => { fail!("goodbye"); }
+        a(d) => { panic!("hello"); }
+        b => { panic!("goodbye"); }
     }
 }
index 57eca3666ef14ef3dc363b4e1f8c32f719f26b58..2deb9591a834d08082dae64cce1d76e222eebb6f 100644 (file)
@@ -13,7 +13,7 @@
 // unrelated errors.
 
 fn foo(a: int, b: int, c: int, d:int) {
-  fail!();
+  panic!();
 }
 
 fn main() {
index 38669a99b498f1964e8f7405c26ed6857335d57b..7da62ef4db7daf976f6cafed7c850ee3c22f22ea 100644 (file)
@@ -11,7 +11,7 @@
 enum bar { t1((), Option<Vec<int>>), t2, }
 
 // n.b. my change changes this error message, but I think it's right -- tjc
-fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { fail!(); } } }
+fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { panic!(); } } }
 //~^ ERROR binary operation `*` cannot be applied to
 
 fn main() { }
index efb98a74538f2e6a3409f19db909d55f56100387..7752ea521f7e35a1b1ce1da989bbae1c009498d8 100644 (file)
@@ -17,7 +17,7 @@ fn foo(t: bar) {
       t1(_, Some::<int>(x)) => {
         println!("{}", x);
       }
-      _ => { fail!(); }
+      _ => { panic!(); }
     }
 }
 
index 06d473baea878403c7d12375fd41129b8cb19de2..deae9a83866038256d0fa9785dd93b3b48622b74 100644 (file)
@@ -64,5 +64,5 @@ fn main() {
 }
 
 fn check_pp<T>(expr: T, f: |pprust::ps, T|, expect: str) {
-    fail!();
+    panic!();
 }
index f63dd91eb2bc14465beefa07878d214028736f72..94485dddd136b01c45a2617a341c2182cab84f61 100644 (file)
@@ -57,5 +57,5 @@ fn main() {
 }
 
 fn check_pp<T>(expr: T, f: |pprust::ps, T|, expect: str) {
-    fail!();
+    panic!();
 }
index b3b5993bf915bd06d51143ba57dec3fd1fa18cab..c2b52b79f6c87cc894c533570e5a15f5f8cba867 100644 (file)
@@ -21,8 +21,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn of<T>() -> |T| { fail!(); }
-fn subtype<T>(x: |T|) { fail!(); }
+fn of<T>() -> |T| { panic!(); }
+fn subtype<T>(x: |T|) { panic!(); }
 
 fn test_fn<'x, 'y, 'z, T>(_x: &'x T, _y: &'y T, _z: &'z T) {
     // Here, x, y, and z are free.  Other letters
index 2d20634cdc41de8a9bcdfe0d8fa336f227cf68c6..72004f8714c6e361d87eb92def4fed742f0069ed 100644 (file)
@@ -31,17 +31,17 @@ fn want_G(f: G) { }
 
 // Should meet both.
 fn foo(x: &S) -> &'static S {
-    fail!()
+    panic!()
 }
 
 // Should meet both.
 fn bar<'a,'b>(x: &'a S) -> &'b S {
-    fail!()
+    panic!()
 }
 
 // Meets F, but not G.
 fn baz(x: &S) -> &S {
-    fail!()
+    panic!()
 }
 
 fn supply_F() {
index 30b33e82a4b79b32dd71aed7c7b87ca6d0f6b2eb..8e8d892a39f22dd0f4a5d5189c804e3690d8d755 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn of<'a,T>() -> |T|:'a { fail!(); }
-fn subtype<T>(x: |T|) { fail!(); }
+fn of<'a,T>() -> |T|:'a { panic!(); }
+fn subtype<T>(x: |T|) { panic!(); }
 
 fn test_fn<'x,'y,'z,T>(_x: &'x T, _y: &'y T, _z: &'z T) {
     // Here, x, y, and z are free.  Other letters
index 26cf3be429bd6dc36063cac66aff5996ec37f559..435d10a0a29a1c07db7a43a40d2ca3bfee547143 100644 (file)
@@ -27,7 +27,7 @@ fn ordering3<'a, 'b>(x: &'a uint, y: &'b uint) -> &'a &'b uint {
     // Do not infer an ordering from the return value.
     let z: &'b uint = &*x;
     //~^ ERROR cannot infer
-    fail!();
+    panic!();
 }
 
 fn ordering4<'a, 'b>(a: &'a uint, b: &'b uint, x: |&'a &'b uint|) {
index 9615e32bb1acf28f88ff00da9d2907467393bfe0..a9df449032e6fef4d9a22e03b57131458ed0ee03 100644 (file)
@@ -15,7 +15,7 @@
 use std::vec::Vec;
 
 fn last<T>(v: Vec<&T> ) -> std::option::Option<T> {
-    fail!();
+    panic!();
 }
 
 fn main() {
index f2ef1d1952505c09ba85aae43a1eda241b026277..5785a13b006821cef87cd4a4cd852bce4b093ebe 100644 (file)
@@ -14,4 +14,4 @@ enum quux<T> { bar }
 
 fn foo(c: quux) { assert!((false)); }
 
-fn main() { fail!(); }
+fn main() { panic!(); }
index 4233fa843eb611d0ca02e51b74a11f428b121a53..52035c09dd6dd3ce9d089bef98307b7e6658ec9f 100644 (file)
@@ -20,7 +20,7 @@ fn main() {
         x: 3i
     };
 
-    let baz: Foo<uint> = fail!();
+    let baz: Foo<uint> = panic!();
     //~^ ERROR not implemented
 }
 
index ecc52c0ee7d58491b5f59f2d063b0ca078bcf7d4..124bd9c4d5b4ef997b47d0b92968ee1793e78c3c 100644 (file)
@@ -17,7 +17,7 @@ enum MustUse { Test }
 #[must_use = "some message"]
 enum MustUseMsg { Test2 }
 
-fn foo<T>() -> T { fail!() }
+fn foo<T>() -> T { panic!() }
 
 fn bar() -> int { return foo::<int>(); }
 fn baz() -> MustUse { return foo::<MustUse>(); }
index d67a6b1e200499c2667321940d55e0ca51f8952b..dae1aca4ed37cce85d23ea8164a641f909766e4d 100644 (file)
@@ -72,4 +72,4 @@ fn main() {
 }
 
 fn _zzz() {()}
-fn _yyy() -> ! {fail!()}
+fn _yyy() -> ! {panic!()}
index 85b71e4e86cc7bcb47feb1b664ccffff412ef138..377f4669ffc8cb7b6f08ab7cab0285a08e356d7f 100644 (file)
@@ -8,6 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn f() { if (1i == fail!()) { } else { } }
+fn f() { if (1i == panic!()) { } else { } }
 
 fn main() { }
index 5e1b7bb69bb2bf29ec81d6f57fa0065f99f62b0e..4878ec59fd4bcb632e366b92d48fa8a521c055c7 100644 (file)
@@ -11,6 +11,6 @@
 
 // error-pattern:meep
 
-fn f(_a: int, _b: int, _c: Box<int>) { fail!("moop"); }
+fn f(_a: int, _b: int, _c: Box<int>) { panic!("moop"); }
 
-fn main() { f(1, fail!("meep"), box 42); }
+fn main() { f(1, panic!("meep"), box 42); }
index 1ae520bbf1a74d2e3628e3f384605e34e48c3911..ac85b218ec0306f9aeb9e6fb6b178c01078a2ce4 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 // error-pattern:quux
-fn my_err(s: String) -> ! { println!("{}", s); fail!("quux"); }
+fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); }
 fn main() { 3u == my_err("bye".to_string()); }
index 8ca317e1dd77399956211c2fb3048d936ca2939e..06712841823e850666205fd058cfc9ed0ad0cbc4 100644 (file)
@@ -16,7 +16,7 @@
 fn main() {
     let x = vec!(1u,2u,3u);
 
-    // This should cause a bounds-check failure, but may not if we do our
+    // This should cause a bounds-check panic, but may not if we do our
     // bounds checking by comparing a scaled index value to the vector's
     // length (in bytes), because the scaling of the index will cause it to
     // wrap around to a small number.
@@ -24,6 +24,6 @@ fn main() {
     let idx = uint::MAX & !(uint::MAX >> 1u);
     println!("ov2 idx = 0x%x", idx);
 
-    // This should fail.
+    // This should panic.
     println!("ov2 0x%x",  x[idx]);
 }
index 6106abc76c3f7259a823c610d8f2fdaf04968dd2..22a9fffb2fb2312074c5af1f57c072004463c6a1 100644 (file)
@@ -17,7 +17,7 @@
 fn main() {
     let x = vec!(1u,2u,3u);
 
-    // This should cause a bounds-check failure, but may not if we do our
+    // This should cause a bounds-check panic, but may not if we do our
     // bounds checking by truncating the index value to the size of the
     // machine word, losing relevant bits of the index value.
 
@@ -28,13 +28,13 @@ fn main() {
            (idx >> 32) as uint,
            idx as uint);
 
-    // This should fail.
+    // This should panic.
     println!("ov3 0x%x",  x.as_slice()[idx]);
 }
 
 #[cfg(target_arch="x86_64")]
 fn main() {
-    // This version just fails anyways, for symmetry on 64-bit hosts.
+    // This version just panics anyways, for symmetry on 64-bit hosts.
     let x = vec!(1u,2u,3u);
     error!("ov3 0x%x",  x.as_slice()[200]);
 }
index 9123342f09a5c07edcc7e47f52a2fcb2563898d2..f8686d0dbb56fdb8494af6a0824b446452e4b274 100644 (file)
@@ -14,7 +14,7 @@
 
 fn main() {
 
-    // This should cause a bounds-check failure, but may not if we do our
+    // This should cause a bounds-check panic, but may not if we do our
     // bounds checking by comparing the scaled index to the vector's
     // address-bounds, since we've scaled the index to wrap around to the
     // address of the 0th cell in the array (even though the index is
@@ -30,6 +30,6 @@ fn main() {
     println!("ov1 idx * sizeof::<uint>() = 0x{:x}",
            idx * mem::size_of::<uint>());
 
-    // This should fail.
+    // This should panic.
     println!("ov1 0x{:x}", x[idx]);
 }
index 2a256b9a4e384d8310e6b53d52b7033b41fb4b88..e46564f80760c6c62cc2b5d8ee474b65f7ea6b69 100644 (file)
@@ -19,6 +19,6 @@ struct chan_t<T> {
     port: port_id,
 }
 
-fn send<T:Send>(_ch: chan_t<T>, _data: T) { fail!(); }
+fn send<T:Send>(_ch: chan_t<T>, _data: T) { panic!(); }
 
-fn main() { fail!("quux"); }
+fn main() { panic!("quux"); }
index 74889263cc8a2a2c7c05f8dc990f0bd81da5357e..5747aa7a838e3315a23a7fea759c2b0c24e57da6 100644 (file)
@@ -23,7 +23,7 @@ struct S {
 
 impl Foo for S {
     fn foo(self, x: int) {
-        fail!()
+        panic!()
     }
 }
 
index 7f7eddd86cf67e6fbc5db21293ec1b5621fdaa7a..2014a108b3dabf49e1dc6984c9b5c10728bfd300 100644 (file)
@@ -11,5 +11,5 @@
 // error-pattern:test
 
 fn main() {
-    let _i: int = fail!("test");
+    let _i: int = panic!("test");
 }
index f1d9b15c42a0b09fd0f6ae7d0186554fddebd7cc..b54bf1c0c68d6ce985d6e93d8276a42677e2d70a 100644 (file)
@@ -11,7 +11,7 @@
 // error-pattern:test
 
 fn f() {
-    fail!("test");
+    panic!("test");
 }
 
 fn main() {
index 82e790c5d9fd90f7f916afb8577bd46663d389c4..811bd6e037dd45377c2aa1e3a7d297603c4ad2c6 100644 (file)
@@ -11,5 +11,5 @@
 // error-pattern:test
 
 fn main() {
-    fail!("test");
+    panic!("test");
 }
index 4f3dfaa80b939a0913583fa98560f446497d62dc..3835a16a5c2631beb29f745a31e1e9f80042c00d 100644 (file)
@@ -12,6 +12,6 @@
 
 //error-pattern:One
 fn main() {
-    fail!("One");
-    fail!("Two");
+    panic!("One");
+    panic!("Two");
 }
index 4af9b82ec7e22edf440ded5f61caab38f6812cea..f6d27cf99592a2084b042f89b8cc9509e7fabf86 100644 (file)
@@ -15,5 +15,5 @@
 fn main() {
     let mut a = 1i;
     if 1i == 1 { a = 2; }
-    fail!(format!("woooo{}", "o"));
+    panic!(format!("woooo{}", "o"));
 }
index 8c204b66e3657f2010776d4c370f977438567a24..4699897bf8abea7d73caa7b5ff4bdcca4610ad07 100644 (file)
@@ -12,4 +12,4 @@
 
 
 // error-pattern:explicit
-fn main() { fail!(); }
+fn main() { panic!(); }
index e645ea34df5647b5c204396ae33327844729db05..179d52bda0318e046ce72141106af93d6b9d6a7d 100644 (file)
@@ -12,6 +12,6 @@
 
 
 // error-pattern:explicit failure
-fn f() -> ! { fail!() }
+fn f() -> ! { panic!() }
 
 fn main() { f(); }
index 99f798147f28f3e615fc8c5d30874ca6bce63739..ad2ff7a8c6beac92d1891fc096d11f3dbc7deea4 100644 (file)
@@ -12,7 +12,7 @@
 
 
 // error-pattern:explicit failure
-fn f() -> ! { fail!() }
+fn f() -> ! { panic!() }
 
 fn g() -> int { let x = if true { f() } else { 10 }; return x; }
 
index 55d86bc6493245722ce004567b6eefc7505af0f4..d2214f8c39878cac0843b16e8d61e509ca124d3e 100644 (file)
@@ -12,4 +12,4 @@
 
 
 // error-pattern:explicit failure
-fn main() { let _x = if false { 0i } else if true { fail!() } else { 10i }; }
+fn main() { let _x = if false { 0i } else if true { panic!() } else { 10i }; }
index 6476e57a35b842b3ca89cd4192f54c3afacaa74d..78f9ce8cc291ddec9f2a896507a68d98367b21b3 100644 (file)
@@ -12,7 +12,7 @@
 
 
 // error-pattern:explicit failure
-fn f() -> ! { fail!() }
+fn f() -> ! { panic!() }
 
 fn g() -> int { let x = match true { true => { f() } false => { 10 } }; return x; }
 
index d15ec3f7b486ab00150fea6c0915a37e168c1d5a..0354717291dd2a87a0133a5875dd9fec719316e8 100644 (file)
@@ -12,4 +12,4 @@
 
 
 // error-pattern:explicit failure
-fn main() { let _x = match true { false => { 0i } true => { fail!() } }; }
+fn main() { let _x = match true { false => { 0i } true => { panic!() } }; }
index c11d269a89755e41351e8fe3d24f0f64c11cb55e..21a332a46cb5976d38ed2ff93ba31ed658af2105 100644 (file)
@@ -45,7 +45,7 @@ fn main() {
         task::spawn(proc() {
             let result = count(5u);
             println!("result = %?", result);
-            fail!();
+            panic!();
         });
     }
 }
index e23145ec2535798c676df3b5bb918e2624932b7d..4d4f931751067929c8c2afe8a9a2e52c44de1dac 100644 (file)
@@ -11,4 +11,4 @@
 // error-pattern:woe
 fn f(a: int) { println!("{}", a); }
 
-fn main() { f(fail!("woe")); }
+fn main() { f(panic!("woe")); }
index e1eea1d89b9db13e51906320e9f439acc391a6e8..432647e0e2b2afbce022aed88918603fef9345ba 100644 (file)
@@ -11,5 +11,5 @@
 // error-pattern:failed at 'Box<Any>'
 
 fn main() {
-    fail!(box 612_i64);
+    panic!(box 612_i64);
 }
index 528f18dde0d3bacdf06a02801f42702ba3ec1f25..54704c44c0116916827ed2376f95fdf0f64a59cc 100644 (file)
@@ -12,5 +12,5 @@
 
 
 fn main() {
-    fail!(box 413i as Box<::std::any::Any+Send>);
+    panic!(box 413i as Box<::std::any::Any+Send>);
 }
index 13e3a6a31a8fa535139ddbe6710d9d5a41925781..bc240181e4c41b1c7cb13f8bfa920b07f282084d 100644 (file)
@@ -11,5 +11,5 @@
 // error-pattern:failed at 'explicit failure'
 
 fn main() {
-    fail!();
+    panic!();
 }
index b3984c210b5b412ea8f08a8ea6f484f0eb5381be..069ffc4434f3f420254c4ee22065230855405eee 100644 (file)
@@ -11,5 +11,5 @@
 // error-pattern:failed at 'test-fail-fmt 42 rust'
 
 fn main() {
-    fail!("test-fail-fmt {} {}", 42i, "rust");
+    panic!("test-fail-fmt {} {}", 42i, "rust");
 }
index e59f5bdcaa1797d8e2507614879291f3f9488f1e..477f344280451fcebb1ce781973b3b03c8b43797 100644 (file)
@@ -11,5 +11,5 @@
 // error-pattern:failed at 'test-fail-owned'
 
 fn main() {
-    fail!("test-fail-owned");
+    panic!("test-fail-owned");
 }
index 688ca4ce7e5720145a6a7f2efc721753639c3bae..51b70110da296c706933a7c726bcbcdc3d9fdf0e 100644 (file)
@@ -11,5 +11,5 @@
 // error-pattern:failed at 'test-fail-static'
 
 fn main() {
-    fail!("test-fail-static");
+    panic!("test-fail-static");
 }
index f90530a4435b1770da42f8cd9a30e38e1e18853f..877ea9cd0a4308524c0da40fcc115dd8bcccd0fb 100644 (file)
@@ -9,4 +9,4 @@
 // except according to those terms.
 
 // error-pattern:moop
-fn main() { fail!("moop"); }
+fn main() { panic!("moop"); }
index 88720b421e6870d7f397147e7400362f7b1fb698..ba4ff1da7e0b5d7d1c344798839ef1a2eaee75e4 100644 (file)
@@ -22,5 +22,5 @@ fn fmt(&self, fmtr:&mut std::fmt::Formatter) -> std::fmt::Result {
     }
 }
 fn main() {
-    fail!("{}", Foo)
+    panic!("{}", Foo)
 }
index 90a44e42759377e416135c568cda77a819f96388..06655e4c6813277c0b0b70e7fab4cdfc8964d7fc 100644 (file)
 // certain positions
 // error-pattern:oops
 
-fn bigfail() {
-    while (fail!("oops")) { if (fail!()) {
-        match (fail!()) { () => {
+fn bigpanic() {
+    while (panic!("oops")) { if (panic!()) {
+        match (panic!()) { () => {
         }
                      }
     }};
 }
 
-fn main() { bigfail(); }
+fn main() { bigpanic(); }
index 75d23d0f4fdf2e47919a99d619e64d732c2059b4..a32b64f91051874c021e3d96c4c34e0c957c2ff6 100644 (file)
@@ -14,7 +14,7 @@
 
 fn main() {
     let r: Result<int,_> = task::try(proc() {
-        fail!("test");
+        panic!("test");
         1i
     });
     assert!(r.is_ok());
index edb03b2d6b461ec110fe191f4c36a8d9a1b2d79c..7553347e20b67184a7afc3272d8e36f757ceae25 100644 (file)
@@ -15,7 +15,7 @@
 fn main() {
     let r: Result<int,_> = TaskBuilder::new().named("owned name".to_string())
                                              .try(proc() {
-        fail!("test");
+        panic!("test");
         1i
     });
     assert!(r.is_ok());
index 0a74009977828e4ffa152f6d29131eaed7b86820..2dcf947d0a9acc8181f168d81138478011f4368e 100644 (file)
@@ -14,7 +14,7 @@ fn main() {
     let r: Result<int,_> =
         ::std::task::TaskBuilder::new().named("send name".into_maybe_owned())
                                        .try(proc() {
-            fail!("test");
+            panic!("test");
             3i
         });
     assert!(r.is_ok());
index 0b2901889cbf233e6d9e2975f6befe26224edf31..d1861931e6062a5ffc7f586bbb6b77c19ac7b58d 100644 (file)
@@ -13,7 +13,7 @@
 fn main() {
     let r: Result<int,_> =
         ::std::task::TaskBuilder::new().named("static name").try(proc() {
-            fail!("test");
+            panic!("test");
         });
     assert!(r.is_ok());
 }
index ae89f9518406a2ac1f87dfce70aefd8722289d77..22e81480867a9d46c70f1020ae24623e7d96e579 100644 (file)
@@ -12,5 +12,5 @@
 
 fn main() {
     let str_var: String = "meh".to_string();
-    fail!("{}", str_var);
+    panic!("{}", str_var);
 }
index 508463599a32fe36c2551dd958014c84365e6840..472c8ae15b99249c9daf225957654bb85307d5f5 100644 (file)
@@ -10,4 +10,4 @@
 
 // error-pattern:moop
 
-fn main() { for _ in range(0u, 10u) { fail!("moop"); } }
+fn main() { for _ in range(0u, 10u) { panic!("moop"); } }
index bf04789bbc7738ddbb8ee4e8e3012f8feaa3f8d6..cb66f2602d4a6563f420ae577f68c07bffef245f 100644 (file)
@@ -20,5 +20,5 @@
 use std::*;
 
 fn main() {
-    fail!("fail works")
+    panic!("panic works")
 }
index b5f39e73fcb1a3bda1968b9c6a6d7a5d4dc53e7d..1ead81b00919d42d7f22826d64921a19f4430821 100644 (file)
@@ -19,7 +19,7 @@ fn foo(x: uint) {
     if even(x) {
         println!("{}", x);
     } else {
-        fail!("Number is odd");
+        panic!("Number is odd");
     }
 }
 
index d80ae967f0e2c2e1c35a31b73284e4b5b4230f39..f38b00ab46d90ee92785f022456ee5a04393a025 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 // error-pattern:quux
-fn my_err(s: String) -> ! { println!("{}", s); fail!("quux"); }
+fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); }
 fn main() { if my_err("bye".to_string()) { } }
index b5b8d4855ab8d0aedfae3cd08e4a86e30375d415..ade098d721ed715b3e1320808eb688a703cede15 100644 (file)
@@ -11,5 +11,5 @@
 // error-pattern:explicit failure
 
 pub fn main() {
-    fail!(); println!("{}", 1i);
+    panic!(); println!("{}", 1i);
 }
index 80006936f22c0969d581154910b9265b62dbad14..57b7dfc1eecd605e61cd5601eb963f6c37a15e84 100644 (file)
@@ -11,5 +11,5 @@
 // error-pattern:bad input
 
 fn main() {
-    Some("foo").unwrap_or(fail!("bad input")).to_string();
+    Some("foo").unwrap_or(panic!("bad input")).to_string();
 }
index 9a5a8e7c38f81be52786510ddccca6455c495693..8aaf38e251a36f8c014462ec70842dea7deaf368 100644 (file)
@@ -14,7 +14,7 @@
 
 enum e<T> { ee(Arc<T>) }
 
-fn foo() -> e<int> {fail!();}
+fn foo() -> e<int> {panic!();}
 
 fn main() {
    let _f = foo();
index 539d2adc7d45caebecf69f46893ac8648a6225db..686277c8c09a00493028631609613f6b5c73eb48 100644 (file)
@@ -17,6 +17,6 @@
 fn main() {
     let mut x = Vec::new();
     let y = vec!(3i);
-    fail!("so long");
+    panic!("so long");
     x.extend(y.into_iter());
 }
index 5669131aeee536946b88a1763af14251d5d9b160..878a293c373162af45198de4a90cbb421bf2e5ce 100644 (file)
@@ -16,5 +16,5 @@ struct Point { x: int, y: int }
 
 fn main() {
     let origin = Point {x: 0, y: 0};
-    let f: Point = Point {x: (fail!("beep boop")),.. origin};
+    let f: Point = Point {x: (panic!("beep boop")),.. origin};
 }
index ca219fe21837d5041200ee1ef83fd157537185bf..6b1818b4fa2a72c5c07edaba19bc6553ac48ccf5 100644 (file)
@@ -11,5 +11,5 @@
 // error-pattern:task '<main>' failed at
 
 fn main() {
-    fail!()
+    panic!()
 }
index 9d80f07de0af9173049ee15a7d7896df9c7d3195..8763f958a83e68c138ceff5d4cea23bf26a74036 100644 (file)
@@ -17,6 +17,6 @@ fn foo(s: String) { }
 
 fn main() {
     let i =
-        match Some::<int>(3) { None::<int> => { fail!() } Some::<int>(_) => { fail!() } };
+        match Some::<int>(3) { None::<int> => { panic!() } Some::<int>(_) => { panic!() } };
     foo(i);
 }
index 13ccd118c61861ac0f4eaebf90c45b9517c0edc2..da08f53fcde56d24573b5afdc8a6922ddf108acf 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 // error-pattern:quux
-fn f() -> ! { fail!("quux") }
+fn f() -> ! { panic!("quux") }
 fn g() -> int { match f() { true => { 1 } false => { 0 } } }
 fn main() { g(); }
index a4a6739bfc1d49a858e5b9a1b7744e648b1e92ee..5c1a9e1a5e7125bee72556f53f1ac9cd4932508c 100644 (file)
@@ -11,9 +11,9 @@
 // error-pattern:squirrelcupcake
 fn cmp() -> int {
     match (Some('a'), None::<char>) {
-        (Some(_), _) => { fail!("squirrelcupcake"); }
-        (_, Some(_)) => { fail!(); }
-        _                    => { fail!("wat"); }
+        (Some(_), _) => { panic!("squirrelcupcake"); }
+        (_, Some(_)) => { panic!(); }
+        _                    => { panic!("wat"); }
     }
 }
 
index ae3924ba9356cbd7525c7b72a82b9eb8cd518a33..6b5e3bafe79b5ccdcf745cc7651dbad4956bfb3f 100644 (file)
@@ -16,6 +16,6 @@
 #[start]
 fn start(argc: int, argv: *const *const u8) -> int {
     native::start(argc, argv, proc() {
-        fail!();
+        panic!();
     })
 }
index d607ec76c351de4856bd3b41736042e38b361eff..ec19e08c74f72066c910da763d62d887516a18df 100644 (file)
@@ -18,6 +18,6 @@
 struct T { t: String }
 
 fn main() {
-    let pth = fail!("bye");
+    let pth = panic!("bye");
     let _rs: T = T {t: pth};
 }
index c960679a43f1e074e56667b13c7cc1f3ac893cfe..e524a2432ac4ef1248601ad4c02f3e035734b336 100644 (file)
@@ -17,8 +17,8 @@
 fn main() {
     error!("whatever");
     // Setting the exit status only works when the scheduler terminates
-    // normally. In this case we're going to fail, so instead of
+    // normally. In this case we're going to panic, so instead of
     // returning 50 the process will return the typical rt failure code.
     os::set_exit_status(50);
-    fail!();
+    panic!();
 }
index 22985d57936a29a1237b5c898dffc022fa097a1c..1cfc6c36a6397f844bd5d29cc870f242d637b608 100644 (file)
@@ -20,7 +20,7 @@ struct r {
 }
 
 // Setting the exit status after the runtime has already
-// failed has no effect and the process exits with the
+// panicked has no effect and the process exits with the
 // runtime's exit code
 impl Drop for r {
     fn drop(&mut self) {
@@ -39,5 +39,5 @@ fn main() {
     task::spawn(proc() {
       let _i = r(5);
     });
-    fail!();
+    panic!();
 }
index d08cb198802ad38892d5fb9c91a3b67659ae3e4e..bddf9b5a7ea5970b414c6aba90b7854b694c0ffa 100644 (file)
@@ -16,7 +16,7 @@
 
 fn main() {
     error!("whatever");
-    // 101 is the code the runtime uses on task failure and the value
+    // 101 is the code the runtime uses on task panic and the value
     // compiletest expects run-fail tests to return.
     os::set_exit_status(101);
 }
index 70ef4a0c0c3d307e9895ccbe78cc4560f8977ce6..0e218740ab1cfb83db5db6819b8486077a9910d0 100644 (file)
@@ -17,5 +17,5 @@ mod m {
     pub fn exported() { }
 
     #[test]
-    fn unexported() { fail!("runned an unexported test"); }
+    fn unexported() { panic!("runned an unexported test"); }
 }
index c3ee76047d13428060432d2ded9cd7359bd79cb1..a9c0030fecaf7aa8094dc96446dc4832838744ab 100644 (file)
@@ -13,6 +13,6 @@
 fn main() {
     let s: String = "hello".to_string();
 
-    // Bounds-check failure.
+    // Bounds-check panic.
     assert_eq!(s.as_bytes()[5], 0x0 as u8);
 }
index e7fd97f8d31f386deeef8e56a82c32995370d82a..dfc3238662cfef413ef446f3847b46b0bc4fca2b 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:Ensure that the child task runs by failing
+// error-pattern:Ensure that the child task runs by panicking
 
 use std::task;
 
@@ -17,10 +17,10 @@ fn main() {
     // works when provided with a bare function:
     let r = task::try(startfn);
     if r.is_err() {
-        fail!()
+        panic!()
     }
 }
 
 fn startfn() {
-    assert!("Ensure that the child task runs by failing".is_empty());
+    assert!("Ensure that the child task runs by panicking".is_empty());
 }
index b628f101fd5766b67e7315d0d5d8291ff5ee2aef..0c1f9424ba0355fda63420610b7afe48c1eca734 100644 (file)
@@ -15,6 +15,6 @@
 
 #[test]
 fn test_foo() {
-    fail!()
+    panic!()
 }
 
index 1858ceb2836485bed7fa8ca2f73170b363d36654..5b44e3757047b83db80c3030602f323417f8b5bd 100644 (file)
@@ -15,5 +15,5 @@
 
 fn main() {
     os::args();
-    fail!("please have a nonzero exit status");
+    panic!("please have a nonzero exit status");
 }
index 04733552969c510e3f8d2db016de554509337bd5..2ec670c3306db044ddd8f1239d0d4b38fd8e5d1f 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-test leaks
 // error-pattern:ran out of stack
 
-// Test that the task fails after hitting the recursion limit
+// Test that the task panicks after hitting the recursion limit
 // during unwinding
 
 fn recurse() {
index f1804c10691893c1ac756a5c69984b82268d95f7..931963442442ccc258c04dd6baa82ab599e03594 100644 (file)
@@ -9,4 +9,4 @@
 // except according to those terms.
 
 // error-pattern: fail
-fn main() { box fail!(); }
+fn main() { box panic!(); }
index f6a3aa48def9b224e78d5b4b833eb7b7cddd142c..5012ded28b5c38763778eb6fab81c6655744c11f 100644 (file)
@@ -12,7 +12,7 @@
 
 fn a() { }
 
-fn b() { fail!(); }
+fn b() { panic!(); }
 
 fn main() {
     let _x = vec!(0i);
index 9c96970f0e7f116685a85ffd1d9e67c3f98b2642..1c72686b60287ace08d2905f00c68075da791f68 100644 (file)
@@ -12,7 +12,7 @@
 
 
 fn build() -> Vec<int> {
-    fail!();
+    panic!();
 }
 
 struct Blk { node: Vec<int> }
index 178d0a8ab327c4e06b2f9051de274f4bb8ea351b..943b4cd76715c35e3490e8624af652137a685a00 100644 (file)
@@ -16,7 +16,7 @@ fn build1() -> Vec<int> {
 }
 
 fn build2() -> Vec<int> {
-    fail!();
+    panic!();
 }
 
 struct Blk { node: Vec<int> , span: Vec<int> }
index 233d367c4b1e16b2b7fee4b109dbe0926b4c93ab..6b5aefbab802b6c638977c61d5364bf6a81712d2 100644 (file)
@@ -12,7 +12,7 @@
 
 
 fn failfn() {
-    fail!();
+    panic!();
 }
 
 fn main() {
index 281523a807ef8a368090ea951c329f7214bbadfb..c378e852f897e2dbe7524acedfa590f9033c4ea4 100644 (file)
@@ -15,7 +15,7 @@ fn main() {
     let v: Vec<int> = vec!(10);
     let x: uint = 0;
     assert_eq!(v[x], 10);
-    // Bounds-check failure.
+    // Bounds-check panic.
 
     assert_eq!(v[x + 2], 20);
 }
index 0a0b26083579df730a8ea8fafaa78484ef7a290a..6a7d0a1d73e8fe7170d65a7b2c4446d52432190b 100644 (file)
@@ -11,4 +11,4 @@
 #![allow(while_true)]
 
 // error-pattern:quux
-fn main() { let _x: int = { while true { fail!("quux"); } ; 8 } ; }
+fn main() { let _x: int = { while true { panic!("quux"); } ; 8 } ; }
index 24058c4fb936efed6303d86694885c1983070a71..f6081e497bffefaf16ae06f9706acd149b252233 100644 (file)
@@ -12,5 +12,5 @@
 
 // error-pattern:giraffe
 fn main() {
-    fail!({ while true { fail!("giraffe") }; "clandestine" });
+    panic!({ while true { panic!("giraffe") }; "clandestine" });
 }
index 9fe78cc2553e742ac3263245433bed9fedede75d..9918fbb1ab70186db32aa26ae06df8007c97650c 100644 (file)
@@ -24,7 +24,7 @@ fn drop(&mut self) {
 fn main() {
     task::try(proc() {
         let _a = A;
-        lib::callback(|| fail!());
+        lib::callback(|| panic!());
         1i
     });
 
index 8ae2c1600aa28eb9294342ba6dd97d23feeec1d4..2f5e72491bef390e14493300e7cea306840d6291 100644 (file)
@@ -10,7 +10,7 @@
 
 
 pub fn main() {
-    fail!()
+    panic!()
 }
 
 #[main]
index f487a1c6be5ced06433e50904c9ace67f23442a9..7e7399c403a734e3007ea60a3aad5de6e1a7ccc3 100644 (file)
@@ -26,16 +26,16 @@ fn start(argc: int, argv: *const *const u8) -> int {
 fn foo() {
     let _v = vec![1i, 2, 3];
     if os::getenv("IS_TEST").is_some() {
-        fail!()
+        panic!()
     }
 }
 
 #[inline(never)]
 fn double() {
     (|| {
-        fail!("once");
+        panic!("once");
     }).finally(|| {
-        fail!("twice");
+        panic!("twice");
     })
 }
 
index 9c6e6ab60abe20f453088638355561f7f16b6037..8235b91273b521df5d9bbafa25a5d36ed7f18d88 100644 (file)
@@ -11,6 +11,6 @@
 // Check that issue #954 stays fixed
 
 pub fn main() {
-    match -1i { -1 => {}, _ => fail!("wat") }
+    match -1i { -1 => {}, _ => panic!("wat") }
     assert_eq!(1i-1, 0i);
 }
index a7d3d99e45892f33829761d569e797ec304ad0d5..a9fa8449d0f1ac654474da7fac604d30f43ac048 100644 (file)
@@ -16,6 +16,6 @@ pub fn main() {
     let x = Some(p);
     match x {
         Some(z) => { dispose(z); },
-        None => fail!()
+        None => panic!()
     }
 }
index 10835730fa54eccb705906045f855502fef7cd70..415c660221d406844e6d1c6f80b949a5a88dc41d 100644 (file)
@@ -32,11 +32,11 @@ macro_rules! declare(
     );
     match s {
       box Bar2(id, rest) => declare!(id, self.elaborate_stm(rest)),
-      _ => fail!()
+      _ => panic!()
     }
   }
 
-  fn check_id(&mut self, s: int) { fail!() }
+  fn check_id(&mut self, s: int) { panic!() }
 }
 
 pub fn main() { }
index aa45bfd14541cded421085bd0d12c309baabf2e7..ee8a58a0d337f01c67b64c93efd32e59203dfd1b 100644 (file)
@@ -29,12 +29,12 @@ pub fn main() {
 
     match 42 {
         b'*' => {},
-        _ => fail!()
+        _ => panic!()
     }
 
     match 100 {
         b'a' ... b'z' => {},
-        _ => fail!()
+        _ => panic!()
     }
 
     let expected: &[_] = &[97u8, 10u8, 13u8, 9u8, 92u8, 39u8, 34u8, 0u8, 240u8];
@@ -48,7 +48,7 @@ pub fn main() {
     let val: &[_] = &[97u8, 10u8];
     match val {
         b"a\n" => {},
-        _ => fail!(),
+        _ => panic!(),
     }
 
     let buf = vec!(97u8, 98, 99, 100);
index 97310fd9ad2e61cb04c41b1d653d73faf549a47e..c7c655b3db48c444f2a9abbe6b1dcfc194095af5 100644 (file)
@@ -20,7 +20,7 @@ fn clone(&self) -> Foo {
         // invoked -- after all, that would permit evil user code to
         // abuse `Cell` and trigger crashes.
 
-        fail!();
+        panic!();
     }
 }
 
index dd3a7b86bea830b98840f99fb232beba55c673fd..aab06c0339be209a1a1ccb26acb9af6060e3ba0d 100644 (file)
@@ -75,7 +75,7 @@ fn insert(&mut self, k: int, _: T) -> bool {
         true
     }
 
-    fn find_mut(&mut self, _k: &int) -> Option<&mut T> { fail!() }
+    fn find_mut(&mut self, _k: &int) -> Option<&mut T> { panic!() }
 
     fn remove(&mut self, k: &int) -> bool {
         if self.find(k).is_some() {
@@ -85,16 +85,16 @@ fn remove(&mut self, k: &int) -> bool {
         }
     }
 
-    fn pop(&mut self, _k: &int) -> Option<T> { fail!() }
+    fn pop(&mut self, _k: &int) -> Option<T> { panic!() }
 
-    fn swap(&mut self, _k: int, _v: T) -> Option<T> { fail!() }
+    fn swap(&mut self, _k: int, _v: T) -> Option<T> { panic!() }
 }
 
 impl<T> cat<T> {
     pub fn get(&self, k: &int) -> &T {
         match self.find(k) {
           Some(v) => { v }
-          None    => { fail!("epic fail"); }
+          None    => { panic!("epic fail"); }
         }
     }
 
index fda4a31375bcdbe6d662fc28dd2a681fd96853e6..97134a9d38937519678c3841fb907b3e5efbf8ec 100644 (file)
@@ -14,7 +14,7 @@
 //
 // 1. Partial cleanup of `box` is in scope,
 // 2. cleanup of return value from `get_bar()` is in scope,
-// 3. do_it() fails.
+// 3. do_it() panics.
 //
 // This led to a bug because `the top-most frame that was to be
 // cleaned (which happens to be the partial cleanup of `box`) required
@@ -33,7 +33,7 @@ enum Conzabble {
 struct Foo { field: Box<uint> }
 
 fn do_it(x: &[uint]) -> Foo {
-    fail!()
+    panic!()
 }
 
 fn get_bar(x: uint) -> Vec<uint> { vec!(x * 2) }
index e164aeca013b2533fb609d9f8a3530983d5c7337..9b4033ae0d7221ddec9828abbc7367d215b5e675 100644 (file)
@@ -15,6 +15,6 @@ fn f(x: || -> !) -> ! {
 }
 
 fn main() {
-    let x: || -> ! = || fail!();
+    let x: || -> ! = || panic!();
     let _y: || -> ! = || x();
 }
index 116aa462a0ae2d20d685e55d71a63793ce0a079f..e5891b2f48dff788d7dd6abe59373029669b82ad 100644 (file)
@@ -80,7 +80,7 @@ pub fn f() { }
 // Since the bogus configuration isn't defined main will just be
 // parsed, but nothing further will be done with it
 #[cfg(bogus)]
-pub fn main() { fail!() }
+pub fn main() { panic!() }
 
 pub fn main() {
     // Exercise some of the configured items in ways that wouldn't be possible
@@ -94,7 +94,7 @@ pub fn main() {
 
 fn test_in_fn_ctxt() {
     #[cfg(bogus)]
-    fn f() { fail!() }
+    fn f() { panic!() }
     fn f() { }
     f();
 
index 29d329d46a05a748a664c5c1e4241d0c6753af29..f87d92dc16f7f22933cbf31d2d0c0880e3625912 100644 (file)
@@ -16,6 +16,6 @@
 extern crate log;
 
 pub fn main() {
-    // only fails if println! evaluates its argument.
-    debug!("{}", { if true { fail!() } });
+    // only panics if println! evaluates its argument.
+    debug!("{}", { if true { panic!() } });
 }
index 9d09740f3b45e85620b78d9c5b84e2b4c1ad1c8e..0591828bb132b1dde473de1112095ca701eb7cf6 100644 (file)
@@ -12,8 +12,8 @@
 
 pub fn main() {
     // exits early if println! evaluates its arguments, otherwise it
-    // will hit the fail.
+    // will hit the panic.
     println!("{}", { if true { return; } });
 
-    fail!();
+    panic!();
 }
index ac2e879ceacc931b266366e665372f9f94c31ead..1b9bd5e5692af573ea06c65fae02c3bffb2d9a3e 100644 (file)
@@ -19,18 +19,18 @@ enum Foo {
 pub fn main() {
     match X {
         Baz => {}
-        _ => fail!()
+        _ => panic!()
     }
     match Y {
         Bar(s) => assert!(s == 2654435769),
-        _ => fail!()
+        _ => panic!()
     }
     match Z {
         Quux(d,h) => {
             assert_eq!(d, 0x123456789abcdef0);
             assert_eq!(h, 0x1234);
         }
-        _ => fail!()
+        _ => panic!()
     }
 }
 
index eaca18be93a1368f469a087af9b5d5f040a9c07b..465830c6e129829dbb6d029640343cc0e1405514 100644 (file)
@@ -15,7 +15,7 @@ impl E {
     pub fn method(&self) {
         match *self {
             V => {}
-            VV(..) => fail!()
+            VV(..) => panic!()
         }
     }
 }
index ee7e3c7c66300ec85b7963e2506c650670a5f0bf..4cad4acf147fff812cb5d68d881ede086885d457 100644 (file)
@@ -14,7 +14,7 @@ enum E { V, VV(int) }
 fn f(a: &E) {
     match *a {
         V => {}
-        VV(..) => fail!()
+        VV(..) => panic!()
     }
 }
 
index c1e3889d613d922dfcd3bd5f6a2ae3d869492379..02d8fcf201d83937c9cd33427a2c37568b75f2cf 100644 (file)
@@ -14,6 +14,6 @@ enum E { V0, V1(int) }
 pub fn main() {
     match *C {
         V0 => (),
-        _ => fail!()
+        _ => panic!()
     }
 }
index c4e36ba7b4e39d2432bca9299fd3ca2b41dca4a2..3cd7db69f074afacbbd426986cd84239818a2e1c 100644 (file)
@@ -19,7 +19,7 @@ enum E {
 
 pub fn main() {
     match C {
-        S0 { .. } => fail!(),
+        S0 { .. } => panic!(),
         S1 { u } => assert!(u == 23)
     }
 }
index 2a00daa3c038c53ce173f07c5fbaf681f9e524b9..9177cad9d62411658a808a6c81ffea2aba047f46 100644 (file)
@@ -19,19 +19,19 @@ enum E { V1(int), V0 }
 pub fn main() {
     match C0 {
         V0 => (),
-        _ => fail!()
+        _ => panic!()
     }
     match C1 {
         V1(n) => assert!(n == 0xDEADBEE),
-        _ => fail!()
+        _ => panic!()
     }
 
     match D0 {
         V0 => (),
-        _ => fail!()
+        _ => panic!()
     }
     match D1 {
         V1(n) => assert!(n == 0xDEADBEE),
-        _ => fail!()
+        _ => panic!()
     }
 }
index 95c4ed836c7698610affe5f2bd1f2972900e8714..8723b2815dabe46a6e32ed2847ffc1cc2fc9e7e6 100644 (file)
@@ -14,10 +14,10 @@ enum E { V1(int), V0 }
 pub fn main() {
     match C[1] {
         V1(n) => assert!(n == 0xDEADBEE),
-        _ => fail!()
+        _ => panic!()
     }
     match C[2] {
         V0 => (),
-        _ => fail!()
+        _ => panic!()
     }
 }
index 3dc5b918f7f583db6518f2c6b8093caeae0db652..e94e1de2e2d1eca5cdd0dd8680531a0c68145cf0 100644 (file)
@@ -14,10 +14,10 @@ enum E { V1(int), V0 }
 pub fn main() {
     match C[1] {
         V1(n) => assert!(n == 0xDEADBEE),
-        _ => fail!()
+        _ => panic!()
     }
     match C[2] {
         V0 => (),
-        _ => fail!()
+        _ => panic!()
     }
 }
index bc61c8e9aecf5e47bba25f8abaa74e3d8f0a3e78..2d023317db623a2c3a342c938345c921b6fe9c99 100644 (file)
@@ -19,11 +19,11 @@ enum Foo {
 pub fn main() {
     match X {
         Bar => {}
-        Baz | Boo => fail!()
+        Baz | Boo => panic!()
     }
     match Y {
         Baz => {}
-        Bar | Boo => fail!()
+        Bar | Boo => panic!()
     }
 }
 
index b4a54b599fe8a680f5c18145f3f6c9072f00a1e6..d8dfb433e6d4910f36384fd5c8f1ded4330c86d7 100644 (file)
 use std::str;
 
 macro_rules! succeed( ($e:expr) => (
-    match $e { Ok(..) => {}, Err(e) => fail!("failure: {}", e) }
+    match $e { Ok(..) => {}, Err(e) => panic!("panic: {}", e) }
 ) )
 
 fn test_destroy_once() {
     let mut p = sleeper();
     match p.signal_exit() {
         Ok(()) => {}
-        Err(e) => fail!("error: {}", e),
+        Err(e) => panic!("error: {}", e),
     }
 }
 
@@ -91,7 +91,7 @@ pub fn test_destroy_actually_kills(force: bool) {
         }
     });
     match p.wait().unwrap() {
-        ExitStatus(..) => fail!("expected a signal"),
+        ExitStatus(..) => panic!("expected a signal"),
         ExitSignal(..) => tx.send(()),
     }
 }
index df5c58ff04b6d7f8cc8c0c7dad5bc9f9c86f35b9..fd59b804da3769c93bb027f19b265d14cbb9ea95 100644 (file)
@@ -9,22 +9,22 @@
 // except according to those terms.
 
 // check that the derived impls for the comparison traits shortcircuit
-// where possible, by having a type that fails when compared as the
+// where possible, by having a type that panics when compared as the
 // second element, so this passes iff the instances shortcircuit.
 
 pub struct FailCmp;
 impl PartialEq for FailCmp {
-    fn eq(&self, _: &FailCmp) -> bool { fail!("eq") }
+    fn eq(&self, _: &FailCmp) -> bool { panic!("eq") }
 }
 
 impl PartialOrd for FailCmp {
-    fn partial_cmp(&self, _: &FailCmp) -> Option<Ordering> { fail!("partial_cmp") }
+    fn partial_cmp(&self, _: &FailCmp) -> Option<Ordering> { panic!("partial_cmp") }
 }
 
 impl Eq for FailCmp {}
 
 impl Ord for FailCmp {
-    fn cmp(&self, _: &FailCmp) -> Ordering { fail!("cmp") }
+    fn cmp(&self, _: &FailCmp) -> Ordering { panic!("cmp") }
 }
 
 #[deriving(PartialEq,PartialOrd,Eq,Ord)]
index df1e4132cb737cd63d0d9918420c8311a44c534f..565e33ce01e17721a17f2e98a08f11d274fc19a1 100644 (file)
@@ -8,14 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Just testing that fail!() type checks in statement or expr
+// Just testing that panic!() type checks in statement or expr
 
 #![allow(unreachable_code)]
 
 fn f() {
-    fail!();
+    panic!();
 
-    let _x: int = fail!();
+    let _x: int = panic!();
 }
 
 pub fn main() {
index 977eaa13fc108e03b53901b11ee55a5602c1b657..6f4e927abd5da556020fb686328a3879e8ac3688 100644 (file)
@@ -44,7 +44,7 @@ fn drop(&mut self) {
                 sender.send(DestructorRan);
             }
             &FailingVariant { .. } => {
-                fail!("Failed");
+                panic!("Failed");
             }
         }
     }
index 465529ac90941e1006bc0375aa56c3d344127f8a..c2707a1ae6e905e7c5ddba2325341432394f7a05 100644 (file)
@@ -16,7 +16,7 @@ pub struct Arr {
 
 impl Deref<[uint]> for Arr {
     fn deref(&self) -> &[uint] {
-        fail!();
+        panic!();
     }
 }
 
index a1ef12a7657fe50deaab40a2b319979f3e1dca0f..27560986e02532a45fd9bf5362064459aa857134 100644 (file)
@@ -24,7 +24,7 @@ fn is_aligned<T>(ptr: &T) -> bool {
 pub fn main() {
     let x = Some(0u64);
     match x {
-        None => fail!(),
+        None => panic!(),
         Some(ref y) => assert!(is_aligned(y))
     }
 }
index 24fb503aea3a96ebf549fe9892d789aa0f1272a1..d6cdce7390a6097f2deaef14af8f3d7a7c87afe6 100644 (file)
@@ -20,6 +20,6 @@ pub fn main() {
     match Cons(10i, box Nil) {
         Cons(10i, _) => {}
         Nil => {}
-        _ => fail!()
+        _ => panic!()
     }
 }
index 8e56011e6dcec71da8d7416d2600fd5cfa852404..0dd7ddc3f846a9e2ee05c2164eaa1152a589a934 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// When all branches of an if expression result in fail, the entire if
-// expression results in fail.
+// When all branches of an if expression result in panic, the entire if
+// expression results in panic.
 pub fn main() {
     let _x = if true {
         10i
     } else {
-        if true { fail!() } else { fail!() }
+        if true { panic!() } else { panic!() }
     };
 }
index e9f116fcdd4259a78ad6e443f0e8f6347f25d04d..aa4240c60f1dfcdcbda217723eb8cc69fd3b4034 100644 (file)
@@ -8,19 +8,19 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn test_if_fail() {
-    let x = if false { fail!() } else { 10i };
+fn test_if_panic() {
+    let x = if false { panic!() } else { 10i };
     assert!((x == 10));
 }
 
-fn test_else_fail() {
-    let x = if true { 10i } else { fail!() };
+fn test_else_panic() {
+    let x = if true { 10i } else { panic!() };
     assert_eq!(x, 10i);
 }
 
-fn test_elseif_fail() {
-    let x = if false { 0i } else if false { fail!() } else { 10i };
+fn test_elseif_panic() {
+    let x = if false { 0i } else if false { panic!() } else { 10i };
     assert_eq!(x, 10i);
 }
 
-pub fn main() { test_if_fail(); test_else_fail(); test_elseif_fail(); }
+pub fn main() { test_if_panic(); test_else_panic(); test_elseif_panic(); }
index 0d23098d8fc77b94634726296da3765a9e671c11..3b33c18bbbd59bd6e8c843854ecfae1d6b9cc99d 100644 (file)
 
 
 
-// When all branches of a match expression result in fail, the entire
-// match expression results in fail.
+// When all branches of a match expression result in panic, the entire
+// match expression results in panic.
 pub fn main() {
     let _x =
         match true {
           true => { 10i }
-          false => { match true { true => { fail!() } false => { fail!() } } }
+          false => { match true { true => { panic!() } false => { panic!() } } }
         };
 }
index 1f246581687b1317cf4bcfd3d2d6a5aa87676f0b..d8ee21dfdc6b963fe8682d545f9abef6351795c4 100644 (file)
 
 
 fn test_simple() {
-    let r = match true { true => { true } false => { fail!() } };
+    let r = match true { true => { true } false => { panic!() } };
     assert_eq!(r, true);
 }
 
 fn test_box() {
-    let r = match true { true => { vec!(10i) } false => { fail!() } };
+    let r = match true { true => { vec!(10i) } false => { panic!() } };
     assert_eq!(r[0], 10i);
 }
 
index e2f8f7c8ebf0a6348b4fc267cefa6bb00e59ce81..aed4024b5bc5cb140490c32c2a60db94636bf871 100644 (file)
@@ -14,7 +14,7 @@
 fn test_generic<T:Clone>(expected: Box<T>, eq: compare<T>) {
     let actual: Box<T> = match true {
         true => { expected.clone() },
-        _ => fail!("wat")
+        _ => panic!("wat")
     };
     assert!((eq(expected, actual)));
 }
index a9b02a6e79938ee7ec8e662201166ddb67ed38b6..89adef378f1a1dabc6aa48639bd80a7cf22c0967 100644 (file)
@@ -14,7 +14,7 @@
 fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
     let actual: T = match true {
         true => expected.clone(),
-        _ => fail!("wat")
+        _ => panic!("wat")
     };
     assert!((eq(expected, actual)));
 }
index ff19862fee3435e4ab49a9d693c8250eeec7804b..c74caf4de4bdc252faf11238f4bfcbd0062d5321 100644 (file)
@@ -12,7 +12,7 @@
 type compare<T> = extern "Rust" fn(T, T) -> bool;
 
 fn test_generic<T:Clone>(expected: T, eq: compare<T>) {
-  let actual: T = match true { true => { expected.clone() }, _ => fail!("wat") };
+  let actual: T = match true { true => { expected.clone() }, _ => panic!("wat") };
     assert!((eq(expected, actual)));
 }
 
index 3d01c6653a7a002bc082e5dbaf22c50dfd89af0e..21b0c28495e6b93a02dfda1618cac1b6c6072f24 100644 (file)
@@ -16,7 +16,7 @@
 struct R { i: int }
 
 fn test_rec() {
-    let rs = match true { true => R {i: 100}, _ => fail!() };
+    let rs = match true { true => R {i: 100}, _ => panic!() };
     assert_eq!(rs.i, 100);
 }
 
index 3ee0a232d19c06377253a9bd04172a5730bfa4e3..83f2ada02b0ffd60b20b00b660b669720bb1a467 100644 (file)
@@ -11,7 +11,7 @@
 
 // Tests for match as expressions resulting in boxed types
 fn test_box() {
-    let res = match true { true => { box 100i }, _ => fail!() };
+    let res = match true { true => { box 100i }, _ => panic!() };
     assert_eq!(*res, 100i);
 }
 
index 3faa30c4c8a20e896e0d17e594bdfdffedea91c0..2f0d6cf90aa5a16af38112ab00d13c1f21647e18 100644 (file)
@@ -16,7 +16,7 @@
 impl Drop for Foo {
     fn drop(&mut self) {
         unsafe { DROPS += 1; }
-        fail!()
+        panic!()
     }
 }
 
index be4a497989ce8d239ed6f2d1a1e19c88ca65a4a9..46924c74a8c46d71eabad6c0591152b1e08d18ba 100644 (file)
@@ -22,7 +22,7 @@ struct B {
 
 impl Drop for A {
     fn drop(&mut self) {
-        fail!()
+        panic!()
     }
 }
 
index c0f6b14dc27489f031813b1f8215a7d6de779830..d157da3139fdb4bf9a57365cc9b6a16227a5d699 100644 (file)
@@ -9,4 +9,4 @@
 // except according to those terms.
 
 
-pub fn main() { let x: Vec<int> = Vec::new(); for _ in x.iter() { fail!("moop"); } }
+pub fn main() { let x: Vec<int> = Vec::new(); for _ in x.iter() { panic!("moop"); } }
index afa4b7a1ad0be5a747de69a0ee2e6076f843fb86..a3df98afcb0c52e39c06908bdc7f315065f87b49 100644 (file)
@@ -19,7 +19,7 @@ pub fn main() {
     match getopts(args.as_slice(), opts.as_slice()) {
         Ok(ref m)  =>
             assert!(!m.opt_present("b")),
-        Err(ref f) => fail!("{}", *f)
+        Err(ref f) => panic!("{}", *f)
     };
 
 }
index abb0bdab71f8b72498993ebfd528fc940386b216..53c081ff83e0e906b354731a5b75cdd8706f47d7 100644 (file)
@@ -35,23 +35,23 @@ pub fn main() {
     'x: for _ in range(0i, 1) {
         // this 'x should refer to the outer loop, lexically
         loop_x!(break 'x);
-        fail!("break doesn't act hygienically inside for loop");
+        panic!("break doesn't act hygienically inside for loop");
     }
 
     'x: loop {
         // ditto
         loop_x!(break 'x);
-        fail!("break doesn't act hygienically inside infinite loop");
+        panic!("break doesn't act hygienically inside infinite loop");
     }
 
     'x: while 1i + 1 == 2 {
         while_x!(break 'x);
-        fail!("break doesn't act hygienically inside infinite while loop");
+        panic!("break doesn't act hygienically inside infinite while loop");
     }
 
     'x: for _ in range(0i, 1) {
         // ditto
         run_once!(continue 'x);
-        fail!("continue doesn't act hygienically inside for loop");
+        panic!("continue doesn't act hygienically inside for loop");
     }
 }
index bfe3e9beddc54c4a33718376c9a7d447a0a9f1dc..44c834d233fe7f02d45fce3dc112a8c46140c676 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 pub fn main() {
-    let i: int = if false { fail!() } else { 5 };
+    let i: int = if false { panic!() } else { 5 };
     println!("{}", i);
 }
index 22b5281ef38f04b07d7617e70f77bed03edb29ec..660a6147d08d432e7b100b540f59fdd9e7f2d280 100644 (file)
@@ -18,7 +18,7 @@ fn foo(x: uint) {
     if even(x) {
         println!("{}", x);
     } else {
-        fail!();
+        panic!();
     }
 }
 
index 4bf3a85677c7216f13b9161f5c66f409fa006ad9..a07b783278672558d97454216e5d865d2e988035 100644 (file)
@@ -15,7 +15,7 @@ pub fn main() {
     if let Some(y) = x {
         assert_eq!(y, 3i);
     } else {
-        fail!("if-let failed");
+        panic!("if-let panicked");
     }
     let mut worked = false;
     if let Some(_) = x {
@@ -35,9 +35,9 @@ pub fn main() {
     assert_eq!(clause, 4u);
 
     if 3i > 4 {
-        fail!("bad math");
+        panic!("bad math");
     } else if let 1 = 2i {
-        fail!("bad pattern match");
+        panic!("bad pattern match");
     }
 
     enum Foo {
@@ -48,22 +48,22 @@ enum Foo {
 
     let foo = Three("three".to_string(), 42i);
     if let One = foo {
-        fail!("bad pattern match");
+        panic!("bad pattern match");
     } else if let Two(_x) = foo {
-        fail!("bad pattern match");
+        panic!("bad pattern match");
     } else if let Three(s, _) = foo {
         assert_eq!(s.as_slice(), "three");
     } else {
-        fail!("bad else");
+        panic!("bad else");
     }
 
     if false {
-        fail!("wat");
+        panic!("wat");
     } else if let a@Two(_) = Two(42u) {
         if let Two(b) = a {
             assert_eq!(b, 42u);
         } else {
-            fail!("fail in nested if-let");
+            panic!("panic in nested if-let");
         }
     }
 }
index 416c070180454e4b4cec12686f596bf3b5b5062c..6643636c5704d8afba613a1fcff4f53271a3bb7f 100644 (file)
@@ -13,7 +13,7 @@
 impl Foo {
     #[allow(dead_code)]
     fn foo(self) {
-        fail!("wrong method!")
+        panic!("wrong method!")
     }
 }
 
index 796fae7dc329808ac6b2d7f23170f9ffc948d497..1aa9c96de1a9418f66ae165e73fd98cac338e52e 100644 (file)
@@ -11,8 +11,8 @@
 struct A { foo: int }
 struct B { a: int, b: int, c: int }
 
-fn mka() -> A { fail!() }
-fn mkb() -> B { fail!() }
+fn mka() -> A { panic!() }
+fn mkb() -> B { panic!() }
 
 fn test() {
     let A { foo, } = mka();
index a30cf71732851c2ebcbb7617696510be94fa4e93..1c267f48337525910e2dc6858c01d824721471bc 100644 (file)
@@ -35,7 +35,7 @@ pub fn main() {
 
     // An `if false {} else { expr }` statement should compile the same as `{ expr }`.
     if false {
-        fail!();
+        panic!();
     } else {
         let _a = Foo{ dropped: false };
     }
index 42b5bbc8623e40c6d54823ec30430798d27b4b68..106bb7f701c9631eb4c90eb54c52c894e36785e8 100644 (file)
@@ -20,7 +20,7 @@ fn fas(n: &Noun) -> Noun
 {
     match n {
         &Cell(box Atom(2), box Cell(ref a, _)) => (**a).clone(),
-        _ => fail!("Invalid fas pattern")
+        _ => panic!("Invalid fas pattern")
     }
 }
 
index d299b853aeeb195353235a0ca091f9b26a747f7e..0567a5836abfae4bfd0a9b75db64462aa449dc3a 100644 (file)
 
 // ignore-pretty
 
-// Don't fail on blocks without results
+// Don't panic on blocks without results
 // There are several tests in this run-pass that raised
 // when this bug was opened. The cases where the compiler
-// failed before the fix have a comment.
+// panics before the fix have a comment.
 
 struct S {x:()}
 
@@ -31,8 +31,8 @@ fn not(b: bool) -> bool {
     if b {
         !b
     } else {
-        // `fail!(...)` would break
-        fail!("Break the compiler");
+        // `panic!(...)` would break
+        panic!("Break the compiler");
     }
 }
 
index 1a909db92e3283711fc00a60061fd0b116065d43..0e42bdbd6add7c9b44e42b10d9d789837866cc6c 100644 (file)
@@ -32,7 +32,7 @@ pub fn test() {
             FormatMessageW(0x1000, 0 as *mut c_void, 1, 0x400,
                            buf.as_mut_ptr(), buf.len() as u32, 0 as *const c_void)
         };
-        // On some 32-bit Windowses (Win7-8 at least) this will fail with segmented
+        // On some 32-bit Windowses (Win7-8 at least) this will panic with segmented
         // stacks taking control of pvArbitrary
         assert!(ret != 0);
     }
index c84b1eae8e0978540ad088c3cbc02e968e9bfd12..e3cc653909f33832f5afdf4647bf517352759acd 100644 (file)
@@ -17,14 +17,14 @@ fn main() {
     let x = match Foo(42) {
         Foo(..) => 1i,
         _ if true => 0,
-        Bar(..) => fail!("Oh dear")
+        Bar(..) => panic!("Oh dear")
     };
     assert_eq!(x, 1);
 
     let x = match Foo(42) {
         _ if true => 0i,
         Foo(..) => 1,
-        Bar(..) => fail!("Oh dear")
+        Bar(..) => panic!("Oh dear")
     };
     assert_eq!(x, 0);
 }
index 3aaa480d776c23845ab8b86a26c5630ff0e56d30..3c5af9ca032c100df1112e981c02075ff253f3f7 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 pub fn main() {
-    let early_error: |&str|: 'static -> ! = |_msg| { fail!() };
+    let early_error: |&str|: 'static -> ! = |_msg| { panic!() };
 }
index b03bfb958af1b2af92258db09dad4f7471aa6ba5..e0b98ab19652a40e302c4c5ef0d470aecffea249 100644 (file)
@@ -15,7 +15,7 @@ struct foo<A> {
 
 impl<A> foo<A> {
    pub fn bar<B,C:clam<A>>(&self, _c: C) -> B {
-     fail!();
+     panic!();
    }
 }
 
index 14b5efe904db8c4b5036704f50bac4c728abec23..8c597552d75aadb81a502a9e1050c5dab682d7e9 100644 (file)
@@ -15,7 +15,7 @@ trait clam<A> { }
 struct foo(int);
 
 impl foo {
-    pub fn bar<B,C:clam<B>>(&self, _c: C) -> B { fail!(); }
+    pub fn bar<B,C:clam<B>>(&self, _c: C) -> B { panic!(); }
 }
 
 pub fn main() { }
index 8a9e2d28776a78fb3e0309075b86bf914f8ee1c4..2608c89d15567d1a6d83739150c5a250ad2209dd 100644 (file)
@@ -20,7 +20,7 @@ struct E {
 }
 
 impl A for E {
-  fn b<F,G>(_x: F) -> F { fail!() }
+  fn b<F,G>(_x: F) -> F { panic!() }
   //~^ ERROR in method `b`, type parameter 0 has 1 bound, but
 }
 
index c52dd5ce5e4e34aca6dbb7f81d517e4588413237..cb17b7f6a6cc032472a1b17fb55dc3f0d0c352dc 100644 (file)
@@ -56,9 +56,9 @@ pub fn packet<T:Send>() -> *const packet<T> {
     }
 
     mod rusti {
-      pub fn atomic_xchg(_dst: &mut int, _src: int) -> int { fail!(); }
-      pub fn atomic_xchg_acq(_dst: &mut int, _src: int) -> int { fail!(); }
-      pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { fail!(); }
+      pub fn atomic_xchg(_dst: &mut int, _src: int) -> int { panic!(); }
+      pub fn atomic_xchg_acq(_dst: &mut int, _src: int) -> int { panic!(); }
+      pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { panic!(); }
     }
 
     // We should consider moving this to ::std::unsafe, although I
@@ -92,7 +92,7 @@ pub fn send<T:Send>(mut p: send_packet<T>, payload: T) {
             // The receiver will eventually clean this up.
             unsafe { forget(p); }
           }
-          full => { fail!("duplicate send") }
+          full => { panic!("duplicate send") }
           blocked => {
 
             // The receiver will eventually clean this up.
@@ -134,7 +134,7 @@ pub fn sender_terminate<T:Send>(p: *const packet<T>) {
           }
           full => {
             // This is impossible
-            fail!("you dun goofed")
+            panic!("you dun goofed")
           }
           terminated => {
             // I have to clean up, use drop_glue
@@ -151,7 +151,7 @@ pub fn receiver_terminate<T:Send>(p: *const packet<T>) {
           }
           blocked => {
             // this shouldn't happen.
-            fail!("terminating a blocked packet")
+            panic!("terminating a blocked packet")
           }
           terminated | full => {
             // I have to clean up, use drop_glue
@@ -236,7 +236,7 @@ pub fn liberate_ping(p: ping) -> ::pipes::send_packet<pong> {
             let _addr : *const ::pipes::send_packet<pong> = match &p {
               &ping(ref x) => { mem::transmute(x) }
             };
-            fail!()
+            panic!()
         }
     }
 
@@ -245,7 +245,7 @@ pub fn liberate_pong(p: pong) -> ::pipes::send_packet<ping> {
             let _addr : *const ::pipes::send_packet<ping> = match &p {
               &pong(ref x) => { mem::transmute(x) }
             };
-            fail!()
+            panic!()
         }
     }
 
@@ -269,7 +269,7 @@ pub fn do_ping(c: ping) -> pong {
         pub fn do_pong(c: pong) -> (ping, ()) {
             let packet = ::pipes::recv(c);
             if packet.is_none() {
-                fail!("sender closed the connection")
+                panic!("sender closed the connection")
             }
             (pingpong::liberate_pong(packet.unwrap()), ())
         }
@@ -284,7 +284,7 @@ pub mod server {
         pub fn do_ping(c: ping) -> (pong, ()) {
             let packet = ::pipes::recv(c);
             if packet.is_none() {
-                fail!("sender closed the connection")
+                panic!("sender closed the connection")
             }
             (pingpong::liberate_ping(packet.unwrap()), ())
         }
index 1964001cebd8e7971fe63000e6230b490a53276d..04866c56913b1cfb6f1bd252e25d1b1365eadb3c 100644 (file)
@@ -53,7 +53,7 @@ fn square_from_char(c: char) -> square {
       ' '  => { empty }
       _ => {
         println!("invalid square: {}", c);
-        fail!()
+        panic!()
       }
     }
 }
index efe0cb8d491d9fa4dd8c289a97830c626db7a536..ee075db272350933f13225e6e0a1a27a60081bd1 100644 (file)
@@ -13,6 +13,6 @@ enum State { BadChar, BadSyntax }
 
     match BadChar {
         _ if true => BadChar,
-        BadChar | BadSyntax => fail!() ,
+        BadChar | BadSyntax => panic!() ,
     };
 }
index 20b818f47d47749fd636244232f7cf2a0f4417c0..e5cc8414f064b631ff04e8ad192022209efc8e04 100644 (file)
@@ -19,7 +19,7 @@ fn exec<T: JD>() {
     let doc = json::from_str("").unwrap();
     let mut decoder = json::Decoder::new(doc);
     let _v: T = Decodable::decode(&mut decoder).unwrap();
-    fail!()
+    panic!()
 }
 
 pub fn main() {}
index d8c08f8ac321487967b097190bd5d245921e356f..3130c0441a5bd279ca1b89c8ce7093f9248b8a24 100644 (file)
@@ -48,7 +48,7 @@ enum Result {
         let v = match io.read_char() {
             '$' => parse_bulk(io),
             ':' => parse_int(io),
-             _ => fail!()
+             _ => panic!()
         };
         list.push(v);
     }
@@ -61,26 +61,26 @@ enum Result {
 
 priv fn parse_bulk(io: @io::Reader) -> Result {
     match from_str::<int>(chop(io.read_line())) {
-    None => fail!(),
+    None => panic!(),
     Some(-1) => Nil,
     Some(len) if len >= 0 => parse_data(len as uint, io),
-    Some(_) => fail!()
+    Some(_) => panic!()
     }
 }
 
 priv fn parse_multi(io: @io::Reader) -> Result {
     match from_str::<int>(chop(io.read_line())) {
-    None => fail!(),
+    None => panic!(),
     Some(-1) => Nil,
     Some(0) => List(~[]),
     Some(len) if len >= 0 => parse_list(len as uint, io),
-    Some(_) => fail!()
+    Some(_) => panic!()
     }
 }
 
 priv fn parse_int(io: @io::Reader) -> Result {
     match from_str::<int>(chop(io.read_line())) {
-    None => fail!(),
+    None => panic!(),
     Some(i) => Int(i)
     }
 }
@@ -92,7 +92,7 @@ enum Result {
     '+' => Status(chop(io.read_line())),
     '-' => Error(chop(io.read_line())),
     ':' => parse_int(io),
-    _ => fail!()
+    _ => panic!()
     }
 }
 
index be75c7230427bed3ee5513a092af43b7d3ee909c..fb0e8e599eb2af9477cdbffce70a292b28b7ffd4 100644 (file)
@@ -15,7 +15,7 @@
 
 fn bar(a: foo::map) {
     if false {
-        fail!();
+        panic!();
     } else {
         let _b = &(*a)[2];
     }
index 29775e4a69921ef873a3aaea1d4e8f113d0a9100..4b31f39330932e2b84dc6ef2845f7009430345a8 100644 (file)
@@ -19,7 +19,7 @@ trait Graph<Node, Edge> {
 
 impl<E> Graph<int, E> for HashMap<int, int> {
     fn f(&self, _e: E) {
-        fail!();
+        panic!();
     }
 }
 
index 48e2890b2594fbd231f05f2e2af080b31a533826..5a6dea8d15bff6ecb745d58499f1421fa7ceb5ef 100644 (file)
@@ -20,25 +20,25 @@ enum Other {
 
 fn main() {
     match Baz {
-        ::Bar(3) => fail!(),
-        ::Bar(_) if false => fail!(),
-        ::Bar(..) if false => fail!(),
-        ::Bar(_n) => fail!(),
+        ::Bar(3) => panic!(),
+        ::Bar(_) if false => panic!(),
+        ::Bar(..) if false => panic!(),
+        ::Bar(_n) => panic!(),
         ::Baz => {}
     }
     match Bar(3) {
         ::Bar(3) => {}
-        ::Bar(_) if false => fail!(),
-        ::Bar(..) if false => fail!(),
-        ::Bar(_n) => fail!(),
-        ::Baz => fail!(),
+        ::Bar(_) if false => panic!(),
+        ::Bar(..) if false => panic!(),
+        ::Bar(_n) => panic!(),
+        ::Baz => panic!(),
     }
     match Bar(4) {
-        ::Bar(3) => fail!(),
-        ::Bar(_) if false => fail!(),
-        ::Bar(..) if false => fail!(),
+        ::Bar(3) => panic!(),
+        ::Bar(_) if false => panic!(),
+        ::Bar(..) if false => panic!(),
         ::Bar(n) => assert_eq!(n, 4),
-        ::Baz => fail!(),
+        ::Baz => panic!(),
     }
 
     match Other1(Baz) {
index ac389c8e4947af55123ec5304fcff7146a2c7333..c1d5bb0961bbafa690a984fc7d654785d5096918 100644 (file)
@@ -18,8 +18,8 @@ enum E {
 pub fn main() {
     let e = Foo{f: 0};
     match e {
-        Foo{f: 1} => fail!(),
+        Foo{f: 1} => panic!(),
         Foo{..} => (),
-        _ => fail!(),
+        _ => panic!(),
     }
 }
index 9ce24200d690b0a8eb15f9e419d0f83e0e40fd87..28b37826812a35ea0588c3cff5390d439eea442e 100644 (file)
@@ -18,8 +18,8 @@ enum E {
 pub fn main() {
     let e = Foo{f: 0, b: false};
     match e {
-        Foo{f: 1, b: true} => fail!(),
+        Foo{f: 1, b: true} => panic!(),
         Foo{b: false, f: 0} => (),
-        _ => fail!(),
+        _ => panic!(),
     }
 }
index 05bf8e01c5874f6dd73efe95988b1df58c95c9aa..c0dcf9e609418a4839dca2cc60e60769774a058f 100644 (file)
@@ -15,7 +15,7 @@ fn lp<T>(s: String, f: |String| -> T) -> T {
         let r = f(s);
         return (r);
     }
-    fail!();
+    panic!();
 }
 
 fn apply<T>(s: String, f: |String| -> T) -> T {
index 7975af434d2846339e1a8f9196ecdd17caf34697..4b97d274fbae420f453df14d18fefd9ef127fcb3 100644 (file)
@@ -17,6 +17,6 @@
 
 pub fn main() {
     if log_enabled!(log::DEBUG) {
-        fail!("what?! debugging?");
+        panic!("what?! debugging?");
     }
 }
index 184ac713c899bfa178e0dd1f5ea2193f7d44344a..c4f7b1492ab57e1c20903c8f964d8c7aa590a211 100644 (file)
@@ -16,9 +16,9 @@
 
 pub fn main() {
     if log_enabled!(log::DEBUG) {
-        fail!("what?! debugging?");
+        panic!("what?! debugging?");
     }
     if !log_enabled!(log::INFO) {
-        fail!("what?! no info?");
+        panic!("what?! no info?");
     }
 }
index 31c2ae891e068832368599ba1a54f60872bb615a..ced1fdc4455194f734595ed133c8c3d6b7fb4eef 100644 (file)
 // monomorphized functions from other crates had logging turned on (their
 // logging module names were all incorrect). This test ensures that this no
 // longer happens by enabling logging for *this* crate and then invoking a
-// function in an external crate which will fail when logging is enabled.
+// function in an external crate which will panic when logging is enabled.
 
 extern crate logging_right_crate;
 
 pub fn main() {
-    // this function fails if logging is turned on
+    // this function panicks if logging is turned on
     logging_right_crate::foo::<int>();
 }
index 14aee4c3be81d001e25ab0dc0a5d5ccb1ed0a597..0f4dd881698a4198a1f0e101d593f54ce55dd009 100644 (file)
@@ -13,7 +13,7 @@
 impl Drop for S { fn drop(&mut self) { } }
 
 // user-defined function "returning" bottom (i.e. no return at all).
-fn my_fail() -> ! { loop {} }
+fn my_panic() -> ! { loop {} }
 
 pub fn step(f: bool) {
     let mut g = S;
@@ -30,7 +30,7 @@ pub fn step(f: bool) {
             continue;
         }
 
-        my_fail();
+        my_panic();
 
         // we never get here, so we do not need to re-initialize g.
     }
index 76fc05deb0eae69ecc522096d2e3e9aefcd1ab09..672efa68398ec8923598287099a13e49e3047799 100644 (file)
@@ -18,7 +18,7 @@ fn $fnname($arg: $ty) -> Option<$ty> $body
           Some($pat) => {
             $res
           }
-          _ => { fail!(); }
+          _ => { panic!(); }
         }
     })
 
index f3c299bd1f9138c9a9469b8fcc076f417d11fc02..5b48d0ff5080988cf30d5c917fc9ece76de87c69 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 // n.b. This was only ever failing with optimization disabled.
-fn a() -> int { match return 1i { 2i => 3i, _ => fail!() } }
+fn a() -> int { match return 1i { 2i => 3i, _ => panic!() } }
 pub fn main() { a(); }
index 7e55e227cc07b660dadcf1e0896c90687cae503d..74cf3faea46ee1646441319f0f7debae7b5a7fe3 100644 (file)
@@ -11,6 +11,6 @@
 
 pub fn main() {
     let i: int =
-        match Some::<int>(3) { None::<int> => { fail!() } Some::<int>(_) => { 5 } };
+        match Some::<int>(3) { None::<int> => { panic!() } Some::<int>(_) => { 5 } };
     println!("{}", i);
 }
index fef7555af5e4209271d49d20b8096deba231fb7b..6b18f3c19da2b0a3b7896c502df1c7de49c21a30 100644 (file)
@@ -20,7 +20,7 @@ enum E {
 pub fn main() {
     let e = Bar;
     match e {
-        Foo{f: _f} => fail!(),
+        Foo{f: _f} => panic!(),
         _ => (),
     }
 }
index 12902fb738e97a5d43c379c7926c37f18c8d6edd..451b8f63e9576f8a7f2ad86e40562465ee8f305b 100644 (file)
@@ -19,10 +19,10 @@ pub fn main() {
     let e = Foo{f: 1};
     match e {
         Foo{..} => (),
-        _ => fail!(),
+        _ => panic!(),
     }
     match e {
         Foo{f: _f} => (),
-        _ => fail!(),
+        _ => panic!(),
     }
 }
index 9d59b197d3ab755ccf70beaaa32cf8090a70eaed..4265d0a5406aa9c59b842c54ddd5a65f762d6182 100644 (file)
@@ -14,7 +14,7 @@ fn altlit(f: int) -> int {
     match f {
       10 => { println!("case 10"); return 20; }
       11 => { println!("case 11"); return 22; }
-      _  => fail!("the impossible happened")
+      _  => panic!("the impossible happened")
     }
 }
 
index 2169e996577bf89756a9f515749638e19cc85ab9..ed2f7c5cb47c2be48952407158cc4630087febeb 100644 (file)
@@ -15,7 +15,7 @@ fn test1() {
                 assert_eq!(a, "a".to_string());
                 assert_eq!(b, "b".to_string());
             },
-            _ => fail!(),
+            _ => panic!(),
     }
 }
 
@@ -25,7 +25,7 @@ fn test2() {
             assert_eq!(a, 2);
             assert_eq!(b, 3);
         },
-        _ => fail!(),
+        _ => panic!(),
     }
 }
 
@@ -35,7 +35,7 @@ fn test3() {
             assert_eq!(*a, 2);
             assert_eq!(*b, 3);
         },
-        _ => fail!(),
+        _ => panic!(),
     }
 }
 
@@ -45,7 +45,7 @@ fn test4() {
             assert_eq!(a, 2);
             assert_eq!(b, 3);
         },
-        _ => fail!(),
+        _ => panic!(),
     }
 }
 
@@ -55,7 +55,7 @@ fn test5() {
             assert_eq!(*a, 2);
             assert_eq!(*b, 3);
         },
-        _ => fail!(),
+        _ => panic!(),
     }
 }
 
index 4761d2606fc2a9185beaa5f4ec7ffcfd5c9d437b..83066c126ce140bb94e1e5b127e07ff335ff0f02 100644 (file)
 pub fn main() {
     match 5u {
       1u...5u => {}
-      _ => fail!("should match range"),
+      _ => panic!("should match range"),
     }
     match 5u {
-      6u...7u => fail!("shouldn't match range"),
+      6u...7u => panic!("shouldn't match range"),
       _ => {}
     }
     match 5u {
-      1u => fail!("should match non-first range"),
+      1u => panic!("should match non-first range"),
       2u...6u => {}
-      _ => fail!("math is broken")
+      _ => panic!("math is broken")
     }
     match 'c' {
       'a'...'z' => {}
-      _ => fail!("should suppport char ranges")
+      _ => panic!("should suppport char ranges")
     }
     match -3i {
       -7...5 => {}
-      _ => fail!("should match signed range")
+      _ => panic!("should match signed range")
     }
     match 3.0f64 {
       1.0...5.0 => {}
-      _ => fail!("should match float range")
+      _ => panic!("should match float range")
     }
     match -1.5f64 {
       -3.6...3.6 => {}
-      _ => fail!("should match negative float range")
+      _ => panic!("should match negative float range")
     }
 }
index a07c63490e78e2624088c609056db816a6406ec3..243c87c0eeb0095221cb2d5105ee77754879691c 100644 (file)
@@ -15,7 +15,7 @@ pub fn main() {
             Some(ref z) if *z.lock() => {
                 assert!(*z.lock());
             },
-            _ => fail!()
+            _ => panic!()
         }
     }
 }
index d31f7a60715105b63b7e6d28984e86ebf2a8dded..651f56e894ac8e0b77a70b6061d16a233498665a 100644 (file)
 // Issue #53
 
 pub fn main() {
-    match "test" { "not-test" => fail!(), "test" => (), _ => fail!() }
+    match "test" { "not-test" => panic!(), "test" => (), _ => panic!() }
 
     enum t { tag1(String), tag2, }
 
 
     match tag1("test".to_string()) {
-      tag2 => fail!(),
-      tag1(ref s) if "test" != s.as_slice() => fail!(),
+      tag2 => panic!(),
+      tag1(ref s) if "test" != s.as_slice() => panic!(),
       tag1(ref s) if "test" == s.as_slice() => (),
-      _ => fail!()
+      _ => panic!()
     }
 
-    let x = match "a" { "a" => 1i, "b" => 2i, _ => fail!() };
+    let x = match "a" { "a" => 1i, "b" => 2i, _ => panic!() };
     assert_eq!(x, 1);
 
-    match "a" { "a" => { } "b" => { }, _ => fail!() }
+    match "a" { "a" => { } "b" => { }, _ => panic!() }
 
 }
index 769a5ab5460a7150c65b5b7607461373ca87ef20..6d5658aa13cbfcebc746a231053f359e761663ec 100644 (file)
@@ -15,15 +15,15 @@ struct Foo{
 pub fn main() {
     let f = Foo{f: 1};
     match f {
-        Foo{f: 0} => fail!(),
+        Foo{f: 0} => panic!(),
         Foo{..} => (),
     }
     match f {
-        Foo{f: 0} => fail!(),
+        Foo{f: 0} => panic!(),
         Foo{f: _f} => (),
     }
     match f {
-        Foo{f: 0} => fail!(),
+        Foo{f: 0} => panic!(),
         _ => (),
     }
 }
index 148c1c9f0cfafb714c52d1bf333541e31ba6dcc3..4bf91bf703523616c7948d63d0ecc226dde91531 100644 (file)
@@ -11,6 +11,6 @@
 pub fn main() {
     match -5i {
       -5 => {}
-      _ => { fail!() }
+      _ => { panic!() }
     }
 }
index 0cbe46cb4ef17e9c691da6716b17d9c4dedcd0f4..a6d932935ade6b1a227112b36af992e3a8a89974 100644 (file)
@@ -11,7 +11,7 @@
 /* This test checks that nested comments are supported
 
    /*
-     This should not fail
+     This should not panic
    */
 */
 
index 927f8160f7e4aba76ccafe98d5861978d004cff3..19eba0808c88237cdc4f5b79430a57ad24dfd238 100644 (file)
@@ -23,7 +23,7 @@ fn b(i:int) -> b {
         }
     }
 
-    //  fn b(x:int) -> int { fail!(); }
+    //  fn b(x:int) -> int { panic!(); }
 
     let z = b(42);
     assert_eq!(z.i, 42);
index fa28025afa077b3b0fa6cf9a80bff8b76dfde34e..55c1de2700f9520a31edbdf317bb1831d084c809 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn baz() -> ! { fail!(); }
+fn baz() -> ! { panic!(); }
 
 fn foo() {
     match Some::<int>(5) {
index bc03b0d27ca8dcc201bdb3371319d6de756a5aee..7fe50d667087c1b6b3126f1814af11cdc0871f4f 100644 (file)
@@ -16,7 +16,7 @@ enum t { foo(int, uint), bar(int, Option<int>), }
 
 fn nested(o: t) {
     match o {
-        bar(_i, Some::<int>(_)) => { println!("wrong pattern matched"); fail!(); }
+        bar(_i, Some::<int>(_)) => { println!("wrong pattern matched"); panic!(); }
         _ => { println!("succeeded"); }
     }
 }
index bc7987f4a27e2f893f7c17e7d3c145f860e4252a..eda36fad215fed6fac17d19f747770c6209f2325 100644 (file)
@@ -25,7 +25,7 @@ fn drop(&mut self) {
 fn main() {
     task::try::<()>(proc() {
         let _a = A;
-        fail!();
+        panic!();
     });
     assert!(unsafe { !HIT });
 }
index 9d7130ecb8c554a1a7e23ddbcc3eec4ec4a7f6c3..450034e12403b999c1807a33168de60259115f74 100644 (file)
@@ -30,7 +30,7 @@ fn is_none(&self) -> bool {
     }
     fn get_ref(&self) -> (int, &T) {
         match *self {
-            Nothing(..) => fail!("E::get_ref(Nothing::<{}>)",  stringify!(T)),
+            Nothing(..) => panic!("E::get_ref(Nothing::<{}>)",  stringify!(T)),
             Thing(x, ref y) => (x, y)
         }
     }
@@ -59,7 +59,7 @@ macro_rules! check_fancy {
         let t_ = Thing::<$T>(23, e);
         match t_.get_ref() {
             (23, $v) => { $chk }
-            _ => fail!("Thing::<{}>(23, {}).get_ref() != (23, _)",
+            _ => panic!("Thing::<{}>(23, {}).get_ref() != (23, _)",
                        stringify!($T), stringify!($e))
         }
     }}
index 8bdae89e523fd3e102c146a7cad8f712d5f488cf..71323016e835e4ed965e2bfd8a7b551054700d4e 100644 (file)
@@ -26,7 +26,7 @@ fn drop(&mut self) {
 fn unwrap<T>(o: Option<T>) -> T {
     match o {
       Some(v) => v,
-      None => fail!()
+      None => panic!()
     }
 }
 
index d047f02fe2f6585c5d96c134d09c60a0ec463953..7c6ad45a9efe1ce84088467bab71e2d3b2c872ca 100644 (file)
@@ -35,7 +35,7 @@ fn index<'a>(&'a self, index: &K) -> &'a V {
                 return &pair.value
             }
         }
-        fail!("No value found for key: {}", index);
+        panic!("No value found for key: {}", index);
     }
 }
 
index a0686e7f17f8bdc55f2a29909f8cab96522a45f1..2975b209d0690a20e550118a804134a87ad7fde8 100644 (file)
@@ -36,7 +36,7 @@ pub fn main() {
 
     let mut_s = Rc::new(RefCell::new(String::from_str("foo")));
     mut_s.borrow_mut().push_str("bar");
-    // HACK assert_eq! would fail here because it stores the LHS and RHS in two locals.
+    // HACK assert_eq! would panic here because it stores the LHS and RHS in two locals.
     assert!(mut_s.borrow().as_slice() == "foobar");
     assert!(mut_s.borrow_mut().as_slice() == "foobar");
 
index cdd56f64d273dd8899d9529c969311600d56dc5f..b63db29cf916ed97c796786a3738da82c63aaf97 100644 (file)
@@ -34,7 +34,7 @@ pub fn main() {
 
     let mut_s = Rc::new(RefCell::new(String::from_str("foo")));
     (*(*mut_s).borrow_mut()).push_str("bar");
-    // assert_eq! would fail here because it stores the LHS and RHS in two locals.
+    // assert_eq! would panic here because it stores the LHS and RHS in two locals.
     assert!((*(*mut_s).borrow()).as_slice() == "foobar");
     assert!((*(*mut_s).borrow_mut()).as_slice() == "foobar");
 
index 34c5bf0234f18c16b5af1c6a182eb5dc917ed99e..0dbba3654b689ee251ec33382af34bdd98be1503 100644 (file)
@@ -10,6 +10,6 @@
 
 #![allow(unreachable_code)]
 
-fn dont_call_me() { fail!(); println!("{}", 1i); }
+fn dont_call_me() { panic!(); println!("{}", 1i); }
 
 pub fn main() { }
index 569d4acb4c610c2087250698b75d7e64c33cfd3c..4c078a66f0882279f3ccf6c269529da989611e89 100644 (file)
@@ -44,6 +44,6 @@ fn main() {
     drop(p.stdin.take());
     match p.wait().unwrap() {
         process::ExitStatus(..) => {}
-        process::ExitSignal(..) => fail!()
+        process::ExitSignal(..) => panic!()
     }
 }
index dbc5bf6626af1086d04f27562617a5f722c0681d..75c52f63041a5f037d445f1839162f11bf13904f 100644 (file)
@@ -10,7 +10,7 @@
 
 // A very limited test of the "bottom" region
 
-fn produce_static<T>() -> &'static T { fail!(); }
+fn produce_static<T>() -> &'static T { panic!(); }
 
 fn foo<T>(_x: &T) -> &uint { produce_static() }
 
index 68a451b62acc436d306de6e2ecb7047905dadc43..f074ca9a8892104175c3f39e2f193f0fd34446c5 100644 (file)
@@ -58,21 +58,21 @@ fn get_v5(a: &A, _i: uint) -> &int {
 fn get_v6_a(a: &A, _i: uint) -> &int {
     match a.value.v6 {
         Some(ref v) => &v.f,
-        None => fail!()
+        None => panic!()
     }
 }
 
 fn get_v6_b(a: &A, _i: uint) -> &int {
     match *a {
         A { value: B { v6: Some(ref v), .. } } => &v.f,
-        _ => fail!()
+        _ => panic!()
     }
 }
 
 fn get_v6_c(a: &A, _i: uint) -> &int {
     match a {
         &A { value: B { v6: Some(ref v), .. } } => &v.f,
-        _ => fail!()
+        _ => panic!()
     }
 }
 
index c732d20a1560584306400cf4fcf197f94a056d16..5de5e39a4545b39b398420baa60dc8cf78d1f802 100644 (file)
@@ -91,13 +91,13 @@ impl<'l> List<'l> {
     fn car<'m>(&'m self) -> int {
         match self {
             &Cons(car, _) => car,
-            &Null => fail!(),
+            &Null => panic!(),
         }
     }
     fn cdr<'n>(&'n self) -> &'l List<'l> {
         match self {
             &Cons(_, cdr) => cdr,
-            &Null => fail!(),
+            &Null => panic!(),
         }
     }
 }
index f6971a8b4ad30e189cc61b720ae589e78ba30a86..54458f0d0df0330d6ab054e3cc1d7e5da4042f5c 100644 (file)
@@ -11,7 +11,7 @@
 fn get<T>(opt: &Option<T>) -> &T {
     match *opt {
       Some(ref v) => v,
-      None => fail!("none")
+      None => panic!("none")
     }
 }
 
index 42e5c8731e269f45e9b30fa0eb10309e51d9bdd6..ff4932e8453e454fa4bb0fda7974fcfd383adadf 100644 (file)
@@ -11,7 +11,7 @@
 
 
 
-fn my_err(s: String) -> ! { println!("{}", s); fail!(); }
+fn my_err(s: String) -> ! { println!("{}", s); panic!(); }
 
 fn okay(i: uint) -> int {
     if i == 3u {
index 1756d74a81e1789dedd8a0c9dd6c495179b80d03..2709904fb4cac0c3bc2fd53c2dd3451f30e5caa7 100644 (file)
@@ -17,7 +17,7 @@ fn surrounding() {
         unsafe { calls += 1 }
 
         if n >= 0 { return; }
-        fail!()
+        panic!()
     };
 
     return_works(10);
@@ -28,7 +28,7 @@ fn surrounding() {
         unsafe { calls += 1 }
 
         if n >= 0 { return; }
-        fail!()
+        panic!()
     };
 
     return_works_proc(10);
index d0762d1f3d8f22dbf3928eabd5bb5a783ae7e2c8..942542a6bcdbd71543325fc663871cbcb348abdd 100644 (file)
@@ -25,12 +25,12 @@ fn start(argc: int, argv: *const *const u8) -> int {
                 1 => {}
                 2 => println!("foo"),
                 3 => assert!(try(|| {}).is_ok()),
-                4 => assert!(try(|| fail!()).is_err()),
+                4 => assert!(try(|| panic!()).is_err()),
                 5 => assert!(try(|| spawn(proc() {})).is_err()),
                 6 => assert!(Command::new("test").spawn().is_err()),
                 7 => assert!(foo.get().is_none()),
                 8 => assert!(try(|| { foo.replace(Some(3)); }).is_err()),
-                _ => fail!()
+                _ => panic!()
             }
         }
         return 0
index 5d154e02af67085e5d7808de78d1500517fb37b7..c2c7a48815cc04e3abb07bace9cd0145c3d689a8 100644 (file)
@@ -23,7 +23,7 @@ fn pad() -> uint { 0 }
 
 mod a {
     pub fn f() {
-        fail!();
+        panic!();
     }
 }
 
index 52fa8e1132e2fec927ad732a52c3ae37a0f1fe94..dc72b6b05390ba1f6ee675cfd7df934933a9f45d 100644 (file)
@@ -25,7 +25,7 @@ pub fn main() {
         match status {
             ExitSignal(_) if cfg!(unix) => {},
             ExitStatus(0xC0000028) if cfg!(windows) => {},
-            _ => fail!("invalid termination (was not signalled): {}", status)
+            _ => panic!("invalid termination (was not signalled): {}", status)
         }
     }
 }
index 65928fd7bf33292ba9dfa1de81c34610d7af8b16..afb6c21d3f41a472ba59caebf93a6e2dbfea4d55 100644 (file)
@@ -15,7 +15,7 @@ fn uhoh<T>(v: Vec<clam<T>> ) {
       a::<T>(ref _t, ref u) => {
           println!("incorrect");
           println!("{}", u);
-          fail!();
+          panic!();
       }
       b::<T> => { println!("correct"); }
     }
index a2aecc1d5cd56e3b62d415006d7e2634ceedbe18..0ac7a2001fc678472f7338d0f4bbd76fca8c08a9 100644 (file)
@@ -23,7 +23,7 @@ impl Drop for Foo {
 }
 
 fn bar() -> uint {
-    fail!();
+    panic!();
 }
 
 fn foo() {
index 8f67532d89d6bdc64810ceca8746befcaa709946..8c888ff03624f701aed29c3f1c38bc38b2cfbe49 100644 (file)
 
 pub fn main() {
     // check
-    if ! cfg!(foo) { fail!() }
-    if   cfg!(not(foo)) { fail!() }
+    if ! cfg!(foo) { panic!() }
+    if   cfg!(not(foo)) { panic!() }
 
-    if ! cfg!(qux="foo") { fail!() }
-    if   cfg!(not(qux="foo")) { fail!() }
+    if ! cfg!(qux="foo") { panic!() }
+    if   cfg!(not(qux="foo")) { panic!() }
 
-    if ! cfg!(all(foo, qux="foo")) { fail!() }
-    if   cfg!(not(all(foo, qux="foo"))) { fail!() }
-    if   cfg!(all(not(all(foo, qux="foo")))) { fail!() }
+    if ! cfg!(all(foo, qux="foo")) { panic!() }
+    if   cfg!(not(all(foo, qux="foo"))) { panic!() }
+    if   cfg!(all(not(all(foo, qux="foo")))) { panic!() }
 
-    if cfg!(not_a_cfg) { fail!() }
-    if cfg!(all(not_a_cfg, foo, qux="foo")) { fail!() }
-    if cfg!(all(not_a_cfg, foo, qux="foo")) { fail!() }
-    if ! cfg!(any(not_a_cfg, foo)) { fail!() }
+    if cfg!(not_a_cfg) { panic!() }
+    if cfg!(all(not_a_cfg, foo, qux="foo")) { panic!() }
+    if cfg!(all(not_a_cfg, foo, qux="foo")) { panic!() }
+    if ! cfg!(any(not_a_cfg, foo)) { panic!() }
 
-    if ! cfg!(not(not_a_cfg)) { fail!() }
-    if ! cfg!(all(not(not_a_cfg), foo, qux="foo")) { fail!() }
+    if ! cfg!(not(not_a_cfg)) { panic!() }
+    if ! cfg!(all(not(not_a_cfg), foo, qux="foo")) { panic!() }
 }
index ceffd1e363667d313ce04f3cf3a4e226a14361a9..0dbe74d722bca34605bb8bec4021f7971097ee06 100644 (file)
@@ -17,7 +17,7 @@ fn main() {
     let stderr = ChanWriter::new(tx);
 
     let res = TaskBuilder::new().stderr(box stderr as Box<Writer + Send>).try(proc() -> () {
-        fail!("Hello, world!")
+        panic!("Hello, world!")
     });
     assert!(res.is_err());
 
index fe882937ca0189fbae6d41ad094b9b682a7e6729..bf6fe5a9d26d90519c502f8694b56e911ba0b7c0 100644 (file)
@@ -45,7 +45,7 @@ fn test() {
                         }
                     }
                     Err(ref e) if e.kind == EndOfFile => break,
-                    Err(e) => fail!("{}", e),
+                    Err(e) => panic!("{}", e),
                 }
             }
             srv_tx.send(());
@@ -67,7 +67,7 @@ fn test() {
     // wait for senders
     if cli_rx.iter().take(N).count() != N {
         a.close_accept().unwrap();
-        fail!("clients failed");
+        panic!("clients panicked");
     }
 
     // wait for one acceptor to die
index e186f63e0a45e00f357682a8bbc3b3e1f4e1c447..07fc1212d7899b9ff7ee913acce460214001c80b 100644 (file)
@@ -48,10 +48,10 @@ fn eventual_timeout() {
         match TcpStream::connect_timeout(addr, Duration::milliseconds(100)) {
             Ok(e) => v.push(e),
             Err(ref e) if e.kind == io::TimedOut => return,
-            Err(e) => fail!("other error: {}", e),
+            Err(e) => panic!("other error: {}", e),
         }
     }
-    fail!("never timed out!");
+    panic!("never timed out!");
 }
 
 fn timeout_success() {
index 91c07c259a2d8b60d8f0da09267053192f84da47..8d2a8a6ccfe205c62523dc094092ee28eb8aec88 100644 (file)
@@ -40,7 +40,7 @@ fn main() {
             let mut stream = match acceptor.accept() {
                 Ok(stream) => stream,
                 Err(error) => {
-                    debug!("accept failed: {}", error);
+                    debug!("accept panicked: {}", error);
                     continue;
                 }
             };
index eceafa40265f92828865b3d98ae9973841c0f9e0..476278405ca8a88a8a00eacd6c0f2c5709e501b1 100644 (file)
@@ -39,7 +39,7 @@ fn test_rm_tempdir() {
     let f: proc():Send = proc() {
         let tmp = TempDir::new("test_rm_tempdir").unwrap();
         tx.send(tmp.path().clone());
-        fail!("fail to unwind past `tmp`");
+        panic!("panic to unwind past `tmp`");
     };
     task::try(f);
     let path = rx.recv();
@@ -49,7 +49,7 @@ fn test_rm_tempdir() {
     let path = tmp.path().clone();
     let f: proc():Send = proc() {
         let _tmp = tmp;
-        fail!("fail to unwind past `tmp`");
+        panic!("panic to unwind past `tmp`");
     };
     task::try(f);
     assert!(!path.exists());
@@ -81,7 +81,7 @@ fn test_rm_tempdir_close() {
         let tmp = TempDir::new("test_rm_tempdir").unwrap();
         tx.send(tmp.path().clone());
         tmp.close();
-        fail!("fail to unwind past `tmp`");
+        panic!("panic when unwinding past `tmp`");
     };
     task::try(f);
     let path = rx.recv();
@@ -92,7 +92,7 @@ fn test_rm_tempdir_close() {
     let f: proc():Send = proc() {
         let tmp = tmp;
         tmp.close();
-        fail!("fail to unwind past `tmp`");
+        panic!("panic when unwinding past `tmp`");
     };
     task::try(f);
     assert!(!path.exists());
@@ -175,15 +175,15 @@ pub fn test_rmdir_recursive_ok() {
     assert!(!root.join("bar").join("blat").exists());
 }
 
-pub fn dont_double_fail() {
+pub fn dont_double_panic() {
     let r: Result<(), _> = task::try(proc() {
         let tmpdir = TempDir::new("test").unwrap();
         // Remove the temporary directory so that TempDir sees
         // an error on drop
         fs::rmdir(tmpdir.path());
-        // Trigger failure. If TempDir fails *again* due to the rmdir
+        // Panic. If TempDir panics *again* due to the rmdir
         // error then the process will abort.
-        fail!();
+        panic!();
     });
     assert!(r.is_err());
 }
@@ -203,5 +203,5 @@ pub fn main() {
     in_tmpdir(recursive_mkdir_dot);
     in_tmpdir(recursive_mkdir_rel_2);
     in_tmpdir(test_rmdir_recursive_ok);
-    in_tmpdir(dont_double_fail);
+    in_tmpdir(dont_double_panic);
 }
index 41a9e6e53f251772d893ab56406fd7c56c000730..2a71148216d6407452a4b49c8043fa15dc178f98 100644 (file)
 
 fn test_ret() { let _x: Box<int> = return; }
 
-fn test_fail() {
-    fn f() { let _x: Box<int> = fail!(); }
+fn test_panic() {
+    fn f() { let _x: Box<int> = panic!(); }
     task::try(proc() f() );
 }
 
-fn test_fail_indirect() {
-    fn f() -> ! { fail!(); }
+fn test_panic_indirect() {
+    fn f() -> ! { panic!(); }
     fn g() { let _x: Box<int> = f(); }
     task::try(proc() g() );
 }
@@ -35,6 +35,6 @@ pub fn main() {
     test_break();
     test_cont();
     test_ret();
-    test_fail();
-    test_fail_indirect();
+    test_panic();
+    test_panic_indirect();
 }
index 9b658ee1dae53a3cab4aad0e2c1e346d0d9daddd..839e91f3793d4e9d6d7e6578c5f7ea86ba7a5533 100644 (file)
@@ -13,4 +13,4 @@
 
 // Building as a test runner means that a synthetic main will be run,
 // not ours
-pub fn main() { fail!(); }
+pub fn main() { panic!(); }
index ed4712ff3be9c55bd8ba81e1b64498f0fee7445c..93aa367feee82ebf352d04ee6d0fa2c5bd491426 100644 (file)
@@ -57,10 +57,10 @@ fn non_default_instance() -> &'static Request {
 pub fn main() {
     match default_instance() {
         &Request { foo: TestNone, bar: 17 } => {},
-        _ => fail!(),
+        _ => panic!(),
     };
     match non_default_instance() {
         &Request { foo: TestSome(0x1020304050607080), bar: 19 } => {},
-        _ => fail!(),
+        _ => panic!(),
     };
 }
index 6be79cb62dd7f09ccf6c1f32ffc1c14cd1b0d1a4..48d073e28aa753092fc0fd98b9323082e76474d9 100644 (file)
@@ -26,7 +26,7 @@ fn foo(a:T, b:T) -> T {
             match (a, b) {
                 (A($id1), A($id2)) => A($e),
                 (B($id1), B($id2)) => B($e),
-                _ => fail!()
+                _ => panic!()
             }
         }
     )
index 762a74b24551c29a36123080584f22a9545f5054..3c67eaee0a6a2a83bb9882c5ca7d6dca79bc6ce6 100644 (file)
@@ -17,13 +17,13 @@ enum t { t1(int), t2(int), }
       t1(a) {
         assert_eq!(a, 10);
       }
-      _ { fail!(); }
+      _ { panic!(); }
     }*/
 
     /*alt x {
       box t1(a) {
         assert_eq!(a, 10);
       }
-      _ { fail!(); }
+      _ { panic!(); }
     }*/
 }
index 7f894a8c324b55b3074c63b284e7ff59ee3a523d..a902fef288f002dff362435962264d8573ae728e 100644 (file)
@@ -14,5 +14,5 @@ pub fn main() {
 }
 
 fn f(_i: Box<int>) -> Box<int> {
-    fail!();
+    panic!();
 }
index 297ded0222d1f4be69dcb3d8bb2a216b1e280309..a0eee7e3cb6ee770560795d1e5a0f192f9c2993d 100644 (file)
@@ -11,7 +11,7 @@
 fn simple() {
     match box true {
       box true => { }
-      _ => { fail!(); }
+      _ => { panic!(); }
     }
 }
 
index 3a1cc0331a3e6c04ef39c12cfd896361f2660dab..c12303b009f46c588d128582ce1627d0502cd6fe 100644 (file)
@@ -17,7 +17,7 @@
 
 impl Drop for Foo {
     fn drop(&mut self) {
-        fail!("This failure should happen.");
+        panic!("This panic should happen.");
     }
 }
 
@@ -27,5 +27,5 @@ pub fn main() {
     });
 
     let s = x.unwrap_err().downcast::<&'static str>().unwrap();
-    assert_eq!(s.as_slice(), "This failure should happen.");
+    assert_eq!(s.as_slice(), "This panic should happen.");
 }
index 42b78e4ec661639c73c428a2583db655a4c5d22e..b2ef1a044db808e8e51b95b556fb05f415c170e2 100644 (file)
@@ -87,7 +87,7 @@ fn main() {
     };
 
     match process::Process::spawn(cfg) {
-        Ok(_) => { fail!("spawn() should have failled"); }
+        Ok(_) => { panic!("spawn() should have panicked"); }
         Err(rtio::IoError { code: err, ..}) => {
             assert_eq!(err as c_int, EXPECTED_ERRNO);
         }
index fa24cc44f90079c2cb6464e49fd1ee7cc18b63c2..d8a8913e58ad9b1bc8fdcd5cd34893940db3fa23 100644 (file)
@@ -14,7 +14,7 @@
 fn id(x: bool) -> bool { x }
 
 fn call_id() {
-    let c = fail!();
+    let c = panic!();
     id(c); //~ WARNING unreachable statement
 }
 
index 496be7e0e6abbec08ffa375b62bd10f9b87c0099..a9ac78c5d76fd81d30a6a480402d8e4a7f08245e 100644 (file)
@@ -15,7 +15,7 @@
 fn id(x: bool) -> bool { x }
 
 fn call_id() {
-    let c = fail!();
+    let c = panic!();
     id(c);
 }
 
index 13370ea340f656aa4132b4926285ac7c6bdd3760..60f07663bef0e38ee714fcef07e0213c4d577542 100644 (file)
@@ -32,7 +32,7 @@ fn complainer(tx: Sender<bool>) -> complainer {
 
 fn f(tx: Sender<bool>) {
     let _tx = complainer(tx);
-    fail!();
+    panic!();
 }
 
 pub fn main() {
index e5497427755fd23eeeb695949c226df2719889f2..2f31ee25b5daab80d30235b8006052299a198fb9 100644 (file)
@@ -12,7 +12,7 @@
 
 fn f() {
     let _a = box 0i;
-    fail!();
+    panic!();
 }
 
 pub fn main() {
index b5d2b9ef84c574a89609abc18cadc253d4f6a6b1..9337d064d2397a293a3c474f3154c687225a2be8 100644 (file)
@@ -13,7 +13,7 @@
 fn foo<T>(o: myoption<T>) -> int {
     let mut x: int;
     match o {
-        none::<T> => { fail!(); }
+        none::<T> => { panic!(); }
         some::<T>(_t) => { x = 5; }
     }
     return x;
index 9992c059ac4e6b13884cf2af764a8cf74222d12f..6476f734ae650b3dcfcc0257e954797ed351290f 100644 (file)
 pub fn main() {
     let x = [1i, 2, 3];
     match x {
-        [2, _, _] => fail!(),
+        [2, _, _] => panic!(),
         [1, a, b] => {
             assert!([a, b] == [2, 3]);
         }
-        [_, _, _] => fail!(),
+        [_, _, _] => panic!(),
     }
 
     let y = ([(1i, true), (2i, false)], 0.5f64);
@@ -24,7 +24,7 @@ pub fn main() {
             assert_eq!(a, true);
             assert_eq!(b, 2);
         }
-        ([_, _], 0.5) => fail!(),
-        ([_, _], _) => fail!(),
+        ([_, _], 0.5) => panic!(),
+        ([_, _], _) => panic!(),
     }
 }
index 187d97f483ddaa6ff787ac23cff471f0b4089018..77226df7fa2025f27b6dd8a297e3a61e78cd4404 100644 (file)
@@ -57,7 +57,7 @@ fn b() {
 fn c() {
     let x = [1i];
     match x {
-        [2, ..] => fail!(),
+        [2, ..] => panic!(),
         [..] => ()
     }
 }
index 10c37651a86350e07c4c9c1465e7ae659a5ae2db..ce9cc68bd3654f5ba18820e26c3e852739d3535a 100644 (file)
@@ -68,8 +68,8 @@ pub fn main() {
             let mut count = 0;
             main.clone().as_mut_slice().sort_by(|a, b| { count += 1; a.cmp(b) });
 
-            // ... and then fail on each and every single one.
-            for fail_countdown in range(0i, count) {
+            // ... and then panic on each and every single one.
+            for panic_countdown in range(0i, count) {
                 // refresh the counters.
                 for c in drop_counts.iter() {
                     c.store(0, Relaxed);
@@ -79,12 +79,12 @@ pub fn main() {
 
                 let _ = task::try(proc() {
                         let mut v = v;
-                        let mut fail_countdown = fail_countdown;
+                        let mut panic_countdown = panic_countdown;
                         v.as_mut_slice().sort_by(|a, b| {
-                                if fail_countdown == 0 {
-                                    fail!()
+                                if panic_countdown == 0 {
+                                    panic!()
                                 }
-                                fail_countdown -= 1;
+                                panic_countdown -= 1;
                                 a.cmp(b)
                             })
                     });
index 72204c28f82ade773eb42141ea6cc504ec2f3df1..f73800b89db642e28f0333f1366401dfd01d5bac 100644 (file)
@@ -71,7 +71,7 @@ fn p() -> bool { true }
 fn angrydome() {
     loop { if break { } }
     let mut i = 0i;
-    loop { i += 1; if i == 1 { match (continue) { 1i => { }, _ => fail!("wat") } }
+    loop { i += 1; if i == 1 { match (continue) { 1i => { }, _ => panic!("wat") } }
       break; }
 }
 
index dd53ac889f5056b4ccd561037792ea3c56fccd6d..41712f7c64d29c28fa1b2a9ba23ae0cdec82b25f 100644 (file)
@@ -15,7 +15,7 @@ pub fn main() {
         i -= 1;
         if i == 95 {
             break 'w;
-            fail!("Should have broken out of loop");
+            panic!("Should have broken out of loop");
         }
     }
     assert_eq!(i, 95);
index 6d57bff1bd673b7ac49724948adeadc8518c78cd..ae49c07093b11818fbce833496afa8228dff3ce8 100644 (file)
@@ -20,7 +20,7 @@ pub fn main() {
             Some(ref z) if *z.lock() => {
                 assert!(*z.lock());
             },
-            _ => fail!()
+            _ => panic!()
         }
     }
 }