]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #23098 - brson:ignore-fast, r=alexcrichton
authorManish Goregaokar <manishsmail@gmail.com>
Fri, 6 Mar 2015 03:32:56 +0000 (09:02 +0530)
committerManish Goregaokar <manishsmail@gmail.com>
Fri, 6 Mar 2015 16:52:28 +0000 (22:22 +0530)
439 files changed:
mk/tests.mk
src/compiletest/compiletest.rs
src/doc/intro.md
src/doc/reference.md
src/doc/trpl/arrays-vectors-and-slices.md
src/doc/trpl/compound-data-types.md
src/etc/tidy.py
src/etc/unicode.py
src/grammar/parser-lalr.y
src/jemalloc
src/liballoc/boxed.rs
src/liballoc/boxed_test.rs
src/libcollections/bit.rs
src/libcollections/fmt.rs
src/libcollections/slice.rs
src/libcollections/str.rs
src/libcollections/string.rs
src/libcore/char.rs
src/libcore/fmt/float.rs
src/libcore/fmt/mod.rs
src/libcore/fmt/num.rs
src/libcore/hash/sip.rs
src/libcore/intrinsics.rs
src/libcore/iter.rs
src/libcore/macros.rs
src/libcore/num/mod.rs
src/libcore/ops.rs
src/libcore/option.rs
src/libcore/str/mod.rs
src/libcoretest/char.rs
src/libcoretest/hash/mod.rs
src/libcoretest/hash/sip.rs
src/libcoretest/iter.rs
src/libcoretest/mem.rs
src/libcoretest/num/mod.rs
src/libcoretest/ptr.rs
src/libgetopts/lib.rs
src/liblibc/lib.rs
src/liblog/macros.rs
src/librand/chacha.rs
src/librand/distributions/range.rs
src/librand/isaac.rs
src/librand/lib.rs
src/librand/reseeding.rs
src/librbml/lib.rs
src/librustc/lib.rs
src/librustc/metadata/creader.rs
src/librustc/metadata/loader.rs
src/librustc/metadata/macro_import.rs
src/librustc/middle/check_match.rs
src/librustc/middle/const_eval.rs
src/librustc/middle/infer/error_reporting.rs
src/librustc/middle/stability.rs
src/librustc/plugin/registry.rs
src/librustc/session/config.rs
src/librustc/util/lev_distance.rs
src/librustc_back/archive.rs
src/librustc_back/lib.rs
src/librustc_back/sha2.rs
src/librustc_back/target/apple_ios_base.rs
src/librustc_back/tempdir.rs [new file with mode: 0644]
src/librustc_bitflags/lib.rs
src/librustc_borrowck/borrowck/gather_loans/move_error.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_driver/driver.rs
src/librustc_driver/lib.rs
src/librustc_lint/builtin.rs
src/librustc_resolve/lib.rs
src/librustc_trans/back/link.rs
src/librustc_trans/lib.rs
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/cabi_aarch64.rs
src/librustc_trans/trans/consts.rs
src/librustc_trans/trans/debuginfo.rs
src/librustc_trans/trans/expr.rs
src/librustc_trans/trans/foreign.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/callee.rs
src/librustc_typeck/check/implicator.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/wf.rs
src/librustc_typeck/coherence/mod.rs
src/librustc_typeck/collect.rs
src/librustdoc/html/render.rs
src/librustdoc/html/static/main.js
src/librustdoc/lib.rs
src/librustdoc/test.rs
src/libserialize/hex.rs
src/libserialize/json.rs
src/libstd/ascii.rs
src/libstd/collections/hash/table.rs
src/libstd/collections/mod.rs
src/libstd/env.rs
src/libstd/fs/mod.rs
src/libstd/fs/tempdir.rs
src/libstd/io/buffered.rs
src/libstd/io/cursor.rs
src/libstd/io/impls.rs
src/libstd/io/mod.rs
src/libstd/io/util.rs
src/libstd/lib.rs
src/libstd/net/addr.rs
src/libstd/net/parser.rs
src/libstd/net/tcp.rs
src/libstd/num/f32.rs
src/libstd/num/f64.rs
src/libstd/num/mod.rs
src/libstd/num/strconv.rs
src/libstd/old_io/buffered.rs
src/libstd/old_io/comm_adapters.rs
src/libstd/old_io/extensions.rs
src/libstd/old_io/fs.rs
src/libstd/old_io/mod.rs
src/libstd/old_io/net/ip.rs
src/libstd/old_io/net/tcp.rs
src/libstd/old_io/process.rs
src/libstd/old_io/test.rs
src/libstd/old_io/util.rs
src/libstd/rand/mod.rs
src/libstd/rand/os.rs
src/libstd/rand/reader.rs
src/libstd/rt/util.rs
src/libstd/sys/common/thread_local.rs
src/libstd/sys/common/wtf8.rs
src/libstd/sys/unix/fs.rs
src/libstd/sys/unix/process.rs
src/libstd/sys/windows/process.rs
src/libstd/thread.rs
src/libstd/thread_local/mod.rs
src/libstd/thread_local/scoped.rs
src/libstd/time/duration.rs
src/libstd/tuple.rs
src/libsyntax/ast.rs
src/libsyntax/ast_util.rs
src/libsyntax/codemap.rs
src/libsyntax/diagnostics/macros.rs
src/libsyntax/ext/asm.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/deriving/generic/mod.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/quote.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/feature_gate.rs
src/libsyntax/lib.rs
src/libsyntax/parse/attr.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax/test.rs
src/libterm/lib.rs
src/libterm/terminfo/parm.rs
src/libtest/lib.rs
src/libunicode/tables.rs
src/libunicode/u_str.rs
src/llvm
src/rustbook/build.rs
src/rustbook/main.rs
src/rustllvm/llvm-auto-clean-trigger
src/snapshots.txt
src/test/auxiliary/cci_class_3.rs
src/test/auxiliary/cci_class_4.rs
src/test/auxiliary/cci_class_cast.rs
src/test/auxiliary/cci_impl_lib.rs
src/test/auxiliary/cci_iter_lib.rs
src/test/auxiliary/cci_no_inline_lib.rs
src/test/auxiliary/internal_unstable.rs [new file with mode: 0644]
src/test/auxiliary/macro_reexport_1.rs
src/test/auxiliary/plugin_args.rs
src/test/auxiliary/roman_numerals.rs
src/test/auxiliary/unboxed-closures-cross-crate.rs
src/test/bench/noise.rs
src/test/bench/shootout-chameneos-redux.rs
src/test/bench/shootout-fannkuch-redux.rs
src/test/bench/shootout-fasta-redux.rs
src/test/bench/shootout-fasta.rs
src/test/bench/shootout-k-nucleotide.rs
src/test/bench/shootout-meteor.rs
src/test/bench/sudoku.rs
src/test/compile-fail-fulldeps/issue-18986.rs
src/test/compile-fail/array-not-vector.rs
src/test/compile-fail/asm-in-bad-modifier.rs
src/test/compile-fail/asm-out-assign-imm.rs
src/test/compile-fail/asm-out-no-modifier.rs
src/test/compile-fail/assign-to-method.rs
src/test/compile-fail/bad-bang-ann-3.rs
src/test/compile-fail/bad-bang-ann.rs
src/test/compile-fail/bad-const-type.rs
src/test/compile-fail/bad-method-typaram-kind.rs
src/test/compile-fail/binop-logic-int.rs
src/test/compile-fail/borrow-immutable-upvar-mutation.rs
src/test/compile-fail/borrowck-move-error-with-note.rs
src/test/compile-fail/borrowck-report-with-custom-diagnostic.rs
src/test/compile-fail/cfg-attr-unknown-attribute-macro-expansion.rs [new file with mode: 0644]
src/test/compile-fail/class-method-missing.rs
src/test/compile-fail/class-missing-self.rs
src/test/compile-fail/coercion-slice.rs
src/test/compile-fail/const-block-non-item-statement.rs
src/test/compile-fail/deriving-non-type.rs
src/test/compile-fail/destructor-restrictions.rs
src/test/compile-fail/feature-gate-allow-internal-unstable-nested-macro.rs [new file with mode: 0644]
src/test/compile-fail/feature-gate-allow-internal-unstable.rs [new file with mode: 0644]
src/test/compile-fail/feature-gated-feature-in-macro-arg.rs
src/test/compile-fail/import-glob-circular.rs
src/test/compile-fail/index-bot.rs
src/test/compile-fail/infinite-instantiation.rs
src/test/compile-fail/internal-unstable-noallow.rs [new file with mode: 0644]
src/test/compile-fail/internal-unstable-thread-local.rs [new file with mode: 0644]
src/test/compile-fail/internal-unstable.rs [new file with mode: 0755]
src/test/compile-fail/issue-11714.rs
src/test/compile-fail/issue-13058.rs
src/test/compile-fail/issue-13466.rs
src/test/compile-fail/issue-14845.rs
src/test/compile-fail/issue-16747.rs
src/test/compile-fail/issue-17283.rs
src/test/compile-fail/issue-17651.rs
src/test/compile-fail/issue-17718-patterns.rs
src/test/compile-fail/issue-17933.rs
src/test/compile-fail/issue-18107.rs
src/test/compile-fail/issue-18252.rs
src/test/compile-fail/issue-18566.rs
src/test/compile-fail/issue-18783.rs
src/test/compile-fail/issue-18959.rs
src/test/compile-fail/issue-19991.rs
src/test/compile-fail/issue-20801.rs
src/test/compile-fail/issue-2150.rs
src/test/compile-fail/issue-4517.rs
src/test/compile-fail/issue-7575.rs
src/test/compile-fail/issue-7867.rs
src/test/compile-fail/kindck-nonsendable-1.rs
src/test/compile-fail/lifetime-inference-give-expl-lifetime-param-2.rs
src/test/compile-fail/lint-dead-code-4.rs
src/test/compile-fail/liveness-return-last-stmt-semi.rs
src/test/compile-fail/macro-no-implicit-reexport.rs
src/test/compile-fail/macro-reexport-not-locally-visible.rs
src/test/compile-fail/method-self-arg-1.rs
src/test/compile-fail/mut-pattern-mismatched.rs
src/test/compile-fail/mutable-class-fields-2.rs
src/test/compile-fail/mutable-class-fields.rs
src/test/compile-fail/non-exhaustive-pattern-witness.rs
src/test/compile-fail/or-patter-mismatch.rs
src/test/compile-fail/private-method.rs
src/test/compile-fail/private-struct-field-cross-crate.rs
src/test/compile-fail/range-1.rs
src/test/compile-fail/regions-addr-of-self.rs
src/test/compile-fail/regions-addr-of-upvar-self.rs
src/test/compile-fail/regions-creating-enums.rs
src/test/compile-fail/regions-pattern-typing-issue-19997.rs
src/test/compile-fail/regions-return-ref-to-upvar-issue-17403.rs
src/test/compile-fail/regions-trait-1.rs
src/test/compile-fail/structure-constructor-type-mismatch.rs
src/test/compile-fail/tail-typeck.rs
src/test/compile-fail/traits-issue-23003-overflow.rs [new file with mode: 0644]
src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs
src/test/compile-fail/tuple-index-out-of-bounds.rs
src/test/compile-fail/type-mismatch-multiple.rs
src/test/compile-fail/type-params-in-different-spaces-1.rs
src/test/compile-fail/typeck_type_placeholder_item.rs
src/test/compile-fail/unboxed-closure-illegal-move.rs
src/test/compile-fail/unboxed-closure-immutable-capture.rs
src/test/compile-fail/unboxed-closure-region.rs
src/test/compile-fail/unboxed-closures-borrow-conflict.rs
src/test/compile-fail/unboxed-closures-mutate-upvar.rs
src/test/compile-fail/unboxed-closures-mutated-upvar-from-fn-closure.rs
src/test/compile-fail/unreachable-arm.rs
src/test/compile-fail/unsafe-fn-assign-deref-ptr.rs
src/test/compile-fail/variance-issue-20533.rs
src/test/compile-fail/vtable-res-trait-param.rs
src/test/debuginfo/associated-types.rs
src/test/debuginfo/constant-debug-locs.rs [new file with mode: 0644]
src/test/debuginfo/extern-c-fn.rs [new file with mode: 0644]
src/test/debuginfo/recursive-struct.rs
src/test/debuginfo/simd.rs
src/test/parse-fail/class-implements-bad-trait.rs
src/test/parse-fail/issue-5544-b.rs
src/test/parse-fail/lex-bad-numeric-literals.rs
src/test/parse-fail/regions-trait-2.rs
src/test/pretty/empty-lines.rs
src/test/pretty/issue-4264.pp
src/test/pretty/issue-4264.rs
src/test/run-fail/extern-panic.rs
src/test/run-fail/if-check-panic.rs
src/test/run-fail/overflowing-add.rs
src/test/run-fail/overflowing-mul.rs
src/test/run-fail/overflowing-sub.rs
src/test/run-make/debug-assertions/Makefile [new file with mode: 0644]
src/test/run-make/debug-assertions/debug.rs [new file with mode: 0644]
src/test/run-make/graphviz-flowgraph/f20.dot-expected.dot
src/test/run-make/graphviz-flowgraph/f20.rs
src/test/run-make/save-analysis/foo.rs
src/test/run-make/symbols-are-reasonable/lib.rs
src/test/run-pass-fulldeps/quote-tokens.rs
src/test/run-pass/alias-uninit-value.rs
src/test/run-pass/associated-types-constant-type.rs
src/test/run-pass/associated-types-return.rs
src/test/run-pass/associated-types-struct-field-named.rs
src/test/run-pass/associated-types-struct-field-numbered.rs
src/test/run-pass/associated-types-sugar-path.rs
src/test/run-pass/auto-encode.rs
src/test/run-pass/autoderef-method-on-trait.rs
src/test/run-pass/autoderef-method-priority.rs
src/test/run-pass/autoderef-method-twice-but-not-thrice.rs
src/test/run-pass/autoderef-method-twice.rs
src/test/run-pass/autoderef-method.rs
src/test/run-pass/autoref-intermediate-types-issue-3585.rs
src/test/run-pass/big-literals.rs
src/test/run-pass/block-arg-call-as.rs
src/test/run-pass/block-iter-1.rs
src/test/run-pass/block-iter-2.rs
src/test/run-pass/borrowck-closures-two-imm.rs
src/test/run-pass/borrowck-mut-uniq.rs
src/test/run-pass/capture-clauses-unboxed-closures.rs
src/test/run-pass/cast.rs
src/test/run-pass/cci_borrow.rs
src/test/run-pass/cci_impl_exe.rs
src/test/run-pass/cci_iter_exe.rs
src/test/run-pass/cci_no_inline_exe.rs
src/test/run-pass/class-cast-to-trait-cross-crate-2.rs
src/test/run-pass/class-cast-to-trait.rs
src/test/run-pass/class-dtor.rs
src/test/run-pass/class-exports.rs
src/test/run-pass/class-method-cross-crate.rs
src/test/run-pass/class-methods-cross-crate.rs
src/test/run-pass/class-methods.rs
src/test/run-pass/class-poly-methods.rs
src/test/run-pass/class-separate-impl.rs
src/test/run-pass/class-typarams.rs
src/test/run-pass/classes-simple-cross-crate.rs
src/test/run-pass/classes-simple-method.rs
src/test/run-pass/classes-simple.rs
src/test/run-pass/coerce-reborrow-imm-vec-rcvr.rs
src/test/run-pass/concat.rs
src/test/run-pass/conditional-debug-macro-off.rs
src/test/run-pass/const-block.rs
src/test/run-pass/const-bound.rs
src/test/run-pass/double-ref.rs
src/test/run-pass/drop-trait-enum.rs
src/test/run-pass/extern-pass-char.rs
src/test/run-pass/extern-pass-u32.rs
src/test/run-pass/extern-pass-u64.rs
src/test/run-pass/foreign-fn-linkname.rs
src/test/run-pass/i32-sub.rs
src/test/run-pass/i8-incr.rs
src/test/run-pass/if-check.rs
src/test/run-pass/intrinsic-alignment.rs
src/test/run-pass/intrinsics-integer.rs
src/test/run-pass/intrinsics-math.rs
src/test/run-pass/issue-1112.rs
src/test/run-pass/issue-11736.rs
src/test/run-pass/issue-11958.rs
src/test/run-pass/issue-12909.rs
src/test/run-pass/issue-15571.rs
src/test/run-pass/issue-15673.rs
src/test/run-pass/issue-15734.rs
src/test/run-pass/issue-17662.rs
src/test/run-pass/issue-18539.rs
src/test/run-pass/issue-20055-box-trait.rs
src/test/run-pass/issue-20055-box-unsized-array.rs
src/test/run-pass/issue-20676.rs
src/test/run-pass/issue-21475.rs
src/test/run-pass/issue-2185.rs
src/test/run-pass/issue-22036.rs
src/test/run-pass/issue-2550.rs
src/test/run-pass/issue-2989.rs
src/test/run-pass/issue-3609.rs
src/test/run-pass/issue-6130.rs
src/test/run-pass/issue-6892.rs
src/test/run-pass/issue-7012.rs
src/test/run-pass/issue-8783.rs
src/test/run-pass/issue2170exe.rs
src/test/run-pass/ivec-tag.rs
src/test/run-pass/last-use-in-cap-clause.rs
src/test/run-pass/logging-enabled-debug.rs
src/test/run-pass/logging-separate-lines.rs
src/test/run-pass/macro-interpolation.rs
src/test/run-pass/macro-pat.rs
src/test/run-pass/match-with-ret-arm.rs
src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs
src/test/run-pass/method-self-arg-aux1.rs
src/test/run-pass/method-self-arg-aux2.rs
src/test/run-pass/method-self-arg-trait.rs
src/test/run-pass/method-self-arg.rs
src/test/run-pass/nullable-pointer-iotareduction.rs
src/test/run-pass/object-method-numbering.rs
src/test/run-pass/objects-coerce-freeze-borrored.rs
src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs
src/test/run-pass/or-pattern.rs
src/test/run-pass/overloaded-calls-param-vtables.rs
src/test/run-pass/packed-struct-vec.rs
src/test/run-pass/path.rs
src/test/run-pass/private-class-field.rs
src/test/run-pass/pure-sum.rs
src/test/run-pass/ranges-precedence.rs
src/test/run-pass/realloc-16687.rs
src/test/run-pass/rec-align-u32.rs
src/test/run-pass/rec-align-u64.rs
src/test/run-pass/record-pat.rs
src/test/run-pass/regions-borrow-at.rs
src/test/run-pass/regions-borrow-uniq.rs
src/test/run-pass/regions-copy-closure.rs
src/test/run-pass/regions-escape-into-other-fn.rs
src/test/run-pass/regions-params.rs
src/test/run-pass/regions-refcell.rs
src/test/run-pass/regions-trait-object-1.rs
src/test/run-pass/rename-directory.rs
src/test/run-pass/ret-bang.rs
src/test/run-pass/running-with-no-runtime.rs
src/test/run-pass/sendfn-is-a-block.rs
src/test/run-pass/shift-various-types.rs
src/test/run-pass/small-enums-with-fields.rs
src/test/run-pass/static-methods-in-traits.rs
src/test/run-pass/string-self-append.rs
src/test/run-pass/struct-return.rs
src/test/run-pass/syntax-extension-source-utils.rs
src/test/run-pass/tag-align-dyn-u64.rs
src/test/run-pass/tag-align-dyn-variants.rs
src/test/run-pass/tag-align-shape.rs
src/test/run-pass/tag-align-u64.rs
src/test/run-pass/task-comm-16.rs
src/test/run-pass/tcp-stress.rs
src/test/run-pass/trait-default-method-bound-subst4.rs
src/test/run-pass/trait-object-generics.rs
src/test/run-pass/trait-object-with-lifetime-bound.rs
src/test/run-pass/traits-issue-23003.rs [new file with mode: 0644]
src/test/run-pass/type-params-in-for-each.rs
src/test/run-pass/typeck_type_placeholder_1.rs
src/test/run-pass/u32-decr.rs
src/test/run-pass/u8-incr-decr.rs
src/test/run-pass/u8-incr.rs
src/test/run-pass/ufcs-trait-object.rs
src/test/run-pass/unboxed-closures-unique-type-id.rs
src/test/run-pass/unique-pat-2.rs
src/test/run-pass/unique-send-2.rs
src/test/run-pass/unsized3.rs
src/test/run-pass/utf8_chars.rs
src/test/run-pass/vec-fixed-length.rs
src/test/run-pass/weird-exprs.rs
src/test/run-pass/where-for-self.rs
src/test/run-pass/x86stdcall.rs
src/test/run-pass/x86stdcall2.rs

index 838ed0dccfcbbf971971f640121e5ddef109203d..ef38abcab651877dfdd0a6a9c9358d4176cadce6 100644 (file)
@@ -590,7 +590,7 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \
 
 # The tests select when to use debug configuration on their own;
 # remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
-CTEST_RUSTC_FLAGS := $$(subst --cfg ndebug,,$$(CFG_RUSTC_FLAGS))
+CTEST_RUSTC_FLAGS := $$(subst -C debug-assertions,,$$(CFG_RUSTC_FLAGS))
 
 # The tests cannot be optimized while the rest of the compiler is optimized, so
 # filter out the optimization (if any) from rustc and then figure out if we need
index b9e6f1842eeab8f3a58eaaf817a89280457bf330..a7531152a84006034067fb2b5ef5ed37641ca531 100644 (file)
@@ -24,8 +24,8 @@
 #![feature(path)]
 #![feature(os)]
 #![feature(io)]
-#![feature(fs)]
 #![feature(net)]
+#![feature(path_ext)]
 
 #![deny(warnings)]
 
index d145eaada2b0e0f1f81c87bfaf2f3a6ba82d3ea3..bb86de64e7af3bd3ef098c16d0f1d43bc748edcd 100644 (file)
@@ -428,7 +428,8 @@ fn main() {
 
     let guards: Vec<_> = (0..3).map(|i| {
         Thread::scoped(move || {
-            for j in 0..3 { numbers[j] += 1 }
+            numbers[i] += 1;
+            println!("numbers[{}] is {}", i, numbers[i]);
         });
     }).collect();
 }
@@ -437,10 +438,12 @@ fn main() {
 It gives us this error:
 
 ```text
-7:29: 9:10 error: cannot move out of captured outer variable in an `FnMut` closure
-7         Thread::scoped(move || {
-8             for j in 0..3 { numbers[j] += 1 }
-9         });
+7:25: 10:6 error: cannot move out of captured outer variable in an `FnMut` closure
+7     Thread::scoped(move || {
+8       numbers[i] += 1;
+9       println!("numbers[{}] is {}", i, numbers[i]);
+10     });
+error: aborting due to previous error
 ```
 
 It mentions that "captured outer variable in an `FnMut` closure".
index fa4986816aa1ca5f044b2eda87830f32b4046575..95ccc71532a34f740a413da5b081a5f6a41ed95a 100644 (file)
@@ -2555,6 +2555,14 @@ The currently implemented features of the reference compiler are:
                             types, e.g. as the return type of a public function.
                             This capability may be removed in the future.
 
+* `allow_internal_unstable` - Allows `macro_rules!` macros to be tagged with the
+                              `#[allow_internal_unstable]` attribute, designed
+                              to allow `std` macros to call
+                              `#[unstable]`/feature-gated functionality
+                              internally without imposing on callers
+                              (i.e. making them behave like function calls in
+                              terms of encapsulation).
+
 If a feature is promoted to a language feature, then all existing programs will
 start to receive compilation warnings about #[feature] directives which enabled
 the new feature (because the directive is no longer necessary). However, if a
index d4e2ad5cd5f66fa7973a0214b130afa660a411aa..f1b5ecf4ff031b4535a5fc685312a6003455aa91 100644 (file)
@@ -60,6 +60,12 @@ let v = vec![1, 2, 3]; // v: Vec<i32>
 brackets `[]` with `vec!`. Rust allows you to use either in either situation,
 this is just convention.)
 
+There's an alternate form of `vec!` for repeating an initial value:
+
+```
+let v = vec![0; 10]; // ten zeroes
+```
+
 You can get the length of, iterate over, and subscript vectors just like
 arrays. In addition, (mutable) vectors can grow automatically:
 
index 85d67262c4066d9bf78b9d7185b0020fefa23877..e09922fd390a9b037cedaab162908449a42d2eb2 100644 (file)
@@ -6,8 +6,8 @@ strings, but next, let's talk about some more complicated ways of storing data.
 
 ## Tuples
 
-The first compound data type we're going to talk about are called *tuples*.
-Tuples are an ordered list of a fixed size. Like this:
+The first compound data type we're going to talk about is called the *tuple*.
+A tuple is an ordered list of fixed size. Like this:
 
 ```rust
 let x = (1, "hello");
@@ -229,7 +229,7 @@ enum Character {
 ```
 
 An `enum` variant can be defined as most normal types. Below are some example
-types have been listed which also would be allowed in an `enum`.
+types which also would be allowed in an `enum`.
 
 ```rust
 struct Empty;
index fd3309dce12cbd01e1c573e05beeddb096a7c2f1..c524fae7f0a42e6272ce736cd5d54517702baa11 100644 (file)
@@ -13,7 +13,7 @@ import fileinput
 import subprocess
 import re
 import os
-from licenseck import *
+from licenseck import check_license
 import snapshot
 
 err = 0
@@ -22,13 +22,8 @@ cr_flag = "ignore-tidy-cr"
 tab_flag = "ignore-tidy-tab"
 linelength_flag = "ignore-tidy-linelength"
 
-# Be careful to support Python 2.4, 2.6, and 3.x here!
-config_proc = subprocess.Popen(["git", "config", "core.autocrlf"],
-                               stdout=subprocess.PIPE)
-result = config_proc.communicate()[0]
-
-true = "true".encode('utf8')
-autocrlf = result.strip() == true if result is not None else False
+interesting_files = ['.rs', '.py', '.js', '.sh', '.c', '.h']
+uninteresting_files = ['miniz.c', 'jquery', 'rust_android_dummy']
 
 
 def report_error_name_no(name, no, s):
@@ -51,6 +46,34 @@ def do_license_check(name, contents):
     if not check_license(name, contents):
         report_error_name_no(name, 1, "incorrect license")
 
+
+def update_counts(current_name):
+    global file_counts
+    global count_other_linted_files
+
+    _, ext = os.path.splitext(current_name)
+
+    if ext in interesting_files:
+        file_counts[ext] += 1
+    else:
+        count_other_linted_files += 1
+
+
+def interesting_file(f):
+    if any(x in f for x in uninteresting_files):
+        return False
+
+    return any(os.path.splitext(f)[1] == ext for ext in interesting_files)
+
+
+# Be careful to support Python 2.4, 2.6, and 3.x here!
+config_proc = subprocess.Popen(["git", "config", "core.autocrlf"],
+                               stdout=subprocess.PIPE)
+result = config_proc.communicate()[0]
+
+true = "true".encode('utf8')
+autocrlf = result.strip() == true if result is not None else False
+
 current_name = ""
 current_contents = ""
 check_tab = True
@@ -63,28 +86,16 @@ if len(sys.argv) < 2:
 
 src_dir = sys.argv[1]
 
-try:
-    count_lines = 0
-    count_non_blank_lines = 0
+count_lines = 0
+count_non_blank_lines = 0
+count_other_linted_files = 0
 
-    interesting_files = ['.rs', '.py', '.js', '.sh', '.c', '.h']
+file_counts = {ext: 0 for ext in interesting_files}
 
-    file_counts = {ext: 0 for ext in interesting_files}
-    file_counts['other'] = 0
-
-    def update_counts(current_name):
-        global file_counts
-        _, ext = os.path.splitext(current_name)
-
-        if ext in file_counts:
-            file_counts[ext] += 1
-        else:
-            file_counts['other'] += 1
-
-    all_paths = set()
+all_paths = set()
 
+try:
     for (dirpath, dirnames, filenames) in os.walk(src_dir):
-
         # Skip some third-party directories
         skippable_dirs = {
             'src/jemalloc',
@@ -103,14 +114,6 @@ try:
         if any(d in dirpath for d in skippable_dirs):
             continue
 
-        def interesting_file(f):
-            if "miniz.c" in f \
-            or "jquery" in f \
-            or "rust_android_dummy" in f:
-                return False
-
-            return any(os.path.splitext(f)[1] == ext for ext in interesting_files)
-
         file_names = [os.path.join(dirpath, f) for f in filenames
                       if interesting_file(f)
                       and not f.endswith("_gen.rs")
@@ -196,10 +199,11 @@ except UnicodeDecodeError as e:
     report_err("UTF-8 decoding error " + str(e))
 
 print
-for ext in file_counts:
-    print "* linted " + str(file_counts[ext]) + " " + ext + " files"
-print "* total lines of code: " + str(count_lines)
-print "* total non-blank lines of code: " + str(count_non_blank_lines)
+for ext in sorted(file_counts, key=file_counts.get, reverse=True):
+    print "* linted {} {} files".format(file_counts[ext], ext)
+print "* linted {} other files".format(count_other_linted_files)
+print "* total lines of code: {}".format(count_lines)
+print "* total non-blank lines of code: {}".format(count_non_blank_lines)
 print
 
 sys.exit(err)
index 5472ba3c7eda118fc60e72af2238aae2dace405b..312076b1b13b2818d43480b32ffea2c96a097ef4 100755 (executable)
@@ -84,8 +84,8 @@ def fetch(f):
         sys.stderr.write("cannot load %s" % f)
         exit(1)
 
-def is_valid_unicode(n):
-    return 0 <= n <= 0xD7FF or 0xE000 <= n <= 0x10FFFF
+def is_surrogate(n):
+    return 0xD800 <= n <= 0xDFFF
 
 def load_unicode_data(f):
     fetch(f)
@@ -96,19 +96,28 @@ def load_unicode_data(f):
     canon_decomp = {}
     compat_decomp = {}
 
+    udict = {};
+    range_start = -1;
     for line in fileinput.input(f):
-        fields = line.split(";")
-        if len(fields) != 15:
+        data = line.split(';');
+        if len(data) != 15:
             continue
-        [code, name, gencat, combine, bidi,
-         decomp, deci, digit, num, mirror,
-         old, iso, upcase, lowcase, titlecase ] = fields
-
-        code_org = code
-        code     = int(code, 16)
-
-        if not is_valid_unicode(code):
+        cp = int(data[0], 16);
+        if is_surrogate(cp):
             continue
+        if range_start >= 0:
+            for i in xrange(range_start, cp):
+                udict[i] = data;
+            range_start = -1;
+        if data[1].endswith(", First>"):
+            range_start = cp;
+            continue;
+        udict[cp] = data;
+
+    for code in udict:
+        [code_org, name, gencat, combine, bidi,
+         decomp, deci, digit, num, mirror,
+         old, iso, upcase, lowcase, titlecase ] = udict[code];
 
         # generate char to char direct common and simple conversions
         # uppercase to lowercase
index 6a6f7e0e9f92cb99627b0fe24cdf71f2e71f8a60..6c3fd186cd423bdea36260cc459fe361602eb0e2 100644 (file)
@@ -152,6 +152,12 @@ extern char *yytext;
 %precedence MOD_SEP
 %precedence RARROW ':'
 
+// In where clauses, "for" should have greater precedence when used as
+// a higher ranked constraint than when used as the beginning of a
+// for_in_type (which is a ty)
+%precedence FORTYPE
+%precedence FOR
+
 // Binops & unops, and their precedences
 %precedence BOX
 %precedence BOXPLACE
@@ -582,6 +588,14 @@ item_impl
 {
   $$ = mk_node("ItemImplNeg", 7, $1, $3, $5, $7, $8, $10, $11);
 }
+| maybe_unsafe IMPL generic_params trait_ref FOR DOTDOT '{' '}'
+{
+  $$ = mk_node("ItemImplDefault", 3, $1, $3, $4);
+}
+| maybe_unsafe IMPL generic_params '!' trait_ref FOR DOTDOT '{' '}'
+{
+  $$ = mk_node("ItemImplDefaultNeg", 3, $1, $3, $4);
+}
 ;
 
 maybe_impl_items
@@ -769,10 +783,14 @@ where_predicates
 ;
 
 where_predicate
-: lifetime ':' bounds    { $$ = mk_node("WherePredicate", 2, $1, $3); }
-| ty ':' ty_param_bounds { $$ = mk_node("WherePredicate", 2, $1, $3); }
+: maybe_for_lifetimes lifetime ':' bounds    { $$ = mk_node("WherePredicate", 3, $1, $2, $4); }
+| maybe_for_lifetimes ty ':' ty_param_bounds { $$ = mk_node("WherePredicate", 3, $1, $2, $4); }
 ;
 
+maybe_for_lifetimes
+: FOR '<' lifetimes '>' { $$ = mk_none(); }
+| %prec FORTYPE %empty  { $$ = mk_none(); }
+
 ty_params
 : ty_param               { $$ = mk_node("TyParams", 1, $1); }
 | ty_params ',' ty_param { $$ = ext_node($1, 1, $3); }
@@ -1024,7 +1042,8 @@ ty_qualified_path_and_generic_values
 }
 | ty_qualified_path ',' ty_sums maybe_bindings
 {
-  $$ = mk_node("GenericValues", 3, mk_none(), ext_node(mk_node("TySums", 1, $1), 1, $3), $4); }
+  $$ = mk_node("GenericValues", 3, mk_none(), mk_node("TySums", 2, $1, $3), $4);
+}
 ;
 
 ty_qualified_path
@@ -1513,31 +1532,35 @@ nonblock_prefix_expr
 ;
 
 expr_qualified_path
-: '<' ty_sum AS trait_ref '>' MOD_SEP ident
+: '<' ty_sum maybe_as_trait_ref '>' MOD_SEP ident
 {
-  $$ = mk_node("ExprQualifiedPath", 3, $2, $4, $7);
+  $$ = mk_node("ExprQualifiedPath", 3, $2, $3, $6);
 }
-| '<' ty_sum AS trait_ref '>' MOD_SEP ident generic_args
+| '<' ty_sum maybe_as_trait_ref '>' MOD_SEP ident generic_args
 {
-  $$ = mk_node("ExprQualifiedPath", 4, $2, $4, $7, $8);
+  $$ = mk_node("ExprQualifiedPath", 4, $2, $3, $6, $7);
 }
-| SHL ty_sum AS trait_ref '>' MOD_SEP ident AS trait_ref '>' MOD_SEP ident
+| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident maybe_as_trait_ref '>' MOD_SEP ident
 {
-  $$ = mk_node("ExprQualifiedPath", 3, mk_node("ExprQualifiedPath", 3, $2, $4, $7), $9, $12);
+  $$ = mk_node("ExprQualifiedPath", 3, mk_node("ExprQualifiedPath", 3, $2, $3, $6), $7, $10);
 }
-| SHL ty_sum AS trait_ref '>' MOD_SEP ident generic_args AS trait_ref '>' MOD_SEP ident
+| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident generic_args maybe_as_trait_ref '>' MOD_SEP ident
 {
-  $$ = mk_node("ExprQualifiedPath", 3, mk_node("ExprQualifiedPath", 4, $2, $4, $7, $8), $10, $13);
+  $$ = mk_node("ExprQualifiedPath", 3, mk_node("ExprQualifiedPath", 4, $2, $3, $6, $7), $8, $11);
 }
-| SHL ty_sum AS trait_ref '>' MOD_SEP ident AS trait_ref '>' MOD_SEP ident generic_args
+| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident maybe_as_trait_ref '>' MOD_SEP ident generic_args
 {
-  $$ = mk_node("ExprQualifiedPath", 4, mk_node("ExprQualifiedPath", 3, $2, $4, $7), $9, $12, $13);
+  $$ = mk_node("ExprQualifiedPath", 4, mk_node("ExprQualifiedPath", 3, $2, $3, $6), $7, $10, $11);
 }
-| SHL ty_sum AS trait_ref '>' MOD_SEP ident generic_args AS trait_ref '>' MOD_SEP ident generic_args
+| SHL ty_sum maybe_as_trait_ref '>' MOD_SEP ident generic_args maybe_as_trait_ref '>' MOD_SEP ident generic_args
 {
-  $$ = mk_node("ExprQualifiedPath", 4, mk_node("ExprQualifiedPath", 4, $2, $4, $7, $8), $10, $13, $14);
+  $$ = mk_node("ExprQualifiedPath", 4, mk_node("ExprQualifiedPath", 4, $2, $3, $6, $7), $8, $11, $12);
 }
 
+maybe_as_trait_ref
+: AS trait_ref { $$ = $2; }
+| %empty       { $$ = mk_none(); }
+;
 
 lambda_expr
 : %prec LAMBDA
index b001609960ca33047e5cbc5a231c1e24b6041d4b..e24a1a025a1f214e40eedafe3b9c7b1d69937922 160000 (submodule)
@@ -1 +1 @@
-Subproject commit b001609960ca33047e5cbc5a231c1e24b6041d4b
+Subproject commit e24a1a025a1f214e40eedafe3b9c7b1d69937922
index 630ca837daac8eb2ca5b75d56a14ba825f316cd3..9351b11010030baed4f8e31a9097fc3b0107ca75 100644 (file)
@@ -42,7 +42,7 @@
 //! }
 //! ```
 //!
-//! This will print `Cons(1i32, Box(Cons(2i32, Box(Nil))))`.
+//! This will print `Cons(1, Box(Cons(2, Box(Nil))))`.
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
index b7bacaa0cae2bf074ba3a311da0a34c7a7b256b9..bb1ff9428a7c01889b89797073a43df8189529bf 100644 (file)
@@ -72,13 +72,13 @@ fn test_show() {
 #[test]
 fn deref() {
     fn homura<T: Deref<Target=i32>>(_: T) { }
-    homura(Box::new(765i32));
+    homura(Box::new(765));
 }
 
 #[test]
 fn raw_sized() {
     unsafe {
-        let x = Box::new(17i32);
+        let x = Box::new(17);
         let p = boxed::into_raw(x);
         assert_eq!(17, *p);
         *p = 19;
index b0490b287ad9a303214f9224be1dc6f9eec574de..7524fb6cf18a65b4effbc2f0585afbab13ab7ecc 100644 (file)
@@ -118,11 +118,11 @@ fn match_words <'a,'b>(a: &'a BitVec, b: &'b BitVec) -> (MatchWords<'a>, MatchWo
 
     // have to uselessly pretend to pad the longer one for type matching
     if a_len < b_len {
-        (a.blocks().enumerate().chain(iter::repeat(0u32).enumerate().take(b_len).skip(a_len)),
-         b.blocks().enumerate().chain(iter::repeat(0u32).enumerate().take(0).skip(0)))
+        (a.blocks().enumerate().chain(iter::repeat(0).enumerate().take(b_len).skip(a_len)),
+         b.blocks().enumerate().chain(iter::repeat(0).enumerate().take(0).skip(0)))
     } else {
-        (a.blocks().enumerate().chain(iter::repeat(0u32).enumerate().take(0).skip(0)),
-         b.blocks().enumerate().chain(iter::repeat(0u32).enumerate().take(a_len).skip(b_len)))
+        (a.blocks().enumerate().chain(iter::repeat(0).enumerate().take(0).skip(0)),
+         b.blocks().enumerate().chain(iter::repeat(0).enumerate().take(a_len).skip(b_len)))
     }
 }
 
@@ -199,7 +199,7 @@ fn blocks_for_bits(bits: usize) -> usize {
 /// Computes the bitmask for the final word of the vector
 fn mask_for_bits(bits: usize) -> u32 {
     // Note especially that a perfect multiple of u32::BITS should mask all 1s.
-    !0u32 >> (u32::BITS as usize - bits % u32::BITS as usize) % u32::BITS as usize
+    !0 >> (u32::BITS as usize - bits % u32::BITS as usize) % u32::BITS as usize
 }
 
 impl BitVec {
@@ -275,7 +275,7 @@ pub fn new() -> BitVec {
     pub fn from_elem(nbits: usize, bit: bool) -> BitVec {
         let nblocks = blocks_for_bits(nbits);
         let mut bit_vec = BitVec {
-            storage: repeat(if bit { !0u32 } else { 0u32 }).take(nblocks).collect(),
+            storage: repeat(if bit { !0 } else { 0 }).take(nblocks).collect(),
             nbits: nbits
         };
         bit_vec.fix_last_block();
@@ -330,7 +330,7 @@ pub fn from_bytes(bytes: &[u8]) -> BitVec {
         }
 
         if extra_bytes > 0 {
-            let mut last_word = 0u32;
+            let mut last_word = 0;
             for (i, &byte) in bytes[complete_words*4..].iter().enumerate() {
                 last_word |= (reverse_bits(byte) as u32) << (i * 8);
             }
@@ -431,7 +431,7 @@ pub fn set(&mut self, i: usize, x: bool) {
     /// ```
     #[inline]
     pub fn set_all(&mut self) {
-        for w in &mut self.storage { *w = !0u32; }
+        for w in &mut self.storage { *w = !0; }
         self.fix_last_block();
     }
 
@@ -566,12 +566,12 @@ pub fn difference(&mut self, other: &BitVec) -> bool {
     /// assert_eq!(bv.all(), false);
     /// ```
     pub fn all(&self) -> bool {
-        let mut last_word = !0u32;
+        let mut last_word = !0;
         // Check that every block but the last is all-ones...
         self.blocks().all(|elem| {
             let tmp = last_word;
             last_word = elem;
-            tmp == !0u32
+            tmp == !0
         // and then check the last one has enough ones
         }) && (last_word == mask_for_bits(self.nbits))
     }
@@ -912,7 +912,7 @@ pub fn is_empty(&self) -> bool { self.len() == 0 }
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn clear(&mut self) {
-        for w in &mut self.storage { *w = 0u32; }
+        for w in &mut self.storage { *w = 0; }
     }
 }
 
@@ -2313,7 +2313,7 @@ fn test_bit_vec_iterator() {
 
         assert_eq!(bit_vec.iter().collect::<Vec<bool>>(), bools);
 
-        let long: Vec<_> = (0i32..10000).map(|i| i % 2 == 0).collect();
+        let long: Vec<_> = (0..10000).map(|i| i % 2 == 0).collect();
         let bit_vec: BitVec = long.iter().map(|n| *n).collect();
         assert_eq!(bit_vec.iter().collect::<Vec<bool>>(), long)
     }
index 5a20ba4b49f0f2bd15d683e32f4fd20fe970a5b7..c88be80679da45f888da4215f7b72757ea680b15 100644 (file)
 //! Some examples of the output from both traits:
 //!
 //! ```
-//! assert_eq!(format!("{} {:?}", 3i32, 4i32), "3 4");
+//! assert_eq!(format!("{} {:?}", 3, 4), "3 4");
 //! assert_eq!(format!("{} {:?}", 'a', 'b'), "a 'b'");
 //! assert_eq!(format!("{} {:?}", "foo\n", "bar\n"), "foo\n \"bar\\n\"");
 //! ```
index 23b256568dae416be84828fbee86873943122925..abcb996e3ede1478ee7498d9917d8b29216b549b 100644 (file)
@@ -2639,7 +2639,7 @@ macro_rules! t {
     #[test]
     fn test_bytes_set_memory() {
         use slice::bytes::MutableByteVector;
-        let mut values = [1u8,2,3,4,5];
+        let mut values = [1,2,3,4,5];
         values[0..5].set_memory(0xAB);
         assert!(values == [0xAB, 0xAB, 0xAB, 0xAB, 0xAB]);
         values[2..4].set_memory(0xFF);
@@ -2809,26 +2809,26 @@ fn test_get_mut() {
     fn test_mut_chunks() {
         use core::iter::ExactSizeIterator;
 
-        let mut v = [0u8, 1, 2, 3, 4, 5, 6];
+        let mut v = [0, 1, 2, 3, 4, 5, 6];
         assert_eq!(v.chunks_mut(2).len(), 4);
         for (i, chunk) in v.chunks_mut(3).enumerate() {
             for x in chunk {
                 *x = i as u8;
             }
         }
-        let result = [0u8, 0, 0, 1, 1, 1, 2];
+        let result = [0, 0, 0, 1, 1, 1, 2];
         assert!(v == result);
     }
 
     #[test]
     fn test_mut_chunks_rev() {
-        let mut v = [0u8, 1, 2, 3, 4, 5, 6];
+        let mut v = [0, 1, 2, 3, 4, 5, 6];
         for (i, chunk) in v.chunks_mut(3).rev().enumerate() {
             for x in chunk {
                 *x = i as u8;
             }
         }
-        let result = [2u8, 2, 2, 1, 1, 1, 0];
+        let result = [2, 2, 2, 1, 1, 1, 0];
         assert!(v == result);
     }
 
index 599b92d05ddd7e21d3337ae2d9045bd1f082d8d4..19c085df2c43d8f5f2bae6a08c09b91742f8bc0c 100644 (file)
 //
 // ignore-lexer-test FIXME #15679
 
-//! Unicode string manipulation (the `str` type).
+//! Unicode string manipulation (the [`str`](../primitive.str.html) type).
 //!
-//! Rust's `str` type is one of the core primitive types of the language. `&str` is the borrowed
-//! string type. This type of string can only be created from other strings, unless it is a static
-//! string (see below). As the word "borrowed" implies, this type of string is owned elsewhere, and
-//! this string cannot be moved out of.
+//! Rust's [`str`](../primitive.str.html) type is one of the core primitive types of the
+//! language. `&str` is the borrowed string type. This type of string can only be created
+//! from other strings, unless it is a `&'static str` (see below). It is not possible to
+//! move out of borrowed strings because they are owned elsewhere.
+//!
+//! Basic operations are implemented directly by the compiler, but more advanced operations are
+//! defined on the [`StrExt`](trait.StrExt.html) trait.
 //!
 //! # Examples
 //!
@@ -383,7 +386,7 @@ macro_rules! utf8_first_byte {
 
 // return the value of $ch updated with continuation byte $byte
 macro_rules! utf8_acc_cont_byte {
-    ($ch:expr, $byte:expr) => (($ch << 6) | ($byte & 63u8) as u32)
+    ($ch:expr, $byte:expr) => (($ch << 6) | ($byte & 63) as u32)
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -2300,8 +2303,8 @@ fn test_rev_iterator() {
 
     #[test]
     fn test_chars_decoding() {
-        let mut bytes = [0u8; 4];
-        for c in (0u32..0x110000).filter_map(|c| ::core::char::from_u32(c)) {
+        let mut bytes = [0; 4];
+        for c in (0..0x110000).filter_map(|c| ::core::char::from_u32(c)) {
             let len = c.encode_utf8(&mut bytes).unwrap_or(0);
             let s = ::core::str::from_utf8(&bytes[..len]).unwrap();
             if Some(c) != s.chars().next() {
@@ -2312,8 +2315,8 @@ fn test_chars_decoding() {
 
     #[test]
     fn test_chars_rev_decoding() {
-        let mut bytes = [0u8; 4];
-        for c in (0u32..0x110000).filter_map(|c| ::core::char::from_u32(c)) {
+        let mut bytes = [0; 4];
+        for c in (0..0x110000).filter_map(|c| ::core::char::from_u32(c)) {
             let len = c.encode_utf8(&mut bytes).unwrap_or(0);
             let s = ::core::str::from_utf8(&bytes[..len]).unwrap();
             if Some(c) != s.chars().rev().next() {
index 33189bd68bdc64782e0798808ac9b3cb945888ec..d6ec8f0d979e0cde74402f03afdcc9dfa10cdb3f 100644 (file)
@@ -153,7 +153,7 @@ pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> Cow<'a, str> {
             }
         }
 
-        const TAG_CONT_U8: u8 = 128u8;
+        const TAG_CONT_U8: u8 = 128;
         const REPLACEMENT: &'static [u8] = b"\xEF\xBF\xBD"; // U+FFFD in UTF-8
         let total = v.len();
         fn unsafe_get(xs: &[u8], i: usize) -> u8 {
@@ -195,14 +195,14 @@ macro_rules! error { () => ({
                 }
             })}
 
-            if byte < 128u8 {
+            if byte < 128 {
                 // subseqidx handles this
             } else {
                 let w = unicode_str::utf8_char_width(byte);
 
                 match w {
                     2 => {
-                        if safe_get(v, i, total) & 192u8 != TAG_CONT_U8 {
+                        if safe_get(v, i, total) & 192 != TAG_CONT_U8 {
                             error!();
                             continue;
                         }
@@ -220,7 +220,7 @@ macro_rules! error { () => ({
                             }
                         }
                         i += 1;
-                        if safe_get(v, i, total) & 192u8 != TAG_CONT_U8 {
+                        if safe_get(v, i, total) & 192 != TAG_CONT_U8 {
                             error!();
                             continue;
                         }
@@ -237,12 +237,12 @@ macro_rules! error { () => ({
                             }
                         }
                         i += 1;
-                        if safe_get(v, i, total) & 192u8 != TAG_CONT_U8 {
+                        if safe_get(v, i, total) & 192 != TAG_CONT_U8 {
                             error!();
                             continue;
                         }
                         i += 1;
-                        if safe_get(v, i, total) & 192u8 != TAG_CONT_U8 {
+                        if safe_get(v, i, total) & 192 != TAG_CONT_U8 {
                             error!();
                             continue;
                         }
@@ -1084,40 +1084,40 @@ fn test_from_utf8_lossy() {
     fn test_from_utf16() {
         let pairs =
             [(String::from_str("𐍅𐌿𐌻𐍆𐌹𐌻𐌰\n"),
-              vec![0xd800_u16, 0xdf45_u16, 0xd800_u16, 0xdf3f_u16,
-                0xd800_u16, 0xdf3b_u16, 0xd800_u16, 0xdf46_u16,
-                0xd800_u16, 0xdf39_u16, 0xd800_u16, 0xdf3b_u16,
-                0xd800_u16, 0xdf30_u16, 0x000a_u16]),
+              vec![0xd800, 0xdf45, 0xd800, 0xdf3f,
+                0xd800, 0xdf3b, 0xd800, 0xdf46,
+                0xd800, 0xdf39, 0xd800, 0xdf3b,
+                0xd800, 0xdf30, 0x000a]),
 
              (String::from_str("𐐒𐑉𐐮𐑀𐐲𐑋 𐐏𐐲𐑍\n"),
-              vec![0xd801_u16, 0xdc12_u16, 0xd801_u16,
-                0xdc49_u16, 0xd801_u16, 0xdc2e_u16, 0xd801_u16,
-                0xdc40_u16, 0xd801_u16, 0xdc32_u16, 0xd801_u16,
-                0xdc4b_u16, 0x0020_u16, 0xd801_u16, 0xdc0f_u16,
-                0xd801_u16, 0xdc32_u16, 0xd801_u16, 0xdc4d_u16,
-                0x000a_u16]),
+              vec![0xd801, 0xdc12, 0xd801,
+                0xdc49, 0xd801, 0xdc2e, 0xd801,
+                0xdc40, 0xd801, 0xdc32, 0xd801,
+                0xdc4b, 0x0020, 0xd801, 0xdc0f,
+                0xd801, 0xdc32, 0xd801, 0xdc4d,
+                0x000a]),
 
              (String::from_str("𐌀𐌖𐌋𐌄𐌑𐌉·𐌌𐌄𐌕𐌄𐌋𐌉𐌑\n"),
-              vec![0xd800_u16, 0xdf00_u16, 0xd800_u16, 0xdf16_u16,
-                0xd800_u16, 0xdf0b_u16, 0xd800_u16, 0xdf04_u16,
-                0xd800_u16, 0xdf11_u16, 0xd800_u16, 0xdf09_u16,
-                0x00b7_u16, 0xd800_u16, 0xdf0c_u16, 0xd800_u16,
-                0xdf04_u16, 0xd800_u16, 0xdf15_u16, 0xd800_u16,
-                0xdf04_u16, 0xd800_u16, 0xdf0b_u16, 0xd800_u16,
-                0xdf09_u16, 0xd800_u16, 0xdf11_u16, 0x000a_u16 ]),
+              vec![0xd800, 0xdf00, 0xd800, 0xdf16,
+                0xd800, 0xdf0b, 0xd800, 0xdf04,
+                0xd800, 0xdf11, 0xd800, 0xdf09,
+                0x00b7, 0xd800, 0xdf0c, 0xd800,
+                0xdf04, 0xd800, 0xdf15, 0xd800,
+                0xdf04, 0xd800, 0xdf0b, 0xd800,
+                0xdf09, 0xd800, 0xdf11, 0x000a ]),
 
              (String::from_str("𐒋𐒘𐒈𐒑𐒛𐒒 𐒕𐒓 𐒈𐒚𐒍 𐒏𐒜𐒒𐒖𐒆 𐒕𐒆\n"),
-              vec![0xd801_u16, 0xdc8b_u16, 0xd801_u16, 0xdc98_u16,
-                0xd801_u16, 0xdc88_u16, 0xd801_u16, 0xdc91_u16,
-                0xd801_u16, 0xdc9b_u16, 0xd801_u16, 0xdc92_u16,
-                0x0020_u16, 0xd801_u16, 0xdc95_u16, 0xd801_u16,
-                0xdc93_u16, 0x0020_u16, 0xd801_u16, 0xdc88_u16,
-                0xd801_u16, 0xdc9a_u16, 0xd801_u16, 0xdc8d_u16,
-                0x0020_u16, 0xd801_u16, 0xdc8f_u16, 0xd801_u16,
-                0xdc9c_u16, 0xd801_u16, 0xdc92_u16, 0xd801_u16,
-                0xdc96_u16, 0xd801_u16, 0xdc86_u16, 0x0020_u16,
-                0xd801_u16, 0xdc95_u16, 0xd801_u16, 0xdc86_u16,
-                0x000a_u16 ]),
+              vec![0xd801, 0xdc8b, 0xd801, 0xdc98,
+                0xd801, 0xdc88, 0xd801, 0xdc91,
+                0xd801, 0xdc9b, 0xd801, 0xdc92,
+                0x0020, 0xd801, 0xdc95, 0xd801,
+                0xdc93, 0x0020, 0xd801, 0xdc88,
+                0xd801, 0xdc9a, 0xd801, 0xdc8d,
+                0x0020, 0xd801, 0xdc8f, 0xd801,
+                0xdc9c, 0xd801, 0xdc92, 0xd801,
+                0xdc96, 0xd801, 0xdc86, 0x0020,
+                0xd801, 0xdc95, 0xd801, 0xdc86,
+                0x000a ]),
              // Issue #12318, even-numbered non-BMP planes
              (String::from_str("\u{20000}"),
               vec![0xD840, 0xDC00])];
@@ -1303,7 +1303,7 @@ fn test_simple_types() {
         assert_eq!(1.to_string(), "1");
         assert_eq!((-1).to_string(), "-1");
         assert_eq!(200.to_string(), "200");
-        assert_eq!(2u8.to_string(), "2");
+        assert_eq!(2.to_string(), "2");
         assert_eq!(true.to_string(), "true");
         assert_eq!(false.to_string(), "false");
         assert_eq!(("hi".to_string()).to_string(), "hi");
@@ -1421,7 +1421,7 @@ fn from_utf8_lossy_invalid(b: &mut Bencher) {
 
     #[bench]
     fn from_utf8_lossy_100_invalid(b: &mut Bencher) {
-        let s = repeat(0xf5u8).take(100).collect::<Vec<_>>();
+        let s = repeat(0xf5).take(100).collect::<Vec<_>>();
         b.iter(|| {
             let _ = String::from_utf8_lossy(&s);
         });
index 8e27ae1cea97039342dceb76b1e04b541d6faa41..973070677d8ee9e9e2fb8e636fa608b6a9764e7d 100644 (file)
 use slice::SliceExt;
 
 // UTF-8 ranges and tags for encoding characters
-const TAG_CONT: u8    = 0b1000_0000u8;
-const TAG_TWO_B: u8   = 0b1100_0000u8;
-const TAG_THREE_B: u8 = 0b1110_0000u8;
-const TAG_FOUR_B: u8  = 0b1111_0000u8;
-const MAX_ONE_B: u32   =     0x80u32;
-const MAX_TWO_B: u32   =    0x800u32;
-const MAX_THREE_B: u32 =  0x10000u32;
+const TAG_CONT: u8    = 0b1000_0000;
+const TAG_TWO_B: u8   = 0b1100_0000;
+const TAG_THREE_B: u8 = 0b1110_0000;
+const TAG_FOUR_B: u8  = 0b1111_0000;
+const MAX_ONE_B: u32   =     0x80;
+const MAX_TWO_B: u32   =    0x800;
+const MAX_THREE_B: u32 =  0x10000;
 
 /*
     Lu  Uppercase_Letter        an uppercase letter
@@ -413,7 +413,7 @@ fn len_utf8(self) -> usize {
     #[stable(feature = "rust1", since = "1.0.0")]
     fn len_utf16(self) -> usize {
         let ch = self as u32;
-        if (ch & 0xFFFF_u32) == ch { 1 } else { 2 }
+        if (ch & 0xFFFF) == ch { 1 } else { 2 }
     }
 
     #[inline]
@@ -444,19 +444,19 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<usize> {
         dst[0] = code as u8;
         Some(1)
     } else if code < MAX_TWO_B && dst.len() >= 2 {
-        dst[0] = (code >> 6 & 0x1F_u32) as u8 | TAG_TWO_B;
-        dst[1] = (code & 0x3F_u32) as u8 | TAG_CONT;
+        dst[0] = (code >> 6 & 0x1F) as u8 | TAG_TWO_B;
+        dst[1] = (code & 0x3F) as u8 | TAG_CONT;
         Some(2)
     } else if code < MAX_THREE_B && dst.len() >= 3  {
-        dst[0] = (code >> 12 & 0x0F_u32) as u8 | TAG_THREE_B;
-        dst[1] = (code >>  6 & 0x3F_u32) as u8 | TAG_CONT;
-        dst[2] = (code & 0x3F_u32) as u8 | TAG_CONT;
+        dst[0] = (code >> 12 & 0x0F) as u8 | TAG_THREE_B;
+        dst[1] = (code >>  6 & 0x3F) as u8 | TAG_CONT;
+        dst[2] = (code & 0x3F) as u8 | TAG_CONT;
         Some(3)
     } else if dst.len() >= 4 {
-        dst[0] = (code >> 18 & 0x07_u32) as u8 | TAG_FOUR_B;
-        dst[1] = (code >> 12 & 0x3F_u32) as u8 | TAG_CONT;
-        dst[2] = (code >>  6 & 0x3F_u32) as u8 | TAG_CONT;
-        dst[3] = (code & 0x3F_u32) as u8 | TAG_CONT;
+        dst[0] = (code >> 18 & 0x07) as u8 | TAG_FOUR_B;
+        dst[1] = (code >> 12 & 0x3F) as u8 | TAG_CONT;
+        dst[2] = (code >>  6 & 0x3F) as u8 | TAG_CONT;
+        dst[3] = (code & 0x3F) as u8 | TAG_CONT;
         Some(4)
     } else {
         None
@@ -472,15 +472,15 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<usize> {
 #[unstable(feature = "core")]
 pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option<usize> {
     // Marked #[inline] to allow llvm optimizing it away
-    if (ch & 0xFFFF_u32) == ch  && dst.len() >= 1 {
+    if (ch & 0xFFFF) == ch  && dst.len() >= 1 {
         // The BMP falls through (assuming non-surrogate, as it should)
         dst[0] = ch as u16;
         Some(1)
     } else if dst.len() >= 2 {
         // Supplementary planes break into surrogates.
-        ch -= 0x1_0000_u32;
-        dst[0] = 0xD800_u16 | ((ch >> 10) as u16);
-        dst[1] = 0xDC00_u16 | ((ch as u16) & 0x3FF_u16);
+        ch -= 0x1_0000;
+        dst[0] = 0xD800 | ((ch >> 10) as u16);
+        dst[1] = 0xDC00 | ((ch as u16) & 0x3FF);
         Some(2)
     } else {
         None
index 2eeb564859cbcd2cf555b93c59d0eaf2d57830a7..0df04c296c8aee771002f1438487a21355aef03e 100644 (file)
@@ -123,13 +123,13 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
     // For an f64 the exponent is in the range of [-1022, 1023] for base 2, so
     // we may have up to that many digits. Give ourselves some extra wiggle room
     // otherwise as well.
-    let mut buf = [0u8; 1536];
+    let mut buf = [0; 1536];
     let mut end = 0;
     let radix_gen: T = cast(radix as int).unwrap();
 
     let (num, exp) = match exp_format {
-        ExpNone => (num, 0i32),
-        ExpDec if num == _0 => (num, 0i32),
+        ExpNone => (num, 0),
+        ExpDec if num == _0 => (num, 0),
         ExpDec => {
             let (exp, exp_base) = match exp_format {
                 ExpDec => (num.abs().log10().floor(), cast::<f64, T>(10.0f64).unwrap()),
index 9544fbaa55b256b65fd48dd58ee682dc14c1386a..e640bf02f5a32adfd11fe3b53d13fab0271a470e 100644 (file)
@@ -565,7 +565,7 @@ fn with_padding<F>(&mut self, padding: usize, default: Alignment,
             Alignment::Center => (padding / 2, (padding + 1) / 2),
         };
 
-        let mut fill = [0u8; 4];
+        let mut fill = [0; 4];
         let len = self.fill.encode_utf8(&mut fill).unwrap_or(0);
         let fill = unsafe { str::from_utf8_unchecked(&fill[..len]) };
 
@@ -689,7 +689,7 @@ fn fmt(&self, f: &mut Formatter) -> Result {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Display for char {
     fn fmt(&self, f: &mut Formatter) -> Result {
-        let mut utf8 = [0u8; 4];
+        let mut utf8 = [0; 4];
         let amt = self.encode_utf8(&mut utf8).unwrap_or(0);
         let s: &str = unsafe { mem::transmute(&utf8[..amt]) };
         Display::fmt(s, f)
index 045442e28ac5dfc57161dc0ec3302054c685139a..b3f2302bb3e0741418ed6ef5be380603b855f9b8 100644 (file)
@@ -38,7 +38,7 @@ fn fmt_int<T: Int>(&self, mut x: T, f: &mut fmt::Formatter) -> fmt::Result {
         // characters for a base 2 number.
         let zero = Int::zero();
         let is_positive = x >= zero;
-        let mut buf = [0u8; 64];
+        let mut buf = [0; 64];
         let mut curr = buf.len();
         let base = cast(self.base()).unwrap();
         if is_positive {
index df0008c500b8e86d94597c81bfe47d0f2d2956dc..bd1516e0cfcc8b49e57334af9a99036b14a5cc4f 100644 (file)
@@ -60,7 +60,7 @@ macro_rules! u8to64_le {
     ($buf:expr, $i:expr, $len:expr) =>
     ({
         let mut t = 0;
-        let mut out = 0u64;
+        let mut out = 0;
         while t < $len {
             out |= ($buf[t+$i] as u64) << t*8;
             t += 1;
index ed129136091250bec2ed7fcca252c3f66d9851be..c6fc8ba5867abd7612a11caff90adbdf662fc158 100644 (file)
@@ -230,7 +230,7 @@ pub struct TyDesc {
     /// use std::mem;
     ///
     /// let v: &[u8] = unsafe { mem::transmute("L") };
-    /// assert!(v == [76u8]);
+    /// assert!(v == [76]);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn transmute<T,U>(e: T) -> U;
index 767828408be868000c79d424d14f4b4260968dcd..16e652fcc9a8aa433227c9fb122f8093c386fa69 100644 (file)
@@ -1149,7 +1149,7 @@ pub trait AdditiveIterator<A> {
     /// ```
     /// use std::iter::AdditiveIterator;
     ///
-    /// let a = [1i32, 2, 3, 4, 5];
+    /// let a = [1, 2, 3, 4, 5];
     /// let mut it = a.iter().cloned();
     /// assert!(it.sum() == 15);
     /// ```
index 94ca9ec37b49b515523e2e6ed713e1df3c6074cb..c2860d435114f64329d48c30daae5224a4c7b4cf 100644 (file)
@@ -100,10 +100,12 @@ macro_rules! assert_eq {
 /// 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
-/// `--cfg ndebug` to the compiler. This makes `debug_assert!` useful for
-/// checks that are too expensive to be present in a release build but may be
-/// helpful during development.
+/// Unlike `assert!`, `debug_assert!` statements are only enabled in non
+/// optimized builds by default. An optimized build will omit all
+/// `debug_assert!` statements unless `-C debug-assertions` is passed to the
+/// compiler. This makes `debug_assert!` useful for checks that are too
+/// expensive to be present in a release build but may be helpful during
+/// development.
 ///
 /// # Example
 ///
@@ -125,7 +127,7 @@ macro_rules! assert_eq {
 #[macro_export]
 #[stable(feature = "rust1", since = "1.0.0")]
 macro_rules! debug_assert {
-    ($($arg:tt)*) => (if cfg!(not(ndebug)) { assert!($($arg)*); })
+    ($($arg:tt)*) => (if cfg!(debug_assertions) { assert!($($arg)*); })
 }
 
 /// Asserts that two expressions are equal to each other, testing equality in
@@ -133,10 +135,12 @@ macro_rules! debug_assert {
 ///
 /// 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!`
-/// useful for checks that are too expensive to be present in a release build
-/// but may be helpful during development.
+/// Unlike `assert_eq!`, `debug_assert_eq!` statements are only enabled in non
+/// optimized builds by default. An optimized build will omit all
+/// `debug_assert_eq!` statements unless `-C debug-assertions` is passed to the
+/// compiler. This makes `debug_assert_eq!` useful for checks that are too
+/// expensive to be present in a release build but may be helpful during
+/// development.
 ///
 /// # Example
 ///
@@ -147,7 +151,7 @@ macro_rules! debug_assert {
 /// ```
 #[macro_export]
 macro_rules! debug_assert_eq {
-    ($($arg:tt)*) => (if cfg!(not(ndebug)) { assert_eq!($($arg)*); })
+    ($($arg:tt)*) => (if cfg!(debug_assertions) { assert_eq!($($arg)*); })
 }
 
 /// Short circuiting evaluation on Err
@@ -227,7 +231,7 @@ macro_rules! writeln {
 ///
 /// ```rust
 /// fn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3
-///     for i in std::iter::count(0_u32, 1) {
+///     for i in std::iter::count(0, 1) {
 ///         if 3*i < i { panic!("u32 overflow"); }
 ///         if x < 3*i { return i-1; }
 ///     }
index 92cdd84160b7ac1672855c2ce8b159c662829610..76edec80896bb400c4a3d154960b1ed5c99cbd92 100644 (file)
@@ -1238,6 +1238,7 @@ pub fn from_f64<A: FromPrimitive>(n: f64) -> Option<A> {
 
 macro_rules! impl_from_primitive {
     ($T:ty, $to_ty:ident) => (
+        #[allow(deprecated)]
         impl FromPrimitive for $T {
             #[inline] fn from_int(n: int) -> Option<$T> { n.$to_ty() }
             #[inline] fn from_i8(n: i8) -> Option<$T> { n.$to_ty() }
@@ -1299,6 +1300,7 @@ macro_rules! impl_num_cast {
     ($T:ty, $conv:ident) => (
         impl NumCast for $T {
             #[inline]
+            #[allow(deprecated)]
             fn from<N: ToPrimitive>(n: N) -> Option<$T> {
                 // `$conv` could be generated using `concat_idents!`, but that
                 // macro seems to be broken at the moment
index c382ac46d5db9895a99241e95d32291f3da1650e..4116d8be9fb5c034dddf16bf96a088c7745870ca 100644 (file)
@@ -913,6 +913,7 @@ macro_rules! shr_impl_all {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait Index<Idx: ?Sized> {
     /// The returned type after indexing
+    #[stable(feature = "rust1", since = "1.0.0")]
     type Output: ?Sized;
 
     /// The method for the indexing (`Foo[Bar]`) operation
index 1ecbd8fae8cdb664b5f9549a358ea6c7cb7b7b01..5343cdaaf088c52aa1631b1b3804c166544b4af1 100644 (file)
@@ -385,7 +385,7 @@ pub fn unwrap_or(self, def: T) -> T {
     /// # Example
     ///
     /// ```
-    /// let k = 10i32;
+    /// let k = 10;
     /// assert_eq!(Some(4).unwrap_or_else(|| 2 * k), 4);
     /// assert_eq!(None.unwrap_or_else(|| 2 * k), 20);
     /// ```
index 4f4164f673b91bd6c27f6829c29e6f62adff63f0..1d4b81512dda8e24213ef74ebf56d8bb965ac6cb 100644 (file)
@@ -1119,9 +1119,9 @@ pub struct CharRange {
 }
 
 /// Mask of the value bits of a continuation byte
-const CONT_MASK: u8 = 0b0011_1111u8;
+const CONT_MASK: u8 = 0b0011_1111;
 /// Value of the tag bits (tag mask is !CONT_MASK) of a continuation byte
-const TAG_CONT_U8: u8 = 0b1000_0000u8;
+const TAG_CONT_U8: u8 = 0b1000_0000;
 
 /*
 Section: Trait implementations
@@ -1568,7 +1568,7 @@ fn is_char_boundary(&self, index: usize) -> bool {
         if index == self.len() { return true; }
         match self.as_bytes().get(index) {
             None => false,
-            Some(&b) => b < 128u8 || b >= 192u8,
+            Some(&b) => b < 128 || b >= 192,
         }
     }
 
@@ -1680,7 +1680,7 @@ fn parse<T: FromStr>(&self) -> Result<T, T::Err> { FromStr::from_str(self) }
 #[inline]
 #[unstable(feature = "core")]
 pub fn char_range_at_raw(bytes: &[u8], i: usize) -> (u32, usize) {
-    if bytes[i] < 128u8 {
+    if bytes[i] < 128 {
         return (bytes[i] as u32, i + 1);
     }
 
index 32dc6440b1326e546c8110da9fbf6ce7b3f7e98c..46d1f7ff3ae095772c7ef0d561224af10afb7ab1 100644 (file)
@@ -165,7 +165,7 @@ fn string(c: char) -> String { c.escape_unicode().collect() }
 #[test]
 fn test_encode_utf8() {
     fn check(input: char, expect: &[u8]) {
-        let mut buf = [0u8; 4];
+        let mut buf = [0; 4];
         let n = input.encode_utf8(&mut buf).unwrap_or(0);
         assert_eq!(&buf[..n], expect);
     }
@@ -179,7 +179,7 @@ fn check(input: char, expect: &[u8]) {
 #[test]
 fn test_encode_utf16() {
     fn check(input: char, expect: &[u16]) {
-        let mut buf = [0u16; 2];
+        let mut buf = [0; 2];
         let n = input.encode_utf16(&mut buf).unwrap_or(0);
         assert_eq!(&buf[..n], expect);
     }
index 3433813e7b5e6dc821205fe656d5b0437df1a3e1..5c11f0196aeb8d7cdf377fe5d44fb573ac5f642d 100644 (file)
@@ -62,10 +62,10 @@ fn hash<T: Hash>(t: &T) -> u64 {
     // FIXME (#18283) Enable test
     //let s: Box<str> = box "a";
     //assert_eq!(hasher.hash(& s), 97 + 0xFF);
-    let cs: &[u8] = &[1u8, 2u8, 3u8];
+    let cs: &[u8] = &[1, 2, 3];
     assert_eq!(hash(& cs), 9);
     // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-    let cs: Box<[u8]> = Box::new([1u8, 2u8, 3u8]);
+    let cs: Box<[u8]> = Box::new([1, 2, 3]);
     assert_eq!(hash(& cs), 9);
 
     // FIXME (#18248) Add tests for hashing Rc<str> and Rc<[T]>
index 248cad32ef4d24c7af645dc16543d783bf9cf682..8289d06d04c61b2541ac73b79e6063e8d50881c7 100644 (file)
@@ -100,8 +100,8 @@ fn test_siphash() {
         [ 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, ]
     ];
 
-    let k0 = 0x_07_06_05_04_03_02_01_00_u64;
-    let k1 = 0x_0f_0e_0d_0c_0b_0a_09_08_u64;
+    let k0 = 0x_07_06_05_04_03_02_01_00;
+    let k1 = 0x_0f_0e_0d_0c_0b_0a_09_08;
     let mut buf = Vec::new();
     let mut t = 0;
     let mut state_inc = SipState::new_with_keys(k0, k1);
@@ -230,8 +230,8 @@ fn test_hash_no_concat_alias() {
     assert!(s != t && t != u);
     assert!(hash(&s) != hash(&t) && hash(&s) != hash(&u));
 
-    let v: (&[u8], &[u8], &[u8]) = (&[1u8], &[0u8, 0], &[0u8]);
-    let w: (&[u8], &[u8], &[u8]) = (&[1u8, 0, 0, 0], &[], &[]);
+    let v: (&[u8], &[u8], &[u8]) = (&[1], &[0, 0], &[0]);
+    let w: (&[u8], &[u8], &[u8]) = (&[1, 0, 0, 0], &[], &[]);
 
     assert!(v != w);
     assert!(hash(&v) != hash(&w));
index b1b10b582e55c5437ba1758ff65d4bbc853e121a..91d1ea2747657efb1d8ae45ee370981354a7f79b 100644 (file)
@@ -778,9 +778,9 @@ fn test_range_step() {
     assert_eq!(range_step(0, 20, 5).collect::<Vec<int>>(), [0, 5, 10, 15]);
     assert_eq!(range_step(20, 0, -5).collect::<Vec<int>>(), [20, 15, 10, 5]);
     assert_eq!(range_step(20, 0, -6).collect::<Vec<int>>(), [20, 14, 8, 2]);
-    assert_eq!(range_step(200u8, 255, 50).collect::<Vec<u8>>(), [200u8, 250]);
-    assert_eq!(range_step(200i, -5, 1).collect::<Vec<int>>(), []);
-    assert_eq!(range_step(200i, 200, 1).collect::<Vec<int>>(), []);
+    assert_eq!(range_step(200, 255, 50).collect::<Vec<u8>>(), [200, 250]);
+    assert_eq!(range_step(200, -5, 1).collect::<Vec<int>>(), []);
+    assert_eq!(range_step(200, 200, 1).collect::<Vec<int>>(), []);
 }
 
 #[test]
@@ -788,7 +788,7 @@ fn test_range_step_inclusive() {
     assert_eq!(range_step_inclusive(0, 20, 5).collect::<Vec<int>>(), [0, 5, 10, 15, 20]);
     assert_eq!(range_step_inclusive(20, 0, -5).collect::<Vec<int>>(), [20, 15, 10, 5, 0]);
     assert_eq!(range_step_inclusive(20, 0, -6).collect::<Vec<int>>(), [20, 14, 8, 2]);
-    assert_eq!(range_step_inclusive(200u8, 255, 50).collect::<Vec<u8>>(), [200u8, 250]);
+    assert_eq!(range_step_inclusive(200, 255, 50).collect::<Vec<u8>>(), [200, 250]);
     assert_eq!(range_step_inclusive(200, -5, 1).collect::<Vec<int>>(), []);
     assert_eq!(range_step_inclusive(200, 200, 1).collect::<Vec<int>>(), [200]);
 }
index 73000670c61aa839e975fb39829b45eb39be2789..bf3e1cf03cbddfb516fe2137b43d44e63d9b89a6 100644 (file)
@@ -103,7 +103,7 @@ impl Foo for int {}
     }
 
     unsafe {
-        assert_eq!([76u8], transmute::<_, Vec<u8>>("L".to_string()));
+        assert_eq!([76], transmute::<_, Vec<u8>>("L".to_string()));
     }
 }
 
index 721354b6a44c24ce8202585b38b7043443f23938..9087b87f640cb77519b19df956e97e8f0cc285ea 100644 (file)
@@ -88,7 +88,7 @@ fn test_from_str_radix_float() {
 
     #[test]
     fn test_int_from_str_overflow() {
-        let mut i8_val: i8 = 127_i8;
+        let mut i8_val: i8 = 127;
         assert_eq!("127".parse::<i8>().ok(), Some(i8_val));
         assert_eq!("128".parse::<i8>().ok(), None);
 
@@ -96,7 +96,7 @@ fn test_int_from_str_overflow() {
         assert_eq!("-128".parse::<i8>().ok(), Some(i8_val));
         assert_eq!("-129".parse::<i8>().ok(), None);
 
-        let mut i16_val: i16 = 32_767_i16;
+        let mut i16_val: i16 = 32_767;
         assert_eq!("32767".parse::<i16>().ok(), Some(i16_val));
         assert_eq!("32768".parse::<i16>().ok(), None);
 
@@ -104,7 +104,7 @@ fn test_int_from_str_overflow() {
         assert_eq!("-32768".parse::<i16>().ok(), Some(i16_val));
         assert_eq!("-32769".parse::<i16>().ok(), None);
 
-        let mut i32_val: i32 = 2_147_483_647_i32;
+        let mut i32_val: i32 = 2_147_483_647;
         assert_eq!("2147483647".parse::<i32>().ok(), Some(i32_val));
         assert_eq!("2147483648".parse::<i32>().ok(), None);
 
@@ -112,7 +112,7 @@ fn test_int_from_str_overflow() {
         assert_eq!("-2147483648".parse::<i32>().ok(), Some(i32_val));
         assert_eq!("-2147483649".parse::<i32>().ok(), None);
 
-        let mut i64_val: i64 = 9_223_372_036_854_775_807_i64;
+        let mut i64_val: i64 = 9_223_372_036_854_775_807;
         assert_eq!("9223372036854775807".parse::<i64>().ok(), Some(i64_val));
         assert_eq!("9223372036854775808".parse::<i64>().ok(), None);
 
index c8a54ef59abda2c0676e72bd196db6090ae220c8..6a25c8be14e5a97e8fde1cc2719180260a405fc6 100644 (file)
@@ -139,12 +139,12 @@ fn test_ptr_addition() {
 fn test_ptr_subtraction() {
     unsafe {
         let xs = vec![0,1,2,3,4,5,6,7,8,9];
-        let mut idx = 9i8;
+        let mut idx = 9;
         let ptr = xs.as_ptr();
 
-        while idx >= 0i8 {
+        while idx >= 0 {
             assert_eq!(*(ptr.offset(idx as int)), idx as int);
-            idx = idx - 1i8;
+            idx = idx - 1;
         }
 
         let mut xs_mut = xs;
index 6b9d6cb0000f2fa5e296af72026caab82c27ddb5..49a062ca3e4bab13f3e866a0d5ea4894f91719df 100644 (file)
@@ -92,8 +92,8 @@
 #![feature(collections)]
 #![feature(int_uint)]
 #![feature(staged_api)]
-#![feature(str_words)]
 #![feature(core)]
+#![feature(str_words)]
 #![cfg_attr(test, feature(rustc_private))]
 
 #[cfg(test)] #[macro_use] extern crate log;
index 42143b06ca0e391678583b6e9cfced390ffa897c..c0b9b67758eeeee09f764a8395c02008dbdfc655 100644 (file)
 
 #![crate_name = "libc"]
 #![crate_type = "rlib"]
-#![cfg_attr(not(feature = "cargo-build"),
-            unstable(feature = "libc"))]
-#![cfg_attr(not(feature = "cargo-build"), feature(staged_api))]
+#![cfg_attr(not(feature = "cargo-build"), unstable(feature = "libc"))]
+#![cfg_attr(not(feature = "cargo-build"), feature(staged_api, core, no_std))]
 #![cfg_attr(not(feature = "cargo-build"), staged_api)]
-#![cfg_attr(not(feature = "cargo-build"), feature(core))]
-#![feature(no_std)]
-#![no_std]
+#![cfg_attr(not(feature = "cargo-build"), no_std)]
 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
        html_root_url = "http://doc.rust-lang.org/nightly/",
@@ -386,7 +383,8 @@ pub mod c99 {
                       target_arch = "mips",
                       target_arch = "mipsel",
                       target_arch = "powerpc",
-                      target_arch = "le32"))]
+                      target_arch = "le32",
+                      all(target_arch = "arm", not(target_os = "android"))))]
             pub mod posix88 {
                 pub type off_t = i32;
                 pub type dev_t = u64;
@@ -398,7 +396,7 @@ pub mod posix88 {
                 pub type mode_t = u32;
                 pub type ssize_t = i32;
             }
-            #[cfg(target_arch = "arm")]
+            #[cfg(all(target_arch = "arm", target_os = "android"))]
             pub mod posix88 {
                 pub type off_t = i32;
                 pub type dev_t = u32;
@@ -412,7 +410,8 @@ pub mod posix88 {
             }
             #[cfg(any(target_arch = "x86",
                       target_arch = "le32",
-                      target_arch = "powerpc"))]
+                      target_arch = "powerpc",
+                      all(target_arch = "arm", not(target_os = "android"))))]
             pub mod posix01 {
                 use types::os::arch::c95::{c_short, c_long, time_t};
                 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
@@ -458,7 +457,7 @@ pub mod posix01 {
                     pub __size: [u32; 9]
                 }
             }
-            #[cfg(target_arch = "arm")]
+            #[cfg(all(target_arch = "arm", target_os = "android"))]
             pub mod posix01 {
                 use types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t};
                 use types::os::arch::c99::{c_longlong, c_ulonglong};
@@ -2203,11 +2202,11 @@ pub mod c95 {
             pub const _IOFBF : c_int = 0;
             pub const _IONBF : c_int = 4;
             pub const _IOLBF : c_int = 64;
-            pub const BUFSIZ : c_uint = 512_u32;
-            pub const FOPEN_MAX : c_uint = 20_u32;
-            pub const FILENAME_MAX : c_uint = 260_u32;
-            pub const L_tmpnam : c_uint = 16_u32;
-            pub const TMP_MAX : c_uint = 32767_u32;
+            pub const BUFSIZ : c_uint = 512;
+            pub const FOPEN_MAX : c_uint = 20;
+            pub const FILENAME_MAX : c_uint = 260;
+            pub const L_tmpnam : c_uint = 16;
+            pub const TMP_MAX : c_uint = 32767;
 
             pub const WSAEINTR: c_int = 10004;
             pub const WSAEBADF: c_int = 10009;
@@ -2584,11 +2583,11 @@ pub mod c95 {
             pub const _IOFBF : c_int = 0;
             pub const _IONBF : c_int = 2;
             pub const _IOLBF : c_int = 1;
-            pub const BUFSIZ : c_uint = 8192_u32;
-            pub const FOPEN_MAX : c_uint = 16_u32;
-            pub const FILENAME_MAX : c_uint = 4096_u32;
-            pub const L_tmpnam : c_uint = 20_u32;
-            pub const TMP_MAX : c_uint = 238328_u32;
+            pub const BUFSIZ : c_uint = 8192;
+            pub const FOPEN_MAX : c_uint = 16;
+            pub const FILENAME_MAX : c_uint = 4096;
+            pub const L_tmpnam : c_uint = 20;
+            pub const TMP_MAX : c_uint = 238328;
         }
         pub mod c99 {
         }
@@ -3450,11 +3449,11 @@ pub mod c95 {
             pub const _IOFBF : c_int = 0;
             pub const _IONBF : c_int = 2;
             pub const _IOLBF : c_int = 1;
-            pub const BUFSIZ : c_uint = 1024_u32;
-            pub const FOPEN_MAX : c_uint = 20_u32;
-            pub const FILENAME_MAX : c_uint = 1024_u32;
-            pub const L_tmpnam : c_uint = 1024_u32;
-            pub const TMP_MAX : c_uint = 308915776_u32;
+            pub const BUFSIZ : c_uint = 1024;
+            pub const FOPEN_MAX : c_uint = 20;
+            pub const FILENAME_MAX : c_uint = 1024;
+            pub const L_tmpnam : c_uint = 1024;
+            pub const TMP_MAX : c_uint = 308915776;
         }
         pub mod c99 {
         }
@@ -3858,11 +3857,11 @@ pub mod c95 {
             pub const _IOFBF : c_int = 0;
             pub const _IONBF : c_int = 2;
             pub const _IOLBF : c_int = 1;
-            pub const BUFSIZ : c_uint = 1024_u32;
-            pub const FOPEN_MAX : c_uint = 20_u32;
-            pub const FILENAME_MAX : c_uint = 1024_u32;
-            pub const L_tmpnam : c_uint = 1024_u32;
-            pub const TMP_MAX : c_uint = 308915776_u32;
+            pub const BUFSIZ : c_uint = 1024;
+            pub const FOPEN_MAX : c_uint = 20;
+            pub const FILENAME_MAX : c_uint = 1024;
+            pub const L_tmpnam : c_uint = 1024;
+            pub const TMP_MAX : c_uint = 308915776;
         }
         pub mod c99 {
         }
@@ -4236,11 +4235,11 @@ pub mod c95 {
             pub const _IOFBF : c_int = 0;
             pub const _IONBF : c_int = 2;
             pub const _IOLBF : c_int = 1;
-            pub const BUFSIZ : c_uint = 1024_u32;
-            pub const FOPEN_MAX : c_uint = 20_u32;
-            pub const FILENAME_MAX : c_uint = 1024_u32;
-            pub const L_tmpnam : c_uint = 1024_u32;
-            pub const TMP_MAX : c_uint = 308915776_u32;
+            pub const BUFSIZ : c_uint = 1024;
+            pub const FOPEN_MAX : c_uint = 20;
+            pub const FILENAME_MAX : c_uint = 1024;
+            pub const L_tmpnam : c_uint = 1024;
+            pub const TMP_MAX : c_uint = 308915776;
         }
         pub mod c99 {
         }
@@ -5002,9 +5001,36 @@ pub mod fcntl {
             use types::os::arch::c95::{c_char, c_int};
             use types::os::arch::posix88::mode_t;
 
+            mod open_shim {
+                extern {
+                    #[cfg(any(target_os = "macos",
+                              target_os = "ios"))]
+                    pub fn open(path: *const ::c_char, oflag: ::c_int, ...)
+                                -> ::c_int;
+
+                    #[cfg(not(any(target_os = "macos",
+                                  target_os = "ios")))]
+                    pub fn open(path: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
+                                -> ::c_int;
+                }
+            }
+
+            #[cfg(any(target_os = "macos",
+                      target_os = "ios"))]
+            #[inline]
+            pub unsafe extern fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
+                use types::os::arch::c95::c_uint;
+                open_shim::open(path, oflag, mode as c_uint)
+            }
+
+            #[cfg(not(any(target_os = "macos",
+                          target_os = "ios")))]
+            #[inline]
+            pub unsafe extern fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
+                open_shim::open(path, oflag, mode)
+            }
+
             extern {
-                pub fn open(path: *const c_char, oflag: c_int, mode: mode_t)
-                            -> c_int;
                 pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
                 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
             }
index 4a9a9bd40600b73d736244b022a68a46cab331fb..f0f861a3831a126efe176495d163f55d486b6cb1 100644 (file)
@@ -157,7 +157,7 @@ macro_rules! info {
 /// ```
 #[macro_export]
 macro_rules! debug {
-    ($($arg:tt)*) => (if cfg!(not(ndebug)) { log!(::log::DEBUG, $($arg)*) })
+    ($($arg:tt)*) => (if cfg!(debug_assertions) { log!(::log::DEBUG, $($arg)*) })
 }
 
 /// A macro to test whether a log level is enabled for the current module.
@@ -192,7 +192,7 @@ macro_rules! debug {
 macro_rules! log_enabled {
     ($lvl:expr) => ({
         let lvl = $lvl;
-        (lvl != ::log::DEBUG || cfg!(not(ndebug))) &&
+        (lvl != ::log::DEBUG || cfg!(debug_assertions)) &&
         lvl <= ::log::log_level() &&
         ::log::mod_enabled(lvl, module_path!())
     })
index 71ace016d6b1691b4ec6c36f171fb681a795960f..d54f183707475632089a14cd933c6ed2fa69a563 100644 (file)
@@ -173,7 +173,7 @@ impl<'a> SeedableRng<&'a [u32]> for ChaChaRng {
 
     fn reseed(&mut self, seed: &'a [u32]) {
         // reset state
-        self.init(&[0u32; KEY_WORDS]);
+        self.init(&[0; KEY_WORDS]);
         // set key in place
         let key = &mut self.state[4 .. 4+KEY_WORDS];
         for (k, s) in key.iter_mut().zip(seed.iter()) {
@@ -245,7 +245,7 @@ fn test_rng_reseed() {
     fn test_rng_true_values() {
         // Test vectors 1 and 2 from
         // http://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04
-        let seed : &[_] = &[0u32; 8];
+        let seed : &[_] = &[0; 8];
         let mut ra: ChaChaRng = SeedableRng::from_seed(seed);
 
         let v = (0..16).map(|_| ra.next_u32()).collect::<Vec<_>>();
@@ -285,7 +285,7 @@ fn test_rng_true_values() {
 
     #[test]
     fn test_rng_clone() {
-        let seed : &[_] = &[0u32; 8];
+        let seed : &[_] = &[0; 8];
         let mut rng: ChaChaRng = SeedableRng::from_seed(seed);
         let mut clone = rng.clone();
         for _ in 0..16 {
index fb73a44c2b94510b096a35ea621e537992fcc0b2..4afc67d63c8f952c4ef4405016cb23a19874d56e 100644 (file)
@@ -23,8 +23,8 @@
 ///
 /// This gives a uniform distribution (assuming the RNG used to sample
 /// it is itself uniform & the `SampleRange` implementation for the
-/// given type is correct), even for edge cases like `low = 0u8`,
-/// `high = 170u8`, for which a naive modulo operation would return
+/// given type is correct), even for edge cases like `low = 0`,
+/// `high = 170`, for which a naive modulo operation would return
 /// numbers less than 85 with double the probability to those greater
 /// than 85.
 ///
index 28f1ea872d7ad4846fbacecdb4cebd3f27ffc161..5532e41028ad2aa6804e788d77465d1c41673d46 100644 (file)
@@ -217,7 +217,7 @@ impl<'a> SeedableRng<&'a [u32]> for IsaacRng {
     fn reseed(&mut self, seed: &'a [u32]) {
         // make the seed into [seed[0], seed[1], ..., seed[seed.len()
         // - 1], 0, 0, ...], to fill rng.rsl.
-        let seed_iter = seed.iter().cloned().chain(repeat(0u32));
+        let seed_iter = seed.iter().cloned().chain(repeat(0));
 
         for (rsl_elem, seed_elem) in self.rsl.iter_mut().zip(seed_iter) {
             *rsl_elem = seed_elem;
@@ -460,7 +460,7 @@ impl<'a> SeedableRng<&'a [u64]> for Isaac64Rng {
     fn reseed(&mut self, seed: &'a [u64]) {
         // make the seed into [seed[0], seed[1], ..., seed[seed.len()
         // - 1], 0, 0, ...], to fill rng.rsl.
-        let seed_iter = seed.iter().cloned().chain(repeat(0u64));
+        let seed_iter = seed.iter().cloned().chain(repeat(0));
 
         for (rsl_elem, seed_elem) in self.rsl.iter_mut().zip(seed_iter) {
             *rsl_elem = seed_elem;
index 3458d519af5cda5b440566c1abf386510094886b..c92f6c5e52db7424d8e122e8a8fe9ea56017d8c8 100644 (file)
@@ -149,7 +149,7 @@ fn next_f64(&mut self) -> f64 {
     /// ```rust
     /// use std::rand::{thread_rng, Rng};
     ///
-    /// let mut v = [0u8; 13579];
+    /// let mut v = [0; 13579];
     /// thread_rng().fill_bytes(&mut v);
     /// println!("{:?}", v.as_slice());
     /// ```
index 0072c555d1412cc1bed6e81ccb3422d037d65853..22b77a759319b8818421ed561e3ab67c41305172 100644 (file)
@@ -215,7 +215,7 @@ fn test_rng_reseed() {
     const FILL_BYTES_V_LEN: uint = 13579;
     #[test]
     fn test_rng_fill_bytes() {
-        let mut v = repeat(0u8).take(FILL_BYTES_V_LEN).collect::<Vec<_>>();
+        let mut v = repeat(0).take(FILL_BYTES_V_LEN).collect::<Vec<_>>();
         ::test::rng().fill_bytes(&mut v);
 
         // Sanity test: if we've gotten here, `fill_bytes` has not infinitely
index 844d097bdafa95f32b2c166ed25ee56e5d2a6306..f0b79640f7d449c3fdbd98f9e9817a86377c8153 100644 (file)
@@ -290,22 +290,22 @@ pub fn tag_at(data: &[u8], start: uint) -> DecodeResult<Res> {
     #[inline(never)]
     fn vuint_at_slow(data: &[u8], start: uint) -> DecodeResult<Res> {
         let a = data[start];
-        if a & 0x80u8 != 0u8 {
-            return Ok(Res {val: (a & 0x7fu8) as uint, next: start + 1});
+        if a & 0x80 != 0 {
+            return Ok(Res {val: (a & 0x7f) as uint, next: start + 1});
         }
-        if a & 0x40u8 != 0u8 {
-            return Ok(Res {val: ((a & 0x3fu8) as uint) << 8 |
+        if a & 0x40 != 0 {
+            return Ok(Res {val: ((a & 0x3f) as uint) << 8 |
                         (data[start + 1] as uint),
                     next: start + 2});
         }
-        if a & 0x20u8 != 0u8 {
-            return Ok(Res {val: ((a & 0x1fu8) as uint) << 16 |
+        if a & 0x20 != 0 {
+            return Ok(Res {val: ((a & 0x1f) as uint) << 16 |
                         (data[start + 1] as uint) << 8 |
                         (data[start + 2] as uint),
                     next: start + 3});
         }
-        if a & 0x10u8 != 0u8 {
-            return Ok(Res {val: ((a & 0x0fu8) as uint) << 24 |
+        if a & 0x10 != 0 {
+            return Ok(Res {val: ((a & 0x0f) as uint) << 24 |
                         (data[start + 1] as uint) << 16 |
                         (data[start + 2] as uint) << 8 |
                         (data[start + 3] as uint),
@@ -877,11 +877,11 @@ fn write_tag<W: Writer>(w: &mut W, n: uint) -> EncodeResult {
 
     fn write_sized_vuint<W: Writer>(w: &mut W, n: uint, size: uint) -> EncodeResult {
         match size {
-            1 => w.write_all(&[0x80u8 | (n as u8)]),
-            2 => w.write_all(&[0x40u8 | ((n >> 8) as u8), n as u8]),
-            3 => w.write_all(&[0x20u8 | ((n >> 16) as u8), (n >> 8) as u8,
+            1 => w.write_all(&[0x80 | (n as u8)]),
+            2 => w.write_all(&[0x40 | ((n >> 8) as u8), n as u8]),
+            3 => w.write_all(&[0x20 | ((n >> 16) as u8), (n >> 8) as u8,
                             n as u8]),
-            4 => w.write_all(&[0x10u8 | ((n >> 24) as u8), (n >> 16) as u8,
+            4 => w.write_all(&[0x10 | ((n >> 24) as u8), (n >> 16) as u8,
                             (n >> 8) as u8, n as u8]),
             _ => Err(old_io::IoError {
                 kind: old_io::OtherIoError,
@@ -930,7 +930,7 @@ pub fn start_tag(&mut self, tag_id: uint) -> EncodeResult {
 
             // Write a placeholder four-byte size.
             self.size_positions.push(try!(self.writer.tell()) as uint);
-            let zeroes: &[u8] = &[0u8, 0u8, 0u8, 0u8];
+            let zeroes: &[u8] = &[0, 0, 0, 0];
             self.writer.write_all(zeroes)
         }
 
@@ -1422,9 +1422,9 @@ mod bench {
 
     #[bench]
     pub fn vuint_at_A_aligned(b: &mut Bencher) {
-        let data = (0i32..4*100).map(|i| {
+        let data = (0..4*100).map(|i| {
             match i % 2 {
-              0 => 0x80u8,
+              0 => 0x80,
               _ => i as u8,
             }
         }).collect::<Vec<_>>();
@@ -1440,9 +1440,9 @@ pub fn vuint_at_A_aligned(b: &mut Bencher) {
 
     #[bench]
     pub fn vuint_at_A_unaligned(b: &mut Bencher) {
-        let data = (0i32..4*100+1).map(|i| {
+        let data = (0..4*100+1).map(|i| {
             match i % 2 {
-              1 => 0x80u8,
+              1 => 0x80,
               _ => i as u8
             }
         }).collect::<Vec<_>>();
@@ -1458,11 +1458,11 @@ pub fn vuint_at_A_unaligned(b: &mut Bencher) {
 
     #[bench]
     pub fn vuint_at_D_aligned(b: &mut Bencher) {
-        let data = (0i32..4*100).map(|i| {
+        let data = (0..4*100).map(|i| {
             match i % 4 {
-              0 => 0x10u8,
+              0 => 0x10,
               3 => i as u8,
-              _ => 0u8
+              _ => 0
             }
         }).collect::<Vec<_>>();
         let mut sum = 0;
@@ -1477,11 +1477,11 @@ pub fn vuint_at_D_aligned(b: &mut Bencher) {
 
     #[bench]
     pub fn vuint_at_D_unaligned(b: &mut Bencher) {
-        let data = (0i32..4*100+1).map(|i| {
+        let data = (0..4*100+1).map(|i| {
             match i % 4 {
-              1 => 0x10u8,
+              1 => 0x10,
               0 => i as u8,
-              _ => 0u8
+              _ => 0
             }
         }).collect::<Vec<_>>();
         let mut sum = 0;
index 2d542eafbe1ae3a2dc27c7b3ada24e462772ba10..027360b31ad462bc5afc8ec5920ec8650d151a57 100644 (file)
@@ -40,8 +40,8 @@
 #![feature(std_misc)]
 #![feature(os)]
 #![feature(path)]
-#![feature(fs)]
 #![feature(io)]
+#![feature(path_ext)]
 #![cfg_attr(test, feature(test))]
 
 extern crate arena;
index a19ccceb0571538ce22375c6d33b219853816e75..515e85410d9fd031767da5a65446b7217daf4e3a 100644 (file)
@@ -542,6 +542,7 @@ pub fn read_exported_macros(&mut self, krate: &ast::Item) -> Vec<ast::MacroDef>
                     // overridden in plugin/load.rs
                     export: false,
                     use_locally: false,
+                    allow_internal_unstable: false,
 
                     body: body,
                 });
index d83470354acb90c24cf5d00fc78259a3bc5c9a1c..8486bf782b00bc1048a34ad6b0020de7be49c3f9 100644 (file)
@@ -354,7 +354,7 @@ pub fn report_load_errs(&mut self) {
             }
         }
         if self.rejected_via_kind.len() > 0 {
-            self.sess.span_help(self.span, "please recompile this crate using \
+            self.sess.fileline_help(self.span, "please recompile this crate using \
                                             --crate-type lib");
             let mismatches = self.rejected_via_kind.iter();
             for (i, &CrateMismatch { ref path, .. }) in mismatches.enumerate() {
index d25dc4f58a5dfa6181472a12ff73c75237c69155..3714e3b8c73da6a7cc4ca9eecb641743c7751388 100644 (file)
@@ -84,7 +84,7 @@ fn visit_item(&mut self, item: &ast::Item) {
                 }
                 "plugin" => {
                     self.sess.span_err(attr.span, "#[plugin] on `extern crate` is deprecated");
-                    self.sess.span_help(attr.span, &format!("use a crate attribute instead, \
+                    self.sess.fileline_help(attr.span, &format!("use a crate attribute instead, \
                                                             i.e. #![plugin({})]",
                                                             item.ident.as_str()));
                 }
@@ -166,6 +166,9 @@ fn load_macros<'b>(&mut self,
                 Some(sel) => sel.contains_key(&name),
             };
             def.export = reexport.contains_key(&name);
+            def.allow_internal_unstable = attr::contains_name(&def.attrs,
+                                                              "allow_internal_unstable");
+            debug!("load_macros: loaded: {:?}", def);
             self.macros.push(def);
         }
 
index f8a2c507e4204edbc0b80e0de2ba390288f7daa6..10885359985069eabaed3869240966c63f3e049c 100644 (file)
@@ -246,7 +246,7 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat)
                                 "pattern binding `{}` is named the same as one \
                                  of the variants of the type `{}`",
                                 &token::get_ident(ident.node), ty_to_string(cx.tcx, pat_ty));
-                            span_help!(cx.tcx.sess, p.span,
+                            fileline_help!(cx.tcx.sess, p.span,
                                 "if you meant to match on a variant, \
                                  consider making the path in the pattern qualified: `{}::{}`",
                                 ty_to_string(cx.tcx, pat_ty), &token::get_ident(ident.node));
index ae43738d471eb8dc8ac833473aa920f9f72544d3..896a0010e7e7f93e5fd789ec571673f34f003b1b 100644 (file)
@@ -537,7 +537,7 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
       ast::ExprBlock(ref block) => {
         match block.expr {
             Some(ref expr) => try!(eval_const_expr_partial(tcx, &**expr, ety)),
-            None => const_int(0i64)
+            None => const_int(0)
         }
       }
       ast::ExprTupField(ref base, index) => {
index da4df813030c3ab504f228b24935a4f1d5b4a79f..a7f5c2c843711b6aec3a2d2a6fec0ae25156ab56 100644 (file)
@@ -444,7 +444,7 @@ fn report_generic_bound_failure(&self,
                 // Does the required lifetime have a nice name we can print?
                 span_err!(self.tcx.sess, origin.span(), E0309,
                     "{} may not live long enough", labeled_user_string);
-                self.tcx.sess.span_help(
+                self.tcx.sess.fileline_help(
                     origin.span(),
                     &format!(
                         "consider adding an explicit lifetime bound `{}: {}`...",
@@ -456,7 +456,7 @@ fn report_generic_bound_failure(&self,
                 // Does the required lifetime have a nice name we can print?
                 span_err!(self.tcx.sess, origin.span(), E0310,
                     "{} may not live long enough", labeled_user_string);
-                self.tcx.sess.span_help(
+                self.tcx.sess.fileline_help(
                     origin.span(),
                     &format!(
                         "consider adding an explicit lifetime bound `{}: 'static`...",
@@ -468,7 +468,7 @@ fn report_generic_bound_failure(&self,
                 span_err!(self.tcx.sess, origin.span(), E0311,
                         "{} may not live long enough",
                         labeled_user_string);
-                self.tcx.sess.span_help(
+                self.tcx.sess.fileline_help(
                     origin.span(),
                     &format!(
                         "consider adding an explicit lifetime bound for `{}`",
index ddac6cc75143ba85ab176ab3a5d89b013f2884c0..3599ba5a0f779a4c2eb2f5ff0bd5a604ab65f017 100644 (file)
@@ -362,8 +362,6 @@ pub fn check_item(tcx: &ty::ctxt, item: &ast::Item, warn_about_defns: bool,
 /// Helper for discovering nodes to check for stability
 pub fn check_expr(tcx: &ty::ctxt, e: &ast::Expr,
                   cb: &mut FnMut(ast::DefId, Span, &Option<Stability>)) {
-    if is_internal(tcx, e.span) { return; }
-
     let span;
     let id = match e.node {
         ast::ExprMethodCall(i, _, _) => {
@@ -527,12 +525,13 @@ pub fn check_pat(tcx: &ty::ctxt, pat: &ast::Pat,
 fn maybe_do_stability_check(tcx: &ty::ctxt, id: ast::DefId, span: Span,
                             cb: &mut FnMut(ast::DefId, Span, &Option<Stability>)) {
     if !is_staged_api(tcx, id) { return  }
+    if is_internal(tcx, span) { return }
     let ref stability = lookup(tcx, id);
     cb(id, span, stability);
 }
 
 fn is_internal(tcx: &ty::ctxt, span: Span) -> bool {
-    tcx.sess.codemap().span_is_internal(span)
+    tcx.sess.codemap().span_allows_unstable(span)
 }
 
 fn is_staged_api(tcx: &ty::ctxt, id: DefId) -> bool {
index 6f98b79e782c0bcd7841427fd7a0bd795fcb9e01..78f7b3b91ddf74d5c9935466183229933fd87dda 100644 (file)
@@ -81,8 +81,12 @@ pub fn args<'b>(&'b self) -> &'b Vec<P<ast::MetaItem>> {
     /// This is the most general hook into `libsyntax`'s expansion behavior.
     pub fn register_syntax_extension(&mut self, name: ast::Name, extension: SyntaxExtension) {
         self.syntax_exts.push((name, match extension {
-            NormalTT(ext, _) => NormalTT(ext, Some(self.krate_span)),
-            IdentTT(ext, _) => IdentTT(ext, Some(self.krate_span)),
+            NormalTT(ext, _, allow_internal_unstable) => {
+                NormalTT(ext, Some(self.krate_span), allow_internal_unstable)
+            }
+            IdentTT(ext, _, allow_internal_unstable) => {
+                IdentTT(ext, Some(self.krate_span), allow_internal_unstable)
+            }
             Decorator(ext) => Decorator(ext),
             Modifier(ext) => Modifier(ext),
             MultiModifier(ext) => MultiModifier(ext),
@@ -99,7 +103,8 @@ pub fn register_syntax_extension(&mut self, name: ast::Name, extension: SyntaxEx
     /// It builds for you a `NormalTT` that calls `expander`,
     /// and also takes care of interning the macro's name.
     pub fn register_macro(&mut self, name: &str, expander: MacroExpanderFn) {
-        self.register_syntax_extension(token::intern(name), NormalTT(Box::new(expander), None));
+        self.register_syntax_extension(token::intern(name),
+                                       NormalTT(Box::new(expander), None, false));
     }
 
     /// Register a compiler lint pass.
index a4355803f4a4e3bd79fd3f6223be46b1a8a0f664..1b09be050203bd82b894d0e981b43f5417a0f524 100644 (file)
@@ -81,6 +81,7 @@ pub struct Options {
 
     pub gc: bool,
     pub optimize: OptLevel,
+    pub debug_assertions: bool,
     pub debuginfo: DebugInfoLevel,
     pub lint_opts: Vec<(String, lint::Level)>,
     pub describe_lints: bool,
@@ -238,7 +239,8 @@ pub fn basic_options() -> Options {
         crate_name: None,
         alt_std_name: None,
         libs: Vec::new(),
-        unstable_features: UnstableFeatures::Disallow
+        unstable_features: UnstableFeatures::Disallow,
+        debug_assertions: true,
     }
 }
 
@@ -528,6 +530,8 @@ fn parse_passes(slot: &mut Passes, v: Option<&str>) -> bool {
          2 = full debug info with variable and type information"),
     opt_level: Option<uint> = (None, parse_opt_uint,
         "Optimize with possible levels 0-3"),
+    debug_assertions: Option<bool> = (None, parse_opt_bool,
+        "explicitly enable the cfg(debug_assertions) directive"),
 }
 
 
@@ -621,7 +625,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
     };
 
     let mk = attr::mk_name_value_item_str;
-    return vec!(// Target bindings.
+    let mut ret = vec![ // Target bindings.
          attr::mk_word_item(fam.clone()),
          mk(InternedString::new("target_os"), intern(os)),
          mk(InternedString::new("target_family"), fam),
@@ -629,7 +633,11 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
          mk(InternedString::new("target_endian"), intern(end)),
          mk(InternedString::new("target_pointer_width"),
             intern(wordsz))
-    );
+    ];
+    if sess.opts.debug_assertions {
+        ret.push(attr::mk_word_item(InternedString::new("debug_assertions")));
+    }
+    return ret;
 }
 
 pub fn append_configuration(cfg: &mut ast::CrateConfig,
@@ -923,6 +931,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
             }
         }
     };
+    let debug_assertions = cg.debug_assertions.unwrap_or(opt_level == No);
     let gc = debugging_opts.gc;
     let debuginfo = if matches.opt_present("g") {
         if cg.debuginfo.is_some() {
@@ -1064,6 +1073,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
         alt_std_name: None,
         libs: libs,
         unstable_features: get_unstable_features_setting(),
+        debug_assertions: debug_assertions,
     }
 }
 
index 10a7b2abea80bb389e3213ec3895b27661ded2d8..d3b9b07ea416970daecfaab42dec9f9cf22de738 100644 (file)
@@ -45,7 +45,7 @@ pub fn lev_distance(me: &str, t: &str) -> uint {
 fn test_lev_distance() {
     use std::char::{ from_u32, MAX };
     // Test bytelength agnosticity
-    for c in (0u32..MAX as u32)
+    for c in (0..MAX as u32)
              .filter_map(|i| from_u32(i))
              .map(|i| i.to_string()) {
         assert_eq!(lev_distance(&c[..], &c[..]), 0);
index a6994387f8d6a27234eae257afe7106f182b0a00..ed44bf8952951ae6363d04bed52eb3c2a9d1f83f 100644 (file)
@@ -11,7 +11,7 @@
 //! A helper class for dealing with static archives
 
 use std::env;
-use std::fs::{self, TempDir};
+use std::fs;
 use std::io::prelude::*;
 use std::io;
 use std::path::{Path, PathBuf};
@@ -19,6 +19,8 @@
 use std::str;
 use syntax::diagnostic::Handler as ErrorHandler;
 
+use tempdir::TempDir;
+
 pub const METADATA_FILENAME: &'static str = "rust.metadata.bin";
 
 pub struct ArchiveConfig<'a> {
index 2b028a5c626234f63381d38f1672f01c14a9a72f..a7ae9661c3d8329a57585854cf946ad6c08297b1 100644 (file)
@@ -34,7 +34,6 @@
 #![feature(collections)]
 #![feature(core)]
 #![feature(old_fs)]
-#![feature(fs)]
 #![feature(hash)]
 #![feature(int_uint)]
 #![feature(io)]
@@ -44,7 +43,8 @@
 #![feature(path)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
-#![feature(tempdir)]
+#![feature(rand)]
+#![feature(path_ext)]
 
 extern crate syntax;
 extern crate serialize;
@@ -52,6 +52,7 @@
 
 pub mod abi;
 pub mod archive;
+pub mod tempdir;
 pub mod arm;
 pub mod fs;
 pub mod mips;
index 844920ad5ece1a8d7ec7731df38714ee054eebfd..482c710149c0920a3d5ce7103ff955dbf8504cfd 100644 (file)
@@ -119,7 +119,7 @@ impl FixedBuffer64 {
     /// Create a new FixedBuffer64
     fn new() -> FixedBuffer64 {
         return FixedBuffer64 {
-            buffer: [0u8; 64],
+            buffer: [0; 64],
             buffer_idx: 0
         };
     }
@@ -258,7 +258,7 @@ fn input_str(&mut self, input: &str) {
     /// Convenience function that retrieves the result of a digest as a
     /// newly allocated vec of bytes.
     fn result_bytes(&mut self) -> Vec<u8> {
-        let mut buf: Vec<u8> = repeat(0u8).take((self.output_bits()+7)/8).collect();
+        let mut buf: Vec<u8> = repeat(0).take((self.output_bits()+7)/8).collect();
         self.result(&mut buf);
         buf
     }
@@ -342,7 +342,7 @@ fn sigma1(x: u32) -> u32 {
         let mut g = self.h6;
         let mut h = self.h7;
 
-        let mut w = [0u32; 64];
+        let mut w = [0; 64];
 
         // Sha-512 and Sha-256 use basically the same calculations which are implemented
         // by these macros. Inlining the calculations seems to result in better generated code.
@@ -660,7 +660,7 @@ mod bench {
     #[bench]
     pub fn sha256_10(b: &mut Bencher) {
         let mut sh = Sha256::new();
-        let bytes = [1u8; 10];
+        let bytes = [1; 10];
         b.iter(|| {
             sh.input(&bytes);
         });
@@ -670,7 +670,7 @@ pub fn sha256_10(b: &mut Bencher) {
     #[bench]
     pub fn sha256_1k(b: &mut Bencher) {
         let mut sh = Sha256::new();
-        let bytes = [1u8; 1024];
+        let bytes = [1; 1024];
         b.iter(|| {
             sh.input(&bytes);
         });
@@ -680,7 +680,7 @@ pub fn sha256_1k(b: &mut Bencher) {
     #[bench]
     pub fn sha256_64k(b: &mut Bencher) {
         let mut sh = Sha256::new();
-        let bytes = [1u8; 65536];
+        let bytes = [1; 65536];
         b.iter(|| {
             sh.input(&bytes);
         });
index 904b337c03f46e63e664126f01cc470d457c013a..2fbbe7d1f7c5ea60e7865617f78a5ecc8898e4da 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::old_io::{Command, IoError, OtherIoError};
+use std::io;
+use std::process::Command;
 use target::TargetOptions;
 
 use self::Arch::*;
@@ -40,16 +41,15 @@ pub fn get_sdk_root(sdk_name: &str) -> String {
                       .arg("--show-sdk-path")
                       .arg("-sdk")
                       .arg(sdk_name)
-                      .spawn()
-                      .and_then(|c| c.wait_with_output())
+                      .output()
                       .and_then(|output| {
                           if output.status.success() {
-                              Ok(String::from_utf8(output.output).unwrap())
+                              Ok(String::from_utf8(output.stdout).unwrap())
                           } else {
-                              Err(IoError {
-                                  kind: OtherIoError,
-                                  desc: "process exit with error",
-                                  detail: String::from_utf8(output.error).ok()})
+                              let error = String::from_utf8(output.stderr);
+                              Err(io::Error::new(io::ErrorKind::Other,
+                                                 "process exit with error",
+                                                 error.ok()))
                           }
                       });
 
diff --git a/src/librustc_back/tempdir.rs b/src/librustc_back/tempdir.rs
new file mode 100644 (file)
index 0000000..4d8619a
--- /dev/null
@@ -0,0 +1,121 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::env;
+use std::io::{self, Error, ErrorKind};
+use std::fs;
+use std::path::{self, PathBuf, AsPath};
+use std::rand::{thread_rng, Rng};
+
+/// A wrapper for a path to temporary directory implementing automatic
+/// scope-based deletion.
+pub struct TempDir {
+    path: Option<PathBuf>,
+}
+
+// How many times should we (re)try finding an unused random name? It should be
+// enough that an attacker will run out of luck before we run out of patience.
+const NUM_RETRIES: u32 = 1 << 31;
+// How many characters should we include in a random file name? It needs to
+// be enough to dissuade an attacker from trying to preemptively create names
+// of that length, but not so huge that we unnecessarily drain the random number
+// generator of entropy.
+const NUM_RAND_CHARS: uint = 12;
+
+impl TempDir {
+    /// Attempts to make a temporary directory inside of `tmpdir` whose name
+    /// will have the prefix `prefix`. The directory will be automatically
+    /// deleted once the returned wrapper is destroyed.
+    ///
+    /// If no directory can be created, `Err` is returned.
+    #[allow(deprecated)] // rand usage
+    pub fn new_in<P: AsPath + ?Sized>(tmpdir: &P, prefix: &str)
+                                      -> io::Result<TempDir> {
+        let storage;
+        let mut tmpdir = tmpdir.as_path();
+        if !tmpdir.is_absolute() {
+            let cur_dir = try!(env::current_dir());
+            storage = cur_dir.join(tmpdir);
+            tmpdir = &storage;
+            // return TempDir::new_in(&cur_dir.join(tmpdir), prefix);
+        }
+
+        let mut rng = thread_rng();
+        for _ in 0..NUM_RETRIES {
+            let suffix: String = rng.gen_ascii_chars().take(NUM_RAND_CHARS).collect();
+            let leaf = if prefix.len() > 0 {
+                format!("{}.{}", prefix, suffix)
+            } else {
+                // If we're given an empty string for a prefix, then creating a
+                // directory starting with "." would lead to it being
+                // semi-invisible on some systems.
+                suffix
+            };
+            let path = tmpdir.join(&leaf);
+            match fs::create_dir(&path) {
+                Ok(_) => return Ok(TempDir { path: Some(path) }),
+                Err(ref e) if e.kind() == ErrorKind::PathAlreadyExists => {}
+                Err(e) => return Err(e)
+            }
+        }
+
+        Err(Error::new(ErrorKind::PathAlreadyExists,
+                       "too many temporary directories already exist",
+                       None))
+    }
+
+    /// Attempts to make a temporary directory inside of `env::temp_dir()` whose
+    /// name will have the prefix `prefix`. The directory will be automatically
+    /// deleted once the returned wrapper is destroyed.
+    ///
+    /// If no directory can be created, `Err` is returned.
+    #[allow(deprecated)]
+    pub fn new(prefix: &str) -> io::Result<TempDir> {
+        TempDir::new_in(&env::temp_dir(), prefix)
+    }
+
+    /// Unwrap the wrapped `std::path::Path` from the `TempDir` wrapper.
+    /// This discards the wrapper so that the automatic deletion of the
+    /// temporary directory is prevented.
+    pub fn into_path(mut self) -> PathBuf {
+        self.path.take().unwrap()
+    }
+
+    /// Access the wrapped `std::path::Path` to the temporary directory.
+    pub fn path(&self) -> &path::Path {
+        self.path.as_ref().unwrap()
+    }
+
+    /// Close and remove the temporary directory
+    ///
+    /// Although `TempDir` removes the directory on drop, in the destructor
+    /// any errors are ignored. To detect errors cleaning up the temporary
+    /// directory, call `close` instead.
+    pub fn close(mut self) -> io::Result<()> {
+        self.cleanup_dir()
+    }
+
+    fn cleanup_dir(&mut self) -> io::Result<()> {
+        match self.path {
+            Some(ref p) => fs::remove_dir_all(p),
+            None => Ok(())
+        }
+    }
+}
+
+impl Drop for TempDir {
+    fn drop(&mut self) {
+        let _ = self.cleanup_dir();
+    }
+}
+
+// the tests for this module need to change the path using change_dir,
+// and this doesn't play nicely with other tests so these unit tests are located
+// in src/test/run-pass/tempfile.rs
index 370a5d48decaec85298da73575468e6a98efb5f0..2199beb7a20126fdc0fb5e341dd44d0c9ae3cbe7 100644 (file)
@@ -316,7 +316,7 @@ mod tests {
 
     bitflags! {
         flags AnotherSetOfFlags: i8 {
-            const AnotherFlag = -1_i8,
+            const AnotherFlag = -1,
         }
     }
 
@@ -327,7 +327,7 @@ fn test_bits(){
         assert_eq!(FlagABC.bits(), 0b00000111);
 
         assert_eq!(AnotherSetOfFlags::empty().bits(), 0b00);
-        assert_eq!(AnotherFlag.bits(), !0_i8);
+        assert_eq!(AnotherFlag.bits(), !0);
     }
 
     #[test]
@@ -338,7 +338,7 @@ fn test_from_bits() {
         assert!(Flags::from_bits(0b11) == Some(FlagA | FlagB));
         assert!(Flags::from_bits(0b1000) == None);
 
-        assert!(AnotherSetOfFlags::from_bits(!0_i8) == Some(AnotherFlag));
+        assert!(AnotherSetOfFlags::from_bits(!0) == Some(AnotherFlag));
     }
 
     #[test]
@@ -350,7 +350,7 @@ fn test_from_bits_truncate() {
         assert!(Flags::from_bits_truncate(0b1000) == Flags::empty());
         assert!(Flags::from_bits_truncate(0b1001) == FlagA);
 
-        assert!(AnotherSetOfFlags::from_bits_truncate(0_i8) == AnotherSetOfFlags::empty());
+        assert!(AnotherSetOfFlags::from_bits_truncate(0) == AnotherSetOfFlags::empty());
     }
 
     #[test]
index 53761eb14713def82f45a671a5a2dc45a3f6daab..84636ebaae42b608d7ce09f161bfbb5574d7e075 100644 (file)
@@ -165,7 +165,7 @@ fn note_move_destination(bccx: &BorrowckCtxt,
         bccx.span_note(
             move_to_span,
             "attempting to move value to here");
-        bccx.span_help(
+        bccx.fileline_help(
             move_to_span,
             &format!("to prevent the move, \
                      use `ref {0}` or `ref mut {0}` to capture value by \
index f6df2acce597b4c52d699fbe966f822ea2a9bdbd..42b3555b54edef926dc7d2aadddd436630c4aa9a 100644 (file)
@@ -643,7 +643,7 @@ pub fn report_use_of_moved_value<'b>(&self,
                             ol,
                             moved_lp_msg,
                             pat_ty.user_string(self.tcx)));
-                self.tcx.sess.span_help(span,
+                self.tcx.sess.fileline_help(span,
                     "use `ref` to override");
             }
 
@@ -675,7 +675,7 @@ pub fn report_use_of_moved_value<'b>(&self,
                             moved_lp_msg,
                             expr_ty.user_string(self.tcx),
                             suggestion));
-                self.tcx.sess.span_help(expr_span, help);
+                self.tcx.sess.fileline_help(expr_span, help);
             }
         }
 
@@ -741,6 +741,10 @@ pub fn span_help(&self, s: Span, m: &str) {
         self.tcx.sess.span_help(s, m);
     }
 
+    pub fn fileline_help(&self, s: Span, m: &str) {
+        self.tcx.sess.fileline_help(s, m);
+    }
+
     pub fn bckerr_to_string(&self, err: &BckError<'tcx>) -> String {
         match err.code {
             err_mutbl => {
@@ -870,7 +874,7 @@ pub fn report_aliasability_violation(&self,
         }
 
         if is_closure {
-            self.tcx.sess.span_help(
+            self.tcx.sess.fileline_help(
                 span,
                 "closures behind references must be called via `&mut`");
         }
index 73682faf1a77b3ffccac90846ca5da07e52cea20..565782b29e97126041f7d8894437646a42d88698 100644 (file)
@@ -493,12 +493,16 @@ pub fn phase_2_configure_and_expand(sess: &Session,
         }
     );
 
-    // Needs to go *after* expansion to be able to check the results of macro expansion.
-    time(time_passes, "complete gated feature checking", (), |_| {
+    // Needs to go *after* expansion to be able to check the results
+    // of macro expansion.  This runs before #[cfg] to try to catch as
+    // much as possible (e.g. help the programmer avoid platform
+    // specific differences)
+    time(time_passes, "complete gated feature checking 1", (), |_| {
         let features =
             syntax::feature_gate::check_crate(sess.codemap(),
-                                          &sess.parse_sess.span_diagnostic,
-                                          &krate);
+                                              &sess.parse_sess.span_diagnostic,
+                                              &krate,
+                                              true);
         *sess.features.borrow_mut() = features;
         sess.abort_if_errors();
     });
@@ -521,6 +525,19 @@ pub fn phase_2_configure_and_expand(sess: &Session,
     time(time_passes, "checking that all macro invocations are gone", &krate, |krate|
          syntax::ext::expand::check_for_macros(&sess.parse_sess, krate));
 
+    // One final feature gating of the true AST that gets compiled
+    // later, to make sure we've got everything (e.g. configuration
+    // can insert new attributes via `cfg_attr`)
+    time(time_passes, "complete gated feature checking 2", (), |_| {
+        let features =
+            syntax::feature_gate::check_crate(sess.codemap(),
+                                              &sess.parse_sess.span_diagnostic,
+                                              &krate,
+                                              false);
+        *sess.features.borrow_mut() = features;
+        sess.abort_if_errors();
+    });
+
     Some(krate)
 }
 
@@ -797,7 +814,9 @@ fn write_out_deps(sess: &Session,
         // Build a list of files used to compile the output and
         // write Makefile-compatible dependency rules
         let files: Vec<String> = sess.codemap().files.borrow()
-                                   .iter().filter(|fmap| fmap.is_real_file())
+                                   .iter()
+                                   .filter(|fmap| fmap.is_real_file())
+                                   .filter(|fmap| !fmap.is_imported())
                                    .map(|fmap| escape_dep_filename(&fmap.name))
                                    .collect();
         let mut file = try!(fs::File::create(&deps_filename));
index aa8b7c7785d204b6c61b64a3d22b4396d885229c..3743b7d9c7d9f8a96ad21b1d187f07331435ed35 100644 (file)
@@ -39,7 +39,6 @@
 #![feature(exit_status)]
 #![feature(path)]
 #![feature(io)]
-#![feature(fs)]
 
 extern crate arena;
 extern crate flate;
@@ -775,6 +774,7 @@ fn parse_crate_attrs(sess: &Session, input: &Input) ->
 ///
 /// The diagnostic emitter yielded to the procedure should be used for reporting
 /// errors of the compiler.
+#[allow(deprecated)]
 pub fn monitor<F:FnOnce()+Send+'static>(f: F) {
     const STACK_SIZE: uint = 8 * 1024 * 1024; // 8MB
 
index 3682fdb74b74f6103fec44006541169bd4d833f4..1eea52fe1bb205ce05c6b433fd82baecd90bfee4 100644 (file)
@@ -1921,7 +1921,8 @@ fn check_fn(&mut self, cx: &Context, fn_kind: visit::FnKind, _: &ast::FnDecl,
                 for call in &self_call_spans {
                     sess.span_note(*call, "recursive call site")
                 }
-                sess.span_help(sp, "a `loop` may express intention better if this is on purpose")
+                sess.fileline_help(sp, "a `loop` may express intention \
+                                        better if this is on purpose")
             }
         }
 
index 78ce9abe07d92495d9e646a2ae0122845b24231f..0ddfd707f0089391eb1c0b93a9672a7500e17100 100644 (file)
@@ -4115,10 +4115,14 @@ fn resolve_expr(&mut self, expr: &Expr) {
                                           uses it like a function name",
                                          path_name));
 
-                        self.session.span_help(expr.span,
-                            &format!("Did you mean to write: \
-                                     `{} {{ /* fields */ }}`?",
-                                     path_name));
+                        let msg = format!("Did you mean to write: \
+                                           `{} {{ /* fields */ }}`?",
+                                          path_name);
+                        if self.emit_errors {
+                            self.session.fileline_help(expr.span, &msg);
+                        } else {
+                            self.session.span_help(expr.span, &msg);
+                        }
                     } else {
                         // Write the result into the def map.
                         debug!("(resolving expr) resolved `{}`",
@@ -4146,18 +4150,21 @@ fn resolve_expr(&mut self, expr: &Expr) {
                     match type_res.map(|r| r.base_def) {
                         Some(DefTy(struct_id, _))
                             if self.structs.contains_key(&struct_id) => {
-                            self.resolve_error(expr.span,
+                                self.resolve_error(expr.span,
                                     &format!("`{}` is a structure name, but \
                                                 this expression \
                                                 uses it like a function name",
                                                 path_name));
 
-                            self.session.span_help(expr.span,
-                                &format!("Did you mean to write: \
-                                            `{} {{ /* fields */ }}`?",
-                                            path_name));
-
-                        }
+                                let msg = format!("Did you mean to write: \
+                                                     `{} {{ /* fields */ }}`?",
+                                                    path_name);
+                                if self.emit_errors {
+                                    self.session.fileline_help(expr.span, &msg);
+                                } else {
+                                    self.session.span_help(expr.span, &msg);
+                                }
+                            }
                         _ => {
                             // Keep reporting some errors even if they're ignored above.
                             self.resolve_path(expr.id, path, 0, ValueNS, true);
index 1e84bc4b8e0bb197d8b2ae7cc0989c3829743a78..f353c69eca299b389384a95bab37605db61b74bf 100644 (file)
 use util::common::time;
 use util::ppaux;
 use util::sha2::{Digest, Sha256};
+use rustc_back::tempdir::TempDir;
 
 use std::ffi::{AsOsStr, OsString};
-use std::fs::{self, TempDir, PathExt};
+use std::fs::{self, PathExt};
 use std::io::{self, Read, Write};
 use std::mem;
 use std::path::{Path, PathBuf};
index dcc79e90cc5722556f44c2bc140e363a1c53a581..7cdd1d0a456cc735eb536643980f6b42250776c2 100644 (file)
 #![feature(std_misc)]
 #![feature(unicode)]
 #![feature(io)]
-#![feature(fs)]
 #![feature(path)]
 #![feature(os)]
-#![feature(tempdir)]
+#![feature(path_ext)]
+#![feature(fs)]
 
 extern crate arena;
 extern crate flate;
index 13f882bc36318c79d895c651c043158505afdb6b..f49905613d24cbd2a241880971d395022b2dd4a8 100644 (file)
@@ -833,11 +833,11 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>(
 
     let (is_zero, is_signed) = match rhs_t.sty {
         ty::ty_int(t) => {
-            let zero = C_integral(Type::int_from_ty(cx.ccx(), t), 0u64, false);
+            let zero = C_integral(Type::int_from_ty(cx.ccx(), t), 0, false);
             (ICmp(cx, llvm::IntEQ, rhs, zero, debug_loc), true)
         }
         ty::ty_uint(t) => {
-            let zero = C_integral(Type::uint_from_ty(cx.ccx(), t), 0u64, false);
+            let zero = C_integral(Type::uint_from_ty(cx.ccx(), t), 0, false);
             (ICmp(cx, llvm::IntEQ, rhs, zero, debug_loc), false)
         }
         _ => {
@@ -3089,7 +3089,7 @@ pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
     let check_overflow = if let Some(v) = tcx.sess.opts.debugging_opts.force_overflow_checks {
         v
     } else {
-        !attr::contains_name(&krate.config, "ndebug")
+        tcx.sess.opts.debug_assertions
     };
 
     // Before we touch LLVM, make sure that multithreading is enabled.
index 5d1e6d2c9e84400a54e52c8ae6ac96351ce0acde..03496a966bf30e8d617652b6746b176a186f5162 100644 (file)
@@ -117,7 +117,7 @@ fn classify_arg_ty(ccx: &CrateContext, ty: Type) -> ArgType {
     let size = ty_size(ty);
     if size <= 16 {
         let llty = if size == 0 {
-            Type::array(&Type::i64(ccx), 0u64)
+            Type::array(&Type::i64(ccx), 0)
         } else if size == 1 {
             Type::i8(ccx)
         } else if size == 2 {
index a39f5d42b555f470adbc4fcd0a872c0dac3f46ea..39b430b7ad51ed1a6ddcb5eaeaa9baea1311e89e 100644 (file)
@@ -173,7 +173,7 @@ pub fn get_const_expr<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         &**expr
     } else {
         ccx.sess().span_bug(ref_expr.span,
-                            &format!("get_const_val given non-constant item {}",
+                            &format!("get_const_expr given non-constant item {}",
                                      item.repr(ccx.tcx())));
     }
 }
index 142262a25bd437982e5f299ec93ac7c240e43d36..95c39270cc6d9f18c56dd2e98145009c39f74ae3 100644 (file)
@@ -697,6 +697,7 @@ struct FunctionDebugContextData {
     fn_metadata: DISubprogram,
     argument_counter: Cell<uint>,
     source_locations_enabled: Cell<bool>,
+    source_location_override: Cell<bool>,
 }
 
 enum VariableAccess<'a> {
@@ -1176,6 +1177,12 @@ pub fn set_source_location(fcx: &FunctionContext,
             return;
         }
         FunctionDebugContext::RegularContext(box ref function_debug_context) => {
+            if function_debug_context.source_location_override.get() {
+                // Just ignore any attempts to set a new debug location while
+                // the override is active.
+                return;
+            }
+
             let cx = fcx.ccx;
 
             debug!("set_source_location: {}", cx.sess().codemap().span_to_string(span));
@@ -1194,6 +1201,35 @@ pub fn set_source_location(fcx: &FunctionContext,
     }
 }
 
+/// This function makes sure that all debug locations emitted while executing
+/// `wrapped_function` are set to the given `debug_loc`.
+pub fn with_source_location_override<F, R>(fcx: &FunctionContext,
+                                           debug_loc: DebugLoc,
+                                           wrapped_function: F) -> R
+    where F: FnOnce() -> R
+{
+    match fcx.debug_context {
+        FunctionDebugContext::DebugInfoDisabled => {
+            wrapped_function()
+        }
+        FunctionDebugContext::FunctionWithoutDebugInfo => {
+            set_debug_location(fcx.ccx, UnknownLocation);
+            wrapped_function()
+        }
+        FunctionDebugContext::RegularContext(box ref function_debug_context) => {
+            if function_debug_context.source_location_override.get() {
+                wrapped_function()
+            } else {
+                debug_loc.apply(fcx);
+                function_debug_context.source_location_override.set(true);
+                let result = wrapped_function();
+                function_debug_context.source_location_override.set(false);
+                result
+            }
+        }
+    }
+}
+
 /// Clears the current debug location.
 ///
 /// Instructions generated hereafter won't be assigned a source location.
@@ -1414,6 +1450,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         fn_metadata: fn_metadata,
         argument_counter: Cell::new(1),
         source_locations_enabled: Cell::new(false),
+        source_location_override: Cell::new(false),
     };
 
 
index 60455119d58720963a4253e1eea762161cd09b55..96d3e16d253b44707c6f15ba5cb7d536e002b1e1 100644 (file)
@@ -147,7 +147,7 @@ pub fn trans_into<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                 ast::ExprPath(..) => {
                     match bcx.def(expr.id) {
                         def::DefConst(did) => {
-                            let expr = consts::get_const_expr(bcx.ccx(), did, expr);
+                            let const_expr = consts::get_const_expr(bcx.ccx(), did, expr);
                             // Temporarily get cleanup scopes out of the way,
                             // as they require sub-expressions to be contained
                             // inside the current AST scope.
@@ -155,7 +155,13 @@ pub fn trans_into<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                             // can't have destructors.
                             let scopes = mem::replace(&mut *bcx.fcx.scopes.borrow_mut(),
                                                       vec![]);
-                            bcx = trans_into(bcx, expr, dest);
+                            // Lock emitted debug locations to the location of
+                            // the constant reference expression.
+                            debuginfo::with_source_location_override(bcx.fcx,
+                                                                     expr.debug_loc(),
+                                                                     || {
+                                bcx = trans_into(bcx, const_expr, dest)
+                            });
                             let scopes = mem::replace(&mut *bcx.fcx.scopes.borrow_mut(),
                                                       scopes);
                             assert!(scopes.is_empty());
index efae76c5ef41c76027b149666d001858e9f058ae..b0383e355e489477f2ac37c2612f0d35b1cf701c 100644 (file)
@@ -440,7 +440,7 @@ fn gate_simd_ffi(tcx: &ty::ctxt, decl: &ast::FnDecl, ty: &ty::BareFnTy) {
                               &format!("use of SIMD type `{}` in FFI is highly experimental and \
                                         may result in invalid code",
                                        pprust::ty_to_string(ast_ty)));
-                tcx.sess.span_help(ast_ty.span,
+                tcx.sess.fileline_help(ast_ty.span,
                                    "add #![feature(simd_ffi)] to the crate attributes to enable");
             }
         };
index 0da2c86066ae9bb7b982e29749a946544979adb7..00e9e76d81903eb7810c7e389479da0492e61331 100644 (file)
@@ -229,18 +229,18 @@ pub fn opt_ast_region_to_region<'tcx>(
                                 }
                             }
                             if len == 1 {
-                                span_help!(this.tcx().sess, default_span,
+                                fileline_help!(this.tcx().sess, default_span,
                                     "this function's return type contains a borrowed value, but \
                                      the signature does not say which {} it is borrowed from",
                                     m);
                             } else if len == 0 {
-                                span_help!(this.tcx().sess, default_span,
+                                fileline_help!(this.tcx().sess, default_span,
                                     "this function's return type contains a borrowed value, but \
                                      there is no value for it to be borrowed from");
-                                span_help!(this.tcx().sess, default_span,
+                                fileline_help!(this.tcx().sess, default_span,
                                     "consider giving it a 'static lifetime");
                             } else {
-                                span_help!(this.tcx().sess, default_span,
+                                fileline_help!(this.tcx().sess, default_span,
                                     "this function's return type contains a borrowed value, but \
                                      the signature does not say whether it is borrowed from {}",
                                     m);
@@ -722,7 +722,7 @@ fn ast_path_to_trait_ref<'a,'tcx>(
                 span_err!(this.tcx().sess, span, E0215,
                                          "angle-bracket notation is not stable when \
                                          used with the `Fn` family of traits, use parentheses");
-                span_help!(this.tcx().sess, span,
+                fileline_help!(this.tcx().sess, span,
                            "add `#![feature(unboxed_closures)]` to \
                             the crate attributes to enable");
             }
@@ -736,7 +736,7 @@ fn ast_path_to_trait_ref<'a,'tcx>(
                 span_err!(this.tcx().sess, span, E0216,
                                          "parenthetical notation is only stable when \
                                          used with the `Fn` family of traits");
-                span_help!(this.tcx().sess, span,
+                fileline_help!(this.tcx().sess, span,
                            "add `#![feature(unboxed_closures)]` to \
                             the crate attributes to enable");
             }
@@ -963,14 +963,14 @@ fn ast_ty_to_trait_ref<'tcx>(this: &AstConv<'tcx>,
                       pprust::ty_to_string(ty));
             match ty.node {
                 ast::TyRptr(None, ref mut_ty) => {
-                    span_help!(this.tcx().sess, ty.span,
+                    fileline_help!(this.tcx().sess, ty.span,
                                "perhaps you meant `&{}({} +{})`? (per RFC 438)",
                                ppaux::mutability_to_string(mut_ty.mutbl),
                                pprust::ty_to_string(&*mut_ty.ty),
                                pprust::bounds_to_string(bounds));
                 }
                ast::TyRptr(Some(ref lt), ref mut_ty) => {
-                    span_help!(this.tcx().sess, ty.span,
+                    fileline_help!(this.tcx().sess, ty.span,
                                "perhaps you meant `&{} {}({} +{})`? (per RFC 438)",
                                pprust::lifetime_to_string(lt),
                                ppaux::mutability_to_string(mut_ty.mutbl),
@@ -979,7 +979,7 @@ fn ast_ty_to_trait_ref<'tcx>(this: &AstConv<'tcx>,
                 }
 
                 _ => {
-                    span_help!(this.tcx().sess, ty.span,
+                    fileline_help!(this.tcx().sess, ty.span,
                                "perhaps you forgot parentheses? (per RFC 438)");
                 }
             }
index f31dbf5138bb601ce6f6e13689cdec546055624b..6ba21e25e1fe5c62d48f4ca1c1f65465893005a5 100644 (file)
@@ -63,7 +63,7 @@ pub fn check_legal_trait_for_method_call(ccx: &CrateCtxt, span: Span, trait_id:
         span_err!(tcx.sess, span, E0174,
                   "explicit use of unboxed closure method `{}` is experimental",
                   method);
-        span_help!(tcx.sess, span,
+        fileline_help!(tcx.sess, span,
                    "add `#![feature(unboxed_closures)]` to the crate attributes to enable");
     }
 }
index f99ba8940297dbc6c2a9a7e747bd3d5e72cbc9d7..6b4a7761d0a9b836bf913d611d03aea86f7b3bac 100644 (file)
@@ -22,6 +22,7 @@
 use syntax::codemap::Span;
 
 use util::common::ErrorReported;
+use util::nodemap::FnvHashSet;
 use util::ppaux::Repr;
 
 // Helper functions related to manipulating region types.
@@ -40,6 +41,7 @@ struct Implicator<'a, 'tcx: 'a> {
     stack: Vec<(ty::Region, Option<Ty<'tcx>>)>,
     span: Span,
     out: Vec<Implication<'tcx>>,
+    visited: FnvHashSet<Ty<'tcx>>,
 }
 
 /// This routine computes the well-formedness constraints that must hold for the type `ty` to
@@ -65,7 +67,8 @@ pub fn implications<'a,'tcx>(
                               body_id: body_id,
                               span: span,
                               stack: stack,
-                              out: Vec::new() };
+                              out: Vec::new(),
+                              visited: FnvHashSet() };
     wf.accumulate_from_ty(ty);
     debug!("implications: out={}", wf.out.repr(closure_typer.tcx()));
     wf.out
@@ -80,6 +83,12 @@ fn accumulate_from_ty(&mut self, ty: Ty<'tcx>) {
         debug!("accumulate_from_ty(ty={})",
                ty.repr(self.tcx()));
 
+        // When expanding out associated types, we can visit a cyclic
+        // set of types. Issue #23003.
+        if !self.visited.insert(ty) {
+            return;
+        }
+
         match ty.sty {
             ty::ty_bool |
             ty::ty_char |
index 9db98bf00cda85fa5fad708d4927edb1789bd182..595a2295674a12d54f80998d07133e5bfb3349e1 100644 (file)
@@ -3112,7 +3112,7 @@ fn check_field<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                 },
                 expr_t, None);
 
-            tcx.sess.span_help(field.span,
+            tcx.sess.fileline_help(field.span,
                                "maybe a `()` to call it is missing? \
                                If not, try an anonymous function");
         } else {
@@ -4494,7 +4494,7 @@ pub fn check_instantiable(tcx: &ty::ctxt,
         span_err!(tcx.sess, sp, E0073,
             "this type cannot be instantiated without an \
              instance of itself");
-        span_help!(tcx.sess, sp, "consider using `Option<{}>`",
+        fileline_help!(tcx.sess, sp, "consider using `Option<{}>`",
             ppaux::ty_to_string(tcx, item_ty));
         false
     } else {
index fcc5eea76062d817c811cd225cb237c172077ca4..aa7e2b6dcce896763419195facb2daba171c4a79 100644 (file)
@@ -401,7 +401,7 @@ fn report_bivariance(&self,
 
         match suggested_marker_id {
             Some(def_id) => {
-                self.tcx().sess.span_help(
+                self.tcx().sess.fileline_help(
                     span,
                     format!("consider removing `{}` or using a marker such as `{}`",
                             param_name.user_string(self.tcx()),
index 58b67d31ab5803458fa02b9b6be6f4ce41451368..9a8545f3dd5159c87a33d06a9bbabf9bdad64afe 100644 (file)
@@ -524,7 +524,7 @@ fn enforce_trait_manually_implementable(tcx: &ty::ctxt, sp: Span, trait_def_id:
         return // everything OK
     };
     span_err!(tcx.sess, sp, E0183, "manual implementations of `{}` are experimental", trait_name);
-    span_help!(tcx.sess, sp,
+    fileline_help!(tcx.sess, sp,
                "add `#![feature(unboxed_closures)]` to the crate attributes to enable");
 }
 
index 12bcf5cf5ada47a2af3d506559ab3e65538ae01d..77e3b6ee64bb8f7d834d0861a4c48c3f041d8937 100644 (file)
@@ -1342,7 +1342,7 @@ fn trait_def_of_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
             it.span,
             "the `#[rustc_paren_sugar]` attribute is a temporary means of controlling \
              which traits can use parenthetical notation");
-        span_help!(ccx.tcx.sess, it.span,
+        fileline_help!(ccx.tcx.sess, it.span,
                    "add `#![feature(unboxed_closures)]` to \
                     the crate attributes to use it");
     }
index add44769bab60fff1ca052786349c8670b4a85eb..4af6a6d229f554a0151c9ad3a504f83c98ed70f6 100644 (file)
 use html::layout;
 use html::markdown::Markdown;
 use html::markdown;
-use html::escape::Escape;
 use stability_summary;
 
 /// A pair of name and its optional document.
-#[derive(Clone, Eq, Ord, PartialEq, PartialOrd)]
-pub struct NameDoc(String, Option<String>);
+pub type NameDoc = (String, Option<String>);
 
 /// Major driving force in all rustdoc rendering. This contains information
 /// about where in the tree-like hierarchy rendering is occurring and controls
@@ -98,12 +96,6 @@ pub struct Context {
     /// This describes the layout of each page, and is not modified after
     /// creation of the context (contains info like the favicon and added html).
     pub layout: layout::Layout,
-    /// This map is a list of what should be displayed on the sidebar of the
-    /// current page. The key is the section header (traits, modules,
-    /// functions), and the value is the list of containers belonging to this
-    /// header. This map will change depending on the surrounding context of the
-    /// page.
-    pub sidebar: HashMap<String, Vec<NameDoc>>,
     /// This flag indicates whether [src] links should be generated or not. If
     /// the source files are present in the html rendering, then this will be
     /// `true`.
@@ -271,7 +263,6 @@ pub fn run(mut krate: clean::Crate,
         passes: passes,
         current: Vec::new(),
         root_path: String::new(),
-        sidebar: HashMap::new(),
         layout: layout::Layout {
             logo: "".to_string(),
             favicon: "".to_string(),
@@ -1232,7 +1223,16 @@ fn render(w: File, cx: &Context, it: &clean::Item,
                         clean::ModuleItem(m) => m,
                         _ => unreachable!()
                     };
-                    this.sidebar = this.build_sidebar(&m);
+
+                    // render sidebar-items.js used throughout this module
+                    {
+                        let items = this.build_sidebar_items(&m);
+                        let js_dst = this.dst.join("sidebar-items.js");
+                        let mut js_out = BufferedWriter::new(try!(File::create(&js_dst)));
+                        try!(write!(&mut js_out, "initSidebarItems({});",
+                                    json::as_json(&items)));
+                    }
+
                     for item in m.items {
                         f(this,item);
                     }
@@ -1252,15 +1252,11 @@ fn render(w: File, cx: &Context, it: &clean::Item,
         }
     }
 
-    fn build_sidebar(&self, m: &clean::Module) -> HashMap<String, Vec<NameDoc>> {
+    fn build_sidebar_items(&self, m: &clean::Module) -> HashMap<String, Vec<NameDoc>> {
         let mut map = HashMap::new();
         for item in &m.items {
             if self.ignore_private_item(item) { continue }
 
-            // avoid putting foreign items to the sidebar.
-            if let &clean::ForeignFunctionItem(..) = &item.inner { continue }
-            if let &clean::ForeignStaticItem(..) = &item.inner { continue }
-
             let short = shortty(item).to_static_str();
             let myname = match item.name {
                 None => continue,
@@ -1269,7 +1265,7 @@ fn build_sidebar(&self, m: &clean::Module) -> HashMap<String, Vec<NameDoc>> {
             let short = short.to_string();
             let v = map.entry(short).get().unwrap_or_else(
                 |vacant_entry| vacant_entry.insert(Vec::with_capacity(1)));
-            v.push(NameDoc(myname, Some(shorter_line(item.doc_value()))));
+            v.push((myname, Some(shorter_line(item.doc_value()))));
         }
 
         for (_, items) in &mut map {
@@ -2216,9 +2212,18 @@ impl<'a> fmt::Display for Sidebar<'a> {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         let cx = self.cx;
         let it = self.item;
+        let parentlen = cx.current.len() - if it.is_mod() {1} else {0};
+
+        // the sidebar is designed to display sibling functions, modules and
+        // other miscellaneous informations. since there are lots of sibling
+        // items (and that causes quadratic growth in large modules),
+        // we refactor common parts into a shared JavaScript file per module.
+        // still, we don't move everything into JS because we want to preserve
+        // as much HTML as possible in order to allow non-JS-enabled browsers
+        // to navigate the documentation (though slightly inefficiently).
+
         try!(write!(fmt, "<p class='location'>"));
-        let len = cx.current.len() - if it.is_mod() {1} else {0};
-        for (i, name) in cx.current.iter().take(len).enumerate() {
+        for (i, name) in cx.current.iter().take(parentlen).enumerate() {
             if i > 0 {
                 try!(write!(fmt, "::<wbr>"));
             }
@@ -2228,40 +2233,25 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         }
         try!(write!(fmt, "</p>"));
 
-        fn block(w: &mut fmt::Formatter, short: &str, longty: &str,
-                 cur: &clean::Item, cx: &Context) -> fmt::Result {
-            let items = match cx.sidebar.get(short) {
-                Some(items) => items,
-                None => return Ok(())
-            };
-            try!(write!(w, "<div class='block {}'><h2>{}</h2>", short, longty));
-            for &NameDoc(ref name, ref doc) in items {
-                let curty = shortty(cur).to_static_str();
-                let class = if cur.name.as_ref().unwrap() == name &&
-                               short == curty { "current" } else { "" };
-                try!(write!(w, "<a class='{ty} {class}' href='{href}{path}' \
-                                title='{title}'>{name}</a>",
-                       ty = short,
-                       class = class,
-                       href = if curty == "mod" {"../"} else {""},
-                       path = if short == "mod" {
-                           format!("{}/index.html", name)
-                       } else {
-                           format!("{}.{}.html", short, name)
-                       },
-                       title = Escape(doc.as_ref().unwrap()),
-                       name = name));
-            }
-            try!(write!(w, "</div>"));
-            Ok(())
+        // sidebar refers to the enclosing module, not this module
+        let relpath = if shortty(it) == ItemType::Module { "../" } else { "" };
+        try!(write!(fmt,
+                    "<script>window.sidebarCurrent = {{\
+                        name: '{name}', \
+                        ty: '{ty}', \
+                        relpath: '{path}'\
+                     }};</script>",
+                    name = it.name.as_ref().map(|x| &x[..]).unwrap_or(""),
+                    ty = shortty(it).to_static_str(),
+                    path = relpath));
+        if parentlen == 0 {
+            // there is no sidebar-items.js beyond the crate root path
+            // FIXME maybe dynamic crate loading can be merged here
+        } else {
+            try!(write!(fmt, "<script async src=\"{path}sidebar-items.js\"></script>",
+                        path = relpath));
         }
 
-        try!(block(fmt, "mod", "Modules", it, cx));
-        try!(block(fmt, "struct", "Structs", it, cx));
-        try!(block(fmt, "enum", "Enums", it, cx));
-        try!(block(fmt, "trait", "Traits", it, cx));
-        try!(block(fmt, "fn", "Functions", it, cx));
-        try!(block(fmt, "macro", "Macros", it, cx));
         Ok(())
     }
 }
index aac3985f0cc9cd967115c98c7381b696f1e43eb6..a9b233dd128d49994112dd364743f8d66acd36aa 100644 (file)
     "use strict";
     var resizeTimeout, interval;
 
+    // This mapping table should match the discriminants of
+    // `rustdoc::html::item_type::ItemType` type in Rust.
+    var itemTypes = ["mod",
+                     "externcrate",
+                     "import",
+                     "struct",
+                     "enum",
+                     "fn",
+                     "type",
+                     "static",
+                     "trait",
+                     "impl",
+                     "tymethod",
+                     "method",
+                     "structfield",
+                     "variant",
+                     "macro",
+                     "primitive",
+                     "associatedtype",
+                     "constant"];
+
     $('.js-only').removeClass('js-only');
 
     function getQueryStringParams() {
             showResults(results);
         }
 
-        // This mapping table should match the discriminants of
-        // `rustdoc::html::item_type::ItemType` type in Rust.
-        var itemTypes = ["mod",
-                         "externcrate",
-                         "import",
-                         "struct",
-                         "enum",
-                         "fn",
-                         "type",
-                         "static",
-                         "trait",
-                         "impl",
-                         "tymethod",
-                         "method",
-                         "structfield",
-                         "variant",
-                         "macro",
-                         "primitive",
-                         "associatedtype",
-                         "constant"];
-
         function itemTypeFromName(typename) {
             for (var i = 0; i < itemTypes.length; ++i) {
                 if (itemTypes[i] === typename) return i;
 
     window.initSearch = initSearch;
 
+    // delayed sidebar rendering.
+    function initSidebarItems(items) {
+        var sidebar = $('.sidebar');
+        var current = window.sidebarCurrent;
+
+        function block(shortty, longty) {
+            var filtered = items[shortty];
+            if (!filtered) return;
+
+            var div = $('<div>').attr('class', 'block ' + shortty);
+            div.append($('<h2>').text(longty));
+
+            for (var i = 0; i < filtered.length; ++i) {
+                var item = filtered[i];
+                var name = item[0];
+                var desc = item[1]; // can be null
+
+                var klass = shortty;
+                if (name === current.name && shortty == current.ty) {
+                    klass += ' current';
+                }
+                var path;
+                if (shortty === 'mod') {
+                    path = name + '/index.html';
+                } else {
+                    path = shortty + '.' + name + '.html';
+                }
+                div.append($('<a>', {'href': current.relpath + path,
+                                     'title': desc,
+                                     'class': klass}).text(name));
+            }
+            sidebar.append(div);
+        }
+
+        block("mod", "Modules");
+        block("struct", "Structs");
+        block("enum", "Enums");
+        block("trait", "Traits");
+        block("fn", "Functions");
+        block("macro", "Macros");
+    }
+
+    window.initSidebarItems = initSidebarItems;
+
     window.register_implementors = function(imp) {
         var list = $('#implementors-list');
         var libs = Object.getOwnPropertyNames(imp);
index b4522ad680b77a7e128ec2fded45729c007ad0d3..712168ae7067996d45888adb645e551c9fce044a 100644 (file)
@@ -35,9 +35,8 @@
 #![feature(unicode)]
 #![feature(str_words)]
 #![feature(io)]
-#![feature(fs)]
 #![feature(path)]
-#![feature(tempdir)]
+#![feature(path_ext)]
 
 extern crate arena;
 extern crate getopts;
@@ -47,6 +46,7 @@
 extern crate rustc_driver;
 extern crate rustc_resolve;
 extern crate rustc_lint;
+extern crate rustc_back;
 extern crate serialize;
 extern crate syntax;
 extern crate "test" as testing;
index 9fd38ecb13627f07ee721b931b80da2061ff7a07..c785d78dc9303e1247e87298cc9fca6c2adcc899 100644 (file)
@@ -13,7 +13,6 @@
 use std::dynamic_lib::DynamicLibrary;
 use std::env;
 use std::ffi::OsString;
-use std::fs::TempDir;
 use std::old_io;
 use std::io;
 use std::path::PathBuf;
@@ -28,6 +27,7 @@
 use rustc::session::{self, config};
 use rustc::session::config::get_unstable_features_setting;
 use rustc::session::search_paths::{SearchPaths, PathKind};
+use rustc_back::tempdir::TempDir;
 use rustc_driver::{driver, Compilation};
 use syntax::codemap::CodeMap;
 use syntax::diagnostic;
@@ -111,6 +111,7 @@ pub fn run(input: &str,
     0
 }
 
+#[allow(deprecated)]
 fn runtest(test: &str, cratename: &str, libs: SearchPaths,
            externs: core::Externs,
            should_fail: bool, no_run: bool, as_test_harness: bool) {
index 970ae06763c70dc208f3906efe3e6782e6b0501d..6f3d90d45b08721a10583ecd14d8e89d5f32fd74 100644 (file)
@@ -117,7 +117,7 @@ fn from_hex(&self) -> Result<Vec<u8>, FromHexError> {
         // This may be an overestimate if there is any whitespace
         let mut b = Vec::with_capacity(self.len() / 2);
         let mut modulus = 0;
-        let mut buf = 0u8;
+        let mut buf = 0;
 
         for (idx, byte) in self.bytes().enumerate() {
             buf <<= 4;
index bf4d006fcfaacbb82ab09b5eb31aafc9d319212a..0d445739b397f7d72872d0e65d2f46382eef63ee 100644 (file)
@@ -1653,7 +1653,7 @@ fn parse_exponent(&mut self, mut res: f64) -> Result<f64, ParserError> {
 
     fn decode_hex_escape(&mut self) -> Result<u16, ParserError> {
         let mut i = 0;
-        let mut n = 0u16;
+        let mut n = 0;
         while i < 4 && !self.eof() {
             self.bump();
             n = match self.ch_or_null() {
index 94457a5d71441b784dc52e9969f6d5e77703ea60..8b275d1bc4ab772b867569cf6bb77ea6d178547a 100644 (file)
@@ -186,7 +186,7 @@ fn into_ascii_lowercase(mut self) -> Vec<u8> {
 impl AsciiExt for u8 {
     type Owned = u8;
     #[inline]
-    fn is_ascii(&self) -> bool { *self & 128 == 0u8 }
+    fn is_ascii(&self) -> bool { *self & 128 == 0 }
     #[inline]
     fn to_ascii_uppercase(&self) -> u8 { ASCII_UPPERCASE_MAP[*self as usize] }
     #[inline]
@@ -398,7 +398,7 @@ fn test_to_ascii_uppercase() {
         assert_eq!("url()URL()uRl()ürl".to_ascii_uppercase(), "URL()URL()URL()üRL");
         assert_eq!("hıKß".to_ascii_uppercase(), "HıKß");
 
-        for i in 0u32..501 {
+        for i in 0..501 {
             let upper = if 'a' as u32 <= i && i <= 'z' as u32 { i + 'A' as u32 - 'a' as u32 }
                         else { i };
             assert_eq!((from_u32(i).unwrap()).to_string().to_ascii_uppercase(),
@@ -412,7 +412,7 @@ fn test_to_ascii_lowercase() {
         // Dotted capital I, Kelvin sign, Sharp S.
         assert_eq!("HİKß".to_ascii_lowercase(), "hİKß");
 
-        for i in 0u32..501 {
+        for i in 0..501 {
             let lower = if 'A' as u32 <= i && i <= 'Z' as u32 { i + 'a' as u32 - 'A' as u32 }
                         else { i };
             assert_eq!((from_u32(i).unwrap()).to_string().to_ascii_lowercase(),
@@ -426,7 +426,7 @@ fn test_into_ascii_uppercase() {
                    "URL()URL()URL()üRL".to_string());
         assert_eq!(("hıKß".to_string()).into_ascii_uppercase(), "HıKß");
 
-        for i in 0u32..501 {
+        for i in 0..501 {
             let upper = if 'a' as u32 <= i && i <= 'z' as u32 { i + 'A' as u32 - 'a' as u32 }
                         else { i };
             assert_eq!((from_u32(i).unwrap()).to_string().into_ascii_uppercase(),
@@ -441,7 +441,7 @@ fn test_into_ascii_lowercase() {
         // Dotted capital I, Kelvin sign, Sharp S.
         assert_eq!(("HİKß".to_string()).into_ascii_lowercase(), "hİKß");
 
-        for i in 0u32..501 {
+        for i in 0..501 {
             let lower = if 'A' as u32 <= i && i <= 'Z' as u32 { i + 'a' as u32 - 'A' as u32 }
                         else { i };
             assert_eq!((from_u32(i).unwrap()).to_string().into_ascii_lowercase(),
@@ -459,7 +459,7 @@ fn test_eq_ignore_ascii_case() {
         assert!(!"K".eq_ignore_ascii_case("k"));
         assert!(!"ß".eq_ignore_ascii_case("s"));
 
-        for i in 0u32..501 {
+        for i in 0..501 {
             let lower = if 'A' as u32 <= i && i <= 'Z' as u32 { i + 'a' as u32 - 'A' as u32 }
                         else { i };
             assert!((from_u32(i).unwrap()).to_string().eq_ignore_ascii_case(
index 2670cd0c003b5c41bed4d7a4ab068daaf63842e8..69fd0a57d5f38c3eb4176b8d15db486cab819c8d 100644 (file)
@@ -28,7 +28,7 @@
 use rt::heap::{allocate, deallocate, EMPTY};
 use collections::hash_state::HashState;
 
-const EMPTY_BUCKET: u64 = 0u64;
+const EMPTY_BUCKET: u64 = 0;
 
 /// The raw hashtable, providing safe-ish access to the unzipped and highly
 /// optimized arrays of hashes, keys, and values.
@@ -149,7 +149,7 @@ pub fn make_hash<T: ?Sized, S>(hash_state: &S, t: &T) -> SafeHash
 {
     let mut state = hash_state.hasher();
     t.hash(&mut state);
-    // We need to avoid 0u64 in order to prevent collisions with
+    // We need to avoid 0 in order to prevent collisions with
     // EMPTY_HASH. We can maintain our precious uniform distribution
     // of initial indexes by unconditionally setting the MSB,
     // effectively reducing 64-bits hashes to 63 bits.
index 100d3e6ed4aa9c5c6afb095c293b3e1c6ee8fe7e..caada8ae50f74aa30a4f0c7373674ddbb5ad191b 100644 (file)
@@ -78,7 +78,7 @@
 //! * You want a bit vector.
 //!
 //! ### Use a `BitSet` when:
-//! * You want a `VecSet`.
+//! * You want a `BitVec`, but want `Set` properties
 //!
 //! ### Use a `BinaryHeap` when:
 //! * You want to store a bunch of elements, but only ever want to process the "biggest"
@@ -89,7 +89,8 @@
 //!
 //! Choosing the right collection for the job requires an understanding of what each collection
 //! is good at. Here we briefly summarize the performance of different collections for certain
-//! important operations. For further details, see each type's documentation.
+//! important operations. For further details, see each type's documentation, and note that the
+//! names of actual methods may differ from the tables below on certain collections.
 //!
 //! Throughout the documentation, we will follow a few conventions. For all operations,
 //! the collection's size is denoted by n. If another collection is involved in the operation, it
 //! a variant of the `Entry` enum.
 //!
 //! If a `Vacant(entry)` is yielded, then the key *was not* found. In this case the
-//! only valid operation is to `set` the value of the entry. When this is done,
+//! only valid operation is to `insert` a value into the entry. When this is done,
 //! the vacant entry is consumed and converted into a mutable reference to the
 //! the value that was inserted. This allows for further manipulation of the value
 //! beyond the lifetime of the search itself. This is useful if complex logic needs to
 //! be performed on the value regardless of whether the value was just inserted.
 //!
 //! If an `Occupied(entry)` is yielded, then the key *was* found. In this case, the user
-//! has several options: they can `get`, `set`, or `take` the value of the occupied
+//! has several options: they can `get`, `insert`, or `remove` the value of the occupied
 //! entry. Additionally, they can convert the occupied entry into a mutable reference
-//! to its value, providing symmetry to the vacant `set` case.
+//! to its value, providing symmetry to the vacant `insert` case.
 //!
 //! ### Examples
 //!
 //! use std::collections::btree_map::{BTreeMap, Entry};
 //!
 //! // A client of the bar. They have an id and a blood alcohol level.
-//! struct Person { id: u32, blood_alcohol: f32 };
+//! struct Person { id: u32, blood_alcohol: f32 }
 //!
 //! // All the orders made to the bar, by client id.
 //! let orders = vec![1,2,1,2,3,4,1,2,2,3,4,1,1,1];
index 1968ca4b9e7052cbad18612fd4ab8f21e13848df..c052a69bc343a42d0484dfef3934a0004085fd1c 100644 (file)
@@ -616,6 +616,9 @@ mod os {
 mod os {
     pub const FAMILY: &'static str = "unix";
     pub const OS: &'static str = "ios";
+    pub const DLL_PREFIX: &'static str = "lib";
+    pub const DLL_SUFFIX: &'static str = ".dylib";
+    pub const DLL_EXTENSION: &'static str = "dylib";
     pub const EXE_SUFFIX: &'static str = "";
     pub const EXE_EXTENSION: &'static str = "";
 }
index 64ec025a5c423bc087426f835ef43aef8e93eb5e..ef2dd65a81610bc20374c3e9834fd57e1925a2cc 100644 (file)
@@ -15,7 +15,7 @@
 //! operations. Extra platform-specific functionality can be found in the
 //! extension traits of `std::os::$platform`.
 
-#![unstable(feature = "fs")]
+#![stable(feature = "rust1", since = "1.0.0")]
 
 use core::prelude::*;
 
@@ -25,6 +25,7 @@
 use sys_common::{AsInnerMut, FromInner, AsInner};
 use vec::Vec;
 
+#[allow(deprecated)]
 pub use self::tempdir::TempDir;
 
 mod tempdir;
@@ -52,6 +53,7 @@
 /// # Ok(())
 /// # }
 /// ```
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct File {
     inner: fs_imp::File,
     path: PathBuf,
@@ -62,6 +64,7 @@ pub struct File {
 /// This structure is returned from the `metadata` function or method and
 /// represents known metadata about a file such as its permissions, size,
 /// modification times, etc.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct Metadata(fs_imp::FileAttr);
 
 /// Iterator over the entries in a directory.
@@ -70,6 +73,7 @@ pub struct File {
 /// will yield instances of `io::Result<DirEntry>`. Through a `DirEntry`
 /// information like the entry's path and possibly other metadata can be
 /// learned.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct ReadDir(fs_imp::ReadDir);
 
 /// Entries returned by the `ReadDir` iterator.
@@ -77,9 +81,14 @@ pub struct File {
 /// An instance of `DirEntry` represents an entry inside of a directory on the
 /// filesystem. Each entry can be inspected via methods to learn about the full
 /// path or possibly other metadata through per-platform extension traits.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct DirEntry(fs_imp::DirEntry);
 
 /// An iterator that recursively walks over the contents of a directory.
+#[unstable(feature = "fs_walk",
+           reason = "the precise semantics and defaults for a recursive walk \
+                     may change and this may end up accounting for files such \
+                     as symlinks differently")]
 pub struct WalkDir {
     cur: Option<ReadDir>,
     stack: Vec<io::Result<ReadDir>>,
@@ -92,6 +101,7 @@ pub struct WalkDir {
 /// `File::create` methods are aliases for commonly used options using this
 /// builder.
 #[derive(Clone)]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct OpenOptions(fs_imp::OpenOptions);
 
 /// Representation of the various permissions on a file.
@@ -101,6 +111,7 @@ pub struct WalkDir {
 /// functionality, such as mode bits, is available through the
 /// `os::unix::PermissionsExt` trait.
 #[derive(Clone, PartialEq, Eq, Debug)]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct Permissions(fs_imp::FilePermissions);
 
 impl File {
@@ -112,6 +123,7 @@ impl File {
     ///
     /// This function will return an error if `path` does not already exist.
     /// Other errors may also be returned according to `OpenOptions::open`.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn open<P: AsPath + ?Sized>(path: &P) -> io::Result<File> {
         OpenOptions::new().read(true).open(path)
     }
@@ -122,11 +134,15 @@ pub fn open<P: AsPath + ?Sized>(path: &P) -> io::Result<File> {
     /// and will truncate it if it does.
     ///
     /// See the `OpenOptions::open` function for more details.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn create<P: AsPath + ?Sized>(path: &P) -> io::Result<File> {
         OpenOptions::new().write(true).create(true).truncate(true).open(path)
     }
 
     /// Returns the original path that was used to open this file.
+    #[unstable(feature = "file_path",
+               reason = "this abstraction is imposed by this library instead \
+                         of the underlying OS and may be removed")]
     pub fn path(&self) -> Option<&Path> {
         Some(&self.path)
     }
@@ -135,6 +151,7 @@ pub fn path(&self) -> Option<&Path> {
     ///
     /// This function will attempt to ensure that all in-core data reaches the
     /// filesystem before returning.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn sync_all(&self) -> io::Result<()> {
         self.inner.fsync()
     }
@@ -148,6 +165,7 @@ pub fn sync_all(&self) -> io::Result<()> {
     ///
     /// Note that some platforms may simply implement this in terms of
     /// `sync_all`.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn sync_data(&self) -> io::Result<()> {
         self.inner.datasync()
     }
@@ -159,11 +177,13 @@ pub fn sync_data(&self) -> io::Result<()> {
     /// be shrunk. If it is greater than the current file's size, then the file
     /// will be extended to `size` and have all of the intermediate data filled
     /// in with 0s.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn set_len(&self, size: u64) -> io::Result<()> {
         self.inner.truncate(size)
     }
 
-    /// Queries information about the underlying file.
+    /// Queries metadata about the underlying file.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn metadata(&self) -> io::Result<Metadata> {
         self.inner.file_attr().map(Metadata)
     }
@@ -172,33 +192,39 @@ pub fn metadata(&self) -> io::Result<Metadata> {
 impl AsInner<fs_imp::File> for File {
     fn as_inner(&self) -> &fs_imp::File { &self.inner }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl Read for File {
     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
         self.inner.read(buf)
     }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl Write for File {
     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
         self.inner.write(buf)
     }
     fn flush(&mut self) -> io::Result<()> { self.inner.flush() }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl Seek for File {
     fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> {
         self.inner.seek(pos)
     }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Read for &'a File {
     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
         self.inner.read(buf)
     }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Write for &'a File {
     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
         self.inner.write(buf)
     }
     fn flush(&mut self) -> io::Result<()> { self.inner.flush() }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Seek for &'a File {
     fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> {
         self.inner.seek(pos)
@@ -209,6 +235,7 @@ impl OpenOptions {
     /// Creates a blank net set of options ready for configuration.
     ///
     /// All options are initially set to `false`.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn new() -> OpenOptions {
         OpenOptions(fs_imp::OpenOptions::new())
     }
@@ -217,6 +244,7 @@ pub fn new() -> OpenOptions {
     ///
     /// This option, when true, will indicate that the file should be
     /// `read`-able if opened.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn read(&mut self, read: bool) -> &mut OpenOptions {
         self.0.read(read); self
     }
@@ -225,6 +253,7 @@ pub fn read(&mut self, read: bool) -> &mut OpenOptions {
     ///
     /// This option, when true, will indicate that the file should be
     /// `write`-able if opened.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn write(&mut self, write: bool) -> &mut OpenOptions {
         self.0.write(write); self
     }
@@ -233,6 +262,7 @@ pub fn write(&mut self, write: bool) -> &mut OpenOptions {
     ///
     /// This option, when true, means that writes will append to a file instead
     /// of overwriting previous contents.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn append(&mut self, append: bool) -> &mut OpenOptions {
         self.0.append(append); self
     }
@@ -241,6 +271,7 @@ pub fn append(&mut self, append: bool) -> &mut OpenOptions {
     ///
     /// If a file is successfully opened with this option set it will truncate
     /// the file to 0 length if it already exists.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn truncate(&mut self, truncate: bool) -> &mut OpenOptions {
         self.0.truncate(truncate); self
     }
@@ -249,6 +280,7 @@ pub fn truncate(&mut self, truncate: bool) -> &mut OpenOptions {
     ///
     /// This option indicates whether a new file will be created if the file
     /// does not yet already exist.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn create(&mut self, create: bool) -> &mut OpenOptions {
         self.0.create(create); self
     }
@@ -264,37 +296,33 @@ pub fn create(&mut self, create: bool) -> &mut OpenOptions {
     /// * Attempting to open a file with access that the user lacks
     ///   permissions for
     /// * Filesystem-level errors (full disk, etc)
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn open<P: AsPath + ?Sized>(&self, path: &P) -> io::Result<File> {
         let path = path.as_path();
         let inner = try!(fs_imp::File::open(path, &self.0));
-
-        // On *BSD systems, we can open a directory as a file and read from
-        // it: fd=open("/tmp", O_RDONLY); read(fd, buf, N); due to an old
-        // tradition before the introduction of opendir(3).  We explicitly
-        // reject it because there are few use cases.
-        if cfg!(not(any(target_os = "linux", target_os = "android"))) &&
-           try!(inner.file_attr()).is_dir() {
-            Err(Error::new(ErrorKind::InvalidInput, "is a directory", None))
-        } else {
-            Ok(File { path: path.to_path_buf(), inner: inner })
-        }
+        Ok(File { path: path.to_path_buf(), inner: inner })
     }
 }
+
 impl AsInnerMut<fs_imp::OpenOptions> for OpenOptions {
     fn as_inner_mut(&mut self) -> &mut fs_imp::OpenOptions { &mut self.0 }
 }
 
 impl Metadata {
     /// Returns whether this metadata is for a directory.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn is_dir(&self) -> bool { self.0.is_dir() }
 
     /// Returns whether this metadata is for a regular file.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn is_file(&self) -> bool { self.0.is_file() }
 
     /// Returns the size of the file, in bytes, this metadata is for.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn len(&self) -> u64 { self.0.size() }
 
     /// Returns the permissions of the file this metadata is for.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn permissions(&self) -> Permissions {
         Permissions(self.0.perm())
     }
@@ -302,22 +330,32 @@ pub fn permissions(&self) -> Permissions {
     /// Returns the most recent access time for a file.
     ///
     /// The return value is in milliseconds since the epoch.
+    #[unstable(feature = "fs_time",
+               reason = "the return type of u64 is not quite appropriate for \
+                         this method and may change if the standard library \
+                         gains a type to represent a moment in time")]
     pub fn accessed(&self) -> u64 { self.0.accessed() }
 
     /// Returns the most recent modification time for a file.
     ///
     /// The return value is in milliseconds since the epoch.
+    #[unstable(feature = "fs_time",
+               reason = "the return type of u64 is not quite appropriate for \
+                         this method and may change if the standard library \
+                         gains a type to represent a moment in time")]
     pub fn modified(&self) -> u64 { self.0.modified() }
 }
 
 impl Permissions {
     /// Returns whether these permissions describe a readonly file.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn readonly(&self) -> bool { self.0.readonly() }
 
     /// Modify the readonly flag for this set of permissions.
     ///
     /// This operation does **not** modify the filesystem. To modify the
     /// filesystem use the `fs::set_permissions` function.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn set_readonly(&mut self, readonly: bool) {
         self.0.set_readonly(readonly)
     }
@@ -333,6 +371,7 @@ impl AsInner<fs_imp::FilePermissions> for Permissions {
     fn as_inner(&self) -> &fs_imp::FilePermissions { &self.0 }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl Iterator for ReadDir {
     type Item = io::Result<DirEntry>;
 
@@ -341,11 +380,13 @@ fn next(&mut self) -> Option<io::Result<DirEntry>> {
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl DirEntry {
     /// Returns the full path to the file that this entry represents.
     ///
     /// The full path is created by joining the original path to `read_dir` or
     /// `walk_dir` with the filename of this entry.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn path(&self) -> PathBuf { self.0.path() }
 }
 
@@ -368,31 +409,9 @@ pub fn path(&self) -> PathBuf { self.0.path() }
 /// This function will return an error if `path` points to a directory, if the
 /// user lacks permissions to remove the file, or if some other filesystem-level
 /// error occurs.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn remove_file<P: AsPath + ?Sized>(path: &P) -> io::Result<()> {
-    let path = path.as_path();
-    let e = match fs_imp::unlink(path) {
-        Ok(()) => return Ok(()),
-        Err(e) => e,
-    };
-    if !cfg!(windows) { return Err(e) }
-
-    // On unix, a readonly file can be successfully removed. On windows,
-    // however, it cannot. To keep the two platforms in line with
-    // respect to their behavior, catch this case on windows, attempt to
-    // change it to read-write, and then remove the file.
-    if e.kind() != ErrorKind::PermissionDenied { return Err(e) }
-
-    let attr = match metadata(path) { Ok(a) => a, Err(..) => return Err(e) };
-    let mut perms = attr.permissions();
-    if !perms.readonly() { return Err(e) }
-    perms.set_readonly(false);
-
-    if set_permissions(path, perms).is_err() { return Err(e) }
-    if fs_imp::unlink(path).is_ok() { return Ok(()) }
-
-    // Oops, try to put things back the way we found it
-    let _ = set_permissions(path, attr.permissions());
-    Err(e)
+    fs_imp::unlink(path.as_path())
 }
 
 /// Given a path, query the file system to get information about a file,
@@ -418,6 +437,7 @@ pub fn remove_file<P: AsPath + ?Sized>(path: &P) -> io::Result<()> {
 /// This function will return an error if the user lacks the requisite
 /// permissions to perform a `metadata` call on the given `path` or if there
 /// is no entry in the filesystem at the provided path.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn metadata<P: AsPath + ?Sized>(path: &P) -> io::Result<Metadata> {
     fs_imp::stat(path.as_path()).map(Metadata)
 }
@@ -438,6 +458,7 @@ pub fn metadata<P: AsPath + ?Sized>(path: &P) -> io::Result<Metadata> {
 /// the process lacks permissions to view the contents, if `from` and `to`
 /// reside on separate filesystems, or if some other intermittent I/O error
 /// occurs.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn rename<P: AsPath + ?Sized, Q: AsPath + ?Sized>(from: &P, to: &Q)
                                                       -> io::Result<()> {
     fs_imp::rename(from.as_path(), to.as_path())
@@ -468,6 +489,7 @@ pub fn rename<P: AsPath + ?Sized, Q: AsPath + ?Sized>(from: &P, to: &Q)
 /// * The `from` file does not exist
 /// * The current process does not have the permission rights to access
 ///   `from` or write `to`
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn copy<P: AsPath + ?Sized, Q: AsPath + ?Sized>(from: &P, to: &Q)
                                                     -> io::Result<u64> {
     let from = from.as_path();
@@ -490,6 +512,7 @@ pub fn copy<P: AsPath + ?Sized, Q: AsPath + ?Sized>(from: &P, to: &Q)
 ///
 /// The `dst` path will be a link pointing to the `src` path. Note that systems
 /// often require these two paths to both be located on the same filesystem.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn hard_link<P: AsPath + ?Sized, Q: AsPath + ?Sized>(src: &P, dst: &Q)
                                                          -> io::Result<()> {
     fs_imp::link(src.as_path(), dst.as_path())
@@ -498,6 +521,7 @@ pub fn hard_link<P: AsPath + ?Sized, Q: AsPath + ?Sized>(src: &P, dst: &Q)
 /// Creates a new soft link on the filesystem.
 ///
 /// The `dst` path will be a soft link pointing to the `src` path.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn soft_link<P: AsPath + ?Sized, Q: AsPath + ?Sized>(src: &P, dst: &Q)
                                                          -> io::Result<()> {
     fs_imp::symlink(src.as_path(), dst.as_path())
@@ -510,6 +534,7 @@ pub fn soft_link<P: AsPath + ?Sized, Q: AsPath + ?Sized>(src: &P, dst: &Q)
 /// This function will return an error on failure. Failure conditions include
 /// reading a file that does not exist or reading a file that is not a soft
 /// link.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn read_link<P: AsPath + ?Sized>(path: &P) -> io::Result<PathBuf> {
     fs_imp::readlink(path.as_path())
 }
@@ -528,6 +553,7 @@ pub fn read_link<P: AsPath + ?Sized>(path: &P) -> io::Result<PathBuf> {
 ///
 /// This function will return an error if the user lacks permissions to make a
 /// new directory at the provided `path`, or if the directory already exists.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn create_dir<P: AsPath + ?Sized>(path: &P) -> io::Result<()> {
     fs_imp::mkdir(path.as_path())
 }
@@ -541,6 +567,7 @@ pub fn create_dir<P: AsPath + ?Sized>(path: &P) -> io::Result<()> {
 /// does not already exist and it could not be created otherwise. The specific
 /// error conditions for when a directory is being created (after it is
 /// determined to not exist) are outlined by `fs::create_dir`.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn create_dir_all<P: AsPath + ?Sized>(path: &P) -> io::Result<()> {
     let path = path.as_path();
     if path.is_dir() { return Ok(()) }
@@ -572,6 +599,7 @@ pub fn create_dir_all<P: AsPath + ?Sized>(path: &P) -> io::Result<()> {
 ///
 /// This function will return an error if the user lacks permissions to remove
 /// the directory at the provided `path`, or if the directory isn't empty.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn remove_dir<P: AsPath + ?Sized>(path: &P) -> io::Result<()> {
     fs_imp::rmdir(path.as_path())
 }
@@ -585,6 +613,7 @@ pub fn remove_dir<P: AsPath + ?Sized>(path: &P) -> io::Result<()> {
 /// # Errors
 ///
 /// See `file::remove_file` and `fs::remove_dir`
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn remove_dir_all<P: AsPath + ?Sized>(path: &P) -> io::Result<()> {
     let path = path.as_path();
     for child in try!(read_dir(path)) {
@@ -637,6 +666,7 @@ fn lstat(path: &Path) -> io::Result<fs_imp::FileAttr> { fs_imp::stat(path) }
 /// This function will return an error if the provided `path` doesn't exist, if
 /// the process lacks permissions to view the contents or if the `path` points
 /// at a non-directory file
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn read_dir<P: AsPath + ?Sized>(path: &P) -> io::Result<ReadDir> {
     fs_imp::readdir(path.as_path()).map(ReadDir)
 }
@@ -649,11 +679,16 @@ pub fn read_dir<P: AsPath + ?Sized>(path: &P) -> io::Result<ReadDir> {
 ///
 /// The iterator will yield instances of `io::Result<DirEntry>`. New errors may
 /// be encountered after an iterator is initially constructed.
+#[unstable(feature = "fs_walk",
+           reason = "the precise semantics and defaults for a recursive walk \
+                     may change and this may end up accounting for files such \
+                     as symlinks differently")]
 pub fn walk_dir<P: AsPath + ?Sized>(path: &P) -> io::Result<WalkDir> {
     let start = try!(read_dir(path));
     Ok(WalkDir { cur: Some(start), stack: Vec::new() })
 }
 
+#[unstable(feature = "fs_walk")]
 impl Iterator for WalkDir {
     type Item = io::Result<DirEntry>;
 
@@ -683,6 +718,9 @@ fn next(&mut self) -> Option<io::Result<DirEntry>> {
 }
 
 /// Utility methods for paths.
+#[unstable(feature = "path_ext",
+           reason = "the precise set of methods exposed on this trait may \
+                     change and some methods may be removed")]
 pub trait PathExt {
     /// Get information on the file, directory, etc at this path.
     ///
@@ -727,6 +765,10 @@ fn is_dir(&self) -> bool {
 /// The file at the path specified will have its last access time set to
 /// `atime` and its modification time set to `mtime`. The times specified should
 /// be in milliseconds.
+#[unstable(feature = "fs_time",
+           reason = "the argument type of u64 is not quite appropriate for \
+                     this function and may change if the standard library \
+                     gains a type to represent a moment in time")]
 pub fn set_file_times<P: AsPath + ?Sized>(path: &P, accessed: u64,
                                           modified: u64) -> io::Result<()> {
     fs_imp::utimes(path.as_path(), accessed, modified)
@@ -752,6 +794,10 @@ pub fn set_file_times<P: AsPath + ?Sized>(path: &P, accessed: u64,
 /// This function will return an error if the provided `path` doesn't exist, if
 /// the process lacks permissions to change the attributes of the file, or if
 /// some other I/O error is encountered.
+#[unstable(feature = "fs",
+           reason = "a more granual ability to set specific permissions may \
+                     be exposed on the Permissions structure itself and this \
+                     method may not always exist")]
 pub fn set_permissions<P: AsPath + ?Sized>(path: &P, perm: Permissions)
                                            -> io::Result<()> {
     fs_imp::set_perm(path.as_path(), perm.0)
@@ -1053,7 +1099,7 @@ fn file_test_directoryinfo_readdir() {
             check!(w.write(msg));
         }
         let files = check!(fs::read_dir(dir));
-        let mut mem = [0u8; 4];
+        let mut mem = [0; 4];
         for f in files {
             let f = f.unwrap().path();
             {
@@ -1083,7 +1129,7 @@ fn file_test_walk_dir() {
         check!(File::create(&dir2.join("14")));
 
         let files = check!(fs::walk_dir(dir));
-        let mut cur = [0u8; 2];
+        let mut cur = [0; 2];
         for f in files {
             let f = f.unwrap().path();
             let stem = f.file_stem().unwrap().to_str().unwrap();
index 79bdb35dd48cd3b6ebc1e3f9b5d5d6004be241c0..c1da77a6668f51b513ab79d7428a87aa1bcebd3d 100644 (file)
@@ -9,6 +9,9 @@
 // except according to those terms.
 
 #![unstable(feature = "tempdir", reason = "needs an RFC before stabilization")]
+#![deprecated(since = "1.0.0",
+              reason = "use the `tempdir` crate from crates.io instead")]
+#![allow(deprecated)]
 
 use prelude::v1::*;
 
index 1135609959015d2fbee5d2565a0dd18affd69b7f..3603f1275048d9fda1fe4210f1ad32f0ba7b9db7 100644 (file)
@@ -616,14 +616,14 @@ fn test_short_reads() {
 
     #[test]
     fn read_char_buffered() {
-        let buf = [195u8, 159u8];
+        let buf = [195, 159];
         let reader = BufReader::with_capacity(1, &buf[..]);
         assert_eq!(reader.chars().next(), Some(Ok('ß')));
     }
 
     #[test]
     fn test_chars() {
-        let buf = [195u8, 159u8, b'a'];
+        let buf = [195, 159, b'a'];
         let reader = BufReader::with_capacity(1, &buf[..]);
         let mut it = reader.chars();
         assert_eq!(it.next(), Some(Ok('ß')));
index b1779587528c26b20ca9635cca37e48bbdc851ba..2445f5a7a40403e8c7f15190953b70e48926e77d 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(missing_copy_implementations)]
-
 use prelude::v1::*;
 use io::prelude::*;
 
@@ -32,6 +30,7 @@
 /// Implementations of the I/O traits for `Cursor<T>` are not currently generic
 /// over `T` itself. Instead, specific implementations are provided for various
 /// in-memory buffer types like `Vec<u8>` and `&[u8]`.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct Cursor<T> {
     inner: T,
     pos: u64,
@@ -39,26 +38,32 @@ pub struct Cursor<T> {
 
 impl<T> Cursor<T> {
     /// Create a new cursor wrapping the provided underlying I/O object.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn new(inner: T) -> Cursor<T> {
         Cursor { pos: 0, inner: inner }
     }
 
     /// Consume this cursor, returning the underlying value.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn into_inner(self) -> T { self.inner }
 
     /// Get a reference to the underlying value in this cursor.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn get_ref(&self) -> &T { &self.inner }
 
     /// Get a mutable reference to the underlying value in this cursor.
     ///
     /// Care should be taken to avoid modifying the internal I/O state of the
     /// underlying value as it may corrupt this cursor's position.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn get_mut(&mut self) -> &mut T { &mut self.inner }
 
     /// Returns the current value of this cursor
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn position(&self) -> u64 { self.pos }
 
     /// Sets the value of this cursor
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn set_position(&mut self, pos: u64) { self.pos = pos; }
 }
 
@@ -83,8 +88,11 @@ fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> io::Seek for Cursor<&'a [u8]> { seek!(); }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> io::Seek for Cursor<&'a mut [u8]> { seek!(); }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl io::Seek for Cursor<Vec<u8>> { seek!(); }
 
 macro_rules! read {
@@ -97,8 +105,11 @@ fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Read for Cursor<&'a [u8]> { read!(); }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Read for Cursor<&'a mut [u8]> { read!(); }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl Read for Cursor<Vec<u8>> { read!(); }
 
 macro_rules! buffer {
@@ -111,10 +122,14 @@ fn fill_buf(&mut self) -> io::Result<&[u8]> {
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> BufRead for Cursor<&'a [u8]> { buffer!(); }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> BufRead for Cursor<&'a mut [u8]> { buffer!(); }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> BufRead for Cursor<Vec<u8>> { buffer!(); }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Write for Cursor<&'a mut [u8]> {
     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
         let pos = cmp::min(self.pos, self.inner.len() as u64);
@@ -125,6 +140,7 @@ fn write(&mut self, data: &[u8]) -> io::Result<usize> {
     fn flush(&mut self) -> io::Result<()> { Ok(()) }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl Write for Cursor<Vec<u8>> {
     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
         // Make sure the internal buffer is as least as big as where we
@@ -237,7 +253,7 @@ fn test_buf_writer_error() {
 
     #[test]
     fn test_mem_reader() {
-        let mut reader = Cursor::new(vec!(0u8, 1, 2, 3, 4, 5, 6, 7));
+        let mut reader = Cursor::new(vec!(0, 1, 2, 3, 4, 5, 6, 7));
         let mut buf = [];
         assert_eq!(reader.read(&mut buf), Ok(0));
         assert_eq!(reader.position(), 0);
@@ -259,7 +275,7 @@ fn test_mem_reader() {
 
     #[test]
     fn read_to_end() {
-        let mut reader = Cursor::new(vec!(0u8, 1, 2, 3, 4, 5, 6, 7));
+        let mut reader = Cursor::new(vec!(0, 1, 2, 3, 4, 5, 6, 7));
         let mut v = Vec::new();
         reader.read_to_end(&mut v).ok().unwrap();
         assert_eq!(v, [0, 1, 2, 3, 4, 5, 6, 7]);
@@ -267,7 +283,7 @@ fn read_to_end() {
 
     #[test]
     fn test_slice_reader() {
-        let in_buf = vec![0u8, 1, 2, 3, 4, 5, 6, 7];
+        let in_buf = vec![0, 1, 2, 3, 4, 5, 6, 7];
         let mut reader = &mut in_buf.as_slice();
         let mut buf = [];
         assert_eq!(reader.read(&mut buf), Ok(0));
@@ -289,7 +305,7 @@ fn test_slice_reader() {
 
     #[test]
     fn test_buf_reader() {
-        let in_buf = vec![0u8, 1, 2, 3, 4, 5, 6, 7];
+        let in_buf = vec![0, 1, 2, 3, 4, 5, 6, 7];
         let mut reader = Cursor::new(in_buf.as_slice());
         let mut buf = [];
         assert_eq!(reader.read(&mut buf), Ok(0));
@@ -335,7 +351,7 @@ fn seek_past_end() {
         assert_eq!(r.seek(SeekFrom::Start(10)), Ok(10));
         assert_eq!(r.read(&mut [0]), Ok(0));
 
-        let mut r = Cursor::new(vec!(10u8));
+        let mut r = Cursor::new(vec!(10));
         assert_eq!(r.seek(SeekFrom::Start(10)), Ok(10));
         assert_eq!(r.read(&mut [0]), Ok(0));
 
@@ -347,11 +363,11 @@ fn seek_past_end() {
 
     #[test]
     fn seek_before_0() {
-        let buf = [0xff_u8];
+        let buf = [0xff];
         let mut r = Cursor::new(&buf[..]);
         assert!(r.seek(SeekFrom::End(-2)).is_err());
 
-        let mut r = Cursor::new(vec!(10u8));
+        let mut r = Cursor::new(vec!(10));
         assert!(r.seek(SeekFrom::End(-2)).is_err());
 
         let mut buf = [0];
index 82b69ddebff68630fcf70bf1da0d61c342ed754b..c968415d3efdc5670cdee690fb3cea0c6bf60032 100644 (file)
 // =============================================================================
 // Forwarding implementations
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, R: Read + ?Sized> Read for &'a mut R {
-    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { (**self).read(buf) }
-
-    fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<()> { (**self).read_to_end(buf) }
-
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        (**self).read(buf)
+    }
+    fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<()> {
+        (**self).read_to_end(buf)
+    }
     fn read_to_string(&mut self, buf: &mut String) -> io::Result<()> {
         (**self).read_to_string(buf)
     }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, W: Write + ?Sized> Write for &'a mut W {
     fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
-
-    fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { (**self).write_all(buf) }
-
-    fn write_fmt(&mut self, fmt: fmt::Arguments) -> io::Result<()> { (**self).write_fmt(fmt) }
-
     fn flush(&mut self) -> io::Result<()> { (**self).flush() }
+    fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
+        (**self).write_all(buf)
+    }
+    fn write_fmt(&mut self, fmt: fmt::Arguments) -> io::Result<()> {
+        (**self).write_fmt(fmt)
+    }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, S: Seek + ?Sized> Seek for &'a mut S {
     fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { (**self).seek(pos) }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, B: BufRead + ?Sized> BufRead for &'a mut B {
     fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
-
     fn consume(&mut self, amt: usize) { (**self).consume(amt) }
-
     fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<()> {
         (**self).read_until(byte, buf)
     }
-
-    fn read_line(&mut self, buf: &mut String) -> io::Result<()> { (**self).read_line(buf) }
+    fn read_line(&mut self, buf: &mut String) -> io::Result<()> {
+        (**self).read_line(buf)
+    }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<R: Read + ?Sized> Read for Box<R> {
-    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { (**self).read(buf) }
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        (**self).read(buf)
+    }
+    fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<()> {
+        (**self).read_to_end(buf)
+    }
+    fn read_to_string(&mut self, buf: &mut String) -> io::Result<()> {
+        (**self).read_to_string(buf)
+    }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<W: Write + ?Sized> Write for Box<W> {
     fn write(&mut self, buf: &[u8]) -> io::Result<usize> { (**self).write(buf) }
     fn flush(&mut self) -> io::Result<()> { (**self).flush() }
+    fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
+        (**self).write_all(buf)
+    }
+    fn write_fmt(&mut self, fmt: fmt::Arguments) -> io::Result<()> {
+        (**self).write_fmt(fmt)
+    }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<S: Seek + ?Sized> Seek for Box<S> {
     fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { (**self).seek(pos) }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<B: BufRead + ?Sized> BufRead for Box<B> {
     fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
     fn consume(&mut self, amt: usize) { (**self).consume(amt) }
+    fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<()> {
+        (**self).read_until(byte, buf)
+    }
+    fn read_line(&mut self, buf: &mut String) -> io::Result<()> {
+        (**self).read_line(buf)
+    }
 }
 
 // =============================================================================
 // In-memory buffer implementations
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Read for &'a [u8] {
     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
         let amt = cmp::min(buf.len(), self.len());
@@ -83,11 +114,13 @@ fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> BufRead for &'a [u8] {
     fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
     fn consume(&mut self, amt: usize) { *self = &self[amt..]; }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Write for &'a mut [u8] {
     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
         let amt = cmp::min(data.len(), self.len());
@@ -108,6 +141,7 @@ fn write_all(&mut self, data: &[u8]) -> io::Result<()> {
     fn flush(&mut self) -> io::Result<()> { Ok(()) }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl Write for Vec<u8> {
     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
         self.push_all(buf);
@@ -115,7 +149,7 @@ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
     }
 
     fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
-        try!(self.write(buf));
+        self.push_all(buf);
         Ok(())
     }
 
index 46547ac583637c808990357679c553c42cb04141..9137068076b46818d30eb55a5d5cf77d5a0845a9 100644 (file)
@@ -237,11 +237,13 @@ fn read_to_string(&mut self, buf: &mut String) -> Result<()> {
 
 /// Extension methods for all instances of `Read`, typically imported through
 /// `std::io::prelude::*`.
+#[unstable(feature = "io", reason = "may merge into the Read trait")]
 pub trait ReadExt: Read + Sized {
     /// Create a "by reference" adaptor for this instance of `Read`.
     ///
     /// The returned adaptor also implements `Read` and will simply borrow this
     /// current reader.
+    #[stable(feature = "rust1", since = "1.0.0")]
     fn by_ref(&mut self) -> &mut Self { self }
 
     /// Transform this `Read` instance to an `Iterator` over its bytes.
@@ -250,6 +252,7 @@ fn by_ref(&mut self) -> &mut Self { self }
     /// R::Err>`.  The yielded item is `Ok` if a byte was successfully read and
     /// `Err` otherwise for I/O errors. EOF is mapped to returning `None` from
     /// this iterator.
+    #[stable(feature = "rust1", since = "1.0.0")]
     fn bytes(self) -> Bytes<Self> {
         Bytes { inner: self }
     }
@@ -264,6 +267,9 @@ fn bytes(self) -> Bytes<Self> {
     ///
     /// Currently this adaptor will discard intermediate data read, and should
     /// be avoided if this is not desired.
+    #[unstable(feature = "io", reason = "the semantics of a partial read/write \
+                                         of where errors happen is currently \
+                                         unclear and may change")]
     fn chars(self) -> Chars<Self> {
         Chars { inner: self }
     }
@@ -273,6 +279,7 @@ fn chars(self) -> Chars<Self> {
     /// The returned `Read` instance will first read all bytes from this object
     /// until EOF is encountered. Afterwards the output is equivalent to the
     /// output of `next`.
+    #[stable(feature = "rust1", since = "1.0.0")]
     fn chain<R: Read>(self, next: R) -> Chain<Self, R> {
         Chain { first: self, second: next, done_first: false }
     }
@@ -283,6 +290,7 @@ fn chain<R: Read>(self, next: R) -> Chain<Self, R> {
     /// `limit` bytes, after which it will always return EOF (`Ok(0)`). Any
     /// read errors will not count towards the number of bytes read and future
     /// calls to `read` may succeed.
+    #[stable(feature = "rust1", since = "1.0.0")]
     fn take(self, limit: u64) -> Take<Self> {
         Take { inner: self, limit: limit }
     }
@@ -293,6 +301,9 @@ fn take(self, limit: u64) -> Take<Self> {
     /// Whenever the returned `Read` instance is read it will write the read
     /// data to `out`. The current semantics of this implementation imply that
     /// a `write` error will not report how much data was initially read.
+    #[unstable(feature = "io", reason = "the semantics of a partial read/write \
+                                         of where errors happen is currently \
+                                         unclear and may change")]
     fn tee<W: Write>(self, out: W) -> Tee<Self, W> {
         Tee { reader: self, writer: out }
     }
@@ -415,11 +426,13 @@ fn write_str(&mut self, s: &str) -> fmt::Result {
 
 /// Extension methods for all instances of `Write`, typically imported through
 /// `std::io::prelude::*`.
+#[unstable(feature = "io", reason = "may merge into the Read trait")]
 pub trait WriteExt: Write + Sized {
     /// Create a "by reference" adaptor for this instance of `Write`.
     ///
     /// The returned adaptor also implements `Write` and will simply borrow this
     /// current writer.
+    #[stable(feature = "rust1", since = "1.0.0")]
     fn by_ref(&mut self) -> &mut Self { self }
 
     /// Creates a new writer which will write all data to both this writer and
@@ -430,11 +443,15 @@ fn by_ref(&mut self) -> &mut Self { self }
     /// implementation do not precisely track where errors happen. For example
     /// an error on the second call to `write` will not report that the first
     /// call to `write` succeeded.
+    #[unstable(feature = "io", reason = "the semantics of a partial read/write \
+                                         of where errors happen is currently \
+                                         unclear and may change")]
     fn broadcast<W: Write>(self, other: W) -> Broadcast<Self, W> {
         Broadcast { first: self, second: other }
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<T: Write> WriteExt for T {}
 
 /// An object implementing `Seek` internally has some form of cursor which can
@@ -592,6 +609,8 @@ pub trait BufReadExt: BufRead + Sized {
     ///
     /// This function will yield errors whenever `read_until` would have also
     /// yielded an error.
+    #[unstable(feature = "io", reason = "may be renamed to not conflict with \
+                                         SliceExt::split")]
     fn split(self, byte: u8) -> Split<Self> {
         Split { buf: self, delim: byte }
     }
@@ -604,11 +623,13 @@ fn split(self, byte: u8) -> Split<Self> {
     ///
     /// This function will yield errors whenever `read_string` would have also
     /// yielded an error.
+    #[stable(feature = "rust1", since = "1.0.0")]
     fn lines(self) -> Lines<Self> {
         Lines { buf: self }
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<T: BufRead> BufReadExt for T {}
 
 /// A `Write` adaptor which will write data to multiple locations.
@@ -635,12 +656,14 @@ fn flush(&mut self) -> Result<()> {
 /// Adaptor to chain together two instances of `Read`.
 ///
 /// For more information, see `ReadExt::chain`.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct Chain<T, U> {
     first: T,
     second: U,
     done_first: bool,
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<T: Read, U: Read> Read for Chain<T, U> {
     fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
         if !self.done_first {
@@ -656,11 +679,13 @@ fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
 /// Reader adaptor which limits the bytes read from an underlying reader.
 ///
 /// For more information, see `ReadExt::take`.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct Take<T> {
     inner: T,
     limit: u64,
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<T> Take<T> {
     /// Returns the number of bytes that can be read before this instance will
     /// return EOF.
@@ -669,9 +694,11 @@ impl<T> Take<T> {
     ///
     /// This instance may reach EOF after reading fewer bytes than indicated by
     /// this method if the underlying `Read` instance reaches EOF.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn limit(&self) -> u64 { self.limit }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<T: Read> Read for Take<T> {
     fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
         // Don't call into inner reader at all at EOF because it may still block
@@ -686,6 +713,7 @@ fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<T: BufRead> BufRead for Take<T> {
     fn fill_buf(&mut self) -> Result<&[u8]> {
         let buf = try!(self.inner.fill_buf());
@@ -721,10 +749,12 @@ fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
 /// A bridge from implementations of `Read` to an `Iterator` of `u8`.
 ///
 /// See `ReadExt::bytes` for more information.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct Bytes<R> {
     inner: R,
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<R: Read> Iterator for Bytes<R> {
     type Item = Result<u8>;
 
@@ -845,10 +875,12 @@ fn next(&mut self) -> Option<Result<Vec<u8>>> {
 /// byte.
 ///
 /// See `BufReadExt::lines` for more information.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct Lines<B> {
     buf: B,
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<B: BufRead> Iterator for Lines<B> {
     type Item = Result<String>;
 
index 3d342137c62ddd3d3a340811384d1dc2e166efd8..20426025257c3761a8bba56c4281f5093ac49ccb 100644 (file)
@@ -12,7 +12,7 @@
 
 use prelude::v1::*;
 
-use io::{self, Read, Write, ErrorKind};
+use io::{self, Read, Write, ErrorKind, BufRead};
 
 /// Copies the entire contents of a reader into a writer.
 ///
@@ -27,6 +27,7 @@
 /// This function will return an error immediately if any call to `read` or
 /// `write` returns an error. All instances of `ErrorKind::Interrupted` are
 /// handled by this function and the underlying operation is retried.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn copy<R: Read, W: Write>(r: &mut R, w: &mut W) -> io::Result<u64> {
     let mut buf = [0; super::DEFAULT_BUF_SIZE];
     let mut written = 0;
@@ -43,26 +44,37 @@ pub fn copy<R: Read, W: Write>(r: &mut R, w: &mut W) -> io::Result<u64> {
 }
 
 /// A reader which is always at EOF.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct Empty { _priv: () }
 
 /// Creates an instance of an empty reader.
 ///
 /// All reads from the returned reader will return `Ok(0)`.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn empty() -> Empty { Empty { _priv: () } }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl Read for Empty {
     fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> { Ok(0) }
 }
+#[stable(feature = "rust1", since = "1.0.0")]
+impl BufRead for Empty {
+    fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(&[]) }
+    fn consume(&mut self, _n: usize) {}
+}
 
 /// A reader which infinitely yields one byte.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct Repeat { byte: u8 }
 
 /// Creates an instance of a reader that infinitely repeats one byte.
 ///
 /// All reads from this reader will succeed by filling the specified buffer with
 /// the given byte.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn repeat(byte: u8) -> Repeat { Repeat { byte: byte } }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl Read for Repeat {
     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
         for slot in buf.iter_mut() {
@@ -73,14 +85,17 @@ fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
 }
 
 /// A writer which will move data into the void.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct Sink { _priv: () }
 
 /// Creates an instance of a writer which will successfully consume all data.
 ///
 /// All calls to `write` on the returned instance will return `Ok(buf.len())`
 /// and the contents of the buffer will not be inspected.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub fn sink() -> Sink { Sink { _priv: () } }
 
+#[stable(feature = "rust1", since = "1.0.0")]
 impl Write for Sink {
     fn write(&mut self, buf: &[u8]) -> io::Result<usize> { Ok(buf.len()) }
     fn flush(&mut self) -> io::Result<()> { Ok(()) }
index 569906047aab3523371fdf69ead368c4cd6ff5d9..c0db163e0874dce39f28099ac8ddae334d23af5c 100644 (file)
 #![feature(hash)]
 #![feature(int_uint)]
 #![feature(unique)]
+#![feature(allow_internal_unstable)]
 #![cfg_attr(test, feature(test, rustc_private))]
 
 // Don't link to std. We are std.
index f16f501c46a19006ff789b01839a71f054684528..916abe78eb3b3aeaf66c0c8cf166a9f7e84ebe1c 100644 (file)
@@ -562,7 +562,7 @@ fn to_socket_addr_socketaddr() {
     #[test]
     fn to_socket_addr_ipaddr_u16() {
         let a = IpAddr::new_v4(77, 88, 21, 11);
-        let p = 12345u16;
+        let p = 12345;
         let e = SocketAddr::new(a, p);
         assert_eq!(Ok(vec![e]), tsa((a, p)));
     }
@@ -570,13 +570,13 @@ fn to_socket_addr_ipaddr_u16() {
     #[test]
     fn to_socket_addr_str_u16() {
         let a = SocketAddr::new(IpAddr::new_v4(77, 88, 21, 11), 24352);
-        assert_eq!(Ok(vec![a]), tsa(("77.88.21.11", 24352u16)));
+        assert_eq!(Ok(vec![a]), tsa(("77.88.21.11", 24352)));
 
         let a = SocketAddr::new(IpAddr::new_v6(0x2a02, 0x6b8, 0, 1, 0, 0, 0, 1), 53);
         assert_eq!(Ok(vec![a]), tsa(("2a02:6b8:0:1::1", 53)));
 
         let a = SocketAddr::new(IpAddr::new_v4(127, 0, 0, 1), 23924);
-        assert!(tsa(("localhost", 23924u16)).unwrap().contains(&a));
+        assert!(tsa(("localhost", 23924)).unwrap().contains(&a));
     }
 
     #[test]
index e82dc88cddd7b7036989232092f2e781f43a4617..aa54a432d625ba803a2dfec2a3e8110ef25182e7 100644 (file)
@@ -136,7 +136,7 @@ fn parse_digit(c: char, radix: u8) -> Option<u8> {
     }
 
     fn read_number_impl(&mut self, radix: u8, max_digits: u32, upto: u32) -> Option<u32> {
-        let mut r = 0u32;
+        let mut r = 0;
         let mut digit_count = 0;
         loop {
             match self.read_digit(radix) {
@@ -164,7 +164,7 @@ fn read_number(&mut self, radix: u8, max_digits: u32, upto: u32) -> Option<u32>
     }
 
     fn read_ipv4_addr_impl(&mut self) -> Option<Ipv4Addr> {
-        let mut bs = [0u8; 4];
+        let mut bs = [0; 4];
         let mut i = 0;
         while i < 4 {
             if i != 0 && self.read_given_char('.').is_none() {
@@ -189,7 +189,7 @@ fn read_ipv4_addr(&mut self) -> Option<Ipv4Addr> {
     fn read_ipv6_addr_impl(&mut self) -> Option<Ipv6Addr> {
         fn ipv6_addr_from_head_tail(head: &[u16], tail: &[u16]) -> Ipv6Addr {
             assert!(head.len() + tail.len() <= 8);
-            let mut gs = [0u16; 8];
+            let mut gs = [0; 8];
             gs.clone_from_slice(head);
             gs[(8 - tail.len()) .. 8].clone_from_slice(tail);
             Ipv6Addr::new(gs[0], gs[1], gs[2], gs[3], gs[4], gs[5], gs[6], gs[7])
@@ -231,7 +231,7 @@ fn ipv6_addr_from_head_tail(head: &[u16], tail: &[u16]) -> Ipv6Addr {
             (i, false)
         }
 
-        let mut head = [0u16; 8];
+        let mut head = [0; 8];
         let (head_size, head_ipv4) = read_groups(self, &mut head, 8);
 
         if head_size == 8 {
@@ -250,7 +250,7 @@ fn ipv6_addr_from_head_tail(head: &[u16], tail: &[u16]) -> Ipv6Addr {
             return None;
         }
 
-        let mut tail = [0u16; 8];
+        let mut tail = [0; 8];
         let (tail_size, _) = read_groups(self, &mut tail, 8 - head_size);
         Some(ipv6_addr_from_head_tail(&head[..head_size], &tail[..tail_size]))
     }
index 6ce3a939c6a4976ac9dacb5df04af3ac483125b1..fd723ea13e9629e8f94c9c0bb6933430d201a5e6 100644 (file)
@@ -233,13 +233,13 @@ macro_rules! t {
         }
     }
 
-    // FIXME #11530 this fails on android because tests are run as root
-    #[cfg_attr(any(windows, target_os = "android"), ignore)]
     #[test]
     fn bind_error() {
-        match TcpListener::bind("0.0.0.0:1") {
+        match TcpListener::bind("1.1.1.1:9999") {
             Ok(..) => panic!(),
-            Err(e) => assert_eq!(e.kind(), ErrorKind::PermissionDenied),
+            Err(e) =>
+                // EADDRNOTAVAIL is mapped to ConnectionRefused
+                assert_eq!(e.kind(), ErrorKind::ConnectionRefused),
         }
     }
 
index 7d15a16309e5b3f481a52440fa1df25b44d614da..093cde55bbb5fe7c2fd3c4b588998a616fe9318b 100644 (file)
@@ -824,14 +824,14 @@ fn test_frexp_nowin() {
 
     #[test]
     fn test_integer_decode() {
-        assert_eq!(3.14159265359f32.integer_decode(), (13176795u64, -22i16, 1i8));
-        assert_eq!((-8573.5918555f32).integer_decode(), (8779358u64, -10i16, -1i8));
-        assert_eq!(2f32.powf(100.0).integer_decode(), (8388608u64, 77i16, 1i8));
-        assert_eq!(0f32.integer_decode(), (0u64, -150i16, 1i8));
-        assert_eq!((-0f32).integer_decode(), (0u64, -150i16, -1i8));
-        assert_eq!(INFINITY.integer_decode(), (8388608u64, 105i16, 1i8));
-        assert_eq!(NEG_INFINITY.integer_decode(), (8388608u64, 105i16, -1i8));
-        assert_eq!(NAN.integer_decode(), (12582912u64, 105i16, 1i8));
+        assert_eq!(3.14159265359f32.integer_decode(), (13176795, -22, 1));
+        assert_eq!((-8573.5918555f32).integer_decode(), (8779358, -10, -1));
+        assert_eq!(2f32.powf(100.0).integer_decode(), (8388608, 77, 1));
+        assert_eq!(0f32.integer_decode(), (0, -150, 1));
+        assert_eq!((-0f32).integer_decode(), (0, -150, -1));
+        assert_eq!(INFINITY.integer_decode(), (8388608, 105, 1));
+        assert_eq!(NEG_INFINITY.integer_decode(), (8388608, 105, -1));
+        assert_eq!(NAN.integer_decode(), (12582912, 105, 1));
     }
 
     #[test]
index 0ce56371c77e544733a9dfc3a72a4ca2809b1e79..a7bdad70a362b8cf16ddddd95cec057a18c586c4 100644 (file)
@@ -826,14 +826,14 @@ fn test_frexp_nowin() {
 
     #[test]
     fn test_integer_decode() {
-        assert_eq!(3.14159265359f64.integer_decode(), (7074237752028906u64, -51i16, 1i8));
-        assert_eq!((-8573.5918555f64).integer_decode(), (4713381968463931u64, -39i16, -1i8));
-        assert_eq!(2f64.powf(100.0).integer_decode(), (4503599627370496u64, 48i16, 1i8));
-        assert_eq!(0f64.integer_decode(), (0u64, -1075i16, 1i8));
-        assert_eq!((-0f64).integer_decode(), (0u64, -1075i16, -1i8));
-        assert_eq!(INFINITY.integer_decode(), (4503599627370496u64, 972i16, 1i8));
+        assert_eq!(3.14159265359f64.integer_decode(), (7074237752028906, -51, 1));
+        assert_eq!((-8573.5918555f64).integer_decode(), (4713381968463931, -39, -1));
+        assert_eq!(2f64.powf(100.0).integer_decode(), (4503599627370496, 48, 1));
+        assert_eq!(0f64.integer_decode(), (0, -1075, 1));
+        assert_eq!((-0f64).integer_decode(), (0, -1075, -1));
+        assert_eq!(INFINITY.integer_decode(), (4503599627370496, 972, 1));
         assert_eq!(NEG_INFINITY.integer_decode(), (4503599627370496, 972, -1));
-        assert_eq!(NAN.integer_decode(), (6755399441055744u64, 972i16, 1i8));
+        assert_eq!(NAN.integer_decode(), (6755399441055744, 972, 1));
     }
 
     #[test]
index 0bca60ed1a0ae6c86108b862072b1ec2728a0f17..9458ed1d3535ec35af26924a22d83f5753203179 100644 (file)
@@ -312,7 +312,7 @@ pub trait Float
     ///
     /// let num = 2.0f32;
     ///
-    /// // (8388608u64, -22i16, 1i8)
+    /// // (8388608, -22, 1)
     /// let (mantissa, exponent, sign) = num.integer_decode();
     /// let sign_f = sign as f32;
     /// let mantissa_f = mantissa as f32;
@@ -1755,25 +1755,25 @@ macro_rules! assert_pow {
 
     #[test]
     fn test_uint_to_str_overflow() {
-        let mut u8_val: u8 = 255_u8;
+        let mut u8_val: u8 = 255;
         assert_eq!(u8_val.to_string(), "255");
 
         u8_val = u8_val.wrapping_add(1);
         assert_eq!(u8_val.to_string(), "0");
 
-        let mut u16_val: u16 = 65_535_u16;
+        let mut u16_val: u16 = 65_535;
         assert_eq!(u16_val.to_string(), "65535");
 
         u16_val = u16_val.wrapping_add(1);
         assert_eq!(u16_val.to_string(), "0");
 
-        let mut u32_val: u32 = 4_294_967_295_u32;
+        let mut u32_val: u32 = 4_294_967_295;
         assert_eq!(u32_val.to_string(), "4294967295");
 
         u32_val = u32_val.wrapping_add(1);
         assert_eq!(u32_val.to_string(), "0");
 
-        let mut u64_val: u64 = 18_446_744_073_709_551_615_u64;
+        let mut u64_val: u64 = 18_446_744_073_709_551_615;
         assert_eq!(u64_val.to_string(), "18446744073709551615");
 
         u64_val = u64_val.wrapping_add(1);
@@ -1786,7 +1786,7 @@ fn from_str<T: ::str::FromStr>(t: &str) -> Option<T> {
 
     #[test]
     fn test_uint_from_str_overflow() {
-        let mut u8_val: u8 = 255_u8;
+        let mut u8_val: u8 = 255;
         assert_eq!(from_str::<u8>("255"), Some(u8_val));
         assert_eq!(from_str::<u8>("256"), None);
 
@@ -1794,7 +1794,7 @@ fn test_uint_from_str_overflow() {
         assert_eq!(from_str::<u8>("0"), Some(u8_val));
         assert_eq!(from_str::<u8>("-1"), None);
 
-        let mut u16_val: u16 = 65_535_u16;
+        let mut u16_val: u16 = 65_535;
         assert_eq!(from_str::<u16>("65535"), Some(u16_val));
         assert_eq!(from_str::<u16>("65536"), None);
 
@@ -1802,7 +1802,7 @@ fn test_uint_from_str_overflow() {
         assert_eq!(from_str::<u16>("0"), Some(u16_val));
         assert_eq!(from_str::<u16>("-1"), None);
 
-        let mut u32_val: u32 = 4_294_967_295_u32;
+        let mut u32_val: u32 = 4_294_967_295;
         assert_eq!(from_str::<u32>("4294967295"), Some(u32_val));
         assert_eq!(from_str::<u32>("4294967296"), None);
 
@@ -1810,7 +1810,7 @@ fn test_uint_from_str_overflow() {
         assert_eq!(from_str::<u32>("0"), Some(u32_val));
         assert_eq!(from_str::<u32>("-1"), None);
 
-        let mut u64_val: u64 = 18_446_744_073_709_551_615_u64;
+        let mut u64_val: u64 = 18_446_744_073_709_551_615;
         assert_eq!(from_str::<u64>("18446744073709551615"), Some(u64_val));
         assert_eq!(from_str::<u64>("18446744073709551616"), None);
 
index b38c52dad1ad10d8ab3abada5d58c5bf9135507e..5fdd42dbc7a838bd9d4a6243231c8f6e963fe803 100644 (file)
@@ -104,7 +104,7 @@ fn int_to_str_bytes_common<T, F>(num: T, radix: uint, sign: SignFormat, mut f: F
     // This is just for integral types, the largest of which is a u64. The
     // smallest base that we can have is 2, so the most number of digits we're
     // ever going to have is 64
-    let mut buf = [0u8; 64];
+    let mut buf = [0; 64];
     let mut cur = 0;
 
     // Loop at least once to make sure at least a `0` gets emitted.
@@ -221,10 +221,10 @@ pub fn float_to_str_bytes_common<T: Float>(
     let radix_gen: T = num::cast(radix as int).unwrap();
 
     let (num, exp) = match exp_format {
-        ExpNone => (num, 0i32),
+        ExpNone => (num, 0),
         ExpDec | ExpBin => {
             if num == _0 {
-                (num, 0i32)
+                (num, 0)
             } else {
                 let (exp, exp_base) = match exp_format {
                     ExpDec => (num.abs().log10().floor(), num::cast::<f64, T>(10.0f64).unwrap()),
@@ -432,25 +432,25 @@ mod tests {
 
     #[test]
     fn test_int_to_str_overflow() {
-        let mut i8_val: i8 = 127_i8;
+        let mut i8_val: i8 = 127;
         assert_eq!(i8_val.to_string(), "127");
 
         i8_val = i8_val.wrapping_add(1);
         assert_eq!(i8_val.to_string(), "-128");
 
-        let mut i16_val: i16 = 32_767_i16;
+        let mut i16_val: i16 = 32_767;
         assert_eq!(i16_val.to_string(), "32767");
 
         i16_val = i16_val.wrapping_add(1);
         assert_eq!(i16_val.to_string(), "-32768");
 
-        let mut i32_val: i32 = 2_147_483_647_i32;
+        let mut i32_val: i32 = 2_147_483_647;
         assert_eq!(i32_val.to_string(), "2147483647");
 
         i32_val = i32_val.wrapping_add(1);
         assert_eq!(i32_val.to_string(), "-2147483648");
 
-        let mut i64_val: i64 = 9_223_372_036_854_775_807_i64;
+        let mut i64_val: i64 = 9_223_372_036_854_775_807;
         assert_eq!(i64_val.to_string(), "9223372036854775807");
 
         i64_val = i64_val.wrapping_add(1);
index 2d2d0d8b33a4c9e68ef0bf00e7f2511b878d7b22..fe2510b668f9278e6376734a13804e90ab082b68 100644 (file)
@@ -642,14 +642,14 @@ fn test_short_reads() {
 
     #[test]
     fn read_char_buffered() {
-        let buf = [195u8, 159u8];
+        let buf = [195, 159];
         let mut reader = BufferedReader::with_capacity(1, &buf[..]);
         assert_eq!(reader.read_char(), Ok('ß'));
     }
 
     #[test]
     fn test_chars() {
-        let buf = [195u8, 159u8, b'a'];
+        let buf = [195, 159, b'a'];
         let mut reader = BufferedReader::with_capacity(1, &buf[..]);
         let mut it = reader.chars();
         assert_eq!(it.next(), Some(Ok('ß')));
index 207d3d39167660b929225e667725357d166a1b63..dec1ae98ba0be10fc8065de87eaacdfe2994fce5 100644 (file)
@@ -30,7 +30,7 @@
 /// # drop(tx);
 /// let mut reader = ChanReader::new(rx);
 ///
-/// let mut buf = [0u8; 100];
+/// let mut buf = [0; 100];
 /// match reader.read(&mut buf) {
 ///     Ok(nread) => println!("Read {} bytes", nread),
 ///     Err(e) => println!("read error: {}", e),
@@ -167,15 +167,15 @@ mod test {
     fn test_rx_reader() {
         let (tx, rx) = channel();
         thread::spawn(move|| {
-          tx.send(vec![1u8, 2u8]).unwrap();
+          tx.send(vec![1, 2]).unwrap();
           tx.send(vec![]).unwrap();
-          tx.send(vec![3u8, 4u8]).unwrap();
-          tx.send(vec![5u8, 6u8]).unwrap();
-          tx.send(vec![7u8, 8u8]).unwrap();
+          tx.send(vec![3, 4]).unwrap();
+          tx.send(vec![5, 6]).unwrap();
+          tx.send(vec![78]).unwrap();
         });
 
         let mut reader = ChanReader::new(rx);
-        let mut buf = [0u8; 3];
+        let mut buf = [0; 3];
 
         assert_eq!(Ok(0), reader.read(&mut []));
 
@@ -233,7 +233,7 @@ fn test_chan_writer() {
         let mut writer = ChanWriter::new(tx);
         writer.write_be_u32(42).unwrap();
 
-        let wanted = vec![0u8, 0u8, 0u8, 42u8];
+        let wanted = vec![0, 0, 0, 42];
         let got = thread::scoped(move|| { rx.recv().unwrap() }).join();
         assert_eq!(wanted, got);
 
index 45a86a9fde72c4322eb32eddd73f2a1b04e21451..a2bc28962c39a9ad6b7c38619940c8b49c4445d9 100644 (file)
@@ -101,7 +101,7 @@ pub fn u64_to_le_bytes<T, F>(n: u64, size: uint, f: F) -> T where
         let mut i = size;
         let mut n = n;
         while i > 0 {
-            bytes.push((n & 255_u64) as u8);
+            bytes.push((n & 255) as u8);
             n >>= 8;
             i -= 1;
         }
@@ -170,7 +170,7 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
         panic!("index out of bounds");
     }
 
-    let mut buf = [0u8; 8];
+    let mut buf = [0; 8];
     unsafe {
         let ptr = data.as_ptr().offset(start as int);
         let out = buf.as_mut_ptr();
@@ -522,8 +522,8 @@ macro_rules! u64_from_be_bytes_bench_impl {
         ({
             use super::u64_from_be_bytes;
 
-            let data = (0u8..$stride*100+$start_index).collect::<Vec<_>>();
-            let mut sum = 0u64;
+            let data = (0..$stride*100+$start_index).collect::<Vec<_>>();
+            let mut sum = 0;
             $b.iter(|| {
                 let mut i = $start_index;
                 while i < data.len() {
index 9a34ec4b026398d2674a7d0279091e48cb659f77..afffed2278b8d8f0a41651cb41c6d97ca1e4f23b 100644 (file)
@@ -1166,7 +1166,7 @@ fn file_test_directoryinfo_readdir() {
             check!(w.write(msg));
         }
         let files = check!(readdir(dir));
-        let mut mem = [0u8; 4];
+        let mut mem = [0; 4];
         for f in &files {
             {
                 let n = f.filestem_str();
@@ -1198,7 +1198,7 @@ fn file_test_walk_dir() {
         check!(File::create(&dir2.join("14")));
 
         let mut files = check!(walk_dir(dir));
-        let mut cur = [0u8; 2];
+        let mut cur = [0; 2];
         for f in files {
             let stem = f.filestem_str().unwrap();
             let root = stem.as_bytes()[0] - b'0';
index 728a5dac4e4c9316a8bf2e8211bff2f4436c0641..9ce888efcebed3baef9c0ae75f199b67a1b220aa 100644 (file)
@@ -670,7 +670,7 @@ fn read_to_string(&mut self) -> IoResult<String> {
     fn read_le_uint_n(&mut self, nbytes: uint) -> IoResult<u64> {
         assert!(nbytes > 0 && nbytes <= 8);
 
-        let mut val = 0u64;
+        let mut val = 0;
         let mut pos = 0;
         let mut i = nbytes;
         while i > 0 {
@@ -694,7 +694,7 @@ fn read_le_int_n(&mut self, nbytes: uint) -> IoResult<i64> {
     fn read_be_uint_n(&mut self, nbytes: uint) -> IoResult<u64> {
         assert!(nbytes > 0 && nbytes <= 8);
 
-        let mut val = 0u64;
+        let mut val = 0;
         let mut i = nbytes;
         while i > 0 {
             i -= 1;
@@ -1078,7 +1078,7 @@ fn write_line(&mut self, s: &str) -> IoResult<()> {
     /// Write a single char, encoded as UTF-8.
     #[inline]
     fn write_char(&mut self, c: char) -> IoResult<()> {
-        let mut buf = [0u8; 4];
+        let mut buf = [0; 4];
         let n = c.encode_utf8(&mut buf).unwrap_or(0);
         self.write_all(&buf[..n])
     }
@@ -1896,7 +1896,7 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
     fn test_read_at_least() {
         let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
                                    vec![GoodBehavior(usize::MAX)]);
-        let buf = &mut [0u8; 5];
+        let buf = &mut [0; 5];
         assert!(r.read_at_least(1, buf).unwrap() >= 1);
         assert!(r.read_exact(5).unwrap().len() == 5); // read_exact uses read_at_least
         assert!(r.read_at_least(0, buf).is_ok());
index f1634cd422935db42c534236ab13e3abced87055..6e2f491262dea7f077f6f9653ea63328e65772a6 100644 (file)
@@ -198,7 +198,7 @@ fn parse_digit(c: char, radix: u8) -> Option<u8> {
     }
 
     fn read_number_impl(&mut self, radix: u8, max_digits: u32, upto: u32) -> Option<u32> {
-        let mut r = 0u32;
+        let mut r = 0;
         let mut digit_count = 0;
         loop {
             match self.read_digit(radix) {
@@ -226,7 +226,7 @@ fn read_number(&mut self, radix: u8, max_digits: u32, upto: u32) -> Option<u32>
     }
 
     fn read_ipv4_addr_impl(&mut self) -> Option<IpAddr> {
-        let mut bs = [0u8; 4];
+        let mut bs = [0; 4];
         let mut i = 0;
         while i < 4 {
             if i != 0 && self.read_given_char('.').is_none() {
@@ -251,7 +251,7 @@ fn read_ipv4_addr(&mut self) -> Option<IpAddr> {
     fn read_ipv6_addr_impl(&mut self) -> Option<IpAddr> {
         fn ipv6_addr_from_head_tail(head: &[u16], tail: &[u16]) -> IpAddr {
             assert!(head.len() + tail.len() <= 8);
-            let mut gs = [0u16; 8];
+            let mut gs = [0; 8];
             gs.clone_from_slice(head);
             gs[(8 - tail.len()) .. 8].clone_from_slice(tail);
             Ipv6Addr(gs[0], gs[1], gs[2], gs[3], gs[4], gs[5], gs[6], gs[7])
@@ -294,7 +294,7 @@ fn ipv6_addr_from_head_tail(head: &[u16], tail: &[u16]) -> IpAddr {
             (i, false)
         }
 
-        let mut head = [0u16; 8];
+        let mut head = [0; 8];
         let (head_size, head_ipv4) = read_groups(self, &mut head, 8);
 
         if head_size == 8 {
@@ -313,7 +313,7 @@ fn ipv6_addr_from_head_tail(head: &[u16], tail: &[u16]) -> IpAddr {
             return None;
         }
 
-        let mut tail = [0u16; 8];
+        let mut tail = [0; 8];
         let (tail_size, _) = read_groups(self, &mut tail, 8 - head_size);
         Some(ipv6_addr_from_head_tail(&head[..head_size], &tail[..tail_size]))
     }
@@ -425,17 +425,17 @@ fn from_str(s: &str) -> Result<SocketAddr, ParseError> {
 ///     // The following lines are equivalent modulo possible "localhost" name resolution
 ///     // differences
 ///     let tcp_s = TcpStream::connect(SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 12345 });
-///     let tcp_s = TcpStream::connect((Ipv4Addr(127, 0, 0, 1), 12345u16));
-///     let tcp_s = TcpStream::connect(("127.0.0.1", 12345u16));
-///     let tcp_s = TcpStream::connect(("localhost", 12345u16));
+///     let tcp_s = TcpStream::connect((Ipv4Addr(127, 0, 0, 1), 12345));
+///     let tcp_s = TcpStream::connect(("127.0.0.1", 12345));
+///     let tcp_s = TcpStream::connect(("localhost", 12345));
 ///     let tcp_s = TcpStream::connect("127.0.0.1:12345");
 ///     let tcp_s = TcpStream::connect("localhost:12345");
 ///
 ///     // TcpListener::bind(), UdpSocket::bind() and UdpSocket::send_to() behave similarly
 ///     let tcp_l = TcpListener::bind("localhost:12345");
 ///
-///     let mut udp_s = UdpSocket::bind(("127.0.0.1", 23451u16)).unwrap();
-///     udp_s.send_to([7u8, 7u8, 7u8].as_slice(), (Ipv4Addr(127, 0, 0, 1), 23451u16));
+///     let mut udp_s = UdpSocket::bind(("127.0.0.1", 23451)).unwrap();
+///     udp_s.send_to([7, 7, 7].as_slice(), (Ipv4Addr(127, 0, 0, 1), 23451));
 /// }
 /// ```
 pub trait ToSocketAddr {
@@ -674,7 +674,7 @@ fn to_socket_addr_socketaddr() {
     #[test]
     fn to_socket_addr_ipaddr_u16() {
         let a = Ipv4Addr(77, 88, 21, 11);
-        let p = 12345u16;
+        let p = 12345;
         let e = SocketAddr { ip: a, port: p };
         assert_eq!(Ok(e), (a, p).to_socket_addr());
         assert_eq!(Ok(vec![e]), (a, p).to_socket_addr_all());
@@ -683,15 +683,15 @@ fn to_socket_addr_ipaddr_u16() {
     #[test]
     fn to_socket_addr_str_u16() {
         let a = SocketAddr { ip: Ipv4Addr(77, 88, 21, 11), port: 24352 };
-        assert_eq!(Ok(a), ("77.88.21.11", 24352u16).to_socket_addr());
-        assert_eq!(Ok(vec![a]), ("77.88.21.11", 24352u16).to_socket_addr_all());
+        assert_eq!(Ok(a), ("77.88.21.11", 24352).to_socket_addr());
+        assert_eq!(Ok(vec![a]), ("77.88.21.11", 24352).to_socket_addr_all());
 
         let a = SocketAddr { ip: Ipv6Addr(0x2a02, 0x6b8, 0, 1, 0, 0, 0, 1), port: 53 };
         assert_eq!(Ok(a), ("2a02:6b8:0:1::1", 53).to_socket_addr());
         assert_eq!(Ok(vec![a]), ("2a02:6b8:0:1::1", 53).to_socket_addr_all());
 
         let a = SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 23924 };
-        assert!(("localhost", 23924u16).to_socket_addr_all().unwrap().contains(&a));
+        assert!(("localhost", 23924).to_socket_addr_all().unwrap().contains(&a));
     }
 
     #[test]
index 19a6f6e3defa7be42a677cea30cfdc75df58081d..73ef21fa3aa9609703011a3078862eb588a3bfe4 100644 (file)
@@ -1162,7 +1162,7 @@ fn accept_timeout() {
                 tx.send(TcpStream::connect(addr).unwrap()).unwrap();
             });
             let _l = rx.recv().unwrap();
-            for i in 0i32..1001 {
+            for i in 0..1001 {
                 match a.accept() {
                     Ok(..) => break,
                     Err(ref e) if e.kind == TimedOut => {}
@@ -1262,7 +1262,7 @@ fn readwrite_timeouts() {
         assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut);
 
         s.set_timeout(Some(20));
-        for i in 0i32..1001 {
+        for i in 0..1001 {
             match s.write(&[0; 128 * 1024]) {
                 Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
                 Err(IoError { kind: TimedOut, .. }) => break,
@@ -1320,7 +1320,7 @@ fn write_timeouts() {
 
         let mut s = a.accept().unwrap();
         s.set_write_timeout(Some(20));
-        for i in 0i32..1001 {
+        for i in 0..1001 {
             match s.write(&[0; 128 * 1024]) {
                 Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
                 Err(IoError { kind: TimedOut, .. }) => break,
index a13295b1ccb5014ea8137156559b628cca769547..e02e863516ab1ebdddcea006f24af713076c48ae 100644 (file)
@@ -11,6 +11,9 @@
 //! Bindings for executing child processes
 
 #![allow(non_upper_case_globals)]
+#![unstable(feature = "old_io")]
+#![deprecated(since = "1.0.0",
+              reason = "replaced with the std::process module")]
 
 pub use self::StdioContainer::*;
 pub use self::ProcessExit::*;
index 43c0b9268a242d065cc90b9c53c0a71a3207cb9c..9fbdac84a80dbc79e5fad48372ec75072a92df14 100644 (file)
@@ -73,8 +73,8 @@ pub fn next_test_ip6() -> SocketAddr {
 */
 fn base_port() -> u16 {
 
-    let base = 9600u16;
-    let range = 1000u16;
+    let base = 9600;
+    let range = 1000;
 
     let bases = [
         ("32-opt", base + range * 1),
index 8e49335ed5469e110114ab9823866d113903e071..4faf8af57b4c4392da158935f543aa28436e15ef 100644 (file)
@@ -10,6 +10,8 @@
 
 //! Utility implementations of Reader and Writer
 
+#![allow(deprecated)]
+
 use prelude::v1::*;
 use cmp;
 use old_io;
 
 /// Wraps a `Reader`, limiting the number of bytes that can be read from it.
 #[derive(Debug)]
+#[deprecated(since = "1.0.0", reason = "use std::io::Take")]
+#[unstable(feature = "old_io")]
 pub struct LimitReader<R> {
     limit: uint,
     inner: R
 }
 
+#[deprecated(since = "1.0.0", reason = "use std::io::Take")]
+#[unstable(feature = "old_io")]
 impl<R: Reader> LimitReader<R> {
     /// Creates a new `LimitReader`
+    #[deprecated(since = "1.0.0", reason = "use std::io's take method instead")]
+    #[unstable(feature = "old_io")]
     pub fn new(r: R, limit: uint) -> LimitReader<R> {
         LimitReader { limit: limit, inner: r }
     }
@@ -41,6 +49,8 @@ pub fn into_inner(self) -> R { self.inner }
     pub fn limit(&self) -> uint { self.limit }
 }
 
+#[deprecated(since = "1.0.0", reason = "use std::io's take method instead")]
+#[unstable(feature = "old_io")]
 impl<R: Reader> Reader for LimitReader<R> {
     fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
         if self.limit == 0 {
@@ -57,6 +67,8 @@ fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
     }
 }
 
+#[deprecated(since = "1.0.0", reason = "use std::io's take method instead")]
+#[unstable(feature = "old_io")]
 impl<R: Buffer> Buffer for LimitReader<R> {
     fn fill_buf<'a>(&'a mut self) -> old_io::IoResult<&'a [u8]> {
         let amt = try!(self.inner.fill_buf());
@@ -79,8 +91,12 @@ fn consume(&mut self, amt: uint) {
 
 /// A `Writer` which ignores bytes written to it, like /dev/null.
 #[derive(Copy, Debug)]
+#[deprecated(since = "1.0.0", reason = "use std::io::sink() instead")]
+#[unstable(feature = "old_io")]
 pub struct NullWriter;
 
+#[deprecated(since = "1.0.0", reason = "use std::io::sink() instead")]
+#[unstable(feature = "old_io")]
 impl Writer for NullWriter {
     #[inline]
     fn write_all(&mut self, _buf: &[u8]) -> old_io::IoResult<()> { Ok(()) }
@@ -88,8 +104,12 @@ fn write_all(&mut self, _buf: &[u8]) -> old_io::IoResult<()> { Ok(()) }
 
 /// A `Reader` which returns an infinite stream of 0 bytes, like /dev/zero.
 #[derive(Copy, Debug)]
+#[deprecated(since = "1.0.0", reason = "use std::io::repeat(0) instead")]
+#[unstable(feature = "old_io")]
 pub struct ZeroReader;
 
+#[deprecated(since = "1.0.0", reason = "use std::io::repeat(0) instead")]
+#[unstable(feature = "old_io")]
 impl Reader for ZeroReader {
     #[inline]
     fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
@@ -98,6 +118,8 @@ fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
     }
 }
 
+#[deprecated(since = "1.0.0", reason = "use std::io::repeat(0) instead")]
+#[unstable(feature = "old_io")]
 impl Buffer for ZeroReader {
     fn fill_buf<'a>(&'a mut self) -> old_io::IoResult<&'a [u8]> {
         static DATA: [u8; 64] = [0; 64];
@@ -109,8 +131,12 @@ fn consume(&mut self, _amt: uint) {}
 
 /// A `Reader` which is always at EOF, like /dev/null.
 #[derive(Copy, Debug)]
+#[deprecated(since = "1.0.0", reason = "use std::io::empty() instead")]
+#[unstable(feature = "old_io")]
 pub struct NullReader;
 
+#[deprecated(since = "1.0.0", reason = "use std::io::empty() instead")]
+#[unstable(feature = "old_io")]
 impl Reader for NullReader {
     #[inline]
     fn read(&mut self, _buf: &mut [u8]) -> old_io::IoResult<uint> {
@@ -118,6 +144,8 @@ fn read(&mut self, _buf: &mut [u8]) -> old_io::IoResult<uint> {
     }
 }
 
+#[deprecated(since = "1.0.0", reason = "use std::io::empty() instead")]
+#[unstable(feature = "old_io")]
 impl Buffer for NullReader {
     fn fill_buf<'a>(&'a mut self) -> old_io::IoResult<&'a [u8]> {
         Err(old_io::standard_error(old_io::EndOfFile))
@@ -130,17 +158,23 @@ fn consume(&mut self, _amt: uint) {}
 /// The `Writer`s are delegated to in order. If any `Writer` returns an error,
 /// that error is returned immediately and remaining `Writer`s are not called.
 #[derive(Debug)]
+#[deprecated(since = "1.0.0", reason = "use std::io::Broadcast instead")]
+#[unstable(feature = "old_io")]
 pub struct MultiWriter<W> {
     writers: Vec<W>
 }
 
 impl<W> MultiWriter<W> where W: Writer {
     /// Creates a new `MultiWriter`
+    #[deprecated(since = "1.0.0", reason = "use std::io's broadcast method instead")]
+    #[unstable(feature = "old_io")]
     pub fn new(writers: Vec<W>) -> MultiWriter<W> {
         MultiWriter { writers: writers }
     }
 }
 
+#[deprecated(since = "1.0.0", reason = "use std::io::Broadcast instead")]
+#[unstable(feature = "old_io")]
 impl<W> Writer for MultiWriter<W> where W: Writer {
     #[inline]
     fn write_all(&mut self, buf: &[u8]) -> old_io::IoResult<()> {
@@ -162,6 +196,8 @@ fn flush(&mut self) -> old_io::IoResult<()> {
 /// A `Reader` which chains input from multiple `Reader`s, reading each to
 /// completion before moving onto the next.
 #[derive(Clone, Debug)]
+#[deprecated(since = "1.0.0", reason = "use std::io::Chain instead")]
+#[unstable(feature = "old_io")]
 pub struct ChainedReader<I, R> {
     readers: I,
     cur_reader: Option<R>,
@@ -169,12 +205,16 @@ pub struct ChainedReader<I, R> {
 
 impl<R: Reader, I: Iterator<Item=R>> ChainedReader<I, R> {
     /// Creates a new `ChainedReader`
+    #[deprecated(since = "1.0.0", reason = "use std::io's chain method instead")]
+    #[unstable(feature = "old_io")]
     pub fn new(mut readers: I) -> ChainedReader<I, R> {
         let r = readers.next();
         ChainedReader { readers: readers, cur_reader: r }
     }
 }
 
+#[deprecated(since = "1.0.0", reason = "use std::io::Chain instead")]
+#[unstable(feature = "old_io")]
 impl<R: Reader, I: Iterator<Item=R>> Reader for ChainedReader<I, R> {
     fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
         loop {
@@ -201,13 +241,19 @@ fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
 /// A `Reader` which forwards input from another `Reader`, passing it along to
 /// a `Writer` as well. Similar to the `tee(1)` command.
 #[derive(Debug)]
+#[deprecated(since = "1.0.0", reason = "use std::io::Tee instead")]
+#[unstable(feature = "old_io")]
 pub struct TeeReader<R, W> {
     reader: R,
     writer: W,
 }
 
+#[deprecated(since = "1.0.0", reason = "use std::io::Tee instead")]
+#[unstable(feature = "old_io")]
 impl<R: Reader, W: Writer> TeeReader<R, W> {
     /// Creates a new `TeeReader`
+    #[deprecated(since = "1.0.0", reason = "use std::io's tee method instead")]
+    #[unstable(feature = "old_io")]
     pub fn new(r: R, w: W) -> TeeReader<R, W> {
         TeeReader { reader: r, writer: w }
     }
@@ -220,6 +266,8 @@ pub fn into_inner(self) -> (R, W) {
     }
 }
 
+#[deprecated(since = "1.0.0", reason = "use std::io::Tee instead")]
+#[unstable(feature = "old_io")]
 impl<R: Reader, W: Writer> Reader for TeeReader<R, W> {
     fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
         self.reader.read(buf).and_then(|len| {
@@ -229,6 +277,8 @@ fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
 }
 
 /// Copies all data from a `Reader` to a `Writer`.
+#[deprecated(since = "1.0.0", reason = "use std::io's copy function instead")]
+#[unstable(feature = "old_io")]
 pub fn copy<R: Reader, W: Writer>(r: &mut R, w: &mut W) -> old_io::IoResult<()> {
     let mut buf = [0; super::DEFAULT_BUF_SIZE];
     loop {
@@ -418,7 +468,7 @@ fn limit_reader_buffer() {
 
     #[test]
     fn test_iter_reader() {
-        let mut r = IterReader::new(0u8..8);
+        let mut r = IterReader::new(0..8);
         let mut buf = [0, 0, 0];
         let len = r.read(&mut buf).unwrap();
         assert_eq!(len, 3);
@@ -437,7 +487,7 @@ fn test_iter_reader() {
 
     #[test]
     fn iter_reader_zero_length() {
-        let mut r = IterReader::new(0u8..8);
+        let mut r = IterReader::new(0..8);
         let mut buf = [];
         assert_eq!(Ok(0), r.read(&mut buf));
     }
index a49db0128824097ba843f8632c311066e449b51c..4ed1520ed03f60181a2651d83287e4a3baf46ebe 100644 (file)
@@ -468,7 +468,7 @@ fn test_fill_bytes_default() {
         let lengths = [0, 1, 2, 3, 4, 5, 6, 7,
                        80, 81, 82, 83, 84, 85, 86, 87];
         for &n in &lengths {
-            let mut v = repeat(0u8).take(n).collect::<Vec<_>>();
+            let mut v = repeat(0).take(n).collect::<Vec<_>>();
             r.fill_bytes(&mut v);
 
             // use this to get nicer error messages.
index c2ead2675787b9ec08169ae371c28c0fd84a0f3d..6cb3eb4d16e613a4102bbe5fadcdd28d927521fb 100644 (file)
@@ -80,13 +80,13 @@ fn getrandom_fill_bytes(v: &mut [u8]) {
     }
 
     fn getrandom_next_u32() -> u32 {
-        let mut buf: [u8; 4] = [0u8; 4];
+        let mut buf: [u8; 4] = [0; 4];
         getrandom_fill_bytes(&mut buf);
         unsafe { mem::transmute::<[u8; 4], u32>(buf) }
     }
 
     fn getrandom_next_u64() -> u64 {
-        let mut buf: [u8; 8] = [0u8; 8];
+        let mut buf: [u8; 8] = [0; 8];
         getrandom_fill_bytes(&mut buf);
         unsafe { mem::transmute::<[u8; 8], u64>(buf) }
     }
@@ -231,12 +231,12 @@ pub fn new() -> IoResult<OsRng> {
 
     impl Rng for OsRng {
         fn next_u32(&mut self) -> u32 {
-            let mut v = [0u8; 4];
+            let mut v = [0; 4];
             self.fill_bytes(&mut v);
             unsafe { mem::transmute(v) }
         }
         fn next_u64(&mut self) -> u64 {
-            let mut v = [0u8; 8];
+            let mut v = [0; 8];
             self.fill_bytes(&mut v);
             unsafe { mem::transmute(v) }
         }
@@ -318,12 +318,12 @@ pub fn new() -> IoResult<OsRng> {
 
     impl Rng for OsRng {
         fn next_u32(&mut self) -> u32 {
-            let mut v = [0u8; 4];
+            let mut v = [0; 4];
             self.fill_bytes(&mut v);
             unsafe { mem::transmute(v) }
         }
         fn next_u64(&mut self) -> u64 {
-            let mut v = [0u8; 8];
+            let mut v = [0; 8];
             self.fill_bytes(&mut v);
             unsafe { mem::transmute(v) }
         }
@@ -366,7 +366,7 @@ fn test_os_rng() {
         r.next_u32();
         r.next_u64();
 
-        let mut v = [0u8; 1000];
+        let mut v = [0; 1000];
         r.fill_bytes(&mut v);
     }
 
@@ -386,7 +386,7 @@ fn test_os_rng_tasks() {
                 // as possible (XXX: is this a good test?)
                 let mut r = OsRng::new().unwrap();
                 thread::yield_now();
-                let mut v = [0u8; 1000];
+                let mut v = [0; 1000];
 
                 for _ in 0..100 {
                     r.next_u32();
index b71e8b4fd61e8dadebd3d9fa754e559b23ee4532..ba1ebc2ab227556ce7eb023ae972c85aff5b93ee 100644 (file)
@@ -84,28 +84,28 @@ mod test {
     #[test]
     fn test_reader_rng_u64() {
         // transmute from the target to avoid endianness concerns.
-        let v = vec![0u8, 0, 0, 0, 0, 0, 0, 1,
+        let v = vec![0, 0, 0, 0, 0, 0, 0, 1,
                      0  , 0, 0, 0, 0, 0, 0, 2,
                      0,   0, 0, 0, 0, 0, 0, 3];
         let mut rng = ReaderRng::new(MemReader::new(v));
 
-        assert_eq!(rng.next_u64(), 1_u64.to_be());
-        assert_eq!(rng.next_u64(), 2_u64.to_be());
-        assert_eq!(rng.next_u64(), 3_u64.to_be());
+        assert_eq!(rng.next_u64(), 1.to_be());
+        assert_eq!(rng.next_u64(), 2.to_be());
+        assert_eq!(rng.next_u64(), 3.to_be());
     }
     #[test]
     fn test_reader_rng_u32() {
-        let v = vec![0u8, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3];
+        let v = vec![0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3];
         let mut rng = ReaderRng::new(MemReader::new(v));
 
-        assert_eq!(rng.next_u32(), 1_u32.to_be());
-        assert_eq!(rng.next_u32(), 2_u32.to_be());
-        assert_eq!(rng.next_u32(), 3_u32.to_be());
+        assert_eq!(rng.next_u32(), 1.to_be());
+        assert_eq!(rng.next_u32(), 2.to_be());
+        assert_eq!(rng.next_u32(), 3.to_be());
     }
     #[test]
     fn test_reader_rng_fill_bytes() {
-        let v = [1u8, 2, 3, 4, 5, 6, 7, 8];
-        let mut w = [0u8; 8];
+        let v = [1, 2, 3, 4, 5, 6, 7, 8];
+        let mut w = [0; 8];
 
         let mut rng = ReaderRng::new(MemReader::new(v.to_vec()));
         rng.fill_bytes(&mut w);
@@ -117,7 +117,7 @@ fn test_reader_rng_fill_bytes() {
     #[should_fail]
     fn test_reader_rng_insufficient_bytes() {
         let mut rng = ReaderRng::new(MemReader::new(vec!()));
-        let mut v = [0u8; 3];
+        let mut v = [0; 3];
         rng.fill_bytes(&mut v);
     }
 }
index a304f1f844d748f8f263fc73db78d984ec38bbe9..dc55740315349b56c87d4042f3e209e81050c34b 100644 (file)
@@ -139,7 +139,7 @@ fn write_str(&mut self, bytes: &str) -> fmt::Result {
     }
 
     // Convert the arguments into a stack-allocated string
-    let mut msg = [0u8; 512];
+    let mut msg = [0; 512];
     let mut w = BufWriter { buf: &mut msg, pos: 0 };
     let _ = write!(&mut w, "{}", args);
     let msg = str::from_utf8(&w.buf[..w.pos]).unwrap_or("aborted");
index 27b8784e3943a6a46320fbddc45c6ee8066d88da..91de2662883f8ce6aa717b326fd6ddccbf954897 100644 (file)
@@ -55,6 +55,7 @@
 //! ```
 
 #![allow(non_camel_case_types)]
+#![unstable(feature = "thread_local_internals")]
 
 use prelude::v1::*;
 
 ///     KEY.set(1 as *mut u8);
 /// }
 /// ```
-#[stable(feature = "rust1", since = "1.0.0")]
 pub struct StaticKey {
     /// Inner static TLS key (internals), created with by `INIT_INNER` in this
     /// module.
-    #[stable(feature = "rust1", since = "1.0.0")]
     pub inner: StaticKeyInner,
     /// Destructor for the TLS value.
     ///
     /// See `Key::new` for information about when the destructor runs and how
     /// it runs.
-    #[stable(feature = "rust1", since = "1.0.0")]
     pub dtor: Option<unsafe extern fn(*mut u8)>,
 }
 
@@ -131,7 +129,6 @@ pub struct Key {
 /// Constant initialization value for static TLS keys.
 ///
 /// This value specifies no destructor by default.
-#[stable(feature = "rust1", since = "1.0.0")]
 pub const INIT: StaticKey = StaticKey {
     inner: INIT_INNER,
     dtor: None,
@@ -140,7 +137,6 @@ pub struct Key {
 /// Constant initialization value for the inner part of static TLS keys.
 ///
 /// This value allows specific configuration of the destructor for a TLS key.
-#[stable(feature = "rust1", since = "1.0.0")]
 pub const INIT_INNER: StaticKeyInner = StaticKeyInner {
     key: atomic::ATOMIC_USIZE_INIT,
 };
index 31bdaee1e346acc2b9056fb5f9a5f546766a944e..719c74179ac23690bc360f5bf59e4a7e6c7784c0 100644 (file)
@@ -714,7 +714,7 @@ pub fn is_code_point_boundary(slice: &Wtf8, index: uint) -> bool {
     if index == slice.len() { return true; }
     match slice.bytes.get(index) {
         None => false,
-        Some(&b) => b < 128u8 || b >= 192u8,
+        Some(&b) => b < 128 || b >= 192,
     }
 }
 
@@ -776,7 +776,7 @@ fn next(&mut self) -> Option<u16> {
             return Some(tmp);
         }
 
-        let mut buf = [0u16; 2];
+        let mut buf = [0; 2];
         self.code_points.next().map(|code_point| {
             let n = encode_utf16_raw(code_point.value, &mut buf)
                 .unwrap_or(0);
index 71b6214460f4b9550926f95e1488fe2dd73519a1..3d490380bfd61bdce3a33673c7f257887ba0e374 100644 (file)
@@ -389,7 +389,7 @@ fn test_file_desc() {
         let mut writer = FileDesc::new(writer, true);
 
         writer.write(b"test").ok().unwrap();
-        let mut buf = [0u8; 4];
+        let mut buf = [0; 4];
         match reader.read(&mut buf) {
             Ok(4) => {
                 assert_eq!(buf[0], 't' as u8);
index 68c5c65e7cdb11cfac9bf64ff25732d8efbba32b..62a1799de94c938fe0c3ef9f94ef6632323bff86 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(deprecated)]
+
 use prelude::v1::*;
 use self::Req::*;
 
index 53a037ef07e613a15f30a4e926567078359d4595..ca3ed54eb036a4b2e55e11235fe21d63086dfbfb 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(deprecated)]
+
 use prelude::v1::*;
 
 use collections;
index 9be77e78ed1f3cb910a7fb5f542fba12b162e542..0ce3ca1f97ac8896abf350a06c1eef61ce972e6d 100644 (file)
@@ -901,7 +901,7 @@ fn test_try_panic_message_any() {
                 assert!(e.is::<T>());
                 let any = e.downcast::<T>().ok().unwrap();
                 assert!(any.is::<u16>());
-                assert_eq!(*any.downcast::<u16>().ok().unwrap(), 413u16);
+                assert_eq!(*any.downcast::<u16>().ok().unwrap(), 413);
             }
             Ok(()) => panic!()
         }
index 764c7d730cb0e448d4c20c390c08769e3624fa49..6bba73420d8512cd7b7c563230941ec171792d5b 100644 (file)
@@ -45,7 +45,7 @@
 
 // Sure wish we had macro hygiene, no?
 #[doc(hidden)]
-#[stable(feature = "rust1", since = "1.0.0")]
+#[unstable(feature = "thread_local_internals")]
 pub mod __impl {
     pub use super::imp::Key as KeyInner;
     pub use super::imp::destroy_value;
@@ -117,6 +117,7 @@ pub struct Key<T> {
 /// Declare a new thread local storage key of type `std::thread_local::Key`.
 #[macro_export]
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow_internal_unstable]
 macro_rules! thread_local {
     (static $name:ident: $t:ty = $init:expr) => (
         static $name: ::std::thread_local::Key<$t> = {
@@ -176,6 +177,7 @@ fn __getit() -> &'static __KeyInner<__UnsafeCell<__Option<$t>>> {
 
 #[macro_export]
 #[doc(hidden)]
+#[allow_internal_unstable]
 macro_rules! __thread_local_inner {
     (static $name:ident: $t:ty = $init:expr) => (
         #[cfg_attr(all(any(target_os = "macos", target_os = "linux"),
@@ -337,7 +339,7 @@ mod imp {
     use ptr;
 
     #[doc(hidden)]
-    #[stable(since = "1.0.0", feature = "rust1")]
+    #[unstable(feature = "thread_local_internals")]
     pub struct Key<T> {
         // Place the inner bits in an `UnsafeCell` to currently get around the
         // "only Sync statics" restriction. This allows any type to be placed in
@@ -345,14 +347,14 @@ pub struct Key<T> {
         //
         // Note that all access requires `T: 'static` so it can't be a type with
         // any borrowed pointers still.
-        #[stable(since = "1.0.0", feature = "rust1")]
+        #[unstable(feature = "thread_local_internals")]
         pub inner: UnsafeCell<T>,
 
         // Metadata to keep track of the state of the destructor. Remember that
         // these variables are thread-local, not global.
-        #[stable(since = "1.0.0", feature = "rust1")]
+        #[unstable(feature = "thread_local_internals")]
         pub dtor_registered: UnsafeCell<bool>, // should be Cell
-        #[stable(since = "1.0.0", feature = "rust1")]
+        #[unstable(feature = "thread_local_internals")]
         pub dtor_running: UnsafeCell<bool>, // should be Cell
     }
 
@@ -455,7 +457,7 @@ fn _tlv_atexit(dtor: unsafe extern fn(*mut u8),
     }
 
     #[doc(hidden)]
-    #[stable(feature = "rust1", since = "1.0.0")]
+    #[unstable(feature = "thread_local_internals")]
     pub unsafe extern fn destroy_value<T>(ptr: *mut u8) {
         let ptr = ptr as *mut Key<T>;
         // Right before we run the user destructor be sure to flag the
@@ -477,15 +479,15 @@ mod imp {
     use sys_common::thread_local::StaticKey as OsStaticKey;
 
     #[doc(hidden)]
-    #[stable(since = "1.0.0", feature = "rust1")]
+    #[unstable(feature = "thread_local_internals")]
     pub struct Key<T> {
         // Statically allocated initialization expression, using an `UnsafeCell`
         // for the same reasons as above.
-        #[stable(since = "1.0.0", feature = "rust1")]
+        #[unstable(feature = "thread_local_internals")]
         pub inner: UnsafeCell<T>,
 
         // OS-TLS key that we'll use to key off.
-        #[stable(since = "1.0.0", feature = "rust1")]
+        #[unstable(feature = "thread_local_internals")]
         pub os: OsStaticKey,
     }
 
@@ -528,7 +530,7 @@ unsafe fn ptr(&'static self) -> Option<*mut T> {
     }
 
     #[doc(hidden)]
-    #[stable(feature = "rust1", since = "1.0.0")]
+    #[unstable(feature = "thread_local_internals")]
     pub unsafe extern fn destroy_value<T: 'static>(ptr: *mut u8) {
         // The OS TLS ensures that this key contains a NULL value when this
         // destructor starts to run. We set it back to a sentinel value of 1 to
index d89d69e9497167e9fdddedcc25da927de7411616..a5339568e9ef69088cce9f97f73686c4ad6a9a0e 100644 (file)
@@ -65,6 +65,7 @@ pub struct Key<T> { #[doc(hidden)] pub inner: __impl::KeyInner<T> }
 /// This macro declares a `static` item on which methods are used to get and
 /// set the value stored within.
 #[macro_export]
+#[allow_internal_unstable]
 macro_rules! scoped_thread_local {
     (static $name:ident: $t:ty) => (
         __scoped_thread_local_inner!(static $name: $t);
@@ -76,6 +77,7 @@ macro_rules! scoped_thread_local {
 
 #[macro_export]
 #[doc(hidden)]
+#[allow_internal_unstable]
 macro_rules! __scoped_thread_local_inner {
     (static $name:ident: $t:ty) => (
         #[cfg_attr(not(any(windows,
index 42ef3459a0ed7cf931f191e300a7940ca87b21e9..958417d864c1fa7b477975d0f287d9ba2bb0b088 100644 (file)
@@ -68,7 +68,7 @@ pub struct Duration {
 
 impl Duration {
     /// Makes a new `Duration` with given number of weeks.
-    /// Equivalent to `Duration::seconds(weeks * 7 * 24 * 60 * 60), with overflow checks.
+    /// Equivalent to `Duration::seconds(weeks * 7 * 24 * 60 * 60)` with overflow checks.
     /// Panics when the duration is out of bounds.
     #[inline]
     #[unstable(feature = "std_misc")]
index 988b13cd160462b42fa62200dcc8fac8663d7005..41b70889c9f276f96735a7d473b56960bb8f64dd 100644 (file)
@@ -53,7 +53,7 @@
 //! assert!(b == c);
 //!
 //! let d : (u32, f32) = Default::default();
-//! assert_eq!(d, (0u32, 0.0f32));
+//! assert_eq!(d, (0, 0.0f32));
 //! ```
 
 #![doc(primitive = "tuple")]
index 05348ee77e81f24d7f6c3cd45fb01d54ee2b4d1f..b41eb05ded695041108291b4d5b63935bb6c96d7 100644 (file)
@@ -1743,6 +1743,7 @@ pub struct MacroDef {
     pub imported_from: Option<Ident>,
     pub export: bool,
     pub use_locally: bool,
+    pub allow_internal_unstable: bool,
     pub body: Vec<TokenTree>,
 }
 
index 264e05f5c8d31ec1229b01ff6f6c39c0316b97ab..26d7562cdb2d4c4c408fc71d12ee5021a8c38a7a 100644 (file)
@@ -159,10 +159,10 @@ pub fn int_ty_to_string(t: IntTy, val: Option<i64>) -> String {
 
 pub fn int_ty_max(t: IntTy) -> u64 {
     match t {
-        TyI8 => 0x80u64,
-        TyI16 => 0x8000u64,
-        TyIs(_) | TyI32 => 0x80000000u64, // actually ni about TyIs
-        TyI64 => 0x8000000000000000u64
+        TyI8 => 0x80,
+        TyI16 => 0x8000,
+        TyIs(_) | TyI32 => 0x80000000, // actually ni about TyIs
+        TyI64 => 0x8000000000000000
     }
 }
 
@@ -185,10 +185,10 @@ pub fn uint_ty_to_string(t: UintTy, val: Option<u64>) -> String {
 
 pub fn uint_ty_max(t: UintTy) -> u64 {
     match t {
-        TyU8 => 0xffu64,
-        TyU16 => 0xffffu64,
-        TyUs(_) | TyU32 => 0xffffffffu64, // actually ni about TyUs
-        TyU64 => 0xffffffffffffffffu64
+        TyU8 => 0xff,
+        TyU16 => 0xffff,
+        TyUs(_) | TyU32 => 0xffffffff, // actually ni about TyUs
+        TyU64 => 0xffffffffffffffff
     }
 }
 
index 162da2ac54c12ee111e380302ce5b430a60332a9..44df8a6d3daec74139a3b91e3aa234ebf4da2a1d 100644 (file)
@@ -243,6 +243,10 @@ pub struct NameAndSpan {
     pub name: String,
     /// The format with which the macro was invoked.
     pub format: MacroFormat,
+    /// Whether the macro is allowed to use #[unstable]/feature-gated
+    /// features internally without forcing the whole crate to opt-in
+    /// to them.
+    pub allow_internal_unstable: bool,
     /// The span of the macro definition itself. The macro may not
     /// have a sensible definition span (e.g. something defined
     /// completely inside libsyntax) in which case this is None.
@@ -830,41 +834,43 @@ pub fn with_expn_info<T, F>(&self, id: ExpnId, f: F) -> T where
         }
     }
 
-    /// Check if a span is "internal" to a macro. This means that it is entirely generated by a
-    /// macro expansion and contains no code that was passed in as an argument.
-    pub fn span_is_internal(&self, span: Span) -> bool {
-        // first, check if the given expression was generated by a macro or not
-        // we need to go back the expn_info tree to check only the arguments
-        // of the initial macro call, not the nested ones.
-        let mut is_internal = false;
-        let mut expnid = span.expn_id;
-        while self.with_expn_info(expnid, |expninfo| {
-            match expninfo {
-                Some(ref info) => {
-                    // save the parent expn_id for next loop iteration
-                    expnid = info.call_site.expn_id;
-                    if info.callee.name == "format_args" {
-                        // This is a hack because the format_args builtin calls unstable APIs.
-                        // I spent like 6 hours trying to solve this more generally but am stupid.
-                        is_internal = true;
-                        false
-                    } else if info.callee.span.is_none() {
-                        // it's a compiler built-in, we *really* don't want to mess with it
-                        // so we skip it, unless it was called by a regular macro, in which case
-                        // we will handle the caller macro next turn
-                        is_internal = true;
-                        true // continue looping
+    /// Check if a span is "internal" to a macro in which #[unstable]
+    /// items can be used (that is, a macro marked with
+    /// `#[allow_internal_unstable]`).
+    pub fn span_allows_unstable(&self, span: Span) -> bool {
+        debug!("span_allows_unstable(span = {:?})", span);
+        let mut allows_unstable = false;
+        let mut expn_id = span.expn_id;
+        loop {
+            let quit = self.with_expn_info(expn_id, |expninfo| {
+                debug!("span_allows_unstable: expninfo = {:?}", expninfo);
+                expninfo.map_or(/* hit the top level */ true, |info| {
+
+                    let span_comes_from_this_expansion =
+                        info.callee.span.map_or(span == info.call_site, |mac_span| {
+                            mac_span.lo <= span.lo && span.hi < mac_span.hi
+                        });
+
+                    debug!("span_allows_unstable: from this expansion? {}, allows unstable? {}",
+                           span_comes_from_this_expansion,
+                           info.callee.allow_internal_unstable);
+                    if span_comes_from_this_expansion {
+                        allows_unstable = info.callee.allow_internal_unstable;
+                        // we've found the right place, stop looking
+                        true
                     } else {
-                        // was this expression from the current macro arguments ?
-                        is_internal = !( span.lo > info.call_site.lo &&
-                                         span.hi < info.call_site.hi );
-                        true // continue looping
+                        // not the right place, keep looking
+                        expn_id = info.call_site.expn_id;
+                        false
                     }
-                },
-                _ => false // stop looping
+                })
+            });
+            if quit {
+                break
             }
-        }) { /* empty while loop body */ }
-        return is_internal;
+        }
+        debug!("span_allows_unstable? {}", allows_unstable);
+        allows_unstable
     }
 }
 
index 54689a1f77ad2dddcb9e6fa96bdff67b0de08e53..055ade46a3f01ab482ce08674ca5cb0eb9462f1b 100644 (file)
@@ -52,6 +52,13 @@ macro_rules! span_help {
     })
 }
 
+#[macro_export]
+macro_rules! fileline_help {
+    ($session:expr, $span:expr, $($message:tt)*) => ({
+        ($session).fileline_help($span, &format!($($message)*))
+    })
+}
+
 #[macro_export]
 macro_rules! register_diagnostics {
     ($($code:tt),*) => (
index e58a3de41c05c2d9270fe42f5c6345cb55ba3dc9..d256698b88598cd5cd764379514d23aaf3056785 100644 (file)
@@ -214,6 +214,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
             name: "asm".to_string(),
             format: codemap::MacroBang,
             span: None,
+            allow_internal_unstable: false,
         },
     });
 
index f6bdd693cfa219fea4bd23010f413a502f5bb0e0..5513b44235d2c444fc24d08baf3f44a1cbf0da97 100644 (file)
@@ -430,12 +430,15 @@ pub enum SyntaxExtension {
     /// A normal, function-like syntax extension.
     ///
     /// `bytes!` is a `NormalTT`.
-    NormalTT(Box<TTMacroExpander + 'static>, Option<Span>),
+    ///
+    /// The `bool` dictates whether the contents of the macro can
+    /// directly use `#[unstable]` things (true == yes).
+    NormalTT(Box<TTMacroExpander + 'static>, Option<Span>, bool),
 
     /// A function-like syntax extension that has an extra ident before
     /// the block.
     ///
-    IdentTT(Box<IdentMacroExpander + 'static>, Option<Span>),
+    IdentTT(Box<IdentMacroExpander + 'static>, Option<Span>, bool),
 
     /// Represents `macro_rules!` itself.
     MacroRulesTT,
@@ -465,14 +468,14 @@ fn initial_syntax_expander_table<'feat>(ecfg: &expand::ExpansionConfig<'feat>)
                                         -> SyntaxEnv {
     // utility function to simplify creating NormalTT syntax extensions
     fn builtin_normal_expander(f: MacroExpanderFn) -> SyntaxExtension {
-        NormalTT(Box::new(f), None)
+        NormalTT(Box::new(f), None, false)
     }
 
     let mut syntax_expanders = SyntaxEnv::new();
     syntax_expanders.insert(intern("macro_rules"), MacroRulesTT);
     syntax_expanders.insert(intern("format_args"),
-                            builtin_normal_expander(
-                                ext::format::expand_format_args));
+                            // format_args uses `unstable` things internally.
+                            NormalTT(Box::new(ext::format::expand_format_args), None, true));
     syntax_expanders.insert(intern("env"),
                             builtin_normal_expander(
                                     ext::env::expand_env));
@@ -753,6 +756,10 @@ pub fn span_help(&self, sp: Span, msg: &str) {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.span_help(sp, msg);
     }
+    pub fn fileline_help(&self, sp: Span, msg: &str) {
+        self.print_backtrace();
+        self.parse_sess.span_diagnostic.fileline_help(sp, msg);
+    }
     pub fn bug(&self, msg: &str) -> ! {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.handler().bug(msg);
index a36d3a155b8d86de2db26d46d15627bfba53e99d..9cd965a8138e083d475da73ced390cc630b3f347 100644 (file)
@@ -1216,7 +1216,8 @@ fn set_expn_info(&self,
             callee: codemap::NameAndSpan {
                 name: format!("derive({})", trait_name),
                 format: codemap::MacroAttribute,
-                span: Some(self.span)
+                span: Some(self.span),
+                allow_internal_unstable: false,
             }
         });
         to_set
index bea57ae14e4af27c91d8600e7016525bdda30456..d48108f17ff9a6a39d82adb843e1e1b0d147b17b 100644 (file)
@@ -22,7 +22,7 @@
 use codemap;
 use codemap::{Span, Spanned, ExpnInfo, NameAndSpan, MacroBang, MacroAttribute};
 use ext::base::*;
-use feature_gate::{Features};
+use feature_gate::{self, Features};
 use fold;
 use fold::*;
 use parse;
@@ -395,13 +395,14 @@ fn expand_mac_invoc<T, F, G>(mac: ast::Mac, span: codemap::Span,
                     None
                 }
                 Some(rc) => match *rc {
-                    NormalTT(ref expandfun, exp_span) => {
+                    NormalTT(ref expandfun, exp_span, allow_internal_unstable) => {
                         fld.cx.bt_push(ExpnInfo {
                                 call_site: span,
                                 callee: NameAndSpan {
                                     name: extnamestr.to_string(),
                                     format: MacroBang,
                                     span: exp_span,
+                                    allow_internal_unstable: allow_internal_unstable,
                                 },
                             });
                         let fm = fresh_mark();
@@ -530,6 +531,9 @@ fn expand_item_modifiers(mut it: P<ast::Item>, fld: &mut MacroExpander)
                             name: mname.to_string(),
                             format: MacroAttribute,
                             span: None,
+                            // attributes can do whatever they like,
+                            // for now
+                            allow_internal_unstable: true,
                         }
                     });
                     it = mac.expand(fld.cx, attr.span, &*attr.node.value, it);
@@ -571,7 +575,7 @@ fn contains_macro_use(fld: &mut MacroExpander, attrs: &[ast::Attribute]) -> bool
             fld.cx.span_warn(attr.span, "macro_escape is a deprecated synonym for macro_use");
             is_use = true;
             if let ast::AttrInner = attr.node.style {
-                fld.cx.span_help(attr.span, "consider an outer attribute, \
+                fld.cx.fileline_help(attr.span, "consider an outer attribute, \
                                              #[macro_use] mod ...");
             }
         };
@@ -614,7 +618,7 @@ pub fn expand_item_mac(it: P<ast::Item>,
             }
 
             Some(rc) => match *rc {
-                NormalTT(ref expander, span) => {
+                NormalTT(ref expander, span, allow_internal_unstable) => {
                     if it.ident.name != parse::token::special_idents::invalid.name {
                         fld.cx
                             .span_err(path_span,
@@ -628,14 +632,15 @@ pub fn expand_item_mac(it: P<ast::Item>,
                         callee: NameAndSpan {
                             name: extnamestr.to_string(),
                             format: MacroBang,
-                            span: span
+                            span: span,
+                            allow_internal_unstable: allow_internal_unstable,
                         }
                     });
                     // mark before expansion:
                     let marked_before = mark_tts(&tts[..], fm);
                     expander.expand(fld.cx, it.span, &marked_before[..])
                 }
-                IdentTT(ref expander, span) => {
+                IdentTT(ref expander, span, allow_internal_unstable) => {
                     if it.ident.name == parse::token::special_idents::invalid.name {
                         fld.cx.span_err(path_span,
                                         &format!("macro {}! expects an ident argument",
@@ -647,7 +652,8 @@ pub fn expand_item_mac(it: P<ast::Item>,
                         callee: NameAndSpan {
                             name: extnamestr.to_string(),
                             format: MacroBang,
-                            span: span
+                            span: span,
+                            allow_internal_unstable: allow_internal_unstable,
                         }
                     });
                     // mark before expansion:
@@ -661,16 +667,35 @@ pub fn expand_item_mac(it: P<ast::Item>,
                                         );
                         return SmallVector::zero();
                     }
+
                     fld.cx.bt_push(ExpnInfo {
                         call_site: it.span,
                         callee: NameAndSpan {
                             name: extnamestr.to_string(),
                             format: MacroBang,
                             span: None,
+                            // `macro_rules!` doesn't directly allow
+                            // unstable (this is orthogonal to whether
+                            // the macro it creates allows it)
+                            allow_internal_unstable: false,
                         }
                     });
                     // DON'T mark before expansion.
 
+                    let allow_internal_unstable = attr::contains_name(&it.attrs,
+                                                                      "allow_internal_unstable");
+
+                    // ensure any #[allow_internal_unstable]s are
+                    // detected (including nested macro definitions
+                    // etc.)
+                    if allow_internal_unstable && !fld.cx.ecfg.enable_allow_internal_unstable() {
+                        feature_gate::emit_feature_err(
+                            &fld.cx.parse_sess.span_diagnostic,
+                            "allow_internal_unstable",
+                            it.span,
+                            feature_gate::EXPLAIN_ALLOW_INTERNAL_UNSTABLE)
+                    }
+
                     let def = ast::MacroDef {
                         ident: it.ident,
                         attrs: it.attrs.clone(),
@@ -679,6 +704,7 @@ pub fn expand_item_mac(it: P<ast::Item>,
                         imported_from: None,
                         export: attr::contains_name(&it.attrs, "macro_export"),
                         use_locally: true,
+                        allow_internal_unstable: allow_internal_unstable,
                         body: tts,
                     };
                     fld.cx.insert_macro(def);
@@ -959,13 +985,14 @@ fn expand_pat(p: P<ast::Pat>, fld: &mut MacroExpander) -> P<ast::Pat> {
             }
 
             Some(rc) => match *rc {
-                NormalTT(ref expander, tt_span) => {
+                NormalTT(ref expander, tt_span, allow_internal_unstable) => {
                     fld.cx.bt_push(ExpnInfo {
                         call_site: span,
                         callee: NameAndSpan {
                             name: extnamestr.to_string(),
                             format: MacroBang,
-                            span: tt_span
+                            span: tt_span,
+                            allow_internal_unstable: allow_internal_unstable,
                         }
                     });
 
@@ -1094,7 +1121,10 @@ fn expand_annotatable(a: Annotatable,
                         callee: NameAndSpan {
                             name: mname.to_string(),
                             format: MacroAttribute,
-                            span: None
+                            span: None,
+                            // attributes can do whatever they like,
+                            // for now.
+                            allow_internal_unstable: true,
                         }
                     });
 
@@ -1244,6 +1274,9 @@ fn expand_item_multi_modifier(mut it: Annotatable,
                             name: mname.to_string(),
                             format: MacroAttribute,
                             span: None,
+                            // attributes can do whatever they like,
+                            // for now
+                            allow_internal_unstable: true,
                         }
                     });
                     it = mac.expand(fld.cx, attr.span, &*attr.node.value, it);
@@ -1457,6 +1490,13 @@ pub fn enable_trace_macros(&self) -> bool {
             _ => false,
         }
     }
+
+    pub fn enable_allow_internal_unstable(&self) -> bool {
+        match self.features {
+            Some(&Features { allow_internal_unstable: true, .. }) => true,
+            _ => false
+        }
+    }
 }
 
 pub fn expand_crate<'feat>(parse_sess: &parse::ParseSess,
index 2599a53e313277cbc430699b5fc436a72121e690..737648cd90c37bc56cf3a4715157bd8bea08ed78 100644 (file)
@@ -676,9 +676,10 @@ macro_rules! mk_lit {
         token::FatArrow     => "FatArrow",
         token::Pound        => "Pound",
         token::Dollar       => "Dollar",
+        token::Question     => "Question",
         token::Underscore   => "Underscore",
         token::Eof          => "Eof",
-        _                   => panic!(),
+        _                   => panic!("unhandled token in quote!"),
     };
     mk_token_path(cx, sp, name)
 }
index d15eb3df6394bb089385369a5f6e71b8cb6e41d5..644c6cd7e2833f60c9ff8f4350d306a35eec2355 100644 (file)
@@ -267,7 +267,7 @@ pub fn compile<'cx>(cx: &'cx mut ExtCtxt,
         rhses: rhses,
     };
 
-    NormalTT(exp, Some(def.span))
+    NormalTT(exp, Some(def.span), def.allow_internal_unstable)
 }
 
 fn check_lhs_nt_follows(cx: &mut ExtCtxt, lhs: &NamedMatch, sp: Span) {
index 18d3f85f4b58ed80d11fb26c53b81f4d72a234ee..c6a94b26a0a51fd32ba3b52ac6ca12c68c2140bd 100644 (file)
 
     // Allows the use of `static_assert`
     ("static_assert", "1.0.0", Active),
+
+    // Allows the use of #[allow_internal_unstable]. This is an
+    // attribute on macro_rules! and can't use the attribute handling
+    // below (it has to be checked before expansion possibly makes
+    // macros disappear).
+    ("allow_internal_unstable", "1.0.0", Active),
 ];
 // (changing above list without updating src/doc/reference.md makes @cmr sad)
 
@@ -279,7 +285,7 @@ enum Status {
     ("recursion_limit", CrateLevel),
 ];
 
-#[derive(PartialEq, Copy)]
+#[derive(PartialEq, Copy, Debug)]
 pub enum AttributeType {
     /// Normal, builtin attribute that is consumed
     /// by the compiler before the unused_attribute check
@@ -308,6 +314,7 @@ pub struct Features {
     pub allow_log_syntax: bool,
     pub allow_concat_idents: bool,
     pub allow_trace_macros: bool,
+    pub allow_internal_unstable: bool,
     pub old_orphan_check: bool,
     pub simd_ffi: bool,
     pub unmarked_api: bool,
@@ -328,6 +335,7 @@ pub fn new() -> Features {
             allow_log_syntax: false,
             allow_concat_idents: false,
             allow_trace_macros: false,
+            allow_internal_unstable: false,
             old_orphan_check: false,
             simd_ffi: false,
             unmarked_api: false,
@@ -341,17 +349,20 @@ struct Context<'a> {
     features: Vec<&'static str>,
     span_handler: &'a SpanHandler,
     cm: &'a CodeMap,
+    do_warnings: bool,
 }
 
 impl<'a> Context<'a> {
     fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
-        if !self.has_feature(feature) {
+        let has_feature = self.has_feature(feature);
+        debug!("gate_feature(feature = {:?}, span = {:?}); has? {}", feature, span, has_feature);
+        if !has_feature {
             emit_feature_err(self.span_handler, feature, span, explain);
         }
     }
 
     fn warn_feature(&self, feature: &str, span: Span, explain: &str) {
-        if !self.has_feature(feature) {
+        if !self.has_feature(feature) && self.do_warnings {
             emit_feature_warn(self.span_handler, feature, span, explain);
         }
     }
@@ -362,7 +373,7 @@ fn has_feature(&self, feature: &str) -> bool {
 
 pub fn emit_feature_err(diag: &SpanHandler, feature: &str, span: Span, explain: &str) {
     diag.span_err(span, explain);
-    diag.span_help(span, &format!("add #![feature({})] to the \
+    diag.fileline_help(span, &format!("add #![feature({})] to the \
                                    crate attributes to enable",
                                   feature));
 }
@@ -370,7 +381,7 @@ pub fn emit_feature_err(diag: &SpanHandler, feature: &str, span: Span, explain:
 pub fn emit_feature_warn(diag: &SpanHandler, feature: &str, span: Span, explain: &str) {
     diag.span_warn(span, explain);
     if diag.handler.can_emit_warnings {
-        diag.span_help(span, &format!("add #![feature({})] to the \
+        diag.fileline_help(span, &format!("add #![feature({})] to the \
                                        crate attributes to silence this warning",
                                       feature));
     }
@@ -387,6 +398,8 @@ pub fn emit_feature_warn(diag: &SpanHandler, feature: &str, span: Span, explain:
 
 pub const EXPLAIN_TRACE_MACROS: &'static str =
     "`trace_macros` is not stable enough for use and is subject to change";
+pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &'static str =
+    "allow_internal_unstable side-steps feature gating and stability checks";
 
 struct MacroVisitor<'a> {
     context: &'a Context<'a>
@@ -421,6 +434,13 @@ fn visit_mac(&mut self, mac: &ast::Mac) {
             self.context.gate_feature("concat_idents", path.span, EXPLAIN_CONCAT_IDENTS);
         }
     }
+
+    fn visit_attribute(&mut self, attr: &'v ast::Attribute) {
+        if attr.name() == "allow_internal_unstable" {
+            self.context.gate_feature("allow_internal_unstable", attr.span,
+                                      EXPLAIN_ALLOW_INTERNAL_UNSTABLE)
+        }
+    }
 }
 
 struct PostExpansionVisitor<'a> {
@@ -429,7 +449,7 @@ struct PostExpansionVisitor<'a> {
 
 impl<'a> PostExpansionVisitor<'a> {
     fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
-        if !self.context.cm.span_is_internal(span) {
+        if !self.context.cm.span_allows_unstable(span) {
             self.context.gate_feature(feature, span, explain)
         }
     }
@@ -617,12 +637,14 @@ fn visit_expr(&mut self, e: &ast::Expr) {
     }
 
     fn visit_attribute(&mut self, attr: &ast::Attribute) {
+        debug!("visit_attribute(attr = {:?})", attr);
         let name = &*attr.name();
         for &(n, ty) in KNOWN_ATTRIBUTES {
             if n == name {
                 if let Gated(gate, desc) = ty {
                     self.gate_feature(gate, attr.span, desc);
                 }
+                debug!("visit_attribute: {:?} is known, {:?}", name, ty);
                 return;
             }
         }
@@ -679,6 +701,7 @@ fn visit_fn(&mut self,
 }
 
 fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::Crate,
+                        do_warnings: bool,
                         check: F)
                        -> Features
     where F: FnOnce(&mut Context, &ast::Crate)
@@ -686,6 +709,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::C
     let mut cx = Context {
         features: Vec::new(),
         span_handler: span_handler,
+        do_warnings: do_warnings,
         cm: cm,
     };
 
@@ -754,6 +778,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::C
         allow_log_syntax: cx.has_feature("log_syntax"),
         allow_concat_idents: cx.has_feature("concat_idents"),
         allow_trace_macros: cx.has_feature("trace_macros"),
+        allow_internal_unstable: cx.has_feature("allow_internal_unstable"),
         old_orphan_check: cx.has_feature("old_orphan_check"),
         simd_ffi: cx.has_feature("simd_ffi"),
         unmarked_api: cx.has_feature("unmarked_api"),
@@ -764,13 +789,14 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::C
 
 pub fn check_crate_macros(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::Crate)
 -> Features {
-    check_crate_inner(cm, span_handler, krate,
+    check_crate_inner(cm, span_handler, krate, true,
                       |ctx, krate| visit::walk_crate(&mut MacroVisitor { context: ctx }, krate))
 }
 
-pub fn check_crate(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::Crate)
--> Features {
-    check_crate_inner(cm, span_handler, krate,
+pub fn check_crate(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::Crate,
+                   do_warnings: bool) -> Features
+{
+    check_crate_inner(cm, span_handler, krate, do_warnings,
                       |ctx, krate| visit::walk_crate(&mut PostExpansionVisitor { context: ctx },
                                                      krate))
 }
index 7bd9cc3b85515dfd733a9c70657848adb88f1f01..c0977508112c5db14eea7d7ea03203ae9cd03d0e 100644 (file)
@@ -37,8 +37,8 @@
 #![feature(std_misc)]
 #![feature(unicode)]
 #![feature(path)]
-#![feature(fs)]
 #![feature(io)]
+#![feature(path_ext)]
 
 extern crate arena;
 extern crate fmt_macros;
index a0e2b4dbf5a70bae65ede6b0efb4c520ac2a8f1e..db5583cf13ac193e119436b1c9ca512f798272c6 100644 (file)
@@ -77,7 +77,7 @@ fn parse_attribute(&mut self, permit_inner: bool) -> ast::Attribute {
                         self.span_err(span,
                                       "an inner attribute is not permitted in \
                                        this context");
-                        self.span_help(span,
+                        self.fileline_help(span,
                                        "place inner attribute at the top of the module or block");
                     }
                     ast::AttrInner
index 8d3e93d35ddd1b87ea13ec8f577d392ae1981471..72ff501c6481eb2c2627dcca68e26c97d59dd227 100644 (file)
@@ -781,7 +781,7 @@ fn old_escape_warning(&mut self, sp: Span) {
         self.span_diagnostic
             .span_warn(sp, "\\U00ABCD12 and \\uABCD escapes are deprecated");
         self.span_diagnostic
-            .span_help(sp, "use \\u{ABCD12} escapes instead");
+            .fileline_help(sp, "use \\u{ABCD12} escapes instead");
     }
 
     /// Scan for a single (possibly escaped) byte or char
index def5963e6f4e961ac28e281e1c85838fdcd70c6a..58d58551df363715365f717735e0770acbe13284 100644 (file)
@@ -724,7 +724,7 @@ pub fn integer_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) ->
                                               &suf[1..]));
                 } else {
                     sd.span_err(sp, &*format!("illegal suffix `{}` for numeric literal", suf));
-                    sd.span_help(sp, "the suffix must be one of the integral types \
+                    sd.fileline_help(sp, "the suffix must be one of the integral types \
                                       (`u32`, `isize`, etc)");
                 }
 
index 88df6d6d4cd2fb2bfbf675544be1666dc5de08c9..28d757e9be96397b2cd7d85771dc941fd0dd1e58 100644 (file)
@@ -974,7 +974,7 @@ pub fn span_fatal(&self, sp: Span, m: &str) -> ! {
     }
     pub fn span_fatal_help(&self, sp: Span, m: &str, help: &str) -> ! {
         self.span_err(sp, m);
-        self.span_help(sp, help);
+        self.fileline_help(sp, help);
         panic!(diagnostic::FatalError);
     }
     pub fn span_note(&self, sp: Span, m: &str) {
@@ -983,6 +983,9 @@ pub fn span_note(&self, sp: Span, m: &str) {
     pub fn span_help(&self, sp: Span, m: &str) {
         self.sess.span_diagnostic.span_help(sp, m)
     }
+    pub fn fileline_help(&self, sp: Span, m: &str) {
+        self.sess.span_diagnostic.fileline_help(sp, m)
+    }
     pub fn bug(&self, m: &str) -> ! {
         self.sess.span_diagnostic.span_bug(self.span, m)
     }
@@ -2532,7 +2535,7 @@ pub fn parse_dot_or_call_expr_with(&mut self, e0: P<Expr>) -> P<Expr> {
                             Some(f) => f,
                             None => continue,
                         };
-                        self.span_help(last_span,
+                        self.fileline_help(last_span,
                             &format!("try parenthesizing the first index; e.g., `(foo.{}){}`",
                                     float.trunc() as usize,
                                     &float.fract().to_string()[1..]));
@@ -2943,7 +2946,7 @@ fn check_no_chained_comparison(&mut self, lhs: &Expr, outer_op: ast::BinOp_) {
                 self.span_err(op_span,
                     "chained comparison operators require parentheses");
                 if op.node == BiLt && outer_op == BiGt {
-                    self.span_help(op_span,
+                    self.fileline_help(op_span,
                         "use `::<...>` instead of `<...>` if you meant to specify type arguments");
                 }
             }
@@ -4699,7 +4702,7 @@ fn complain_if_pub_macro(&mut self, visa: Visibility, span: Span) {
         match visa {
             Public => {
                 self.span_err(span, "can't qualify macro invocation with `pub`");
-                self.span_help(span, "try adjusting the macro to put `pub` inside \
+                self.fileline_help(span, "try adjusting the macro to put `pub` inside \
                                       the invocation");
             }
             Inherited => (),
@@ -5445,7 +5448,7 @@ fn parse_item_extern_crate(&mut self,
                     if self.token.is_ident() { self.bump(); }
 
                     self.span_err(span, "expected `;`, found `as`");
-                    self.span_help(span,
+                    self.fileline_help(span,
                                    &format!("perhaps you meant to enclose the crate name `{}` in \
                                            a string?",
                                           the_ident.as_str()));
@@ -5756,7 +5759,7 @@ fn parse_item_(&mut self, attrs: Vec<Attribute>,
             if self.eat_keyword(keywords::Mut) {
                 let last_span = self.last_span;
                 self.span_err(last_span, "const globals cannot be mutable");
-                self.span_help(last_span, "did you mean to declare a static?");
+                self.fileline_help(last_span, "did you mean to declare a static?");
             }
             let (ident, item_, extra_attrs) = self.parse_item_const(None);
             let last_span = self.last_span;
index 5bada41badfd8077b4980f4bb79deb6c6fc4066a..d889453a5f977127708805124cf273979392a68c 100644 (file)
@@ -256,7 +256,8 @@ fn generate_test_harness(sess: &ParseSess,
         callee: NameAndSpan {
             name: "test".to_string(),
             format: MacroAttribute,
-            span: None
+            span: None,
+            allow_internal_unstable: false,
         }
     });
 
@@ -288,7 +289,8 @@ fn ignored_span(cx: &TestCtxt, sp: Span) -> Span {
         callee: NameAndSpan {
             name: "test".to_string(),
             format: MacroAttribute,
-            span: None
+            span: None,
+            allow_internal_unstable: true,
         }
     };
     let expn_id = cx.sess.span_diagnostic.cm.record_expansion(info);
index ba9860ee31f604603a7ebba8d607317f68804dc6..317bacf0f5222771f637fcaffaaf6753b505ea53 100644 (file)
@@ -52,7 +52,6 @@
 
 #![feature(box_syntax)]
 #![feature(collections)]
-#![feature(fs)]
 #![feature(int_uint)]
 #![feature(io)]
 #![feature(old_io)]
@@ -61,6 +60,7 @@
 #![feature(staged_api)]
 #![feature(std_misc)]
 #![feature(unicode)]
+#![feature(path_ext)]
 #![cfg_attr(windows, feature(libc))]
 
 #[macro_use] extern crate log;
@@ -154,23 +154,23 @@ pub mod color {
     /// Number for a terminal color
     pub type Color = u16;
 
-    pub const BLACK:   Color = 0u16;
-    pub const RED:     Color = 1u16;
-    pub const GREEN:   Color = 2u16;
-    pub const YELLOW:  Color = 3u16;
-    pub const BLUE:    Color = 4u16;
-    pub const MAGENTA: Color = 5u16;
-    pub const CYAN:    Color = 6u16;
-    pub const WHITE:   Color = 7u16;
-
-    pub const BRIGHT_BLACK:   Color = 8u16;
-    pub const BRIGHT_RED:     Color = 9u16;
-    pub const BRIGHT_GREEN:   Color = 10u16;
-    pub const BRIGHT_YELLOW:  Color = 11u16;
-    pub const BRIGHT_BLUE:    Color = 12u16;
-    pub const BRIGHT_MAGENTA: Color = 13u16;
-    pub const BRIGHT_CYAN:    Color = 14u16;
-    pub const BRIGHT_WHITE:   Color = 15u16;
+    pub const BLACK:   Color = 0;
+    pub const RED:     Color = 1;
+    pub const GREEN:   Color = 2;
+    pub const YELLOW:  Color = 3;
+    pub const BLUE:    Color = 4;
+    pub const MAGENTA: Color = 5;
+    pub const CYAN:    Color = 6;
+    pub const WHITE:   Color = 7;
+
+    pub const BRIGHT_BLACK:   Color = 8;
+    pub const BRIGHT_RED:     Color = 9;
+    pub const BRIGHT_GREEN:   Color = 10;
+    pub const BRIGHT_YELLOW:  Color = 11;
+    pub const BRIGHT_BLUE:    Color = 12;
+    pub const BRIGHT_MAGENTA: Color = 13;
+    pub const BRIGHT_CYAN:    Color = 14;
+    pub const BRIGHT_WHITE:   Color = 15;
 }
 
 /// Terminal attributes
index 112525fcce96efe2a1762a6555f4ddee0a80daa5..30b732781db1cdead56be19d692d607036eaf62b 100644 (file)
@@ -128,7 +128,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
                             // if c is 0, use 0200 (128) for ncurses compatibility
                             Number(c) => {
                                 output.push(if c == 0 {
-                                    128u8
+                                    128
                                 } else {
                                     c as u8
                                 })
@@ -647,7 +647,7 @@ fn test_push_bad_param() {
 
     #[test]
     fn test_comparison_ops() {
-        let v = [('<', [1u8, 0u8, 0u8]), ('=', [0u8, 1u8, 0u8]), ('>', [0u8, 0u8, 1u8])];
+        let v = [('<', [1, 0, 0]), ('=', [0, 1, 0]), ('>', [0, 0, 1])];
         for &(op, bs) in &v {
             let s = format!("%{{1}}%{{2}}%{}%d", op);
             let res = expand(s.as_bytes(), &[], &mut Variables::new());
index e309e7a6c221d2665994421b15cb2cdd066f65dd..06af12e807546c371e440e19967ee6f7472155db 100644 (file)
@@ -39,7 +39,6 @@
 #![feature(int_uint)]
 #![feature(old_io)]
 #![feature(path)]
-#![feature(fs)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
 #![feature(std_misc)]
@@ -1024,7 +1023,7 @@ impl Bencher {
     pub fn iter<T, F>(&mut self, mut inner: F) where F: FnMut() -> T {
         self.dur = Duration::span(|| {
             let k = self.iterations;
-            for _ in 0u64..k {
+            for _ in 0..k {
                 black_box(inner());
             }
         });
@@ -1050,7 +1049,7 @@ pub fn bench_n<F>(&mut self, n: u64, f: F) where F: FnOnce(&mut Bencher) {
     // This is a more statistics-driven benchmark algorithm
     pub fn auto_bench<F>(&mut self, mut f: F) -> stats::Summary<f64> where F: FnMut(&mut Bencher) {
         // Initial bench run to get ballpark figure.
-        let mut n = 1_u64;
+        let mut n = 1;
         self.bench_n(n, |x| f(x));
 
         // Try to estimate iter count for 1ms falling back to 1m
index 99a6b6aa1806f56b0883678f6529e47a49c5863a..1fb6ee7bc7ce1952c59d0f0dd579b6b6e86413e3 100644 (file)
@@ -115,27 +115,26 @@ pub mod general_category {
         '\u{2eff}'), ('\u{2fd6}', '\u{2fef}'), ('\u{2ffc}', '\u{2fff}'), ('\u{3040}', '\u{3040}'),
         ('\u{3097}', '\u{3098}'), ('\u{3100}', '\u{3104}'), ('\u{312e}', '\u{3130}'), ('\u{318f}',
         '\u{318f}'), ('\u{31bb}', '\u{31bf}'), ('\u{31e4}', '\u{31ef}'), ('\u{321f}', '\u{321f}'),
-        ('\u{32ff}', '\u{32ff}'), ('\u{3401}', '\u{4db4}'), ('\u{4db6}', '\u{4dbf}'), ('\u{4e01}',
-        '\u{9fcb}'), ('\u{9fcd}', '\u{9fff}'), ('\u{a48d}', '\u{a48f}'), ('\u{a4c7}', '\u{a4cf}'),
-        ('\u{a62c}', '\u{a63f}'), ('\u{a69e}', '\u{a69e}'), ('\u{a6f8}', '\u{a6ff}'), ('\u{a78f}',
-        '\u{a78f}'), ('\u{a7ae}', '\u{a7af}'), ('\u{a7b2}', '\u{a7f6}'), ('\u{a82c}', '\u{a82f}'),
-        ('\u{a83a}', '\u{a83f}'), ('\u{a878}', '\u{a87f}'), ('\u{a8c5}', '\u{a8cd}'), ('\u{a8da}',
-        '\u{a8df}'), ('\u{a8fc}', '\u{a8ff}'), ('\u{a954}', '\u{a95e}'), ('\u{a97d}', '\u{a97f}'),
-        ('\u{a9ce}', '\u{a9ce}'), ('\u{a9da}', '\u{a9dd}'), ('\u{a9ff}', '\u{a9ff}'), ('\u{aa37}',
-        '\u{aa3f}'), ('\u{aa4e}', '\u{aa4f}'), ('\u{aa5a}', '\u{aa5b}'), ('\u{aac3}', '\u{aada}'),
-        ('\u{aaf7}', '\u{ab00}'), ('\u{ab07}', '\u{ab08}'), ('\u{ab0f}', '\u{ab10}'), ('\u{ab17}',
-        '\u{ab1f}'), ('\u{ab27}', '\u{ab27}'), ('\u{ab2f}', '\u{ab2f}'), ('\u{ab60}', '\u{ab63}'),
-        ('\u{ab66}', '\u{abbf}'), ('\u{abee}', '\u{abef}'), ('\u{abfa}', '\u{abff}'), ('\u{ac01}',
-        '\u{d7a2}'), ('\u{d7a4}', '\u{d7af}'), ('\u{d7c7}', '\u{d7ca}'), ('\u{d7fc}', '\u{d7ff}'),
-        ('\u{e000}', '\u{f8ff}'), ('\u{fa6e}', '\u{fa6f}'), ('\u{fada}', '\u{faff}'), ('\u{fb07}',
-        '\u{fb12}'), ('\u{fb18}', '\u{fb1c}'), ('\u{fb37}', '\u{fb37}'), ('\u{fb3d}', '\u{fb3d}'),
-        ('\u{fb3f}', '\u{fb3f}'), ('\u{fb42}', '\u{fb42}'), ('\u{fb45}', '\u{fb45}'), ('\u{fbc2}',
-        '\u{fbd2}'), ('\u{fd40}', '\u{fd4f}'), ('\u{fd90}', '\u{fd91}'), ('\u{fdc8}', '\u{fdef}'),
-        ('\u{fdfe}', '\u{fdff}'), ('\u{fe1a}', '\u{fe1f}'), ('\u{fe2e}', '\u{fe2f}'), ('\u{fe53}',
-        '\u{fe53}'), ('\u{fe67}', '\u{fe67}'), ('\u{fe6c}', '\u{fe6f}'), ('\u{fe75}', '\u{fe75}'),
-        ('\u{fefd}', '\u{ff00}'), ('\u{ffbf}', '\u{ffc1}'), ('\u{ffc8}', '\u{ffc9}'), ('\u{ffd0}',
-        '\u{ffd1}'), ('\u{ffd8}', '\u{ffd9}'), ('\u{ffdd}', '\u{ffdf}'), ('\u{ffe7}', '\u{ffe7}'),
-        ('\u{ffef}', '\u{fffb}'), ('\u{fffe}', '\u{ffff}'), ('\u{1000c}', '\u{1000c}'),
+        ('\u{32ff}', '\u{32ff}'), ('\u{4db6}', '\u{4dbf}'), ('\u{9fcd}', '\u{9fff}'), ('\u{a48d}',
+        '\u{a48f}'), ('\u{a4c7}', '\u{a4cf}'), ('\u{a62c}', '\u{a63f}'), ('\u{a69e}', '\u{a69e}'),
+        ('\u{a6f8}', '\u{a6ff}'), ('\u{a78f}', '\u{a78f}'), ('\u{a7ae}', '\u{a7af}'), ('\u{a7b2}',
+        '\u{a7f6}'), ('\u{a82c}', '\u{a82f}'), ('\u{a83a}', '\u{a83f}'), ('\u{a878}', '\u{a87f}'),
+        ('\u{a8c5}', '\u{a8cd}'), ('\u{a8da}', '\u{a8df}'), ('\u{a8fc}', '\u{a8ff}'), ('\u{a954}',
+        '\u{a95e}'), ('\u{a97d}', '\u{a97f}'), ('\u{a9ce}', '\u{a9ce}'), ('\u{a9da}', '\u{a9dd}'),
+        ('\u{a9ff}', '\u{a9ff}'), ('\u{aa37}', '\u{aa3f}'), ('\u{aa4e}', '\u{aa4f}'), ('\u{aa5a}',
+        '\u{aa5b}'), ('\u{aac3}', '\u{aada}'), ('\u{aaf7}', '\u{ab00}'), ('\u{ab07}', '\u{ab08}'),
+        ('\u{ab0f}', '\u{ab10}'), ('\u{ab17}', '\u{ab1f}'), ('\u{ab27}', '\u{ab27}'), ('\u{ab2f}',
+        '\u{ab2f}'), ('\u{ab60}', '\u{ab63}'), ('\u{ab66}', '\u{abbf}'), ('\u{abee}', '\u{abef}'),
+        ('\u{abfa}', '\u{abff}'), ('\u{d7a4}', '\u{d7af}'), ('\u{d7c7}', '\u{d7ca}'), ('\u{d7fc}',
+        '\u{d7ff}'), ('\u{e000}', '\u{f8ff}'), ('\u{fa6e}', '\u{fa6f}'), ('\u{fada}', '\u{faff}'),
+        ('\u{fb07}', '\u{fb12}'), ('\u{fb18}', '\u{fb1c}'), ('\u{fb37}', '\u{fb37}'), ('\u{fb3d}',
+        '\u{fb3d}'), ('\u{fb3f}', '\u{fb3f}'), ('\u{fb42}', '\u{fb42}'), ('\u{fb45}', '\u{fb45}'),
+        ('\u{fbc2}', '\u{fbd2}'), ('\u{fd40}', '\u{fd4f}'), ('\u{fd90}', '\u{fd91}'), ('\u{fdc8}',
+        '\u{fdef}'), ('\u{fdfe}', '\u{fdff}'), ('\u{fe1a}', '\u{fe1f}'), ('\u{fe2e}', '\u{fe2f}'),
+        ('\u{fe53}', '\u{fe53}'), ('\u{fe67}', '\u{fe67}'), ('\u{fe6c}', '\u{fe6f}'), ('\u{fe75}',
+        '\u{fe75}'), ('\u{fefd}', '\u{ff00}'), ('\u{ffbf}', '\u{ffc1}'), ('\u{ffc8}', '\u{ffc9}'),
+        ('\u{ffd0}', '\u{ffd1}'), ('\u{ffd8}', '\u{ffd9}'), ('\u{ffdd}', '\u{ffdf}'), ('\u{ffe7}',
+        '\u{ffe7}'), ('\u{ffef}', '\u{fffb}'), ('\u{fffe}', '\u{ffff}'), ('\u{1000c}', '\u{1000c}'),
         ('\u{10027}', '\u{10027}'), ('\u{1003b}', '\u{1003b}'), ('\u{1003e}', '\u{1003e}'),
         ('\u{1004e}', '\u{1004f}'), ('\u{1005e}', '\u{1007f}'), ('\u{100fb}', '\u{100ff}'),
         ('\u{10103}', '\u{10106}'), ('\u{10134}', '\u{10136}'), ('\u{1018d}', '\u{1018f}'),
@@ -210,9 +209,8 @@ pub mod general_category {
         ('\u{1f643}', '\u{1f644}'), ('\u{1f6d0}', '\u{1f6df}'), ('\u{1f6ed}', '\u{1f6ef}'),
         ('\u{1f6f4}', '\u{1f6ff}'), ('\u{1f774}', '\u{1f77f}'), ('\u{1f7d5}', '\u{1f7ff}'),
         ('\u{1f80c}', '\u{1f80f}'), ('\u{1f848}', '\u{1f84f}'), ('\u{1f85a}', '\u{1f85f}'),
-        ('\u{1f888}', '\u{1f88f}'), ('\u{1f8ae}', '\u{1ffff}'), ('\u{20001}', '\u{2a6d5}'),
-        ('\u{2a6d7}', '\u{2a6ff}'), ('\u{2a701}', '\u{2b733}'), ('\u{2b735}', '\u{2b73f}'),
-        ('\u{2b741}', '\u{2b81c}'), ('\u{2b81e}', '\u{2f7ff}'), ('\u{2fa1e}', '\u{e00ff}'),
+        ('\u{1f888}', '\u{1f88f}'), ('\u{1f8ae}', '\u{1ffff}'), ('\u{2a6d7}', '\u{2a6ff}'),
+        ('\u{2b735}', '\u{2b73f}'), ('\u{2b81e}', '\u{2f7ff}'), ('\u{2fa1e}', '\u{e00ff}'),
         ('\u{e01f0}', '\u{10ffff}')
     ];
 
@@ -319,112 +317,108 @@ pub fn Cc(c: char) -> bool {
         ('\u{2e9a}', '\u{2e9a}'), ('\u{2ef4}', '\u{2eff}'), ('\u{2fd6}', '\u{2fef}'), ('\u{2ffc}',
         '\u{2fff}'), ('\u{3040}', '\u{3040}'), ('\u{3097}', '\u{3098}'), ('\u{3100}', '\u{3104}'),
         ('\u{312e}', '\u{3130}'), ('\u{318f}', '\u{318f}'), ('\u{31bb}', '\u{31bf}'), ('\u{31e4}',
-        '\u{31ef}'), ('\u{321f}', '\u{321f}'), ('\u{32ff}', '\u{32ff}'), ('\u{3401}', '\u{4db4}'),
-        ('\u{4db6}', '\u{4dbf}'), ('\u{4e01}', '\u{9fcb}'), ('\u{9fcd}', '\u{9fff}'), ('\u{a48d}',
-        '\u{a48f}'), ('\u{a4c7}', '\u{a4cf}'), ('\u{a62c}', '\u{a63f}'), ('\u{a69e}', '\u{a69e}'),
-        ('\u{a6f8}', '\u{a6ff}'), ('\u{a78f}', '\u{a78f}'), ('\u{a7ae}', '\u{a7af}'), ('\u{a7b2}',
-        '\u{a7f6}'), ('\u{a82c}', '\u{a82f}'), ('\u{a83a}', '\u{a83f}'), ('\u{a878}', '\u{a87f}'),
-        ('\u{a8c5}', '\u{a8cd}'), ('\u{a8da}', '\u{a8df}'), ('\u{a8fc}', '\u{a8ff}'), ('\u{a954}',
-        '\u{a95e}'), ('\u{a97d}', '\u{a97f}'), ('\u{a9ce}', '\u{a9ce}'), ('\u{a9da}', '\u{a9dd}'),
-        ('\u{a9ff}', '\u{a9ff}'), ('\u{aa37}', '\u{aa3f}'), ('\u{aa4e}', '\u{aa4f}'), ('\u{aa5a}',
-        '\u{aa5b}'), ('\u{aac3}', '\u{aada}'), ('\u{aaf7}', '\u{ab00}'), ('\u{ab07}', '\u{ab08}'),
-        ('\u{ab0f}', '\u{ab10}'), ('\u{ab17}', '\u{ab1f}'), ('\u{ab27}', '\u{ab27}'), ('\u{ab2f}',
-        '\u{ab2f}'), ('\u{ab60}', '\u{ab63}'), ('\u{ab66}', '\u{abbf}'), ('\u{abee}', '\u{abef}'),
-        ('\u{abfa}', '\u{abff}'), ('\u{ac01}', '\u{d7a2}'), ('\u{d7a4}', '\u{d7af}'), ('\u{d7c7}',
-        '\u{d7ca}'), ('\u{d7fc}', '\u{d7ff}'), ('\u{e001}', '\u{f8fe}'), ('\u{fa6e}', '\u{fa6f}'),
-        ('\u{fada}', '\u{faff}'), ('\u{fb07}', '\u{fb12}'), ('\u{fb18}', '\u{fb1c}'), ('\u{fb37}',
-        '\u{fb37}'), ('\u{fb3d}', '\u{fb3d}'), ('\u{fb3f}', '\u{fb3f}'), ('\u{fb42}', '\u{fb42}'),
-        ('\u{fb45}', '\u{fb45}'), ('\u{fbc2}', '\u{fbd2}'), ('\u{fd40}', '\u{fd4f}'), ('\u{fd90}',
-        '\u{fd91}'), ('\u{fdc8}', '\u{fdef}'), ('\u{fdfe}', '\u{fdff}'), ('\u{fe1a}', '\u{fe1f}'),
-        ('\u{fe2e}', '\u{fe2f}'), ('\u{fe53}', '\u{fe53}'), ('\u{fe67}', '\u{fe67}'), ('\u{fe6c}',
-        '\u{fe6f}'), ('\u{fe75}', '\u{fe75}'), ('\u{fefd}', '\u{fefe}'), ('\u{ff00}', '\u{ff00}'),
-        ('\u{ffbf}', '\u{ffc1}'), ('\u{ffc8}', '\u{ffc9}'), ('\u{ffd0}', '\u{ffd1}'), ('\u{ffd8}',
-        '\u{ffd9}'), ('\u{ffdd}', '\u{ffdf}'), ('\u{ffe7}', '\u{ffe7}'), ('\u{ffef}', '\u{fff8}'),
-        ('\u{fffe}', '\u{ffff}'), ('\u{1000c}', '\u{1000c}'), ('\u{10027}', '\u{10027}'),
-        ('\u{1003b}', '\u{1003b}'), ('\u{1003e}', '\u{1003e}'), ('\u{1004e}', '\u{1004f}'),
-        ('\u{1005e}', '\u{1007f}'), ('\u{100fb}', '\u{100ff}'), ('\u{10103}', '\u{10106}'),
-        ('\u{10134}', '\u{10136}'), ('\u{1018d}', '\u{1018f}'), ('\u{1019c}', '\u{1019f}'),
-        ('\u{101a1}', '\u{101cf}'), ('\u{101fe}', '\u{1027f}'), ('\u{1029d}', '\u{1029f}'),
-        ('\u{102d1}', '\u{102df}'), ('\u{102fc}', '\u{102ff}'), ('\u{10324}', '\u{1032f}'),
-        ('\u{1034b}', '\u{1034f}'), ('\u{1037b}', '\u{1037f}'), ('\u{1039e}', '\u{1039e}'),
-        ('\u{103c4}', '\u{103c7}'), ('\u{103d6}', '\u{103ff}'), ('\u{1049e}', '\u{1049f}'),
-        ('\u{104aa}', '\u{104ff}'), ('\u{10528}', '\u{1052f}'), ('\u{10564}', '\u{1056e}'),
-        ('\u{10570}', '\u{105ff}'), ('\u{10737}', '\u{1073f}'), ('\u{10756}', '\u{1075f}'),
-        ('\u{10768}', '\u{107ff}'), ('\u{10806}', '\u{10807}'), ('\u{10809}', '\u{10809}'),
-        ('\u{10836}', '\u{10836}'), ('\u{10839}', '\u{1083b}'), ('\u{1083d}', '\u{1083e}'),
-        ('\u{10856}', '\u{10856}'), ('\u{1089f}', '\u{108a6}'), ('\u{108b0}', '\u{108ff}'),
-        ('\u{1091c}', '\u{1091e}'), ('\u{1093a}', '\u{1093e}'), ('\u{10940}', '\u{1097f}'),
-        ('\u{109b8}', '\u{109bd}'), ('\u{109c0}', '\u{109ff}'), ('\u{10a04}', '\u{10a04}'),
-        ('\u{10a07}', '\u{10a0b}'), ('\u{10a14}', '\u{10a14}'), ('\u{10a18}', '\u{10a18}'),
-        ('\u{10a34}', '\u{10a37}'), ('\u{10a3b}', '\u{10a3e}'), ('\u{10a48}', '\u{10a4f}'),
-        ('\u{10a59}', '\u{10a5f}'), ('\u{10aa0}', '\u{10abf}'), ('\u{10ae7}', '\u{10aea}'),
-        ('\u{10af7}', '\u{10aff}'), ('\u{10b36}', '\u{10b38}'), ('\u{10b56}', '\u{10b57}'),
-        ('\u{10b73}', '\u{10b77}'), ('\u{10b92}', '\u{10b98}'), ('\u{10b9d}', '\u{10ba8}'),
-        ('\u{10bb0}', '\u{10bff}'), ('\u{10c49}', '\u{10e5f}'), ('\u{10e7f}', '\u{10fff}'),
-        ('\u{1104e}', '\u{11051}'), ('\u{11070}', '\u{1107e}'), ('\u{110c2}', '\u{110cf}'),
-        ('\u{110e9}', '\u{110ef}'), ('\u{110fa}', '\u{110ff}'), ('\u{11135}', '\u{11135}'),
-        ('\u{11144}', '\u{1114f}'), ('\u{11177}', '\u{1117f}'), ('\u{111c9}', '\u{111cc}'),
-        ('\u{111ce}', '\u{111cf}'), ('\u{111db}', '\u{111e0}'), ('\u{111f5}', '\u{111ff}'),
-        ('\u{11212}', '\u{11212}'), ('\u{1123e}', '\u{112af}'), ('\u{112eb}', '\u{112ef}'),
-        ('\u{112fa}', '\u{11300}'), ('\u{11304}', '\u{11304}'), ('\u{1130d}', '\u{1130e}'),
-        ('\u{11311}', '\u{11312}'), ('\u{11329}', '\u{11329}'), ('\u{11331}', '\u{11331}'),
-        ('\u{11334}', '\u{11334}'), ('\u{1133a}', '\u{1133b}'), ('\u{11345}', '\u{11346}'),
-        ('\u{11349}', '\u{1134a}'), ('\u{1134e}', '\u{11356}'), ('\u{11358}', '\u{1135c}'),
-        ('\u{11364}', '\u{11365}'), ('\u{1136d}', '\u{1136f}'), ('\u{11375}', '\u{1147f}'),
-        ('\u{114c8}', '\u{114cf}'), ('\u{114da}', '\u{1157f}'), ('\u{115b6}', '\u{115b7}'),
-        ('\u{115ca}', '\u{115ff}'), ('\u{11645}', '\u{1164f}'), ('\u{1165a}', '\u{1167f}'),
-        ('\u{116b8}', '\u{116bf}'), ('\u{116ca}', '\u{1189f}'), ('\u{118f3}', '\u{118fe}'),
-        ('\u{11900}', '\u{11abf}'), ('\u{11af9}', '\u{11fff}'), ('\u{12399}', '\u{123ff}'),
-        ('\u{1246f}', '\u{1246f}'), ('\u{12475}', '\u{12fff}'), ('\u{1342f}', '\u{167ff}'),
-        ('\u{16a39}', '\u{16a3f}'), ('\u{16a5f}', '\u{16a5f}'), ('\u{16a6a}', '\u{16a6d}'),
-        ('\u{16a70}', '\u{16acf}'), ('\u{16aee}', '\u{16aef}'), ('\u{16af6}', '\u{16aff}'),
-        ('\u{16b46}', '\u{16b4f}'), ('\u{16b5a}', '\u{16b5a}'), ('\u{16b62}', '\u{16b62}'),
-        ('\u{16b78}', '\u{16b7c}'), ('\u{16b90}', '\u{16eff}'), ('\u{16f45}', '\u{16f4f}'),
-        ('\u{16f7f}', '\u{16f8e}'), ('\u{16fa0}', '\u{1afff}'), ('\u{1b002}', '\u{1bbff}'),
-        ('\u{1bc6b}', '\u{1bc6f}'), ('\u{1bc7d}', '\u{1bc7f}'), ('\u{1bc89}', '\u{1bc8f}'),
-        ('\u{1bc9a}', '\u{1bc9b}'), ('\u{1bca4}', '\u{1cfff}'), ('\u{1d0f6}', '\u{1d0ff}'),
-        ('\u{1d127}', '\u{1d128}'), ('\u{1d1de}', '\u{1d1ff}'), ('\u{1d246}', '\u{1d2ff}'),
-        ('\u{1d357}', '\u{1d35f}'), ('\u{1d372}', '\u{1d3ff}'), ('\u{1d455}', '\u{1d455}'),
-        ('\u{1d49d}', '\u{1d49d}'), ('\u{1d4a0}', '\u{1d4a1}'), ('\u{1d4a3}', '\u{1d4a4}'),
-        ('\u{1d4a7}', '\u{1d4a8}'), ('\u{1d4ad}', '\u{1d4ad}'), ('\u{1d4ba}', '\u{1d4ba}'),
-        ('\u{1d4bc}', '\u{1d4bc}'), ('\u{1d4c4}', '\u{1d4c4}'), ('\u{1d506}', '\u{1d506}'),
-        ('\u{1d50b}', '\u{1d50c}'), ('\u{1d515}', '\u{1d515}'), ('\u{1d51d}', '\u{1d51d}'),
-        ('\u{1d53a}', '\u{1d53a}'), ('\u{1d53f}', '\u{1d53f}'), ('\u{1d545}', '\u{1d545}'),
-        ('\u{1d547}', '\u{1d549}'), ('\u{1d551}', '\u{1d551}'), ('\u{1d6a6}', '\u{1d6a7}'),
-        ('\u{1d7cc}', '\u{1d7cd}'), ('\u{1d800}', '\u{1e7ff}'), ('\u{1e8c5}', '\u{1e8c6}'),
-        ('\u{1e8d7}', '\u{1edff}'), ('\u{1ee04}', '\u{1ee04}'), ('\u{1ee20}', '\u{1ee20}'),
-        ('\u{1ee23}', '\u{1ee23}'), ('\u{1ee25}', '\u{1ee26}'), ('\u{1ee28}', '\u{1ee28}'),
-        ('\u{1ee33}', '\u{1ee33}'), ('\u{1ee38}', '\u{1ee38}'), ('\u{1ee3a}', '\u{1ee3a}'),
-        ('\u{1ee3c}', '\u{1ee41}'), ('\u{1ee43}', '\u{1ee46}'), ('\u{1ee48}', '\u{1ee48}'),
-        ('\u{1ee4a}', '\u{1ee4a}'), ('\u{1ee4c}', '\u{1ee4c}'), ('\u{1ee50}', '\u{1ee50}'),
-        ('\u{1ee53}', '\u{1ee53}'), ('\u{1ee55}', '\u{1ee56}'), ('\u{1ee58}', '\u{1ee58}'),
-        ('\u{1ee5a}', '\u{1ee5a}'), ('\u{1ee5c}', '\u{1ee5c}'), ('\u{1ee5e}', '\u{1ee5e}'),
-        ('\u{1ee60}', '\u{1ee60}'), ('\u{1ee63}', '\u{1ee63}'), ('\u{1ee65}', '\u{1ee66}'),
-        ('\u{1ee6b}', '\u{1ee6b}'), ('\u{1ee73}', '\u{1ee73}'), ('\u{1ee78}', '\u{1ee78}'),
-        ('\u{1ee7d}', '\u{1ee7d}'), ('\u{1ee7f}', '\u{1ee7f}'), ('\u{1ee8a}', '\u{1ee8a}'),
-        ('\u{1ee9c}', '\u{1eea0}'), ('\u{1eea4}', '\u{1eea4}'), ('\u{1eeaa}', '\u{1eeaa}'),
-        ('\u{1eebc}', '\u{1eeef}'), ('\u{1eef2}', '\u{1efff}'), ('\u{1f02c}', '\u{1f02f}'),
-        ('\u{1f094}', '\u{1f09f}'), ('\u{1f0af}', '\u{1f0b0}'), ('\u{1f0c0}', '\u{1f0c0}'),
-        ('\u{1f0d0}', '\u{1f0d0}'), ('\u{1f0f6}', '\u{1f0ff}'), ('\u{1f10d}', '\u{1f10f}'),
-        ('\u{1f12f}', '\u{1f12f}'), ('\u{1f16c}', '\u{1f16f}'), ('\u{1f19b}', '\u{1f1e5}'),
-        ('\u{1f203}', '\u{1f20f}'), ('\u{1f23b}', '\u{1f23f}'), ('\u{1f249}', '\u{1f24f}'),
-        ('\u{1f252}', '\u{1f2ff}'), ('\u{1f32d}', '\u{1f32f}'), ('\u{1f37e}', '\u{1f37f}'),
-        ('\u{1f3cf}', '\u{1f3d3}'), ('\u{1f3f8}', '\u{1f3ff}'), ('\u{1f4ff}', '\u{1f4ff}'),
-        ('\u{1f54b}', '\u{1f54f}'), ('\u{1f57a}', '\u{1f57a}'), ('\u{1f5a4}', '\u{1f5a4}'),
-        ('\u{1f643}', '\u{1f644}'), ('\u{1f6d0}', '\u{1f6df}'), ('\u{1f6ed}', '\u{1f6ef}'),
-        ('\u{1f6f4}', '\u{1f6ff}'), ('\u{1f774}', '\u{1f77f}'), ('\u{1f7d5}', '\u{1f7ff}'),
-        ('\u{1f80c}', '\u{1f80f}'), ('\u{1f848}', '\u{1f84f}'), ('\u{1f85a}', '\u{1f85f}'),
-        ('\u{1f888}', '\u{1f88f}'), ('\u{1f8ae}', '\u{1ffff}'), ('\u{20001}', '\u{2a6d5}'),
-        ('\u{2a6d7}', '\u{2a6ff}'), ('\u{2a701}', '\u{2b733}'), ('\u{2b735}', '\u{2b73f}'),
-        ('\u{2b741}', '\u{2b81c}'), ('\u{2b81e}', '\u{2f7ff}'), ('\u{2fa1e}', '\u{e0000}'),
-        ('\u{e0002}', '\u{e001f}'), ('\u{e0080}', '\u{e00ff}'), ('\u{e01f0}', '\u{effff}'),
-        ('\u{f0001}', '\u{ffffc}'), ('\u{ffffe}', '\u{fffff}'), ('\u{100001}', '\u{10fffc}'),
-        ('\u{10fffe}', '\u{10ffff}')
+        '\u{31ef}'), ('\u{321f}', '\u{321f}'), ('\u{32ff}', '\u{32ff}'), ('\u{4db6}', '\u{4dbf}'),
+        ('\u{9fcd}', '\u{9fff}'), ('\u{a48d}', '\u{a48f}'), ('\u{a4c7}', '\u{a4cf}'), ('\u{a62c}',
+        '\u{a63f}'), ('\u{a69e}', '\u{a69e}'), ('\u{a6f8}', '\u{a6ff}'), ('\u{a78f}', '\u{a78f}'),
+        ('\u{a7ae}', '\u{a7af}'), ('\u{a7b2}', '\u{a7f6}'), ('\u{a82c}', '\u{a82f}'), ('\u{a83a}',
+        '\u{a83f}'), ('\u{a878}', '\u{a87f}'), ('\u{a8c5}', '\u{a8cd}'), ('\u{a8da}', '\u{a8df}'),
+        ('\u{a8fc}', '\u{a8ff}'), ('\u{a954}', '\u{a95e}'), ('\u{a97d}', '\u{a97f}'), ('\u{a9ce}',
+        '\u{a9ce}'), ('\u{a9da}', '\u{a9dd}'), ('\u{a9ff}', '\u{a9ff}'), ('\u{aa37}', '\u{aa3f}'),
+        ('\u{aa4e}', '\u{aa4f}'), ('\u{aa5a}', '\u{aa5b}'), ('\u{aac3}', '\u{aada}'), ('\u{aaf7}',
+        '\u{ab00}'), ('\u{ab07}', '\u{ab08}'), ('\u{ab0f}', '\u{ab10}'), ('\u{ab17}', '\u{ab1f}'),
+        ('\u{ab27}', '\u{ab27}'), ('\u{ab2f}', '\u{ab2f}'), ('\u{ab60}', '\u{ab63}'), ('\u{ab66}',
+        '\u{abbf}'), ('\u{abee}', '\u{abef}'), ('\u{abfa}', '\u{abff}'), ('\u{d7a4}', '\u{d7af}'),
+        ('\u{d7c7}', '\u{d7ca}'), ('\u{d7fc}', '\u{d7ff}'), ('\u{fa6e}', '\u{fa6f}'), ('\u{fada}',
+        '\u{faff}'), ('\u{fb07}', '\u{fb12}'), ('\u{fb18}', '\u{fb1c}'), ('\u{fb37}', '\u{fb37}'),
+        ('\u{fb3d}', '\u{fb3d}'), ('\u{fb3f}', '\u{fb3f}'), ('\u{fb42}', '\u{fb42}'), ('\u{fb45}',
+        '\u{fb45}'), ('\u{fbc2}', '\u{fbd2}'), ('\u{fd40}', '\u{fd4f}'), ('\u{fd90}', '\u{fd91}'),
+        ('\u{fdc8}', '\u{fdef}'), ('\u{fdfe}', '\u{fdff}'), ('\u{fe1a}', '\u{fe1f}'), ('\u{fe2e}',
+        '\u{fe2f}'), ('\u{fe53}', '\u{fe53}'), ('\u{fe67}', '\u{fe67}'), ('\u{fe6c}', '\u{fe6f}'),
+        ('\u{fe75}', '\u{fe75}'), ('\u{fefd}', '\u{fefe}'), ('\u{ff00}', '\u{ff00}'), ('\u{ffbf}',
+        '\u{ffc1}'), ('\u{ffc8}', '\u{ffc9}'), ('\u{ffd0}', '\u{ffd1}'), ('\u{ffd8}', '\u{ffd9}'),
+        ('\u{ffdd}', '\u{ffdf}'), ('\u{ffe7}', '\u{ffe7}'), ('\u{ffef}', '\u{fff8}'), ('\u{fffe}',
+        '\u{ffff}'), ('\u{1000c}', '\u{1000c}'), ('\u{10027}', '\u{10027}'), ('\u{1003b}',
+        '\u{1003b}'), ('\u{1003e}', '\u{1003e}'), ('\u{1004e}', '\u{1004f}'), ('\u{1005e}',
+        '\u{1007f}'), ('\u{100fb}', '\u{100ff}'), ('\u{10103}', '\u{10106}'), ('\u{10134}',
+        '\u{10136}'), ('\u{1018d}', '\u{1018f}'), ('\u{1019c}', '\u{1019f}'), ('\u{101a1}',
+        '\u{101cf}'), ('\u{101fe}', '\u{1027f}'), ('\u{1029d}', '\u{1029f}'), ('\u{102d1}',
+        '\u{102df}'), ('\u{102fc}', '\u{102ff}'), ('\u{10324}', '\u{1032f}'), ('\u{1034b}',
+        '\u{1034f}'), ('\u{1037b}', '\u{1037f}'), ('\u{1039e}', '\u{1039e}'), ('\u{103c4}',
+        '\u{103c7}'), ('\u{103d6}', '\u{103ff}'), ('\u{1049e}', '\u{1049f}'), ('\u{104aa}',
+        '\u{104ff}'), ('\u{10528}', '\u{1052f}'), ('\u{10564}', '\u{1056e}'), ('\u{10570}',
+        '\u{105ff}'), ('\u{10737}', '\u{1073f}'), ('\u{10756}', '\u{1075f}'), ('\u{10768}',
+        '\u{107ff}'), ('\u{10806}', '\u{10807}'), ('\u{10809}', '\u{10809}'), ('\u{10836}',
+        '\u{10836}'), ('\u{10839}', '\u{1083b}'), ('\u{1083d}', '\u{1083e}'), ('\u{10856}',
+        '\u{10856}'), ('\u{1089f}', '\u{108a6}'), ('\u{108b0}', '\u{108ff}'), ('\u{1091c}',
+        '\u{1091e}'), ('\u{1093a}', '\u{1093e}'), ('\u{10940}', '\u{1097f}'), ('\u{109b8}',
+        '\u{109bd}'), ('\u{109c0}', '\u{109ff}'), ('\u{10a04}', '\u{10a04}'), ('\u{10a07}',
+        '\u{10a0b}'), ('\u{10a14}', '\u{10a14}'), ('\u{10a18}', '\u{10a18}'), ('\u{10a34}',
+        '\u{10a37}'), ('\u{10a3b}', '\u{10a3e}'), ('\u{10a48}', '\u{10a4f}'), ('\u{10a59}',
+        '\u{10a5f}'), ('\u{10aa0}', '\u{10abf}'), ('\u{10ae7}', '\u{10aea}'), ('\u{10af7}',
+        '\u{10aff}'), ('\u{10b36}', '\u{10b38}'), ('\u{10b56}', '\u{10b57}'), ('\u{10b73}',
+        '\u{10b77}'), ('\u{10b92}', '\u{10b98}'), ('\u{10b9d}', '\u{10ba8}'), ('\u{10bb0}',
+        '\u{10bff}'), ('\u{10c49}', '\u{10e5f}'), ('\u{10e7f}', '\u{10fff}'), ('\u{1104e}',
+        '\u{11051}'), ('\u{11070}', '\u{1107e}'), ('\u{110c2}', '\u{110cf}'), ('\u{110e9}',
+        '\u{110ef}'), ('\u{110fa}', '\u{110ff}'), ('\u{11135}', '\u{11135}'), ('\u{11144}',
+        '\u{1114f}'), ('\u{11177}', '\u{1117f}'), ('\u{111c9}', '\u{111cc}'), ('\u{111ce}',
+        '\u{111cf}'), ('\u{111db}', '\u{111e0}'), ('\u{111f5}', '\u{111ff}'), ('\u{11212}',
+        '\u{11212}'), ('\u{1123e}', '\u{112af}'), ('\u{112eb}', '\u{112ef}'), ('\u{112fa}',
+        '\u{11300}'), ('\u{11304}', '\u{11304}'), ('\u{1130d}', '\u{1130e}'), ('\u{11311}',
+        '\u{11312}'), ('\u{11329}', '\u{11329}'), ('\u{11331}', '\u{11331}'), ('\u{11334}',
+        '\u{11334}'), ('\u{1133a}', '\u{1133b}'), ('\u{11345}', '\u{11346}'), ('\u{11349}',
+        '\u{1134a}'), ('\u{1134e}', '\u{11356}'), ('\u{11358}', '\u{1135c}'), ('\u{11364}',
+        '\u{11365}'), ('\u{1136d}', '\u{1136f}'), ('\u{11375}', '\u{1147f}'), ('\u{114c8}',
+        '\u{114cf}'), ('\u{114da}', '\u{1157f}'), ('\u{115b6}', '\u{115b7}'), ('\u{115ca}',
+        '\u{115ff}'), ('\u{11645}', '\u{1164f}'), ('\u{1165a}', '\u{1167f}'), ('\u{116b8}',
+        '\u{116bf}'), ('\u{116ca}', '\u{1189f}'), ('\u{118f3}', '\u{118fe}'), ('\u{11900}',
+        '\u{11abf}'), ('\u{11af9}', '\u{11fff}'), ('\u{12399}', '\u{123ff}'), ('\u{1246f}',
+        '\u{1246f}'), ('\u{12475}', '\u{12fff}'), ('\u{1342f}', '\u{167ff}'), ('\u{16a39}',
+        '\u{16a3f}'), ('\u{16a5f}', '\u{16a5f}'), ('\u{16a6a}', '\u{16a6d}'), ('\u{16a70}',
+        '\u{16acf}'), ('\u{16aee}', '\u{16aef}'), ('\u{16af6}', '\u{16aff}'), ('\u{16b46}',
+        '\u{16b4f}'), ('\u{16b5a}', '\u{16b5a}'), ('\u{16b62}', '\u{16b62}'), ('\u{16b78}',
+        '\u{16b7c}'), ('\u{16b90}', '\u{16eff}'), ('\u{16f45}', '\u{16f4f}'), ('\u{16f7f}',
+        '\u{16f8e}'), ('\u{16fa0}', '\u{1afff}'), ('\u{1b002}', '\u{1bbff}'), ('\u{1bc6b}',
+        '\u{1bc6f}'), ('\u{1bc7d}', '\u{1bc7f}'), ('\u{1bc89}', '\u{1bc8f}'), ('\u{1bc9a}',
+        '\u{1bc9b}'), ('\u{1bca4}', '\u{1cfff}'), ('\u{1d0f6}', '\u{1d0ff}'), ('\u{1d127}',
+        '\u{1d128}'), ('\u{1d1de}', '\u{1d1ff}'), ('\u{1d246}', '\u{1d2ff}'), ('\u{1d357}',
+        '\u{1d35f}'), ('\u{1d372}', '\u{1d3ff}'), ('\u{1d455}', '\u{1d455}'), ('\u{1d49d}',
+        '\u{1d49d}'), ('\u{1d4a0}', '\u{1d4a1}'), ('\u{1d4a3}', '\u{1d4a4}'), ('\u{1d4a7}',
+        '\u{1d4a8}'), ('\u{1d4ad}', '\u{1d4ad}'), ('\u{1d4ba}', '\u{1d4ba}'), ('\u{1d4bc}',
+        '\u{1d4bc}'), ('\u{1d4c4}', '\u{1d4c4}'), ('\u{1d506}', '\u{1d506}'), ('\u{1d50b}',
+        '\u{1d50c}'), ('\u{1d515}', '\u{1d515}'), ('\u{1d51d}', '\u{1d51d}'), ('\u{1d53a}',
+        '\u{1d53a}'), ('\u{1d53f}', '\u{1d53f}'), ('\u{1d545}', '\u{1d545}'), ('\u{1d547}',
+        '\u{1d549}'), ('\u{1d551}', '\u{1d551}'), ('\u{1d6a6}', '\u{1d6a7}'), ('\u{1d7cc}',
+        '\u{1d7cd}'), ('\u{1d800}', '\u{1e7ff}'), ('\u{1e8c5}', '\u{1e8c6}'), ('\u{1e8d7}',
+        '\u{1edff}'), ('\u{1ee04}', '\u{1ee04}'), ('\u{1ee20}', '\u{1ee20}'), ('\u{1ee23}',
+        '\u{1ee23}'), ('\u{1ee25}', '\u{1ee26}'), ('\u{1ee28}', '\u{1ee28}'), ('\u{1ee33}',
+        '\u{1ee33}'), ('\u{1ee38}', '\u{1ee38}'), ('\u{1ee3a}', '\u{1ee3a}'), ('\u{1ee3c}',
+        '\u{1ee41}'), ('\u{1ee43}', '\u{1ee46}'), ('\u{1ee48}', '\u{1ee48}'), ('\u{1ee4a}',
+        '\u{1ee4a}'), ('\u{1ee4c}', '\u{1ee4c}'), ('\u{1ee50}', '\u{1ee50}'), ('\u{1ee53}',
+        '\u{1ee53}'), ('\u{1ee55}', '\u{1ee56}'), ('\u{1ee58}', '\u{1ee58}'), ('\u{1ee5a}',
+        '\u{1ee5a}'), ('\u{1ee5c}', '\u{1ee5c}'), ('\u{1ee5e}', '\u{1ee5e}'), ('\u{1ee60}',
+        '\u{1ee60}'), ('\u{1ee63}', '\u{1ee63}'), ('\u{1ee65}', '\u{1ee66}'), ('\u{1ee6b}',
+        '\u{1ee6b}'), ('\u{1ee73}', '\u{1ee73}'), ('\u{1ee78}', '\u{1ee78}'), ('\u{1ee7d}',
+        '\u{1ee7d}'), ('\u{1ee7f}', '\u{1ee7f}'), ('\u{1ee8a}', '\u{1ee8a}'), ('\u{1ee9c}',
+        '\u{1eea0}'), ('\u{1eea4}', '\u{1eea4}'), ('\u{1eeaa}', '\u{1eeaa}'), ('\u{1eebc}',
+        '\u{1eeef}'), ('\u{1eef2}', '\u{1efff}'), ('\u{1f02c}', '\u{1f02f}'), ('\u{1f094}',
+        '\u{1f09f}'), ('\u{1f0af}', '\u{1f0b0}'), ('\u{1f0c0}', '\u{1f0c0}'), ('\u{1f0d0}',
+        '\u{1f0d0}'), ('\u{1f0f6}', '\u{1f0ff}'), ('\u{1f10d}', '\u{1f10f}'), ('\u{1f12f}',
+        '\u{1f12f}'), ('\u{1f16c}', '\u{1f16f}'), ('\u{1f19b}', '\u{1f1e5}'), ('\u{1f203}',
+        '\u{1f20f}'), ('\u{1f23b}', '\u{1f23f}'), ('\u{1f249}', '\u{1f24f}'), ('\u{1f252}',
+        '\u{1f2ff}'), ('\u{1f32d}', '\u{1f32f}'), ('\u{1f37e}', '\u{1f37f}'), ('\u{1f3cf}',
+        '\u{1f3d3}'), ('\u{1f3f8}', '\u{1f3ff}'), ('\u{1f4ff}', '\u{1f4ff}'), ('\u{1f54b}',
+        '\u{1f54f}'), ('\u{1f57a}', '\u{1f57a}'), ('\u{1f5a4}', '\u{1f5a4}'), ('\u{1f643}',
+        '\u{1f644}'), ('\u{1f6d0}', '\u{1f6df}'), ('\u{1f6ed}', '\u{1f6ef}'), ('\u{1f6f4}',
+        '\u{1f6ff}'), ('\u{1f774}', '\u{1f77f}'), ('\u{1f7d5}', '\u{1f7ff}'), ('\u{1f80c}',
+        '\u{1f80f}'), ('\u{1f848}', '\u{1f84f}'), ('\u{1f85a}', '\u{1f85f}'), ('\u{1f888}',
+        '\u{1f88f}'), ('\u{1f8ae}', '\u{1ffff}'), ('\u{2a6d7}', '\u{2a6ff}'), ('\u{2b735}',
+        '\u{2b73f}'), ('\u{2b81e}', '\u{2f7ff}'), ('\u{2fa1e}', '\u{e0000}'), ('\u{e0002}',
+        '\u{e001f}'), ('\u{e0080}', '\u{e00ff}'), ('\u{e01f0}', '\u{effff}'), ('\u{ffffe}',
+        '\u{fffff}'), ('\u{10fffe}', '\u{10ffff}')
     ];
 
     pub const Co_table: &'static [(char, char)] = &[
-        ('\u{e000}', '\u{e000}'), ('\u{f8ff}', '\u{f8ff}'), ('\u{f0000}', '\u{f0000}'),
-        ('\u{ffffd}', '\u{ffffd}'), ('\u{100000}', '\u{100000}'), ('\u{10fffd}', '\u{10fffd}')
+        ('\u{e000}', '\u{f8ff}'), ('\u{f0000}', '\u{ffffd}'), ('\u{100000}', '\u{10fffd}')
     ];
 
     pub const L_table: &'static [(char, char)] = &[
@@ -511,86 +505,84 @@ pub fn Cc(c: char) -> bool {
         ('\u{2e2f}', '\u{2e2f}'), ('\u{3005}', '\u{3006}'), ('\u{3031}', '\u{3035}'), ('\u{303b}',
         '\u{303c}'), ('\u{3041}', '\u{3096}'), ('\u{309d}', '\u{309f}'), ('\u{30a1}', '\u{30fa}'),
         ('\u{30fc}', '\u{30ff}'), ('\u{3105}', '\u{312d}'), ('\u{3131}', '\u{318e}'), ('\u{31a0}',
-        '\u{31ba}'), ('\u{31f0}', '\u{31ff}'), ('\u{3400}', '\u{3400}'), ('\u{4db5}', '\u{4db5}'),
-        ('\u{4e00}', '\u{4e00}'), ('\u{9fcc}', '\u{9fcc}'), ('\u{a000}', '\u{a48c}'), ('\u{a4d0}',
-        '\u{a4fd}'), ('\u{a500}', '\u{a60c}'), ('\u{a610}', '\u{a61f}'), ('\u{a62a}', '\u{a62b}'),
-        ('\u{a640}', '\u{a66e}'), ('\u{a67f}', '\u{a69d}'), ('\u{a6a0}', '\u{a6e5}'), ('\u{a717}',
-        '\u{a71f}'), ('\u{a722}', '\u{a788}'), ('\u{a78b}', '\u{a78e}'), ('\u{a790}', '\u{a7ad}'),
-        ('\u{a7b0}', '\u{a7b1}'), ('\u{a7f7}', '\u{a801}'), ('\u{a803}', '\u{a805}'), ('\u{a807}',
-        '\u{a80a}'), ('\u{a80c}', '\u{a822}'), ('\u{a840}', '\u{a873}'), ('\u{a882}', '\u{a8b3}'),
-        ('\u{a8f2}', '\u{a8f7}'), ('\u{a8fb}', '\u{a8fb}'), ('\u{a90a}', '\u{a925}'), ('\u{a930}',
-        '\u{a946}'), ('\u{a960}', '\u{a97c}'), ('\u{a984}', '\u{a9b2}'), ('\u{a9cf}', '\u{a9cf}'),
-        ('\u{a9e0}', '\u{a9e4}'), ('\u{a9e6}', '\u{a9ef}'), ('\u{a9fa}', '\u{a9fe}'), ('\u{aa00}',
-        '\u{aa28}'), ('\u{aa40}', '\u{aa42}'), ('\u{aa44}', '\u{aa4b}'), ('\u{aa60}', '\u{aa76}'),
-        ('\u{aa7a}', '\u{aa7a}'), ('\u{aa7e}', '\u{aaaf}'), ('\u{aab1}', '\u{aab1}'), ('\u{aab5}',
-        '\u{aab6}'), ('\u{aab9}', '\u{aabd}'), ('\u{aac0}', '\u{aac0}'), ('\u{aac2}', '\u{aac2}'),
-        ('\u{aadb}', '\u{aadd}'), ('\u{aae0}', '\u{aaea}'), ('\u{aaf2}', '\u{aaf4}'), ('\u{ab01}',
-        '\u{ab06}'), ('\u{ab09}', '\u{ab0e}'), ('\u{ab11}', '\u{ab16}'), ('\u{ab20}', '\u{ab26}'),
-        ('\u{ab28}', '\u{ab2e}'), ('\u{ab30}', '\u{ab5a}'), ('\u{ab5c}', '\u{ab5f}'), ('\u{ab64}',
-        '\u{ab65}'), ('\u{abc0}', '\u{abe2}'), ('\u{ac00}', '\u{ac00}'), ('\u{d7a3}', '\u{d7a3}'),
-        ('\u{d7b0}', '\u{d7c6}'), ('\u{d7cb}', '\u{d7fb}'), ('\u{f900}', '\u{fa6d}'), ('\u{fa70}',
-        '\u{fad9}'), ('\u{fb00}', '\u{fb06}'), ('\u{fb13}', '\u{fb17}'), ('\u{fb1d}', '\u{fb1d}'),
-        ('\u{fb1f}', '\u{fb28}'), ('\u{fb2a}', '\u{fb36}'), ('\u{fb38}', '\u{fb3c}'), ('\u{fb3e}',
-        '\u{fb3e}'), ('\u{fb40}', '\u{fb41}'), ('\u{fb43}', '\u{fb44}'), ('\u{fb46}', '\u{fbb1}'),
-        ('\u{fbd3}', '\u{fd3d}'), ('\u{fd50}', '\u{fd8f}'), ('\u{fd92}', '\u{fdc7}'), ('\u{fdf0}',
-        '\u{fdfb}'), ('\u{fe70}', '\u{fe74}'), ('\u{fe76}', '\u{fefc}'), ('\u{ff21}', '\u{ff3a}'),
-        ('\u{ff41}', '\u{ff5a}'), ('\u{ff66}', '\u{ffbe}'), ('\u{ffc2}', '\u{ffc7}'), ('\u{ffca}',
-        '\u{ffcf}'), ('\u{ffd2}', '\u{ffd7}'), ('\u{ffda}', '\u{ffdc}'), ('\u{10000}', '\u{1000b}'),
-        ('\u{1000d}', '\u{10026}'), ('\u{10028}', '\u{1003a}'), ('\u{1003c}', '\u{1003d}'),
-        ('\u{1003f}', '\u{1004d}'), ('\u{10050}', '\u{1005d}'), ('\u{10080}', '\u{100fa}'),
-        ('\u{10280}', '\u{1029c}'), ('\u{102a0}', '\u{102d0}'), ('\u{10300}', '\u{1031f}'),
-        ('\u{10330}', '\u{10340}'), ('\u{10342}', '\u{10349}'), ('\u{10350}', '\u{10375}'),
-        ('\u{10380}', '\u{1039d}'), ('\u{103a0}', '\u{103c3}'), ('\u{103c8}', '\u{103cf}'),
-        ('\u{10400}', '\u{1049d}'), ('\u{10500}', '\u{10527}'), ('\u{10530}', '\u{10563}'),
-        ('\u{10600}', '\u{10736}'), ('\u{10740}', '\u{10755}'), ('\u{10760}', '\u{10767}'),
-        ('\u{10800}', '\u{10805}'), ('\u{10808}', '\u{10808}'), ('\u{1080a}', '\u{10835}'),
-        ('\u{10837}', '\u{10838}'), ('\u{1083c}', '\u{1083c}'), ('\u{1083f}', '\u{10855}'),
-        ('\u{10860}', '\u{10876}'), ('\u{10880}', '\u{1089e}'), ('\u{10900}', '\u{10915}'),
-        ('\u{10920}', '\u{10939}'), ('\u{10980}', '\u{109b7}'), ('\u{109be}', '\u{109bf}'),
-        ('\u{10a00}', '\u{10a00}'), ('\u{10a10}', '\u{10a13}'), ('\u{10a15}', '\u{10a17}'),
-        ('\u{10a19}', '\u{10a33}'), ('\u{10a60}', '\u{10a7c}'), ('\u{10a80}', '\u{10a9c}'),
-        ('\u{10ac0}', '\u{10ac7}'), ('\u{10ac9}', '\u{10ae4}'), ('\u{10b00}', '\u{10b35}'),
-        ('\u{10b40}', '\u{10b55}'), ('\u{10b60}', '\u{10b72}'), ('\u{10b80}', '\u{10b91}'),
-        ('\u{10c00}', '\u{10c48}'), ('\u{11003}', '\u{11037}'), ('\u{11083}', '\u{110af}'),
-        ('\u{110d0}', '\u{110e8}'), ('\u{11103}', '\u{11126}'), ('\u{11150}', '\u{11172}'),
-        ('\u{11176}', '\u{11176}'), ('\u{11183}', '\u{111b2}'), ('\u{111c1}', '\u{111c4}'),
-        ('\u{111da}', '\u{111da}'), ('\u{11200}', '\u{11211}'), ('\u{11213}', '\u{1122b}'),
-        ('\u{112b0}', '\u{112de}'), ('\u{11305}', '\u{1130c}'), ('\u{1130f}', '\u{11310}'),
-        ('\u{11313}', '\u{11328}'), ('\u{1132a}', '\u{11330}'), ('\u{11332}', '\u{11333}'),
-        ('\u{11335}', '\u{11339}'), ('\u{1133d}', '\u{1133d}'), ('\u{1135d}', '\u{11361}'),
-        ('\u{11480}', '\u{114af}'), ('\u{114c4}', '\u{114c5}'), ('\u{114c7}', '\u{114c7}'),
-        ('\u{11580}', '\u{115ae}'), ('\u{11600}', '\u{1162f}'), ('\u{11644}', '\u{11644}'),
-        ('\u{11680}', '\u{116aa}'), ('\u{118a0}', '\u{118df}'), ('\u{118ff}', '\u{118ff}'),
-        ('\u{11ac0}', '\u{11af8}'), ('\u{12000}', '\u{12398}'), ('\u{13000}', '\u{1342e}'),
-        ('\u{16800}', '\u{16a38}'), ('\u{16a40}', '\u{16a5e}'), ('\u{16ad0}', '\u{16aed}'),
-        ('\u{16b00}', '\u{16b2f}'), ('\u{16b40}', '\u{16b43}'), ('\u{16b63}', '\u{16b77}'),
-        ('\u{16b7d}', '\u{16b8f}'), ('\u{16f00}', '\u{16f44}'), ('\u{16f50}', '\u{16f50}'),
-        ('\u{16f93}', '\u{16f9f}'), ('\u{1b000}', '\u{1b001}'), ('\u{1bc00}', '\u{1bc6a}'),
-        ('\u{1bc70}', '\u{1bc7c}'), ('\u{1bc80}', '\u{1bc88}'), ('\u{1bc90}', '\u{1bc99}'),
-        ('\u{1d400}', '\u{1d454}'), ('\u{1d456}', '\u{1d49c}'), ('\u{1d49e}', '\u{1d49f}'),
-        ('\u{1d4a2}', '\u{1d4a2}'), ('\u{1d4a5}', '\u{1d4a6}'), ('\u{1d4a9}', '\u{1d4ac}'),
-        ('\u{1d4ae}', '\u{1d4b9}'), ('\u{1d4bb}', '\u{1d4bb}'), ('\u{1d4bd}', '\u{1d4c3}'),
-        ('\u{1d4c5}', '\u{1d505}'), ('\u{1d507}', '\u{1d50a}'), ('\u{1d50d}', '\u{1d514}'),
-        ('\u{1d516}', '\u{1d51c}'), ('\u{1d51e}', '\u{1d539}'), ('\u{1d53b}', '\u{1d53e}'),
-        ('\u{1d540}', '\u{1d544}'), ('\u{1d546}', '\u{1d546}'), ('\u{1d54a}', '\u{1d550}'),
-        ('\u{1d552}', '\u{1d6a5}'), ('\u{1d6a8}', '\u{1d6c0}'), ('\u{1d6c2}', '\u{1d6da}'),
-        ('\u{1d6dc}', '\u{1d6fa}'), ('\u{1d6fc}', '\u{1d714}'), ('\u{1d716}', '\u{1d734}'),
-        ('\u{1d736}', '\u{1d74e}'), ('\u{1d750}', '\u{1d76e}'), ('\u{1d770}', '\u{1d788}'),
-        ('\u{1d78a}', '\u{1d7a8}'), ('\u{1d7aa}', '\u{1d7c2}'), ('\u{1d7c4}', '\u{1d7cb}'),
-        ('\u{1e800}', '\u{1e8c4}'), ('\u{1ee00}', '\u{1ee03}'), ('\u{1ee05}', '\u{1ee1f}'),
-        ('\u{1ee21}', '\u{1ee22}'), ('\u{1ee24}', '\u{1ee24}'), ('\u{1ee27}', '\u{1ee27}'),
-        ('\u{1ee29}', '\u{1ee32}'), ('\u{1ee34}', '\u{1ee37}'), ('\u{1ee39}', '\u{1ee39}'),
-        ('\u{1ee3b}', '\u{1ee3b}'), ('\u{1ee42}', '\u{1ee42}'), ('\u{1ee47}', '\u{1ee47}'),
-        ('\u{1ee49}', '\u{1ee49}'), ('\u{1ee4b}', '\u{1ee4b}'), ('\u{1ee4d}', '\u{1ee4f}'),
-        ('\u{1ee51}', '\u{1ee52}'), ('\u{1ee54}', '\u{1ee54}'), ('\u{1ee57}', '\u{1ee57}'),
-        ('\u{1ee59}', '\u{1ee59}'), ('\u{1ee5b}', '\u{1ee5b}'), ('\u{1ee5d}', '\u{1ee5d}'),
-        ('\u{1ee5f}', '\u{1ee5f}'), ('\u{1ee61}', '\u{1ee62}'), ('\u{1ee64}', '\u{1ee64}'),
-        ('\u{1ee67}', '\u{1ee6a}'), ('\u{1ee6c}', '\u{1ee72}'), ('\u{1ee74}', '\u{1ee77}'),
-        ('\u{1ee79}', '\u{1ee7c}'), ('\u{1ee7e}', '\u{1ee7e}'), ('\u{1ee80}', '\u{1ee89}'),
-        ('\u{1ee8b}', '\u{1ee9b}'), ('\u{1eea1}', '\u{1eea3}'), ('\u{1eea5}', '\u{1eea9}'),
-        ('\u{1eeab}', '\u{1eebb}'), ('\u{20000}', '\u{20000}'), ('\u{2a6d6}', '\u{2a6d6}'),
-        ('\u{2a700}', '\u{2a700}'), ('\u{2b734}', '\u{2b734}'), ('\u{2b740}', '\u{2b740}'),
-        ('\u{2b81d}', '\u{2b81d}'), ('\u{2f800}', '\u{2fa1d}')
+        '\u{31ba}'), ('\u{31f0}', '\u{31ff}'), ('\u{3400}', '\u{4db5}'), ('\u{4e00}', '\u{9fcc}'),
+        ('\u{a000}', '\u{a48c}'), ('\u{a4d0}', '\u{a4fd}'), ('\u{a500}', '\u{a60c}'), ('\u{a610}',
+        '\u{a61f}'), ('\u{a62a}', '\u{a62b}'), ('\u{a640}', '\u{a66e}'), ('\u{a67f}', '\u{a69d}'),
+        ('\u{a6a0}', '\u{a6e5}'), ('\u{a717}', '\u{a71f}'), ('\u{a722}', '\u{a788}'), ('\u{a78b}',
+        '\u{a78e}'), ('\u{a790}', '\u{a7ad}'), ('\u{a7b0}', '\u{a7b1}'), ('\u{a7f7}', '\u{a801}'),
+        ('\u{a803}', '\u{a805}'), ('\u{a807}', '\u{a80a}'), ('\u{a80c}', '\u{a822}'), ('\u{a840}',
+        '\u{a873}'), ('\u{a882}', '\u{a8b3}'), ('\u{a8f2}', '\u{a8f7}'), ('\u{a8fb}', '\u{a8fb}'),
+        ('\u{a90a}', '\u{a925}'), ('\u{a930}', '\u{a946}'), ('\u{a960}', '\u{a97c}'), ('\u{a984}',
+        '\u{a9b2}'), ('\u{a9cf}', '\u{a9cf}'), ('\u{a9e0}', '\u{a9e4}'), ('\u{a9e6}', '\u{a9ef}'),
+        ('\u{a9fa}', '\u{a9fe}'), ('\u{aa00}', '\u{aa28}'), ('\u{aa40}', '\u{aa42}'), ('\u{aa44}',
+        '\u{aa4b}'), ('\u{aa60}', '\u{aa76}'), ('\u{aa7a}', '\u{aa7a}'), ('\u{aa7e}', '\u{aaaf}'),
+        ('\u{aab1}', '\u{aab1}'), ('\u{aab5}', '\u{aab6}'), ('\u{aab9}', '\u{aabd}'), ('\u{aac0}',
+        '\u{aac0}'), ('\u{aac2}', '\u{aac2}'), ('\u{aadb}', '\u{aadd}'), ('\u{aae0}', '\u{aaea}'),
+        ('\u{aaf2}', '\u{aaf4}'), ('\u{ab01}', '\u{ab06}'), ('\u{ab09}', '\u{ab0e}'), ('\u{ab11}',
+        '\u{ab16}'), ('\u{ab20}', '\u{ab26}'), ('\u{ab28}', '\u{ab2e}'), ('\u{ab30}', '\u{ab5a}'),
+        ('\u{ab5c}', '\u{ab5f}'), ('\u{ab64}', '\u{ab65}'), ('\u{abc0}', '\u{abe2}'), ('\u{ac00}',
+        '\u{d7a3}'), ('\u{d7b0}', '\u{d7c6}'), ('\u{d7cb}', '\u{d7fb}'), ('\u{f900}', '\u{fa6d}'),
+        ('\u{fa70}', '\u{fad9}'), ('\u{fb00}', '\u{fb06}'), ('\u{fb13}', '\u{fb17}'), ('\u{fb1d}',
+        '\u{fb1d}'), ('\u{fb1f}', '\u{fb28}'), ('\u{fb2a}', '\u{fb36}'), ('\u{fb38}', '\u{fb3c}'),
+        ('\u{fb3e}', '\u{fb3e}'), ('\u{fb40}', '\u{fb41}'), ('\u{fb43}', '\u{fb44}'), ('\u{fb46}',
+        '\u{fbb1}'), ('\u{fbd3}', '\u{fd3d}'), ('\u{fd50}', '\u{fd8f}'), ('\u{fd92}', '\u{fdc7}'),
+        ('\u{fdf0}', '\u{fdfb}'), ('\u{fe70}', '\u{fe74}'), ('\u{fe76}', '\u{fefc}'), ('\u{ff21}',
+        '\u{ff3a}'), ('\u{ff41}', '\u{ff5a}'), ('\u{ff66}', '\u{ffbe}'), ('\u{ffc2}', '\u{ffc7}'),
+        ('\u{ffca}', '\u{ffcf}'), ('\u{ffd2}', '\u{ffd7}'), ('\u{ffda}', '\u{ffdc}'), ('\u{10000}',
+        '\u{1000b}'), ('\u{1000d}', '\u{10026}'), ('\u{10028}', '\u{1003a}'), ('\u{1003c}',
+        '\u{1003d}'), ('\u{1003f}', '\u{1004d}'), ('\u{10050}', '\u{1005d}'), ('\u{10080}',
+        '\u{100fa}'), ('\u{10280}', '\u{1029c}'), ('\u{102a0}', '\u{102d0}'), ('\u{10300}',
+        '\u{1031f}'), ('\u{10330}', '\u{10340}'), ('\u{10342}', '\u{10349}'), ('\u{10350}',
+        '\u{10375}'), ('\u{10380}', '\u{1039d}'), ('\u{103a0}', '\u{103c3}'), ('\u{103c8}',
+        '\u{103cf}'), ('\u{10400}', '\u{1049d}'), ('\u{10500}', '\u{10527}'), ('\u{10530}',
+        '\u{10563}'), ('\u{10600}', '\u{10736}'), ('\u{10740}', '\u{10755}'), ('\u{10760}',
+        '\u{10767}'), ('\u{10800}', '\u{10805}'), ('\u{10808}', '\u{10808}'), ('\u{1080a}',
+        '\u{10835}'), ('\u{10837}', '\u{10838}'), ('\u{1083c}', '\u{1083c}'), ('\u{1083f}',
+        '\u{10855}'), ('\u{10860}', '\u{10876}'), ('\u{10880}', '\u{1089e}'), ('\u{10900}',
+        '\u{10915}'), ('\u{10920}', '\u{10939}'), ('\u{10980}', '\u{109b7}'), ('\u{109be}',
+        '\u{109bf}'), ('\u{10a00}', '\u{10a00}'), ('\u{10a10}', '\u{10a13}'), ('\u{10a15}',
+        '\u{10a17}'), ('\u{10a19}', '\u{10a33}'), ('\u{10a60}', '\u{10a7c}'), ('\u{10a80}',
+        '\u{10a9c}'), ('\u{10ac0}', '\u{10ac7}'), ('\u{10ac9}', '\u{10ae4}'), ('\u{10b00}',
+        '\u{10b35}'), ('\u{10b40}', '\u{10b55}'), ('\u{10b60}', '\u{10b72}'), ('\u{10b80}',
+        '\u{10b91}'), ('\u{10c00}', '\u{10c48}'), ('\u{11003}', '\u{11037}'), ('\u{11083}',
+        '\u{110af}'), ('\u{110d0}', '\u{110e8}'), ('\u{11103}', '\u{11126}'), ('\u{11150}',
+        '\u{11172}'), ('\u{11176}', '\u{11176}'), ('\u{11183}', '\u{111b2}'), ('\u{111c1}',
+        '\u{111c4}'), ('\u{111da}', '\u{111da}'), ('\u{11200}', '\u{11211}'), ('\u{11213}',
+        '\u{1122b}'), ('\u{112b0}', '\u{112de}'), ('\u{11305}', '\u{1130c}'), ('\u{1130f}',
+        '\u{11310}'), ('\u{11313}', '\u{11328}'), ('\u{1132a}', '\u{11330}'), ('\u{11332}',
+        '\u{11333}'), ('\u{11335}', '\u{11339}'), ('\u{1133d}', '\u{1133d}'), ('\u{1135d}',
+        '\u{11361}'), ('\u{11480}', '\u{114af}'), ('\u{114c4}', '\u{114c5}'), ('\u{114c7}',
+        '\u{114c7}'), ('\u{11580}', '\u{115ae}'), ('\u{11600}', '\u{1162f}'), ('\u{11644}',
+        '\u{11644}'), ('\u{11680}', '\u{116aa}'), ('\u{118a0}', '\u{118df}'), ('\u{118ff}',
+        '\u{118ff}'), ('\u{11ac0}', '\u{11af8}'), ('\u{12000}', '\u{12398}'), ('\u{13000}',
+        '\u{1342e}'), ('\u{16800}', '\u{16a38}'), ('\u{16a40}', '\u{16a5e}'), ('\u{16ad0}',
+        '\u{16aed}'), ('\u{16b00}', '\u{16b2f}'), ('\u{16b40}', '\u{16b43}'), ('\u{16b63}',
+        '\u{16b77}'), ('\u{16b7d}', '\u{16b8f}'), ('\u{16f00}', '\u{16f44}'), ('\u{16f50}',
+        '\u{16f50}'), ('\u{16f93}', '\u{16f9f}'), ('\u{1b000}', '\u{1b001}'), ('\u{1bc00}',
+        '\u{1bc6a}'), ('\u{1bc70}', '\u{1bc7c}'), ('\u{1bc80}', '\u{1bc88}'), ('\u{1bc90}',
+        '\u{1bc99}'), ('\u{1d400}', '\u{1d454}'), ('\u{1d456}', '\u{1d49c}'), ('\u{1d49e}',
+        '\u{1d49f}'), ('\u{1d4a2}', '\u{1d4a2}'), ('\u{1d4a5}', '\u{1d4a6}'), ('\u{1d4a9}',
+        '\u{1d4ac}'), ('\u{1d4ae}', '\u{1d4b9}'), ('\u{1d4bb}', '\u{1d4bb}'), ('\u{1d4bd}',
+        '\u{1d4c3}'), ('\u{1d4c5}', '\u{1d505}'), ('\u{1d507}', '\u{1d50a}'), ('\u{1d50d}',
+        '\u{1d514}'), ('\u{1d516}', '\u{1d51c}'), ('\u{1d51e}', '\u{1d539}'), ('\u{1d53b}',
+        '\u{1d53e}'), ('\u{1d540}', '\u{1d544}'), ('\u{1d546}', '\u{1d546}'), ('\u{1d54a}',
+        '\u{1d550}'), ('\u{1d552}', '\u{1d6a5}'), ('\u{1d6a8}', '\u{1d6c0}'), ('\u{1d6c2}',
+        '\u{1d6da}'), ('\u{1d6dc}', '\u{1d6fa}'), ('\u{1d6fc}', '\u{1d714}'), ('\u{1d716}',
+        '\u{1d734}'), ('\u{1d736}', '\u{1d74e}'), ('\u{1d750}', '\u{1d76e}'), ('\u{1d770}',
+        '\u{1d788}'), ('\u{1d78a}', '\u{1d7a8}'), ('\u{1d7aa}', '\u{1d7c2}'), ('\u{1d7c4}',
+        '\u{1d7cb}'), ('\u{1e800}', '\u{1e8c4}'), ('\u{1ee00}', '\u{1ee03}'), ('\u{1ee05}',
+        '\u{1ee1f}'), ('\u{1ee21}', '\u{1ee22}'), ('\u{1ee24}', '\u{1ee24}'), ('\u{1ee27}',
+        '\u{1ee27}'), ('\u{1ee29}', '\u{1ee32}'), ('\u{1ee34}', '\u{1ee37}'), ('\u{1ee39}',
+        '\u{1ee39}'), ('\u{1ee3b}', '\u{1ee3b}'), ('\u{1ee42}', '\u{1ee42}'), ('\u{1ee47}',
+        '\u{1ee47}'), ('\u{1ee49}', '\u{1ee49}'), ('\u{1ee4b}', '\u{1ee4b}'), ('\u{1ee4d}',
+        '\u{1ee4f}'), ('\u{1ee51}', '\u{1ee52}'), ('\u{1ee54}', '\u{1ee54}'), ('\u{1ee57}',
+        '\u{1ee57}'), ('\u{1ee59}', '\u{1ee59}'), ('\u{1ee5b}', '\u{1ee5b}'), ('\u{1ee5d}',
+        '\u{1ee5d}'), ('\u{1ee5f}', '\u{1ee5f}'), ('\u{1ee61}', '\u{1ee62}'), ('\u{1ee64}',
+        '\u{1ee64}'), ('\u{1ee67}', '\u{1ee6a}'), ('\u{1ee6c}', '\u{1ee72}'), ('\u{1ee74}',
+        '\u{1ee77}'), ('\u{1ee79}', '\u{1ee7c}'), ('\u{1ee7e}', '\u{1ee7e}'), ('\u{1ee80}',
+        '\u{1ee89}'), ('\u{1ee8b}', '\u{1ee9b}'), ('\u{1eea1}', '\u{1eea3}'), ('\u{1eea5}',
+        '\u{1eea9}'), ('\u{1eeab}', '\u{1eebb}'), ('\u{20000}', '\u{2a6d6}'), ('\u{2a700}',
+        '\u{2b734}'), ('\u{2b740}', '\u{2b81d}'), ('\u{2f800}', '\u{2fa1d}')
     ];
 
     pub const LC_table: &'static [(char, char)] = &[
@@ -896,72 +888,71 @@ pub fn Cc(c: char) -> bool {
         '\u{2dd6}'), ('\u{2dd8}', '\u{2dde}'), ('\u{3006}', '\u{3006}'), ('\u{303c}', '\u{303c}'),
         ('\u{3041}', '\u{3096}'), ('\u{309f}', '\u{309f}'), ('\u{30a1}', '\u{30fa}'), ('\u{30ff}',
         '\u{30ff}'), ('\u{3105}', '\u{312d}'), ('\u{3131}', '\u{318e}'), ('\u{31a0}', '\u{31ba}'),
-        ('\u{31f0}', '\u{31ff}'), ('\u{3400}', '\u{3400}'), ('\u{4db5}', '\u{4db5}'), ('\u{4e00}',
-        '\u{4e00}'), ('\u{9fcc}', '\u{9fcc}'), ('\u{a000}', '\u{a014}'), ('\u{a016}', '\u{a48c}'),
-        ('\u{a4d0}', '\u{a4f7}'), ('\u{a500}', '\u{a60b}'), ('\u{a610}', '\u{a61f}'), ('\u{a62a}',
-        '\u{a62b}'), ('\u{a66e}', '\u{a66e}'), ('\u{a6a0}', '\u{a6e5}'), ('\u{a7f7}', '\u{a7f7}'),
-        ('\u{a7fb}', '\u{a801}'), ('\u{a803}', '\u{a805}'), ('\u{a807}', '\u{a80a}'), ('\u{a80c}',
-        '\u{a822}'), ('\u{a840}', '\u{a873}'), ('\u{a882}', '\u{a8b3}'), ('\u{a8f2}', '\u{a8f7}'),
-        ('\u{a8fb}', '\u{a8fb}'), ('\u{a90a}', '\u{a925}'), ('\u{a930}', '\u{a946}'), ('\u{a960}',
-        '\u{a97c}'), ('\u{a984}', '\u{a9b2}'), ('\u{a9e0}', '\u{a9e4}'), ('\u{a9e7}', '\u{a9ef}'),
-        ('\u{a9fa}', '\u{a9fe}'), ('\u{aa00}', '\u{aa28}'), ('\u{aa40}', '\u{aa42}'), ('\u{aa44}',
-        '\u{aa4b}'), ('\u{aa60}', '\u{aa6f}'), ('\u{aa71}', '\u{aa76}'), ('\u{aa7a}', '\u{aa7a}'),
-        ('\u{aa7e}', '\u{aaaf}'), ('\u{aab1}', '\u{aab1}'), ('\u{aab5}', '\u{aab6}'), ('\u{aab9}',
-        '\u{aabd}'), ('\u{aac0}', '\u{aac0}'), ('\u{aac2}', '\u{aac2}'), ('\u{aadb}', '\u{aadc}'),
-        ('\u{aae0}', '\u{aaea}'), ('\u{aaf2}', '\u{aaf2}'), ('\u{ab01}', '\u{ab06}'), ('\u{ab09}',
-        '\u{ab0e}'), ('\u{ab11}', '\u{ab16}'), ('\u{ab20}', '\u{ab26}'), ('\u{ab28}', '\u{ab2e}'),
-        ('\u{abc0}', '\u{abe2}'), ('\u{ac00}', '\u{ac00}'), ('\u{d7a3}', '\u{d7a3}'), ('\u{d7b0}',
-        '\u{d7c6}'), ('\u{d7cb}', '\u{d7fb}'), ('\u{f900}', '\u{fa6d}'), ('\u{fa70}', '\u{fad9}'),
-        ('\u{fb1d}', '\u{fb1d}'), ('\u{fb1f}', '\u{fb28}'), ('\u{fb2a}', '\u{fb36}'), ('\u{fb38}',
-        '\u{fb3c}'), ('\u{fb3e}', '\u{fb3e}'), ('\u{fb40}', '\u{fb41}'), ('\u{fb43}', '\u{fb44}'),
-        ('\u{fb46}', '\u{fbb1}'), ('\u{fbd3}', '\u{fd3d}'), ('\u{fd50}', '\u{fd8f}'), ('\u{fd92}',
-        '\u{fdc7}'), ('\u{fdf0}', '\u{fdfb}'), ('\u{fe70}', '\u{fe74}'), ('\u{fe76}', '\u{fefc}'),
-        ('\u{ff66}', '\u{ff6f}'), ('\u{ff71}', '\u{ff9d}'), ('\u{ffa0}', '\u{ffbe}'), ('\u{ffc2}',
-        '\u{ffc7}'), ('\u{ffca}', '\u{ffcf}'), ('\u{ffd2}', '\u{ffd7}'), ('\u{ffda}', '\u{ffdc}'),
-        ('\u{10000}', '\u{1000b}'), ('\u{1000d}', '\u{10026}'), ('\u{10028}', '\u{1003a}'),
-        ('\u{1003c}', '\u{1003d}'), ('\u{1003f}', '\u{1004d}'), ('\u{10050}', '\u{1005d}'),
-        ('\u{10080}', '\u{100fa}'), ('\u{10280}', '\u{1029c}'), ('\u{102a0}', '\u{102d0}'),
-        ('\u{10300}', '\u{1031f}'), ('\u{10330}', '\u{10340}'), ('\u{10342}', '\u{10349}'),
-        ('\u{10350}', '\u{10375}'), ('\u{10380}', '\u{1039d}'), ('\u{103a0}', '\u{103c3}'),
-        ('\u{103c8}', '\u{103cf}'), ('\u{10450}', '\u{1049d}'), ('\u{10500}', '\u{10527}'),
-        ('\u{10530}', '\u{10563}'), ('\u{10600}', '\u{10736}'), ('\u{10740}', '\u{10755}'),
-        ('\u{10760}', '\u{10767}'), ('\u{10800}', '\u{10805}'), ('\u{10808}', '\u{10808}'),
-        ('\u{1080a}', '\u{10835}'), ('\u{10837}', '\u{10838}'), ('\u{1083c}', '\u{1083c}'),
-        ('\u{1083f}', '\u{10855}'), ('\u{10860}', '\u{10876}'), ('\u{10880}', '\u{1089e}'),
-        ('\u{10900}', '\u{10915}'), ('\u{10920}', '\u{10939}'), ('\u{10980}', '\u{109b7}'),
-        ('\u{109be}', '\u{109bf}'), ('\u{10a00}', '\u{10a00}'), ('\u{10a10}', '\u{10a13}'),
-        ('\u{10a15}', '\u{10a17}'), ('\u{10a19}', '\u{10a33}'), ('\u{10a60}', '\u{10a7c}'),
-        ('\u{10a80}', '\u{10a9c}'), ('\u{10ac0}', '\u{10ac7}'), ('\u{10ac9}', '\u{10ae4}'),
-        ('\u{10b00}', '\u{10b35}'), ('\u{10b40}', '\u{10b55}'), ('\u{10b60}', '\u{10b72}'),
-        ('\u{10b80}', '\u{10b91}'), ('\u{10c00}', '\u{10c48}'), ('\u{11003}', '\u{11037}'),
-        ('\u{11083}', '\u{110af}'), ('\u{110d0}', '\u{110e8}'), ('\u{11103}', '\u{11126}'),
-        ('\u{11150}', '\u{11172}'), ('\u{11176}', '\u{11176}'), ('\u{11183}', '\u{111b2}'),
-        ('\u{111c1}', '\u{111c4}'), ('\u{111da}', '\u{111da}'), ('\u{11200}', '\u{11211}'),
-        ('\u{11213}', '\u{1122b}'), ('\u{112b0}', '\u{112de}'), ('\u{11305}', '\u{1130c}'),
-        ('\u{1130f}', '\u{11310}'), ('\u{11313}', '\u{11328}'), ('\u{1132a}', '\u{11330}'),
-        ('\u{11332}', '\u{11333}'), ('\u{11335}', '\u{11339}'), ('\u{1133d}', '\u{1133d}'),
-        ('\u{1135d}', '\u{11361}'), ('\u{11480}', '\u{114af}'), ('\u{114c4}', '\u{114c5}'),
-        ('\u{114c7}', '\u{114c7}'), ('\u{11580}', '\u{115ae}'), ('\u{11600}', '\u{1162f}'),
-        ('\u{11644}', '\u{11644}'), ('\u{11680}', '\u{116aa}'), ('\u{118ff}', '\u{118ff}'),
-        ('\u{11ac0}', '\u{11af8}'), ('\u{12000}', '\u{12398}'), ('\u{13000}', '\u{1342e}'),
-        ('\u{16800}', '\u{16a38}'), ('\u{16a40}', '\u{16a5e}'), ('\u{16ad0}', '\u{16aed}'),
-        ('\u{16b00}', '\u{16b2f}'), ('\u{16b63}', '\u{16b77}'), ('\u{16b7d}', '\u{16b8f}'),
-        ('\u{16f00}', '\u{16f44}'), ('\u{16f50}', '\u{16f50}'), ('\u{1b000}', '\u{1b001}'),
-        ('\u{1bc00}', '\u{1bc6a}'), ('\u{1bc70}', '\u{1bc7c}'), ('\u{1bc80}', '\u{1bc88}'),
-        ('\u{1bc90}', '\u{1bc99}'), ('\u{1e800}', '\u{1e8c4}'), ('\u{1ee00}', '\u{1ee03}'),
-        ('\u{1ee05}', '\u{1ee1f}'), ('\u{1ee21}', '\u{1ee22}'), ('\u{1ee24}', '\u{1ee24}'),
-        ('\u{1ee27}', '\u{1ee27}'), ('\u{1ee29}', '\u{1ee32}'), ('\u{1ee34}', '\u{1ee37}'),
-        ('\u{1ee39}', '\u{1ee39}'), ('\u{1ee3b}', '\u{1ee3b}'), ('\u{1ee42}', '\u{1ee42}'),
-        ('\u{1ee47}', '\u{1ee47}'), ('\u{1ee49}', '\u{1ee49}'), ('\u{1ee4b}', '\u{1ee4b}'),
-        ('\u{1ee4d}', '\u{1ee4f}'), ('\u{1ee51}', '\u{1ee52}'), ('\u{1ee54}', '\u{1ee54}'),
-        ('\u{1ee57}', '\u{1ee57}'), ('\u{1ee59}', '\u{1ee59}'), ('\u{1ee5b}', '\u{1ee5b}'),
-        ('\u{1ee5d}', '\u{1ee5d}'), ('\u{1ee5f}', '\u{1ee5f}'), ('\u{1ee61}', '\u{1ee62}'),
-        ('\u{1ee64}', '\u{1ee64}'), ('\u{1ee67}', '\u{1ee6a}'), ('\u{1ee6c}', '\u{1ee72}'),
-        ('\u{1ee74}', '\u{1ee77}'), ('\u{1ee79}', '\u{1ee7c}'), ('\u{1ee7e}', '\u{1ee7e}'),
-        ('\u{1ee80}', '\u{1ee89}'), ('\u{1ee8b}', '\u{1ee9b}'), ('\u{1eea1}', '\u{1eea3}'),
-        ('\u{1eea5}', '\u{1eea9}'), ('\u{1eeab}', '\u{1eebb}'), ('\u{20000}', '\u{20000}'),
-        ('\u{2a6d6}', '\u{2a6d6}'), ('\u{2a700}', '\u{2a700}'), ('\u{2b734}', '\u{2b734}'),
-        ('\u{2b740}', '\u{2b740}'), ('\u{2b81d}', '\u{2b81d}'), ('\u{2f800}', '\u{2fa1d}')
+        ('\u{31f0}', '\u{31ff}'), ('\u{3400}', '\u{4db5}'), ('\u{4e00}', '\u{9fcc}'), ('\u{a000}',
+        '\u{a014}'), ('\u{a016}', '\u{a48c}'), ('\u{a4d0}', '\u{a4f7}'), ('\u{a500}', '\u{a60b}'),
+        ('\u{a610}', '\u{a61f}'), ('\u{a62a}', '\u{a62b}'), ('\u{a66e}', '\u{a66e}'), ('\u{a6a0}',
+        '\u{a6e5}'), ('\u{a7f7}', '\u{a7f7}'), ('\u{a7fb}', '\u{a801}'), ('\u{a803}', '\u{a805}'),
+        ('\u{a807}', '\u{a80a}'), ('\u{a80c}', '\u{a822}'), ('\u{a840}', '\u{a873}'), ('\u{a882}',
+        '\u{a8b3}'), ('\u{a8f2}', '\u{a8f7}'), ('\u{a8fb}', '\u{a8fb}'), ('\u{a90a}', '\u{a925}'),
+        ('\u{a930}', '\u{a946}'), ('\u{a960}', '\u{a97c}'), ('\u{a984}', '\u{a9b2}'), ('\u{a9e0}',
+        '\u{a9e4}'), ('\u{a9e7}', '\u{a9ef}'), ('\u{a9fa}', '\u{a9fe}'), ('\u{aa00}', '\u{aa28}'),
+        ('\u{aa40}', '\u{aa42}'), ('\u{aa44}', '\u{aa4b}'), ('\u{aa60}', '\u{aa6f}'), ('\u{aa71}',
+        '\u{aa76}'), ('\u{aa7a}', '\u{aa7a}'), ('\u{aa7e}', '\u{aaaf}'), ('\u{aab1}', '\u{aab1}'),
+        ('\u{aab5}', '\u{aab6}'), ('\u{aab9}', '\u{aabd}'), ('\u{aac0}', '\u{aac0}'), ('\u{aac2}',
+        '\u{aac2}'), ('\u{aadb}', '\u{aadc}'), ('\u{aae0}', '\u{aaea}'), ('\u{aaf2}', '\u{aaf2}'),
+        ('\u{ab01}', '\u{ab06}'), ('\u{ab09}', '\u{ab0e}'), ('\u{ab11}', '\u{ab16}'), ('\u{ab20}',
+        '\u{ab26}'), ('\u{ab28}', '\u{ab2e}'), ('\u{abc0}', '\u{abe2}'), ('\u{ac00}', '\u{d7a3}'),
+        ('\u{d7b0}', '\u{d7c6}'), ('\u{d7cb}', '\u{d7fb}'), ('\u{f900}', '\u{fa6d}'), ('\u{fa70}',
+        '\u{fad9}'), ('\u{fb1d}', '\u{fb1d}'), ('\u{fb1f}', '\u{fb28}'), ('\u{fb2a}', '\u{fb36}'),
+        ('\u{fb38}', '\u{fb3c}'), ('\u{fb3e}', '\u{fb3e}'), ('\u{fb40}', '\u{fb41}'), ('\u{fb43}',
+        '\u{fb44}'), ('\u{fb46}', '\u{fbb1}'), ('\u{fbd3}', '\u{fd3d}'), ('\u{fd50}', '\u{fd8f}'),
+        ('\u{fd92}', '\u{fdc7}'), ('\u{fdf0}', '\u{fdfb}'), ('\u{fe70}', '\u{fe74}'), ('\u{fe76}',
+        '\u{fefc}'), ('\u{ff66}', '\u{ff6f}'), ('\u{ff71}', '\u{ff9d}'), ('\u{ffa0}', '\u{ffbe}'),
+        ('\u{ffc2}', '\u{ffc7}'), ('\u{ffca}', '\u{ffcf}'), ('\u{ffd2}', '\u{ffd7}'), ('\u{ffda}',
+        '\u{ffdc}'), ('\u{10000}', '\u{1000b}'), ('\u{1000d}', '\u{10026}'), ('\u{10028}',
+        '\u{1003a}'), ('\u{1003c}', '\u{1003d}'), ('\u{1003f}', '\u{1004d}'), ('\u{10050}',
+        '\u{1005d}'), ('\u{10080}', '\u{100fa}'), ('\u{10280}', '\u{1029c}'), ('\u{102a0}',
+        '\u{102d0}'), ('\u{10300}', '\u{1031f}'), ('\u{10330}', '\u{10340}'), ('\u{10342}',
+        '\u{10349}'), ('\u{10350}', '\u{10375}'), ('\u{10380}', '\u{1039d}'), ('\u{103a0}',
+        '\u{103c3}'), ('\u{103c8}', '\u{103cf}'), ('\u{10450}', '\u{1049d}'), ('\u{10500}',
+        '\u{10527}'), ('\u{10530}', '\u{10563}'), ('\u{10600}', '\u{10736}'), ('\u{10740}',
+        '\u{10755}'), ('\u{10760}', '\u{10767}'), ('\u{10800}', '\u{10805}'), ('\u{10808}',
+        '\u{10808}'), ('\u{1080a}', '\u{10835}'), ('\u{10837}', '\u{10838}'), ('\u{1083c}',
+        '\u{1083c}'), ('\u{1083f}', '\u{10855}'), ('\u{10860}', '\u{10876}'), ('\u{10880}',
+        '\u{1089e}'), ('\u{10900}', '\u{10915}'), ('\u{10920}', '\u{10939}'), ('\u{10980}',
+        '\u{109b7}'), ('\u{109be}', '\u{109bf}'), ('\u{10a00}', '\u{10a00}'), ('\u{10a10}',
+        '\u{10a13}'), ('\u{10a15}', '\u{10a17}'), ('\u{10a19}', '\u{10a33}'), ('\u{10a60}',
+        '\u{10a7c}'), ('\u{10a80}', '\u{10a9c}'), ('\u{10ac0}', '\u{10ac7}'), ('\u{10ac9}',
+        '\u{10ae4}'), ('\u{10b00}', '\u{10b35}'), ('\u{10b40}', '\u{10b55}'), ('\u{10b60}',
+        '\u{10b72}'), ('\u{10b80}', '\u{10b91}'), ('\u{10c00}', '\u{10c48}'), ('\u{11003}',
+        '\u{11037}'), ('\u{11083}', '\u{110af}'), ('\u{110d0}', '\u{110e8}'), ('\u{11103}',
+        '\u{11126}'), ('\u{11150}', '\u{11172}'), ('\u{11176}', '\u{11176}'), ('\u{11183}',
+        '\u{111b2}'), ('\u{111c1}', '\u{111c4}'), ('\u{111da}', '\u{111da}'), ('\u{11200}',
+        '\u{11211}'), ('\u{11213}', '\u{1122b}'), ('\u{112b0}', '\u{112de}'), ('\u{11305}',
+        '\u{1130c}'), ('\u{1130f}', '\u{11310}'), ('\u{11313}', '\u{11328}'), ('\u{1132a}',
+        '\u{11330}'), ('\u{11332}', '\u{11333}'), ('\u{11335}', '\u{11339}'), ('\u{1133d}',
+        '\u{1133d}'), ('\u{1135d}', '\u{11361}'), ('\u{11480}', '\u{114af}'), ('\u{114c4}',
+        '\u{114c5}'), ('\u{114c7}', '\u{114c7}'), ('\u{11580}', '\u{115ae}'), ('\u{11600}',
+        '\u{1162f}'), ('\u{11644}', '\u{11644}'), ('\u{11680}', '\u{116aa}'), ('\u{118ff}',
+        '\u{118ff}'), ('\u{11ac0}', '\u{11af8}'), ('\u{12000}', '\u{12398}'), ('\u{13000}',
+        '\u{1342e}'), ('\u{16800}', '\u{16a38}'), ('\u{16a40}', '\u{16a5e}'), ('\u{16ad0}',
+        '\u{16aed}'), ('\u{16b00}', '\u{16b2f}'), ('\u{16b63}', '\u{16b77}'), ('\u{16b7d}',
+        '\u{16b8f}'), ('\u{16f00}', '\u{16f44}'), ('\u{16f50}', '\u{16f50}'), ('\u{1b000}',
+        '\u{1b001}'), ('\u{1bc00}', '\u{1bc6a}'), ('\u{1bc70}', '\u{1bc7c}'), ('\u{1bc80}',
+        '\u{1bc88}'), ('\u{1bc90}', '\u{1bc99}'), ('\u{1e800}', '\u{1e8c4}'), ('\u{1ee00}',
+        '\u{1ee03}'), ('\u{1ee05}', '\u{1ee1f}'), ('\u{1ee21}', '\u{1ee22}'), ('\u{1ee24}',
+        '\u{1ee24}'), ('\u{1ee27}', '\u{1ee27}'), ('\u{1ee29}', '\u{1ee32}'), ('\u{1ee34}',
+        '\u{1ee37}'), ('\u{1ee39}', '\u{1ee39}'), ('\u{1ee3b}', '\u{1ee3b}'), ('\u{1ee42}',
+        '\u{1ee42}'), ('\u{1ee47}', '\u{1ee47}'), ('\u{1ee49}', '\u{1ee49}'), ('\u{1ee4b}',
+        '\u{1ee4b}'), ('\u{1ee4d}', '\u{1ee4f}'), ('\u{1ee51}', '\u{1ee52}'), ('\u{1ee54}',
+        '\u{1ee54}'), ('\u{1ee57}', '\u{1ee57}'), ('\u{1ee59}', '\u{1ee59}'), ('\u{1ee5b}',
+        '\u{1ee5b}'), ('\u{1ee5d}', '\u{1ee5d}'), ('\u{1ee5f}', '\u{1ee5f}'), ('\u{1ee61}',
+        '\u{1ee62}'), ('\u{1ee64}', '\u{1ee64}'), ('\u{1ee67}', '\u{1ee6a}'), ('\u{1ee6c}',
+        '\u{1ee72}'), ('\u{1ee74}', '\u{1ee77}'), ('\u{1ee79}', '\u{1ee7c}'), ('\u{1ee7e}',
+        '\u{1ee7e}'), ('\u{1ee80}', '\u{1ee89}'), ('\u{1ee8b}', '\u{1ee9b}'), ('\u{1eea1}',
+        '\u{1eea3}'), ('\u{1eea5}', '\u{1eea9}'), ('\u{1eeab}', '\u{1eebb}'), ('\u{20000}',
+        '\u{2a6d6}'), ('\u{2a700}', '\u{2b734}'), ('\u{2b740}', '\u{2b81d}'), ('\u{2f800}',
+        '\u{2fa1d}')
     ];
 
     pub const Lt_table: &'static [(char, char)] = &[
index 38cbe5c7dea16218d1942fc7eef3f9e70406dc18..57439addeaa1a85b1acb596fd36ca3d6cad76045 100644 (file)
@@ -525,7 +525,7 @@ fn next(&mut self) -> Option<u16> {
             return Some(tmp);
         }
 
-        let mut buf = [0u16; 2];
+        let mut buf = [0; 2];
         self.chars.next().map(|ch| {
             let n = CharExt::encode_utf16(ch, &mut buf).unwrap_or(0);
             if n == 2 { self.extra = buf[1]; }
index b89c3f039b61edbb077771eda2ee8a718dbec7e0..bff69076975642c64e76dbeaa53476bfa7212086 160000 (submodule)
--- a/src/llvm
+++ b/src/llvm
@@ -1 +1 @@
-Subproject commit b89c3f039b61edbb077771eda2ee8a718dbec7e0
+Subproject commit bff69076975642c64e76dbeaa53476bfa7212086
index 1fb30e15400efb7c8fa71965cd92cce3cfad98c7..731773917e09118452152504f0df79da09bd10e4 100644 (file)
 //! Implementation of the `build` subcommand, used to compile a book.
 
 use std::env;
-use std::fs::{self, File, TempDir};
+use std::fs::{self, File};
 use std::io::prelude::*;
 use std::io::{self, BufWriter};
 use std::path::{Path, PathBuf};
+use rustc_back::tempdir::TempDir;
 
 use subcommand::Subcommand;
 use term::Term;
index 848f960839e6e0c4cd56fb5ec4823e9c1112cc7a..8df622b0b5d0c2e58c5b4a984dc0316293d44bf6 100644 (file)
 
 #![feature(core)]
 #![feature(exit_status)]
-#![feature(fs)]
 #![feature(io)]
 #![feature(old_io)]
 #![feature(path)]
 #![feature(rustdoc)]
-#![feature(tempdir)]
+#![feature(rustc_private)]
 
 extern crate rustdoc;
+extern crate rustc_back;
 
 use std::env;
 use std::error::Error;
index 2cd7ed6c1550781d31be6ab2bf7a54e56b264294..1ea40fc46a52196764be269294605440a042f794 100644 (file)
@@ -1,4 +1,4 @@
 # If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
 # The actual contents of this file do not matter, but to trigger a change on the
 # build bots then the contents should be changed so git updates the mtime.
-2015-02-19
+2015-03-04
index 318f66b946585d6cbd44f6760ab8e0e56f54d62b..5e85e3dff6afacfd51d8b3b5f055d718be3f21b9 100644 (file)
@@ -1,4 +1,5 @@
 S 2015-02-25 880fb89
+  bitrig-x86_64 8cdc4ca0a80103100f46cbf8caa9fe497df048c5
   freebsd-x86_64 f4cbe4227739de986444211f8ee8d74745ab8f7f
   linux-i386 3278ebbce8cb269acc0614dac5ddac07eab6a99c
   linux-x86_64 72287d0d88de3e5a53bae78ac0d958e1a7637d73
index 98881eb09bf9bc89848da0b64cee29cfc309cb6e..44d3a69fde48ffea2eb6d1a9e2bb1982ebd20af4 100644 (file)
@@ -16,7 +16,7 @@ pub struct cat {
     }
 
     impl cat {
-        pub fn speak(&mut self) { self.meows += 1_usize; }
+        pub fn speak(&mut self) { self.meows += 1; }
         pub fn meow_count(&mut self) -> uint { self.meows }
     }
 
index 9d7905cdebd04eb10cb8f1ccca51fe02c1bea8ab..c10ef805a65de941aafdf7029ca799a496c01dd6 100644 (file)
@@ -34,8 +34,8 @@ pub fn eat(&mut self) -> bool {
     impl cat {
         pub fn meow(&mut self) {
             println!("Meow");
-            self.meows += 1_usize;
-            if self.meows % 5_usize == 0_usize {
+            self.meows += 1;
+            if self.meows % 5 == 0 {
                 self.how_hungry += 1;
             }
         }
index 96a06968c5fa3cc961496cba8a20ee33163eddc7..28fa354fef34ceda4b8a0a66998aa6f35b8e80b0 100644 (file)
@@ -26,8 +26,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     impl cat {
         fn meow(&mut self) {
             println!("Meow");
-            self.meows += 1_usize;
-            if self.meows % 5_usize == 0_usize {
+            self.meows += 1;
+            if self.meows % 5 == 0 {
                 self.how_hungry += 1;
             }
         }
index 6ee497370e8e33da19591b74937a8327ba3493fd..a650b30e593f9d9f4c7c6c76acd9518c16fc4745 100644 (file)
@@ -20,7 +20,7 @@ fn to<F>(&self, v: uint, mut f: F) where F: FnMut(uint) {
         let mut i = *self;
         while i < v {
             f(i);
-            i += 1_usize;
+            i += 1;
         }
     }
 }
index 8e00b0dc7be74f444d5234084a323a4b2234160b..07d03b4c7590ff9d66d6e9d2fd8beff8245759dc 100644 (file)
 
 #[inline]
 pub fn iter<T, F>(v: &[T], mut f: F) where F: FnMut(&T) {
-    let mut i = 0_usize;
+    let mut i = 0;
     let n = v.len();
     while i < n {
         f(&v[i]);
-        i += 1_usize;
+        i += 1;
     }
 }
index ce041118906ed9a2f9c174e454000d9248493648..f3ad2a3aeb963c2208924e41d0a360c88e40d258 100644 (file)
 
 // same as cci_iter_lib, more-or-less, but not marked inline
 pub fn iter<F>(v: Vec<uint> , mut f: F) where F: FnMut(uint) {
-    let mut i = 0_usize;
+    let mut i = 0;
     let n = v.len();
     while i < n {
         f(v[i]);
-        i += 1_usize;
+        i += 1;
     }
 }
diff --git a/src/test/auxiliary/internal_unstable.rs b/src/test/auxiliary/internal_unstable.rs
new file mode 100644 (file)
index 0000000..3d59b8e
--- /dev/null
@@ -0,0 +1,60 @@
+// Copyright 2015 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.
+
+#![feature(staged_api, allow_internal_unstable)]
+#![staged_api]
+#![stable(feature = "stable", since = "1.0.0")]
+
+#[unstable(feature = "function")]
+pub fn unstable() {}
+
+
+#[stable(feature = "stable", since = "1.0.0")]
+pub struct Foo {
+    #[unstable(feature = "struct_field")]
+    pub x: u8
+}
+
+#[allow_internal_unstable]
+#[macro_export]
+macro_rules! call_unstable_allow {
+    () => { $crate::unstable() }
+}
+
+#[allow_internal_unstable]
+#[macro_export]
+macro_rules! construct_unstable_allow {
+    ($e: expr) => {
+        $crate::Foo { x: $e }
+    }
+}
+
+#[allow_internal_unstable]
+#[macro_export]
+macro_rules! pass_through_allow {
+    ($e: expr) => { $e }
+}
+
+#[macro_export]
+macro_rules! call_unstable_noallow {
+    () => { $crate::unstable() }
+}
+
+#[macro_export]
+macro_rules! construct_unstable_noallow {
+    ($e: expr) => {
+        $crate::Foo { x: $e }
+    }
+}
+
+#[macro_export]
+macro_rules! pass_through_noallow {
+    ($e: expr) => { $e }
+}
index 9c72cb1a6800ad7b25e62f098c2dafad4e4907cf..aaeccc6e89883865bdbdb5607523f9d6ce369f0c 100644 (file)
@@ -11,5 +11,5 @@
 #![crate_type = "dylib"]
 #[macro_export]
 macro_rules! reexported {
-    () => ( 3_usize )
+    () => ( 3 )
 }
index 20c84c4ba5b4a9863d9623e558bb940d9cc7bb98..30b18a3618ffa09174f70bcb64757472a20a5934 100644 (file)
@@ -47,5 +47,5 @@ pub fn plugin_registrar(reg: &mut Registry) {
     let args = reg.args().clone();
     reg.register_syntax_extension(token::intern("plugin_args"),
         // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-        NormalTT(Box::new(Expander { args: args, }), None));
+        NormalTT(Box::new(Expander { args: args, }), None, false));
 }
index e5c4211110558f21adb45c51e2d07be93a504551..0ea7c0005707defad9aa5a93cbb278a2f64d7c80 100644 (file)
@@ -47,7 +47,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
     };
 
     let mut text = &*text;
-    let mut total = 0_usize;
+    let mut total = 0;
     while !text.is_empty() {
         match NUMERALS.iter().find(|&&(rn, _)| text.starts_with(rn)) {
             Some(&(rn, val)) => {
index a5178c03443f796bff07ebc61cdb2785bf974657..26925a350676491d09bb2ceb64dbd0c8658bc064 100644 (file)
@@ -14,9 +14,9 @@
 
 #[inline]
 pub fn has_closures() -> uint {
-    let x = 1_usize;
+    let x = 1;
     let mut f = move || x;
-    let y = 1_usize;
+    let y = 1;
     let g = || y;
     f() + g()
 }
index 53c52ae3019f015a11204a29d1132b145fb0b4de..de88c7733b379b87e7edf7996e4a434d26b41b95 100644 (file)
@@ -49,7 +49,7 @@ fn new() -> Noise2DContext {
             *x = random_gradient(&mut rng);
         }
 
-        let mut permutations = [0i32; 256];
+        let mut permutations = [0; 256];
         for (i, x) in permutations.iter_mut().enumerate() {
             *x = i as i32;
         }
index 73e7c8eb073d1884d23be37a9c5de2fea9417489..4a8bb24270d7fe7b79d7de42234ef56b274f084c 100644 (file)
@@ -145,7 +145,7 @@ fn creature(
     to_rendezvous: Sender<CreatureInfo>,
     to_rendezvous_log: Sender<String>
 ) {
-    let mut creatures_met = 0i32;
+    let mut creatures_met = 0;
     let mut evil_clones_met = 0;
     let mut rendezvous = from_rendezvous.iter();
 
index f7de935d08fdd3b67fcfc13d264a66154d48a8bf..3688c224a7df4b5aacd9cd5b6018270ff92af224 100644 (file)
@@ -91,7 +91,7 @@ fn new(n: u32) -> Perm {
     }
 
     fn get(&mut self, mut idx: i32) -> P {
-        let mut pp = [0u8; 16];
+        let mut pp = [0; 16];
         self.permcount = idx as u32;
         for (i, place) in self.perm.p.iter_mut().enumerate() {
             *place = i as i32 + 1;
@@ -183,7 +183,7 @@ fn main() {
     let n = std::env::args()
         .nth(1)
         .and_then(|arg| arg.parse().ok())
-        .unwrap_or(2i32);
+        .unwrap_or(2);
 
     let (checksum, maxflips) = fannkuch(n);
     println!("{}\nPfannkuchen({}) = {}", checksum, n, maxflips);
index 277c3ee73dff1aa8693eb4154292a13d85c8822a..9cee75757aa1c13a6805e00424a950173ccfa6d2 100644 (file)
@@ -121,7 +121,7 @@ fn new(alu: &'static str, w: &'a mut W) -> RepeatFasta<'a, W> {
 
     fn make(&mut self, n: usize) -> IoResult<()> {
         let alu_len = self.alu.len();
-        let mut buf = repeat(0u8).take(alu_len + LINE_LEN).collect::<Vec<_>>();
+        let mut buf = repeat(0).take(alu_len + LINE_LEN).collect::<Vec<_>>();
         let alu: &[u8] = self.alu.as_bytes();
 
         copy_memory(&mut buf, alu);
index 2c640c4b092556cab96df76819b992575a0fbf66..e15f9d99ff691fa4f3f92d49633e7d0cba306541 100644 (file)
@@ -89,7 +89,7 @@ fn make_fasta<W: Writer, I: Iterator<Item=u8>>(
     -> std::old_io::IoResult<()>
 {
     try!(wr.write(header.as_bytes()));
-    let mut line = [0u8; LINE_LENGTH + 1];
+    let mut line = [0; LINE_LENGTH + 1];
     while n > 0 {
         let nb = min(LINE_LENGTH, n);
         for i in 0..nb {
index 5cfe62d967c580b9face83b4cb4c074fe79fd429..9e5885041b66b98875006e13b6b4238322c1c8d1 100644 (file)
@@ -78,11 +78,11 @@ fn push_char(&self, c: u8) -> Code {
     }
 
     fn rotate(&self, c: u8, frame: usize) -> Code {
-        Code(self.push_char(c).hash() & ((1u64 << (2 * frame)) - 1))
+        Code(self.push_char(c).hash() & ((1 << (2 * frame)) - 1))
     }
 
     fn pack(string: &str) -> Code {
-        string.bytes().fold(Code(0u64), |a, b| a.push_char(b))
+        string.bytes().fold(Code(0), |a, b| a.push_char(b))
     }
 
     fn unpack(&self, frame: usize) -> String {
index a94fe0ccd959848a364d890eef0a1058128ad958..79a5245a40849bc8842324917e8ed84b7c1ae110 100644 (file)
@@ -169,7 +169,7 @@ fn make_masks() -> Vec<Vec<Vec<u64> > > {
         .map(|(id, p)| transform(p, id != 3))
         .collect();
 
-    (0i32..50).map(|yx| {
+    (0..50).map(|yx| {
         transforms.iter().enumerate().map(|(id, t)| {
             t.iter().filter_map(|p| mask(yx / 5, yx % 5, id, p)).collect()
         }).collect()
@@ -211,7 +211,7 @@ fn filter_masks(masks: &mut Vec<Vec<Vec<u64>>>) {
 
 // Gets the identifier of a mask.
 fn get_id(m: u64) -> u8 {
-    for id in 0u8..10 {
+    for id in 0..10 {
         if m & (1 << (id + 50) as usize) != 0 {return id;}
     }
     panic!("{:016x} does not have a valid identifier", m);
index f308743ad136d276fbf2c472bbc5690ad0a2ac69..9a82614510eb265431596d82b1d34ec472e7a203 100644 (file)
@@ -60,7 +60,7 @@ pub fn read(reader: &mut BufRead) -> Sudoku {
         reader.read_line(&mut s).unwrap();
         assert_eq!(s, "9,9\n");
 
-        let mut g = repeat(vec![0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8])
+        let mut g = repeat(vec![0, 0, 0, 0, 0, 0, 0, 0, 0])
                           .take(10).collect::<Vec<_>>();
         for line in reader.lines() {
             let line = line.unwrap();
@@ -94,10 +94,10 @@ pub fn write(&self, writer: &mut Write) {
     // solve sudoku grid
     pub fn solve(&mut self) {
         let mut work: Vec<(u8, u8)> = Vec::new(); /* queue of uncolored fields */
-        for row in 0u8..9u8 {
-            for col in 0u8..9u8 {
+        for row in 0..9 {
+            for col in 0..9 {
                 let color = self.grid[row as usize][col as usize];
-                if color == 0u8 {
+                if color == 0 {
                     work.push((row, col));
                 }
             }
@@ -122,7 +122,7 @@ pub fn solve(&mut self) {
     }
 
     fn next_color(&mut self, row: u8, col: u8, start_color: u8) -> bool {
-        if start_color < 10u8 {
+        if start_color < 10 {
             // colors not yet used
             let mut avail: Box<_> = box Colors::new(start_color);
 
@@ -132,15 +132,15 @@ fn next_color(&mut self, row: u8, col: u8, start_color: u8) -> bool {
             // find first remaining color that is available
             let next = avail.next();
             self.grid[row as usize][col as usize] = next;
-            return 0u8 != next;
+            return 0 != next;
         }
-        self.grid[row as usize][col as usize] = 0u8;
+        self.grid[row as usize][col as usize] = 0;
         return false;
     }
 
     // find colors available in neighbourhood of (row, col)
     fn drop_colors(&mut self, avail: &mut Colors, row: u8, col: u8) {
-        for idx in 0u8..9u8 {
+        for idx in 0..9 {
             /* check same column fields */
             avail.remove(self.grid[idx as usize][col as usize]);
             /* check same row fields */
@@ -148,10 +148,10 @@ fn drop_colors(&mut self, avail: &mut Colors, row: u8, col: u8) {
         }
 
         // check same block fields
-        let row0 = (row / 3u8) * 3u8;
-        let col0 = (col / 3u8) * 3u8;
-        for alt_row in row0..row0 + 3u8 {
-            for alt_col in col0..col0 + 3u8 {
+        let row0 = (row / 3) * 3;
+        let col0 = (col / 3) * 3;
+        for alt_row in row0..row0 + 3 {
+            for alt_col in col0..col0 + 3 {
                 avail.remove(self.grid[alt_row as usize][alt_col as usize]);
             }
         }
@@ -161,29 +161,29 @@ fn drop_colors(&mut self, avail: &mut Colors, row: u8, col: u8) {
 // Stores available colors as simple bitfield, bit 0 is always unset
 struct Colors(u16);
 
-static HEADS: u16 = (1u16 << 10) - 1; /* bits 9..0 */
+static HEADS: u16 = (1 << 10) - 1; /* bits 9..0 */
 
 impl Colors {
     fn new(start_color: u8) -> Colors {
         // Sets bits 9..start_color
-        let tails = !0u16 << start_color as usize;
+        let tails = !0 << start_color as usize;
         return Colors(HEADS & tails);
     }
 
     fn next(&self) -> u8 {
         let Colors(c) = *self;
         let val = c & HEADS;
-        if 0u16 == val {
-            return 0u8;
+        if 0 == val {
+            return 0;
         } else {
             return val.trailing_zeros() as u8
         }
     }
 
     fn remove(&mut self, color: u8) {
-        if color != 0u8 {
+        if color != 0 {
             let Colors(val) = *self;
-            let mask = !(1u16 << color as usize);
+            let mask = !(1 << color as usize);
             *self    = Colors(val & mask);
         }
     }
@@ -191,57 +191,57 @@ fn remove(&mut self, color: u8) {
 
 static DEFAULT_SUDOKU: [[u8;9];9] = [
          /* 0    1    2    3    4    5    6    7    8    */
-  /* 0 */  [0u8, 4u8, 0u8, 6u8, 0u8, 0u8, 0u8, 3u8, 2u8],
-  /* 1 */  [0u8, 0u8, 8u8, 0u8, 2u8, 0u8, 0u8, 0u8, 0u8],
-  /* 2 */  [7u8, 0u8, 0u8, 8u8, 0u8, 0u8, 0u8, 0u8, 0u8],
-  /* 3 */  [0u8, 0u8, 0u8, 5u8, 0u8, 0u8, 0u8, 0u8, 0u8],
-  /* 4 */  [0u8, 5u8, 0u8, 0u8, 0u8, 3u8, 6u8, 0u8, 0u8],
-  /* 5 */  [6u8, 8u8, 0u8, 0u8, 0u8, 0u8, 0u8, 9u8, 0u8],
-  /* 6 */  [0u8, 9u8, 5u8, 0u8, 0u8, 6u8, 0u8, 7u8, 0u8],
-  /* 7 */  [0u8, 0u8, 0u8, 0u8, 4u8, 0u8, 0u8, 6u8, 0u8],
-  /* 8 */  [4u8, 0u8, 0u8, 0u8, 0u8, 7u8, 2u8, 0u8, 3u8]
+  /* 0 */  [0, 4, 0, 6, 0, 0, 0, 3, 2],
+  /* 1 */  [0, 0, 8, 0, 2, 0, 0, 0, 0],
+  /* 2 */  [7, 0, 0, 8, 0, 0, 0, 0, 0],
+  /* 3 */  [0, 0, 0, 5, 0, 0, 0, 0, 0],
+  /* 4 */  [0, 5, 0, 0, 0, 3, 6, 0, 0],
+  /* 5 */  [6, 8, 0, 0, 0, 0, 0, 9, 0],
+  /* 6 */  [0, 9, 5, 0, 0, 6, 0, 7, 0],
+  /* 7 */  [0, 0, 0, 0, 4, 0, 0, 6, 0],
+  /* 8 */  [4, 0, 0, 0, 0, 7, 2, 0, 3]
 ];
 
 #[cfg(test)]
 static DEFAULT_SOLUTION: [[u8;9];9] = [
          /* 0    1    2    3    4    5    6    7    8    */
-  /* 0 */  [1u8, 4u8, 9u8, 6u8, 7u8, 5u8, 8u8, 3u8, 2u8],
-  /* 1 */  [5u8, 3u8, 8u8, 1u8, 2u8, 9u8, 7u8, 4u8, 6u8],
-  /* 2 */  [7u8, 2u8, 6u8, 8u8, 3u8, 4u8, 1u8, 5u8, 9u8],
-  /* 3 */  [9u8, 1u8, 4u8, 5u8, 6u8, 8u8, 3u8, 2u8, 7u8],
-  /* 4 */  [2u8, 5u8, 7u8, 4u8, 9u8, 3u8, 6u8, 1u8, 8u8],
-  /* 5 */  [6u8, 8u8, 3u8, 7u8, 1u8, 2u8, 5u8, 9u8, 4u8],
-  /* 6 */  [3u8, 9u8, 5u8, 2u8, 8u8, 6u8, 4u8, 7u8, 1u8],
-  /* 7 */  [8u8, 7u8, 2u8, 3u8, 4u8, 1u8, 9u8, 6u8, 5u8],
-  /* 8 */  [4u8, 6u8, 1u8, 9u8, 5u8, 7u8, 2u8, 8u8, 3u8]
+  /* 0 */  [1, 4, 9, 6, 7, 5, 8, 3, 2],
+  /* 1 */  [5, 3, 8, 1, 2, 9, 7, 4, 6],
+  /* 2 */  [7, 2, 6, 8, 3, 4, 1, 5, 9],
+  /* 3 */  [9, 1, 4, 5, 6, 8, 3, 2, 7],
+  /* 4 */  [2, 5, 7, 4, 9, 3, 6, 1, 8],
+  /* 5 */  [6, 8, 3, 7, 1, 2, 5, 9, 4],
+  /* 6 */  [3, 9, 5, 2, 8, 6, 4, 7, 1],
+  /* 7 */  [8, 7, 2, 3, 4, 1, 9, 6, 5],
+  /* 8 */  [4, 6, 1, 9, 5, 7, 2, 8, 3]
 ];
 
 #[test]
 fn colors_new_works() {
-    assert_eq!(*Colors::new(1), 1022u16);
-    assert_eq!(*Colors::new(2), 1020u16);
-    assert_eq!(*Colors::new(3), 1016u16);
-    assert_eq!(*Colors::new(4), 1008u16);
-    assert_eq!(*Colors::new(5), 992u16);
-    assert_eq!(*Colors::new(6), 960u16);
-    assert_eq!(*Colors::new(7), 896u16);
-    assert_eq!(*Colors::new(8), 768u16);
-    assert_eq!(*Colors::new(9), 512u16);
+    assert_eq!(*Colors::new(1), 1022);
+    assert_eq!(*Colors::new(2), 1020);
+    assert_eq!(*Colors::new(3), 1016);
+    assert_eq!(*Colors::new(4), 1008);
+    assert_eq!(*Colors::new(5), 992);
+    assert_eq!(*Colors::new(6), 960);
+    assert_eq!(*Colors::new(7), 896);
+    assert_eq!(*Colors::new(8), 768);
+    assert_eq!(*Colors::new(9), 512);
 }
 
 #[test]
 fn colors_next_works() {
-    assert_eq!(Colors(0).next(), 0u8);
-    assert_eq!(Colors(2).next(), 1u8);
-    assert_eq!(Colors(4).next(), 2u8);
-    assert_eq!(Colors(8).next(), 3u8);
-    assert_eq!(Colors(16).next(), 4u8);
-    assert_eq!(Colors(32).next(), 5u8);
-    assert_eq!(Colors(64).next(), 6u8);
-    assert_eq!(Colors(128).next(), 7u8);
-    assert_eq!(Colors(256).next(), 8u8);
-    assert_eq!(Colors(512).next(), 9u8);
-    assert_eq!(Colors(1024).next(), 0u8);
+    assert_eq!(Colors(0).next(), 0);
+    assert_eq!(Colors(2).next(), 1);
+    assert_eq!(Colors(4).next(), 2);
+    assert_eq!(Colors(8).next(), 3);
+    assert_eq!(Colors(16).next(), 4);
+    assert_eq!(Colors(32).next(), 5);
+    assert_eq!(Colors(64).next(), 6);
+    assert_eq!(Colors(128).next(), 7);
+    assert_eq!(Colors(256).next(), 8);
+    assert_eq!(Colors(512).next(), 9);
+    assert_eq!(Colors(1024).next(), 0);
 }
 
 #[test]
@@ -253,7 +253,7 @@ fn colors_remove_works() {
     colors.remove(1);
 
     // THEN
-    assert_eq!(colors.next(), 2u8);
+    assert_eq!(colors.next(), 2);
 }
 
 #[test]
index 9b696e05c50df27f5f7c62b341aa113d83ba565b..06fc3db58c1598db6836e14ca4286eb5ac48691e 100644 (file)
@@ -15,6 +15,6 @@
 
 fn main() {
     match () {
-        Trait { x: 42_usize } => () //~ ERROR use of trait `Trait` in a struct pattern
+        Trait { x: 42 } => () //~ ERROR use of trait `Trait` in a struct pattern
     }
 }
index 7111c00d1246aa32dfa7ad3edbcd787f1e4b4f0f..6c9b8f81b2faf6779cb23a297d3f778d59db929a 100644 (file)
@@ -9,14 +9,14 @@
 // except according to those terms.
 
 fn main() {
-    let _x: i32 = [1i32, 2, 3];
+    let _x: i32 = [1, 2, 3];
     //~^ ERROR mismatched types
     //~| expected `i32`
-    //~| found `[i32; 3]`
+    //~| found `[_; 3]`
     //~| expected i32
     //~| found array of 3 elements
 
-    let x: &[i32] = &[1i32, 2, 3];
+    let x: &[i32] = &[1, 2, 3];
     let _y: &i32 = x;
     //~^ ERROR mismatched types
     //~| expected `&i32`
index 01481af817b7e5caa4bc303c4b1742a1db947603..3cb608a9c5ed29e4ba11be0a4a9d2929c59677c4 100644 (file)
@@ -20,8 +20,8 @@ pub fn main() {
     let x: isize;
     let y: isize;
     unsafe {
-        asm!("mov $1, $0" : "=r"(x) : "=r"(5_usize)); //~ ERROR operand constraint contains '='
-        asm!("mov $1, $0" : "=r"(y) : "+r"(5_usize)); //~ ERROR operand constraint contains '+'
+        asm!("mov $1, $0" : "=r"(x) : "=r"(5)); //~ ERROR operand constraint contains '='
+        asm!("mov $1, $0" : "=r"(y) : "+r"(5)); //~ ERROR operand constraint contains '+'
     }
     foo(x);
     foo(y);
index ff56fb14f7d5753cc2b42845b0fe60482dfcf481..8c8451623d511ee2384a54982d873c064893ae7f 100644 (file)
@@ -21,7 +21,7 @@ pub fn main() {
     x = 1; //~ NOTE prior assignment occurs here
     foo(x);
     unsafe {
-        asm!("mov $1, $0" : "=r"(x) : "r"(5_usize));
+        asm!("mov $1, $0" : "=r"(x) : "r"(5));
         //~^ ERROR re-assignment of immutable variable `x`
     }
     foo(x);
index 17c19c77ab9abd6ebe988e00b0b72132ef849870..9cf43bebe65ab858393f57817450ed8c28f29b1d 100644 (file)
@@ -19,7 +19,7 @@
 pub fn main() {
     let x: isize;
     unsafe {
-        asm!("mov $1, $0" : "r"(x) : "r"(5_usize)); //~ ERROR output operand constraint lacks '='
+        asm!("mov $1, $0" : "r"(x) : "r"(5)); //~ ERROR output operand constraint lacks '='
     }
     foo(x);
 }
index d32ea327d0a8cfceeaec66c6cecffeee40de157a..4518ce36b6da13140019cfdc9a7d5cac12fc25f4 100644 (file)
@@ -15,7 +15,7 @@ struct cat {
 }
 
 impl cat {
-    pub fn speak(&self) { self.meows += 1_usize; }
+    pub fn speak(&self) { self.meows += 1; }
 }
 
 fn cat(in_x : usize, in_y : isize) -> cat {
@@ -26,6 +26,6 @@ fn cat(in_x : usize, in_y : isize) -> cat {
 }
 
 fn main() {
-  let nyan : cat = cat(52_usize, 99);
+  let nyan : cat = cat(52, 99);
   nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method
 }
index 58a8314af211cd581dd2666a0d07f53d2d641614..de315a41361a7900667705cb9eb7882a7c871548 100644 (file)
@@ -11,7 +11,7 @@
 // Tests that a function with a ! annotation always actually fails
 
 fn bad_bang(i: usize) -> ! {
-    return 7_usize; //~ ERROR `return` in a function declared as diverging [E0166]
+    return 7; //~ ERROR `return` in a function declared as diverging [E0166]
 }
 
 fn main() { bad_bang(5); }
index 03c24c2fa3d3e2f15d8eea4caf1f18afaf7fd895..f0ecf31fd10a2532f93c470f1a5ca4aff4bfabd4 100644 (file)
@@ -11,7 +11,7 @@
 // Tests that a function with a ! annotation always actually fails
 
 fn bad_bang(i: usize) -> ! { //~ ERROR computation may converge in a function marked as diverging
-    if i < 0_usize { } else { panic!(); }
+    if i < 0 { } else { panic!(); }
 }
 
 fn main() { bad_bang(5); }
index 7e3c356b87029d0fc7f3169b22ee2160f796a4aa..a9e5c957b89d4735827153a24af639f83f7c058f 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-static i: String = 10i32;
+static i: String = 10;
 //~^ ERROR mismatched types
 //~| expected `collections::string::String`
-//~| found `i32`
+//~| found `_`
 //~| expected struct `collections::string::String`
-//~| found i32
+//~| found integral variable
 fn main() { println!("{}", i); }
index a97cf5d41e809493b774a9fef6f1da5abae75c6c..2129d4fbd505578ff2242fc7685c04eaa7e0704c 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 fn foo<T:'static>() {
-    1_usize.bar::<T>(); //~ ERROR `core::marker::Send` is not implemented
+    1.bar::<T>(); //~ ERROR `core::marker::Send` is not implemented
 }
 
 trait bar {
index 2217cf5e4dacb3ba867db23d7e470020c01644b9..d5dd9e00902f9d40b53fc5cfe1776f254d1c93bf 100644 (file)
@@ -8,6 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:`&&` cannot be applied to type `i32`
+// error-pattern:`&&` cannot be applied to type `_`
 
-fn main() { let x = 1i32 && 2i32; }
+fn main() { let x = 1 && 2; }
index a82aa12dc80c27543b775b21636fbc55e1472717..00f51973a41ad407b6a228b0ea63138a500abc60 100644 (file)
@@ -21,25 +21,25 @@ fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f }
 fn main() {
     // By-ref captures
     {
-        let mut x = 0_usize;
+        let mut x = 0;
         let _f = to_fn(|| x = 42); //~ ERROR cannot assign
 
-        let mut y = 0_usize;
+        let mut y = 0;
         let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow
 
-        let mut z = 0_usize;
+        let mut z = 0;
         let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign
     }
 
     // By-value captures
     {
-        let mut x = 0_usize;
+        let mut x = 0;
         let _f = to_fn(move || x = 42); //~ ERROR cannot assign
 
-        let mut y = 0_usize;
+        let mut y = 0;
         let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow
 
-        let mut z = 0_usize;
+        let mut z = 0;
         let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign
     }
 }
index 2d82c8be519712feea5960cd3ee185ed1def58dc..e4b9fb2671124d64e3dc20d8fd98840b6c0957a8 100644 (file)
@@ -17,7 +17,7 @@ enum Foo {
 }
 
 fn blah() {
-    let f = &Foo::Foo1(box 1u32, box 2u32);
+    let f = &Foo::Foo1(box 1, box 2);
     match *f {             //~ ERROR cannot move out of
         Foo::Foo1(num1,         //~ NOTE attempting to move value to here
                   num2) => (),  //~ NOTE and here
index 216373707241efe7318e41825a6079c0c22eff6a..61bf2c11a1f72d1b96d371f762d352e61947ae1d 100644 (file)
@@ -11,7 +11,7 @@
 #![allow(dead_code)]
 fn main() {
     // Original borrow ends at end of function
-    let mut x = 1_usize;
+    let mut x = 1;
     let y = &mut x;
     let z = &x; //~ ERROR cannot borrow
 }
@@ -21,7 +21,7 @@ fn foo() {
     match true {
         true => {
             // Original borrow ends at end of match arm
-            let mut x = 1_usize;
+            let mut x = 1;
             let y = &x;
             let z = &mut x; //~ ERROR cannot borrow
         }
@@ -33,7 +33,7 @@ fn foo() {
 fn bar() {
     // Original borrow ends at end of closure
     || {
-        let mut x = 1_usize;
+        let mut x = 1;
         let y = &mut x;
         let z = &mut x; //~ ERROR cannot borrow
     };
diff --git a/src/test/compile-fail/cfg-attr-unknown-attribute-macro-expansion.rs b/src/test/compile-fail/cfg-attr-unknown-attribute-macro-expansion.rs
new file mode 100644 (file)
index 0000000..afcb896
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2015 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.
+
+macro_rules! foo {
+    () => {
+        #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown
+        fn foo() {}
+    }
+}
+
+foo!();
+
+fn main() {}
index ada45e8c1fc8b1528803fd00c5ab35f58266a4d8..46b100a4d399e35593ef3cda5b34899e5796dbcd 100644 (file)
@@ -27,5 +27,5 @@ fn cat(in_x : usize) -> cat {
 }
 
 fn main() {
-  let nyan = cat(0_usize);
+  let nyan = cat(0);
 }
index f25b2e65388ee190801e27ce09f55646d6f9be46..ab76af1cbe600d91168633f3b66f3b5db04d6ee7 100644 (file)
@@ -16,7 +16,7 @@ impl cat {
     fn sleep(&self) { loop{} }
     fn meow(&self) {
       println!("Meow");
-      meows += 1_usize; //~ ERROR unresolved name
+      meows += 1; //~ ERROR unresolved name
       sleep();     //~ ERROR unresolved name
     }
 
index aac180f9ad7bf63ca00a2c5f560d5bd1bbed0723..bb4d1693af7e35902839a9d920b85b4b7f5af701 100644 (file)
 // Tests that we forbid coercion from `[T; n]` to `&[T]`
 
 fn main() {
-    let _: &[i32] = [0i32];
+    let _: &[i32] = [0];
     //~^ ERROR mismatched types
     //~| expected `&[i32]`
-    //~| found `[i32; 1]`
+    //~| found `[_; 1]`
     //~| expected &-ptr
     //~| found array of 1 elements
 }
index fa63b16afa6d0835e459e555b3d325efc12d36f8..5ccfb1ddec78adb5d3403a409a001a766942856e 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-const A: usize = { 1_usize; 2 };
+const A: usize = { 1; 2 };
 //~^ ERROR: blocks in constants are limited to items and tail expressions
 
 const B: usize = { { } 2 };
@@ -19,7 +19,7 @@ macro_rules! foo {
 }
 const C: usize = { foo!(); 2 };
 
-const D: usize = { let x = 4_usize; 2 };
+const D: usize = { let x = 4; 2 };
 //~^ ERROR: blocks in constants are limited to items and tail expressions
 
 pub fn main() {
index 966e28a789cc88e7a99fba06719c2a34c33b9017..5b215f3ccd9618f1b76ea1f0b51b59622294564f 100644 (file)
@@ -22,10 +22,10 @@ impl S { }
 impl T for S { }
 
 #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
-static s: usize = 0_usize;
+static s: usize = 0;
 
 #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
-const c: usize = 0_usize;
+const c: usize = 0;
 
 #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
 mod m { }
index 0836cd1695de38e62625eca6a46143a950d20949..22f615cafd71eec06ce67f396d45542e0e1eb466 100644 (file)
@@ -14,8 +14,8 @@
 
 fn main() {
     let b = {
-        let a = Box::new(RefCell::new(4i8));
-        *a.borrow() + 1i8    //~ ERROR `*a` does not live long enough
+        let a = Box::new(RefCell::new(4));
+        *a.borrow() + 1    //~ ERROR `*a` does not live long enough
     };
     println!("{}", b);
 }
diff --git a/src/test/compile-fail/feature-gate-allow-internal-unstable-nested-macro.rs b/src/test/compile-fail/feature-gate-allow-internal-unstable-nested-macro.rs
new file mode 100644 (file)
index 0000000..c9251c9
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2015 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.
+
+macro_rules! bar {
+    () => {
+        // more layers don't help:
+        #[allow_internal_unstable]
+        macro_rules! baz { //~ ERROR allow_internal_unstable side-steps
+            () => {}
+        }
+    }
+}
+
+bar!();
+
+fn main() {}
diff --git a/src/test/compile-fail/feature-gate-allow-internal-unstable.rs b/src/test/compile-fail/feature-gate-allow-internal-unstable.rs
new file mode 100644 (file)
index 0000000..8a2d8dd
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2015 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.
+
+#[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps
+macro_rules! foo {
+    () => {}
+}
+
+fn main() {}
index 1e15e67876ed44f140e63b877fae4e5158baba79..54bdaf011c875c63de26a56c6ec368cb0ecfca7d 100644 (file)
@@ -21,7 +21,7 @@
 // test. Not ideal, but oh well :(
 
 fn main() {
-    let a = &[1i32, 2, 3];
+    let a = &[1, 2, 3];
     println!("{}", {
         extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change
             fn atomic_fence();
index f38172db4447b58ae06dcd7a694877079348486f..67834a9996948f5ca756b67d4b019d0d0ec7e340 100644 (file)
 mod circ1 {
     pub use circ2::f2;
     pub fn f1() { println!("f1"); }
-    pub fn common() -> usize { return 0_usize; }
+    pub fn common() -> usize { return 0; }
 }
 
 mod circ2 {
     pub use circ1::f1;
     pub fn f2() { println!("f2"); }
-    pub fn common() -> usize { return 1_usize; }
+    pub fn common() -> usize { return 1; }
 }
 
 mod test {
index b28f2a746fdc40c5d64345bef176d52d33ef0e53..70c362303ae30cba82ac7837aa7f326f32cabf0b 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 fn main() {
-    (return)[0_usize]; //~ ERROR the type of this value must be known in this context
+    (return)[0]; //~ ERROR the type of this value must be known in this context
 }
index d39efa3c2ab78f909815c6db507a9a0be4a6419a..559e0e9a292a6dda32676241228923421dcede21 100644 (file)
@@ -32,13 +32,13 @@ fn to_option(&self) -> Option<Option<T>> {
 }
 
 fn function<T:ToOpt + Clone>(counter: usize, t: T) {
-    if counter > 0_usize {
-        function(counter - 1_usize, t.to_option());
+    if counter > 0 {
+        function(counter - 1, t.to_option());
         // FIXME(#4287) Error message should be here. It should be
         // a type error to instantiate `test` at a type other than T.
     }
 }
 
 fn main() {
-    function(22_usize, 22_usize);
+    function(22, 22);
 }
diff --git a/src/test/compile-fail/internal-unstable-noallow.rs b/src/test/compile-fail/internal-unstable-noallow.rs
new file mode 100644 (file)
index 0000000..4e29619
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright 2015 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.
+
+// this has to be separate to internal-unstable.rs because these tests
+// have error messages pointing deep into the internals of the
+// cross-crate macros, and hence need to use error-pattern instead of
+// the // ~ form.
+
+// aux-build:internal_unstable.rs
+// error-pattern:use of unstable library feature 'function'
+// error-pattern:use of unstable library feature 'struct_field'
+// error-pattern:compilation successful
+#![feature(rustc_attrs)]
+
+#[macro_use]
+extern crate internal_unstable;
+
+#[rustc_error]
+fn main() {
+    call_unstable_noallow!();
+
+    construct_unstable_noallow!(0);
+}
diff --git a/src/test/compile-fail/internal-unstable-thread-local.rs b/src/test/compile-fail/internal-unstable-thread-local.rs
new file mode 100644 (file)
index 0000000..ff15849
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2015 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.
+
+// aux-build:internal_unstable.rs
+
+#![feature(rustc_attrs)]
+#![allow(dead_code)]
+
+extern crate internal_unstable;
+
+
+thread_local!(static FOO: () = ());
+thread_local!(static BAR: () = internal_unstable::unstable()); //~ WARN use of unstable
+
+#[rustc_error]
+fn main() {} //~ ERROR
diff --git a/src/test/compile-fail/internal-unstable.rs b/src/test/compile-fail/internal-unstable.rs
new file mode 100755 (executable)
index 0000000..8674e8a
--- /dev/null
@@ -0,0 +1,51 @@
+// Copyright 2015 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.
+
+// aux-build:internal_unstable.rs
+
+#![feature(rustc_attrs, allow_internal_unstable)]
+
+#[macro_use]
+extern crate internal_unstable;
+
+macro_rules! foo {
+    ($e: expr, $f: expr) => {{
+        $e;
+        $f;
+        internal_unstable::unstable(); //~ WARN use of unstable
+    }}
+}
+
+#[allow_internal_unstable]
+macro_rules! bar {
+    ($e: expr) => {{
+        foo!($e,
+             internal_unstable::unstable());
+        internal_unstable::unstable();
+    }}
+}
+
+#[rustc_error]
+fn main() { //~ ERROR
+    // ok, the instability is contained.
+    call_unstable_allow!();
+    construct_unstable_allow!(0);
+
+    // bad.
+    pass_through_allow!(internal_unstable::unstable()); //~ WARN use of unstable
+
+    pass_through_noallow!(internal_unstable::unstable()); //~ WARN use of unstable
+
+
+
+    println!("{:?}", internal_unstable::unstable()); //~ WARN use of unstable
+
+    bar!(internal_unstable::unstable()); //~ WARN use of unstable
+}
index d307352517feaf5e95c51d8cbb268c0e74c2fcde..998576097a0a06887275de88b1d82149f2fcae6e 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 fn blah() -> i32 { //~ ERROR not all control paths return a value
-    1i32
+    1
 
     ; //~ HELP consider removing this semicolon:
 }
index 06f14158b91577f7b4219f5b2bcc767e231fc511..50c4ac94d903267b8d07b2c90f9a878bf5293ae0 100644 (file)
@@ -24,7 +24,7 @@ fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
 {
     let cont_iter = cont.iter();
 //~^ ERROR cannot infer an appropriate lifetime for autoref due to conflicting requirements
-    let result = cont_iter.fold(Some(0u16), |state, val| {
+    let result = cont_iter.fold(Some(0), |state, val| {
         state.map_or(None, |mask| {
             let bit = 1 << val;
             if mask & bit == 0 {Some(mask|bit)} else {None}
@@ -34,10 +34,10 @@ fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
 }
 
 fn main() {
-    check((3_usize, 5_usize));
+    check((3, 5));
 //~^ ERROR mismatched types
 //~| expected `&_`
-//~| found `(usize, usize)`
+//~| found `(_, _)`
 //~| expected &-ptr
 //~| found tuple
 }
index 16128e52d64d1d9804e481c89269cf444541e8bc..a29a83c43063214f6bb0c2ebae731c2b7327f575 100644 (file)
@@ -14,17 +14,17 @@ pub fn main() {
     // The expected arm type `Option<T>` has one type parameter, while
     // the actual arm `Result<T, E>` has two. typeck should not be
     // tricked into looking up a non-existing second type parameter.
-    let _x: usize = match Some(1_usize) {
+    let _x: usize = match Some(1) {
         Ok(u) => u,
         //~^ ERROR mismatched types
-        //~| expected `core::option::Option<usize>`
+        //~| expected `core::option::Option<_>`
         //~| found `core::result::Result<_, _>`
         //~| expected enum `core::option::Option`
         //~| found enum `core::result::Result`
 
         Err(e) => panic!(e)
         //~^ ERROR mismatched types
-        //~| expected `core::option::Option<usize>`
+        //~| expected `core::option::Option<_>`
         //~| found `core::result::Result<_, _>`
         //~| expected enum `core::option::Option`
         //~| found enum `core::result::Result`
index d7ff6f2fe63ce38f423aad11654552febbbba6b6..d7bb806999c74abe7291eac8f090a492a53ac417 100644 (file)
@@ -22,11 +22,11 @@ fn main() {
     //~| expected u8
     //~| found array of 1 elements
 
-    let local = [0u8];
+    let local = [0];
     let _v = &local as *mut u8;
     //~^ ERROR mismatched types
     //~| expected `*mut u8`
-    //~| found `&[u8; 1]`
+    //~| found `&[_; 1]`
     //~| expected u8,
     //~| found array of 1 elements
 }
index a213234b89b0ff247c73f9ac27cf1fc0dfce01d3..64334fe4392f8774962a9c301aa109bc50bb0c1e 100644 (file)
@@ -18,11 +18,10 @@ trait ListItem<'a> : MarkerTrait {
 
 struct List<'a, T: ListItem<'a>> {
 //~^ ERROR the parameter type `T` may not live long enough
-//~^^ HELP consider adding an explicit lifetime bound
-//~^^^ NOTE ...so that the reference type `&'a [T]` does not outlive the data it points at
+//~^^ NOTE ...so that the reference type `&'a [T]` does not outlive the data it points at
     slice: &'a [T]
 }
-
+//~^ HELP consider adding an explicit lifetime bound
 impl<'a, T: ListItem<'a>> Collection for List<'a, T> {
     fn len(&self) -> usize {
         0
index 65731379094a9d1002508944b0d734c07dc9556a..a481fec6bf96839cb011e0dcc6f50ab1657ecee1 100644 (file)
@@ -16,7 +16,7 @@ struct Foo {
 }
 
 fn main() {
-    let x = 1_usize;
+    let x = 1;
     let y: Foo;
 
     // `x { ... }` should not be interpreted as a struct literal here
index d6471ca018deec2c8c1eea7c26aa1f97090b7905..8ebf80a8db0dc5be49c5d6fc655d30a5dbaefce0 100644 (file)
@@ -13,6 +13,6 @@
 
 fn main() {
     // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-    (|| Box::new(*[0_usize].as_slice()))();
-    //~^ ERROR the trait `core::marker::Sized` is not implemented for the type `[usize]`
+    (|| Box::new(*[0].as_slice()))();
+    //~^ ERROR the trait `core::marker::Sized` is not implemented for the type `[_]`
 }
index b7f58791bfcc8d32a6968938c8b5222beaccc1db..4e63f667d26fa413e83cc5d3c8ba988093c856a3 100644 (file)
@@ -13,7 +13,7 @@
 const A3: usize = 1;
 
 fn main() {
-    match 1_usize {
+    match 1 {
         A1 => {} //~ ERROR: static variables cannot be referenced in a pattern
         A2 => {} //~ ERROR: static variables cannot be referenced in a pattern
         A3 => {}
index bd0474084981f1164d795c996d9865c9c05f9499..657b31fa83c7f829419e5bf2aa88d9062c217e43 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub static X: usize = 1_usize;
+pub static X: usize = 1;
 
 fn main() {
-    match 1_usize {
+    match 1 {
         self::X => { },
         //~^ ERROR static variables cannot be referenced in a pattern, use a `const` instead
         _       => { },
index d5fb22bdebdb477d5c03cb68f3abdf80e40aaf01..60ab616d5983bf25a4dcad218fa39f5a321caf18 100644 (file)
@@ -16,7 +16,7 @@ fn _create_render(_: &()) ->
     AbstractRenderer
 //~^ ERROR: the trait `core::marker::Sized` is not implemented
 {
-    match 0_usize {
+    match 0 {
         _ => unimplemented!()
     }
 }
index 54c51405bd73f8ad7f13068a7441b541fe189463..e3e56c7f97ad5ba400b76d5c622f5c694873b6db 100644 (file)
@@ -13,5 +13,5 @@ enum Foo {
 }
 
 fn main() {
-    let f = Foo::Variant(42_usize); //~ ERROR uses it like a function
+    let f = Foo::Variant(42); //~ ERROR uses it like a function
 }
index dd3844b1a0ef07bae34d0d8d7e60fc1f3aba007c..41e82d0cd8912f1085856e03ce07fb66298d6a99 100644 (file)
@@ -28,7 +28,7 @@ fn poke(&self, s: &mut usize)  {
 }
 
 fn main() {
-    let s = &mut 1_usize;
+    let s = &mut 1;
 
     MyPtr(s).poke(s);
     //~^ ERROR cannot borrow `*s` as mutable more than once at a time
index f6a3da81857750fd5937f66b5632e08f8471aafb..5eb3c439df2f3170d5a2cafb8bb01f5f308777c7 100644 (file)
@@ -13,7 +13,7 @@
 // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
 
 fn main() {
-    let mut y = 1_usize;
+    let mut y = 1;
     let c = RefCell::new(vec![]);
     c.push(Box::new(|| y = 0));
     c.push(Box::new(|| y = 0));
@@ -21,7 +21,7 @@ fn main() {
 }
 
 fn ufcs() {
-    let mut y = 1_usize;
+    let mut y = 1;
     let c = RefCell::new(vec![]);
 
     Push::push(&c, Box::new(|| y = 0));
index 8fb543fb96703cda1a50fc7c0731dfc11288656f..ebda2481803a7cef57f87661218d5831fa63fdef 100644 (file)
@@ -19,7 +19,7 @@ fn foo<T>(&self, _: &T) {}
 
 #[inline(never)]
 fn foo(b: &Bar) {
-    b.foo(&0usize)
+    b.foo(&0)
     //~^ ERROR the trait `Foo` is not implemented for the type `Bar`
 }
 
index 2d73b98ec1e607d201c17318d507f78a9aca760e..6c9b0004f7754874e0f143038a15f8f8dd33b018 100644 (file)
@@ -14,9 +14,9 @@
 fn main() {
     if let Some(homura) = Some("madoka") { //~  ERROR missing an else clause
                                            //~| expected `()`
-                                           //~| found `i32`
+                                           //~| found `_`
                                            //~| expected ()
-                                           //~| found i32
-        765i32
+                                           //~| found integral variable
+        765
     };
 }
index 929c8ec0fd684eef81bed84c67e68fe818c201cd..fe7807042e55b706c3b8e2177a02d5b135012cb1 100644 (file)
@@ -25,11 +25,11 @@ fn mut_ref() -> &'static mut T {
 }
 
 fn mut_ptr() -> *mut T {
-    unsafe { 0u8 as *mut T }
+    unsafe { 0 as *mut T }
 }
 
 fn const_ptr() -> *const T {
-    unsafe { 0u8 as *const T }
+    unsafe { 0 as *const T }
 }
 
 pub fn main() {
index 505885e6c41f9bdf7f3d309b79684c1ee44cf57d..8b109b0a5c04d9b7eae68158ee5e16e0ccbbb1d3 100644 (file)
@@ -15,7 +15,7 @@
 fn fail_len(v: Vec<isize> ) -> usize {
     let mut i = 3;
     panic!();
-    for x in &v { i += 1_usize; }
+    for x in &v { i += 1; }
     //~^ ERROR: unreachable statement
     return i;
 }
index 6d4777be40b640829dd9bff83ec5c5d1a285b9a0..a1804b5a2689d92978d5a406bf73a3e3c26657fa 100644 (file)
@@ -11,7 +11,7 @@
 fn bar(int_param: usize) {}
 
 fn main() {
-    let foo: [u8; 4] = [1u8; 4_usize];
+    let foo: [u8; 4] = [1; 4];
     bar(foo);
     //~^ ERROR mismatched types
     //~| expected `usize`
index b6643f439529b2a76c6b62a73ea4676dce30dc17..9c019f6ec47fb91a1d17733f737fd44083f7cc58 100644 (file)
@@ -32,17 +32,17 @@ trait UnusedTrait : MarkerTrait {
 
 impl CtxtFn for usize {
     fn f8(self, i: usize) -> usize {
-        i * 4_usize
+        i * 4
     }
 
     fn f9(i: usize) -> usize {
-        i * 4_usize
+        i * 4
     }
 }
 
 impl OtherTrait for usize {
     fn f9(i: usize) -> usize {
-        i * 8_usize
+        i * 8
     }
 }
 
index 7bb4aac23d65cebe30bb5c1857b80dd29c0dfd88..400806c3a5fa6cbfe7110e1b887212ac5be62181 100644 (file)
@@ -23,16 +23,16 @@ fn main() {
         _ => ()
     }
 
-    match &Some(42i32) {
+    match &Some(42) {
         Some(x) => (),
         //~^ ERROR mismatched types
-        //~| expected `&core::option::Option<i32>`
+        //~| expected `&core::option::Option<_>`
         //~| found `core::option::Option<_>`
         //~| expected &-ptr
         //~| found enum `core::option::Option`
         None => ()
         //~^ ERROR mismatched types
-        //~| expected `&core::option::Option<i32>`
+        //~| expected `&core::option::Option<_>`
         //~| found `core::option::Option<_>`
         //~| expected &-ptr
         //~| found enum `core::option::Option`
index e6041cddeadb58adb75ac51e95abb70d7faf5352..c370aa4b8fb1aa6b6d7a6643c2dc8da19f9db319 100644 (file)
@@ -16,7 +16,7 @@ fn foo(_x: Rc<usize>) {}
 fn bar<F:FnOnce() + Send>(_: F) { }
 
 fn main() {
-    let x = Rc::new(3_usize);
+    let x = Rc::new(3);
     bar(move|| foo(x));
     //~^ ERROR `core::marker::Send` is not implemented
 }
index fac518c7635692822d1e0e8746d3a8613663baea..0a8e4514b4334294289cafd117bfa309e3ae7a28 100644 (file)
@@ -24,7 +24,7 @@ fn iter(&'r self) -> Range<usize> {
 fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool {
 //~^ HELP: consider using an explicit lifetime parameter as shown: fn check<'r, I: Iterator<Item = usize>, T: Itble<'r, usize, I>>(cont: &'r T)
     let cont_iter = cont.iter(); //~ ERROR: cannot infer
-    let result = cont_iter.fold(Some(0u16), |state, val| {
+    let result = cont_iter.fold(Some(0), |state, val| {
         state.map_or(None, |mask| {
             let bit = 1 << val;
             if mask & bit == 0 {Some(mask|bit)} else {None}
index f304c26efb5417fccc7b3c60124e18059390bb8e..8441fb3ade9a8ea9cc002d3e309338c0386b9803 100644 (file)
@@ -63,6 +63,6 @@ fn field_match_in_let(f: Bar) -> bool {
 fn main() {
     field_read(Foo { x: 1, b: false, marker: std::marker::NoCopy });
     field_match_in_patterns(XYZ::Z);
-    field_match_in_let(Bar { x: 42_usize, b: true, _guard: () });
+    field_match_in_let(Bar { x: 42, b: true, _guard: () });
     let _ = Baz { x: 0 };
 }
index 57252dd58d7144a3d46eb407e494208916eb6d5d..a4eb1630afe19c00f993df2f6aa67a1ea1270e85 100644 (file)
@@ -10,7 +10,7 @@
 //
 // regression test for #8005
 
-macro_rules! test { () => { fn foo() -> i32 { 1i32; } } }
+macro_rules! test { () => { fn foo() -> i32 { 1; } } }
                                            //~^ ERROR not all control paths return a value
                                            //~^^ HELP consider removing this semicolon
 
index 13dbab12b774270a7242aba28419b6c85a961044..e8d9f444cefc6d687dee1f6ba169d3d08c7533f4 100644 (file)
@@ -16,5 +16,5 @@
 extern crate macro_non_reexport_2;
 
 fn main() {
-    assert_eq!(reexported!(), 3_usize);  //~ ERROR macro undefined
+    assert_eq!(reexported!(), 3);  //~ ERROR macro undefined
 }
index dc8f4fadc76c0a3185d14d80f3e2aaade7d38c34..26de51a7cf8c321e4273f19b75527acb1b4f27f7 100644 (file)
@@ -18,5 +18,5 @@
 extern crate macro_reexport_1;
 
 fn main() {
-    assert_eq!(reexported!(), 3_usize);  //~ ERROR macro undefined
+    assert_eq!(reexported!(), 3);  //~ ERROR macro undefined
 }
index 7b6868af805e52cea3e31325ae456cee3ce3209a..57a96bb9a26ea4febfddf3fd54dc250e5b414194 100644 (file)
@@ -23,9 +23,9 @@ fn main() {
                  //~| found `Foo`
                  //~| expected &-ptr
                  //~| found struct `Foo`
-    Foo::bar(&42i32); //~  ERROR mismatched types
+    Foo::bar(&42); //~  ERROR mismatched types
                       //~| expected `&Foo`
-                      //~| found `&i32`
+                      //~| found `&_`
                       //~| expected struct `Foo`
-                      //~| found i32
+                      //~| found integral variable
 }
index 6de69a9adb0c9a3b56d32b3397176a8d2eb201d1..9eb24c81960cacc29e81d41f3101a56ef298b8b6 100644 (file)
@@ -9,21 +9,21 @@
 // except according to those terms.
 
 fn main() {
-    let foo = &mut 1i32;
+    let foo = &mut 1;
 
     // (separate lines to ensure the spans are accurate)
 
      let &_ //~  ERROR mismatched types
-            //~| expected `&mut i32`
+            //~| expected `&mut _`
             //~| found `&_`
             //~| values differ in mutability
         = foo;
     let &mut _ = foo;
 
-    let bar = &1i32;
+    let bar = &1;
     let &_ = bar;
     let &mut _ //~  ERROR mismatched types
-               //~| expected `&i32`
+               //~| expected `&_`
                //~| found `&mut _`
                //~| values differ in mutability
          = bar;
index b6744d4b33a1021d7b133dbdd4a9e618cc6cc7ae..46af3a862c28f623c9801e974f7675e46275b134 100644 (file)
@@ -29,6 +29,6 @@ fn cat(in_x : usize, in_y : isize) -> cat {
 }
 
 fn main() {
-  let nyan : cat = cat(52_usize, 99);
+  let nyan : cat = cat(52, 99);
   nyan.eat();
 }
index 94b1047f85ed3720f95b32bace33af613f42ed3d..c163dc2b4d228d770398740842ca6ba649e2e7c0 100644 (file)
@@ -21,6 +21,6 @@ fn cat(in_x : usize, in_y : isize) -> cat {
 }
 
 fn main() {
-  let nyan : cat = cat(52_usize, 99);
+  let nyan : cat = cat(52, 99);
   nyan.how_hungry = 0; //~ ERROR cannot assign
 }
index 0eb91e0419a1da232d991ef9da75f0f093a431ed..3ed91459ae94c70ae7e24b9da9a94a9e1706daee 100644 (file)
@@ -27,7 +27,7 @@ fn struct_with_a_nested_enum_and_vector() {
         Foo { first: true, second: None } => (),
         Foo { first: true, second: Some(_) } => (),
         Foo { first: false, second: None } => (),
-        Foo { first: false, second: Some([1_usize, 2_usize, 3_usize, 4_usize]) } => ()
+        Foo { first: false, second: Some([1, 2, 3, 4]) } => ()
     }
 }
 
index 4b261d89888dcd3b02060865863568edab2cad6a..59508d6ac95f9645d2c3a67af396e0eaf29d1e98 100644 (file)
@@ -12,4 +12,4 @@
 
 enum blah { a(isize, isize, usize), b(isize, isize), }
 
-fn main() { match blah::a(1, 1, 2_usize) { blah::a(_, x, y) | blah::b(x, y) => { } } }
+fn main() { match blah::a(1, 1, 2) { blah::a(_, x, y) | blah::b(x, y) => { } } }
index ccbdd52a98328dc769f1b9268852d2e50a313c4a..16510c2c8c99cb01f07743f86cbd0c1508a5ca3f 100644 (file)
@@ -30,6 +30,6 @@ pub fn cat(in_x : usize, in_y : isize) -> cat {
 }
 
 fn main() {
-  let nyan : kitties::cat = kitties::cat(52_usize, 99);
+  let nyan : kitties::cat = kitties::cat(52, 99);
   nyan.nap();
 }
index 243d835d46e6213d7f8bf9143872d899b5404223..fb4491a63757b4e27b93f6d24db04fd3dfc113db 100644 (file)
@@ -13,7 +13,7 @@
 use cci_class::kitties::cat;
 
 fn main() {
-  let nyan : cat = cat(52_usize, 99);
-  assert!((nyan.meows == 52_usize));
+  let nyan : cat = cat(52, 99);
+  assert!((nyan.meows == 52));
   //~^ ERROR field `meows` of struct `cci_class::kitties::cat` is private
 }
index a8b6e399418f7ef430f333d95aaa993894594ecb..e7b34d6d1bc38609bbb11d562d6409046d19b5e7 100644 (file)
@@ -20,7 +20,7 @@ pub fn main() {
     //~^ ERROR the trait `core::num::Int` is not implemented for the type `f32`
 
     // Unsized type.
-    let arr: &[_] = &[1u32, 2, 3];
+    let arr: &[_] = &[1, 2, 3];
     let range = *arr..;
     //~^ ERROR the trait `core::marker::Sized` is not implemented
 }
index 45e468b3ab06676c446ac7d1de41d822573c7270..04ee0526403fbe9dfedf2c8ca39205e2e2a8f9fb 100644 (file)
@@ -15,18 +15,18 @@ struct dog {
 impl dog {
     pub fn chase_cat(&mut self) {
         let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
-        *p += 1_usize;
+        *p += 1;
     }
 
     pub fn chase_cat_2(&mut self) {
         let p: &mut usize = &mut self.cats_chased;
-        *p += 1_usize;
+        *p += 1;
     }
 }
 
 fn dog() -> dog {
     dog {
-        cats_chased: 0_usize
+        cats_chased: 0
     }
 }
 
index 8cc2dd6afc645bc4203de7a03dd814c20bc0ee77..28491f1155c367b204ae52d128c2d4ca1698c3cf 100644 (file)
@@ -18,7 +18,7 @@ impl dog {
     pub fn chase_cat(&mut self) {
         let _f = || {
             let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
-            *p = 3_usize;
+            *p = 3;
         };
     }
 }
index 4c361427bf37c6e0507bccfc84527363118ed9d1..ad2dc28afef02f3be21e4ca19cf918fa33fba6c9 100644 (file)
@@ -14,8 +14,8 @@ enum ast<'a> {
 }
 
 fn build() {
-    let x = ast::num(3_usize);
-    let y = ast::num(4_usize);
+    let x = ast::num(3);
+    let y = ast::num(4);
     let z = ast::add(&x, &y);
     compute(&z);
 }
index da839d72172619e19ecf7be11edc97235752b54e..ae9ceb600d45c1bb5be47b430b21453dd0746229 100644 (file)
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 fn main() {
-    let a0 = 0u8;
-    let f = 1u8;
+    let a0 = 0;
+    let f = 1;
     let mut a1 = &a0;
     match (&a1,) {
         (&ref b0,) => {
index aa20efa5a12b157822f468aa47f73f795654d87c..1e2224eafaeb057567115767d28744583d64cb76 100644 (file)
@@ -15,7 +15,7 @@
 fn main() {
     // Unboxed closure case
     {
-        let mut x = 0_usize;
+        let mut x = 0;
         let mut f = || &mut x; //~ ERROR cannot infer
         let x = f();
         let y = f();
index b45a37d26e58a2d0c41f7df1fd60dcd9924110f3..01439ce5e68775f83454622d295e33ac0aa92ac2 100644 (file)
@@ -34,7 +34,7 @@ fn get_v(gc: Box<get_ctxt>) -> usize {
 }
 
 fn main() {
-    let ctxt = ctxt { v: 22_usize };
+    let ctxt = ctxt { v: 22 };
     let hc = has_ctxt { c: &ctxt };
-    assert_eq!(get_v(box hc as Box<get_ctxt>), 22_usize);
+    assert_eq!(get_v(box hc as Box<get_ctxt>), 22);
 }
index c276228b18ee3552cadd01ab33491abcb2828759..ea6d63ca540ef8a422a2edd344790a770b5f811e 100644 (file)
@@ -26,40 +26,40 @@ fn main() {
     let pt = PointF {
         //~^ ERROR structure constructor specifies a structure of type
         //~| expected f32
-        //~| found i32
-        x: 1i32,
-        y: 2i32,
+        //~| found integral variable
+        x: 1,
+        y: 2,
     };
 
     let pt2 = Point::<f32> {
         //~^ ERROR structure constructor specifies a structure of type
         //~| expected f32
-        //~| found i32
-        x: 3i32,
-        y: 4i32,
+        //~| found integral variable
+        x: 3,
+        y: 4,
     };
 
     let pair = PairF {
         //~^ ERROR structure constructor specifies a structure of type
         //~| expected f32
-        //~| found i32
-        x: 5i32,
-        y: 6i32,
+        //~| found integral variable
+        x: 5,
+        y: 6,
     };
 
     let pair2 = PairF::<i32> {
         //~^ ERROR structure constructor specifies a structure of type
         //~| expected f32
-        //~| found i32
-        x: 7i32,
-        y: 8i32,
+        //~| found integral variable
+        x: 7,
+        y: 8,
     };
 
     let pt3 = PointF::<i32> {
         //~^ ERROR wrong number of type arguments
         //~| ERROR structure constructor specifies a structure of type
-        x: 9i32,
-        y: 10i32,
+        x: 9,
+        y: 10,
     };
 }
 
index 9c1d318d5889990efb92f1d33bf6abcd0be641be..5c1270aa0e43d8f25adb1d42969871318dfc4c97 100644 (file)
@@ -12,6 +12,6 @@
 
 fn f() -> isize { return g(); }
 
-fn g() -> usize { return 0_usize; }
+fn g() -> usize { return 0; }
 
 fn main() { let y = f(); }
diff --git a/src/test/compile-fail/traits-issue-23003-overflow.rs b/src/test/compile-fail/traits-issue-23003-overflow.rs
new file mode 100644 (file)
index 0000000..ea41775
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright 2015 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.
+
+// A variant of traits-issue-23003 in which an infinite series of
+// types are required. This currently creates an overflow. This test
+// is included to ensure that some controlled failure, at least,
+// results -- but it might be that we should adjust the rules somewhat
+// to make this legal. -nmatsakis
+
+use std::marker::PhantomData;
+
+trait Async {
+    type Cancel;
+}
+
+struct Receipt<A:Async> {
+    marker: PhantomData<A>,
+}
+
+struct Complete<B> {
+    core: Option<B>,
+}
+
+impl<B> Async for Complete<B> {
+    type Cancel = Receipt<Complete<Option<B>>>;
+}
+
+fn foo(r: Receipt<Complete<()>>) { }
+//~^ ERROR overflow
+
+fn main() { }
index 0a5aa1b7bd34695cebb9a8451c45d0d5e25eb52f..8fe1f4d2371c42120120c57cf985d960692c75a6 100644 (file)
@@ -33,7 +33,7 @@ fn test<T,U>(_: T, _: U)
 }
 
 fn a() {
-    test(22_i32, std::default::Default::default()); //~ ERROR type annotations required
+    test(22, std::default::Default::default()); //~ ERROR type annotations required
 }
 
 fn main() {}
index 54b8d551f202e5fee102e8f95591805b10bcc945..c2c41fbbb2aaf16857a721a4a2dd90ec859dfafe 100644 (file)
 struct Point(i32, i32);
 
 fn main() {
-    let origin = Point(0i32, 0i32);
+    let origin = Point(0, 0);
     origin.0;
     origin.1;
     origin.2;
     //~^ ERROR attempted out-of-bounds tuple index `2` on type `Point`
-    let tuple = (0i32, 0i32);
+    let tuple = (0, 0);
     tuple.0;
     tuple.1;
     tuple.2;
-    //~^ ERROR attempted out-of-bounds tuple index `2` on type `(i32, i32)`
+    //~^ ERROR attempted out-of-bounds tuple index `2` on type `(_, _)`
 }
index 3bf0896d990af6fdea1ab8521cf65648695cc6ef..627300a037720b92ba9a45e7981b1f9a985638ee 100644 (file)
 
 // Checking that the compiler reports multiple type errors at once
 
-fn main() { let a: bool = 1i32; let b: i32 = true; }
+fn main() { let a: bool = 1; let b: i32 = true; }
 //~^ ERROR mismatched types
 //~| expected `bool`
-//~| found `i32`
+//~| found `_`
 //~| expected bool
-//~| found i32
+//~| found integral variable
 //~| ERROR mismatched types
 //~| expected `i32`
 //~| found `bool`
index de9623de7cd3a551c56e74a21d878e6a4baa8c55..88d8788d63a3de54bdcdc0f8dc3b1313558f709a 100644 (file)
@@ -23,7 +23,7 @@ fn broken_add<T>(&self, rhs: T) -> Self {
 impl<T: Int> BrokenAdd for T {}
 
 pub fn main() {
-    let foo: u8 = 0u8;
+    let foo: u8 = 0;
     let x: u8 = foo.broken_add("hello darkness my old friend".to_string());
     println!("{}", x);
 }
index 5bfad94867e2544c4291236bb0d11c17dcda23a9..d4f3cdfd8b7e248eefedc4d3896d13a0101ff235 100644 (file)
@@ -21,7 +21,7 @@ fn test2() -> (_, _) { (5, 5) }
 static TEST3: _ = "test";
 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
 
-static TEST4: _ = 145u16;
+static TEST4: _ = 145;
 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
 
 static TEST5: (_, _) = (1, 2);
@@ -74,7 +74,7 @@ fn fn_test2() -> (_, _) { (5, 5) }
     static FN_TEST3: _ = "test";
     //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
 
-    static FN_TEST4: _ = 145u16;
+    static FN_TEST4: _ = 145;
     //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
 
     static FN_TEST5: (_, _) = (1, 2);
index 86e326f3c5a8b7f4b15f708491a39f15c225ccea..564b1b4669f7d0235ea2ed45c1a124b6577485cc 100644 (file)
@@ -23,28 +23,28 @@ fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }
 fn main() {
     // By-ref cases
     {
-        let x = Box::new(0_usize);
+        let x = Box::new(0);
         let f = to_fn(|| drop(x)); //~ ERROR cannot move
     }
     {
-        let x = Box::new(0_usize);
+        let x = Box::new(0);
         let f = to_fn_mut(|| drop(x)); //~ ERROR cannot move
     }
     {
-        let x = Box::new(0_usize);
+        let x = Box::new(0);
         let f = to_fn_once(|| drop(x)); // OK -- FnOnce
     }
     // By-value cases
     {
-        let x = Box::new(0_usize);
+        let x = Box::new(0);
         let f = to_fn(move || drop(x)); //~ ERROR cannot move
     }
     {
-        let x = Box::new(0_usize);
+        let x = Box::new(0);
         let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move
     }
     {
-        let x = Box::new(0_usize);
+        let x = Box::new(0);
         let f = to_fn_once(move || drop(x)); // this one is ok
     }
 }
index b40a91181adde2b63c9ededa0260da8c553ec8a9..5be2738b47eff1c1296ea1829755ded3fab1d51a 100644 (file)
@@ -17,7 +17,7 @@
 fn set(x: &mut usize) { *x = 0; }
 
 fn main() {
-    let x = 0_usize;
+    let x = 0;
     move || x = 1; //~ ERROR cannot assign
     move || set(&mut x); //~ ERROR cannot borrow
     move || x = 1; //~ ERROR cannot assign
index 5f4bf0d33be67c0ccbbeaa2bc6c8ab8adf2237eb..eee1b6ce30b5e7467aa53ef15c5700b248f71b08 100644 (file)
@@ -14,7 +14,7 @@
 // reference cannot escape the region of that variable.
 fn main() {
     let _f = {
-        let x = 0_usize;
+        let x = 0;
         || x //~ ERROR `x` does not live long enough
     };
 }
index 1191cfa2600b8a231f1d5d3c5dc4e148e492fcf5..372f3277931e1ff7eab1deaa6cce0605a78f6b29 100644 (file)
@@ -14,7 +14,7 @@
 // cause borrow conflicts.
 
 fn main() {
-    let mut x = 0_usize;
+    let mut x = 0;
     let f = || x += 1;
     let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed
 }
index 650bb17bb7758f9ce60d81d2dcc7ec38ff7cab7b..35052ec0bd507b2334336590723c349eb6680fd5 100644 (file)
@@ -20,21 +20,21 @@ fn to_fn<A,F:Fn<A>>(f: F) -> F { f }
 fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f }
 
 fn a() {
-    let n = 0u8;
+    let n = 0;
     let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign
         n += 1;
     });
 }
 
 fn b() {
-    let mut n = 0u8;
+    let mut n = 0;
     let mut f = to_fn_mut(|| {
         n += 1; // OK
     });
 }
 
 fn c() {
-    let n = 0u8;
+    let n = 0;
     let mut f = to_fn_mut(move || {
         // If we just did a straight-forward desugaring, this would
         // compile, but we do something a bit more subtle, and hence
@@ -44,21 +44,21 @@ fn c() {
 }
 
 fn d() {
-    let mut n = 0u8;
+    let mut n = 0;
     let mut f = to_fn_mut(move || {
         n += 1; // OK
     });
 }
 
 fn e() {
-    let n = 0u8;
+    let n = 0;
     let mut f = to_fn(move || {
         n += 1; //~ ERROR cannot assign
     });
 }
 
 fn f() {
-    let mut n = 0u8;
+    let mut n = 0;
     let mut f = to_fn(move || {
         n += 1; //~ ERROR cannot assign
     });
index 2345a86595e2da0223b60d29f68147c5964c3bdc..432c7fa5d1b2025c9d8d2605e7bb31052ac80fd2 100644 (file)
@@ -16,7 +16,7 @@ fn call<F>(f: F) where F : Fn() {
 }
 
 fn main() {
-    let mut counter = 0_u32;
+    let mut counter = 0;
     call(|| {
         counter += 1;
         //~^ ERROR cannot assign to data in a captured outer variable in an `Fn` closure
index eb5ffeaf888866712075f36d91c00ecafd816718..bc93b86a391191229ae64e45f89aaf94eb469799 100644 (file)
@@ -15,4 +15,4 @@
 
 enum foo { a(Box<foo>, isize), b(usize), }
 
-fn main() { match foo::b(1_usize) { foo::b(_) | foo::a(box _, 1) => { } foo::a(_, 1) => { } } }
+fn main() { match foo::b(1) { foo::b(_) | foo::a(box _, 1) => { } foo::a(_, 1) => { } } }
index 97908118e3518fa82ba54d64a8f2c076b7ce8fa9..4ea7051775e132edf7e53eae6d1081adcfda8a40 100644 (file)
@@ -10,7 +10,7 @@
 
 
 fn f(p: *const u8) {
-    *p = 0u8; //~ ERROR dereference of unsafe pointer requires unsafe function or block
+    *p = 0; //~ ERROR dereference of unsafe pointer requires unsafe function or block
     return;
 }
 
index 0254f56bd1a944b86b1e8db2f55722105416c7d9..e5473f12bf2d6f52ab97270a5399b410bd9c406a 100644 (file)
@@ -33,19 +33,19 @@ fn baz<'a, T>(_x: &'a T) -> Baked<'a> {
 
 fn main() {
     {
-        let a = AffineU32(1_u32);
+        let a = AffineU32(1);
         let x = foo(&a);
         drop(a); //~ ERROR cannot move out of `a`
         drop(x);
     }
     {
-        let a = AffineU32(1_u32);
+        let a = AffineU32(1);
         let x = bar(&a);
         drop(a); //~ ERROR cannot move out of `a`
         drop(x);
     }
     {
-        let a = AffineU32(1_u32);
+        let a = AffineU32(1);
         let x = baz(&a);
         drop(a); //~ ERROR cannot move out of `a`
         drop(x);
index cc6ff2d8ebcc204b2e9965fc00cb22911a82f6e7..654272f5bc6eba34b09220e9eff6adbd080ebcad 100644 (file)
@@ -23,7 +23,7 @@ fn gimme_an_a<A:TraitA>(&self, a: A) -> isize {
 }
 
 fn call_it<B:TraitB>(b: B)  -> isize {
-    let y = 4_usize;
+    let y = 4;
     b.gimme_an_a(y) //~ ERROR the trait `TraitA` is not implemented
 }
 
index 26117e7a13b6f2f1666499e755c988011375de16..63132d91327ca5f4bf74cbc87566239c2c1375e3 100644 (file)
@@ -139,13 +139,13 @@ fn assoc_enum<T: TraitWithAssocType>(arg: Enum<T>) {
 }
 
 fn main() {
-    assoc_struct(Struct { b: -1i32, b1: 0i64 });
-    assoc_local(1i32);
-    assoc_arg::<i32>(2i64);
-    assoc_return_value(3i32);
-    assoc_tuple((4i32, 5i64));
-    assoc_enum(Enum::Variant1(6i32, 7i64));
-    assoc_enum(Enum::Variant2(8i64, 9i32));
+    assoc_struct(Struct { b: -1, b1: 0 });
+    assoc_local(1);
+    assoc_arg::<i32>(2);
+    assoc_return_value(3);
+    assoc_tuple((4, 5));
+    assoc_enum(Enum::Variant1(6, 7));
+    assoc_enum(Enum::Variant2(8, 9));
 }
 
 fn zzz() { () }
diff --git a/src/test/debuginfo/constant-debug-locs.rs b/src/test/debuginfo/constant-debug-locs.rs
new file mode 100644 (file)
index 0000000..24332e3
--- /dev/null
@@ -0,0 +1,67 @@
+// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-android: FIXME(#10381)
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![omit_gdb_pretty_printer_section]
+
+// This test makes sure that the compiler doesn't crash when trying to assign
+// debug locations to const-expressions.
+
+use std::sync::MUTEX_INIT;
+use std::cell::UnsafeCell;
+
+const CONSTANT: u64 = 3 + 4;
+
+struct Struct {
+    a: isize,
+    b: usize,
+}
+const STRUCT: Struct = Struct { a: 1, b: 2 };
+
+struct TupleStruct(u32);
+const TUPLE_STRUCT: TupleStruct = TupleStruct(4);
+
+enum Enum {
+    Variant1(char),
+    Variant2 { a: u8 },
+    Variant3
+}
+
+const VARIANT1: Enum = Enum::Variant1('v');
+const VARIANT2: Enum = Enum::Variant2 { a: 2 };
+const VARIANT3: Enum = Enum::Variant3;
+
+const STRING: &'static str = "String";
+
+const VEC: [u32; 8] = [0; 8];
+
+const NESTED: (Struct, TupleStruct) = (STRUCT, TUPLE_STRUCT);
+
+const UNSAFE_CELL: UnsafeCell<bool> = UnsafeCell { value: false };
+
+fn main() {
+    let mut _constant = CONSTANT;
+    let mut _struct = STRUCT;
+    let mut _tuple_struct = TUPLE_STRUCT;
+    let mut _variant1 = VARIANT1;
+    let mut _variant2 = VARIANT2;
+    let mut _variant3 = VARIANT3;
+    let mut _string = STRING;
+    let mut _vec = VEC;
+    let mut _nested = NESTED;
+    let mut _extern = MUTEX_INIT;
+    let mut _unsafe_cell = UNSAFE_CELL;
+}
diff --git a/src/test/debuginfo/extern-c-fn.rs b/src/test/debuginfo/extern-c-fn.rs
new file mode 100644 (file)
index 0000000..9e73417
--- /dev/null
@@ -0,0 +1,68 @@
+// Copyright 2013-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.
+
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+// gdb-command:run
+
+// gdb-command:print s
+// gdb-check:$1 = [...]"abcd"
+// gdb-command:print len
+// gdb-check:$2 = 20
+// gdb-command:print local0
+// gdb-check:$3 = 19
+// gdb-command:print local1
+// gdb-check:$4 = true
+// gdb-command:print local2
+// gdb-check:$5 = 20.5
+
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+// lldb-command:run
+
+// lldb-command:print len
+// lldb-check:[...]$0 = 20
+// lldb-command:print local0
+// lldb-check:[...]$1 = 19
+// lldb-command:print local1
+// lldb-check:[...]$2 = true
+// lldb-command:print local2
+// lldb-check:[...]$3 = 20.5
+
+// lldb-command:continue
+
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![omit_gdb_pretty_printer_section]
+
+
+#[no_mangle]
+pub unsafe extern "C" fn fn_with_c_abi(s: *const u8, len: i32) -> i32 {
+    let local0 = len - 1;
+    let local1 = len > 2;
+    let local2 = (len as f64) + 0.5;
+
+    zzz(); // #break
+
+    return 0;
+}
+
+fn main() {
+    unsafe {
+        fn_with_c_abi(b"abcd\0".as_ptr(), 20);
+    }
+}
+
+#[inline(never)]
+fn zzz() {()}
index 3b1979337d525fa5d9e1bba910b3fa7a621c19ff..25afd3514b0161bf160f169da040a08232491386 100644 (file)
@@ -128,10 +128,10 @@ fn main() {
         next: Val {
             val: box UniqueNode {
                 next: Empty,
-                value: 1_u16,
+                value: 1,
             }
         },
-        value: 0_u16,
+        value: 0,
     };
 
     let unique_unique: Box<UniqueNode<u32>> = box UniqueNode {
index 161392c94c8f01e61435478bc307a83c399a6eea..12c7b146342ffed60f82ab6ddfb25bdb645b419b 100644 (file)
 
 fn main() {
 
-    let vi8x16 = i8x16(0i8, 1i8, 2i8, 3i8, 4i8, 5i8, 6i8, 7i8,
-                      8i8, 9i8, 10i8, 11i8, 12i8, 13i8, 14i8, 15i8);
-
-    let vi16x8 = i16x8(16i16, 17i16, 18i16, 19i16, 20i16, 21i16, 22i16, 23i16);
-    let vi32x4 = i32x4(24i32, 25i32, 26i32, 27i32);
-    let vi64x2 = i64x2(28i64, 29i64);
-
-    let vu8x16 = u8x16(30u8, 31u8, 32u8, 33u8, 34u8, 35u8, 36u8, 37u8,
-                      38u8, 39u8, 40u8, 41u8, 42u8, 43u8, 44u8, 45u8);
-    let vu16x8 = u16x8(46u16, 47u16, 48u16, 49u16, 50u16, 51u16, 52u16, 53u16);
-    let vu32x4 = u32x4(54u32, 55u32, 56u32, 57u32);
-    let vu64x2 = u64x2(58u64, 59u64);
+    let vi8x16 = i8x16(0, 1, 2, 3, 4, 5, 6, 7,
+                      8, 9, 10, 11, 12, 13, 14, 15);
+
+    let vi16x8 = i16x8(16, 17, 18, 19, 20, 21, 22, 23);
+    let vi32x4 = i32x4(24, 25, 26, 27);
+    let vi64x2 = i64x2(28, 29);
+
+    let vu8x16 = u8x16(30, 31, 32, 33, 34, 35, 36, 37,
+                      38, 39, 40, 41, 42, 43, 44, 45);
+    let vu16x8 = u16x8(46, 47, 48, 49, 50, 51, 52, 53);
+    let vu32x4 = u32x4(54, 55, 56, 57);
+    let vu64x2 = u64x2(58, 59);
 
     let vf32x4 = f32x4(60.5f32, 61.5f32, 62.5f32, 63.5f32);
     let vf64x2 = f64x2(64.5f64, 65.5f64);
index d709ffdc3fc125c3d29b23dd303937286dfeffa9..7de51c1ea75cab90166e8fed825be1560fa38f65 100644 (file)
@@ -15,5 +15,5 @@
 }
 
 fn main() {
-  let nyan = cat(0us);
+  let nyan = cat(0);
 }
index afff5984b46141d61f0c9b3de054473b83bd0657..9c35d77baf015398f60141bdc76be0adc9a4e506 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 fn main() {
-    let __isize = 0xff_ffff_ffff_ffff_ffff__isize;
+    let __isize = 0xff_ffff_ffff_ffff_ffff;
     //~^ ERROR int literal is too large
 }
index 9a490be6a0169963e5d4b8c7ace243f4911b8fa9..62b87e3f480adcf2eea6a3ad8d2f759a0407b86d 100644 (file)
@@ -22,7 +22,7 @@ fn main() {
     1e+; //~ ERROR: expected at least one digit in exponent
     0x539.0; //~ ERROR: hexadecimal float literal is not supported
     99999999999999999999999999999999; //~ ERROR: int literal is too large
-    99999999999999999999999999999999u32; //~ ERROR: int literal is too large
+    99999999999999999999999999999999; //~ ERROR: int literal is too large
     0x; //~ ERROR: no valid digits
     0xu32; //~ ERROR: no valid digits
     0ou32; //~ ERROR: no valid digits
index 8b36e87db3e53741c5b3b14a48f9baf0486b2525..7a7113cd594b5629fed3cf550f3a80dfca258e77 100644 (file)
@@ -26,7 +26,7 @@ fn get_ctxt(&self) -> &'a ctxt { self.c }
 }
 
 fn make_gc() -> @get_ctxt  {
-    let ctxt = ctxt { v: 22us };
+    let ctxt = ctxt { v: 22 };
     let hc = has_ctxt { c: &ctxt };
     return @hc as @get_ctxt;
     //~^ ERROR source contains reference
index 58f6ae960b1895b2835da025c825d8bae1045872..6a9cbef1015424231d94b3a61ec1056e18ee6a93 100644 (file)
@@ -13,5 +13,5 @@
 
 fn a() -> uint {
 
-    1usize
+    1
 }
index 83ee2bd08f4adbcad507ae75e4260aa0a359c6c8..58cd19059c0d7ce63abea716c306fe555e48e323 100644 (file)
@@ -26,12 +26,12 @@ pub fn bar() {
     const FOO: usize = ((5 as usize) - (4 as usize) as usize);
     let _: [(); (FOO as usize)] = ([(() as ())] as [(); 1]);
 
-    let _: [(); (1usize as usize)] = ([(() as ())] as [(); 1]);
+    let _: [(); (1 as usize)] = ([(() as ())] as [(); 1]);
 
     let _ =
         (((&((([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3])) as [i32; 3])
               as &[i32; 3]) as *const _ as *const [i32; 3]) as
-            *const [i32; (3usize as usize)] as *const [i32; 3]);
+            *const [i32; (3 as usize)] as *const [i32; 3]);
 
 
 
index 3aa2f4826b24cdaadd5ac816f3cad62793c3a13e..90757c92c4c998fec6a3fb5f50909ccc84750c22 100644 (file)
@@ -20,9 +20,9 @@ pub fn bar() {
     const FOO: usize = 5 - 4;
     let _: [(); FOO] = [()];
 
-    let _ : [(); 1usize] = [()];
+    let _ : [(); 1] = [()];
 
-    let _ = &([1,2,3]) as *const _ as *const [i32; 3usize];
+    let _ = &([1,2,3]) as *const _ as *const [i32; 3];
 
     format!("test");
 }
index 225ce5a741b7cb4f4e6e484ee5f512cd537f9b61..127700e963abd5a661680bb7175734bea154d7c1 100644 (file)
@@ -26,10 +26,10 @@ pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
 }
 
 extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
-    if data == 1_usize {
+    if data == 1 {
         data
     } else {
-        count(data - 1_usize) + count(data - 1_usize)
+        count(data - 1) + count(data - 1)
     }
 }
 
@@ -41,9 +41,9 @@ fn count(n: uint) -> uint {
 }
 
 fn main() {
-    for _ in 0..10_usize {
+    for _ in 0..10 {
         task::spawn(move|| {
-            let result = count(5_usize);
+            let result = count(5);
             println!("result = %?", result);
             panic!();
         });
index 19a57db5ec79d0d01463bdf1e34b11928382de38..e3af5b2bbf57bc5889728b2b3ac9caeb9f6361ef 100644 (file)
@@ -10,9 +10,9 @@
 
 // error-pattern:Number is odd
 fn even(x: uint) -> bool {
-    if x < 2_usize {
+    if x < 2 {
         return false;
-    } else if x == 2_usize { return true; } else { return even(x - 2_usize); }
+    } else if x == 2 { return true; } else { return even(x - 2); }
 }
 
 fn foo(x: uint) {
@@ -23,4 +23,4 @@ fn foo(x: uint) {
     }
 }
 
-fn main() { foo(3_usize); }
+fn main() { foo(3); }
index 34a03e5f0080dc258feb18dc780e1d21f552aefc..cd13b817c2b8c5fc6d7f2ac64257bff0b3b1db6d 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
+// compile-flags: -C debug-assertions
 
 // (Work around constant-evaluation)
 fn value() -> u8 { 200 }
index b18d99cd232e85ed596e2e67ab827701c7b6b8b8..5d2f53962406c5427793320805a0b068ef75c40e 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
+// compile-flags: -C debug-assertions
 
 // (Work around constant-evaluation)
 fn value() -> u8 { 200 }
index ee32291eca6b23062658ffc69fed609c08c9cddb..b089dccbaa52f0c54b18abcb4ec65377ccd0c383 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
+// compile-flags: -C debug-assertions
 
 // (Work around constant-evaluation)
 fn value() -> u8 { 42 }
diff --git a/src/test/run-make/debug-assertions/Makefile b/src/test/run-make/debug-assertions/Makefile
new file mode 100644 (file)
index 0000000..7129756
--- /dev/null
@@ -0,0 +1,21 @@
+-include ../tools.mk
+
+all:
+       $(RUSTC) debug.rs -C debug-assertions=no
+       $(call RUN,debug) good
+       $(RUSTC) debug.rs -C opt-level=0
+       $(call RUN,debug) bad
+       $(RUSTC) debug.rs -C opt-level=1
+       $(call RUN,debug) good
+       $(RUSTC) debug.rs -C opt-level=2
+       $(call RUN,debug) good
+       $(RUSTC) debug.rs -C opt-level=3
+       $(call RUN,debug) good
+       $(RUSTC) debug.rs -O
+       $(call RUN,debug) good
+       $(RUSTC) debug.rs
+       $(call RUN,debug) bad
+       $(RUSTC) debug.rs -C debug-assertions=yes -O
+       $(call RUN,debug) bad
+       $(RUSTC) debug.rs -C debug-assertions=yes -C opt-level=1
+       $(call RUN,debug) bad
diff --git a/src/test/run-make/debug-assertions/debug.rs b/src/test/run-make/debug-assertions/debug.rs
new file mode 100644 (file)
index 0000000..a0ccc75
--- /dev/null
@@ -0,0 +1,42 @@
+// Copyright 2015 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.
+
+#![deny(warnings)]
+
+use std::env;
+use std::thread;
+
+fn main() {
+    let should_fail = env::args().nth(1) == Some("bad".to_string());
+
+    assert_eq!(thread::spawn(debug_assert_eq).join().is_err(), should_fail);
+    assert_eq!(thread::spawn(debug_assert).join().is_err(), should_fail);
+    assert_eq!(thread::spawn(overflow).join().is_err(), should_fail);
+}
+
+fn debug_assert_eq() {
+    let mut hit1 = false;
+    let mut hit2 = false;
+    debug_assert_eq!({ hit1 = true; 1 }, { hit2 = true; 2 });
+    assert!(!hit1);
+    assert!(!hit2);
+}
+
+fn debug_assert() {
+    let mut hit = false;
+    debug_assert!({ hit = true; false });
+    assert!(!hit);
+}
+
+fn overflow() {
+    fn add(a: u8, b: u8) -> u8 { a + b }
+
+    add(200u8, 200u8);
+}
index b4ec986ef25fd8f50141116a5d4aad171cc7a0be..21e84fb858bcfef907b6023f58fdf3c89e75f66e 100644 (file)
@@ -1,17 +1,17 @@
 digraph block {
     N0[label="entry"];
     N1[label="exit"];
-    N2[label="expr 2usize"];
-    N3[label="expr 0usize"];
-    N4[label="expr 20usize"];
-    N5[label="expr [2usize, 0usize, 20usize]"];
+    N2[label="expr 2"];
+    N3[label="expr 0"];
+    N4[label="expr 20"];
+    N5[label="expr [2, 0, 20]"];
     N6[label="local v"];
-    N7[label="stmt let v = [2usize, 0usize, 20usize];"];
+    N7[label="stmt let v = [2, 0, 20];"];
     N8[label="expr v"];
-    N9[label="expr 20usize"];
-    N10[label="expr v[20usize]"];
-    N11[label="stmt v[20usize];"];
-    N12[label="block { let v = [2usize, 0usize, 20usize]; v[20usize]; }"];
+    N9[label="expr 20"];
+    N10[label="expr v[20]"];
+    N11[label="stmt v[20];"];
+    N12[label="block { let v = [2, 0, 20]; v[20]; }"];
     N0 -> N2;
     N2 -> N3;
     N3 -> N4;
index d65de18b5470ad11e15c4ec283d0a65d5e7426f1..d7349932355b10c92a06c3a1d93af996a6b7e7cb 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 pub fn expr_index_20() {
-    let v = [2_usize, 0_usize, 20_usize];
-    v[20_usize];
+    let v = [2, 0, 20];
+    v[20];
 }
index 7d94f4c7b172a0b09be5dbf7727cb78351db7a6e..2e2b8d2578eaf88384f98bb786cc93769aaf572a 100644 (file)
 // buglink test - see issue #1337.
 
 fn test_alias<I: Iterator>(i: Option<<I as Iterator>::Item>) {
-    let s = sub_struct{ field2: 45u32, };
+    let s = sub_struct{ field2: 45, };
 
     // import tests
     fn foo(x: &Float) {}
     let _: Option<u8> = from_i32(45);
 
-    let x = 42_usize;
+    let x = 42;
 
     myflate::deflate_bytes(&[]);
 
-    let x = (3, 4_usize);
+    let x = (3, 4);
     let y = x.1;
 }
 
index e1f36ecda53e83c5daaf73456b44b6c886688baa..f81d4803f8fa491f686137f91f428b85dc5e507a 100644 (file)
@@ -16,5 +16,5 @@ impl Foo for uint {}
 
 pub fn dummy() {
     // force the vtable to be created
-    let _x = &1_usize as &Foo;
+    let _x = &1 as &Foo;
 }
index 4e6f9b46402956e51100735eda180f76e0b6d4dc..a9b77419b9a37ad7a59ec5c54608b06ab4d5e87a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -43,6 +43,8 @@ fn syntax_extension(cx: &ExtCtxt) {
 
     let _m: Vec<syntax::ast::TokenTree> = quote_matcher!(cx, $($foo:tt,)* bar);
     let _n: syntax::ast::Attribute = quote_attr!(cx, #![cfg(foo, bar = "baz")]);
+
+    let _o: Option<P<syntax::ast::Item>> = quote_item!(cx, fn foo<T: ?Sized>() {});
 }
 
 fn main() {
index b1bebf0b3e60648b3a051be51a4c535589a53dcb..45dd213d71fefffee006e2e04bdf9b06176c2297 100644 (file)
@@ -17,7 +17,7 @@ enum sty { ty_nil, }
 struct RawT {struct_: sty, cname: Option<String>, hash: uint}
 
 fn mk_raw_ty(st: sty, cname: Option<String>) -> RawT {
-    return RawT {struct_: st, cname: cname, hash: 0_usize};
+    return RawT {struct_: st, cname: cname, hash: 0};
 }
 
 pub fn main() { mk_raw_ty(sty::ty_nil, None::<String>); }
index 57e9230336c1e082a0b203cca2ec36801f9f1bff..299225e3a47b97ea527dc0a1e2c0d1c8d01c0311 100644 (file)
@@ -35,5 +35,5 @@ fn get(x: int) -> <int as SignedUnsigned>::Opposite {
 
 fn main() {
     let x = get(22);
-    assert_eq!(22_usize, x);
+    assert_eq!(22, x);
 }
index 8ae550be3fc6672dfe1ee51acc5df4a7cd33d733..e7ab910bc95088e8427ba9d56adb204bac81c020 100644 (file)
@@ -43,7 +43,7 @@ fn foo2<I: Foo>(x: I) -> <I as Foo>::A {
 
 pub fn main() {
     let a = 42;
-    assert!(foo2(a) == 42_usize);
+    assert!(foo2(a) == 42);
 
     let a = Bar;
     assert!(foo2(a) == 43);
index 8667f6c8430aba03c706a9ae8d61bf273e920a5e..a63274beb0ebb32a6b2edd7887a535dca66d766d 100644 (file)
@@ -36,8 +36,8 @@ impl UnifyKey for u32 {
 
 pub fn main() {
     let node: Node<i32> = Node { key: 1, value: Some(22) };
-    assert_eq!(foo(&node), Some(22_u32));
+    assert_eq!(foo(&node), Some(22));
 
     let node: Node<u32> = Node { key: 1, value: Some(22) };
-    assert_eq!(foo(&node), Some(22_i32));
+    assert_eq!(foo(&node), Some(22));
 }
index 9503f78a71b908ed469cfc109a4a11f89f9151b6..3be2623185bcdadd43c2579933a51d9c17571065 100644 (file)
@@ -33,8 +33,8 @@ impl UnifyKey for u32 {
 
 pub fn main() {
     let node: Node<i32> = Node(1, Some(22));
-    assert_eq!(foo(&node), Some(22_u32));
+    assert_eq!(foo(&node), Some(22));
 
     let node: Node<u32> = Node(1, Some(22));
-    assert_eq!(foo(&node), Some(22_i32));
+    assert_eq!(foo(&node), Some(22));
 }
index c068065ac6ae7e2167636a4ae336398c1bec9b8a..7e7299961d8a889659676ad6be2df1f30fd6c04a 100644 (file)
@@ -41,5 +41,5 @@ fn f() {
 }
 
 pub fn main() {
-    let z: uint = bar(2, 4_usize);
+    let z: uint = bar(2, 4);
 }
index 7c126fc420aac7f6b5e5522a5dd33b00977c9f1c..2b84adcb15ccbdaa111627fd12ff6bc304393776 100644 (file)
@@ -131,19 +131,19 @@ enum Quark<T> {
 enum CLike { A, B, C }
 
 pub fn main() {
-    let a = &Plus(@Minus(@Val(3_usize), @Val(10_usize)), @Plus(@Val(22_usize), @Val(5_usize)));
+    let a = &Plus(@Minus(@Val(3), @Val(10)), @Plus(@Val(22), @Val(5)));
     test_rbml(a);
 
-    let a = &Spanned {lo: 0_usize, hi: 5_usize, node: 22_usize};
+    let a = &Spanned {lo: 0, hi: 5, node: 22};
     test_rbml(a);
 
-    let a = &Point {x: 3_usize, y: 5_usize};
+    let a = &Point {x: 3, y: 5};
     test_rbml(a);
 
-    let a = &Top(22_usize);
+    let a = &Top(22);
     test_rbml(a);
 
-    let a = &Bottom(222_usize);
+    let a = &Bottom(222);
     test_rbml(a);
 
     let a = &A;
index 8121edfd2cc6ddc621aca2bede107744482bd06b..6a90fa47e58ff84733d521ef50e7319535b37d78 100644 (file)
@@ -16,10 +16,10 @@ trait double {
 }
 
 impl double for uint {
-    fn double(self: Box<uint>) -> uint { *self * 2_usize }
+    fn double(self: Box<uint>) -> uint { *self * 2 }
 }
 
 pub fn main() {
-    let x: Box<_> = box() (box 3_usize as Box<double>);
-    assert_eq!(x.double(), 6_usize);
+    let x: Box<_> = box() (box 3 as Box<double>);
+    assert_eq!(x.double(), 6);
 }
index 537894bfd158dffdeb71cd5d8e90fb7166525f38..cadce45b18d026041d76e45462e12f4ae6afb6bb 100644 (file)
@@ -20,10 +20,10 @@ fn double(self) -> uint { self }
 }
 
 impl double for Box<uint> {
-    fn double(self) -> uint { *self * 2_usize }
+    fn double(self) -> uint { *self * 2 }
 }
 
 pub fn main() {
-    let x: Box<_> = box 3_usize;
-    assert_eq!(x.double(), 6_usize);
+    let x: Box<_> = box 3;
+    assert_eq!(x.double(), 6);
 }
index 2ffdd576ffb783aae0c29ca52d55cf35a8719c79..746107803c90d0dc1dddede22ee9151509205a97 100644 (file)
@@ -16,10 +16,10 @@ trait double {
 }
 
 impl double for Box<uint> {
-    fn double(self: Box<Box<uint>>) -> uint { **self * 2_usize }
+    fn double(self: Box<Box<uint>>) -> uint { **self * 2 }
 }
 
 pub fn main() {
-    let x: Box<Box<Box<Box<Box<_>>>>> = box box box box box 3_usize;
-    assert_eq!(x.double(), 6_usize);
+    let x: Box<Box<Box<Box<Box<_>>>>> = box box box box box 3;
+    assert_eq!(x.double(), 6);
 }
index 82510aea162b8bb733610bf96d781b9abe3351fa..51b5c98816a2c447c7157ea3ba89936cd35e6421 100644 (file)
@@ -16,10 +16,10 @@ trait double {
 }
 
 impl double for uint {
-    fn double(self: Box<uint>) -> uint { *self * 2_usize }
+    fn double(self: Box<uint>) -> uint { *self * 2 }
 }
 
 pub fn main() {
-    let x: Box<Box<_>> = box box 3_usize;
-    assert_eq!(x.double(), 6_usize);
+    let x: Box<Box<_>> = box box 3;
+    assert_eq!(x.double(), 6);
 }
index c9aa1133101788ef3fafad86029e04a25b1e4417..61e704276af31c984084716b9ce0b4e9ee6184c3 100644 (file)
@@ -16,10 +16,10 @@ trait double {
 }
 
 impl double for uint {
-    fn double(self: Box<uint>) -> uint { *self * 2_usize }
+    fn double(self: Box<uint>) -> uint { *self * 2 }
 }
 
 pub fn main() {
-    let x: Box<_> = box 3_usize;
-    assert_eq!(x.double(), 6_usize);
+    let x: Box<_> = box 3;
+    assert_eq!(x.double(), 6);
 }
index 6e6e58a7ddf104796a2d5895cc16f1bcd6f574e0..86d6a91e75b7613273ac58b6e982153efad7bb04 100644 (file)
@@ -29,6 +29,6 @@ fn foo(&self) -> String {
 }
 
 pub fn main() {
-    let x: Box<_> = box 3_usize;
+    let x: Box<_> = box 3;
     assert_eq!(x.foo(), "box 3".to_string());
 }
index 8afb33c7669f542158e198b0a0759ae41987cc83..01ac2fc20bffe1ebb3f918dad124e60f5cf98c4d 100644 (file)
@@ -9,10 +9,10 @@
 // except according to those terms.
 
 pub fn main() {
-    assert_eq!(0xffffffffu32, (-1 as u32));
-    assert_eq!(4294967295u32, (-1 as u32));
-    assert_eq!(0xffffffffffffffffu64, (-1 as u64));
-    assert_eq!(18446744073709551615u64, (-1 as u64));
+    assert_eq!(0xffffffff, (-1 as u32));
+    assert_eq!(4294967295, (-1 as u32));
+    assert_eq!(0xffffffffffffffff, (-1 as u64));
+    assert_eq!(18446744073709551615, (-1 as u64));
 
-    assert_eq!(-2147483648i32 - 1i32, 2147483647i32);
+    assert_eq!(-2147483648 - 1, 2147483647);
 }
index d319aaa2f8e18b58e80317f319c50413f484d2b6..8be6d1bd35ae81f48ac80690dac90d02472ccaa6 100644 (file)
@@ -13,6 +13,6 @@ fn asBlock<F>(f: F) -> uint where F: FnOnce() -> uint {
 }
 
 pub fn main() {
-   let x = asBlock(|| 22_usize);
-   assert_eq!(x, 22_usize);
+   let x = asBlock(|| 22);
+   assert_eq!(x, 22);
 }
index d5d26f42ef0953cce28df180d701eaa9b81e3c04..7cbe8104deb5d939176929e563cd773983149072 100644 (file)
@@ -11,8 +11,8 @@
 fn iter_vec<T, F>(v: Vec<T> , mut f: F) where F: FnMut(&T) { for x in &v { f(x); } }
 
 pub fn main() {
-    let v = vec![1i32, 2, 3, 4, 5, 6, 7];
-    let mut odds = 0i32;
+    let v = vec![1, 2, 3, 4, 5, 6, 7];
+    let mut odds = 0;
     iter_vec(v, |i| {
         if *i % 2 == 1 {
             odds += 1;
index 8c079ca4b079afe2e3e600424abe294ba624f327..7701f6114ca6233a29b077919fd3c7b3247ae3ef 100644 (file)
@@ -11,7 +11,7 @@
 fn iter_vec<T, F>(v: Vec<T>, mut f: F) where F: FnMut(&T) { for x in &v { f(x); } }
 
 pub fn main() {
-    let v = vec![1i32, 2, 3, 4, 5];
+    let v = vec![1, 2, 3, 4, 5];
     let mut sum = 0;
     iter_vec(v.clone(), |i| {
         iter_vec(v.clone(), |j| {
index c907778339ec50b64e72f42343c9b25321975bd1..75161d16bc064c5d3954f2a36d1519bdbba64755 100644 (file)
@@ -15,7 +15,7 @@
 // the closures are in scope. Issue #6801.
 
 fn a() -> i32 {
-    let mut x = 3i32;
+    let mut x = 3;
     x += 1;
     let c1 = || x * 4;
     let c2 = || x * 5;
@@ -27,7 +27,7 @@ fn get(x: &i32) -> i32 {
 }
 
 fn b() -> i32 {
-    let mut x = 3i32;
+    let mut x = 3;
     x += 1;
     let c1 = || get(&x);
     let c2 = || get(&x);
@@ -35,7 +35,7 @@ fn b() -> i32 {
 }
 
 fn c() -> i32 {
-    let mut x = 3i32;
+    let mut x = 3;
     x += 1;
     let c1 = || x * 5;
     let c2 = || get(&x);
index 499650a6e51db82718408d3a71225b5d6e437f1e..d35600ef22efd5d327bda94cf5dbc1407cd05baa 100644 (file)
@@ -26,7 +26,7 @@ fn add_int(x: &mut Ints, v: int) {
 
 fn iter_ints<F>(x: &Ints, mut f: F) -> bool where F: FnMut(&int) -> bool {
     let l = x.values.len();
-    (0_usize..l).all(|i| f(&x.values[i]))
+    (0..l).all(|i| f(&x.values[i]))
 }
 
 pub fn main() {
index dd417f1a9eb73ad53fe6d1d0135a6cded719368a..19316590c262d6967bbd20f75b183fbdc56e8756 100644 (file)
@@ -17,8 +17,8 @@ fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) {
 }
 
 fn main() {
-    let mut sum = 0_usize;
-    let elems = [ 1_usize, 2, 3, 4, 5 ];
+    let mut sum = 0;
+    let elems = [ 1, 2, 3, 4, 5 ];
     each(&elems, |val: &uint| sum += *val);
     assert_eq!(sum, 15);
 }
index f8a680b2a97ac74b53e5439f3f2151df38681604..fc71e6c59fcafe6f197492cf9b478d5b6742fb6c 100644 (file)
@@ -16,6 +16,6 @@ pub fn main() {
     assert_eq!(u, 'Q' as u32);
     assert_eq!(i as u8, 'Q' as u8);
     assert_eq!(i as u8 as i8, 'Q' as u8 as i8);
-    assert_eq!(0x51u8 as char, 'Q');
+    assert_eq!(0x51 as char, 'Q');
     assert_eq!(0 as u32, false as u32);
 }
index 89babb8f7221d4fdf2120ee1e218f77ec3c1ab2c..cd8f783a2e523ab2756e1414791ed09c11fa0c4b 100644 (file)
@@ -17,8 +17,8 @@
 use cci_borrow_lib::foo;
 
 pub fn main() {
-    let p: Box<_> = box 22_usize;
+    let p: Box<_> = box 22;
     let r = foo(&*p);
     println!("r={}", r);
-    assert_eq!(r, 22_usize);
+    assert_eq!(r, 22);
 }
index c4b55b9962fb65027cb8482197db1853c66329d7..bda3b73e29c4927a3e7908253771e45732c40eb7 100644 (file)
@@ -17,7 +17,7 @@ pub fn main() {
     //let bt0 = sys::frame_address();
     //println!("%?", bt0);
 
-    3_usize.to(10_usize, |i| {
+    3.to(10, |i| {
         println!("{}", i);
 
         //let bt1 = sys::frame_address();
index e4b26ba74be0215fc9e5d86a21f9e34daf3807ac..5b91af7a19431b2e364c48bf0e6bbc739aefdb18 100644 (file)
 extern crate cci_iter_lib;
 
 pub fn main() {
-    //let bt0 = sys::rusti::frame_address(1u32);
+    //let bt0 = sys::rusti::frame_address(1);
     //println!("%?", bt0);
     cci_iter_lib::iter(&[1, 2, 3], |i| {
         println!("{}", *i);
-        //assert!(bt0 == sys::rusti::frame_address(2u32));
+        //assert!(bt0 == sys::rusti::frame_address(2));
     })
 }
index 2040bd7ad713236ded387435a86988648ff9d6e3..cc76ed530c4b5e7fa491f5fba62cbcfed3a13ed3 100644 (file)
@@ -21,7 +21,7 @@ pub fn main() {
     // actually working.
     //let bt0 = sys::frame_address();
     //println!("%?", bt0);
-    iter(vec!(1_usize, 2_usize, 3_usize), |i| {
+    iter(vec!(1, 2, 3), |i| {
         println!("{}", i);
 
         //let bt1 = sys::frame_address();
index 9a388c9bc241d99d0dfc0c2db473bb8af978feb3..da51ad761c70a15db384c8ae3e606d94dffdd420 100644 (file)
@@ -25,6 +25,6 @@ fn print_out(thing: Box<ToString>, expected: String) {
 }
 
 pub fn main() {
-  let nyan: Box<ToString> = box cat(0_usize, 2, "nyan".to_string()) as Box<ToString>;
+  let nyan: Box<ToString> = box cat(0, 2, "nyan".to_string()) as Box<ToString>;
   print_out(nyan, "nyan".to_string());
 }
index 476594c270ec3a2ed781ac81d71abc06fd62754c..01513ab6f47e6deba3d6c837ded4361310cdf740 100644 (file)
@@ -42,8 +42,8 @@ pub fn eat(&mut self) -> bool {
 impl cat {
     fn meow(&mut self) {
       println!("Meow");
-      self.meows += 1_usize;
-      if self.meows % 5_usize == 0_usize {
+      self.meows += 1;
+      if self.meows % 5 == 0 {
           self.how_hungry += 1;
       }
     }
@@ -59,7 +59,7 @@ fn cat(in_x : uint, in_y : int, in_name: String) -> cat {
 
 
 pub fn main() {
-    let mut nyan = cat(0_usize, 2, "nyan".to_string());
+    let mut nyan = cat(0, 2, "nyan".to_string());
     let mut nyan: &mut noisy = &mut nyan;
     nyan.speak();
 }
index 14247ad775487cc7f7dc9d0c6f41d8376608bd63..c98e53c8a95a9c198bc6a008222d98979e7f3c58 100644 (file)
@@ -21,7 +21,7 @@ fn drop(&mut self) {
 
 fn cat(done: extern fn(uint)) -> cat {
     cat {
-        meows: 0_usize,
+        meows: 0,
         done: done
     }
 }
index 4c7d0e6951ab64c33749a94710b612bba065f7ea..1cf4c35ee96e0fe860544e9c73985b0e02117bc2 100644 (file)
@@ -27,7 +27,7 @@ pub fn get_name(&self) -> String { self.name.clone() }
     pub fn cat(in_name: String) -> cat {
         cat {
             name: in_name,
-            meows: 0_usize
+            meows: 0
         }
     }
 }
index 47cc500e44ecb1ff05c63652ec8c87727c85625d..55acd2e040d9e51e8b1e60fd7b2010e40fa346d1 100644 (file)
@@ -13,8 +13,8 @@
 use cci_class_2::kitties::cat;
 
 pub fn main() {
-  let nyan : cat = cat(52_usize, 99);
-  let kitty = cat(1000_usize, 2);
+  let nyan : cat = cat(52, 99);
+  let kitty = cat(1000, 2);
   assert_eq!(nyan.how_hungry, 99);
   assert_eq!(kitty.how_hungry, 2);
   nyan.speak();
index d62a726dcdd55bb6d077508c7560bf7f05f30807..34c309780b1bc12b4b903d0ba2f0c88ca6938c15 100644 (file)
 use cci_class_3::kitties::cat;
 
 pub fn main() {
-    let mut nyan : cat = cat(52_usize, 99);
-    let kitty = cat(1000_usize, 2);
+    let mut nyan : cat = cat(52, 99);
+    let kitty = cat(1000, 2);
     assert_eq!(nyan.how_hungry, 99);
     assert_eq!(kitty.how_hungry, 2);
     nyan.speak();
-    assert_eq!(nyan.meow_count(), 53_usize);
+    assert_eq!(nyan.meow_count(), 53);
 }
index 18fb03ec935ed59fc2ee67246da1ffed3bb0802a..8fa76342286153a1cf78df51b9c26e1520a6f4d0 100644 (file)
@@ -15,7 +15,7 @@ struct cat {
 }
 
 impl cat {
-    pub fn speak(&mut self) { self.meows += 1_usize; }
+    pub fn speak(&mut self) { self.meows += 1; }
     pub fn meow_count(&mut self) -> uint { self.meows }
 }
 
@@ -27,10 +27,10 @@ fn cat(in_x: uint, in_y: int) -> cat {
 }
 
 pub fn main() {
-  let mut nyan: cat = cat(52_usize, 99);
-  let kitty = cat(1000_usize, 2);
+  let mut nyan: cat = cat(52, 99);
+  let kitty = cat(1000, 2);
   assert_eq!(nyan.how_hungry, 99);
   assert_eq!(kitty.how_hungry, 2);
   nyan.speak();
-  assert_eq!(nyan.meow_count(), 53_usize);
+  assert_eq!(nyan.meow_count(), 53);
 }
index b529b0a077210b62012c2e9c5697b06d6941b518..557f9986238c7432a5798487df7ad05dca7fb930 100644 (file)
@@ -32,12 +32,12 @@ fn cat<U>(in_x : uint, in_y : int, in_info: Vec<U> ) -> cat<U> {
 }
 
 pub fn main() {
-  let mut nyan : cat<int> = cat::<int>(52_usize, 99, vec!(9));
-  let mut kitty = cat(1000_usize, 2, vec!("tabby".to_string()));
+  let mut nyan : cat<int> = cat::<int>(52, 99, vec!(9));
+  let mut kitty = cat(1000, 2, vec!("tabby".to_string()));
   assert_eq!(nyan.how_hungry, 99);
   assert_eq!(kitty.how_hungry, 2);
   nyan.speak(vec!(1,2,3));
-  assert_eq!(nyan.meow_count(), 55_usize);
+  assert_eq!(nyan.meow_count(), 55);
   kitty.speak(vec!("meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string()));
-  assert_eq!(kitty.meow_count(), 1004_usize);
+  assert_eq!(kitty.meow_count(), 1004);
 }
index daff321efcfd9d39299fb7c03e35b30934635d8c..2bdc053675fbef16b43064d36ffedaa9e1385b7f 100644 (file)
@@ -39,8 +39,8 @@ pub fn eat(&mut self) -> bool {
 impl cat {
     fn meow(&mut self) {
         println!("Meow");
-        self.meows += 1_usize;
-        if self.meows % 5_usize == 0_usize {
+        self.meows += 1;
+        if self.meows % 5 == 0 {
             self.how_hungry += 1;
         }
     }
@@ -67,6 +67,6 @@ fn print_out(thing: Box<ToString>, expected: String) {
 }
 
 pub fn main() {
-  let nyan: Box<ToString> = box cat(0_usize, 2, "nyan".to_string()) as Box<ToString>;
+  let nyan: Box<ToString> = box cat(0, 2, "nyan".to_string()) as Box<ToString>;
   print_out(nyan, "nyan".to_string());
 }
index b56a749d33bb85d9fef9501a9f777ce55b7e81da..c50a8cc83a503ee8b8358180f17add7f82cdedb6 100644 (file)
@@ -17,7 +17,7 @@ struct cat<U> {
 }
 
 impl<U> cat<U> {
-    pub fn speak(&mut self) { self.meows += 1_usize; }
+    pub fn speak(&mut self) { self.meows += 1; }
     pub fn meow_count(&mut self) -> uint { self.meows }
 }
 
@@ -31,6 +31,6 @@ fn cat<U>(in_x : uint, in_y : int) -> cat<U> {
 
 
 pub fn main() {
-  let _nyan : cat<int> = cat::<int>(52_usize, 99);
-  //  let mut kitty = cat(1000_usize, 2);
+  let _nyan : cat<int> = cat::<int>(52, 99);
+  //  let mut kitty = cat(1000, 2);
 }
index 8037d77807d1d76e0397328d0911452cdd55e4f2..0966045464878f364ed99be06d85e94dc5268d5c 100644 (file)
@@ -13,8 +13,8 @@
 use cci_class::kitties::cat;
 
 pub fn main() {
-  let nyan : cat = cat(52_usize, 99);
-  let kitty = cat(1000_usize, 2);
+  let nyan : cat = cat(52, 99);
+  let kitty = cat(1000, 2);
   assert_eq!(nyan.how_hungry, 99);
   assert_eq!(kitty.how_hungry, 2);
 }
index b15d6544fed29ddea62df03404cf82d2ae6056bb..502fa73ed93e53a58cacd7e8317271505d2375f1 100644 (file)
@@ -26,8 +26,8 @@ fn cat(in_x : uint, in_y : int) -> cat {
 }
 
 pub fn main() {
-  let mut nyan : cat = cat(52_usize, 99);
-  let kitty = cat(1000_usize, 2);
+  let mut nyan : cat = cat(52, 99);
+  let kitty = cat(1000, 2);
   assert_eq!(nyan.how_hungry, 99);
   assert_eq!(kitty.how_hungry, 2);
   nyan.speak();
index 9bf8df3ce4bc99182b2778961fcff012ddffa7a0..3cf529f2958bdfcaf4c52dc202db0d8490ff3b73 100644 (file)
@@ -22,8 +22,8 @@ fn cat(in_x : uint, in_y : int) -> cat {
 }
 
 pub fn main() {
-  let nyan : cat = cat(52_usize, 99);
-  let kitty = cat(1000_usize, 2);
+  let nyan : cat = cat(52, 99);
+  let kitty = cat(1000, 2);
   assert_eq!(nyan.how_hungry, 99);
   assert_eq!(kitty.how_hungry, 2);
 }
index ade18a71259678de4440b813b2837659cfc358af..32230c82a7253a9b604f8cfb3780620933ba1f02 100644 (file)
@@ -18,7 +18,7 @@ fn bip(v: &[uint]) -> Vec<uint> {
 }
 
 pub fn main() {
-    let mut the_vec = vec!(1_usize, 2, 3, 100);
+    let mut the_vec = vec!(1, 2, 3, 100);
     assert_eq!(the_vec.clone(), bar(&mut the_vec));
     assert_eq!(the_vec.clone(), bip(&the_vec));
 }
index b0c3a5922b6344f86e7f7dbaf88ce44617569c73..2de881993f156f07f62b833319b25f5bb90eb79a 100644 (file)
@@ -15,12 +15,12 @@ pub fn main() {
     assert_eq!(concat!("qux", "quux",).to_string(), "quxquux".to_string());
 
     assert_eq!(
-        concat!(1, 2, 3_usize, 4f32, 4.0, 'a', true),
+        concat!(1, 2, 3, 4f32, 4.0, 'a', true),
         "12344.0atrue"
     );
 
     assert!(match "12344.0atrue" {
-        concat!(1, 2, 3_usize, 4f32, 4.0, 'a', true) => true,
+        concat!(1, 2, 3, 4f32, 4.0, 'a', true) => true,
         _ => false
     })
 }
index b5a5f57d07abda322171f642cf19c29b7a9eec5f..90142350772b82693c6b3b1da58c63513aa62358 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: --cfg ndebug
+// compile-flags: -C debug-assertions=no
 // exec-env:RUST_LOG=conditional-debug-macro-off=4
 
 #[macro_use]
index cdb96e5dcbfcd166be6d8cf44d12b20b8e808cbb..bdde0cf02c95895b244084d70c0ca3112906ecd9 100644 (file)
@@ -58,6 +58,6 @@ pub fn main() {
     assert_eq!(BLOCK_FN(300), 300);
     assert_eq!(BLOCK_ENUM_CONSTRUCTOR(200), Some(200));
     // FIXME #13972
-    // assert_eq!(BLOCK_UNSAFE_SAFE_PTR as *const isize as usize, 0xdeadbeef_us);
-    // assert_eq!(BLOCK_UNSAFE_SAFE_PTR_2 as *const isize as usize, 0xdeadbeef_us);
+    // assert_eq!(BLOCK_UNSAFE_SAFE_PTR as *const isize as usize, 0xdeadbeef);
+    // assert_eq!(BLOCK_UNSAFE_SAFE_PTR_2 as *const isize as usize, 0xdeadbeef);
 }
index 3a64f53dbb01e4ef7d76a4b230af19904f5b845b..9b0e7e4e75ebfa0700b202cec905dfb360297141 100644 (file)
@@ -20,7 +20,7 @@ pub fn main() {
     foo("hi".to_string());
     foo(~[1, 2, 3]);
     foo(F{field: 42});
-    foo((1, 2_usize));
+    foo((1, 2));
     foo(@1);*/
     foo(Box::new(1));
 }
index 8018f681f3833fcd89e270184f86ca0600c2f054..0cb48670f23da3043e6659fcaaf09e0028fa5003 100644 (file)
@@ -9,23 +9,23 @@
 // except according to those terms.
 
 fn check_expr() {
-    let _:         & uint =     &1_usize;
-    let _:       & & uint =    &&1_usize;
-    let _:     & & & uint =   &&&1_usize;
-    let _:     & & & uint =  & &&1_usize;
-    let _:   & & & & uint =  &&&&1_usize;
-    let _:   & & & & uint = & &&&1_usize;
-    let _: & & & & & uint = &&&&&1_usize;
+    let _:         & uint =     &1;
+    let _:       & & uint =    &&1;
+    let _:     & & & uint =   &&&1;
+    let _:     & & & uint =  & &&1;
+    let _:   & & & & uint =  &&&&1;
+    let _:   & & & & uint = & &&&1;
+    let _: & & & & & uint = &&&&&1;
 }
 
 fn check_ty() {
-    let _:     &uint =         & 1_usize;
-    let _:    &&uint =       & & 1_usize;
-    let _:   &&&uint =     & & & 1_usize;
-    let _:  & &&uint =     & & & 1_usize;
-    let _:  &&&&uint =   & & & & 1_usize;
-    let _: & &&&uint =   & & & & 1_usize;
-    let _: &&&&&uint = & & & & & 1_usize;
+    let _:     &uint =         & 1;
+    let _:    &&uint =       & & 1;
+    let _:   &&&uint =     & & & 1;
+    let _:  & &&uint =     & & & 1;
+    let _:  &&&&uint =   & & & & 1;
+    let _: & &&&uint =   & & & & 1;
+    let _: &&&&&uint = & & & & & 1;
 }
 
 fn check_pat() {
index f94da9fc747e695fb850e7d2f8f5645df66617d5..353bd7a9ce06222c06df4c7c83881f965eed7266 100644 (file)
@@ -62,7 +62,7 @@ pub fn main() {
 
     let (sender, receiver) = channel();
     {
-        let v = Foo::NestedVariant(box 42_usize, SendOnDrop { sender: sender.clone() }, sender);
+        let v = Foo::NestedVariant(box 42, SendOnDrop { sender: sender.clone() }, sender);
     }
     assert_eq!(receiver.recv().unwrap(), Message::DestructorRan);
     assert_eq!(receiver.recv().unwrap(), Message::Dropped);
@@ -79,10 +79,10 @@ pub fn main() {
     let (sender, receiver) = channel();
     let t = {
         thread::spawn(move|| {
-            let mut v = Foo::NestedVariant(box 42usize, SendOnDrop {
+            let mut v = Foo::NestedVariant(box 42, SendOnDrop {
                 sender: sender.clone()
             }, sender.clone());
-            v = Foo::NestedVariant(box 42_usize,
+            v = Foo::NestedVariant(box 42,
                                    SendOnDrop { sender: sender.clone() },
                                    sender.clone());
             v = Foo::SimpleVariant(sender.clone());
index 49c3bf62dbc859a57236716eb8cf44ca49c7abb2..2e86b3774c8dd64722fc5e493606aa5002056a9a 100644 (file)
@@ -17,6 +17,6 @@
 
 pub fn main() {
     unsafe {
-        assert_eq!(22_u8, rust_dbg_extern_identity_u8(22_u8));
+        assert_eq!(22, rust_dbg_extern_identity_u8(22));
     }
 }
index 07c04af8e1bfd9ce95901d2ae0456e684c81446a..2c01808440762e30b7038e4f10f3a2d60a2be4f5 100644 (file)
@@ -17,6 +17,6 @@
 
 pub fn main() {
     unsafe {
-        assert_eq!(22_u32, rust_dbg_extern_identity_u32(22_u32));
+        assert_eq!(22, rust_dbg_extern_identity_u32(22));
     }
 }
index e19c73ebe2054fa552c7b9dfcd9d7b63ee230abe..e72e87d3d93635ebc142082fbfd0fd16cbb60593 100644 (file)
@@ -17,6 +17,6 @@
 
 pub fn main() {
     unsafe {
-        assert_eq!(22_u64, rust_dbg_extern_identity_u64(22_u64));
+        assert_eq!(22, rust_dbg_extern_identity_u64(22));
     }
 }
index 0adb3942e501bf22efbd70af14092b129495042d..172ece0c4bfd94ccc8bbfe861bf774eb49887187 100644 (file)
@@ -31,5 +31,5 @@ fn strlen(str: String) -> uint {
 
 pub fn main() {
     let len = strlen("Rust".to_string());
-    assert_eq!(len, 4_usize);
+    assert_eq!(len, 4);
 }
index e5451431adedfd2bc2aba36990872be000f874d5..cebfd89d8aae696295669b13aaaeb0380fd01a82 100644 (file)
@@ -11,4 +11,4 @@
 
 
 
-pub fn main() { let mut x: i32 = -400_i32; x = 0_i32 - x; assert!((x == 400_i32)); }
+pub fn main() { let mut x: i32 = -400; x = 0 - x; assert!((x == 400)); }
index fbb4e446dd55e9d230031769305e46504a4b4be4..c91e738b822dcd58f32155e180a055991fe3e1ed 100644 (file)
@@ -12,9 +12,9 @@
 
 
 pub fn main() {
-    let mut x: i8 = -12i8;
-    let y: i8 = -12i8;
-    x = x + 1i8;
-    x = x - 1i8;
+    let mut x: i8 = -12;
+    let y: i8 = -12;
+    x = x + 1;
+    x = x - 1;
     assert_eq!(x, y);
 }
index d2a1a3c71a5fc1d365c9094e3d426b1262acab0f..766cced4c2673ba11dffcff136480054cb129a8a 100644 (file)
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 fn even(x: uint) -> bool {
-    if x < 2_usize {
+    if x < 2 {
         return false;
-    } else if x == 2_usize { return true; } else { return even(x - 2_usize); }
+    } else if x == 2 { return true; } else { return even(x - 2); }
 }
 
 fn foo(x: uint) {
@@ -22,4 +22,4 @@ fn foo(x: uint) {
     }
 }
 
-pub fn main() { foo(2_usize); }
+pub fn main() { foo(2); }
index 4b0e9168e19bd35fac2a431dfc0dab09508aaf19..d111462ed5a318510692c55a2f179e507fad0d16 100644 (file)
@@ -27,8 +27,8 @@ mod m {
     #[cfg(target_arch = "x86")]
     pub fn main() {
         unsafe {
-            assert_eq!(::rusti::pref_align_of::<u64>(), 8_usize);
-            assert_eq!(::rusti::min_align_of::<u64>(), 4_usize);
+            assert_eq!(::rusti::pref_align_of::<u64>(), 8);
+            assert_eq!(::rusti::min_align_of::<u64>(), 4);
         }
     }
 
@@ -36,8 +36,8 @@ pub fn main() {
     #[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))]
     pub fn main() {
         unsafe {
-            assert_eq!(::rusti::pref_align_of::<u64>(), 8_usize);
-            assert_eq!(::rusti::min_align_of::<u64>(), 8_usize);
+            assert_eq!(::rusti::pref_align_of::<u64>(), 8);
+            assert_eq!(::rusti::min_align_of::<u64>(), 8);
         }
     }
 }
@@ -48,8 +48,8 @@ mod m {
     #[cfg(target_arch = "x86_64")]
     pub fn main() {
         unsafe {
-            assert_eq!(::rusti::pref_align_of::<u64>(), 8u);
-            assert_eq!(::rusti::min_align_of::<u64>(), 8u);
+            assert_eq!(::rusti::pref_align_of::<u64>(), 8);
+            assert_eq!(::rusti::min_align_of::<u64>(), 8);
         }
     }
 }
@@ -60,8 +60,8 @@ mod m {
     #[cfg(target_arch = "x86")]
     pub fn main() {
         unsafe {
-            assert_eq!(::rusti::pref_align_of::<u64>(), 8_usize);
-            assert_eq!(::rusti::min_align_of::<u64>(), 8_usize);
+            assert_eq!(::rusti::pref_align_of::<u64>(), 8);
+            assert_eq!(::rusti::min_align_of::<u64>(), 8);
         }
     }
 
@@ -69,8 +69,8 @@ pub fn main() {
     #[cfg(target_arch = "x86_64")]
     pub fn main() {
         unsafe {
-            assert_eq!(::rusti::pref_align_of::<u64>(), 8_usize);
-            assert_eq!(::rusti::min_align_of::<u64>(), 8_usize);
+            assert_eq!(::rusti::pref_align_of::<u64>(), 8);
+            assert_eq!(::rusti::min_align_of::<u64>(), 8);
         }
     }
 }
@@ -81,8 +81,8 @@ mod m {
     #[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
     pub fn main() {
         unsafe {
-            assert_eq!(::rusti::pref_align_of::<u64>(), 8_usize);
-            assert_eq!(::rusti::min_align_of::<u64>(), 8_usize);
+            assert_eq!(::rusti::pref_align_of::<u64>(), 8);
+            assert_eq!(::rusti::min_align_of::<u64>(), 8);
         }
     }
 }
index 2b0f7cc7d7d3214dad905b149475b645f79303ac..e5724c1e0dc16ce81e211089b6097bf5ae0a94e7 100644 (file)
@@ -37,83 +37,83 @@ pub fn main() {
     unsafe {
         use rusti::*;
 
-        assert_eq!(ctpop8(0u8), 0u8);
-        assert_eq!(ctpop16(0u16), 0u16);
-        assert_eq!(ctpop32(0u32), 0u32);
-        assert_eq!(ctpop64(0u64), 0u64);
-
-        assert_eq!(ctpop8(1u8), 1u8);
-        assert_eq!(ctpop16(1u16), 1u16);
-        assert_eq!(ctpop32(1u32), 1u32);
-        assert_eq!(ctpop64(1u64), 1u64);
-
-        assert_eq!(ctpop8(10u8), 2u8);
-        assert_eq!(ctpop16(10u16), 2u16);
-        assert_eq!(ctpop32(10u32), 2u32);
-        assert_eq!(ctpop64(10u64), 2u64);
-
-        assert_eq!(ctpop8(100u8), 3u8);
-        assert_eq!(ctpop16(100u16), 3u16);
-        assert_eq!(ctpop32(100u32), 3u32);
-        assert_eq!(ctpop64(100u64), 3u64);
-
-        assert_eq!(ctpop8(-1u8), 8u8);
-        assert_eq!(ctpop16(-1u16), 16u16);
-        assert_eq!(ctpop32(-1u32), 32u32);
-        assert_eq!(ctpop64(-1u64), 64u64);
-
-        assert_eq!(ctlz8(0u8), 8u8);
-        assert_eq!(ctlz16(0u16), 16u16);
-        assert_eq!(ctlz32(0u32), 32u32);
-        assert_eq!(ctlz64(0u64), 64u64);
-
-        assert_eq!(ctlz8(1u8), 7u8);
-        assert_eq!(ctlz16(1u16), 15u16);
-        assert_eq!(ctlz32(1u32), 31u32);
-        assert_eq!(ctlz64(1u64), 63u64);
-
-        assert_eq!(ctlz8(10u8), 4u8);
-        assert_eq!(ctlz16(10u16), 12u16);
-        assert_eq!(ctlz32(10u32), 28u32);
-        assert_eq!(ctlz64(10u64), 60u64);
-
-        assert_eq!(ctlz8(100u8), 1u8);
-        assert_eq!(ctlz16(100u16), 9u16);
-        assert_eq!(ctlz32(100u32), 25u32);
-        assert_eq!(ctlz64(100u64), 57u64);
-
-        assert_eq!(cttz8(-1u8), 0u8);
-        assert_eq!(cttz16(-1u16), 0u16);
-        assert_eq!(cttz32(-1u32), 0u32);
-        assert_eq!(cttz64(-1u64), 0u64);
-
-        assert_eq!(cttz8(0u8), 8u8);
-        assert_eq!(cttz16(0u16), 16u16);
-        assert_eq!(cttz32(0u32), 32u32);
-        assert_eq!(cttz64(0u64), 64u64);
-
-        assert_eq!(cttz8(1u8), 0u8);
-        assert_eq!(cttz16(1u16), 0u16);
-        assert_eq!(cttz32(1u32), 0u32);
-        assert_eq!(cttz64(1u64), 0u64);
-
-        assert_eq!(cttz8(10u8), 1u8);
-        assert_eq!(cttz16(10u16), 1u16);
-        assert_eq!(cttz32(10u32), 1u32);
-        assert_eq!(cttz64(10u64), 1u64);
-
-        assert_eq!(cttz8(100u8), 2u8);
-        assert_eq!(cttz16(100u16), 2u16);
-        assert_eq!(cttz32(100u32), 2u32);
-        assert_eq!(cttz64(100u64), 2u64);
-
-        assert_eq!(cttz8(-1u8), 0u8);
-        assert_eq!(cttz16(-1u16), 0u16);
-        assert_eq!(cttz32(-1u32), 0u32);
-        assert_eq!(cttz64(-1u64), 0u64);
-
-        assert_eq!(bswap16(0x0A0Bu16), 0x0B0Au16);
-        assert_eq!(bswap32(0x0ABBCC0Du32), 0x0DCCBB0Au32);
-        assert_eq!(bswap64(0x0122334455667708u64), 0x0877665544332201u64);
+        assert_eq!(ctpop8(0), 0);
+        assert_eq!(ctpop16(0), 0);
+        assert_eq!(ctpop32(0), 0);
+        assert_eq!(ctpop64(0), 0);
+
+        assert_eq!(ctpop8(1), 1);
+        assert_eq!(ctpop16(1), 1);
+        assert_eq!(ctpop32(1), 1);
+        assert_eq!(ctpop64(1), 1);
+
+        assert_eq!(ctpop8(10), 2);
+        assert_eq!(ctpop16(10), 2);
+        assert_eq!(ctpop32(10), 2);
+        assert_eq!(ctpop64(10), 2);
+
+        assert_eq!(ctpop8(100), 3);
+        assert_eq!(ctpop16(100), 3);
+        assert_eq!(ctpop32(100), 3);
+        assert_eq!(ctpop64(100), 3);
+
+        assert_eq!(ctpop8(-1), 8);
+        assert_eq!(ctpop16(-1), 16);
+        assert_eq!(ctpop32(-1), 32);
+        assert_eq!(ctpop64(-1), 64);
+
+        assert_eq!(ctlz8(0), 8);
+        assert_eq!(ctlz16(0), 16);
+        assert_eq!(ctlz32(0), 32);
+        assert_eq!(ctlz64(0), 64);
+
+        assert_eq!(ctlz8(1), 7);
+        assert_eq!(ctlz16(1), 15);
+        assert_eq!(ctlz32(1), 31);
+        assert_eq!(ctlz64(1), 63);
+
+        assert_eq!(ctlz8(10), 4);
+        assert_eq!(ctlz16(10), 12);
+        assert_eq!(ctlz32(10), 28);
+        assert_eq!(ctlz64(10), 60);
+
+        assert_eq!(ctlz8(100), 1);
+        assert_eq!(ctlz16(100), 9);
+        assert_eq!(ctlz32(100), 25);
+        assert_eq!(ctlz64(100), 57);
+
+        assert_eq!(cttz8(-1), 0);
+        assert_eq!(cttz16(-1), 0);
+        assert_eq!(cttz32(-1), 0);
+        assert_eq!(cttz64(-1), 0);
+
+        assert_eq!(cttz8(0), 8);
+        assert_eq!(cttz16(0), 16);
+        assert_eq!(cttz32(0), 32);
+        assert_eq!(cttz64(0), 64);
+
+        assert_eq!(cttz8(1), 0);
+        assert_eq!(cttz16(1), 0);
+        assert_eq!(cttz32(1), 0);
+        assert_eq!(cttz64(1), 0);
+
+        assert_eq!(cttz8(10), 1);
+        assert_eq!(cttz16(10), 1);
+        assert_eq!(cttz32(10), 1);
+        assert_eq!(cttz64(10), 1);
+
+        assert_eq!(cttz8(100), 2);
+        assert_eq!(cttz16(100), 2);
+        assert_eq!(cttz32(100), 2);
+        assert_eq!(cttz64(100), 2);
+
+        assert_eq!(cttz8(-1), 0);
+        assert_eq!(cttz16(-1), 0);
+        assert_eq!(cttz32(-1), 0);
+        assert_eq!(cttz64(-1), 0);
+
+        assert_eq!(bswap16(0x0A0B), 0x0B0A);
+        assert_eq!(bswap32(0x0ABBCC0D), 0x0DCCBB0A);
+        assert_eq!(bswap64(0x0122334455667708), 0x0877665544332201);
     }
 }
index ed88b3c65e09c8f428c3740c77e693a0a9b82c2e..ab65f35dd34d86d6e9ddae3a545d618946d4ccb7 100644 (file)
@@ -65,8 +65,8 @@ pub fn main() {
         assert_approx_eq!(sqrtf32(64f32), 8f32);
         assert_approx_eq!(sqrtf64(64f64), 8f64);
 
-        assert_approx_eq!(powif32(25f32, -2i32), 0.0016f32);
-        assert_approx_eq!(powif64(23.2f64, 2i32), 538.24f64);
+        assert_approx_eq!(powif32(25f32, -2), 0.0016f32);
+        assert_approx_eq!(powif64(23.2f64, 2), 538.24f64);
 
         assert_approx_eq!(sinf32(0f32), 0f32);
         assert_approx_eq!(sinf64(f64::consts::PI / 2f64), 1f64);
index 22c88c874f096a70a92c8112ff941e438f73ec2d..2ade0df7f6b68811ad371c9359237826bd0cdb1a 100644 (file)
@@ -24,21 +24,21 @@ struct X<T> {
 pub fn main() {
     let x: X<int> = X {
         a: 12345678,
-        b: 9u8,
+        b: 9,
         c: true,
-        d: 10u8,
-        e: 11u16,
-        f: 12u8,
-        g: 13u8
+        d: 10,
+        e: 11,
+        f: 12,
+        g: 13
     };
     bar(x);
 }
 
 fn bar<T>(x: X<T>) {
-    assert_eq!(x.b, 9u8);
+    assert_eq!(x.b, 9);
     assert_eq!(x.c, true);
-    assert_eq!(x.d, 10u8);
-    assert_eq!(x.e, 11u16);
-    assert_eq!(x.f, 12u8);
-    assert_eq!(x.g, 13u8);
+    assert_eq!(x.d, 10);
+    assert_eq!(x.e, 11);
+    assert_eq!(x.f, 12);
+    assert_eq!(x.g, 13);
 }
index b901e95ff55edb453c6a7b8642af99e394850d67..b09d516dd35922957b512502966d922e82935d2c 100644 (file)
@@ -15,7 +15,7 @@
 
 fn main() {
     // Generate sieve of Eratosthenes for n up to 1e6
-    let n = 1000000_usize;
+    let n = 1000000;
     let mut sieve = BitVec::from_elem(n+1, true);
     let limit: uint = (n as f32).sqrt() as uint;
     for i in 2..limit+1 {
index 00613f35f17bb71a1257021477671d01f7ba02cc..bb34dae77b344874fcf5123da8660bef9b22b61e 100644 (file)
@@ -19,6 +19,6 @@
 use std::thunk::Thunk;
 
 pub fn main() {
-    let mut x = 1i32;
+    let mut x = 1;
     let _thunk = Thunk::new(move|| { x = 2; });
 }
index b7dc98b92e0db21feed21496f54a6ef675e43711..11a2e52cf9767a7da97f3cbaaa194721389c25fe 100644 (file)
@@ -15,7 +15,7 @@ fn copy<T: Copy>(&x: &T) -> T {
 }
 
 fn main() {
-    let arr = [(1, 1_usize), (2, 2), (3, 3)];
+    let arr = [(1, 1), (2, 2), (3, 3)];
 
     let v1: Vec<&_> = arr.iter().collect();
     let v2: Vec<_> = arr.iter().map(copy).collect();
index 5b093d16cbf838a3f7c0a5b0735a3b3fcdef4f3d..3dc76f4a089d9a50114b79b3be8ebcc38ce3f58d 100644 (file)
@@ -47,7 +47,7 @@ fn match_on_binding() {
 }
 
 fn match_on_upvar() {
-    let mut foo: Option<Box<_>> = Some(box 8i32);
+    let mut foo: Option<Box<_>> = Some(box 8);
     let f = move|| {
         match foo {
             None => {},
index a6b8a04eeb60ed63a88133466eb4933fa09885d8..227d8f7b8c82ab970409f07a228386646f1f0590 100644 (file)
@@ -11,5 +11,5 @@
 use std::iter::AdditiveIterator;
 fn main() {
     let x: [u64; 3] = [1, 2, 3];
-    assert_eq!(6, (0_usize..3).map(|i| x[i]).sum());
+    assert_eq!(6, (0..3).map(|i| x[i]).sum());
 }
index e66ac8ff53c1f76e6511cd13b9e8987cd31baa44..18e4190ee459f6b24acccb8d36a18733a6ca28d8 100644 (file)
@@ -53,12 +53,12 @@ fn index<'a>(&'a self, col: &uint) -> &'a T {
 }
 
 fn main() {
-    let m = Mat::new(vec!(1_usize, 2, 3, 4, 5, 6), 3);
+    let m = Mat::new(vec!(1, 2, 3, 4, 5, 6), 3);
     let r = m.row(1);
 
     assert!(r.index(&2) == &6);
     assert!(r[2] == 6);
-    assert!(r[2_usize] == 6_usize);
+    assert!(r[2] == 6);
     assert!(6 == r[2]);
 
     let e = r[2];
index 7bd41cc5b52a2fa06453d197100c5574c0b5daa4..dbfa91553e60cdc88446cd2ee399571e47e93b90 100644 (file)
@@ -17,7 +17,7 @@
 struct Bar<'a> { m: marker::PhantomData<&'a ()> }
 
 impl<'a> i::Foo<'a, uint> for Bar<'a> {
-    fn foo(&self) -> uint { 5_usize }
+    fn foo(&self) -> uint { 5 }
 }
 
 pub fn main() {
index ce56f3e8d72875b996ec4c0ad66dc258997af30b..b92cfa1f29b52a026034c2b1391637a252b8ea6b 100644 (file)
@@ -19,5 +19,5 @@ fn uint_to_foo(_: uint) -> Foo {
 
 #[allow(unused_must_use)]
 fn main() {
-    (0_usize..10).map(uint_to_foo);
+    (0..10).map(uint_to_foo);
 }
index 572a0d825282e7c5425690b47ef056f02954ae8b..7e89cfe24e16aeaef2ed23204a2852845b9664ad 100644 (file)
@@ -41,10 +41,10 @@ fn dummy(&self) { }
 }
 
 pub fn main() {
-    fn box_1() -> Box<[i8; 1]> { Box::new( [1i8; 1] ) }
-    fn box_2() -> Box<[i8; 2]> { Box::new( [1i8; 2] ) }
-    fn box_3() -> Box<[i8; 3]> { Box::new( [1i8; 3] ) }
-    fn box_4() -> Box<[i8; 4]> { Box::new( [1i8; 4] ) }
+    fn box_1() -> Box<[i8; 1]> { Box::new( [1; 1] ) }
+    fn box_2() -> Box<[i8; 2]> { Box::new( [1; 2] ) }
+    fn box_3() -> Box<[i8; 3]> { Box::new( [1; 3] ) }
+    fn box_4() -> Box<[i8; 4]> { Box::new( [1; 4] ) }
 
     foo(box_1, box_2, box_3, box_4);
 }
index f751be6f13bc10ac9ee5ce2fbf1b78c0670c4376..5af5186e94f3748137dd8ebf8fe4bd90ba7afb74 100644 (file)
 }
 
 pub fn main() {
-    fn box_1() -> Box<[i8; 1]> { Box::new( [1i8] ) }
-    fn box_2() -> Box<[i8; 20]> { Box::new( [1i8; 20] ) }
-    fn box_3() -> Box<[i8; 300]> { Box::new( [1i8; 300] ) }
-    fn box_4() -> Box<[i8; 4000]> { Box::new( [1i8; 4000] ) }
+    fn box_1() -> Box<[i8; 1]> { Box::new( [1] ) }
+    fn box_2() -> Box<[i8; 20]> { Box::new( [1; 20] ) }
+    fn box_3() -> Box<[i8; 300]> { Box::new( [1; 300] ) }
+    fn box_4() -> Box<[i8; 4000]> { Box::new( [1; 4000] ) }
 
     foo(box_1, box_2, box_3, box_4);
 }
index 01a2322ae939919c397dbe71d8902180cccbdabf..640774f9d24ce70de9111b2b0c1a483ce15ca4ac 100644 (file)
@@ -15,6 +15,6 @@
 use std::fmt;
 
 fn main() {
-    let a: &fmt::Debug = &1_i32;
+    let a: &fmt::Debug = &1;
     format!("{:?}", a);
 }
index 145145af5194dba01d208490816aa63814f71730..29701bd668aafc977b772460662a741bbfb65778 100644 (file)
 use m::{START, END};
 
 fn main() {
-    match 42u32 {
+    match 42 {
         m::START...m::END => {},
-        0u32...m::END => {},
-        m::START...59u32 => {},
+        0...m::END => {},
+        m::START...59 => {},
         _  => {},
     }
 }
index 20ff8d29b7076bc4dc7d7028ad33ac8bc75dabd2..3da0a67ea8ef0a7ec5e589a297c5842a235cdf5e 100644 (file)
@@ -72,17 +72,17 @@ fn range(lo: uint, hi: uint, it: |uint|) {
     let mut i = lo;
     while i < hi {
         it(i);
-        i += 1_usize;
+        i += 1;
     }
 }
 
 pub fn main() {
-    let range: 'static ||uint|| = |a| range(0_usize, 1000_usize, a);
+    let range: 'static ||uint|| = |a| range(0, 1000, a);
     let filt: 'static ||v: uint|| = |a| filter(
         range,
-        |&&n: uint| n % 3_usize != 0_usize && n % 5_usize != 0_usize,
+        |&&n: uint| n % 3 != 0 && n % 5 != 0,
         a);
-    let sum = foldl(filt, 0_usize, |accum, &&n: uint| accum + n );
+    let sum = foldl(filt, 0, |accum, &&n: uint| accum + n );
 
     println!("{}", sum);
 }
index c06a29c09f78eeda9eb6e5354c243976f48a03f3..7bc6393ef8915b679dc0793af22d460463cfb40b 100644 (file)
@@ -28,6 +28,6 @@ fn digit_iter(self) -> I {
 }
 
 fn main() {
-    let xs = vec![1u8, 2, 3, 4, 5];
+    let xs = vec![1, 2, 3, 4, 5];
     assert_eq!(xs.into_iter().digit_sum(), 15);
 }
index 395b2c4b459eba638256e89466b0290f8e2661b2..c55de959a9464aee56073d392bf016de074f4a5d 100644 (file)
@@ -22,5 +22,5 @@ fn f<T>(_x: T) {
 }
 
 pub fn main() {
-    f(C(1_usize));
+    f(C(1));
 }
index 8767d397b647a19149e766c8d54fca765bf5bac2..8b6eb12f102ee24c5b7c7cc220e55ffcf926cdef 100644 (file)
@@ -21,11 +21,11 @@ fn to_bytes(&self) -> Vec<u8> {
 // the position of this function is significant! - if it comes before methods
 // then it works, if it comes after it then it doesn't!
 fn to_bools(bitv: Storage) -> Vec<bool> {
-    (0_usize..8).map(|i| {
+    (0..8).map(|i| {
         let w = i / 64;
         let b = i % 64;
-        let x = 1u64 & (bitv.storage[w] >> b);
-        x == 1u64
+        let x = 1 & (bitv.storage[w] >> b);
+        x == 1
     }).collect()
 }
 
@@ -35,7 +35,7 @@ pub fn main() {
     let bools = vec!(false, false, true, false, false, true, true, false);
     let bools2 = to_bools(Storage{storage: vec!(0b01100100)});
 
-    for i in 0_usize..8 {
+    for i in 0..8 {
         println!("{} => {} vs {}", i, bools[i], bools2[i]);
     }
 
index 28e44536892a5a5d1be7919b0e4561bfb2e2a6b0..b51edcf8bec4d60adad737e151b5e1d6efcc1c73 100644 (file)
@@ -28,7 +28,7 @@ fn foo(name: String, samples_chan: Sender<Msg>) {
 
         // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         let callback: SamplesFn = Box::new(move |buffer| {
-            for i in 0_usize..buffer.len() {
+            for i in 0..buffer.len() {
                 println!("{}: {}", i, buffer[i])
             }
         });
index 93429ff10dcd1f9fe356e7f4ece7856e42e35f3f..1a1f538a548b722ab86c40f1d2b596b5cc888b40 100644 (file)
@@ -12,9 +12,9 @@
 
 pub fn main() {
     let i: uint = 0;
-    assert!(i <= 0xFFFF_FFFF_usize);
+    assert!(i <= 0xFFFF_FFFF);
 
     let i: int = 0;
-    assert!(i >= -0x8000_0000__isize);
-    assert!(i <= 0x7FFF_FFFF__isize);
+    assert!(i >= -0x8000_0000);
+    assert!(i <= 0x7FFF_FFFF);
 }
index 557ec82233ddebca8a17538b5132abe162ffd6ef..6faca339651c07b77d091200363385f9a40e6be8 100644 (file)
@@ -49,7 +49,7 @@ fn main() {
     assert_eq!(unsafe { NUM_DROPS }, 3);
     { let _x = FooBar::_Foo(Foo); }
     assert_eq!(unsafe { NUM_DROPS }, 5);
-    { let _x = FooBar::_Bar(42_usize); }
+    { let _x = FooBar::_Bar(42); }
     assert_eq!(unsafe { NUM_DROPS }, 6);
 
     { let _ = Foo; }
@@ -60,6 +60,6 @@ fn main() {
     assert_eq!(unsafe { NUM_DROPS }, 9);
     { let _ = FooBar::_Foo(Foo); }
     assert_eq!(unsafe { NUM_DROPS }, 11);
-    { let _ = FooBar::_Bar(42_usize); }
+    { let _ = FooBar::_Bar(42); }
     assert_eq!(unsafe { NUM_DROPS }, 12);
 }
index 96db28f4a101fbaab6d30fe890a47e48d310e992..3a9864f3a766718cd277481995ceff45e5c76b9e 100644 (file)
 struct signature<'a> { pattern : &'a [u32] }
 
 static test1: signature<'static> =  signature {
-  pattern: &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,0x03707344u32,0xa4093822u32,0x299f31d0u32]
+  pattern: &[0x243f6a88,0x85a308d3,0x13198a2e,0x03707344,0xa4093822,0x299f31d0]
 };
 
 pub fn main() {
-  let test: &[u32] = &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,
-                       0x03707344u32,0xa4093822u32,0x299f31d0u32];
+  let test: &[u32] = &[0x243f6a88,0x85a308d3,0x13198a2e,
+                       0x03707344,0xa4093822,0x299f31d0];
   println!("{}",test==test1.pattern);
 }
index 815e00e129143f0ee2d8c60e2cb14e4013ac450c..303dd191006ad88465c39633f32a67049e70241b 100644 (file)
@@ -13,7 +13,7 @@
 struct X { pub x: uint }
 impl Default for X {
     fn default() -> X {
-        X { x: 42_usize }
+        X { x: 42 }
     }
 }
 
index b4a41ef44f82d502298c382a7cadbf478efd2192..58424089c5e02a83457c5f3b7ee309730b8ab649 100644 (file)
@@ -12,5 +12,5 @@
 extern crate issue2170lib;
 
 pub fn main() {
-   // let _ = issue2170lib::rsrc(2i32);
+   // let _ = issue2170lib::rsrc(2);
 }
index dd38a5f8b3ba7b23906bc3b11dede3688d8cfb41..121338823d29133497b1bfa86bf048e1c13df82a 100644 (file)
@@ -13,8 +13,8 @@
 
 fn producer(tx: &Sender<Vec<u8>>) {
     tx.send(
-         vec!(1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, 8u8, 9u8, 10u8, 11u8, 12u8,
-          13u8)).unwrap();
+         vec!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+          13)).unwrap();
 }
 
 pub fn main() {
index 74ddb990c31cb839928d1da2fffdd1a64cb0a06c..45964efad97c86e27ce97a0cbad38b9797aea193 100644 (file)
@@ -19,8 +19,8 @@ struct A { a: Box<isize> }
 fn foo() -> Box<FnMut() -> isize + 'static> {
     let k: Box<_> = box 22;
     let _u = A {a: k.clone()};
-    // FIXME(#16640) suffix in `22_isize` suffix shouldn't be necessary
-    let result  = || 22_isize;
+    // FIXME(#16640) suffix in `22` suffix shouldn't be necessary
+    let result  = || 22;
     // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     Box::new(result)
 }
index 262d9b21eb48bddd57815f6d246e26151037ef4a..dfc9272827066c517138209ab1851338af90e681 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:--cfg ndebug
+// compile-flags:-C debug-assertions=no
 // exec-env:RUST_LOG=logging-enabled-debug=debug
 
 #[macro_use]
index 8526dfe72da134a5c96e16fd7c1459d4db099c56..82a155b117301980bb74b123fa524a4cc74c37e7 100644 (file)
@@ -10,6 +10,7 @@
 
 // ignore-windows
 // exec-env:RUST_LOG=debug
+// compile-flags:-C debug-assertions=y
 
 #[macro_use]
 extern crate log;
index 069aeb9220e604a70ecd87ebdf9988ca8072bbfe..1cbd4f6bc704c3895eff103446568a83f79ebbe5 100644 (file)
@@ -24,6 +24,6 @@ fn $fnname($arg: $ty) -> Option<$ty> $body
 
 pub fn main() {
     assert!(overly_complicated!(f, x, Option<uint>, { return Some(x); },
-                               Some(8_usize), Some(y), y) == 8_usize)
+                               Some(8), Some(y), y) == 8)
 
 }
index 6f2626a5af51ef7b45d8571893ff5d99bf42e014..7a3e55322c8e1cb5cb1c87d6bd96e147df3c4a4b 100644 (file)
@@ -47,9 +47,9 @@ fn f(c: Option<char>) -> uint {
 }
 
 pub fn main() {
-    assert_eq!(1_usize, f(Some('x')));
-    assert_eq!(2_usize, f(Some('y')));
-    assert_eq!(3_usize, f(None));
+    assert_eq!(1, f(Some('x')));
+    assert_eq!(2, f(Some('y')));
+    assert_eq!(3, f(None));
 
     assert_eq!(1, match Some('x') {
         Some(char_x!()) => 1,
index d2e27fc822eebe8323a641772db87038842e2e8c..79b197f08e2718616db5e1bff9e6ce00a557baf9 100644 (file)
@@ -16,6 +16,6 @@ pub fn main() {
         None => return (),
         Some(num) => num as u32
     };
-    assert_eq!(f, 1234u32);
+    assert_eq!(f, 1234);
     println!("{}", f)
 }
index 0ad600dd85d9338a1ed33c230053c369fa0098c7..3ffac98418a7472a7d2a119cd1a356c9f90e3412 100644 (file)
@@ -38,7 +38,7 @@ fn my_write(&mut self, buf: &[u8]) -> IoResult<()> {
 }
 
 fn main() {
-    let mut buf = [0_u8; 6];
+    let mut buf = [0; 6];
 
     {
         let mut writer: &mut [_] = &mut buf;
index e9a1e19d4bf8416494606a25cdb4285f61cd1910..81212ee348f1f68936266cbcceb9127332e42725 100644 (file)
@@ -26,5 +26,5 @@ fn main() {
 
     x.foo(&x);
 
-    assert!(method_self_arg1::get_count() == 2u64*3*3*3*5*5*5*7*7*7);
+    assert!(method_self_arg1::get_count() == 2*3*3*3*5*5*5*7*7*7);
 }
index 7fa810ce1549ad9f671caf94a6907225a87c887b..ca81860dd080c9ed3f8fffe146ee534951ec0b80 100644 (file)
@@ -30,5 +30,5 @@ fn main() {
 
     x.run_trait();
 
-    assert!(method_self_arg2::get_count() == 2u64*2*3*3*5*5*7*7*11*11*13*13*17);
+    assert!(method_self_arg2::get_count() == 2*2*3*3*5*5*7*7*11*11*13*13*17);
 }
index c79141d97950045a9b1f2e68e9bbe7ad44f6f67d..17fdd7b45c20c033a2d328420464a7f27ca6058b 100644 (file)
@@ -75,5 +75,5 @@ fn main() {
 
     x.baz();
 
-    unsafe { assert!(COUNT == 2u64*2*3*3*5*5*7*7*11*11*13*13*17); }
+    unsafe { assert!(COUNT == 2*2*3*3*5*5*7*7*11*11*13*13*17); }
 }
index de24297c7b51af6f3fcd5d4147d04cd868d73697..62b3d52860ba8d2625f3928828324069834bb22f 100644 (file)
@@ -54,5 +54,5 @@ fn main() {
 
     x.foo(&x);
 
-    unsafe { assert!(COUNT == 2_usize*3*3*3*5*5*5*7*7*7); }
+    unsafe { assert!(COUNT == 2*3*3*3*5*5*5*7*7*7); }
 }
index bb62b1599a4fe5aa5f99563b90877e8036b4a863..03027e40d6c1e50c345e4615cc08fa07f1625440 100644 (file)
@@ -55,7 +55,7 @@ macro_rules! check_fancy {
         check_fancy!($e, $T, |ptr| assert!(*ptr == $e));
     }};
     ($e:expr, $T:ty, |$v:ident| $chk:expr) => {{
-        assert!(E::Nothing::<$T>((), ((), ()), [23i8; 0]).is_none());
+        assert!(E::Nothing::<$T>((), ((), ()), [23; 0]).is_none());
         let e = $e;
         let t_ = E::Thing::<$T>(23, e);
         match t_.get_ref() {
index 8da753acb966ef292e0d982d86273cb5eaf93701..9c7a925b5bbc2a932190c9567bc695fbb6ab19e0 100644 (file)
@@ -29,7 +29,7 @@ fn get(&self) -> i32 {
 }
 
 fn main() {
-    let x = 22_i32;
+    let x = 22;
     let x1: &SomeTrait<SomeType=i32> = &x;
     let y = get_int(x1);
     assert_eq!(x, y);
index 998af27c338dc88210fb1f56e02b20a73a178419..d2523bc4f246f34ec0fb1c4e4383aeed577fe930 100644 (file)
@@ -40,9 +40,9 @@ fn do_it_imm(obj: &Foo, v: uint) {
 }
 
 pub fn main() {
-    let mut x = 22_usize;
+    let mut x = 22;
     let obj = &mut x as &mut Foo;
     do_it_mut(obj);
-    do_it_imm(obj, 23_usize);
+    do_it_imm(obj, 23);
     do_it_mut(obj);
 }
index 30a8c270bd7944c36fa43f0833b3621663906de4..9cee266c4a7b9f1aa8eabb2052e82268697dca5b 100644 (file)
@@ -37,7 +37,7 @@ pub fn main() {
         box BarStruct{ x: 2 } as Box<FooTrait>
     );
 
-    for i in 0_usize..foos.len() {
+    for i in 0..foos.len() {
         assert_eq!(i, foos[i].foo());
     }
 }
index 654d2429a0ba06fb83428c44aa97eb8fa8751c41..ef399044abc99347c11d258a0f59ea5ec740b7da 100644 (file)
@@ -16,6 +16,6 @@ fn or_alt(q: blah) -> int {
 
 pub fn main() {
     assert_eq!(or_alt(blah::c), 0);
-    assert_eq!(or_alt(blah::a(10, 100, 0_usize)), 110);
+    assert_eq!(or_alt(blah::a(10, 100, 0)), 110);
     assert_eq!(or_alt(blah::b(20, 200)), 220);
 }
index 2ef9e08134cf7259fcf5dde6a4f99a59ac889bdb..0ac9c97532bffd29b33b8cc483724b0f1dad9e48 100644 (file)
@@ -28,5 +28,5 @@ extern "rust-call" fn call(&self, (arg,): (A,)) -> i32 {
 
 fn main() {
     // ICE trigger
-    (G(PhantomData))(1_i32);
+    (G(PhantomData))(1);
 }
index cfe49c38c5267835a1e1b4c57c06895634d5b857..92f57f04b10ae5279fb9c3acce7a253ce86eb209 100644 (file)
@@ -24,7 +24,7 @@ pub fn main() {
 
     assert_eq!(mem::size_of::<[Foo; 10]>(), 90);
 
-    for i in 0_usize..10 {
+    for i in 0..10 {
         assert_eq!(foos[i], Foo { bar: 1, baz: 2});
     }
 
index 02d8602d59e311618fd820922d239d3aa851e4eb..08d00d4dc035b37a648e6fd6de66487cb2681f1c 100644 (file)
@@ -14,4 +14,4 @@ mod foo {
     pub fn bar(_offset: uint) { }
 }
 
-pub fn main() { foo::bar(0_usize); }
+pub fn main() { foo::bar(0); }
index c7380b362fbbad794447b2b2e7de26072d37f8b8..b4d04ba18f98ef032c4c4d62c341b56cc7380303 100644 (file)
@@ -26,6 +26,6 @@ fn cat(in_x : uint, in_y : int) -> cat {
 }
 
 pub fn main() {
-    let mut nyan : cat = cat(52_usize, 99);
-    assert_eq!(nyan.meow_count(), 52_usize);
+    let mut nyan : cat = cat(52, 99);
+    assert_eq!(nyan.meow_count(), 52);
 }
index 1fd83041f62077ca3c824706e7ae3bf9eef4904d..f12cf82f939c7d2356a0cea330deb6171d5cdfdf 100644 (file)
 #![feature(box_syntax)]
 
 fn sums_to(v: Vec<int> , sum: int) -> bool {
-    let mut i = 0_usize;
+    let mut i = 0;
     let mut sum0 = 0;
     while i < v.len() {
         sum0 += v[i];
-        i += 1_usize;
+        i += 1;
     }
     return sum0 == sum;
 }
 
 fn sums_to_using_uniq(v: Vec<int> , sum: int) -> bool {
-    let mut i = 0_usize;
+    let mut i = 0;
     let mut sum0: Box<_> = box 0;
     while i < v.len() {
         *sum0 += v[i];
-        i += 1_usize;
+        i += 1;
     }
     return *sum0 == sum;
 }
 
 fn sums_to_using_rec(v: Vec<int> , sum: int) -> bool {
-    let mut i = 0_usize;
+    let mut i = 0;
     let mut sum0 = F {f: 0};
     while i < v.len() {
         sum0.f += v[i];
-        i += 1_usize;
+        i += 1;
     }
     return sum0.f == sum;
 }
@@ -46,11 +46,11 @@ fn sums_to_using_rec(v: Vec<int> , sum: int) -> bool {
 struct F<T> { f: T }
 
 fn sums_to_using_uniq_rec(v: Vec<int> , sum: int) -> bool {
-    let mut i = 0_usize;
+    let mut i = 0;
     let mut sum0 = F::<Box<_>> {f: box 0};
     while i < v.len() {
         *sum0.f += v[i];
-        i += 1_usize;
+        i += 1;
     }
     return *sum0.f == sum;
 }
index db414abb7ffc87478820738a37b5fdaa43b6148c..41ed9a74d13107153826251939f62afe2c32a92f 100644 (file)
@@ -38,7 +38,7 @@ fn main() {
     let x = ..1+3;
     assert!(x == (..4));
 
-    let a = &[0i32, 1, 2, 3, 4, 5, 6];
+    let a = &[0, 1, 2, 3, 4, 5, 6];
     let x = &a[1+1..2+2];
     assert!(x == &a[2..4]);
     let x = &a[..1+2];
index de5b14104c5300da7dd50c8b9f66def1104699d2..e8bcff38131a66ea43546f211c4c5f859f5319a4 100644 (file)
@@ -35,9 +35,9 @@ unsafe fn test_triangle() -> bool {
     // from pairs of rows (where each pair of rows is equally sized),
     // and the elements of the triangle match their row-pair index.
     unsafe fn sanity_check(ascend: &[*mut u8]) {
-        for i in 0_usize..COUNT / 2 {
+        for i in 0..COUNT / 2 {
             let (p0, p1, size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i));
-            for j in 0_usize..size {
+            for j in 0..size {
                 assert_eq!(*p0.offset(j as int), i as u8);
                 assert_eq!(*p1.offset(j as int), i as u8);
             }
@@ -88,14 +88,14 @@ fn idx_to_size(i: uint) -> uint { (i+1) * 10 }
     // that at least two rows will be allocated near each other, so
     // that we trigger the bug (a buffer overrun) in an observable
     // way.)
-    for i in 0_usize..COUNT / 2 {
+    for i in 0..COUNT / 2 {
         let size = idx_to_size(i);
         ascend[2*i]   = allocate(size, ALIGN);
         ascend[2*i+1] = allocate(size, ALIGN);
     }
 
     // Initialize each pair of rows to distinct value.
-    for i in 0_usize..COUNT / 2 {
+    for i in 0..COUNT / 2 {
         let (p0, p1, size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i));
         for j in 0..size {
             *p0.offset(j as int) = i as u8;
@@ -109,7 +109,7 @@ fn idx_to_size(i: uint) -> uint { (i+1) * 10 }
     test_3(ascend); // triangle -> square
     test_4(ascend); // square -> triangle
 
-    for i in 0_usize..COUNT / 2 {
+    for i in 0..COUNT / 2 {
         let size = idx_to_size(i);
         deallocate(ascend[2*i], size, ALIGN);
         deallocate(ascend[2*i+1], size, ALIGN);
@@ -123,7 +123,7 @@ fn idx_to_size(i: uint) -> uint { (i+1) * 10 }
     // rows as we go.
     unsafe fn test_1(ascend: &mut [*mut u8]) {
         let new_size = idx_to_size(COUNT-1);
-        for i in 0_usize..COUNT / 2 {
+        for i in 0..COUNT / 2 {
             let (p0, p1, old_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i));
             assert!(old_size < new_size);
 
@@ -138,7 +138,7 @@ unsafe fn test_1(ascend: &mut [*mut u8]) {
     // Test 2: turn the square back into a triangle, top to bottom.
     unsafe fn test_2(ascend: &mut [*mut u8]) {
         let old_size = idx_to_size(COUNT-1);
-        for i in 0_usize..COUNT / 2 {
+        for i in 0..COUNT / 2 {
             let (p0, p1, new_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i));
             assert!(new_size < old_size);
 
@@ -153,7 +153,7 @@ unsafe fn test_2(ascend: &mut [*mut u8]) {
     // Test 3: turn triangle into a square, bottom to top.
     unsafe fn test_3(ascend: &mut [*mut u8]) {
         let new_size = idx_to_size(COUNT-1);
-        for i in (0_usize..COUNT / 2).rev() {
+        for i in (0..COUNT / 2).rev() {
             let (p0, p1, old_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i));
             assert!(old_size < new_size);
 
@@ -168,7 +168,7 @@ unsafe fn test_3(ascend: &mut [*mut u8]) {
     // Test 4: turn the square back into a triangle, bottom to top.
     unsafe fn test_4(ascend: &mut [*mut u8]) {
         let old_size = idx_to_size(COUNT-1);
-        for i in (0_usize..COUNT / 2).rev() {
+        for i in (0..COUNT / 2).rev() {
             let (p0, p1, new_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i));
             assert!(new_size < old_size);
 
index 51b800bc9f01f2e101e541ad090d2a9478409d83..94fe3f1d9eaee5cf14c122c7e02ee9249c7befd0 100644 (file)
@@ -38,19 +38,19 @@ struct Outer {
 
 #[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "aarch64"))]
 mod m {
-    pub fn align() -> uint { 4_usize }
-    pub fn size() -> uint { 8_usize }
+    pub fn align() -> uint { 4 }
+    pub fn size() -> uint { 8 }
 }
 
 #[cfg(target_arch = "x86_64")]
 mod m {
-    pub fn align() -> uint { 4_usize }
-    pub fn size() -> uint { 8_usize }
+    pub fn align() -> uint { 4 }
+    pub fn size() -> uint { 8 }
 }
 
 pub fn main() {
     unsafe {
-        let x = Outer {c8: 22u8, t: Inner {c64: 44u32}};
+        let x = Outer {c8: 22, t: Inner {c64: 44}};
 
         // Send it through the shape code
         let y = format!("{:?}", x);
index 835b4c40f5ca76c5b48cb55a598453a9e9ac5dfe..8b7434ed063453a28e5a9de7f37e9756d1ed36a8 100644 (file)
@@ -44,14 +44,14 @@ struct Outer {
 mod m {
     #[cfg(target_arch = "x86")]
     pub mod m {
-        pub fn align() -> uint { 4_usize }
-        pub fn size() -> uint { 12_usize }
+        pub fn align() -> uint { 4 }
+        pub fn size() -> uint { 12 }
     }
 
     #[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))]
     pub mod m {
-        pub fn align() -> uint { 8_usize }
-        pub fn size() -> uint { 16_usize }
+        pub fn align() -> uint { 8 }
+        pub fn size() -> uint { 16 }
     }
 }
 
@@ -59,8 +59,8 @@ pub fn size() -> uint { 16_usize }
 mod m {
     #[cfg(target_arch = "x86_64")]
     pub mod m {
-        pub fn align() -> uint { 8u }
-        pub fn size() -> uint { 16u }
+        pub fn align() -> uint { 8 }
+        pub fn size() -> uint { 16 }
     }
 }
 
@@ -68,14 +68,14 @@ pub fn size() -> uint { 16u }
 mod m {
     #[cfg(target_arch = "x86")]
     pub mod m {
-        pub fn align() -> uint { 8_usize }
-        pub fn size() -> uint { 16_usize }
+        pub fn align() -> uint { 8 }
+        pub fn size() -> uint { 16 }
     }
 
     #[cfg(target_arch = "x86_64")]
     pub mod m {
-        pub fn align() -> uint { 8_usize }
-        pub fn size() -> uint { 16_usize }
+        pub fn align() -> uint { 8 }
+        pub fn size() -> uint { 16 }
     }
 }
 
@@ -83,14 +83,14 @@ pub fn size() -> uint { 16_usize }
 mod m {
     #[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
     pub mod m {
-        pub fn align() -> uint { 8_usize }
-        pub fn size() -> uint { 16_usize }
+        pub fn align() -> uint { 8 }
+        pub fn size() -> uint { 16 }
     }
 }
 
 pub fn main() {
     unsafe {
-        let x = Outer {c8: 22u8, t: Inner {c64: 44u64}};
+        let x = Outer {c8: 22, t: Inner {c64: 44}};
 
         let y = format!("{:?}", x);
 
index 282a24a407c95d2252f5fdfae96115d9eb47d7de..b152470fbb640941a2668140138c33470f7370dd 100644 (file)
@@ -20,6 +20,6 @@ fn m(input: t3) -> int {
 }
 
 pub fn main() {
-    assert_eq!(m(t3::c(T2 {x: t1::a(10), y: 5}, 4_usize)), 10);
-    assert_eq!(m(t3::c(T2 {x: t1::b(10_usize), y: 5}, 4_usize)), 19);
+    assert_eq!(m(t3::c(T2 {x: t1::a(10), y: 5}, 4)), 10);
+    assert_eq!(m(t3::c(T2 {x: t1::b(10), y: 5}, 4)), 19);
 }
index 1e91ab7e921d32aeeba7361bbca7c4d7cb109806..56dd386ead1c19fc31cf2443d83894fa47477cdc 100644 (file)
@@ -16,8 +16,8 @@ fn foo(x: &uint) -> uint {
 }
 
 pub fn main() {
-    let p: Box<_> = box 22_usize;
+    let p: Box<_> = box 22;
     let r = foo(&*p);
     println!("r={}", r);
-    assert_eq!(r, 22_usize);
+    assert_eq!(r, 22);
 }
index 7c9b1ae226f5aca97a6f091b970149367bda301c..0673179eef0062ab4871d29f8d44188b9c42c2f3 100644 (file)
@@ -16,7 +16,7 @@ fn foo(x: &uint) -> uint {
 }
 
 pub fn main() {
-    let p: Box<_> = box 3_usize;
+    let p: Box<_> = box 3;
     let r = foo(&*p);
-    assert_eq!(r, 3_usize);
+    assert_eq!(r, 3);
 }
index 3704fc1d8d1a30dcec80b0b287195eb9d94d2963..b39343b1f5743ea3416c6255436b7fdd1df585b5 100644 (file)
@@ -20,7 +20,7 @@ fn box_it<'a>(x: Box<FnMut() + 'a>) -> closure_box<'a> {
 }
 
 pub fn main() {
-    let mut i = 3i32;
+    let mut i = 3;
     assert_eq!(i, 3);
     {
         let cl = || i += 1;
index 0ca17e218d2f637751d3dd781f4f131a0c515f5d..3708d187d7161077e9cb411e564420d7ae8a3029 100644 (file)
@@ -15,6 +15,6 @@ fn foo(x: &uint) -> &uint { x }
 fn bar(x: &uint) -> uint { *x }
 
 pub fn main() {
-    let p: Box<_> = box 3_usize;
+    let p: Box<_> = box 3;
     assert_eq!(bar(foo(&*p)), 3);
 }
index c71953e20f8af12bd0f3ba4337367c44958431b7..181d962cfae50da52d80bdcd061c36af7086356c 100644 (file)
@@ -21,6 +21,6 @@ fn parameterized(x: &uint) -> uint {
 }
 
 pub fn main() {
-    let x = 3_usize;
-    assert_eq!(parameterized(&x), 3_usize);
+    let x = 3;
+    assert_eq!(parameterized(&x), 3);
 }
index a224017780e2d936419b6ca4f6ec7e235b527b9c..30d8fc34d00744bbed427c1c5e5059204bda9ca7 100644 (file)
@@ -18,7 +18,7 @@
 // This version does not yet work (associated type issues)...
 #[cfg(cannot_use_this_yet)]
 fn foo<'a>(map: RefCell<HashMap<&'static str, &'a [u8]>>) {
-    let one = [1_usize];
+    let one = [1];
     assert_eq!(map.borrow().get("one"), Some(&one[..]));
 }
 
@@ -26,7 +26,7 @@ fn foo<'a>(map: RefCell<HashMap<&'static str, &'a [u8]>>) {
 // ... and this version does not work (the lifetime of `one` is
 // supposed to match the lifetime `'a`) ...
 fn foo<'a>(map: RefCell<HashMap<&'static str, &'a [u8]>>) {
-    let one = [1_usize];
+    let one = [1];
     assert_eq!(map.borrow().get("one"), Some(&one.as_slice()));
 }
 
@@ -41,9 +41,9 @@ fn foo<'a>(map: RefCell<HashMap<&'static str, &'a [u8]>>) {
 }
 
 fn main() {
-    let zer = [0u8];
-    let one = [1u8];
-    let two = [2u8];
+    let zer = [0];
+    let one = [1];
+    let two = [2];
     let mut map = HashMap::new();
     map.insert("zero", &zer[..]);
     map.insert("one",  &one[..]);
index eb3bec773266670d241bb68fbbbb6ec4bb43b803..807227d47db8f2d4eaa1154bcf3d378b1d75ca33 100644 (file)
@@ -37,7 +37,7 @@ fn extension<'e>(x: &'e E<'e>) -> Box<M+'e> {
 }
 
 fn main() {
-    let w = E { f: &10u8 };
+    let w = E { f: &10 };
     let o = extension(&w);
-    assert_eq!(o.n(), 10u8);
+    assert_eq!(o.n(), 10);
 }
index abe6ffe7d4ccaabdbac3ef7d7bf4a63cf364ba78..9209db22433137498df4d2a7fd1ac5b71a197e48 100644 (file)
@@ -34,7 +34,7 @@ fn rename_directory() {
         let fromp = CString::new(test_file.as_vec()).unwrap();
         let modebuf = CString::new(b"w+b").unwrap();
         let ostream = libc::fopen(fromp.as_ptr(), modebuf.as_ptr());
-        assert!((ostream as uint != 0_usize));
+        assert!((ostream as uint != 0));
         let s = "hello".to_string();
         let buf = CString::new(b"hello").unwrap();
         let write_len = libc::fwrite(buf.as_ptr() as *mut _,
index 74227192cabbefae06eb916fbcc1e002f37934ca..14b398b3d9a64dff9796ed2d9d9ea936f6317c2f 100644 (file)
 fn my_err(s: String) -> ! { println!("{}", s); panic!(); }
 
 fn okay(i: uint) -> int {
-    if i == 3_usize {
+    if i == 3 {
         my_err("I don't like three".to_string());
     } else {
         return 42;
     }
 }
 
-pub fn main() { okay(4_usize); }
+pub fn main() { okay(4); }
index ec033b74dd1cde1714b84dbf7b37636ed9aef1a7..abb16c39d113643a22aa1271773fc0a277055cdd 100644 (file)
@@ -43,15 +43,15 @@ fn start(argc: int, argv: *const *const u8) -> int {
     };
     let me = &*args[0];
 
-    let x: &[u8] = &[1u8];
+    let x: &[u8] = &[1];
     pass(Command::new(me).arg(x).output().unwrap());
-    let x: &[u8] = &[2u8];
+    let x: &[u8] = &[2];
     pass(Command::new(me).arg(x).output().unwrap());
-    let x: &[u8] = &[3u8];
+    let x: &[u8] = &[3];
     pass(Command::new(me).arg(x).output().unwrap());
-    let x: &[u8] = &[4u8];
+    let x: &[u8] = &[4];
     pass(Command::new(me).arg(x).output().unwrap());
-    let x: &[u8] = &[5u8];
+    let x: &[u8] = &[5];
     pass(Command::new(me).arg(x).output().unwrap());
 
     0
index 18519573c26a6ea6ddb08c801559ec82f968293d..51c20bcd09852e7dd1ab39a0bf64842cced73ac7 100644 (file)
 
 
 fn test<F>(f: F) -> uint where F: FnOnce(uint) -> uint {
-    return f(22_usize);
+    return f(22);
 }
 
 pub fn main() {
-    let y = test(|x| 4_usize * x);
-    assert_eq!(y, 88_usize);
+    let y = test(|x| 4 * x);
+    assert_eq!(y, 88);
 }
index 2f56e09b2df83ea5f5d4974bb564d02842f7a245..26dc6c5316b160b9b68fa9fc4837086b97d25a9a 100644 (file)
@@ -25,17 +25,17 @@ struct Panolpy {
 }
 
 fn foo(p: &Panolpy) {
-    assert_eq!(22_i32 >> p.i8, 11_i32);
-    assert_eq!(22_i32 >> p.i16, 11_i32);
-    assert_eq!(22_i32 >> p.i32, 11_i32);
-    assert_eq!(22_i32 >> p.i64, 11_i32);
-    assert_eq!(22_i32 >> p.isize, 11_i32);
+    assert_eq!(22 >> p.i8, 11);
+    assert_eq!(22 >> p.i16, 11);
+    assert_eq!(22 >> p.i32, 11);
+    assert_eq!(22 >> p.i64, 11);
+    assert_eq!(22 >> p.isize, 11);
 
-    assert_eq!(22_i32 >> p.u8, 11_i32);
-    assert_eq!(22_i32 >> p.u16, 11_i32);
-    assert_eq!(22_i32 >> p.u32, 11_i32);
-    assert_eq!(22_i32 >> p.u64, 11_i32);
-    assert_eq!(22_i32 >> p.usize, 11_i32);
+    assert_eq!(22 >> p.u8, 11);
+    assert_eq!(22 >> p.u16, 11);
+    assert_eq!(22 >> p.u32, 11);
+    assert_eq!(22 >> p.u64, 11);
+    assert_eq!(22 >> p.usize, 11);
 }
 
 fn main() {
index 475af8f2b8ef05fa70cc1f46c6013705024ac8c6..86eed715f325a925b5e2954351363e21b9e3a71a 100644 (file)
@@ -29,14 +29,14 @@ macro_rules! check {
 pub fn main() {
     check!(Option<u8>, 2,
            None, "None",
-           Some(129u8), "Some(129)");
+           Some(129), "Some(129)");
     check!(Option<i16>, 4,
            None, "None",
-           Some(-20000i16), "Some(-20000)");
+           Some(-20000), "Some(-20000)");
     check!(Either<u8, i8>, 2,
-           Either::Left(132u8), "Left(132)",
-           Either::Right(-32i8), "Right(-32)");
+           Either::Left(132), "Left(132)",
+           Either::Right(-32), "Right(-32)");
     check!(Either<u8, i16>, 4,
-           Either::Left(132u8), "Left(132)",
-           Either::Right(-20000i16), "Right(-20000)");
+           Either::Left(132), "Left(132)",
+           Either::Right(-20000), "Right(-20000)");
 }
index 5f6dc4f2a536285ba445671b3e5576d6214dbc87..47f46041c224a38063b397a96ec3004bc2f84ad8 100644 (file)
@@ -21,7 +21,7 @@ fn foo() -> int {
 
     impl Foo for uint {
         fn foo() -> uint {
-            5_usize
+            5
         }
     }
 }
index 359c14ea7b0c0d45ec129a7dff4c3e913a026998..cef7a93aeeddcf89aae499d2536cb4faa8642bd4 100644 (file)
@@ -12,12 +12,12 @@ pub fn main() {
     // Make sure we properly handle repeated self-appends.
     let mut a: String = "A".to_string();
     let mut i = 20;
-    let mut expected_len = 1_usize;
+    let mut expected_len = 1;
     while i > 0 {
         println!("{}", a.len());
         assert_eq!(a.len(), expected_len);
         a = format!("{}{}", a, a);
         i -= 1;
-        expected_len *= 2_usize;
+        expected_len *= 2;
     }
 }
index c8768731e2bdb5c19022a99f92bd134cb53d0ffe..d67c6322c61cad85d6adde002036c087f00ac495 100644 (file)
@@ -28,19 +28,19 @@ mod rustrt {
 
 fn test1() {
     unsafe {
-        let q = Quad { a: 0xaaaa_aaaa_aaaa_aaaa_u64,
-                 b: 0xbbbb_bbbb_bbbb_bbbb_u64,
-                 c: 0xcccc_cccc_cccc_cccc_u64,
-                 d: 0xdddd_dddd_dddd_dddd_u64 };
+        let q = Quad { a: 0xaaaa_aaaa_aaaa_aaaa,
+                 b: 0xbbbb_bbbb_bbbb_bbbb,
+                 c: 0xcccc_cccc_cccc_cccc,
+                 d: 0xdddd_dddd_dddd_dddd };
         let qq = rustrt::rust_dbg_abi_1(q);
         println!("a: {:x}", qq.a as uint);
         println!("b: {:x}", qq.b as uint);
         println!("c: {:x}", qq.c as uint);
         println!("d: {:x}", qq.d as uint);
-        assert_eq!(qq.a, q.c + 1u64);
-        assert_eq!(qq.b, q.d - 1u64);
-        assert_eq!(qq.c, q.a + 1u64);
-        assert_eq!(qq.d, q.b - 1u64);
+        assert_eq!(qq.a, q.c + 1);
+        assert_eq!(qq.b, q.d - 1);
+        assert_eq!(qq.c, q.a + 1);
+        assert_eq!(qq.d, q.b - 1);
     }
 }
 
@@ -48,14 +48,14 @@ fn test1() {
 fn test2() {
     unsafe {
         let f = Floats { a: 1.234567890e-15_f64,
-                 b: 0b_1010_1010_u8,
+                 b: 0b_1010_1010,
                  c: 1.0987654321e-15_f64 };
         let ff = rustrt::rust_dbg_abi_2(f);
         println!("a: {}", ff.a as f64);
         println!("b: {}", ff.b as uint);
         println!("c: {}", ff.c as f64);
         assert_eq!(ff.a, f.c + 1.0f64);
-        assert_eq!(ff.b, 0xff_u8);
+        assert_eq!(ff.b, 0xff);
         assert_eq!(ff.c, f.a - 1.0f64);
     }
 }
index ddd8cd8be3d5c00f84287e96521660282eeff7be..684ca7fa2b62d30e6daa53613d5b9de78824381d 100644 (file)
@@ -23,7 +23,7 @@ macro_rules! indirect_line { () => ( line!() ) }
 
 pub fn main() {
     assert_eq!(line!(), 25);
-    assert!((column!() == 4u32));
+    assert!((column!() == 4));
     assert_eq!(indirect_line!(), 27);
     assert!((file!().ends_with("syntax-extension-source-utils.rs")));
     assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string());
index b7fe4983b01b4289ac535efae9ada0e8f4499516..8d8d4caad2404ee69f149a52b4ca3afa3e54a098 100644 (file)
@@ -8,9 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-linux #7340 fails on 32-bit Linux
-// ignore-macos #7340 fails on 32-bit macos
-
 use std::mem;
 
 enum Tag<A> {
@@ -23,15 +20,16 @@ struct Rec {
 }
 
 fn mk_rec() -> Rec {
-    return Rec { c8:0u8, t:Tag::Tag2(0u64) };
+    return Rec { c8:0, t:Tag::Tag2(0) };
 }
 
-fn is_8_byte_aligned(u: &Tag<u64>) -> bool {
+fn is_u64_aligned(u: &Tag<u64>) -> bool {
     let p: uint = unsafe { mem::transmute(u) };
-    return (p & 7_usize) == 0_usize;
+    let u64_align = std::mem::min_align_of::<u64>();
+    return (p & (u64_align - 1)) == 0;
 }
 
 pub fn main() {
     let x = mk_rec();
-    assert!(is_8_byte_aligned(&x.t));
+    assert!(is_u64_aligned(&x.t));
 }
index cb298e720ed825211244db994021c6331b6ff72a..917f2c5b37468fe90bf1ddc4e28fafb19a6e632c 100644 (file)
@@ -8,9 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-linux #7340 fails on 32-bit Linux
-// ignore-macos #7340 fails on 32-bit macos
-
 use std::mem;
 
 enum Tag<A,B> {
@@ -26,12 +23,12 @@ struct Rec<A,B> {
 }
 
 fn mk_rec<A,B>(a: A, b: B) -> Rec<A,B> {
-    Rec { chA:0u8, tA:Tag::VarA(a), chB:1u8, tB:Tag::VarB(b) }
+    Rec { chA:0, tA:Tag::VarA(a), chB:1, tB:Tag::VarB(b) }
 }
 
 fn is_aligned<A>(amnt: uint, u: &A) -> bool {
     let p: uint = unsafe { mem::transmute(u) };
-    return (p & (amnt-1_usize)) == 0_usize;
+    return (p & (amnt-1)) == 0;
 }
 
 fn variant_data_is_aligned<A,B>(amnt: uint, u: &Tag<A,B>) -> bool {
@@ -42,33 +39,34 @@ fn variant_data_is_aligned<A,B>(amnt: uint, u: &Tag<A,B>) -> bool {
 }
 
 pub fn main() {
+    let u64_align = std::mem::min_align_of::<u64>();
     let x = mk_rec(22u64, 23u64);
-    assert!(is_aligned(8_usize, &x.tA));
-    assert!(variant_data_is_aligned(8_usize, &x.tA));
-    assert!(is_aligned(8_usize, &x.tB));
-    assert!(variant_data_is_aligned(8_usize, &x.tB));
+    assert!(is_aligned(u64_align, &x.tA));
+    assert!(variant_data_is_aligned(u64_align, &x.tA));
+    assert!(is_aligned(u64_align, &x.tB));
+    assert!(variant_data_is_aligned(u64_align, &x.tB));
 
     let x = mk_rec(22u64, 23u32);
-    assert!(is_aligned(8_usize, &x.tA));
-    assert!(variant_data_is_aligned(8_usize, &x.tA));
-    assert!(is_aligned(8_usize, &x.tB));
-    assert!(variant_data_is_aligned(4_usize, &x.tB));
+    assert!(is_aligned(u64_align, &x.tA));
+    assert!(variant_data_is_aligned(u64_align, &x.tA));
+    assert!(is_aligned(u64_align, &x.tB));
+    assert!(variant_data_is_aligned(4, &x.tB));
 
     let x = mk_rec(22u32, 23u64);
-    assert!(is_aligned(8_usize, &x.tA));
-    assert!(variant_data_is_aligned(4_usize, &x.tA));
-    assert!(is_aligned(8_usize, &x.tB));
-    assert!(variant_data_is_aligned(8_usize, &x.tB));
+    assert!(is_aligned(u64_align, &x.tA));
+    assert!(variant_data_is_aligned(4, &x.tA));
+    assert!(is_aligned(u64_align, &x.tB));
+    assert!(variant_data_is_aligned(u64_align, &x.tB));
 
     let x = mk_rec(22u32, 23u32);
-    assert!(is_aligned(4_usize, &x.tA));
-    assert!(variant_data_is_aligned(4_usize, &x.tA));
-    assert!(is_aligned(4_usize, &x.tB));
-    assert!(variant_data_is_aligned(4_usize, &x.tB));
+    assert!(is_aligned(4, &x.tA));
+    assert!(variant_data_is_aligned(4, &x.tA));
+    assert!(is_aligned(4, &x.tB));
+    assert!(variant_data_is_aligned(4, &x.tB));
 
     let x = mk_rec(22f64, 23f64);
-    assert!(is_aligned(8_usize, &x.tA));
-    assert!(variant_data_is_aligned(8_usize, &x.tA));
-    assert!(is_aligned(8_usize, &x.tB));
-    assert!(variant_data_is_aligned(8_usize, &x.tB));
+    assert!(is_aligned(u64_align, &x.tA));
+    assert!(variant_data_is_aligned(u64_align, &x.tA));
+    assert!(is_aligned(u64_align, &x.tB));
+    assert!(variant_data_is_aligned(u64_align, &x.tB));
 }
index cc0a75181db96aee22a6432e9ec4b0d632e2836b..5db886c815b2a875039142007894407caf97c881 100644 (file)
@@ -20,7 +20,7 @@ struct t_rec {
 }
 
 pub fn main() {
-    let x = t_rec {c8: 22u8, t: a_tag::a_tag_var(44u64)};
+    let x = t_rec {c8: 22, t: a_tag::a_tag_var(44)};
     let y = format!("{:?}", x);
     println!("y = {:?}", y);
     assert_eq!(y, "t_rec { c8: 22, t: a_tag_var(44) }".to_string());
index 713f55cc10c0ad08497120bab0341ee26503cf54..df99d77142c1b2880cac249744b04ff85f0e0f80 100644 (file)
@@ -8,9 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-linux #7340 fails on 32-bit Linux
-// ignore-macos #7340 fails on 32-bit macos
-
 use std::mem;
 
 enum Tag {
@@ -23,15 +20,16 @@ struct Rec {
 }
 
 fn mk_rec() -> Rec {
-    return Rec { c8:0u8, t:Tag::TagInner(0u64) };
+    return Rec { c8:0, t:Tag::TagInner(0) };
 }
 
-fn is_8_byte_aligned(u: &Tag) -> bool {
+fn is_u64_aligned(u: &Tag) -> bool {
     let p: uint = unsafe { mem::transmute(u) };
-    return (p & 7_usize) == 0_usize;
+    let u64_align = std::mem::min_align_of::<u64>();
+    return (p & (u64_align - 1)) == 0;
 }
 
 pub fn main() {
     let x = mk_rec();
-    assert!(is_8_byte_aligned(&x.t));
+    assert!(is_u64_aligned(&x.t));
 }
index 1d297c04c825764f6925acfc7574f1093cfc0784..ca009677ee9746a00155e16a2d41a2092971e354 100644 (file)
@@ -16,12 +16,12 @@ fn test_rec() {
     struct R {val0: int, val1: u8, val2: char}
 
     let (tx, rx) = channel();
-    let r0: R = R {val0: 0, val1: 1u8, val2: '2'};
+    let r0: R = R {val0: 0, val1: 1, val2: '2'};
     tx.send(r0).unwrap();
     let mut r1: R;
     r1 = rx.recv().unwrap();
     assert_eq!(r1.val0, 0);
-    assert_eq!(r1.val1, 1u8);
+    assert_eq!(r1.val1, 1);
     assert_eq!(r1.val2, '2');
 }
 
@@ -84,14 +84,14 @@ fn test_tag() {
     let (tx, rx) = channel();
     tx.send(t::tag1).unwrap();
     tx.send(t::tag2(10)).unwrap();
-    tx.send(t::tag3(10, 11u8, 'A')).unwrap();
+    tx.send(t::tag3(10, 11, 'A')).unwrap();
     let mut t1: t;
     t1 = rx.recv().unwrap();
     assert_eq!(t1, t::tag1);
     t1 = rx.recv().unwrap();
     assert_eq!(t1, t::tag2(10));
     t1 = rx.recv().unwrap();
-    assert_eq!(t1, t::tag3(10, 11u8, 'A'));
+    assert_eq!(t1, t::tag3(10, 11, 'A'));
 }
 
 fn test_chan() {
index 82584c83de059da98438d880ca4f08924b182502..23ea998c026085331ab204c30a17cd5799937c08 100644 (file)
@@ -52,7 +52,7 @@ fn main() {
     let addr = rx.recv().unwrap();
 
     let (tx, rx) = channel();
-    for _ in 0_usize..1000 {
+    for _ in 0..1000 {
         let tx = tx.clone();
         Builder::new().stack_size(64 * 1024).spawn(move|| {
             match TcpStream::connect(addr) {
@@ -71,7 +71,7 @@ fn main() {
     // Wait for all clients to exit, but don't wait for the server to exit. The
     // server just runs infinitely.
     drop(tx);
-    for _ in 0_usize..1000 {
+    for _ in 0..1000 {
         rx.recv().unwrap();
     }
     unsafe { libc::exit(0) }
index 383849ca51267532abe21f9b51b960caa721ff84..acaa74373f01f20f39c78a1f73791f11cc52a5fb 100644 (file)
@@ -21,6 +21,6 @@ fn f<T, V: A<T>>(i: V, j: uint) -> uint {
 }
 
 pub fn main () {
-    assert_eq!(f::<f64, int>(0, 2_usize), 2_usize);
-    assert_eq!(f::<uint, int>(0, 2_usize), 2_usize);
+    assert_eq!(f::<f64, int>(0, 2), 2);
+    assert_eq!(f::<uint, int>(0, 2), 2);
 }
index 6f89490716f081d123628285840d0404d4c17222..18097b59b08e26e8c5b7abe2d1855d3abaaaee50 100644 (file)
@@ -49,5 +49,5 @@ fn method(&self, _x: Type<(u8,V)>) -> int { 0 }
 
 pub fn main() {
     let a = box() () as Box<Trait<u8, u8>>;
-    assert_eq!(a.method(Type::Constant((1u8, 2u8))), 0);
+    assert_eq!(a.method(Type::Constant((1, 2))), 0);
 }
index 4e481910aa98fd215d9657ce77fb28cf6fa0832b..99910f1573887fef3f9c6031bfd424ba39554470 100644 (file)
@@ -36,7 +36,7 @@ fn extension<'e>(x: &'e E<'e>) -> Box<M+'e> {
 }
 
 fn main() {
-    let w = E { f: &10u8 };
+    let w = E { f: &10 };
     let o = extension(&w);
-    assert_eq!(o.n(), 10u8);
+    assert_eq!(o.n(), 10);
 }
diff --git a/src/test/run-pass/traits-issue-23003.rs b/src/test/run-pass/traits-issue-23003.rs
new file mode 100644 (file)
index 0000000..37b13d3
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright 2015 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.
+
+// Test stack overflow triggered by evaluating the implications. To be
+// WF, the type `Receipt<Complete>` would require that `<Complete as
+// Async>::Cancel` be WF. This normalizes to `Receipt<Complete>`
+// again, leading to an infinite cycle. Issue #23003.
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
+
+use std::marker::PhantomData;
+
+trait Async {
+    type Cancel;
+}
+
+struct Receipt<A:Async> {
+    marker: PhantomData<A>,
+}
+
+struct Complete {
+    core: Option<()>,
+}
+
+impl Async for Complete {
+    type Cancel = Receipt<Complete>;
+}
+
+fn foo(r: Receipt<Complete>) { }
+
+fn main() { }
index cf8a09998daa01b6148fc0aafade82e0b17dab95..5d80cec2a05fda51ce76b1d5fa18f4b8eaca1a23 100644 (file)
@@ -16,11 +16,11 @@ struct S<T> {
 
 fn range_<F>(lo: uint, hi: uint, mut it: F) where F: FnMut(uint) {
     let mut lo_ = lo;
-    while lo_ < hi { it(lo_); lo_ += 1_usize; }
+    while lo_ < hi { it(lo_); lo_ += 1; }
 }
 
 fn create_index<T>(_index: Vec<S<T>> , _hash_fn: extern fn(T) -> uint) {
-    range_(0_usize, 256_usize, |_i| {
+    range_(0, 256, |_i| {
         let _bucket: Vec<T> = Vec::new();
     })
 }
index 48dc944382171395ff9ccfcb36b37eec4a564b31..c850c01753bd880cb8033e2eedfc91599b9c1cb9 100644 (file)
@@ -21,17 +21,17 @@ unsafe impl Sync for TestStruct {}
 
 
 pub fn main() {
-    let x: Vec<_> = (0_usize..5).collect();
+    let x: Vec<_> = (0..5).collect();
     let expected: &[uint] = &[0,1,2,3,4];
     assert_eq!(x, expected);
 
-    let x = (0_usize..5).collect::<Vec<_>>();
+    let x = (0..5).collect::<Vec<_>>();
     assert_eq!(x, expected);
 
     let y: _ = "hello";
     assert_eq!(y.len(), 5);
 
-    let ptr = &5_usize;
+    let ptr = &5;
     let ptr2 = ptr as *const _;
 
     assert_eq!(ptr as *const uint as uint, ptr2 as uint);
index 6ad320580dfec289d227aeb9d595111997b8da80..027bd7ca6806fccf19392ff09deae365a38c3ec9 100644 (file)
@@ -12,7 +12,7 @@
 
 
 pub fn main() {
-    let mut word: u32 = 200000u32;
-    word = word - 1u32;
-    assert_eq!(word, 199999u32);
+    let mut word: u32 = 200000;
+    word = word - 1;
+    assert_eq!(word, 199999);
 }
index 0a178b250af4f6d635bec9ebe05a26110be8be57..ff25d95d1fd211d0da4246e733377ef5e0650670 100644 (file)
 // These constants were chosen because they aren't used anywhere
 // in the rest of the generated code so they're easily grep-able.
 pub fn main() {
-    let mut x: u8 = 19u8; // 0x13
+    let mut x: u8 = 19; // 0x13
 
-    let mut y: u8 = 35u8; // 0x23
+    let mut y: u8 = 35; // 0x23
 
-    x = x + 7u8; // 0x7
+    x = x + 7; // 0x7
 
-    y = y - 9u8; // 0x9
+    y = y - 9; // 0x9
 
     assert_eq!(x, y);
 }
index 90ed3a5eec3a2fa928589d3f5aef48db8a6f3ddc..7f69d0781345f17500c8f7e96fa5e8ee9da1bf7c 100644 (file)
 
 
 pub fn main() {
-    let mut x: u8 = 12u8;
-    let y: u8 = 12u8;
-    x = x + 1u8;
-    x = x - 1u8;
+    let mut x: u8 = 12;
+    let y: u8 = 12;
+    x = x + 1;
+    x = x - 1;
     assert_eq!(x, y);
-    // x = 14u8;
-    // x = x + 1u8;
+    // x = 14;
+    // x = x + 1;
 
 }
index 2ae63040d17850c373b507aeeea377fa03332a41..34cf44bba2efbf55508ea919425817d966f92fa8 100644 (file)
@@ -20,6 +20,6 @@ fn test(&self) -> i32 { *self }
 }
 
 fn main() {
-    let a: &Foo = &22_i32;
+    let a: &Foo = &22;
     assert_eq!(Foo::test(a), 22);
 }
index 5c36832d9f67f50557abd1d0034578bd224e9d8f..ce05f077357f87c78ca53f593a7c262db297f012 100644 (file)
@@ -12,8 +12,8 @@
 //
 //    error: internal compiler error: get_unique_type_id_of_type() -
 //    unexpected type: closure,
-//    ty_closure(syntax::ast::DefId{krate: 0u32, node: 66u32},
-//    ReScope(63u32))
+//    ty_closure(syntax::ast::DefId{krate: 0, node: 66},
+//    ReScope(63))
 //
 // This is a regression test for issue #17021.
 //
@@ -28,8 +28,8 @@ pub fn replace_map<'a, T, F>(src: &mut T, prod: F) where F: FnOnce(T) -> T {
 }
 
 pub fn main() {
-    let mut a = 7_usize;
+    let mut a = 7;
     let b = &mut a;
     replace_map(b, |x: uint| x * 2);
-    assert_eq!(*b, 14_usize);
+    assert_eq!(*b, 14);
 }
index 5db96bc3564f56d39f6bdfcb4c90cb7573640e74..8141e3bce3c2482003c6fd71536ca4c0ddb2acae 100644 (file)
@@ -17,7 +17,7 @@ struct Foo {a: int, b: uint}
 enum bar { u(Box<Foo>), w(int), }
 
 pub fn main() {
-    assert!(match bar::u(box Foo{a: 10, b: 40_usize}) {
+    assert!(match bar::u(box Foo{a: 10, b: 40}) {
               bar::u(box Foo{a: a, b: b}) => { a + (b as int) }
               _ => { 66 }
             } == 50);
index 43824812ec546c44a6f90c6adf8f8f5d19d475f0..654ac9a095cb10d12ee181dde40c8243b72fcbd4 100644 (file)
@@ -20,9 +20,9 @@ fn child(tx: &Sender<Box<uint>>, i: uint) {
 
 pub fn main() {
     let (tx, rx) = channel();
-    let n = 100_usize;
-    let mut expected = 0_usize;
-    let _t = (0_usize..n).map(|i| {
+    let n = 100;
+    let mut expected = 0;
+    let _t = (0..n).map(|i| {
         expected += i;
         let tx = tx.clone();
         thread::spawn(move|| {
@@ -30,8 +30,8 @@ pub fn main() {
         })
     }).collect::<Vec<_>>();
 
-    let mut actual = 0_usize;
-    for _ in 0_usize..n {
+    let mut actual = 0;
+    for _ in 0..n {
         let j = rx.recv().unwrap();
         actual += *j;
     }
index c9a9d6ad1474ee6e86e8863685296aad740cdf53..5bd76d093d483f0da929237298ee55e373de605c 100644 (file)
@@ -66,12 +66,10 @@ struct Foo_<T> {
             f: [T; 3]
         }
 
-        let data: Box<_> = box Foo_{f: [1i32, 2, 3] };
+        let data: Box<Foo_<i32>> = box Foo_{f: [1, 2, 3] };
         let x: &Foo<i32> = mem::transmute(raw::Slice { len: 3, data: &*data });
         assert!(x.f.len() == 3);
         assert!(x.f[0] == 1);
-        assert!(x.f[1] == 2);
-        assert!(x.f[2] == 3);
 
         struct Baz_ {
             f1: uint,
index 84f605eef57001f1a1a60b268e5f2781a5e420f9..88369f2e500b19dd0b1fe321d864d6082a4bb3e3 100644 (file)
@@ -18,26 +18,26 @@ pub fn main() {
     let s: String = chs.iter().cloned().collect();
     let schs: Vec<char> = s.chars().collect();
 
-    assert!(s.len() == 10_usize);
-    assert!(s.chars().count() == 4_usize);
-    assert!(schs.len() == 4_usize);
+    assert!(s.len() == 10);
+    assert!(s.chars().count() == 4);
+    assert!(schs.len() == 4);
     assert!(schs.iter().cloned().collect::<String>() == s);
-    assert!(s.char_at(0_usize) == 'e');
-    assert!(s.char_at(1_usize) == 'é');
+    assert!(s.char_at(0) == 'e');
+    assert!(s.char_at(1) == 'é');
 
     assert!((str::from_utf8(s.as_bytes()).is_ok()));
     // invalid prefix
-    assert!((!str::from_utf8(&[0x80_u8]).is_ok()));
+    assert!((!str::from_utf8(&[0x80]).is_ok()));
     // invalid 2 byte prefix
-    assert!((!str::from_utf8(&[0xc0_u8]).is_ok()));
-    assert!((!str::from_utf8(&[0xc0_u8, 0x10_u8]).is_ok()));
+    assert!((!str::from_utf8(&[0xc0]).is_ok()));
+    assert!((!str::from_utf8(&[0xc0, 0x10]).is_ok()));
     // invalid 3 byte prefix
-    assert!((!str::from_utf8(&[0xe0_u8]).is_ok()));
-    assert!((!str::from_utf8(&[0xe0_u8, 0x10_u8]).is_ok()));
-    assert!((!str::from_utf8(&[0xe0_u8, 0xff_u8, 0x10_u8]).is_ok()));
+    assert!((!str::from_utf8(&[0xe0]).is_ok()));
+    assert!((!str::from_utf8(&[0xe0, 0x10]).is_ok()));
+    assert!((!str::from_utf8(&[0xe0, 0xff, 0x10]).is_ok()));
     // invalid 4 byte prefix
-    assert!((!str::from_utf8(&[0xf0_u8]).is_ok()));
-    assert!((!str::from_utf8(&[0xf0_u8, 0x10_u8]).is_ok()));
-    assert!((!str::from_utf8(&[0xf0_u8, 0xff_u8, 0x10_u8]).is_ok()));
-    assert!((!str::from_utf8(&[0xf0_u8, 0xff_u8, 0xff_u8, 0x10_u8]).is_ok()));
+    assert!((!str::from_utf8(&[0xf0]).is_ok()));
+    assert!((!str::from_utf8(&[0xf0, 0x10]).is_ok()));
+    assert!((!str::from_utf8(&[0xf0, 0xff, 0x10]).is_ok()));
+    assert!((!str::from_utf8(&[0xf0, 0xff, 0xff, 0x10]).is_ok()));
 }
index 015baea5fb5fe5f71a19a45a4e7b1907c844f889..a0b3564d84e17f3d58373be729f334fd503939b6 100644 (file)
@@ -17,11 +17,11 @@ pub fn main() {
     assert_eq!(x[2], 3);
     assert_eq!(x[3], 4);
 
-    assert_eq!(size_of::<[u8; 4]>(), 4_usize);
+    assert_eq!(size_of::<[u8; 4]>(), 4);
 
     // FIXME #10183
     // FIXME #18069
     //if cfg!(target_pointer_width = "64") {
-    //    assert_eq!(size_of::<[u8; (1 << 32)]>(), (1_usize << 32));
+    //    assert_eq!(size_of::<[u8; (1 << 32)]>(), (1 << 32));
     //}
 }
index baea1b8826a470214fcae45cadfac80ae7e217b3..20e42575b277f9e03cec4c6f916fc5d16e95da5b 100644 (file)
@@ -65,7 +65,7 @@ fn canttouchthis() -> uint {
     fn p() -> bool { true }
     let _a = (assert!((true)) == (assert!(p())));
     let _c = (assert!((p())) == ());
-    let _b: bool = (println!("{}", 0) == (return 0_usize));
+    let _b: bool = (println!("{}", 0) == (return 0));
 }
 
 fn angrydome() {
index 1fd223b0dd3f6bd8c8d8ffaa83bd6a59ee8d3370..67757d7efa837cdf35b9cfb57428e199d67c09ee 100644 (file)
@@ -55,7 +55,7 @@ fn foo2<T>(x: &T)
 }
 
 fn main() {
-    let x = 42u32;
+    let x = 42;
     foo1(&x);
     foo2(&x);
     unsafe {
index dea58c8e86fbb8cbc1e2f6708c48d2fb6c770f1b..b884adb7a6ec3e92d1ed1e10cbdfee7097672fab 100644 (file)
@@ -22,7 +22,7 @@ mod kernel32 {
 #[cfg(windows)]
 pub fn main() {
     unsafe {
-        let expected = 1234_usize;
+        let expected = 1234;
         kernel32::SetLastError(expected);
         let actual = kernel32::GetLastError();
         println!("actual = {}", actual);
index 86c1ae0f51fd9c51ee0350d24cf010024b03b214..b5b9d95d87f8c9701c3ad8ae77299d97b2abba74 100644 (file)
@@ -30,10 +30,10 @@ pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T)
 #[cfg(windows)]
 pub fn main() {
     let heap = unsafe { kernel32::GetProcessHeap() };
-    let mem = unsafe { kernel32::HeapAlloc(heap, 0u32, 100u32) };
-    assert!(mem != 0_usize);
-    let res = unsafe { kernel32::HeapFree(heap, 0u32, mem) };
-    assert!(res != 0u8);
+    let mem = unsafe { kernel32::HeapAlloc(heap, 0, 100) };
+    assert!(mem != 0);
+    let res = unsafe { kernel32::HeapFree(heap, 0, mem) };
+    assert!(res != 0);
 }
 
 #[cfg(not(windows))]