]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #23678 - richo:check-flightcheck, r=alexcrichton
authorbors <bors@rust-lang.org>
Tue, 31 Mar 2015 18:26:20 +0000 (18:26 +0000)
committerbors <bors@rust-lang.org>
Tue, 31 Mar 2015 18:26:20 +0000 (18:26 +0000)
Rationale for this, is that I lurked `ulimit -c unlimited` into my .profile to debug an unrelated crash, that I kept forgetting to set before hand. I then ran the test suite and discovered that I had 150 gigs of core dumps in `/cores`.

Very open to another approach, or to setting the limit to something higher than 0, but I think it would be nice if the build system tried to save you from yourself here.

1750 files changed:
AUTHORS.txt
configure
mk/crates.mk
mk/docs.mk
mk/platform.mk
mk/target.mk
src/compiletest/compiletest.rs
src/compiletest/errors.rs
src/compiletest/header.rs
src/compiletest/procsrv.rs
src/compiletest/runtest.rs
src/compiletest/util.rs
src/doc/reference.md
src/doc/trpl/README.md
src/doc/trpl/SUMMARY.md
src/doc/trpl/advanced-macros.md
src/doc/trpl/arrays-vectors-and-slices.md
src/doc/trpl/associated-types.md
src/doc/trpl/basic.md
src/doc/trpl/compound-data-types.md
src/doc/trpl/documentation.md
src/doc/trpl/ffi.md
src/doc/trpl/inline-assembly.md [new file with mode: 0644]
src/doc/trpl/installing-rust.md
src/doc/trpl/intrinsics.md [new file with mode: 0644]
src/doc/trpl/lang-items.md [new file with mode: 0644]
src/doc/trpl/link-args.md [new file with mode: 0644]
src/doc/trpl/looping.md
src/doc/trpl/method-syntax.md
src/doc/trpl/more-strings.md
src/doc/trpl/no-stdlib.md [new file with mode: 0644]
src/doc/trpl/ownership.md
src/doc/trpl/patterns.md
src/doc/trpl/plugins.md
src/doc/trpl/pointers.md
src/doc/trpl/standard-input.md [deleted file]
src/doc/trpl/testing.md
src/doc/trpl/tracing-macros.md [new file with mode: 0644]
src/doc/trpl/traits.md
src/doc/trpl/unsafe.md
src/doc/trpl/unstable.md [new file with mode: 0644]
src/driver/driver.rs
src/etc/rustup.sh
src/liballoc/arc.rs
src/liballoc/boxed.rs
src/liballoc/heap.rs
src/liballoc/lib.rs
src/liballoc/rc.rs
src/libcollections/bit.rs
src/libcollections/btree/map.rs
src/libcollections/btree/node.rs
src/libcollections/btree/set.rs
src/libcollections/enum_set.rs
src/libcollections/lib.rs
src/libcollections/linked_list.rs
src/libcollections/slice.rs
src/libcollections/str.rs
src/libcollections/string.rs
src/libcollections/vec.rs
src/libcollections/vec_deque.rs
src/libcollections/vec_map.rs
src/libcollectionstest/bench.rs
src/libcore/any.rs
src/libcore/array.rs
src/libcore/atomic.rs
src/libcore/cmp.rs
src/libcore/convert.rs
src/libcore/error.rs
src/libcore/fmt/builders.rs
src/libcore/fmt/float.rs
src/libcore/fmt/mod.rs
src/libcore/fmt/num.rs
src/libcore/hash/mod.rs
src/libcore/hash/sip.rs
src/libcore/intrinsics.rs
src/libcore/iter.rs
src/libcore/lib.rs
src/libcore/macros.rs
src/libcore/marker.rs
src/libcore/mem.rs
src/libcore/num/f32.rs
src/libcore/num/f64.rs
src/libcore/num/i16.rs
src/libcore/num/i32.rs
src/libcore/num/i64.rs
src/libcore/num/i8.rs
src/libcore/num/int_macros.rs
src/libcore/num/isize.rs
src/libcore/num/mod.rs
src/libcore/num/u16.rs
src/libcore/num/u32.rs
src/libcore/num/u64.rs
src/libcore/num/u8.rs
src/libcore/num/uint_macros.rs
src/libcore/num/usize.rs
src/libcore/num/wrapping.rs
src/libcore/ops.rs
src/libcore/option.rs
src/libcore/panicking.rs
src/libcore/prelude.rs
src/libcore/ptr.rs
src/libcore/result.rs
src/libcore/slice.rs
src/libcore/str/mod.rs
src/libcoretest/any.rs
src/libcoretest/cell.rs
src/libcoretest/cmp.rs
src/libcoretest/fmt/builders.rs
src/libcoretest/iter.rs
src/libcoretest/lib.rs
src/libcoretest/mem.rs
src/libcoretest/nonzero.rs
src/libcoretest/ops.rs
src/libcoretest/option.rs
src/libcoretest/ptr.rs
src/libcoretest/result.rs
src/libgetopts/lib.rs
src/libgraphviz/lib.rs
src/liblibc/lib.rs
src/liblog/lib.rs
src/librand/chacha.rs
src/librand/distributions/mod.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/lint/builtin.rs
src/librustc/metadata/common.rs
src/librustc/metadata/creader.rs
src/librustc/metadata/csearch.rs
src/librustc/metadata/cstore.rs
src/librustc/metadata/decoder.rs
src/librustc/metadata/encoder.rs
src/librustc/metadata/loader.rs
src/librustc/metadata/macro_import.rs
src/librustc/metadata/tydecode.rs
src/librustc/metadata/tyencode.rs
src/librustc/middle/astconv_util.rs
src/librustc/middle/astencode.rs
src/librustc/middle/check_match.rs
src/librustc/middle/const_eval.rs
src/librustc/middle/dataflow.rs
src/librustc/middle/dead.rs
src/librustc/middle/dependency_format.rs
src/librustc/middle/expr_use_visitor.rs
src/librustc/middle/fast_reject.rs
src/librustc/middle/graph.rs
src/librustc/middle/infer/bivariate.rs
src/librustc/middle/infer/combine.rs
src/librustc/middle/infer/equate.rs
src/librustc/middle/infer/error_reporting.rs
src/librustc/middle/infer/glb.rs
src/librustc/middle/infer/lattice.rs
src/librustc/middle/infer/lub.rs
src/librustc/middle/infer/mod.rs
src/librustc/middle/infer/region_inference/graphviz.rs
src/librustc/middle/infer/region_inference/mod.rs
src/librustc/middle/infer/sub.rs
src/librustc/middle/infer/type_variable.rs
src/librustc/middle/infer/unify.rs
src/librustc/middle/intrinsicck.rs
src/librustc/middle/lang_items.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/pat_util.rs
src/librustc/middle/region.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/middle/subst.rs
src/librustc/middle/traits/coherence.rs
src/librustc/middle/traits/fulfill.rs
src/librustc/middle/traits/mod.rs
src/librustc/middle/traits/object_safety.rs
src/librustc/middle/traits/project.rs
src/librustc/middle/traits/select.rs
src/librustc/middle/traits/util.rs
src/librustc/middle/ty.rs
src/librustc/middle/ty_walk.rs
src/librustc/plugin/load.rs
src/librustc/plugin/mod.rs
src/librustc/plugin/registry.rs
src/librustc/session/config.rs
src/librustc/session/mod.rs
src/librustc/util/common.rs
src/librustc/util/lev_distance.rs
src/librustc/util/nodemap.rs
src/librustc/util/ppaux.rs
src/librustc/util/snapshot_vec.rs
src/librustc_back/abi.rs
src/librustc_back/archive.rs
src/librustc_back/lib.rs
src/librustc_back/sha2.rs
src/librustc_back/svh.rs
src/librustc_back/target/mod.rs
src/librustc_back/tempdir.rs
src/librustc_borrowck/borrowck/check_loans.rs
src/librustc_borrowck/borrowck/fragments.rs
src/librustc_borrowck/borrowck/gather_loans/mod.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_borrowck/borrowck/move_data.rs
src/librustc_borrowck/graphviz.rs
src/librustc_borrowck/lib.rs
src/librustc_driver/driver.rs
src/librustc_driver/lib.rs
src/librustc_driver/test.rs
src/librustc_lint/builtin.rs
src/librustc_lint/lib.rs
src/librustc_llvm/archive_ro.rs
src/librustc_llvm/lib.rs
src/librustc_privacy/lib.rs
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/lib.rs
src/librustc_resolve/resolve_imports.rs
src/librustc_trans/back/link.rs
src/librustc_trans/back/lto.rs
src/librustc_trans/back/write.rs
src/librustc_trans/lib.rs
src/librustc_trans/save/mod.rs
src/librustc_trans/save/span_utils.rs
src/librustc_trans/trans/_match.rs
src/librustc_trans/trans/adt.rs
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/basic_block.rs
src/librustc_trans/trans/build.rs
src/librustc_trans/trans/builder.rs
src/librustc_trans/trans/cabi_aarch64.rs
src/librustc_trans/trans/cabi_arm.rs
src/librustc_trans/trans/cabi_mips.rs
src/librustc_trans/trans/cabi_powerpc.rs
src/librustc_trans/trans/cabi_x86_64.rs
src/librustc_trans/trans/callee.rs
src/librustc_trans/trans/cleanup.rs
src/librustc_trans/trans/closure.rs
src/librustc_trans/trans/common.rs
src/librustc_trans/trans/consts.rs
src/librustc_trans/trans/context.rs
src/librustc_trans/trans/controlflow.rs
src/librustc_trans/trans/datum.rs
src/librustc_trans/trans/debuginfo.rs
src/librustc_trans/trans/expr.rs
src/librustc_trans/trans/foreign.rs
src/librustc_trans/trans/glue.rs
src/librustc_trans/trans/intrinsic.rs
src/librustc_trans/trans/machine.rs
src/librustc_trans/trans/meth.rs
src/librustc_trans/trans/tvec.rs
src/librustc_trans/trans/type_.rs
src/librustc_trans/trans/type_of.rs
src/librustc_trans/trans/value.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/callee.rs
src/librustc_typeck/check/compare_method.rs
src/librustc_typeck/check/dropck.rs
src/librustc_typeck/check/implicator.rs
src/librustc_typeck/check/method/mod.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/op.rs [new file with mode: 0644]
src/librustc_typeck/check/regionck.rs
src/librustc_typeck/check/vtable.rs
src/librustc_typeck/check/wf.rs
src/librustc_typeck/check/writeback.rs
src/librustc_typeck/coherence/mod.rs
src/librustc_typeck/coherence/orphan.rs
src/librustc_typeck/coherence/overlap.rs
src/librustc_typeck/collect.rs
src/librustc_typeck/diagnostics.rs
src/librustc_typeck/lib.rs
src/librustc_typeck/rscope.rs
src/librustc_typeck/variance.rs
src/librustdoc/clean/mod.rs
src/librustdoc/html/markdown.rs
src/librustdoc/html/render.rs
src/librustdoc/html/static/main.css
src/librustdoc/html/toc.rs
src/librustdoc/lib.rs
src/librustdoc/markdown.rs
src/librustdoc/plugins.rs
src/librustdoc/stability_summary.rs
src/librustdoc/test.rs
src/libserialize/hex.rs
src/libserialize/json.rs
src/libserialize/lib.rs
src/libserialize/serialize.rs
src/libstd/ascii.rs
src/libstd/collections/hash/bench.rs
src/libstd/collections/hash/map.rs
src/libstd/collections/hash/set.rs
src/libstd/collections/hash/table.rs
src/libstd/dynamic_lib.rs
src/libstd/ffi/c_str.rs
src/libstd/ffi/os_str.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/stdio.rs
src/libstd/lib.rs
src/libstd/macros.rs
src/libstd/net/mod.rs
src/libstd/net/parser.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/mem.rs
src/libstd/old_io/mod.rs
src/libstd/old_io/net/addrinfo.rs
src/libstd/old_io/net/ip.rs
src/libstd/old_io/net/pipe.rs
src/libstd/old_io/net/tcp.rs
src/libstd/old_io/net/udp.rs
src/libstd/old_io/pipe.rs
src/libstd/old_io/process.rs
src/libstd/old_io/result.rs
src/libstd/old_io/stdio.rs
src/libstd/old_io/tempfile.rs
src/libstd/old_io/util.rs
src/libstd/old_path/mod.rs
src/libstd/old_path/posix.rs
src/libstd/old_path/windows.rs
src/libstd/os.rs
src/libstd/path.rs
src/libstd/prelude/v1.rs
src/libstd/process.rs
src/libstd/rand/mod.rs
src/libstd/rand/reader.rs
src/libstd/rt/args.rs
src/libstd/rt/libunwind.rs
src/libstd/rt/mod.rs
src/libstd/rt/unwind.rs
src/libstd/rt/util.rs
src/libstd/sync/future.rs
src/libstd/sync/mpsc/mod.rs
src/libstd/sync/mpsc/shared.rs
src/libstd/sync/rwlock.rs
src/libstd/sync/semaphore.rs
src/libstd/sys/common/backtrace.rs
src/libstd/sys/common/helper_thread.rs
src/libstd/sys/common/mod.rs
src/libstd/sys/common/net.rs
src/libstd/sys/common/stack.rs
src/libstd/sys/common/thread_info.rs
src/libstd/sys/common/thread_local.rs
src/libstd/sys/common/wtf8.rs
src/libstd/sys/unix/backtrace.rs
src/libstd/sys/unix/c.rs
src/libstd/sys/unix/fs.rs
src/libstd/sys/unix/mod.rs
src/libstd/sys/unix/os.rs
src/libstd/sys/unix/os_str.rs
src/libstd/sys/unix/pipe.rs
src/libstd/sys/unix/process.rs
src/libstd/sys/unix/stack_overflow.rs
src/libstd/sys/unix/sync.rs
src/libstd/sys/unix/tcp.rs
src/libstd/sys/unix/timer.rs
src/libstd/sys/unix/tty.rs
src/libstd/sys/windows/backtrace.rs
src/libstd/sys/windows/fs.rs
src/libstd/sys/windows/mod.rs
src/libstd/sys/windows/net.rs
src/libstd/sys/windows/os_str.rs
src/libstd/sys/windows/pipe.rs
src/libstd/sys/windows/process.rs
src/libstd/sys/windows/process2.rs
src/libstd/sys/windows/stack_overflow.rs
src/libstd/sys/windows/tcp.rs
src/libstd/sys/windows/thread.rs
src/libstd/sys/windows/thread_local.rs
src/libstd/sys/windows/timer.rs
src/libstd/sys/windows/tty.rs
src/libstd/thread/mod.rs
src/libstd/time/duration.rs
src/libsyntax/ast.rs
src/libsyntax/ast_map/blocks.rs
src/libsyntax/ast_util.rs
src/libsyntax/attr.rs
src/libsyntax/ext/build.rs
src/libsyntax/ext/concat_idents.rs
src/libsyntax/ext/deriving/generic/mod.rs
src/libsyntax/ext/deriving/rand.rs
src/libsyntax/ext/quote.rs
src/libsyntax/feature_gate.rs
src/libsyntax/fold.rs
src/libsyntax/lib.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/obsolete.rs
src/libsyntax/parse/parser.rs
src/libsyntax/ptr.rs
src/libsyntax/std_inject.rs
src/libsyntax/test.rs
src/libsyntax/util/parser_testing.rs
src/libterm/lib.rs
src/libterm/terminfo/mod.rs
src/libterm/terminfo/parm.rs
src/libterm/terminfo/parser/compiled.rs
src/libterm/terminfo/searcher.rs
src/libtest/lib.rs
src/libtest/stats.rs
src/libunicode/char.rs
src/libunicode/u_str.rs
src/rust-installer
src/snapshots.txt
src/test/auxiliary/ambig_impl_2_lib.rs
src/test/auxiliary/anon_trait_static_method_lib.rs
src/test/auxiliary/associated-types-cc-lib.rs
src/test/auxiliary/cci_borrow_lib.rs
src/test/auxiliary/cci_class.rs
src/test/auxiliary/cci_class_2.rs
src/test/auxiliary/cci_class_3.rs
src/test/auxiliary/cci_class_4.rs
src/test/auxiliary/cci_class_5.rs
src/test/auxiliary/cci_class_6.rs
src/test/auxiliary/cci_class_cast.rs
src/test/auxiliary/cci_const.rs
src/test/auxiliary/cci_const_block.rs
src/test/auxiliary/cci_impl_lib.rs
src/test/auxiliary/cci_intrinsic.rs
src/test/auxiliary/cci_nested_lib.rs
src/test/auxiliary/cci_no_inline_lib.rs
src/test/auxiliary/cfg_inner_static.rs
src/test/auxiliary/changing-crates-b.rs
src/test/auxiliary/crateresolve1-1.rs
src/test/auxiliary/crateresolve1-2.rs
src/test/auxiliary/crateresolve1-3.rs
src/test/auxiliary/crateresolve3-1.rs
src/test/auxiliary/crateresolve3-2.rs
src/test/auxiliary/crateresolve4a-1.rs
src/test/auxiliary/crateresolve4a-2.rs
src/test/auxiliary/crateresolve4b-1.rs
src/test/auxiliary/crateresolve4b-2.rs
src/test/auxiliary/crateresolve5-1.rs
src/test/auxiliary/crateresolve5-2.rs
src/test/auxiliary/crateresolve7x.rs
src/test/auxiliary/crateresolve8-1.rs
src/test/auxiliary/crateresolve_calories-1.rs
src/test/auxiliary/crateresolve_calories-2.rs
src/test/auxiliary/extern_calling_convention.rs
src/test/auxiliary/go_trait.rs
src/test/auxiliary/impl_privacy_xc_1.rs
src/test/auxiliary/impl_privacy_xc_2.rs
src/test/auxiliary/inherit_struct_lib.rs
src/test/auxiliary/inherited_stability.rs
src/test/auxiliary/inner_static.rs
src/test/auxiliary/issue-11224.rs
src/test/auxiliary/issue-11225-1.rs
src/test/auxiliary/issue-11225-2.rs
src/test/auxiliary/issue-11529.rs
src/test/auxiliary/issue-12133-dylib2.rs
src/test/auxiliary/issue-13560-3.rs
src/test/auxiliary/issue-13620-2.rs
src/test/auxiliary/issue-13872-2.rs
src/test/auxiliary/issue-13872-3.rs
src/test/auxiliary/issue-17718.rs
src/test/auxiliary/issue-2414-a.rs
src/test/auxiliary/issue-2526.rs
src/test/auxiliary/issue-5521.rs
src/test/auxiliary/issue-8044.rs
src/test/auxiliary/issue-9906.rs
src/test/auxiliary/issue13507.rs
src/test/auxiliary/issue_11680.rs
src/test/auxiliary/issue_17718_const_privacy.rs
src/test/auxiliary/issue_19293.rs
src/test/auxiliary/issue_2723_a.rs
src/test/auxiliary/issue_3979_traits.rs
src/test/auxiliary/issue_9188.rs
src/test/auxiliary/lang-item-public.rs
src/test/auxiliary/linkage-visibility.rs
src/test/auxiliary/linkage1.rs
src/test/auxiliary/lint_output_format.rs
src/test/auxiliary/lint_stability.rs
src/test/auxiliary/logging_right_crate.rs
src/test/auxiliary/macro_crate_nonterminal.rs
src/test/auxiliary/moves_based_on_type_lib.rs
src/test/auxiliary/namespaced_enum_emulate_flat.rs
src/test/auxiliary/namespaced_enums.rs
src/test/auxiliary/nested_item.rs
src/test/auxiliary/newtype_struct_xc.rs
src/test/auxiliary/noexporttypelib.rs
src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs
src/test/auxiliary/priv-impl-prim-ty.rs
src/test/auxiliary/privacy_tuple_struct.rs
src/test/auxiliary/pub_use_xcrate1.rs
src/test/auxiliary/reexported_static_methods.rs
src/test/auxiliary/regions_bounded_method_type_parameters_cross_crate_lib.rs
src/test/auxiliary/roman_numerals.rs
src/test/auxiliary/sepcomp-extern-lib.rs
src/test/auxiliary/sepcomp_cci_lib.rs
src/test/auxiliary/sepcomp_lib.rs
src/test/auxiliary/static-function-pointer-aux.rs
src/test/auxiliary/static_fn_inline_xc_aux.rs
src/test/auxiliary/static_fn_trait_xc_aux.rs
src/test/auxiliary/static_mut_xc.rs
src/test/auxiliary/static_priv_by_default.rs
src/test/auxiliary/struct_destructuring_cross_crate.rs
src/test/auxiliary/struct_field_privacy.rs
src/test/auxiliary/struct_variant_privacy.rs
src/test/auxiliary/svh-a-base.rs
src/test/auxiliary/svh-a-change-lit.rs
src/test/auxiliary/svh-a-change-significant-cfg.rs
src/test/auxiliary/svh-a-change-trait-bound.rs
src/test/auxiliary/svh-a-change-type-arg.rs
src/test/auxiliary/svh-a-change-type-ret.rs
src/test/auxiliary/svh-a-change-type-static.rs
src/test/auxiliary/svh-a-comment.rs
src/test/auxiliary/svh-a-doc.rs
src/test/auxiliary/svh-a-macro.rs
src/test/auxiliary/svh-a-no-change.rs
src/test/auxiliary/svh-a-redundant-cfg.rs
src/test/auxiliary/svh-a-whitespace.rs
src/test/auxiliary/svh-uta-base.rs
src/test/auxiliary/svh-uta-change-use-trait.rs
src/test/auxiliary/syntax_extension_with_dll_deps_1.rs
src/test/auxiliary/syntax_extension_with_dll_deps_2.rs
src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs
src/test/auxiliary/trait_default_method_xc_aux.rs
src/test/auxiliary/trait_default_method_xc_aux_2.rs
src/test/auxiliary/trait_impl_conflict.rs
src/test/auxiliary/trait_inheritance_auto_xc_2_aux.rs
src/test/auxiliary/trait_inheritance_auto_xc_aux.rs
src/test/auxiliary/trait_inheritance_cross_trait_call_xc_aux.rs
src/test/auxiliary/trait_inheritance_overloading_xc.rs
src/test/auxiliary/trait_safety_lib.rs
src/test/auxiliary/typeid-intrinsic.rs
src/test/auxiliary/typeid-intrinsic2.rs
src/test/auxiliary/unboxed-closures-cross-crate.rs
src/test/auxiliary/xc_private_method_lib.rs
src/test/auxiliary/xcrate_address_insignificant.rs
src/test/auxiliary/xcrate_static_addresses.rs
src/test/auxiliary/xcrate_struct_aliases.rs
src/test/auxiliary/xcrate_unit_struct.rs
src/test/bench/msgsend-pipes-shared.rs
src/test/bench/msgsend-pipes.rs
src/test/bench/msgsend-ring-mutex-arcs.rs
src/test/bench/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-k-nucleotide-pipes.rs
src/test/bench/shootout-nbody.rs
src/test/bench/shootout-pfib.rs
src/test/bench/shootout-reverse-complement.rs
src/test/bench/shootout-spectralnorm.rs
src/test/bench/task-perf-alloc-unwind.rs
src/test/bench/task-perf-jargon-metal-smoke.rs
src/test/codegen/iterate-over-array.rs
src/test/codegen/scalar-function-call.rs
src/test/codegen/single-return-value.rs
src/test/codegen/small-dense-int-switch.rs
src/test/codegen/static-method-call-multi.rs
src/test/codegen/static-method-call.rs
src/test/codegen/virtual-method-call-struct-return.rs
src/test/codegen/virtual-method-call.rs
src/test/compile-fail/assignment-operator-unimplemented.rs
src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs
src/test/compile-fail/bad-crate-id.rs [deleted file]
src/test/compile-fail/bad-crate-id2.rs [deleted file]
src/test/compile-fail/binop-fail-3.rs [deleted file]
src/test/compile-fail/binop-logic-float.rs
src/test/compile-fail/binop-logic-int.rs
src/test/compile-fail/borrowck-issue-14498.rs
src/test/compile-fail/borrowck-match-binding-is-assignment.rs
src/test/compile-fail/borrowck-move-out-of-vec-tail.rs
src/test/compile-fail/borrowck-overloaded-index-autoderef.rs
src/test/compile-fail/borrowck-vec-pattern-element-loan.rs
src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs
src/test/compile-fail/borrowck-vec-pattern-move-tail.rs
src/test/compile-fail/borrowck-vec-pattern-nesting.rs
src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs
src/test/compile-fail/deprecated-phase.rs [deleted file]
src/test/compile-fail/feature-gate-advanced-slice-features.rs
src/test/compile-fail/feature-gate-int-uint.rs [deleted file]
src/test/compile-fail/fn-compare-mismatch.rs
src/test/compile-fail/gated-unsafe-destructor.rs
src/test/compile-fail/issue-11771.rs
src/test/compile-fail/issue-12369.rs
src/test/compile-fail/issue-12567.rs
src/test/compile-fail/issue-13352.rs [new file with mode: 0644]
src/test/compile-fail/issue-13482-2.rs
src/test/compile-fail/issue-13482.rs
src/test/compile-fail/issue-13853-3.rs [deleted file]
src/test/compile-fail/issue-13853-4.rs [deleted file]
src/test/compile-fail/issue-15381.rs
src/test/compile-fail/issue-16465.rs [deleted file]
src/test/compile-fail/issue-19660.rs
src/test/compile-fail/issue-2149.rs
src/test/compile-fail/issue-5239-1.rs
src/test/compile-fail/issue-6804.rs
src/test/compile-fail/issue-9814.rs
src/test/compile-fail/kindck-destructor-owned.rs [deleted file]
src/test/compile-fail/lint-dead-code-4.rs
src/test/compile-fail/lint-type-limits.rs
src/test/compile-fail/manual-link-bad-form.rs
src/test/compile-fail/manual-link-bad-kind.rs
src/test/compile-fail/manual-link-framework.rs
src/test/compile-fail/match-ref-ice.rs
src/test/compile-fail/match-vec-fixed.rs
src/test/compile-fail/match-vec-mismatch-2.rs
src/test/compile-fail/match-vec-mismatch.rs
src/test/compile-fail/match-vec-unreachable.rs
src/test/compile-fail/non-exhaustive-match-nested.rs
src/test/compile-fail/non-exhaustive-match.rs
src/test/compile-fail/non-exhaustive-pattern-witness.rs
src/test/compile-fail/plugin-extern-crate-attr-deprecated.rs [deleted file]
src/test/compile-fail/range-1.rs
src/test/compile-fail/reflect-assoc.rs [new file with mode: 0644]
src/test/compile-fail/reflect-object-param.rs [new file with mode: 0644]
src/test/compile-fail/reflect.rs [new file with mode: 0644]
src/test/compile-fail/regions-pattern-typing-issue-19552.rs
src/test/compile-fail/shift-various-bad-types.rs
src/test/compile-fail/simd-binop.rs
src/test/compile-fail/slice-1.rs [deleted file]
src/test/compile-fail/unsafe-destructor-check-crash.rs [deleted file]
src/test/compile-fail/use-meta-mismatch.rs
src/test/compile-fail/variance-region-bounds.rs [new file with mode: 0644]
src/test/compile-fail/weak-lang-item.rs
src/test/debuginfo/basic-types-globals-metadata.rs
src/test/debuginfo/basic-types-globals.rs
src/test/debuginfo/basic-types-mut-globals.rs
src/test/debuginfo/basic-types.rs
src/test/debuginfo/borrowed-basic.rs
src/test/debuginfo/borrowed-struct.rs
src/test/debuginfo/borrowed-unique-basic.rs
src/test/debuginfo/by-value-non-immediate-argument.rs
src/test/debuginfo/by-value-self-argument-in-trait-impl.rs
src/test/debuginfo/c-style-enum.rs
src/test/debuginfo/destructured-fn-argument.rs
src/test/debuginfo/destructured-local.rs
src/test/debuginfo/function-arg-initialization.rs
src/test/debuginfo/function-arguments.rs
src/test/debuginfo/function-prologue-stepping-no-stack-check.rs
src/test/debuginfo/function-prologue-stepping-regular.rs
src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs
src/test/debuginfo/gdb-pretty-struct-and-enums.rs
src/test/debuginfo/generic-function.rs
src/test/debuginfo/generic-method-on-generic-struct.rs
src/test/debuginfo/generic-static-method-on-struct-and-enum.rs
src/test/debuginfo/generic-struct-style-enum.rs
src/test/debuginfo/generic-struct.rs
src/test/debuginfo/generic-trait-generic-static-default-method.rs
src/test/debuginfo/generic-tuple-style-enum.rs
src/test/debuginfo/issue12886.rs
src/test/debuginfo/lexical-scope-in-match.rs
src/test/debuginfo/lexical-scope-in-stack-closure.rs
src/test/debuginfo/lexical-scope-in-unique-closure.rs
src/test/debuginfo/lexical-scopes-in-block-expression.rs
src/test/debuginfo/limited-debuginfo.rs
src/test/debuginfo/method-on-enum.rs
src/test/debuginfo/method-on-generic-struct.rs
src/test/debuginfo/method-on-struct.rs
src/test/debuginfo/method-on-trait.rs
src/test/debuginfo/method-on-tuple-struct.rs
src/test/debuginfo/recursive-struct.rs
src/test/debuginfo/self-in-default-method.rs
src/test/debuginfo/self-in-generic-default-method.rs
src/test/debuginfo/simple-struct.rs
src/test/debuginfo/simple-tuple.rs
src/test/debuginfo/static-method-on-struct-and-enum.rs
src/test/debuginfo/struct-in-enum.rs
src/test/debuginfo/struct-style-enum.rs
src/test/debuginfo/trait-generic-static-default-method.rs
src/test/debuginfo/trait-pointers.rs
src/test/debuginfo/tuple-style-enum.rs
src/test/debuginfo/type-names.rs
src/test/debuginfo/unique-enum.rs
src/test/debuginfo/var-captured-in-nested-closure.rs
src/test/debuginfo/var-captured-in-sendable-closure.rs
src/test/debuginfo/var-captured-in-stack-closure.rs
src/test/debuginfo/vec-slices.rs
src/test/parse-fail/bad-lit-suffixes.rs
src/test/parse-fail/issue-23620-invalid-escapes.rs [new file with mode: 0644]
src/test/parse-fail/new-unicode-escapes-4.rs
src/test/pretty/blank-lines.rs
src/test/pretty/block-disambig.rs
src/test/pretty/closure-reform-pretty.rs
src/test/pretty/disamb-stmt-expr.rs
src/test/pretty/do1.rs
src/test/pretty/empty-impl.rs
src/test/pretty/empty-lines.rs
src/test/pretty/for-comment.rs
src/test/pretty/issue-929.rs [deleted file]
src/test/pretty/path-type-bounds.rs
src/test/pretty/record-trailing-comma.rs
src/test/pretty/struct-tuple.rs
src/test/pretty/trait-safety.rs
src/test/pretty/unary-op-disambig.rs
src/test/pretty/where-clauses.rs
src/test/run-fail/args-panic.rs
src/test/run-fail/binop-fail-3.rs [new file with mode: 0644]
src/test/run-fail/bounds-check-no-overflow.rs
src/test/run-fail/bug-2470-bounds-check-overflow-2.rs
src/test/run-fail/bug-2470-bounds-check-overflow-3.rs
src/test/run-fail/bug-2470-bounds-check-overflow.rs
src/test/run-fail/bug-811.rs
src/test/run-fail/die-macro-expr.rs
src/test/run-fail/expr-if-panic-fn.rs
src/test/run-fail/expr-match-panic-fn.rs
src/test/run-fail/extern-panic.rs
src/test/run-fail/if-check-panic.rs
src/test/run-fail/issue-2061.rs
src/test/run-fail/issue-2444.rs
src/test/run-fail/issue-948.rs
src/test/run-fail/match-bot-panic.rs
src/test/run-fail/match-disc-bot.rs
src/test/run-fail/match-wildcards.rs
src/test/run-fail/panic-arg.rs
src/test/run-fail/result-get-panic.rs
src/test/run-fail/rt-set-exit-status-panic2.rs
src/test/run-fail/unwind-rec.rs
src/test/run-fail/unwind-rec2.rs
src/test/run-fail/vec-overrun.rs
src/test/run-fail/while-body-panics.rs
src/test/run-make/extern-fn-reachable/main.rs
src/test/run-make/graphviz-flowgraph/f07.rs
src/test/run-make/intrinsic-unreachable/exit-ret.rs
src/test/run-make/intrinsic-unreachable/exit-unreachable.rs
src/test/run-make/issue-7349/foo.rs
src/test/run-make/metadata-flag-frobs-symbols/foo.rs
src/test/run-make/mixing-deps/both.rs
src/test/run-make/mixing-deps/dylib.rs
src/test/run-make/mixing-deps/prog.rs
src/test/run-make/output-with-hyphens/Makefile [new file with mode: 0644]
src/test/run-make/output-with-hyphens/foo-bar.rs [new file with mode: 0644]
src/test/run-make/pretty-expanded/input.rs
src/test/run-make/pretty-print-path-suffix/foo_method.pp
src/test/run-make/pretty-print-path-suffix/input.rs
src/test/run-make/rustdoc-smoke/foo.rs
src/test/run-make/save-analysis/foo.rs
src/test/run-make/sepcomp-cci-copies/cci_lib.rs
src/test/run-make/sepcomp-cci-copies/foo.rs
src/test/run-make/sepcomp-separate/foo.rs
src/test/run-make/symbols-are-reasonable/lib.rs
src/test/run-make/target-specs/foo.rs
src/test/run-make/volatile-intrinsics/main.rs
src/test/run-make/weird-output-filenames/Makefile
src/test/run-pass-fulldeps/issue-13560.rs
src/test/run-pass-fulldeps/issue-16822.rs
src/test/run-pass-fulldeps/issue-18502.rs
src/test/run-pass-fulldeps/issue-18763-quote-token-tree.rs
src/test/run-pass-fulldeps/qquote.rs
src/test/run-pass-fulldeps/quote-tokens.rs
src/test/run-pass-valgrind/dst-dtor-2.rs
src/test/run-pass/alias-uninit-value.rs
src/test/run-pass/alloca-from-derived-tydesc.rs
src/test/run-pass/anon-trait-static-method.rs
src/test/run-pass/argument-passing.rs
src/test/run-pass/arith-0.rs
src/test/run-pass/arith-1.rs
src/test/run-pass/arith-2.rs
src/test/run-pass/artificial-block.rs
src/test/run-pass/as-precedence.rs
src/test/run-pass/asm-in-out-operand.rs
src/test/run-pass/asm-out-assign.rs
src/test/run-pass/assert-eq-macro-success.rs
src/test/run-pass/assign-assign.rs
src/test/run-pass/assignability-trait.rs
src/test/run-pass/associated-types-basic.rs
src/test/run-pass/associated-types-binding-in-where-clause.rs
src/test/run-pass/associated-types-cc.rs
src/test/run-pass/associated-types-constant-type.rs
src/test/run-pass/associated-types-doubleendediterator-object.rs
src/test/run-pass/associated-types-in-default-method.rs
src/test/run-pass/associated-types-in-fn.rs
src/test/run-pass/associated-types-in-impl-generics.rs
src/test/run-pass/associated-types-in-inherent-method.rs
src/test/run-pass/associated-types-issue-20371.rs
src/test/run-pass/associated-types-iterator-binding.rs
src/test/run-pass/associated-types-projection-bound-in-supertraits.rs
src/test/run-pass/associated-types-ref-in-struct-literal.rs
src/test/run-pass/associated-types-resolve-lifetime.rs
src/test/run-pass/associated-types-return.rs
src/test/run-pass/associated-types-simple.rs
src/test/run-pass/associated-types-sugar-path.rs
src/test/run-pass/attr-no-drop-flag-size.rs
src/test/run-pass/attr-start.rs
src/test/run-pass/auto-encode.rs
src/test/run-pass/auto-instantiate.rs
src/test/run-pass/auto-ref-bounded-ty-param.rs
src/test/run-pass/auto-ref.rs
src/test/run-pass/autobind.rs
src/test/run-pass/autoderef-and-borrow-method-receiver.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/bind-field-short-with-modifiers.rs
src/test/run-pass/binops-issue-22743.rs [new file with mode: 0644]
src/test/run-pass/binops.rs
src/test/run-pass/bitwise.rs
src/test/run-pass/blind-item-mixed-crate-use-item.rs
src/test/run-pass/block-arg-call-as.rs
src/test/run-pass/block-fn-coerce.rs
src/test/run-pass/borrow-by-val-method-receiver.rs
src/test/run-pass/borrow-tuple-fields.rs
src/test/run-pass/borrowck-assign-to-subfield.rs
src/test/run-pass/borrowck-binding-mutbl.rs
src/test/run-pass/borrowck-borrow-from-expr-block.rs
src/test/run-pass/borrowck-borrow-of-mut-base-ptr-safe.rs
src/test/run-pass/borrowck-field-sensitivity.rs
src/test/run-pass/borrowck-freeze-frozen-mut.rs
src/test/run-pass/borrowck-lend-args.rs
src/test/run-pass/borrowck-macro-interaction-issue-6304.rs
src/test/run-pass/borrowck-move-by-capture-ok.rs
src/test/run-pass/borrowck-mut-uniq.rs
src/test/run-pass/borrowck-mut-vec-as-imm-slice.rs
src/test/run-pass/borrowck-nested-calls.rs
src/test/run-pass/borrowck-pat-enum.rs
src/test/run-pass/borrowck-rvalues-mutable.rs
src/test/run-pass/borrowck-scope-of-deref-issue-4666.rs
src/test/run-pass/borrowck-uniq-via-ref.rs
src/test/run-pass/borrowck-univariant-enum.rs
src/test/run-pass/borrowck-use-mut-borrow.rs
src/test/run-pass/borrowed-ptr-pattern-3.rs
src/test/run-pass/borrowed-ptr-pattern-option.rs
src/test/run-pass/box-of-array-of-drop-1.rs [new file with mode: 0644]
src/test/run-pass/box-of-array-of-drop-2.rs [new file with mode: 0644]
src/test/run-pass/break-value.rs
src/test/run-pass/bug-7183-generics.rs
src/test/run-pass/builtin-superkinds-capabilities-xc.rs
src/test/run-pass/builtin-superkinds-capabilities.rs
src/test/run-pass/builtin-superkinds-in-metadata.rs
src/test/run-pass/builtin-superkinds-simple.rs
src/test/run-pass/by-value-self-in-mut-slot.rs
src/test/run-pass/c-stack-returning-int64.rs
src/test/run-pass/call-closure-from-overloaded-op.rs
src/test/run-pass/capture-clauses-unboxed-closures.rs
src/test/run-pass/cast-in-array-size.rs
src/test/run-pass/cast-region-to-uint.rs
src/test/run-pass/cast.rs
src/test/run-pass/cell-does-not-clone.rs
src/test/run-pass/cfgs-on-items.rs
src/test/run-pass/check-static-mut-slices.rs
src/test/run-pass/check-static-slice.rs
src/test/run-pass/class-cast-to-trait-multiple-types.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-impl-very-parameterized-trait.rs
src/test/run-pass/class-implement-trait-cross-crate.rs
src/test/run-pass/class-implement-traits.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-method.rs
src/test/run-pass/classes-simple.rs
src/test/run-pass/classes.rs
src/test/run-pass/cleanup-arm-conditional.rs
src/test/run-pass/cleanup-rvalue-during-if-and-while.rs
src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs
src/test/run-pass/cleanup-shortcircuit.rs
src/test/run-pass/clone-with-exterior.rs
src/test/run-pass/cmp-default.rs
src/test/run-pass/coerce-expect-unsized.rs
src/test/run-pass/coerce-match-calls.rs
src/test/run-pass/coerce-match.rs
src/test/run-pass/coerce-reborrow-imm-ptr-arg.rs
src/test/run-pass/coerce-reborrow-imm-ptr-rcvr.rs
src/test/run-pass/coerce-reborrow-imm-vec-arg.rs
src/test/run-pass/coerce-reborrow-imm-vec-rcvr.rs
src/test/run-pass/coerce-reborrow-mut-ptr-arg.rs
src/test/run-pass/coerce-reborrow-mut-ptr-rcvr.rs
src/test/run-pass/coerce-reborrow-mut-vec-arg.rs
src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs
src/test/run-pass/coherence-impl-in-fn.rs
src/test/run-pass/coherence-multidispatch-tuple.rs
src/test/run-pass/coherence-where-clause.rs
src/test/run-pass/comm.rs
src/test/run-pass/compare-generic-enums.rs
src/test/run-pass/complex.rs
src/test/run-pass/conditional-compile.rs
src/test/run-pass/const-binops.rs
src/test/run-pass/const-block-item-macro-codegen.rs
src/test/run-pass/const-block-item.rs
src/test/run-pass/const-bound.rs
src/test/run-pass/const-const.rs
src/test/run-pass/const-contents.rs
src/test/run-pass/const-cross-crate-const.rs
src/test/run-pass/const-deref.rs
src/test/run-pass/const-enum-byref-self.rs
src/test/run-pass/const-enum-byref.rs
src/test/run-pass/const-enum-cast.rs
src/test/run-pass/const-enum-ptr.rs
src/test/run-pass/const-enum-structlike.rs
src/test/run-pass/const-enum-vec-index.rs
src/test/run-pass/const-enum-vec-ptr.rs
src/test/run-pass/const-enum-vector.rs
src/test/run-pass/const-expr-in-fixed-length-vec.rs
src/test/run-pass/const-expr-in-vec-repeat.rs
src/test/run-pass/const-fields-and-indexing.rs
src/test/run-pass/const-fn-val.rs
src/test/run-pass/const-negative.rs
src/test/run-pass/const-nullary-univariant-enum.rs
src/test/run-pass/const-region-ptrs-noncopy.rs
src/test/run-pass/const-region-ptrs.rs
src/test/run-pass/const-struct.rs
src/test/run-pass/const-tuple-struct.rs
src/test/run-pass/const-vec-syntax.rs
src/test/run-pass/const-vecs-and-slices.rs
src/test/run-pass/const.rs
src/test/run-pass/consts-in-patterns.rs
src/test/run-pass/core-run-destroy.rs
src/test/run-pass/crate-name-attr-used.rs
src/test/run-pass/dead-code-leading-underscore.rs
src/test/run-pass/deep.rs
src/test/run-pass/default-method-parsing.rs
src/test/run-pass/default-method-simple.rs
src/test/run-pass/default-method-supertrait-vtable.rs
src/test/run-pass/deref-mut-on-ref.rs
src/test/run-pass/deref-on-ref.rs
src/test/run-pass/deref.rs
src/test/run-pass/derive-no-std.rs
src/test/run-pass/deriving-clone-generic-enum.rs
src/test/run-pass/deriving-clone-struct.rs
src/test/run-pass/deriving-cmp-shortcircuit.rs
src/test/run-pass/deriving-encodable-decodable-cell-refcell.rs
src/test/run-pass/deriving-encodable-decodable.rs
src/test/run-pass/deriving-enum-single-variant.rs
src/test/run-pass/deriving-global.rs
src/test/run-pass/deriving-hash.rs
src/test/run-pass/deriving-in-fn.rs
src/test/run-pass/deriving-meta-multiple.rs
src/test/run-pass/deriving-meta.rs
src/test/run-pass/deriving-rand.rs
src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs
src/test/run-pass/deriving-self-lifetime.rs
src/test/run-pass/deriving-show-2.rs
src/test/run-pass/deriving-show.rs
src/test/run-pass/deriving-via-extension-enum.rs
src/test/run-pass/deriving-via-extension-hash-enum.rs
src/test/run-pass/deriving-via-extension-hash-struct.rs
src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs
src/test/run-pass/deriving-via-extension-struct-tuple.rs
src/test/run-pass/deriving-via-extension-struct.rs
src/test/run-pass/deriving-via-extension-type-params.rs
src/test/run-pass/destructure-array-1.rs
src/test/run-pass/die-macro.rs
src/test/run-pass/div-mod.rs
src/test/run-pass/double-ref.rs
src/test/run-pass/drop-flag-sanity-check.rs [new file with mode: 0644]
src/test/run-pass/drop-flag-skip-sanity-check.rs [new file with mode: 0644]
src/test/run-pass/drop-on-empty-block-exit.rs
src/test/run-pass/drop-on-ret.rs
src/test/run-pass/drop-struct-as-object.rs
src/test/run-pass/drop-trait-enum.rs
src/test/run-pass/drop-trait.rs
src/test/run-pass/dst-deref-mut.rs
src/test/run-pass/dst-deref.rs
src/test/run-pass/dst-index.rs
src/test/run-pass/dst-raw.rs
src/test/run-pass/dst-struct-sole.rs
src/test/run-pass/dst-struct.rs
src/test/run-pass/dst-trait.rs
src/test/run-pass/early-ret-binop-add.rs
src/test/run-pass/early-vtbl-resolution.rs
src/test/run-pass/empty-mutable-vec.rs
src/test/run-pass/empty-tag.rs
src/test/run-pass/enum-alignment.rs
src/test/run-pass/enum-clike-ffi-as-int.rs
src/test/run-pass/enum-discr.rs
src/test/run-pass/enum-discrim-manual-sizing.rs
src/test/run-pass/enum-disr-val-pretty.rs
src/test/run-pass/enum-null-pointer-opt.rs
src/test/run-pass/enum-nullable-const-null-with-fields.rs
src/test/run-pass/enum-size-variance.rs
src/test/run-pass/enum-vec-initializer.rs
src/test/run-pass/evec-internal.rs
src/test/run-pass/evec-slice.rs
src/test/run-pass/explicit-i-suffix.rs
src/test/run-pass/explicit-self-closures.rs
src/test/run-pass/explicit-self-generic.rs
src/test/run-pass/explicit-self-objects-uniq.rs
src/test/run-pass/explicit-self.rs
src/test/run-pass/export-glob-imports-target.rs
src/test/run-pass/expr-block-fn.rs
src/test/run-pass/expr-block-generic-unique2.rs
src/test/run-pass/expr-block-generic.rs
src/test/run-pass/expr-block-slot.rs
src/test/run-pass/expr-block.rs
src/test/run-pass/expr-copy.rs
src/test/run-pass/expr-fn.rs
src/test/run-pass/expr-if-generic.rs
src/test/run-pass/expr-if-struct.rs
src/test/run-pass/expr-match-generic-unique2.rs
src/test/run-pass/expr-match-generic.rs
src/test/run-pass/expr-match-struct.rs
src/test/run-pass/exterior.rs
src/test/run-pass/extern-call-direct.rs
src/test/run-pass/extern-compare-with-return-type.rs
src/test/run-pass/extern-foreign-crate.rs
src/test/run-pass/fact.rs
src/test/run-pass/fixup-deref-mut.rs
src/test/run-pass/fn-bare-assign.rs
src/test/run-pass/fn-bare-size.rs
src/test/run-pass/fn-bare-spawn.rs
src/test/run-pass/fn-item-type-cast.rs
src/test/run-pass/fn-item-type-coerce.rs
src/test/run-pass/fn-lval.rs
src/test/run-pass/fn-pattern-expected-type-2.rs
src/test/run-pass/fn-pattern-expected-type.rs
src/test/run-pass/for-destruct.rs
src/test/run-pass/for-loop-goofiness.rs
src/test/run-pass/for-loop-no-std.rs
src/test/run-pass/for-loop-panic.rs
src/test/run-pass/foreach-nested.rs
src/test/run-pass/foreach-put-structured.rs
src/test/run-pass/foreach-simple-outer-slot.rs
src/test/run-pass/foreign-call-no-runtime.rs
src/test/run-pass/foreign-fn-linkname.rs
src/test/run-pass/format-no-std.rs
src/test/run-pass/fsu-moves-and-copies.rs
src/test/run-pass/fun-call-variants.rs
src/test/run-pass/fun-indirect-call.rs
src/test/run-pass/func-arg-incomplete-pattern.rs
src/test/run-pass/func-arg-ref-pattern.rs
src/test/run-pass/func-arg-wild-pattern.rs
src/test/run-pass/functional-struct-upd.rs
src/test/run-pass/generic-alias-unique.rs
src/test/run-pass/generic-default-type-params-cross-crate.rs
src/test/run-pass/generic-default-type-params.rs
src/test/run-pass/generic-derived-type.rs
src/test/run-pass/generic-exterior-unique.rs
src/test/run-pass/generic-extern-mangle.rs
src/test/run-pass/generic-fn-infer.rs
src/test/run-pass/generic-fn-twice.rs
src/test/run-pass/generic-fn.rs
src/test/run-pass/generic-object.rs
src/test/run-pass/generic-recursive-tag.rs
src/test/run-pass/generic-tag-match.rs
src/test/run-pass/generic-tag-values.rs
src/test/run-pass/generic-tag.rs
src/test/run-pass/generic-temporary.rs
src/test/run-pass/generic-type.rs
src/test/run-pass/generic-unique.rs
src/test/run-pass/global-scope.rs
src/test/run-pass/guards-not-exhaustive.rs
src/test/run-pass/guards.rs
src/test/run-pass/hashmap-memory.rs
src/test/run-pass/hrtb-binder-levels-in-object-types.rs
src/test/run-pass/hrtb-debruijn-object-types-in-closures.rs
src/test/run-pass/hrtb-fn-like-trait-object.rs
src/test/run-pass/hrtb-fn-like-trait.rs
src/test/run-pass/hrtb-precedence-of-plus-where-clause.rs
src/test/run-pass/hrtb-precedence-of-plus.rs
src/test/run-pass/hrtb-resolve-lifetime.rs
src/test/run-pass/hrtb-trait-object-passed-to-closure.rs
src/test/run-pass/hrtb-unboxed-closure-trait.rs
src/test/run-pass/hygiene-dodging-1.rs
src/test/run-pass/hygienic-labels-in-let.rs
src/test/run-pass/if-bot.rs
src/test/run-pass/if-check.rs
src/test/run-pass/if-let.rs
src/test/run-pass/ignore-all-the-things.rs
src/test/run-pass/impl-implicit-trait.rs
src/test/run-pass/import.rs
src/test/run-pass/import8.rs
src/test/run-pass/infer-fn-tail-expr.rs
src/test/run-pass/infinite-loops.rs
src/test/run-pass/init-res-into-things.rs
src/test/run-pass/instantiable.rs
src/test/run-pass/int.rs
src/test/run-pass/integer-literal-suffix-inference.rs
src/test/run-pass/into-iterator-type-inference-shift.rs
src/test/run-pass/intrinsic-alignment.rs
src/test/run-pass/intrinsic-move-val.rs
src/test/run-pass/intrinsic-return-address.rs
src/test/run-pass/intrinsic-uninit.rs
src/test/run-pass/intrinsic-unreachable.rs
src/test/run-pass/issue-10028.rs
src/test/run-pass/issue-10392.rs
src/test/run-pass/issue-10682.rs
src/test/run-pass/issue-10734.rs
src/test/run-pass/issue-10806.rs
src/test/run-pass/issue-11085.rs
src/test/run-pass/issue-1112.rs
src/test/run-pass/issue-11205.rs
src/test/run-pass/issue-11224.rs
src/test/run-pass/issue-11225-1.rs
src/test/run-pass/issue-11225-2.rs
src/test/run-pass/issue-11267.rs
src/test/run-pass/issue-11508.rs
src/test/run-pass/issue-11529.rs
src/test/run-pass/issue-11552.rs
src/test/run-pass/issue-11577.rs
src/test/run-pass/issue-11592.rs [new file with mode: 0644]
src/test/run-pass/issue-11677.rs
src/test/run-pass/issue-11736.rs
src/test/run-pass/issue-11881.rs
src/test/run-pass/issue-12133-1.rs
src/test/run-pass/issue-12133-2.rs
src/test/run-pass/issue-12133-3.rs
src/test/run-pass/issue-12860.rs
src/test/run-pass/issue-12909.rs
src/test/run-pass/issue-13027.rs
src/test/run-pass/issue-13167.rs
src/test/run-pass/issue-13204.rs
src/test/run-pass/issue-13264.rs
src/test/run-pass/issue-13352.rs [deleted file]
src/test/run-pass/issue-13405.rs
src/test/run-pass/issue-13494.rs
src/test/run-pass/issue-13620.rs
src/test/run-pass/issue-13703.rs
src/test/run-pass/issue-13763.rs
src/test/run-pass/issue-13775.rs
src/test/run-pass/issue-13837.rs
src/test/run-pass/issue-13867.rs
src/test/run-pass/issue-13872.rs
src/test/run-pass/issue-14254.rs
src/test/run-pass/issue-14308.rs
src/test/run-pass/issue-14330.rs
src/test/run-pass/issue-14421.rs
src/test/run-pass/issue-14422.rs
src/test/run-pass/issue-14589.rs
src/test/run-pass/issue-1460.rs
src/test/run-pass/issue-14837.rs
src/test/run-pass/issue-14865.rs
src/test/run-pass/issue-14919.rs
src/test/run-pass/issue-14933.rs
src/test/run-pass/issue-14936.rs
src/test/run-pass/issue-15043.rs
src/test/run-pass/issue-15080.rs
src/test/run-pass/issue-15104.rs
src/test/run-pass/issue-15129.rs
src/test/run-pass/issue-15149.rs
src/test/run-pass/issue-15261.rs
src/test/run-pass/issue-15444.rs
src/test/run-pass/issue-15562.rs
src/test/run-pass/issue-15689-1.rs
src/test/run-pass/issue-15689-2.rs
src/test/run-pass/issue-15734.rs
src/test/run-pass/issue-15763.rs
src/test/run-pass/issue-15793.rs
src/test/run-pass/issue-16151.rs
src/test/run-pass/issue-16452.rs
src/test/run-pass/issue-16492.rs
src/test/run-pass/issue-16560.rs
src/test/run-pass/issue-1660.rs
src/test/run-pass/issue-16643.rs
src/test/run-pass/issue-16648.rs
src/test/run-pass/issue-16774.rs
src/test/run-pass/issue-17068.rs
src/test/run-pass/issue-17302.rs
src/test/run-pass/issue-17503.rs
src/test/run-pass/issue-17662.rs
src/test/run-pass/issue-17718-parse-const.rs
src/test/run-pass/issue-17718-static-unsafe-interior.rs
src/test/run-pass/issue-17718.rs
src/test/run-pass/issue-17877.rs
src/test/run-pass/issue-17897.rs
src/test/run-pass/issue-18412.rs
src/test/run-pass/issue-18501.rs
src/test/run-pass/issue-18514.rs
src/test/run-pass/issue-18539.rs
src/test/run-pass/issue-1866.rs
src/test/run-pass/issue-18711.rs
src/test/run-pass/issue-18738.rs
src/test/run-pass/issue-18859.rs
src/test/run-pass/issue-19340-1.rs
src/test/run-pass/issue-19358.rs
src/test/run-pass/issue-19850.rs
src/test/run-pass/issue-20414.rs
src/test/run-pass/issue-2074.rs
src/test/run-pass/issue-21384.rs
src/test/run-pass/issue-21634.rs
src/test/run-pass/issue-2185.rs
src/test/run-pass/issue-21891.rs
src/test/run-pass/issue-2190-1.rs
src/test/run-pass/issue-2214.rs
src/test/run-pass/issue-2288.rs
src/test/run-pass/issue-2312.rs
src/test/run-pass/issue-23485.rs [new file with mode: 0644]
src/test/run-pass/issue-23781.rs [new file with mode: 0644]
src/test/run-pass/issue-2428.rs
src/test/run-pass/issue-2445-b.rs
src/test/run-pass/issue-2445.rs
src/test/run-pass/issue-2463.rs
src/test/run-pass/issue-2487-a.rs
src/test/run-pass/issue-2550.rs
src/test/run-pass/issue-2611-3.rs
src/test/run-pass/issue-2631-b.rs
src/test/run-pass/issue-2633-2.rs
src/test/run-pass/issue-2642.rs
src/test/run-pass/issue-2708.rs
src/test/run-pass/issue-2718.rs
src/test/run-pass/issue-2748-b.rs
src/test/run-pass/issue-2804-2.rs
src/test/run-pass/issue-2804.rs
src/test/run-pass/issue-2895.rs
src/test/run-pass/issue-2935.rs
src/test/run-pass/issue-2936.rs
src/test/run-pass/issue-3026.rs
src/test/run-pass/issue-3220.rs
src/test/run-pass/issue-3424.rs
src/test/run-pass/issue-3563-2.rs
src/test/run-pass/issue-3563-3.rs
src/test/run-pass/issue-3683.rs
src/test/run-pass/issue-3794.rs
src/test/run-pass/issue-3847.rs
src/test/run-pass/issue-3874.rs
src/test/run-pass/issue-3979-generics.rs
src/test/run-pass/issue-3979-xcrate.rs
src/test/run-pass/issue-3979.rs
src/test/run-pass/issue-3991.rs
src/test/run-pass/issue-4036.rs
src/test/run-pass/issue-4107.rs
src/test/run-pass/issue-4241.rs
src/test/run-pass/issue-4252.rs
src/test/run-pass/issue-4464.rs
src/test/run-pass/issue-4545.rs
src/test/run-pass/issue-4734.rs
src/test/run-pass/issue-4735.rs
src/test/run-pass/issue-4759.rs
src/test/run-pass/issue-4830.rs
src/test/run-pass/issue-5192.rs
src/test/run-pass/issue-5239-2.rs
src/test/run-pass/issue-5243.rs
src/test/run-pass/issue-5321-immediates-with-bare-self.rs
src/test/run-pass/issue-5518.rs
src/test/run-pass/issue-5521.rs
src/test/run-pass/issue-5530.rs
src/test/run-pass/issue-5554.rs
src/test/run-pass/issue-5688.rs
src/test/run-pass/issue-5708.rs
src/test/run-pass/issue-5718.rs
src/test/run-pass/issue-5884.rs
src/test/run-pass/issue-5900.rs
src/test/run-pass/issue-5917.rs
src/test/run-pass/issue-5997.rs
src/test/run-pass/issue-6128.rs
src/test/run-pass/issue-6130.rs
src/test/run-pass/issue-6153.rs
src/test/run-pass/issue-6157.rs
src/test/run-pass/issue-6334.rs
src/test/run-pass/issue-6341.rs
src/test/run-pass/issue-6344-let.rs
src/test/run-pass/issue-6344-match.rs
src/test/run-pass/issue-6449.rs
src/test/run-pass/issue-6470.rs
src/test/run-pass/issue-6557.rs
src/test/run-pass/issue-6892.rs
src/test/run-pass/issue-6898.rs
src/test/run-pass/issue-7178.rs
src/test/run-pass/issue-7563.rs
src/test/run-pass/issue-7575.rs
src/test/run-pass/issue-7660.rs
src/test/run-pass/issue-7663.rs
src/test/run-pass/issue-7784.rs
src/test/run-pass/issue-7899.rs
src/test/run-pass/issue-8044.rs
src/test/run-pass/issue-8259.rs
src/test/run-pass/issue-8351-1.rs
src/test/run-pass/issue-8351-2.rs
src/test/run-pass/issue-8460.rs
src/test/run-pass/issue-8709.rs
src/test/run-pass/issue-8783.rs
src/test/run-pass/issue-8827.rs
src/test/run-pass/issue-8851.rs
src/test/run-pass/issue-8860.rs
src/test/run-pass/issue-9047.rs
src/test/run-pass/issue-9129.rs
src/test/run-pass/issue-9188.rs
src/test/run-pass/issue-9382.rs
src/test/run-pass/issue-9719.rs
src/test/run-pass/issue-979.rs
src/test/run-pass/issue-9906.rs
src/test/run-pass/issue-9942.rs
src/test/run-pass/issue-9968.rs
src/test/run-pass/item-attributes.rs
src/test/run-pass/iter-range.rs
src/test/run-pass/ivec-pass-by-value.rs
src/test/run-pass/keyword-changes-2012-07-31.rs
src/test/run-pass/kindck-implicit-close-over-mut-var.rs
src/test/run-pass/kinds-in-metadata.rs
src/test/run-pass/lambda-infer-unresolved.rs
src/test/run-pass/lambda-var-hygiene.rs
src/test/run-pass/lang-item-public.rs
src/test/run-pass/large-records.rs
src/test/run-pass/last-use-is-capture.rs
src/test/run-pass/lazy-and-or.rs
src/test/run-pass/lazy-init.rs
src/test/run-pass/leak-unique-as-tydesc.rs
src/test/run-pass/let-assignability.rs
src/test/run-pass/linear-for-loop.rs
src/test/run-pass/link-section.rs
src/test/run-pass/linkage-visibility.rs
src/test/run-pass/linkage1.rs
src/test/run-pass/lint-non-camel-case-types-non-uppercase-statics-unicode.rs
src/test/run-pass/lint-non-camel-case-with-trailing-underscores.rs
src/test/run-pass/lint-non-uppercase-statics-lowercase-mut-statics.rs
src/test/run-pass/list.rs
src/test/run-pass/liveness-assign-imm-local-after-loop.rs
src/test/run-pass/liveness-assign-imm-local-after-ret.rs
src/test/run-pass/liveness-move-in-loop.rs
src/test/run-pass/log-knows-the-names-of-variants-in-std.rs
src/test/run-pass/logging-enabled.rs
src/test/run-pass/logging-only-prints-once.rs
src/test/run-pass/logging-right-crate.rs
src/test/run-pass/long-while.rs
src/test/run-pass/macro-2.rs
src/test/run-pass/macro-crate-nonterminal-renamed.rs
src/test/run-pass/macro-crate-use.rs
src/test/run-pass/macro-interpolation.rs
src/test/run-pass/macro-method-issue-4621.rs
src/test/run-pass/macro-pat.rs
src/test/run-pass/macro-path.rs
src/test/run-pass/macro-stmt.rs
src/test/run-pass/match-arm-statics.rs
src/test/run-pass/match-bot-2.rs
src/test/run-pass/match-bot.rs
src/test/run-pass/match-enum-struct-0.rs
src/test/run-pass/match-enum-struct-1.rs
src/test/run-pass/match-implicit-copy-unique.rs
src/test/run-pass/match-in-macro.rs
src/test/run-pass/match-join.rs
src/test/run-pass/match-naked-record-expr.rs
src/test/run-pass/match-naked-record.rs
src/test/run-pass/match-pattern-lit.rs
src/test/run-pass/match-pattern-no-type-params.rs
src/test/run-pass/match-pattern-simple.rs
src/test/run-pass/match-phi.rs
src/test/run-pass/match-range-static.rs
src/test/run-pass/match-ref-binding-mut.rs
src/test/run-pass/match-ref-binding.rs
src/test/run-pass/match-static-const-rename.rs
src/test/run-pass/match-struct-0.rs
src/test/run-pass/match-tag.rs
src/test/run-pass/match-value-binding-in-guard-3291.rs
src/test/run-pass/match-vec-alternatives.rs
src/test/run-pass/max-min-classes.rs
src/test/run-pass/method-attributes.rs
src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs
src/test/run-pass/method-normalize-bounds-issue-20604.rs
src/test/run-pass/method-projection.rs
src/test/run-pass/method-self-arg.rs
src/test/run-pass/method-two-trait-defer-resolution-2.rs
src/test/run-pass/method-two-traits-distinguished-via-where-clause.rs
src/test/run-pass/mid-path-type-params.rs
src/test/run-pass/mod-inside-fn.rs
src/test/run-pass/mod-view-items.rs
src/test/run-pass/mod_dir_implicit_aux/mod.rs
src/test/run-pass/mod_dir_simple/test.rs
src/test/run-pass/mod_file_aux.rs
src/test/run-pass/module-qualified-struct-destructure.rs
src/test/run-pass/monad.rs
src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs
src/test/run-pass/move-1-unique.rs
src/test/run-pass/move-2-unique.rs
src/test/run-pass/move-2.rs
src/test/run-pass/move-3-unique.rs
src/test/run-pass/move-4-unique.rs
src/test/run-pass/move-4.rs
src/test/run-pass/move-arg-2-unique.rs
src/test/run-pass/move-arg-2.rs
src/test/run-pass/move-arg.rs
src/test/run-pass/move-scalar.rs
src/test/run-pass/multidispatch1.rs
src/test/run-pass/multidispatch2.rs
src/test/run-pass/mut-function-arguments.rs
src/test/run-pass/mut-in-ident-patterns.rs
src/test/run-pass/mut-vstore-expr.rs
src/test/run-pass/mutable-alias-vec.rs
src/test/run-pass/mutual-recursion-group.rs
src/test/run-pass/namespaced-enum-emulate-flat.rs
src/test/run-pass/namespaced-enum-glob-import.rs
src/test/run-pass/namespaced-enums.rs
src/test/run-pass/native-print-no-runtime.rs
src/test/run-pass/nested-class.rs
src/test/run-pass/nested-exhaustive-match.rs
src/test/run-pass/nested-function-names-issue-8587.rs
src/test/run-pass/nested-matchs.rs
src/test/run-pass/nested-pattern.rs
src/test/run-pass/nested-vec-1.rs [new file with mode: 0644]
src/test/run-pass/nested-vec-2.rs [new file with mode: 0644]
src/test/run-pass/nested-vec-3.rs [new file with mode: 0644]
src/test/run-pass/nested_item_main.rs
src/test/run-pass/new-box-syntax.rs
src/test/run-pass/new-box.rs
src/test/run-pass/new-impl-syntax.rs
src/test/run-pass/new-style-constants.rs
src/test/run-pass/new-style-fixed-length-vec.rs
src/test/run-pass/new-unsafe-pointers.rs
src/test/run-pass/newlambdas.rs
src/test/run-pass/newtype-struct-drop-run.rs
src/test/run-pass/newtype-temporary.rs
src/test/run-pass/newtype.rs
src/test/run-pass/no-std-xcrate2.rs
src/test/run-pass/non-legacy-modes.rs
src/test/run-pass/nullable-pointer-ffi-compat.rs
src/test/run-pass/nullable-pointer-iotareduction.rs
src/test/run-pass/nullable-pointer-size.rs
src/test/run-pass/nullary-or-pattern.rs
src/test/run-pass/object-one-type-two-traits.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/objects-owned-object-owned-method.rs
src/test/run-pass/opeq.rs
src/test/run-pass/operator-multidispatch.rs
src/test/run-pass/operator-overloading.rs
src/test/run-pass/option-unwrap.rs
src/test/run-pass/or-pattern.rs
src/test/run-pass/order-drop-with-match.rs
src/test/run-pass/out-pointer-aliasing.rs
src/test/run-pass/output-slot-variants.rs
src/test/run-pass/over-constrained-vregs.rs
src/test/run-pass/overloaded-autoderef-count.rs
src/test/run-pass/overloaded-autoderef-vtable.rs
src/test/run-pass/overloaded-autoderef.rs
src/test/run-pass/overloaded-calls-object-one-arg.rs
src/test/run-pass/overloaded-calls-object-two-args.rs
src/test/run-pass/overloaded-calls-object-zero-args.rs
src/test/run-pass/overloaded-calls-zero-args.rs
src/test/run-pass/overloaded-deref-count.rs
src/test/run-pass/overloaded-deref.rs
src/test/run-pass/overloaded-index-autoderef.rs
src/test/run-pass/overloaded-index-in-field.rs
src/test/run-pass/overloaded-index.rs
src/test/run-pass/packed-struct-borrow-element.rs
src/test/run-pass/packed-struct-match.rs
src/test/run-pass/panic-in-dtor-drops-fields.rs
src/test/run-pass/parameterized-trait-with-bounds.rs
src/test/run-pass/path.rs
src/test/run-pass/pattern-bound-var-in-for-each.rs
src/test/run-pass/pattern-in-closure.rs
src/test/run-pass/pred-not-bool.rs
src/test/run-pass/preempt.rs
src/test/run-pass/priv-impl-prim-ty.rs
src/test/run-pass/private-class-field.rs
src/test/run-pass/private-method.rs
src/test/run-pass/ptr-coercion.rs
src/test/run-pass/pure-sum.rs
src/test/run-pass/range.rs
src/test/run-pass/ranges-precedence.rs
src/test/run-pass/rcvr-borrowed-to-region.rs
src/test/run-pass/rcvr-borrowed-to-slice.rs
src/test/run-pass/readalias.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/rec-extend.rs
src/test/run-pass/rec-tup.rs
src/test/run-pass/rec.rs
src/test/run-pass/record-pat.rs
src/test/run-pass/reexport-should-still-link.rs
src/test/run-pass/reexported-static-methods-cross-crate.rs
src/test/run-pass/regions-addr-of-interior-of-unique-box.rs
src/test/run-pass/regions-addr-of-ret.rs
src/test/run-pass/regions-borrow-at.rs
src/test/run-pass/regions-borrow-evec-fixed.rs
src/test/run-pass/regions-borrow-evec-uniq.rs
src/test/run-pass/regions-borrow-uniq.rs
src/test/run-pass/regions-bot.rs
src/test/run-pass/regions-close-over-type-parameter-successfully.rs
src/test/run-pass/regions-creating-enums2.rs
src/test/run-pass/regions-creating-enums5.rs
src/test/run-pass/regions-dependent-addr-of.rs
src/test/run-pass/regions-dependent-autoslice.rs
src/test/run-pass/regions-dependent-let-ref.rs
src/test/run-pass/regions-early-bound-lifetime-in-assoc-fn.rs
src/test/run-pass/regions-early-bound-trait-param.rs
src/test/run-pass/regions-early-bound-used-in-bound-method.rs
src/test/run-pass/regions-early-bound-used-in-bound.rs
src/test/run-pass/regions-early-bound-used-in-type-param.rs
src/test/run-pass/regions-escape-into-other-fn.rs
src/test/run-pass/regions-expl-self.rs
src/test/run-pass/regions-fn-subtyping-2.rs
src/test/run-pass/regions-fn-subtyping.rs
src/test/run-pass/regions-infer-borrow-scope.rs
src/test/run-pass/regions-infer-call-2.rs
src/test/run-pass/regions-infer-call.rs
src/test/run-pass/regions-infer-contravariance-due-to-ret.rs
src/test/run-pass/regions-infer-reborrow-ref-mut-recurse.rs
src/test/run-pass/regions-infer-region-in-fn-but-not-type.rs
src/test/run-pass/regions-infer-static-from-proc.rs
src/test/run-pass/regions-lifetime-nonfree-late-bound.rs
src/test/run-pass/regions-lifetime-static-items-enclosing-scopes.rs
src/test/run-pass/regions-link-fn-args.rs
src/test/run-pass/regions-mock-tcx.rs
src/test/run-pass/regions-mock-trans.rs
src/test/run-pass/regions-nullary-variant.rs
src/test/run-pass/regions-params.rs
src/test/run-pass/regions-reassign-let-bound-pointer.rs
src/test/run-pass/regions-reassign-match-bound-pointer.rs
src/test/run-pass/regions-relate-bound-regions-on-closures-to-inference-variables.rs
src/test/run-pass/regions-self-impls.rs
src/test/run-pass/regions-self-in-enums.rs
src/test/run-pass/regions-simple.rs
src/test/run-pass/regions-variance-contravariant-use-contravariant.rs
src/test/run-pass/regions-variance-covariant-use-covariant.rs
src/test/run-pass/repeat-expr-in-static.rs
src/test/run-pass/resolve-issue-2428.rs
src/test/run-pass/resource-assign-is-not-copy.rs
src/test/run-pass/resource-destruct.rs
src/test/run-pass/ret-bang.rs
src/test/run-pass/ret-none.rs
src/test/run-pass/return-from-closure.rs
src/test/run-pass/running-with-no-runtime.rs
src/test/run-pass/rust-log-filter.rs
src/test/run-pass/segfault-no-out-of-stack.rs
src/test/run-pass/self-impl.rs
src/test/run-pass/self-in-mut-slot-default-method.rs
src/test/run-pass/self-in-mut-slot-immediate-value.rs
src/test/run-pass/self-shadowing-import.rs
src/test/run-pass/self-type-param.rs
src/test/run-pass/send-resource.rs
src/test/run-pass/send_str_hashmap.rs
src/test/run-pass/send_str_treemap.rs
src/test/run-pass/sendable-class.rs
src/test/run-pass/sendfn-is-a-block.rs
src/test/run-pass/sendfn-spawn-with-fn-arg.rs
src/test/run-pass/sepcomp-cci.rs
src/test/run-pass/sepcomp-extern.rs
src/test/run-pass/sepcomp-fns-backwards.rs
src/test/run-pass/sepcomp-fns.rs
src/test/run-pass/sepcomp-statics.rs
src/test/run-pass/sepcomp-unwind.rs
src/test/run-pass/shadow.rs
src/test/run-pass/shift.rs
src/test/run-pass/signal-exit-status.rs
src/test/run-pass/signed-shift-const-eval.rs
src/test/run-pass/simple-generic-match.rs
src/test/run-pass/simple-match-generic-tag.rs
src/test/run-pass/size-and-align.rs
src/test/run-pass/slice-2.rs
src/test/run-pass/slice-panic-1.rs
src/test/run-pass/slice-panic-2.rs
src/test/run-pass/slice.rs
src/test/run-pass/smallest-hello-world.rs
src/test/run-pass/spawn-fn.rs
src/test/run-pass/spawn-types.rs
src/test/run-pass/spawn.rs
src/test/run-pass/spawn2.rs
src/test/run-pass/stable-addr-of.rs
src/test/run-pass/static-fn-inline-xc.rs
src/test/run-pass/static-fn-trait-xc.rs
src/test/run-pass/static-function-pointer-xc.rs
src/test/run-pass/static-function-pointer.rs
src/test/run-pass/static-impl.rs
src/test/run-pass/static-method-in-trait-with-tps-intracrate.rs
src/test/run-pass/static-method-xcrate.rs
src/test/run-pass/static-methods-in-traits.rs
src/test/run-pass/static-mut-xc.rs
src/test/run-pass/struct-aliases.rs
src/test/run-pass/struct-like-variant-construct.rs
src/test/run-pass/struct-like-variant-match.rs
src/test/run-pass/struct-new-as-field-name.rs
src/test/run-pass/struct-order-of-eval-1.rs
src/test/run-pass/struct-partial-move-1.rs
src/test/run-pass/struct-partial-move-2.rs
src/test/run-pass/struct-pattern-matching.rs
src/test/run-pass/struct-return.rs
src/test/run-pass/struct-variant-field-visibility.rs
src/test/run-pass/structured-compare.rs
src/test/run-pass/super-fast-paren-parsing.rs
src/test/run-pass/supported-cast.rs
src/test/run-pass/swap-2.rs
src/test/run-pass/swap-overlapping.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-u64.rs
src/test/run-pass/tag-variant-disr-val.rs
src/test/run-pass/tag.rs
src/test/run-pass/tail-cps.rs
src/test/run-pass/tail-direct.rs
src/test/run-pass/task-comm-0.rs
src/test/run-pass/task-comm-11.rs
src/test/run-pass/task-comm-12.rs
src/test/run-pass/task-comm-13.rs
src/test/run-pass/task-comm-14.rs
src/test/run-pass/task-comm-15.rs
src/test/run-pass/task-comm-16.rs
src/test/run-pass/task-comm-3.rs
src/test/run-pass/task-comm-4.rs
src/test/run-pass/task-comm-5.rs
src/test/run-pass/task-comm-6.rs
src/test/run-pass/task-comm-7.rs
src/test/run-pass/task-comm-9.rs
src/test/run-pass/task-spawn-move-and-copy.rs
src/test/run-pass/tcp-accept-stress.rs
src/test/run-pass/terminate-in-initializer.rs
src/test/run-pass/threads.rs
src/test/run-pass/trailing-comma.rs
src/test/run-pass/trait-bounds-impl-comparison-duplicates.rs
src/test/run-pass/trait-bounds-in-arc.rs
src/test/run-pass/trait-bounds.rs
src/test/run-pass/trait-coercion-generic.rs
src/test/run-pass/trait-coercion.rs
src/test/run-pass/trait-default-method-bound-subst2.rs
src/test/run-pass/trait-default-method-bound-subst3.rs
src/test/run-pass/trait-default-method-bound-subst4.rs
src/test/run-pass/trait-default-method-bound.rs
src/test/run-pass/trait-default-method-xc-2.rs
src/test/run-pass/trait-default-method-xc.rs
src/test/run-pass/trait-generic.rs
src/test/run-pass/trait-impl.rs
src/test/run-pass/trait-inheritance-auto-xc-2.rs
src/test/run-pass/trait-inheritance-auto-xc.rs
src/test/run-pass/trait-inheritance-auto.rs
src/test/run-pass/trait-inheritance-call-bound-inherited.rs
src/test/run-pass/trait-inheritance-call-bound-inherited2.rs
src/test/run-pass/trait-inheritance-cast-without-call-to-supertrait.rs
src/test/run-pass/trait-inheritance-cast.rs
src/test/run-pass/trait-inheritance-cross-trait-call-xc.rs
src/test/run-pass/trait-inheritance-cross-trait-call.rs
src/test/run-pass/trait-inheritance-diamond.rs
src/test/run-pass/trait-inheritance-multiple-inheritors.rs
src/test/run-pass/trait-inheritance-multiple-params.rs
src/test/run-pass/trait-inheritance-num0.rs
src/test/run-pass/trait-inheritance-num2.rs
src/test/run-pass/trait-inheritance-num5.rs
src/test/run-pass/trait-inheritance-overloading-simple.rs
src/test/run-pass/trait-inheritance-overloading-xc-exe.rs
src/test/run-pass/trait-inheritance-overloading.rs
src/test/run-pass/trait-inheritance-self.rs
src/test/run-pass/trait-inheritance-simple.rs
src/test/run-pass/trait-inheritance-static.rs
src/test/run-pass/trait-inheritance-static2.rs
src/test/run-pass/trait-inheritance-subst.rs
src/test/run-pass/trait-inheritance-subst2.rs
src/test/run-pass/trait-inheritance-visibility.rs
src/test/run-pass/trait-inheritance2.rs
src/test/run-pass/trait-object-generics.rs
src/test/run-pass/trait-region-pointer-simple.rs
src/test/run-pass/trait-safety-ok-cc.rs
src/test/run-pass/trait-safety-ok.rs
src/test/run-pass/trait-to-str.rs
src/test/run-pass/trait-with-bounds-default.rs
src/test/run-pass/traits-conditional-model-fn.rs
src/test/run-pass/traits-default-method-mut.rs
src/test/run-pass/traits-default-method-self.rs
src/test/run-pass/traits-default-method-trivial.rs
src/test/run-pass/traits-multidispatch-infer-convert-target.rs
src/test/run-pass/transmute-non-immediate-to-immediate.rs
src/test/run-pass/tup.rs
src/test/run-pass/tuple-index-fat-types.rs
src/test/run-pass/tuple-index.rs
src/test/run-pass/tuple-struct-construct.rs
src/test/run-pass/tuple-struct-constructor-pointer.rs
src/test/run-pass/tuple-struct-destructuring.rs
src/test/run-pass/tuple-struct-matching.rs
src/test/run-pass/tuple-struct-trivial.rs
src/test/run-pass/tydesc-name.rs
src/test/run-pass/type-id-higher-rank.rs
src/test/run-pass/type-in-nested-module.rs
src/test/run-pass/type-namespace.rs
src/test/run-pass/type-param-constraints.rs
src/test/run-pass/type-params-in-for-each.rs
src/test/run-pass/type-ptr.rs
src/test/run-pass/type-sizes.rs
src/test/run-pass/typeck-macro-interaction-issue-8852.rs
src/test/run-pass/typeid-intrinsic.rs
src/test/run-pass/ufcs-explicit-self.rs
src/test/run-pass/uint.rs
src/test/run-pass/unary-minus-suffix-inference.rs
src/test/run-pass/unboxed-closures-all-traits.rs
src/test/run-pass/unboxed-closures-call-fn-autoderef.rs
src/test/run-pass/unboxed-closures-call-sugar-autoderef.rs
src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs
src/test/run-pass/unboxed-closures-call-sugar-object.rs
src/test/run-pass/unboxed-closures-cross-crate.rs
src/test/run-pass/unboxed-closures-drop.rs
src/test/run-pass/unboxed-closures-extern-fn-hr.rs
src/test/run-pass/unboxed-closures-extern-fn.rs
src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs
src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs
src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs
src/test/run-pass/unboxed-closures-monomorphization.rs
src/test/run-pass/unboxed-closures-move-mutable.rs
src/test/run-pass/unboxed-closures-prelude.rs
src/test/run-pass/unboxed-closures-simple.rs
src/test/run-pass/unboxed-closures-single-word-env.rs
src/test/run-pass/unboxed-closures-unique-type-id.rs
src/test/run-pass/unfold-cross-crate.rs
src/test/run-pass/unify-return-ty.rs
src/test/run-pass/uniq-self-in-mut-slot.rs
src/test/run-pass/unique-autoderef-field.rs
src/test/run-pass/unique-containing-tag.rs
src/test/run-pass/unique-decl.rs
src/test/run-pass/unique-destructure.rs
src/test/run-pass/unique-fn-arg-move.rs
src/test/run-pass/unique-fn-arg-mut.rs
src/test/run-pass/unique-fn-arg.rs
src/test/run-pass/unique-fn-ret.rs
src/test/run-pass/unique-in-tag.rs
src/test/run-pass/unique-object-move.rs
src/test/run-pass/unique-pat-2.rs
src/test/run-pass/unique-pat-3.rs
src/test/run-pass/unique-rec.rs
src/test/run-pass/unique-send-2.rs
src/test/run-pass/unnamed_argument_mode.rs
src/test/run-pass/unsafe-pointer-assignability.rs
src/test/run-pass/unsized2.rs
src/test/run-pass/use-crate-name-alias.rs
src/test/run-pass/use-import-export.rs
src/test/run-pass/use-trait-before-def.rs
src/test/run-pass/use-uninit-match.rs
src/test/run-pass/use-uninit-match2.rs
src/test/run-pass/use.rs
src/test/run-pass/utf8.rs
src/test/run-pass/utf8_idents.rs
src/test/run-pass/variant-structs-trivial.rs
src/test/run-pass/vec-concat.rs
src/test/run-pass/vec-dst.rs
src/test/run-pass/vec-fixed-length.rs
src/test/run-pass/vec-late-init.rs
src/test/run-pass/vec-macro-no-std.rs
src/test/run-pass/vec-matching-autoslice.rs
src/test/run-pass/vec-matching-fixed.rs
src/test/run-pass/vec-matching-fold.rs
src/test/run-pass/vec-matching-legal-tail-element-borrow.rs
src/test/run-pass/vec-matching.rs
src/test/run-pass/vec-repeat-with-cast.rs
src/test/run-pass/vec-slice-drop.rs
src/test/run-pass/vec-tail-matching.rs
src/test/run-pass/vec-to_str.rs
src/test/run-pass/vec.rs
src/test/run-pass/vector-no-ann-2.rs
src/test/run-pass/warn-ctypes-inhibit.rs
src/test/run-pass/weak-lang-item.rs
src/test/run-pass/weird-exprs.rs
src/test/run-pass/wf-bound-region-in-object-type.rs
src/test/run-pass/where-clause-early-bound-lifetimes.rs
src/test/run-pass/where-clause-region-outlives.rs
src/test/run-pass/where-clauses-cross-crate.rs
src/test/run-pass/where-clauses-lifetimes.rs
src/test/run-pass/where-clauses.rs
src/test/run-pass/while-flow-graph.rs
src/test/run-pass/while-let.rs
src/test/run-pass/while-loop-constraints-2.rs
src/test/run-pass/while-prelude-drop.rs
src/test/run-pass/while-with-break.rs
src/test/run-pass/while.rs
src/test/run-pass/writealias.rs
src/test/run-pass/x86stdcall.rs
src/test/run-pass/x86stdcall2.rs
src/test/run-pass/xcrate-address-insignificant.rs
src/test/run-pass/xcrate-trait-lifetime-param.rs
src/test/run-pass/yield2.rs
src/test/run-pass/zero-size-type-destructors.rs
src/test/run-pass/zero_sized_subslice_match.rs

index f7934b2fa7051874bc77fa7f69da8c2db716535d..4109797a55ee707811bd3073b1c33bd484682e1e 100644 (file)
@@ -606,7 +606,7 @@ Peter Schuller <peter.schuller@infidyne.com>
 Peter Williams <peter@newton.cx>
 Peter Zotov <whitequark@whitequark.org>
 Petter Remen <petter.remen@gmail.com>
-Phil Dawes <pdawes@drw.com>
+Phil Dawes <phil@phildawes.net>
 Phil Ruffwind <rf@rufflewind.com>
 Philip Munksgaard <pmunksgaard@gmail.com>
 Philipp Brüschweiler <blei42@gmail.com>
index 683c7fd0563961c3056d115319eefcf878cc36f4..ca73c1cf8b1c37e15be146d436a8f3731633cf28 100755 (executable)
--- a/configure
+++ b/configure
@@ -404,7 +404,7 @@ case $CFG_OSTYPE in
         CFG_OSTYPE=pc-windows-gnu
         ;;
 
-# Thad's Cygwin identifers below
+# Thad's Cygwin identifiers below
 
 #   Vista 32 bit
     CYGWIN_NT-6.0)
@@ -526,7 +526,8 @@ VAL_OPTIONS=""
 opt valgrind 0 "run tests with valgrind (memcheck by default)"
 opt helgrind 0 "run tests with helgrind instead of memcheck"
 opt valgrind-rpass 1 "run rpass-valgrind tests with valgrind"
-opt docs     1 "build documentation"
+opt docs     1 "build standard library documentation"
+opt compiler-docs     0 "build compiler documentation"
 opt optimize 1 "build optimized rust code"
 opt optimize-cxx 1 "build optimized C++ code"
 opt optimize-llvm 1 "build optimized LLVM"
index 13e4d8cdeb824af3b5b831cd30418dc27c6f0eb9..f594a6a19f1580ab9f5c489b7fcb969dc2ff4b7d 100644 (file)
@@ -122,17 +122,34 @@ ONLY_RLIB_rustc_bitflags := 1
 # You should not need to edit below this line
 ################################################################################
 
+# On channels where the only usable crate is std, only build documentation for
+# std. This keeps distributions small and doesn't clutter up the API docs with
+# confusing internal details from the crates behind the facade.
+#
+# (Disabled while cmr figures out how to change rustdoc to make reexports work
+# slightly nicer. Otherwise, all cross-crate links to Vec will go to
+# libcollections, breaking them, and [src] links for anything reexported will
+# not work.)
+
+#ifeq ($(CFG_RELEASE_CHANNEL),stable)
+#DOC_CRATES := std
+#else
+#ifeq ($(CFG_RELEASE_CHANNEL),beta)
+#DOC_CRATES := std
+#else
 DOC_CRATES := $(filter-out rustc, \
-              $(filter-out rustc_trans, \
-              $(filter-out rustc_typeck, \
-              $(filter-out rustc_borrowck, \
-              $(filter-out rustc_resolve, \
-              $(filter-out rustc_driver, \
-              $(filter-out rustc_privacy, \
-              $(filter-out rustc_lint, \
-              $(filter-out log, \
-              $(filter-out getopts, \
-              $(filter-out syntax, $(CRATES))))))))))))
+          $(filter-out rustc_trans, \
+          $(filter-out rustc_typeck, \
+          $(filter-out rustc_borrowck, \
+          $(filter-out rustc_resolve, \
+          $(filter-out rustc_driver, \
+          $(filter-out rustc_privacy, \
+          $(filter-out rustc_lint, \
+          $(filter-out log, \
+          $(filter-out getopts, \
+          $(filter-out syntax, $(CRATES))))))))))))
+#endif
+#endif
 COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
                        rustc_typeck rustc_driver syntax rustc_privacy \
                        rustc_lint
index f7ab86d3a29b92d2dde26091d38dc578758ec25a..d297055ba9acb6e3b5c2b322f38ddcccc3b35949 100644 (file)
@@ -259,7 +259,10 @@ doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1)) doc/$(1)/
 endef
 
 $(foreach crate,$(DOC_CRATES),$(eval $(call DEF_LIB_DOC,$(crate),DOC_TARGETS)))
-$(foreach crate,$(COMPILER_DOC_CRATES),$(eval $(call DEF_LIB_DOC,$(crate),COMPILER_DOC_TARGETS)))
+
+ifdef CFG_COMPILER_DOCS
+  $(foreach crate,$(COMPILER_DOC_CRATES),$(eval $(call DEF_LIB_DOC,$(crate),COMPILER_DOC_TARGETS)))
+endif
 
 ifdef CFG_DISABLE_DOCS
   $(info cfg: disabling doc build (CFG_DISABLE_DOCS))
index ed50585822ed432448079d431c9f28442f35896a..cd86b273c6de21a952bdbc524cec890d1788728f 100644 (file)
@@ -179,7 +179,7 @@ define CFG_MAKE_TOOLCHAIN
 
   ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),)
 
-  # On Bitrig, we need the relocation model to be PIC for everthing
+  # On Bitrig, we need the relocation model to be PIC for everything
   ifeq (,$(filter $(OSTYPE_$(1)),bitrig))
     LLVM_MC_RELOCATION_MODEL="pic"
   else
index da18a9a43924ae97eaed78cd57901e75cffc4545..8cc74a9cbfb76f81b77d67843c569725bf7da40c 100644 (file)
@@ -132,7 +132,7 @@ endef
 # on $$(TSREQ$(1)_T_$(2)_H_$(3)), to ensure that no products will be
 # put into the target area until after the get-snapshot.py script has
 # had its chance to clean it out; otherwise the other products will be
-# inadvertantly included in the clean out.
+# inadvertently included in the clean out.
 SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD))
 
 define TARGET_HOST_RULES
index 1ee5917ac9c91b7dbdc734d4f114ed9b2dea7454..f0aacc1460b3fa7b372b6919e632ece9921aea36 100644 (file)
@@ -12,9 +12,7 @@
 
 #![feature(box_syntax)]
 #![feature(collections)]
-#![feature(int_uint)]
 #![feature(old_io)]
-#![feature(old_path)]
 #![feature(rustc_private)]
 #![feature(unboxed_closures)]
 #![feature(std_misc)]
index 2b0e7985229e2bd85e81ba97b5a0b8c05b52dc35..4b2a3e0283dc2a54347045890d03e7bffeb29a5e 100644 (file)
 use std::path::Path;
 
 pub struct ExpectedError {
-    pub line: uint,
+    pub line: usize,
     pub kind: String,
     pub msg: String,
 }
 
 #[derive(PartialEq, Debug)]
-enum WhichLine { ThisLine, FollowPrevious(uint), AdjustBackward(uint) }
+enum WhichLine { ThisLine, FollowPrevious(usize), AdjustBackward(usize) }
 
 /// Looks for either "//~| KIND MESSAGE" or "//~^^... KIND MESSAGE"
 /// The former is a "follow" that inherits its target from the preceding line;
@@ -58,8 +58,8 @@ pub fn load_errors(testfile: &Path) -> Vec<ExpectedError> {
     }).collect()
 }
 
-fn parse_expected(last_nonfollow_error: Option<uint>,
-                  line_num: uint,
+fn parse_expected(last_nonfollow_error: Option<usize>,
+                  line_num: usize,
                   line: &str) -> Option<(WhichLine, ExpectedError)> {
     let start = match line.find("//~") { Some(i) => i, None => return None };
     let (follow, adjusts) = if line.char_at(start + 3) == '|' {
index 461b5af6204edced4155e7ace9b3f5ab533c3c2c..9612c0e06a34d7b311fb08db18b5181e7ac2fe7f 100644 (file)
@@ -357,7 +357,7 @@ pub fn parse_name_value_directive(line: &str, directive: &str)
     }
 }
 
-pub fn gdb_version_to_int(version_string: &str) -> int {
+pub fn gdb_version_to_int(version_string: &str) -> isize {
     let error_string = format!(
         "Encountered GDB version string with unexpected format: {}",
         version_string);
@@ -369,17 +369,17 @@ pub fn gdb_version_to_int(version_string: &str) -> int {
         panic!("{}", error_string);
     }
 
-    let major: int = components[0].parse().ok().expect(&error_string);
-    let minor: int = components[1].parse().ok().expect(&error_string);
+    let major: isize = components[0].parse().ok().expect(&error_string);
+    let minor: isize = components[1].parse().ok().expect(&error_string);
 
     return major * 1000 + minor;
 }
 
-pub fn lldb_version_to_int(version_string: &str) -> int {
+pub fn lldb_version_to_int(version_string: &str) -> isize {
     let error_string = format!(
         "Encountered LLDB version string with unexpected format: {}",
         version_string);
     let error_string = error_string;
-    let major: int = version_string.parse().ok().expect(&error_string);
+    let major: isize = version_string.parse().ok().expect(&error_string);
     return major;
 }
index ceed88b6236fd5f9a0f5c2bb588f1b49570bb126..b30efaa6c29d80c73bfef4c4c75c32e7cf393fb0 100644 (file)
@@ -8,11 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(deprecated)] // for old path, for dynamic_lib
-
 use std::dynamic_lib::DynamicLibrary;
 use std::io::prelude::*;
-use std::old_path::Path;
+use std::path::PathBuf;
 use std::process::{ExitStatus, Command, Child, Output, Stdio};
 
 fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) {
@@ -20,15 +18,15 @@ fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) {
     // search path for the child.
     let mut path = DynamicLibrary::search_path();
     match aux_path {
-        Some(p) => path.insert(0, Path::new(p)),
+        Some(p) => path.insert(0, PathBuf::from(p)),
         None => {}
     }
-    path.insert(0, Path::new(lib_path));
+    path.insert(0, PathBuf::from(lib_path));
 
     // Add the new dylib search path var
     let var = DynamicLibrary::envvar();
     let newpath = DynamicLibrary::create_path(&path);
-    let newpath = String::from_utf8(newpath).unwrap();
+    let newpath = newpath.to_str().unwrap().to_string();
     cmd.env(var, &newpath);
 }
 
index 1666124b46a6185febf95b484ba3546645abbeab..23267c3e93472cb0b4f3faf59fd675594635e13d 100644 (file)
@@ -758,7 +758,7 @@ fn run_lldb(config: &Config,
 struct DebuggerCommands {
     commands: Vec<String>,
     check_lines: Vec<String>,
-    breakpoint_lines: Vec<uint>,
+    breakpoint_lines: Vec<usize>,
 }
 
 fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
@@ -1036,7 +1036,7 @@ fn is_compiler_error_or_warning(line: &str) -> bool {
          scan_string(line, "warning", &mut i));
 }
 
-fn scan_until_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
+fn scan_until_char(haystack: &str, needle: char, idx: &mut usize) -> bool {
     if *idx >= haystack.len() {
         return false;
     }
@@ -1048,7 +1048,7 @@ fn scan_until_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
     return true;
 }
 
-fn scan_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
+fn scan_char(haystack: &str, needle: char, idx: &mut usize) -> bool {
     if *idx >= haystack.len() {
         return false;
     }
@@ -1060,7 +1060,7 @@ fn scan_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
     return true;
 }
 
-fn scan_integer(haystack: &str, idx: &mut uint) -> bool {
+fn scan_integer(haystack: &str, idx: &mut usize) -> bool {
     let mut i = *idx;
     while i < haystack.len() {
         let ch = haystack.char_at(i);
@@ -1076,7 +1076,7 @@ fn scan_integer(haystack: &str, idx: &mut uint) -> bool {
     return true;
 }
 
-fn scan_string(haystack: &str, needle: &str, idx: &mut uint) -> bool {
+fn scan_string(haystack: &str, needle: &str, idx: &mut usize) -> bool {
     let mut haystack_i = *idx;
     let mut needle_i = 0;
     while needle_i < needle.len() {
@@ -1725,7 +1725,7 @@ fn disassemble_extract(config: &Config, _props: &TestProps,
 }
 
 
-fn count_extracted_lines(p: &Path) -> uint {
+fn count_extracted_lines(p: &Path) -> usize {
     let mut x = Vec::new();
     File::open(&p.with_extension("ll")).unwrap().read_to_end(&mut x).unwrap();
     let x = str::from_utf8(&x).unwrap();
index 2e11cf47d1e56fa2bf7c09e04457ca848cbe3ff1..a8b26cb3ef76835a5fb498ca76a347eabcfee5e8 100644 (file)
 
 /// Conversion table from triple OS name to Rust SYSNAME
 const OS_TABLE: &'static [(&'static str, &'static str)] = &[
-    ("mingw32", "windows"),
-    ("win32", "windows"),
-    ("windows", "windows"),
-    ("darwin", "macos"),
     ("android", "android"),
-    ("linux", "linux"),
-    ("freebsd", "freebsd"),
-    ("dragonfly", "dragonfly"),
     ("bitrig", "bitrig"),
+    ("darwin", "macos"),
+    ("dragonfly", "dragonfly"),
+    ("freebsd", "freebsd"),
+    ("ios", "ios"),
+    ("linux", "linux"),
+    ("mingw32", "windows"),
     ("openbsd", "openbsd"),
+    ("win32", "windows"),
+    ("windows", "windows"),
 ];
 
 const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
-    ("i386", "x86"),
-    ("i686", "x86"),
+    ("aarch64", "aarch64"),
     ("amd64", "x86_64"),
-    ("x86_64", "x86_64"),
-    ("sparc", "sparc"),
-    ("powerpc", "powerpc"),
-    ("arm64", "aarch64"),
     ("arm", "arm"),
-    ("aarch64", "aarch64"),
+    ("arm64", "aarch64"),
+    ("hexagon", "hexagon"),
+    ("i386", "x86"),
+    ("i686", "x86"),
     ("mips", "mips"),
-    ("xcore", "xcore"),
     ("msp430", "msp430"),
-    ("hexagon", "hexagon"),
+    ("powerpc", "powerpc"),
     ("s390x", "systemz"),
+    ("sparc", "sparc"),
+    ("x86_64", "x86_64"),
+    ("xcore", "xcore"),
 ];
 
 pub fn get_os(triple: &str) -> &'static str {
index 32088b2ab67bf9dbed624557bd0e12ad30eb23e6..0bc4414999d74e320e6968e410e3211a39237e01 100644 (file)
@@ -645,18 +645,7 @@ fn bar() {
 
 A number of minor features of Rust are not central enough to have their own
 syntax, and yet are not implementable as functions. Instead, they are given
-names, and invoked through a consistent syntax: `name!(...)`. Examples include:
-
-* `format!` : format data into a string
-* `env!` : look up an environment variable's value at compile time
-* `file!`: return the path to the file being compiled
-* `stringify!` : pretty-print the Rust expression given as an argument
-* `include!` : include the Rust expression in the given file
-* `include_str!` : include the contents of the given file as a string
-* `include_bytes!` : include the contents of the given file as a binary blob
-* `error!`, `warn!`, `info!`, `debug!` : provide diagnostic information.
-
-All of the above extensions are expressions with values.
+names, and invoked through a consistent syntax: `some_extension!(...)`.
 
 Users of `rustc` can define new syntax extensions in two ways:
 
@@ -744,38 +733,6 @@ Rust syntax is restricted in two ways:
    pairs when they occur at the beginning of, or immediately after, a `$(...)*`;
    requiring a distinctive token in front can solve the problem.
 
-## Syntax extensions useful in macros
-
-* `stringify!` : turn the identifier argument into a string literal
-* `concat!` : concatenates a comma-separated list of literals
-
-## Syntax extensions for macro debugging
-
-* `log_syntax!` : print out the arguments at compile time
-* `trace_macros!` : supply `true` or `false` to enable or disable macro expansion logging
-
-## Quasiquoting
-
-The following syntax extensions are used for quasiquoting Rust syntax trees,
-usually in [procedural macros](book/plugins.html#syntax-extensions):
-
-* `quote_expr!`
-* `quote_item!`
-* `quote_pat!`
-* `quote_stmt!`
-* `quote_tokens!`
-* `quote_matcher!`
-* `quote_ty!`
-* `quote_attr!`
-
-Keep in mind that when `$name : ident` appears in the input to
-`quote_tokens!`, the result contains unquoted `name` followed by two tokens.
-However, input of the same form passed to `quote_matcher!` becomes a
-quasiquoted MBE-matcher of a nonterminal. No unquotation happens. Otherwise
-the result of `quote_matcher!` is identical to that of `quote_tokens!`.
-
-Documentation is very limited at the moment.
-
 # Crates and source files
 
 Rust is a *compiled* language. Its semantics obey a *phase distinction*
@@ -980,7 +937,7 @@ extern crate pcre;
 
 extern crate std; // equivalent to: extern crate std as std;
 
-extern crate "std" as ruststd; // linking to 'std' under another name
+extern crate std as ruststd; // linking to 'std' under another name
 ```
 
 ##### Use declarations
@@ -1231,12 +1188,15 @@ the guarantee that these issues are never caused by safe code.
 
 * Data races
 * Dereferencing a null/dangling raw pointer
-* Mutating an immutable value/reference without `UnsafeCell`
 * Reads of [undef](http://llvm.org/docs/LangRef.html#undefined-values)
   (uninitialized) memory
 * Breaking the [pointer aliasing
   rules](http://llvm.org/docs/LangRef.html#pointer-aliasing-rules)
   with raw pointers (a subset of the rules used by C)
+* `&mut` and `&` follow LLVM’s scoped [noalias] model, except if the `&T`
+  contains an `UnsafeCell<U>`. Unsafe code must not violate these aliasing
+  guarantees.
+* Mutating an immutable value/reference without `UnsafeCell<U>`
 * Invoking undefined behavior via compiler intrinsics:
   * Indexing outside of the bounds of an object with `std::ptr::offset`
     (`offset` intrinsic), with
@@ -1253,6 +1213,8 @@ the guarantee that these issues are never caused by safe code.
   code. Rust's failure system is not compatible with exception handling in
   other languages. Unwinding must be caught and handled at FFI boundaries.
 
+[noalias]: http://llvm.org/docs/LangRef.html#noalias
+
 ##### Behaviour not considered unsafe
 
 This is a list of behaviour not considered *unsafe* in Rust terms, but that may
@@ -1521,22 +1483,6 @@ statics:
 Constants should in general be preferred over statics, unless large amounts of
 data are being stored, or single-address and mutability properties are required.
 
-```
-use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
-
-// Note that ATOMIC_USIZE_INIT is a *const*, but it may be used to initialize a
-// static. This static can be modified, so it is not placed in read-only memory.
-static COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
-
-// This table is a candidate to be placed in read-only memory.
-static TABLE: &'static [usize] = &[1, 2, 3, /* ... */];
-
-for slot in TABLE.iter() {
-    println!("{}", slot);
-}
-COUNTER.fetch_add(1, Ordering::SeqCst);
-```
-
 #### Mutable statics
 
 If a static item is declared with the `mut` keyword, then it is allowed to
@@ -2376,18 +2322,6 @@ impl<T: PartialEq> PartialEq for Foo<T> {
 }
 ```
 
-Supported traits for `derive` are:
-
-* Comparison traits: `PartialEq`, `Eq`, `PartialOrd`, `Ord`.
-* Serialization: `Encodable`, `Decodable`. These require `serialize`.
-* `Clone`, to create `T` from `&T` via a copy.
-* `Default`, to create an empty instance of a data type.
-* `FromPrimitive`, to create an instance from a numeric primitive.
-* `Hash`, to iterate over the bytes in a data type.
-* `Rand`, to create a random instance of a data type.
-* `Debug`, to format a value using the `{:?}` formatter.
-* `Copy`, for "Plain Old Data" types which can be copied by simply moving bits.
-
 ### Compiler Features
 
 Certain aspects of Rust may be implemented in the compiler, but they're not
@@ -2408,9 +2342,13 @@ considered off, and using the features will result in a compiler error.
 
 The currently implemented features of the reference compiler are:
 
-* `advanced_slice_patterns` - see the [match expressions](#match-expressions)
+* `advanced_slice_patterns` - See the [match expressions](#match-expressions)
                               section for discussion; the exact semantics of
-                              slice patterns are subject to change.
+                              slice patterns are subject to change, so some types
+                             are still unstable.
+
+* `slice_patterns` - OK, actually, slice patterns are just scary and
+                     completely unstable.
 
 * `asm` - The `asm!` macro provides a means for inline assembly. This is often
           useful, but the exact syntax for this feature along with its
@@ -2440,9 +2378,6 @@ The currently implemented features of the reference compiler are:
 * `intrinsics` - Allows use of the "rust-intrinsics" ABI. Compiler intrinsics
                  are inherently unstable and no promise about them is made.
 
-* `int_uint` - Allows the use of the `int` and `uint` types, which are deprecated.
-               Use `isize` and `usize` instead.
-
 * `lang_items` - Allows use of the `#[lang]` attribute. Like `intrinsics`,
                  lang items are inherently unstable and no promise about them
                  is made.
@@ -2759,7 +2694,7 @@ The following are examples of structure expressions:
 ```
 # struct Point { x: f64, y: f64 }
 # struct TuplePoint(f64, f64);
-# mod game { pub struct User<'a> { pub name: &'a str, pub age: u32, pub score: uint } }
+# mod game { pub struct User<'a> { pub name: &'a str, pub age: u32, pub score: usize } }
 # struct Cookie; fn some_fn<T>(t: T) {}
 Point {x: 10.0, y: 20.0};
 TuplePoint(10.0, 20.0);
@@ -3329,7 +3264,7 @@ array, like `[.., 42, ..]`. If preceded by a variable name, it will bind the
 corresponding slice to the variable. Example:
 
 ```
-# #![feature(advanced_slice_patterns)]
+# #![feature(advanced_slice_patterns, slice_patterns)]
 fn is_symmetric(list: &[u32]) -> bool {
     match list {
         [] | [_]                   => true,
@@ -3402,7 +3337,7 @@ subpattern`. For example:
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 
-enum List { Nil, Cons(uint, Box<List>) }
+enum List { Nil, Cons(u32, Box<List>) }
 
 fn is_sorted(list: &List) -> bool {
     match *list {
@@ -3886,75 +3821,27 @@ impl Printable for String {
 `self` refers to the value of type `String` that is the receiver for a call to
 the method `make_string`.
 
-## Type kinds
-
-Types in Rust are categorized into kinds, based on various properties of the
-components of the type. The kinds are:
-
-* `Send`
-  : Types of this kind can be safely sent between threads.
-    This kind includes scalars, boxes, procs, and
-    structural types containing only other owned types.
-    All `Send` types are `'static`.
-* `Copy`
-  : Types of this kind consist of "Plain Old Data"
-    which can be copied by simply moving bits.
-    All values of this kind can be implicitly copied.
-    This kind includes scalars and immutable references,
-    as well as structural types containing other `Copy` types.
-* `'static`
-  : Types of this kind do not contain any references (except for
-    references with the `static` lifetime, which are allowed).
-    This can be a useful guarantee for code
-    that breaks borrowing assumptions
-    using [`unsafe` operations](#unsafe-functions).
-* `Drop`
-  : This is not strictly a kind,
-    but its presence interacts with kinds:
-    the `Drop` trait provides a single method `drop`
-    that takes no parameters,
-    and is run when values of the type are dropped.
-    Such a method is called a "destructor",
-    and are always executed in "top-down" order:
-    a value is completely destroyed
-    before any of the values it owns run their destructors.
-    Only `Send` types can implement `Drop`.
-
-* _Default_
-  : Types with destructors, closure environments,
-    and various other _non-first-class_ types,
-    are not copyable at all.
-    Such types can usually only be accessed through pointers,
-    or in some cases, moved between mutable locations.
-
-Kinds can be supplied as _bounds_ on type parameters, like traits, in which
-case the parameter is constrained to types satisfying that kind.
-
-By default, type parameters do not carry any assumed kind-bounds at all. When
-instantiating a type parameter, the kind bounds on the parameter are checked to
-be the same or narrower than the kind of the type that it is instantiated with.
-
-Sending operations are not part of the Rust language, but are implemented in
-the library. Generic functions that send values bound the kind of these values
-to sendable.
-
-# Memory and concurrency models
-
-Rust has a memory model centered around concurrently-executing _threads_. Thus
-its memory model and its concurrency model are best discussed simultaneously,
-as parts of each only make sense when considered from the perspective of the
-other.
-
-When reading about the memory model, keep in mind that it is partitioned in
-order to support threads; and when reading about threads, keep in mind that their
-isolation and communication mechanisms are only possible due to the ownership
-and lifetime semantics of the memory model.
-
-## Memory model
-
-A Rust program's memory consists of a static set of *items*, a set of
-[threads](#threads) each with its own *stack*, and a *heap*. Immutable portions of
-the heap may be shared between threads, mutable portions may not.
+# The `Copy` trait
+
+Rust has a special trait, `Copy`, which when implemented changes the semantics
+of a value. Values whose type implements `Copy` are copied rather than moved
+upon assignment.
+
+# The `Sized` trait
+
+`Sized` is a special trait which indicates that the size of this type is known
+at compile-time.
+
+# The `Drop` trait
+
+The `Drop` trait provides a destructor, to be run whenever a value of this type
+is to be destroyed.
+
+# Memory model
+
+A Rust program's memory consists of a static set of *items* and a *heap*.
+Immutable portions of the heap may be shared between threads, mutable portions
+may not.
 
 Allocations in the stack consist of *slots*, and allocations in the heap
 consist of *boxes*.
@@ -3965,10 +3852,6 @@ The _items_ of a program are those functions, modules and types that have their
 value calculated at compile-time and stored uniquely in the memory image of the
 rust process. Items are neither dynamically allocated nor freed.
 
-A thread's _stack_ consists of activation frames automatically allocated on entry
-to each function as the thread executes. A stack allocation is reclaimed when
-control leaves the frame containing it.
-
 The _heap_ is a general term that describes boxes.  The lifetime of an
 allocation in the heap depends on the lifetime of the box values pointing to
 it. Since box values may themselves be passed in and out of frames, or stored
@@ -3976,25 +3859,11 @@ in the heap, heap allocations may outlive the frame they are allocated within.
 
 ### Memory ownership
 
-A thread owns all memory it can *safely* reach through local variables, as well
-as boxes and references.
-
-When a thread sends a value that has the `Send` trait to another thread, it loses
-ownership of the value sent and can no longer refer to it. This is statically
-guaranteed by the combined use of "move semantics", and the compiler-checked
-_meaning_ of the `Send` trait: it is only instantiated for (transitively)
-sendable kinds of data constructor and pointers, never including references.
-
 When a stack frame is exited, its local allocations are all released, and its
 references to boxes are dropped.
 
-When a thread finishes, its stack is necessarily empty and it therefore has no
-references to any boxes; the remainder of its heap is immediately freed.
-
 ### Memory slots
 
-A thread's stack contains slots.
-
 A _slot_ is a component of a stack frame, either a function parameter, a
 [temporary](#lvalues,-rvalues-and-temporaries), or a local variable.
 
@@ -4024,86 +3893,6 @@ state. Subsequent statements within a function may or may not initialize the
 local variables. Local variables can be used only after they have been
 initialized; this is enforced by the compiler.
 
-### Boxes
-
-A _box_ is a reference to a heap allocation holding another value, which is
-constructed by the prefix operator `box`. When the standard library is in use,
-the type of a box is `std::owned::Box<T>`.
-
-An example of a box type and value:
-
-```
-let x: Box<i32> = Box::new(10);
-```
-
-Box values exist in 1:1 correspondence with their heap allocation, copying a
-box value makes a shallow copy of the pointer. Rust will consider a shallow
-copy of a box to move ownership of the value. After a value has been moved,
-the source location cannot be used unless it is reinitialized.
-
-```
-let x: Box<i32> = Box::new(10);
-let y = x;
-// attempting to use `x` will result in an error here
-```
-
-## Threads
-
-Rust's primary concurrency mechanism is called a **thread**.
-
-### Communication between threads
-
-Rust threads are isolated and generally unable to interfere with one another's
-memory directly, except through [`unsafe` code](#unsafe-functions).  All
-contact between threads is mediated by safe forms of ownership transfer, and data
-races on memory are prohibited by the type system.
-
-When you wish to send data between threads, the values are restricted to the
-[`Send` type-kind](#type-kinds). Restricting communication interfaces to this
-kind ensures that no references move between threads. Thus access to an entire
-data structure can be mediated through its owning "root" value; no further
-locking or copying is required to avoid data races within the substructure of
-such a value.
-
-### Thread
-
-The _lifecycle_ of a threads consists of a finite set of states and events that
-cause transitions between the states. The lifecycle states of a thread are:
-
-* running
-* blocked
-* panicked
-* dead
-
-A thread begins its lifecycle &mdash; once it has been spawned &mdash; in the
-*running* state. In this state it executes the statements of its entry
-function, and any functions called by the entry function.
-
-A thread may transition from the *running* state to the *blocked* state any time
-it makes a blocking communication call. When the call can be completed &mdash;
-when a message arrives at a sender, or a buffer opens to receive a message
-&mdash; then the blocked thread will unblock and transition back to *running*.
-
-A thread may transition to the *panicked* state at any time, due being killed by
-some external event or internally, from the evaluation of a `panic!()` macro.
-Once *panicking*, a thread unwinds its stack and transitions to the *dead* state.
-Unwinding the stack of a thread is done by the thread itself, on its own control
-stack. If a value with a destructor is freed during unwinding, the code for the
-destructor is run, also on the thread's control stack. Running the destructor
-code causes a temporary transition to a *running* state, and allows the
-destructor code to cause any subsequent state transitions. The original thread
-of unwinding and panicking thereby may suspend temporarily, and may involve
-(recursive) unwinding of the stack of a failed destructor. Nonetheless, the
-outermost unwinding activity will continue until the stack is unwound and the
-thread transitions to the *dead* state. There is no way to "recover" from thread
-panics. Once a thread has temporarily suspended its unwinding in the *panicking*
-state, a panic occurring from within this destructor results in *hard* panic.
-A hard panic currently results in the process aborting.
-
-A thread in the *dead* state cannot transition to other states; it exists only to
-have its termination status inspected by other threads, and/or to await
-reclamation when the last reference to it drops.
-
 # Runtime services, linkage and debugging
 
 The Rust _runtime_ is a relatively compact collection of Rust code that
index eb9e2b24ac900e0d7f1090cc7697c057111bec19..4a866d6224d5d134b01120deaac0b4ef4abb74d6 100644 (file)
@@ -11,8 +11,7 @@ navigate through the menu on the left.
 <h2 class="section-header"><a href="basic.html">Basics</a></h2>
 
 This section is a linear introduction to the basic syntax and semantics of
-Rust. It has individual sections on each part of Rust's syntax, and culminates
-in a small project: a guessing game.
+Rust. It has individual sections on each part of Rust's syntax.
 
 After reading "Basics," you will have a good foundation to learn more about
 Rust, and can write very simple programs.
@@ -29,7 +28,12 @@ and will be able to understand most Rust code and write more complex programs.
 
 In a similar fashion to "Intermediate," this section is full of individual,
 deep-dive chapters, which stand alone and can be read in any order. These
-chapters focus on the most complex features, as well as some things that
-are only available in upcoming versions of Rust.
+chapters focus on the most complex features,
 
-After reading "Advanced," you'll be a Rust expert!
+<h2 class="section-header"><a href="unstable.html">Unstable</a></h2>
+
+In a similar fashion to "Intermediate," this section is full of individual,
+deep-dive chapters, which stand alone and can be read in any order.
+
+This chapter contains things that are only available on the nightly channel of
+Rust.
index 70c74825a072cd7fac01e1b772f70ad659d7dba1..d31348d667b57e56e996ca86e2e64e4505f8fdde 100644 (file)
@@ -13,7 +13,6 @@
     * [Looping](looping.md)
     * [Strings](strings.md)
     * [Arrays, Vectors, and Slices](arrays-vectors-and-slices.md)
-    * [Standard Input](standard-input.md)
 * [Intermediate Rust](intermediate.md)
     * [Crates and Modules](crates-and-modules.md)
     * [Testing](testing.md)
     * [FFI](ffi.md)
     * [Unsafe Code](unsafe.md)
     * [Advanced Macros](advanced-macros.md)
+* [Unstable Rust](unstable.md)
     * [Compiler Plugins](plugins.md)
+    * [Inline Assembly](inline-assembly.md)
+    * [No stdlib](no-stdlib.md)
+    * [Intrinsics](intrinsics.md)
+    * [Lang items](lang-items.md)
+    * [Link args](link-args.md)
 * [Conclusion](conclusion.md)
 * [Glossary](glossary.md)
index 86279f7f1a1680899e6f72435826edd64c056cf1..fef458caaaf3343a1aa2e198888d005bc2ba8221 100644 (file)
@@ -206,8 +206,6 @@ the [Bitwise Cyclic Tag](http://esolangs.org/wiki/Bitwise_Cyclic_Tag) automaton
 within Rust's macro system.
 
 ```rust
-#![feature(trace_macros)]
-
 macro_rules! bct {
     // cmd 0:  d ... => ...
     (0, $($ps:tt),* ; $_d:tt)
@@ -229,13 +227,6 @@ macro_rules! bct {
     ( $($ps:tt),* ; )
         => (());
 }
-
-fn main() {
-    trace_macros!(true);
-# /* just check the definition
-    bct!(0, 0, 1, 1, 1 ; 1, 0, 1);
-# */
-}
 ```
 
 Exercise: use macros to reduce duplication in the above definition of the
index 5d0f314e8c62ec5556b804303a7ef7884647c793..2916dca2c06b01ac863415456de556f289ca44a5 100644 (file)
@@ -99,7 +99,4 @@ You can also take a slice of a vector, `String`, or `&str`, because they are
 backed by arrays. Slices have type `&[T]`, which we'll talk about when we cover
 generics.
 
-We have now learned all of the most basic Rust concepts. We're ready to start
-building ourselves a guessing game, we just need to know one last thing: how to
-get input from the keyboard. You can't have a guessing game without the ability
-to guess!
+We have now learned all of the most basic Rust concepts.
index f36c2c56b6a76d06ff21500a4495fb01c059e102..7161cd33f89be90fb147618376e23dc3c81ea7dc 100644 (file)
@@ -170,7 +170,7 @@ let obj = Box::new(graph) as Box<Graph>;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ```
 
-We can’t create a trait object like this, becuase we don’t know the associated
+We can’t create a trait object like this, because we don’t know the associated
 types. Instead, we can write this:
 
 ```rust
index 087121d0e7dc3d30e35240165ff9090bd7fcd452..c267830e6e0d0c5e0fc700713abb67ad205ef7d4 100644 (file)
@@ -1,8 +1,7 @@
 % Basics
 
 This section is a linear introduction to the basic syntax and semantics of
-Rust. It has individual sections on each part of Rust's syntax, and cumulates
-in a small project: a guessing game.
+Rust. It has individual sections on each part of Rust's syntax.
 
 After reading "Basics," you will have a good foundation to learn more about
 Rust, and can write very simple programs.
index d531a22d0e0dd55d2b2a0d5d913b88f9d3912c73..e44d2edd667a1ea822cde1798278bbc8b1fe3b55 100644 (file)
@@ -361,5 +361,4 @@ and brittle `if`/`else`s.
 
 [arity]: ./glossary.html#arity
 [match]: ./match.html
-[game]: ./guessing-game.html#comparing-guesses
 [generics]: ./generics.html
index 54821e3ce304d5dfc05045c397e56260116bc416..06071a8f15fa4e83b564bd27730cc204587b8267 100644 (file)
@@ -352,7 +352,7 @@ Here’s an example of documenting a macro:
 /// # }
 /// ```
 ///
-/// ```should_fail
+/// ```should_panic
 /// # #[macro_use] extern crate foo;
 /// # fn main() {
 /// panic_unless!(true == false, “I’m broken.”);
@@ -517,7 +517,7 @@ can be useful when changing some options, or when writing a macro.
 
 ### Re-exports
 
-`rustdoc` will show the documentation for a publc re-export in both places:
+`rustdoc` will show the documentation for a public re-export in both places:
 
 ```ignore
 extern crate foo;
@@ -529,7 +529,7 @@ This will create documentation for bar both inside the documentation for the
 crate `foo`, as well as the documentation for your crate. It will use the same
 documentation in both places.
 
-This behavior can be supressed with `no_inline`:
+This behavior can be suppressed with `no_inline`:
 
 ```ignore
 extern crate foo;
index 695279e2d5bb6983cd34a3c6903633969fa2992a..23f6e17b860b23a13da61e5e95db73eca0bf370b 100644 (file)
@@ -366,31 +366,6 @@ A few examples of how this model can be used are:
 
 On OSX, frameworks behave with the same semantics as a dynamic library.
 
-## The `link_args` attribute
-
-There is one other way to tell rustc how to customize linking, and that is via
-the `link_args` attribute. This attribute is applied to `extern` blocks and
-specifies raw flags which need to get passed to the linker when producing an
-artifact. An example usage would be:
-
-``` no_run
-#![feature(link_args)]
-
-#[link_args = "-foo -bar -baz"]
-extern {}
-# fn main() {}
-```
-
-Note that this feature is currently hidden behind the `feature(link_args)` gate
-because this is not a sanctioned way of performing linking. Right now rustc
-shells out to the system linker, so it makes sense to provide extra command line
-arguments, but this will not always be the case. In the future rustc may use
-LLVM directly to link native libraries in which case `link_args` will have no
-meaning.
-
-It is highly recommended to *not* use this attribute, and rather use the more
-formal `#[link(...)]` attribute on `extern` blocks instead.
-
 # Unsafe blocks
 
 Some operations, like dereferencing unsafe pointers or calling functions that have been marked
@@ -401,7 +376,7 @@ Unsafe functions, on the other hand, advertise it to the world. An unsafe functi
 this:
 
 ```
-unsafe fn kaboom(ptr: *const int) -> int { *ptr }
+unsafe fn kaboom(ptr: *const i32) -> i32 { *ptr }
 ```
 
 This function can only be called from an `unsafe` block or another `unsafe` function.
@@ -423,7 +398,7 @@ extern {
 
 fn main() {
     println!("You have readline version {} installed.",
-             rl_readline_version as int);
+             rl_readline_version as i32);
 }
 ```
 
diff --git a/src/doc/trpl/inline-assembly.md b/src/doc/trpl/inline-assembly.md
new file mode 100644 (file)
index 0000000..1a4592f
--- /dev/null
@@ -0,0 +1,141 @@
+% Inline Assembly
+
+For extremely low-level manipulations and performance reasons, one
+might wish to control the CPU directly. Rust supports using inline
+assembly to do this via the `asm!` macro. The syntax roughly matches
+that of GCC & Clang:
+
+```ignore
+asm!(assembly template
+   : output operands
+   : input operands
+   : clobbers
+   : options
+   );
+```
+
+Any use of `asm` is feature gated (requires `#![feature(asm)]` on the
+crate to allow) and of course requires an `unsafe` block.
+
+> **Note**: the examples here are given in x86/x86-64 assembly, but
+> all platforms are supported.
+
+## Assembly template
+
+The `assembly template` is the only required parameter and must be a
+literal string (i.e. `""`)
+
+```
+#![feature(asm)]
+
+#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+fn foo() {
+    unsafe {
+        asm!("NOP");
+    }
+}
+
+// other platforms
+#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
+fn foo() { /* ... */ }
+
+fn main() {
+    // ...
+    foo();
+    // ...
+}
+```
+
+(The `feature(asm)` and `#[cfg]`s are omitted from now on.)
+
+Output operands, input operands, clobbers and options are all optional
+but you must add the right number of `:` if you skip them:
+
+```
+# #![feature(asm)]
+# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+# fn main() { unsafe {
+asm!("xor %eax, %eax"
+    :
+    :
+    : "eax"
+   );
+# } }
+```
+
+Whitespace also doesn't matter:
+
+```
+# #![feature(asm)]
+# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+# fn main() { unsafe {
+asm!("xor %eax, %eax" ::: "eax");
+# } }
+```
+
+## Operands
+
+Input and output operands follow the same format: `:
+"constraints1"(expr1), "constraints2"(expr2), ..."`. Output operand
+expressions must be mutable lvalues:
+
+```
+# #![feature(asm)]
+# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+fn add(a: i32, b: i32) -> i32 {
+    let mut c = 0;
+    unsafe {
+        asm!("add $2, $0"
+             : "=r"(c)
+             : "0"(a), "r"(b)
+             );
+    }
+    c
+}
+# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
+# fn add(a: i32, b: i32) -> i32 { a + b }
+
+fn main() {
+    assert_eq!(add(3, 14159), 14162)
+}
+```
+
+## Clobbers
+
+Some instructions modify registers which might otherwise have held
+different values so we use the clobbers list to indicate to the
+compiler not to assume any values loaded into those registers will
+stay valid.
+
+```
+# #![feature(asm)]
+# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+# fn main() { unsafe {
+// Put the value 0x200 in eax
+asm!("mov $$0x200, %eax" : /* no outputs */ : /* no inputs */ : "eax");
+# } }
+```
+
+Input and output registers need not be listed since that information
+is already communicated by the given constraints. Otherwise, any other
+registers used either implicitly or explicitly should be listed.
+
+If the assembly changes the condition code register `cc` should be
+specified as one of the clobbers. Similarly, if the assembly modifies
+memory, `memory` should also be specified.
+
+## Options
+
+The last section, `options` is specific to Rust. The format is comma
+separated literal strings (i.e. `:"foo", "bar", "baz"`). It's used to
+specify some extra info about the inline assembly:
+
+Current valid options are:
+
+1. *volatile* - specifying this is analogous to
+   `__asm__ __volatile__ (...)` in gcc/clang.
+2. *alignstack* - certain instructions expect the stack to be
+   aligned a certain way (i.e. SSE) and specifying this indicates to
+   the compiler to insert its usual stack alignment code
+3. *intel* - use intel syntax instead of the default AT&T.
+
index 0dc83f95f439d771ecdac6a6ac6fc0144b9741b1..288a4a158fb80d6ab466b0e1f30e5f624cc0f623 100644 (file)
@@ -6,14 +6,14 @@ Linux or a Mac, all you need to do is this (note that you don't need to type
 in the `$`s, they just indicate the start of each command):
 
 ```bash
-$ curl -L https://static.rust-lang.org/rustup.sh | sudo sh
+$ curl -sf -L https://static.rust-lang.org/rustup.sh | sudo sh
 ```
 
 If you're concerned about the [potential insecurity](http://curlpipesh.tumblr.com/) of using `curl | sudo sh`,
 please keep reading and see our disclaimer below. And feel free to use a two-step version of the installation and examine our installation script:
 
 ```bash
-$ curl -L https://static.rust-lang.org/rustup.sh -O
+$ curl -f -L https://static.rust-lang.org/rustup.sh -O
 $ sudo sh rustup.sh
 ```
 
diff --git a/src/doc/trpl/intrinsics.md b/src/doc/trpl/intrinsics.md
new file mode 100644 (file)
index 0000000..25f7c54
--- /dev/null
@@ -0,0 +1,25 @@
+% Intrinsics
+
+> **Note**: intrinsics will forever have an unstable interface, it is
+> recommended to use the stable interfaces of libcore rather than intrinsics
+> directly.
+
+These are imported as if they were FFI functions, with the special
+`rust-intrinsic` ABI. For example, if one was in a freestanding
+context, but wished to be able to `transmute` between types, and
+perform efficient pointer arithmetic, one would import those functions
+via a declaration like
+
+```
+# #![feature(intrinsics)]
+# fn main() {}
+
+extern "rust-intrinsic" {
+    fn transmute<T, U>(x: T) -> U;
+
+    fn offset<T>(dst: *const T, offset: isize) -> *const T;
+}
+```
+
+As with any other FFI functions, these are always `unsafe` to call.
+
diff --git a/src/doc/trpl/lang-items.md b/src/doc/trpl/lang-items.md
new file mode 100644 (file)
index 0000000..5c27c03
--- /dev/null
@@ -0,0 +1,79 @@
+% Lang items
+
+> **Note**: lang items are often provided by crates in the Rust distribution,
+> and lang items themselves have an unstable interface. It is recommended to use
+> officially distributed crates instead of defining your own lang items.
+
+The `rustc` compiler has certain pluggable operations, that is,
+functionality that isn't hard-coded into the language, but is
+implemented in libraries, with a special marker to tell the compiler
+it exists. The marker is the attribute `#[lang="..."]` and there are
+various different values of `...`, i.e. various different 'lang
+items'.
+
+For example, `Box` pointers require two lang items, one for allocation
+and one for deallocation. A freestanding program that uses the `Box`
+sugar for dynamic allocations via `malloc` and `free`:
+
+```
+#![feature(lang_items, box_syntax, start, no_std, libc)]
+#![no_std]
+
+extern crate libc;
+
+extern {
+    fn abort() -> !;
+}
+
+#[lang = "owned_box"]
+pub struct Box<T>(*mut T);
+
+#[lang="exchange_malloc"]
+unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
+    let p = libc::malloc(size as libc::size_t) as *mut u8;
+
+    // malloc failed
+    if p as usize == 0 {
+        abort();
+    }
+
+    p
+}
+#[lang="exchange_free"]
+unsafe fn deallocate(ptr: *mut u8, _size: usize, _align: usize) {
+    libc::free(ptr as *mut libc::c_void)
+}
+
+#[start]
+fn main(argc: isize, argv: *const *const u8) -> isize {
+    let x = box 1;
+
+    0
+}
+
+#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
+#[lang = "eh_personality"] extern fn eh_personality() {}
+#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
+```
+
+Note the use of `abort`: the `exchange_malloc` lang item is assumed to
+return a valid pointer, and so needs to do the check internally.
+
+Other features provided by lang items include:
+
+- overloadable operators via traits: the traits corresponding to the
+  `==`, `<`, dereferencing (`*`) and `+` (etc.) operators are all
+  marked with lang items; those specific four are `eq`, `ord`,
+  `deref`, and `add` respectively.
+- stack unwinding and general failure; the `eh_personality`, `fail`
+  and `fail_bounds_checks` lang items.
+- the traits in `std::marker` used to indicate types of
+  various kinds; lang items `send`, `sync` and `copy`.
+- the marker types and variance indicators found in
+  `std::marker`; lang items `covariant_type`,
+  `contravariant_lifetime`, etc.
+
+Lang items are loaded lazily by the compiler; e.g. if one never uses
+`Box` then there is no need to define functions for `exchange_malloc`
+and `exchange_free`. `rustc` will emit an error when an item is needed
+but not found in the current crate or any that it depends on.
diff --git a/src/doc/trpl/link-args.md b/src/doc/trpl/link-args.md
new file mode 100644 (file)
index 0000000..ee5159a
--- /dev/null
@@ -0,0 +1,25 @@
+% Link args
+
+There is one other way to tell rustc how to customize linking, and that is via
+the `link_args` attribute. This attribute is applied to `extern` blocks and
+specifies raw flags which need to get passed to the linker when producing an
+artifact. An example usage would be:
+
+``` no_run
+#![feature(link_args)]
+
+#[link_args = "-foo -bar -baz"]
+extern {}
+# fn main() {}
+```
+
+Note that this feature is currently hidden behind the `feature(link_args)` gate
+because this is not a sanctioned way of performing linking. Right now rustc
+shells out to the system linker, so it makes sense to provide extra command line
+arguments, but this will not always be the case. In the future rustc may use
+LLVM directly to link native libraries in which case `link_args` will have no
+meaning.
+
+It is highly recommended to *not* use this attribute, and rather use the more
+formal `#[link(...)]` attribute on `extern` blocks instead.
+
index 4301149d1f8b3d62a26c07ba395f43976c5c3a5c..28f02b1ffe1528239ba2ba798a12dad126dde496 100644 (file)
@@ -123,7 +123,7 @@ We now loop forever with `loop` and use `break` to break out early.
 iteration. This will only print the odd numbers:
 
 ```{rust}
-for x in 0u32..10 {
+for x in 0..10 {
     if x % 2 == 0 { continue; }
 
     println!("{}", x);
index 8cb16f7ab33406422659b3d3a57eb82a7de220ec..18542e58bbfd2b878f06d982f8f801f3a6882922 100644 (file)
@@ -46,12 +46,13 @@ This will print `12.566371`.
 
 We've made a struct that represents a circle. We then write an `impl` block,
 and inside it, define a method, `area`. Methods take a  special first
-parameter, `&self`. There are three variants: `self`, `&self`, and `&mut self`.
+parameter, of which there are three variants: `self`, `&self`, and `&mut self`.
 You can think of this first parameter as being the `x` in `x.foo()`. The three
 variants correspond to the three kinds of thing `x` could be: `self` if it's
 just a value on the stack, `&self` if it's a reference, and `&mut self` if it's
-a mutable reference. We should default to using `&self`, as it's the most
-common. Here's an example of all three variants:
+a mutable reference. We should default to using `&self`, as you should prefer
+borrowing over taking ownership, as well as taking immutable references
+over mutable ones. Here's an example of all three variants:
 
 ```rust
 struct Circle {
@@ -100,8 +101,8 @@ impl Circle {
         std::f64::consts::PI * (self.radius * self.radius)
     }
 
-    fn grow(&self) -> Circle {
-        Circle { x: self.x, y: self.y, radius: (self.radius * 10.0) }
+    fn grow(&self, increment: f64) -> Circle {
+        Circle { x: self.x, y: self.y, radius: self.radius + increment }
     }
 }
 
@@ -109,7 +110,7 @@ fn main() {
     let c = Circle { x: 0.0, y: 0.0, radius: 2.0 };
     println!("{}", c.area());
 
-    let d = c.grow().area();
+    let d = c.grow(2.0).area();
     println!("{}", d);
 }
 ```
@@ -124,7 +125,7 @@ fn grow(&self) -> Circle {
 ```
 
 We just say we're returning a `Circle`. With this method, we can grow a new
-circle with an area that's 100 times larger than the old one.
+circle to any arbitrary size.
 
 ## Static methods
 
@@ -180,17 +181,23 @@ impl Circle {
 }
 
 struct CircleBuilder {
-    coordinate: f64,
+    x: f64,
+    y: f64,
     radius: f64,
 }
 
 impl CircleBuilder {
     fn new() -> CircleBuilder {
-        CircleBuilder { coordinate: 0.0, radius: 0.0, }
+        CircleBuilder { x: 0.0, y: 0.0, radius: 0.0, }
+    }
+
+    fn x(&mut self, coordinate: f64) -> &mut CircleBuilder {
+        self.x = coordinate;
+        self
     }
 
-    fn coordinate(&mut self, coordinate: f64) -> &mut CircleBuilder {
-        self.coordinate = coordinate;
+    fn y(&mut self, coordinate: f64) -> &mut CircleBuilder {
+        self.x = coordinate;
         self
     }
 
@@ -200,18 +207,20 @@ impl CircleBuilder {
     }
 
     fn finalize(&self) -> Circle {
-        Circle { x: self.coordinate, y: self.coordinate, radius: self.radius }
+        Circle { x: self.x, y: self.y, radius: self.radius }
     }
 }
 
 fn main() {
     let c = CircleBuilder::new()
-                .coordinate(10.0)
-                .radius(5.0)
+                .x(1.0)
+                .y(2.0)
+                .radius(2.0)
                 .finalize();
 
-
     println!("area: {}", c.area());
+    println!("x: {}", c.x);
+    println!("y: {}", c.y);
 }
 ```
 
index c46f84caa860cbcd681f4019634eadaeddbd433b..17a463842e71c39fa24c4d9935667a6362b47229 100644 (file)
@@ -129,7 +129,7 @@ need, and it can make your lifetimes more complex.
 To write a function that's generic over types of strings, use `&str`.
 
 ```
-fn some_string_length(x: &str) -> uint {
+fn some_string_length(x: &str) -> usize {
     x.len()
 }
 
diff --git a/src/doc/trpl/no-stdlib.md b/src/doc/trpl/no-stdlib.md
new file mode 100644 (file)
index 0000000..094c82a
--- /dev/null
@@ -0,0 +1,168 @@
+% No stdlib
+
+By default, `std` is linked to every Rust crate. In some contexts,
+this is undesirable, and can be avoided with the `#![no_std]`
+attribute attached to the crate.
+
+```ignore
+// a minimal library
+#![crate_type="lib"]
+#![feature(no_std)]
+#![no_std]
+# // fn main() {} tricked you, rustdoc!
+```
+
+Obviously there's more to life than just libraries: one can use
+`#[no_std]` with an executable, controlling the entry point is
+possible in two ways: the `#[start]` attribute, or overriding the
+default shim for the C `main` function with your own.
+
+The function marked `#[start]` is passed the command line parameters
+in the same format as C:
+
+```
+#![feature(lang_items, start, no_std, libc)]
+#![no_std]
+
+// Pull in the system libc library for what crt0.o likely requires
+extern crate libc;
+
+// Entry point for this program
+#[start]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+    0
+}
+
+// These functions and traits are used by the compiler, but not
+// for a bare-bones hello world. These are normally
+// provided by libstd.
+#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
+#[lang = "eh_personality"] extern fn eh_personality() {}
+#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
+# // fn main() {} tricked you, rustdoc!
+```
+
+To override the compiler-inserted `main` shim, one has to disable it
+with `#![no_main]` and then create the appropriate symbol with the
+correct ABI and the correct name, which requires overriding the
+compiler's name mangling too:
+
+```ignore
+#![feature(no_std)]
+#![no_std]
+#![no_main]
+#![feature(lang_items, start)]
+
+extern crate libc;
+
+#[no_mangle] // ensure that this symbol is called `main` in the output
+pub extern fn main(argc: i32, argv: *const *const u8) -> i32 {
+    0
+}
+
+#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
+#[lang = "eh_personality"] extern fn eh_personality() {}
+#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
+# // fn main() {} tricked you, rustdoc!
+```
+
+
+The compiler currently makes a few assumptions about symbols which are available
+in the executable to call. Normally these functions are provided by the standard
+library, but without it you must define your own.
+
+The first of these three functions, `stack_exhausted`, is invoked whenever stack
+overflow is detected.  This function has a number of restrictions about how it
+can be called and what it must do, but if the stack limit register is not being
+maintained then a thread always has an "infinite stack" and this function
+shouldn't get triggered.
+
+The second of these three functions, `eh_personality`, is used by the
+failure mechanisms of the compiler. This is often mapped to GCC's
+personality function (see the
+[libstd implementation](../std/rt/unwind/index.html) for more
+information), but crates which do not trigger a panic can be assured
+that this function is never called. The final function, `panic_fmt`, is
+also used by the failure mechanisms of the compiler.
+
+## Using libcore
+
+> **Note**: the core library's structure is unstable, and it is recommended to
+> use the standard library instead wherever possible.
+
+With the above techniques, we've got a bare-metal executable running some Rust
+code. There is a good deal of functionality provided by the standard library,
+however, that is necessary to be productive in Rust. If the standard library is
+not sufficient, then [libcore](../core/index.html) is designed to be used
+instead.
+
+The core library has very few dependencies and is much more portable than the
+standard library itself. Additionally, the core library has most of the
+necessary functionality for writing idiomatic and effective Rust code.
+
+As an example, here is a program that will calculate the dot product of two
+vectors provided from C, using idiomatic Rust practices.
+
+```
+#![feature(lang_items, start, no_std, core, libc)]
+#![no_std]
+
+# extern crate libc;
+extern crate core;
+
+use core::prelude::*;
+
+use core::mem;
+
+#[no_mangle]
+pub extern fn dot_product(a: *const u32, a_len: u32,
+                          b: *const u32, b_len: u32) -> u32 {
+    use core::raw::Slice;
+
+    // Convert the provided arrays into Rust slices.
+    // The core::raw module guarantees that the Slice
+    // structure has the same memory layout as a &[T]
+    // slice.
+    //
+    // This is an unsafe operation because the compiler
+    // cannot tell the pointers are valid.
+    let (a_slice, b_slice): (&[u32], &[u32]) = unsafe {
+        mem::transmute((
+            Slice { data: a, len: a_len as usize },
+            Slice { data: b, len: b_len as usize },
+        ))
+    };
+
+    // Iterate over the slices, collecting the result
+    let mut ret = 0;
+    for (i, j) in a_slice.iter().zip(b_slice.iter()) {
+        ret += (*i) * (*j);
+    }
+    return ret;
+}
+
+#[lang = "panic_fmt"]
+extern fn panic_fmt(args: &core::fmt::Arguments,
+                    file: &str,
+                    line: u32) -> ! {
+    loop {}
+}
+
+#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
+#[lang = "eh_personality"] extern fn eh_personality() {}
+# #[start] fn start(argc: isize, argv: *const *const u8) -> isize { 0 }
+# fn main() {}
+```
+
+Note that there is one extra lang item here which differs from the examples
+above, `panic_fmt`. This must be defined by consumers of libcore because the
+core library declares panics, but it does not define it. The `panic_fmt`
+lang item is this crate's definition of panic, and it must be guaranteed to
+never return.
+
+As can be seen in this example, the core library is intended to provide the
+power of Rust in all circumstances, regardless of platform requirements. Further
+libraries, such as liballoc, add functionality to libcore which make other
+platform-specific assumptions, but continue to be more portable than the
+standard library itself.
+
index b851f19d22dc39327da7ad296619121c8e5faa7c..f4b5495ba6390d88e50161e7bbb0e212d1324aae 100644 (file)
@@ -472,10 +472,15 @@ thread-safe counterpart of `Rc<T>`.
 
 ## Lifetime Elision
 
-Earlier, we mentioned *lifetime elision*, a feature of Rust which allows you to
-not write lifetime annotations in certain circumstances. All references have a
-lifetime, and so if you elide a lifetime (like `&T` instead of `&'a T`), Rust
-will do three things to determine what those lifetimes should be.
+Rust supports powerful local type inference in function bodies, but it’s
+forbidden in item signatures to allow reasoning about the types just based in
+the item signature alone. However, for ergonomic reasons a very restricted
+secondary inference algorithm called “lifetime elision” applies in function
+signatures. It infers only based on the signature components themselves and not
+based on the body of the function, only infers lifetime paramters, and does
+this with only three easily memorizable and unambiguous rules. This makes
+lifetime elision a shorthand for writing an item signature, while not hiding
+away the actual types involved as full local inference would if applied to it.
 
 When talking about lifetime elision, we use the term *input lifetime* and
 *output lifetime*. An *input lifetime* is a lifetime associated with a parameter
index 9e82e48fd18b7f1fe829d33e7e1eb1b799226f3c..4ebf696aa57a0b017cd70a063b00c3c7b7143990 100644 (file)
@@ -177,6 +177,7 @@ match origin {
 If you want to match against a slice or array, you can use `&`:
 
 ```{rust}
+# #![feature(slice_patterns)]
 fn main() {
     let v = vec!["match_this", "1"];
 
index 33f0893466da604ad7472600230c3a5d4a390778..9eb22a7f6985a51bb6e026aaf73896f1a630135a 100644 (file)
@@ -1,29 +1,5 @@
 % Compiler Plugins
 
-<div class="unstable-feature">
-
-<p>
-<b>Warning:</b> Plugins are an advanced, unstable feature! For many details,
-the only available documentation is the <a
-href="../syntax/index.html"><code>libsyntax</code></a> and <a
-href="../rustc/index.html"><code>librustc</code></a> API docs, or even the source
-code itself. These internal compiler APIs are also subject to change at any
-time.
-</p>
-
-<p>
-For defining new syntax it is often much easier to use Rust's <a
-href="macros.html">built-in macro system</a>.
-</p>
-
-<p style="margin-bottom: 0">
-The code in this document uses language features not covered in the Rust
-Guide.  See the <a href="../reference.html">Reference Manual</a> for more
-information.
-</p>
-
-</div>
-
 # Introduction
 
 `rustc` can load compiler plugins, which are user-provided libraries that
index bd9b449fc087e7db4c0aab4b0cba53656063f2a2..107d7d979a09cc8c2db3457aabb28e458f04fc5c 100644 (file)
@@ -568,8 +568,8 @@ fn add(x: &i32, y: &i32) -> i32 {
 fn main() {
     let x = Box::new(5);
 
-    println!("{}", add(&x, &x));
-    println!("{}", add(&x, &x));
+    println!("{}", add(&*x, &*x));
+    println!("{}", add(&*x, &*x));
 }
 ```
 
diff --git a/src/doc/trpl/standard-input.md b/src/doc/trpl/standard-input.md
deleted file mode 100644 (file)
index a296e13..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-% Standard Input
-
-Getting input from the keyboard is pretty easy, but uses some things
-we haven't seen before. Here's a simple program that reads some input,
-and then prints it back out:
-
-```{rust,ignore}
-corefn main() {
-    println!("Type something!");
-
-    let input = std::old_io::stdin().read_line().ok().expect("Failed to read line");
-
-    println!("{}", input);
-}
-```
-
-Let's go over these chunks, one by one:
-
-```{rust,ignore}
-std::old_io::stdin();
-```
-
-This calls a function, `stdin()`, that lives inside the `std::old_io` module. As
-you can imagine, everything in `std` is provided by Rust, the 'standard
-library.' We'll talk more about the module system later.
-
-Since writing the fully qualified name all the time is annoying, we can use
-the `use` statement to import it in:
-
-```{rust}
-# #![feature(old_io)]
-use std::old_io::stdin;
-
-stdin();
-```
-
-However, it's considered better practice to not import individual functions, but
-to import the module, and only use one level of qualification:
-
-```{rust}
-# #![feature(old_io)]
-use std::old_io;
-
-old_io::stdin();
-```
-
-Let's update our example to use this style:
-
-```{rust,ignore}
-use std::old_io;
-
-fn main() {
-    println!("Type something!");
-
-    let input = old_io::stdin().read_line().ok().expect("Failed to read line");
-
-    println!("{}", input);
-}
-```
-
-Next up:
-
-```{rust,ignore}
-.read_line()
-```
-
-The `read_line()` method can be called on the result of `stdin()` to return
-a full line of input. Nice and easy.
-
-```{rust,ignore}
-.ok().expect("Failed to read line");
-```
-
-Do you remember this code?
-
-```{rust}
-enum OptionalInt {
-    Value(i32),
-    Missing,
-}
-
-fn main() {
-    let x = OptionalInt::Value(5);
-    let y = OptionalInt::Missing;
-
-    match x {
-        OptionalInt::Value(n) => println!("x is {}", n),
-        OptionalInt::Missing => println!("x is missing!"),
-    }
-
-    match y {
-        OptionalInt::Value(n) => println!("y is {}", n),
-        OptionalInt::Missing => println!("y is missing!"),
-    }
-}
-```
-
-We had to match each time to see if we had a value or not. In this case,
-though, we _know_ that `x` has a `Value`, but `match` forces us to handle
-the `missing` case. This is what we want 99% of the time, but sometimes, we
-know better than the compiler.
-
-Likewise, `read_line()` does not return a line of input. It _might_ return a
-line of input, though it might also fail to do so. This could happen if our program
-isn't running in a terminal, but as part of a cron job, or some other context
-where there's no standard input. Because of this, `read_line` returns a type
-very similar to our `OptionalInt`: an `IoResult<T>`. We haven't talked about
-`IoResult<T>` yet because it is the *generic* form of our `OptionalInt`.
-Until then, you can think of it as being the same thing, just for any type –
-not just `i32`s.
-
-Rust provides a method on these `IoResult<T>`s called `ok()`, which does the
-same thing as our `match` statement but assumes that we have a valid value.
-We then call `expect()` on the result, which will terminate our program if we
-don't have a valid value. In this case, if we can't get input, our program
-doesn't work, so we're okay with that. In most cases, we would want to handle
-the error case explicitly. `expect()` allows us to give an error message if
-this crash happens.
-
-We will cover the exact details of how all of this works later in the Guide in
-[Error Handling]. For now, this gives you enough of a basic understanding to
-work with.
-
-Back to the code we were working on! Here's a refresher:
-
-```{rust,ignore}
-use std::old_io;
-
-fn main() {
-    println!("Type something!");
-
-    let input = old_io::stdin().read_line().ok().expect("Failed to read line");
-
-    println!("{}", input);
-}
-```
-
-With long lines like this, Rust gives you some flexibility with the whitespace.
-We _could_ write the example like this:
-
-```{rust,ignore}
-use std::old_io;
-
-fn main() {
-    println!("Type something!");
-
-    // here, we'll show the types at each step
-
-    let input = old_io::stdin() // std::old_io::stdio::StdinReader
-                  .read_line() // IoResult<String>
-                  .ok() // Option<String>
-                  .expect("Failed to read line"); // String
-
-    println!("{}", input);
-}
-```
-
-Sometimes, this makes things more readable – sometimes, less. Use your judgement
-here.
-
-That's all you need to get basic input from the standard input! It's not too
-complicated, but there are a number of small parts.
-
-
-[Error Handling]: ./error-handling.html
index 8fb08e1c6cfdea4f529e051e98cdd66b3e1b169f..8b2c14526cbf0fd91a5611bbfd223fbae6c91125 100644 (file)
@@ -231,7 +231,7 @@ pub fn add_two(a: i32) -> i32 {
 }
 
 #[cfg(test)]
-mod tests {
+mod test {
     use super::add_two;
 
     #[test]
@@ -241,7 +241,7 @@ mod tests {
 }
 ```
 
-There's a few changes here. The first is the introduction of a `mod tests` with
+There's a few changes here. The first is the introduction of a `mod test` with
 a `cfg` attribute. The module allows us to group all of our tests together, and
 to also define helper functions if needed, that don't become a part of the rest
 of our crate. The `cfg` attribute only compiles our test code if we're
@@ -260,7 +260,7 @@ pub fn add_two(a: i32) -> i32 {
 }
 
 #[cfg(test)]
-mod tests {
+mod test {
     use super::*;
 
     #[test]
diff --git a/src/doc/trpl/tracing-macros.md b/src/doc/trpl/tracing-macros.md
new file mode 100644 (file)
index 0000000..6226ea9
--- /dev/null
@@ -0,0 +1,91 @@
+% Tracing Macros
+
+The `trace_macros` feature allows you to use a special feature: tracing macro
+invocations.
+
+In the advanced macros chapter, we defined a `bct` macro:
+
+```rust
+macro_rules! bct {
+    // cmd 0:  d ... => ...
+    (0, $($ps:tt),* ; $_d:tt)
+        => (bct!($($ps),*, 0 ; ));
+    (0, $($ps:tt),* ; $_d:tt, $($ds:tt),*)
+        => (bct!($($ps),*, 0 ; $($ds),*));
+
+    // cmd 1p:  1 ... => 1 ... p
+    (1, $p:tt, $($ps:tt),* ; 1)
+        => (bct!($($ps),*, 1, $p ; 1, $p));
+    (1, $p:tt, $($ps:tt),* ; 1, $($ds:tt),*)
+        => (bct!($($ps),*, 1, $p ; 1, $($ds),*, $p));
+
+    // cmd 1p:  0 ... => 0 ...
+    (1, $p:tt, $($ps:tt),* ; $($ds:tt),*)
+        => (bct!($($ps),*, 1, $p ; $($ds),*));
+
+    // halt on empty data string
+    ( $($ps:tt),* ; )
+        => (());
+}
+```
+
+This is pretty complex! we can see the output
+
+```rust,ignore
+#![feature(trace_macros)]
+
+macro_rules! bct {
+    // cmd 0:  d ... => ...
+    (0, $($ps:tt),* ; $_d:tt)
+        => (bct!($($ps),*, 0 ; ));
+    (0, $($ps:tt),* ; $_d:tt, $($ds:tt),*)
+        => (bct!($($ps),*, 0 ; $($ds),*));
+
+    // cmd 1p:  1 ... => 1 ... p
+    (1, $p:tt, $($ps:tt),* ; 1)
+        => (bct!($($ps),*, 1, $p ; 1, $p));
+    (1, $p:tt, $($ps:tt),* ; 1, $($ds:tt),*)
+        => (bct!($($ps),*, 1, $p ; 1, $($ds),*, $p));
+
+    // cmd 1p:  0 ... => 0 ...
+    (1, $p:tt, $($ps:tt),* ; $($ds:tt),*)
+        => (bct!($($ps),*, 1, $p ; $($ds),*));
+
+    // halt on empty data string
+    ( $($ps:tt),* ; )
+        => (());
+}
+
+fn main() {
+    trace_macros!(true);
+
+    bct!(0, 0, 1, 1, 1 ; 1, 0, 1);
+}
+```
+
+This will print out a wall of text:
+
+```text
+bct! { 0 , 0 , 1 , 1 , 1 ; 1 , 0 , 1 }
+bct! { 0 , 1 , 1 , 1 , 0 ; 0 , 1 }
+bct! { 1 , 1 , 1 , 0 , 0 ; 1 }
+bct! { 1 , 0 , 0 , 1 , 1 ; 1 , 1 }
+bct! { 0 , 1 , 1 , 1 , 0 ; 1 , 1 , 0 }
+bct! { 1 , 1 , 1 , 0 , 0 ; 1 , 0 }
+bct! { 1 , 0 , 0 , 1 , 1 ; 1 , 0 , 1 }
+bct! { 0 , 1 , 1 , 1 , 0 ; 1 , 0 , 1 , 0 }
+bct! { 1 , 1 , 1 , 0 , 0 ; 0 , 1 , 0 }
+bct! { 1 , 0 , 0 , 1 , 1 ; 0 , 1 , 0 }
+bct! { 0 , 1 , 1 , 1 , 0 ; 0 , 1 , 0 }
+```
+
+And eventually, error:
+
+```text
+18:45 error: recursion limit reached while expanding the macro `bct`
+    => (bct!($($ps),*, 1, $p ; $($ds),*));
+        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+```
+
+The `trace_macros!` call is what produces this output, showing how we match
+each time.
index fe26fc5e1eb200a71cd45f74b8c826dfb7f7a573..1e44076a4305f0d43d5928e47e331bee36e82aee 100644 (file)
@@ -479,7 +479,7 @@ impl Foo for OverrideDefault {
 }
 
 let default = UseDefault;
-default.baz(); // prints "We called bar."
+default.baz(); // prints "We called baz."
 
 let over = OverrideDefault;
 over.baz(); // prints "Override baz!"
index dbf0cae6f4ba84b852e771e978b94ae84bbb99c5..3ca3cfd05886ee8add73eaa419c16f7c3c4c34b5 100644 (file)
@@ -181,539 +181,3 @@ code:
   that clean-up is always run, even when the thread panics.
 - ensure that any data stored behind a raw pointer is destroyed at the
   appropriate time.
-
-As an example, we give a reimplementation of owned boxes by wrapping
-`malloc` and `free`. Rust's move semantics and lifetimes mean this
-reimplementation is as safe as the `Box` type.
-
-```
-# #![feature(libc)]
-#![feature(unsafe_destructor)]
-
-extern crate libc;
-use libc::{c_void, size_t, malloc, free};
-use std::mem;
-use std::ptr;
-
-// Define a wrapper around the handle returned by the foreign code.
-// Unique<T> has the same semantics as Box<T>
-//
-// NB: For simplicity and correctness, we require that T has kind Send
-// (owned boxes relax this restriction).
-pub struct Unique<T: Send> {
-    // It contains a single raw, mutable pointer to the object in question.
-    ptr: *mut T
-}
-
-// Implement methods for creating and using the values in the box.
-
-impl<T: Send> Unique<T> {
-    pub fn new(value: T) -> Unique<T> {
-        unsafe {
-            let ptr = malloc(mem::size_of::<T>() as size_t) as *mut T;
-            // we *need* valid pointer.
-            assert!(!ptr.is_null());
-            // `*ptr` is uninitialized, and `*ptr = value` would
-            // attempt to destroy it `overwrite` moves a value into
-            // this memory without attempting to drop the original
-            // value.
-            ptr::write(&mut *ptr, value);
-            Unique{ptr: ptr}
-        }
-    }
-
-    // the 'r lifetime results in the same semantics as `&*x` with
-    // Box<T>
-    pub fn borrow<'r>(&'r self) -> &'r T {
-        // By construction, self.ptr is valid
-        unsafe { &*self.ptr }
-    }
-
-    // the 'r lifetime results in the same semantics as `&mut *x` with
-    // Box<T>
-    pub fn borrow_mut<'r>(&'r mut self) -> &'r mut T {
-        unsafe { &mut *self.ptr }
-    }
-}
-
-// A key ingredient for safety, we associate a destructor with
-// Unique<T>, making the struct manage the raw pointer: when the
-// struct goes out of scope, it will automatically free the raw pointer.
-//
-// NB: This is an unsafe destructor; rustc will not normally allow
-// destructors to be associated with parameterized types (due to
-// historically failing to check them soundly).  Note that the
-// `#[unsafe_destructor]` feature gate is currently required to use
-// unsafe destructors.
-#[unsafe_destructor]
-impl<T: Send> Drop for Unique<T> {
-    fn drop(&mut self) {
-        unsafe {
-            // Copy the object out from the pointer onto the stack,
-            // where it is covered by normal Rust destructor semantics
-            // and cleans itself up, if necessary
-            ptr::read(self.ptr);
-
-            // clean-up our allocation
-            free(self.ptr as *mut c_void)
-        }
-    }
-}
-
-// A comparison between the built-in `Box` and this reimplementation
-fn main() {
-    {
-        let mut x = Box::new(5);
-        *x = 10;
-    } // `x` is freed here
-
-    {
-        let mut y = Unique::new(5);
-        *y.borrow_mut() = 10;
-    } // `y` is freed here
-}
-```
-
-Notably, the only way to construct a `Unique` is via the `new`
-function, and this function ensures that the internal pointer is valid
-and hidden in the private field. The two `borrow` methods are safe
-because the compiler statically guarantees that objects are never used
-before creation or after destruction (unless you use some `unsafe`
-code...).
-
-# Inline assembly
-
-For extremely low-level manipulations and performance reasons, one
-might wish to control the CPU directly. Rust supports using inline
-assembly to do this via the `asm!` macro. The syntax roughly matches
-that of GCC & Clang:
-
-```ignore
-asm!(assembly template
-   : output operands
-   : input operands
-   : clobbers
-   : options
-   );
-```
-
-Any use of `asm` is feature gated (requires `#![feature(asm)]` on the
-crate to allow) and of course requires an `unsafe` block.
-
-> **Note**: the examples here are given in x86/x86-64 assembly, but
-> all platforms are supported.
-
-## Assembly template
-
-The `assembly template` is the only required parameter and must be a
-literal string (i.e. `""`)
-
-```
-#![feature(asm)]
-
-#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-fn foo() {
-    unsafe {
-        asm!("NOP");
-    }
-}
-
-// other platforms
-#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
-fn foo() { /* ... */ }
-
-fn main() {
-    // ...
-    foo();
-    // ...
-}
-```
-
-(The `feature(asm)` and `#[cfg]`s are omitted from now on.)
-
-Output operands, input operands, clobbers and options are all optional
-but you must add the right number of `:` if you skip them:
-
-```
-# #![feature(asm)]
-# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-# fn main() { unsafe {
-asm!("xor %eax, %eax"
-    :
-    :
-    : "eax"
-   );
-# } }
-```
-
-Whitespace also doesn't matter:
-
-```
-# #![feature(asm)]
-# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-# fn main() { unsafe {
-asm!("xor %eax, %eax" ::: "eax");
-# } }
-```
-
-## Operands
-
-Input and output operands follow the same format: `:
-"constraints1"(expr1), "constraints2"(expr2), ..."`. Output operand
-expressions must be mutable lvalues:
-
-```
-# #![feature(asm)]
-# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-fn add(a: i32, b: i32) -> i32 {
-    let mut c = 0;
-    unsafe {
-        asm!("add $2, $0"
-             : "=r"(c)
-             : "0"(a), "r"(b)
-             );
-    }
-    c
-}
-# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
-# fn add(a: i32, b: i32) -> i32 { a + b }
-
-fn main() {
-    assert_eq!(add(3, 14159), 14162)
-}
-```
-
-## Clobbers
-
-Some instructions modify registers which might otherwise have held
-different values so we use the clobbers list to indicate to the
-compiler not to assume any values loaded into those registers will
-stay valid.
-
-```
-# #![feature(asm)]
-# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-# fn main() { unsafe {
-// Put the value 0x200 in eax
-asm!("mov $$0x200, %eax" : /* no outputs */ : /* no inputs */ : "eax");
-# } }
-```
-
-Input and output registers need not be listed since that information
-is already communicated by the given constraints. Otherwise, any other
-registers used either implicitly or explicitly should be listed.
-
-If the assembly changes the condition code register `cc` should be
-specified as one of the clobbers. Similarly, if the assembly modifies
-memory, `memory` should also be specified.
-
-## Options
-
-The last section, `options` is specific to Rust. The format is comma
-separated literal strings (i.e. `:"foo", "bar", "baz"`). It's used to
-specify some extra info about the inline assembly:
-
-Current valid options are:
-
-1. *volatile* - specifying this is analogous to
-   `__asm__ __volatile__ (...)` in gcc/clang.
-2. *alignstack* - certain instructions expect the stack to be
-   aligned a certain way (i.e. SSE) and specifying this indicates to
-   the compiler to insert its usual stack alignment code
-3. *intel* - use intel syntax instead of the default AT&T.
-
-# Avoiding the standard library
-
-By default, `std` is linked to every Rust crate. In some contexts,
-this is undesirable, and can be avoided with the `#![no_std]`
-attribute attached to the crate.
-
-```ignore
-// a minimal library
-#![crate_type="lib"]
-#![feature(no_std)]
-#![no_std]
-# // fn main() {} tricked you, rustdoc!
-```
-
-Obviously there's more to life than just libraries: one can use
-`#[no_std]` with an executable, controlling the entry point is
-possible in two ways: the `#[start]` attribute, or overriding the
-default shim for the C `main` function with your own.
-
-The function marked `#[start]` is passed the command line parameters
-in the same format as C:
-
-```
-# #![feature(libc)]
-#![feature(lang_items, start, no_std)]
-#![no_std]
-
-// Pull in the system libc library for what crt0.o likely requires
-extern crate libc;
-
-// Entry point for this program
-#[start]
-fn start(_argc: isize, _argv: *const *const u8) -> isize {
-    0
-}
-
-// These functions and traits are used by the compiler, but not
-// for a bare-bones hello world. These are normally
-// provided by libstd.
-#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
-#[lang = "eh_personality"] extern fn eh_personality() {}
-#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
-# // fn main() {} tricked you, rustdoc!
-```
-
-To override the compiler-inserted `main` shim, one has to disable it
-with `#![no_main]` and then create the appropriate symbol with the
-correct ABI and the correct name, which requires overriding the
-compiler's name mangling too:
-
-```ignore
-# #![feature(libc)]
-#![feature(no_std)]
-#![no_std]
-#![no_main]
-#![feature(lang_items, start)]
-
-extern crate libc;
-
-#[no_mangle] // ensure that this symbol is called `main` in the output
-pub extern fn main(argc: i32, argv: *const *const u8) -> i32 {
-    0
-}
-
-#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
-#[lang = "eh_personality"] extern fn eh_personality() {}
-#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
-# // fn main() {} tricked you, rustdoc!
-```
-
-
-The compiler currently makes a few assumptions about symbols which are available
-in the executable to call. Normally these functions are provided by the standard
-library, but without it you must define your own.
-
-The first of these three functions, `stack_exhausted`, is invoked whenever stack
-overflow is detected.  This function has a number of restrictions about how it
-can be called and what it must do, but if the stack limit register is not being
-maintained then a thread always has an "infinite stack" and this function
-shouldn't get triggered.
-
-The second of these three functions, `eh_personality`, is used by the
-failure mechanisms of the compiler. This is often mapped to GCC's
-personality function (see the
-[libstd implementation](../std/rt/unwind/index.html) for more
-information), but crates which do not trigger a panic can be assured
-that this function is never called. The final function, `panic_fmt`, is
-also used by the failure mechanisms of the compiler.
-
-## Using libcore
-
-> **Note**: the core library's structure is unstable, and it is recommended to
-> use the standard library instead wherever possible.
-
-With the above techniques, we've got a bare-metal executable running some Rust
-code. There is a good deal of functionality provided by the standard library,
-however, that is necessary to be productive in Rust. If the standard library is
-not sufficient, then [libcore](../core/index.html) is designed to be used
-instead.
-
-The core library has very few dependencies and is much more portable than the
-standard library itself. Additionally, the core library has most of the
-necessary functionality for writing idiomatic and effective Rust code.
-
-As an example, here is a program that will calculate the dot product of two
-vectors provided from C, using idiomatic Rust practices.
-
-```
-# #![feature(libc, core)]
-#![feature(lang_items, start, no_std)]
-#![no_std]
-
-# extern crate libc;
-extern crate core;
-
-use core::prelude::*;
-
-use core::mem;
-
-#[no_mangle]
-pub extern fn dot_product(a: *const u32, a_len: u32,
-                          b: *const u32, b_len: u32) -> u32 {
-    use core::raw::Slice;
-
-    // Convert the provided arrays into Rust slices.
-    // The core::raw module guarantees that the Slice
-    // structure has the same memory layout as a &[T]
-    // slice.
-    //
-    // This is an unsafe operation because the compiler
-    // cannot tell the pointers are valid.
-    let (a_slice, b_slice): (&[u32], &[u32]) = unsafe {
-        mem::transmute((
-            Slice { data: a, len: a_len as usize },
-            Slice { data: b, len: b_len as usize },
-        ))
-    };
-
-    // Iterate over the slices, collecting the result
-    let mut ret = 0;
-    for (i, j) in a_slice.iter().zip(b_slice.iter()) {
-        ret += (*i) * (*j);
-    }
-    return ret;
-}
-
-#[lang = "panic_fmt"]
-extern fn panic_fmt(args: &core::fmt::Arguments,
-                    file: &str,
-                    line: u32) -> ! {
-    loop {}
-}
-
-#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
-#[lang = "eh_personality"] extern fn eh_personality() {}
-# #[start] fn start(argc: isize, argv: *const *const u8) -> isize { 0 }
-# fn main() {}
-```
-
-Note that there is one extra lang item here which differs from the examples
-above, `panic_fmt`. This must be defined by consumers of libcore because the
-core library declares panics, but it does not define it. The `panic_fmt`
-lang item is this crate's definition of panic, and it must be guaranteed to
-never return.
-
-As can be seen in this example, the core library is intended to provide the
-power of Rust in all circumstances, regardless of platform requirements. Further
-libraries, such as liballoc, add functionality to libcore which make other
-platform-specific assumptions, but continue to be more portable than the
-standard library itself.
-
-# Interacting with the compiler internals
-
-> **Note**: this section is specific to the `rustc` compiler; these
-> parts of the language may never be fully specified and so details may
-> differ wildly between implementations (and even versions of `rustc`
-> itself).
->
-> Furthermore, this is just an overview; the best form of
-> documentation for specific instances of these features are their
-> definitions and uses in `std`.
-
-The Rust language currently has two orthogonal mechanisms for allowing
-libraries to interact directly with the compiler and vice versa:
-
-- intrinsics, functions built directly into the compiler providing
-  very basic low-level functionality,
-- lang-items, special functions, types and traits in libraries marked
-  with specific `#[lang]` attributes
-
-## Intrinsics
-
-> **Note**: intrinsics will forever have an unstable interface, it is
-> recommended to use the stable interfaces of libcore rather than intrinsics
-> directly.
-
-These are imported as if they were FFI functions, with the special
-`rust-intrinsic` ABI. For example, if one was in a freestanding
-context, but wished to be able to `transmute` between types, and
-perform efficient pointer arithmetic, one would import those functions
-via a declaration like
-
-```
-# #![feature(intrinsics)]
-# fn main() {}
-
-extern "rust-intrinsic" {
-    fn transmute<T, U>(x: T) -> U;
-
-    fn offset<T>(dst: *const T, offset: isize) -> *const T;
-}
-```
-
-As with any other FFI functions, these are always `unsafe` to call.
-
-## Lang items
-
-> **Note**: lang items are often provided by crates in the Rust distribution,
-> and lang items themselves have an unstable interface. It is recommended to use
-> officially distributed crates instead of defining your own lang items.
-
-The `rustc` compiler has certain pluggable operations, that is,
-functionality that isn't hard-coded into the language, but is
-implemented in libraries, with a special marker to tell the compiler
-it exists. The marker is the attribute `#[lang="..."]` and there are
-various different values of `...`, i.e. various different 'lang
-items'.
-
-For example, `Box` pointers require two lang items, one for allocation
-and one for deallocation. A freestanding program that uses the `Box`
-sugar for dynamic allocations via `malloc` and `free`:
-
-```
-# #![feature(libc)]
-#![feature(lang_items, box_syntax, start, no_std)]
-#![no_std]
-
-extern crate libc;
-
-extern {
-    fn abort() -> !;
-}
-
-#[lang = "owned_box"]
-pub struct Box<T>(*mut T);
-
-#[lang="exchange_malloc"]
-unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
-    let p = libc::malloc(size as libc::size_t) as *mut u8;
-
-    // malloc failed
-    if p as usize == 0 {
-        abort();
-    }
-
-    p
-}
-#[lang="exchange_free"]
-unsafe fn deallocate(ptr: *mut u8, _size: usize, _align: usize) {
-    libc::free(ptr as *mut libc::c_void)
-}
-
-#[start]
-fn main(argc: isize, argv: *const *const u8) -> isize {
-    let x = box 1;
-
-    0
-}
-
-#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
-#[lang = "eh_personality"] extern fn eh_personality() {}
-#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
-```
-
-Note the use of `abort`: the `exchange_malloc` lang item is assumed to
-return a valid pointer, and so needs to do the check internally.
-
-Other features provided by lang items include:
-
-- overloadable operators via traits: the traits corresponding to the
-  `==`, `<`, dereferencing (`*`) and `+` (etc.) operators are all
-  marked with lang items; those specific four are `eq`, `ord`,
-  `deref`, and `add` respectively.
-- stack unwinding and general failure; the `eh_personality`, `fail`
-  and `fail_bounds_checks` lang items.
-- the traits in `std::marker` used to indicate types of
-  various kinds; lang items `send`, `sync` and `copy`.
-- the marker types and variance indicators found in
-  `std::marker`; lang items `covariant_type`,
-  `contravariant_lifetime`, etc.
-
-Lang items are loaded lazily by the compiler; e.g. if one never uses
-`Box` then there is no need to define functions for `exchange_malloc`
-and `exchange_free`. `rustc` will emit an error when an item is needed
-but not found in the current crate or any that it depends on.
diff --git a/src/doc/trpl/unstable.md b/src/doc/trpl/unstable.md
new file mode 100644 (file)
index 0000000..e8e02cc
--- /dev/null
@@ -0,0 +1 @@
+% Unstable Rust
index 6b56c2b630346ff32c1cf6650917017e0204fc1a..c5c58bb49ac361f34df30451b9badd02450acab9 100644 (file)
@@ -12,9 +12,9 @@
 #![cfg_attr(rustdoc, feature(rustdoc))]
 
 #[cfg(rustdoc)]
-extern crate "rustdoc" as this;
+extern crate rustdoc as this;
 
 #[cfg(rustc)]
-extern crate "rustc_driver" as this;
+extern crate rustc_driver as this;
 
 fn main() { this::main() }
index d4f1071c724b6a0cd17020514890601005ac1925..47e64547eed3985bc34d1087df708f00a2ec0321 100755 (executable)
@@ -335,7 +335,7 @@ case $CFG_OSTYPE in
     MINGW32*)
         CFG_OSTYPE=pc-mingw32
         ;;
-# Thad's Cygwin identifers below
+# Thad's Cygwin identifiers below
 
 #   Vista 32 bit
     CYGWIN_NT-6.0)
@@ -437,7 +437,7 @@ CFG_TMP_DIR=$(mktemp -d 2>/dev/null \
            || create_tmp_dir)
 
 # If we're saving nightlies and we didn't specify which one, grab the latest
-# verison from the perspective of the server. Buildbot has typically finished
+# version from the perspective of the server. Buildbot has typically finished
 # building and uploading by ~8UTC, but we want to include a little buffer.
 #
 # FIXME It would be better to use the known most recent nightly that has been
index b5d16d29272850843e9204749c68e6be9165d56d..9b37ddc7ab53383136d86eee9ef4a44de7288917 100644 (file)
@@ -33,7 +33,7 @@
 //!
 //! Sharing some immutable data between tasks:
 //!
-//! ```
+//! ```no_run
 //! use std::sync::Arc;
 //! use std::thread;
 //!
@@ -50,7 +50,7 @@
 //!
 //! Sharing mutable data safely between tasks with a `Mutex`:
 //!
-//! ```
+//! ```no_run
 //! use std::sync::{Arc, Mutex};
 //! use std::thread;
 //!
@@ -76,7 +76,7 @@
 use core::atomic;
 use core::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};
 use core::fmt;
-use core::cmp::{Ordering};
+use core::cmp::Ordering;
 use core::default::Default;
 use core::mem::{min_align_of, size_of};
 use core::mem;
@@ -94,6 +94,9 @@
 /// With simple pipes, without `Arc`, a copy would have to be made for each
 /// task.
 ///
+/// When you clone an `Arc<T>`, it will create another pointer to the data and
+/// increase the reference counter.
+///
 /// ```
 /// # #![feature(alloc, core)]
 /// use std::sync::Arc;
@@ -354,7 +357,8 @@ fn drop(&mut self) {
         // more than once (but it is guaranteed to be zeroed after the first if
         // it's run more than once)
         let ptr = *self._ptr;
-        if ptr.is_null() { return }
+        // if ptr.is_null() { return }
+        if ptr.is_null() || ptr as usize == mem::POST_DROP_USIZE { return }
 
         // Because `fetch_sub` is already atomic, we do not need to synchronize
         // with other threads unless we are going to delete the object. This
@@ -485,7 +489,7 @@ fn drop(&mut self) {
         let ptr = *self._ptr;
 
         // see comments above for why this check is here
-        if ptr.is_null() { return }
+        if ptr.is_null() || ptr as usize == mem::POST_DROP_USIZE { return }
 
         // If we find out that we were the last weak pointer, then its time to
         // deallocate the data entirely. See the discussion in Arc::drop() about
index 8b18fbf554a4cad6218fb0bf99b79135c637aa1b..f9bd0ab2f1e0fdbe1e3cb88fcb61413d1e21b8b6 100644 (file)
@@ -244,13 +244,13 @@ pub trait BoxAny {
     /// Returns the boxed value if it is of type `T`, or
     /// `Err(Self)` if it isn't.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>>;
+    fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>>;
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl BoxAny for Box<Any> {
     #[inline]
-    fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> {
+    fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
         if self.is::<T>() {
             unsafe {
                 // Get the raw representation of the trait object
@@ -270,7 +270,7 @@ fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl BoxAny for Box<Any+Send> {
     #[inline]
-    fn downcast<T: 'static>(self) -> Result<Box<T>, Box<Any>> {
+    fn downcast<T: Any>(self) -> Result<Box<T>, Box<Any>> {
         <Box<Any>>::downcast(self)
     }
 }
index 3733350412e499a8c4d3623cf6fea8aeea403bc6..57baa811b9d4740f82be7a272ae0fe2d44eaaad0 100644 (file)
@@ -189,7 +189,6 @@ mod imp {
     use core::option::Option;
     use core::option::Option::None;
     use core::ptr::{null_mut, null};
-    use core::num::Int;
     use libc::{c_char, c_int, c_void, size_t};
     use super::MIN_ALIGN;
 
@@ -301,7 +300,7 @@ pub unsafe fn reallocate(ptr: *mut u8, old_size: usize, size: usize, align: usiz
             libc::realloc(ptr as *mut libc::c_void, size as libc::size_t) as *mut u8
         } else {
             let new_ptr = allocate(size, align);
-            ptr::copy(new_ptr, ptr, cmp::min(size, old_size));
+            ptr::copy(ptr, new_ptr, cmp::min(size, old_size));
             deallocate(ptr, old_size, align);
             new_ptr
         }
index 541de2d37fbe0cf68f47a6c51d6c9df8e96a2203..b92dfa9117e6beb5745f97c106a758ebfedef1fe 100644 (file)
@@ -75,7 +75,7 @@
 #![feature(box_syntax)]
 #![feature(optin_builtin_traits)]
 #![feature(unboxed_closures)]
-#![feature(unsafe_no_drop_flag)]
+#![feature(unsafe_no_drop_flag, filling_drop)]
 #![feature(core)]
 #![feature(unique)]
 #![cfg_attr(test, feature(test, alloc, rustc_private))]
index eb3c5c167268bfe143f68dbef5fb449e6443b8b9..7cdd48884262182d4c30ee873acc3c082011e863 100644 (file)
 use core::fmt;
 use core::hash::{Hasher, Hash};
 use core::marker;
-use core::mem::{min_align_of, size_of, forget};
+use core::mem::{self, min_align_of, size_of, forget};
 use core::nonzero::NonZero;
 use core::ops::{Deref, Drop};
 use core::option::Option;
@@ -407,7 +407,7 @@ impl<T> Drop for Rc<T> {
     fn drop(&mut self) {
         unsafe {
             let ptr = *self._ptr;
-            if !ptr.is_null() {
+            if !ptr.is_null() && ptr as usize != mem::POST_DROP_USIZE {
                 self.dec_strong();
                 if self.strong() == 0 {
                     ptr::read(&**self); // destroy the contained object
@@ -431,7 +431,8 @@ impl<T> Clone for Rc<T> {
 
     /// Makes a clone of the `Rc<T>`.
     ///
-    /// This increases the strong reference count.
+    /// When you clone an `Rc<T>`, it will create another pointer to the data and
+    /// increase the strong reference counter.
     ///
     /// # Examples
     ///
@@ -718,7 +719,7 @@ impl<T> Drop for Weak<T> {
     fn drop(&mut self) {
         unsafe {
             let ptr = *self._ptr;
-            if !ptr.is_null() {
+            if !ptr.is_null() && ptr as usize != mem::POST_DROP_USIZE {
                 self.dec_weak();
                 // the weak count starts at 1, and will only go to zero if all
                 // the strong pointers have disappeared.
index 377b52a3dbe292d4380c10816327493f3480e5f4..3ed8ca2bea98b1adb197c1654262df769ad138cb 100644 (file)
@@ -91,7 +91,6 @@
 use core::iter::RandomAccessIterator;
 use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat, Cloned};
 use core::iter::{self, FromIterator, IntoIterator};
-use core::num::Int;
 use core::ops::Index;
 use core::slice;
 use core::{u8, u32, usize};
@@ -171,18 +170,6 @@ pub struct BitVec {
 impl Index<usize> for BitVec {
     type Output = bool;
 
-
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, i: &usize) -> &bool {
-        if self.get(*i).expect("index out of bounds") {
-            &TRUE
-        } else {
-            &FALSE
-        }
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, i: usize) -> &bool {
         if self.get(i).expect("index out of bounds") {
index 04a692cc3aea2b59d63675bb648ddcd900418d4b..e1d007f0ac49739e21a33f60929e5fa0b7f5b19a 100644 (file)
@@ -24,7 +24,7 @@
 use core::fmt::Debug;
 use core::hash::{Hash, Hasher};
 use core::iter::{Map, FromIterator, IntoIterator};
-use core::ops::{Index};
+use core::ops::Index;
 use core::{iter, fmt, mem, usize};
 use Bound::{self, Included, Excluded, Unbounded};
 
@@ -904,31 +904,10 @@ fn cmp(&self, other: &BTreeMap<K, V>) -> Ordering {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<K: Debug, V: Debug> Debug for BTreeMap<K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f, "{{"));
-
-        for (i, (k, v)) in self.iter().enumerate() {
-            if i != 0 { try!(write!(f, ", ")); }
-            try!(write!(f, "{:?}: {:?}", *k, *v));
-        }
-
-        write!(f, "}}")
-    }
-}
-
-#[cfg(stage0)]
-#[stable(feature = "rust1", since = "1.0.0")]
-impl<K: Ord, Q: ?Sized, V> Index<Q> for BTreeMap<K, V>
-    where K: Borrow<Q>, Q: Ord
-{
-    type Output = V;
-
-    #[inline]
-    fn index(&self, key: &Q) -> &V {
-        self.get(key).expect("no entry found for key")
+        self.iter().fold(f.debug_map(), |b, (k, v)| b.entry(k, v)).finish()
     }
 }
 
-#[cfg(not(stage0))]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, K: Ord, Q: ?Sized, V> Index<&'a Q> for BTreeMap<K, V>
     where K: Borrow<Q>, Q: Ord
index 23eafa41d8a01d4075737d74cae3b39171b6a5cd..847ee7c19ce94d7b7f8329938a9267c7418a4b36 100644 (file)
@@ -280,9 +280,11 @@ fn drop(&mut self) {
 #[unsafe_destructor]
 impl<K, V> Drop for Node<K, V> {
     fn drop(&mut self) {
-        if self.keys.is_null() {
+        if self.keys.is_null() ||
+            (unsafe { self.keys.get() as *const K as usize == mem::POST_DROP_USIZE })
+        {
             // Since we have #[unsafe_no_drop_flag], we have to watch
-            // out for a null value being stored in self.keys. (Using
+            // out for the sentinel value being stored in self.keys. (Using
             // null is technically a violation of the `Unique`
             // requirements, though.)
             return;
@@ -1131,13 +1133,13 @@ unsafe fn push_edge(&mut self, edge: Node<K, V>) {
     #[inline]
     unsafe fn insert_kv(&mut self, index: usize, key: K, val: V) -> &mut V {
         ptr::copy(
-            self.keys_mut().as_mut_ptr().offset(index as isize + 1),
             self.keys().as_ptr().offset(index as isize),
+            self.keys_mut().as_mut_ptr().offset(index as isize + 1),
             self.len() - index
         );
         ptr::copy(
-            self.vals_mut().as_mut_ptr().offset(index as isize + 1),
             self.vals().as_ptr().offset(index as isize),
+            self.vals_mut().as_mut_ptr().offset(index as isize + 1),
             self.len() - index
         );
 
@@ -1153,8 +1155,8 @@ unsafe fn insert_kv(&mut self, index: usize, key: K, val: V) -> &mut V {
     #[inline]
     unsafe fn insert_edge(&mut self, index: usize, edge: Node<K, V>) {
         ptr::copy(
-            self.edges_mut().as_mut_ptr().offset(index as isize + 1),
             self.edges().as_ptr().offset(index as isize),
+            self.edges_mut().as_mut_ptr().offset(index as isize + 1),
             self.len() - index
         );
         ptr::write(self.edges_mut().get_unchecked_mut(index), edge);
@@ -1186,13 +1188,13 @@ unsafe fn remove_kv(&mut self, index: usize) -> (K, V) {
         let val = ptr::read(self.vals().get_unchecked(index));
 
         ptr::copy(
-            self.keys_mut().as_mut_ptr().offset(index as isize),
             self.keys().as_ptr().offset(index as isize + 1),
+            self.keys_mut().as_mut_ptr().offset(index as isize),
             self.len() - index - 1
         );
         ptr::copy(
-            self.vals_mut().as_mut_ptr().offset(index as isize),
             self.vals().as_ptr().offset(index as isize + 1),
+            self.vals_mut().as_mut_ptr().offset(index as isize),
             self.len() - index - 1
         );
 
@@ -1207,8 +1209,8 @@ unsafe fn remove_edge(&mut self, index: usize) -> Node<K, V> {
         let edge = ptr::read(self.edges().get_unchecked(index));
 
         ptr::copy(
-            self.edges_mut().as_mut_ptr().offset(index as isize),
             self.edges().as_ptr().offset(index as isize + 1),
+            self.edges_mut().as_mut_ptr().offset(index as isize),
             // index can be == len+1, so do the +1 first to avoid underflow.
             (self.len() + 1) - index
         );
@@ -1235,19 +1237,19 @@ fn split(&mut self) -> (K, V, Node<K, V>) {
             right._len = self.len() / 2;
             let right_offset = self.len() - right.len();
             ptr::copy_nonoverlapping(
-                right.keys_mut().as_mut_ptr(),
                 self.keys().as_ptr().offset(right_offset as isize),
+                right.keys_mut().as_mut_ptr(),
                 right.len()
             );
             ptr::copy_nonoverlapping(
-                right.vals_mut().as_mut_ptr(),
                 self.vals().as_ptr().offset(right_offset as isize),
+                right.vals_mut().as_mut_ptr(),
                 right.len()
             );
             if !self.is_leaf() {
                 ptr::copy_nonoverlapping(
-                    right.edges_mut().as_mut_ptr(),
                     self.edges().as_ptr().offset(right_offset as isize),
+                    right.edges_mut().as_mut_ptr(),
                     right.len() + 1
                 );
             }
@@ -1276,19 +1278,19 @@ fn absorb(&mut self, key: K, val: V, mut right: Node<K, V>) {
             ptr::write(self.vals_mut().get_unchecked_mut(old_len), val);
 
             ptr::copy_nonoverlapping(
-                self.keys_mut().as_mut_ptr().offset(old_len as isize + 1),
                 right.keys().as_ptr(),
+                self.keys_mut().as_mut_ptr().offset(old_len as isize + 1),
                 right.len()
             );
             ptr::copy_nonoverlapping(
-                self.vals_mut().as_mut_ptr().offset(old_len as isize + 1),
                 right.vals().as_ptr(),
+                self.vals_mut().as_mut_ptr().offset(old_len as isize + 1),
                 right.len()
             );
             if !self.is_leaf() {
                 ptr::copy_nonoverlapping(
-                    self.edges_mut().as_mut_ptr().offset(old_len as isize + 1),
                     right.edges().as_ptr(),
+                    self.edges_mut().as_mut_ptr().offset(old_len as isize + 1),
                     right.len() + 1
                 );
             }
@@ -1524,36 +1526,6 @@ fn search_linear<Q: ?Sized>(&self, key: &Q) -> (usize, bool)
             }
 
             /// Returns a sub-slice with elements starting with `min_key`.
-            #[cfg(stage0)]
-            pub fn slice_from(self, min_key: &K) -> $NodeSlice<'a, K, V> {
-                //  _______________
-                // |_1_|_3_|_5_|_7_|
-                // |   |   |   |   |
-                // 0 0 1 1 2 2 3 3 4  index
-                // |   |   |   |   |
-                // \___|___|___|___/  slice_from(&0); pos = 0
-                //     \___|___|___/  slice_from(&2); pos = 1
-                //     |___|___|___/  slice_from(&3); pos = 1; result.head_is_edge = false
-                //         \___|___/  slice_from(&4); pos = 2
-                //             \___/  slice_from(&6); pos = 3
-                //                \|/ slice_from(&999); pos = 4
-                let (pos, pos_is_kv) = self.search_linear(min_key);
-                $NodeSlice {
-                    has_edges: self.has_edges,
-                    edges: if !self.has_edges {
-                        self.edges
-                    } else {
-                        self.edges.$index(&(pos ..))
-                    },
-                    keys: &self.keys[pos ..],
-                    vals: self.vals.$index(&(pos ..)),
-                    head_is_edge: !pos_is_kv,
-                    tail_is_edge: self.tail_is_edge,
-                }
-            }
-
-            /// Returns a sub-slice with elements starting with `min_key`.
-            #[cfg(not(stage0))]
             pub fn slice_from(self, min_key: &K) -> $NodeSlice<'a, K, V> {
                 //  _______________
                 // |_1_|_3_|_5_|_7_|
@@ -1582,37 +1554,6 @@ pub fn slice_from(self, min_key: &K) -> $NodeSlice<'a, K, V> {
             }
 
             /// Returns a sub-slice with elements up to and including `max_key`.
-            #[cfg(stage0)]
-            pub fn slice_to(self, max_key: &K) -> $NodeSlice<'a, K, V> {
-                //  _______________
-                // |_1_|_3_|_5_|_7_|
-                // |   |   |   |   |
-                // 0 0 1 1 2 2 3 3 4  index
-                // |   |   |   |   |
-                //\|/  |   |   |   |  slice_to(&0); pos = 0
-                // \___/   |   |   |  slice_to(&2); pos = 1
-                // \___|___|   |   |  slice_to(&3); pos = 1; result.tail_is_edge = false
-                // \___|___/   |   |  slice_to(&4); pos = 2
-                // \___|___|___/   |  slice_to(&6); pos = 3
-                // \___|___|___|___/  slice_to(&999); pos = 4
-                let (pos, pos_is_kv) = self.search_linear(max_key);
-                let pos = pos + if pos_is_kv { 1 } else { 0 };
-                $NodeSlice {
-                    has_edges: self.has_edges,
-                    edges: if !self.has_edges {
-                        self.edges
-                    } else {
-                        self.edges.$index(&(.. (pos + 1)))
-                    },
-                    keys: &self.keys[..pos],
-                    vals: self.vals.$index(&(.. pos)),
-                    head_is_edge: self.head_is_edge,
-                    tail_is_edge: !pos_is_kv,
-                }
-            }
-
-            /// Returns a sub-slice with elements up to and including `max_key`.
-            #[cfg(not(stage0))]
             pub fn slice_to(self, max_key: &K) -> $NodeSlice<'a, K, V> {
                 //  _______________
                 // |_1_|_3_|_5_|_7_|
index 08ee5801482fdb44e81a4531142527c987315401..840110b5b276fffc7822d69d345db5e7ed9894d9 100644 (file)
@@ -628,14 +628,7 @@ fn bitor(self, rhs: &BTreeSet<T>) -> BTreeSet<T> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: Debug> Debug for BTreeSet<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f, "{{"));
-
-        for (i, x) in self.iter().enumerate() {
-            if i != 0 { try!(write!(f, ", ")); }
-            try!(write!(f, "{:?}", *x));
-        }
-
-        write!(f, "}}")
+        self.iter().fold(f.debug_set(), |b, e| b.entry(e)).finish()
     }
 }
 
index fe2efc7164d0cae0c8d69b3f75e6010def7e512b..474b4de8123e1ce271c59e9a3166cf771b54081e 100644 (file)
@@ -16,7 +16,6 @@
 use core::prelude::*;
 use core::marker;
 use core::fmt;
-use core::num::Int;
 use core::iter::{FromIterator, IntoIterator};
 use core::ops::{Sub, BitOr, BitAnd, BitXor};
 
index 6a65c991c95037b5d45be79dd7c191277a74960a..c769b3df37f627548150961962c00aa8500c6c39 100644 (file)
@@ -25,7 +25,6 @@
 #![doc(test(no_crate_inject))]
 
 #![allow(trivial_casts)]
-#![allow(trivial_numeric_casts)]
 #![feature(alloc)]
 #![feature(box_syntax)]
 #![feature(box_patterns)]
 #![feature(unicode)]
 #![feature(unsafe_destructor)]
 #![feature(unique)]
-#![feature(unsafe_no_drop_flag)]
+#![feature(unsafe_no_drop_flag, filling_drop)]
 #![feature(step_by)]
 #![feature(str_char)]
 #![feature(convert)]
+#![feature(slice_patterns)]
+#![feature(debug_builders)]
 #![cfg_attr(test, feature(rand, rustc_private, test, hash, collections))]
 #![cfg_attr(test, allow(deprecated))] // rand
 
index 908c78a17f4f96ef2743f5b9a52dc3e56a5d4952..52da4902b758cf1c31721072a8c6636ed2ed6a70 100644 (file)
@@ -927,14 +927,7 @@ fn clone(&self) -> LinkedList<A> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<A: fmt::Debug> fmt::Debug for LinkedList<A> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f, "["));
-
-        for (i, e) in self.iter().enumerate() {
-            if i != 0 { try!(write!(f, ", ")); }
-            try!(write!(f, "{:?}", *e));
-        }
-
-        write!(f, "]")
+        self.iter().fold(f.debug_list(), |b, e| b.entry(e)).finish()
     }
 }
 
@@ -951,7 +944,7 @@ fn hash<H: Hasher>(&self, state: &mut H) {
 #[cfg(test)]
 mod test {
     use std::clone::Clone;
-    use std::iter::{Iterator, IteratorExt};
+    use std::iter::Iterator;
     use std::option::Option::{Some, None, self};
     use std::rand;
     use std::thread;
index 688d730e2528744c03f49903d7928a0610384a29..050997f2dd3f085459575ea13b65c79725e5c636 100644 (file)
@@ -50,8 +50,8 @@
 //!
 //! ## Iteration
 //!
-//! The slices implement `IntoIterator`. The iterators of yield references
-//! to the slice elements.
+//! The slices implement `IntoIterator`. The iterator yields references to the
+//! slice elements.
 //!
 //! ```
 //! let numbers = &[0, 1, 2];
@@ -76,7 +76,6 @@
 //!   iterators.
 //! * Further methods that return iterators are `.split()`, `.splitn()`,
 //!   `.chunks()`, `.windows()` and more.
-
 #![doc(primitive = "slice")]
 #![stable(feature = "rust1", since = "1.0.0")]
 
 use core::clone::Clone;
 use core::cmp::Ordering::{self, Greater, Less};
 use core::cmp::{self, Ord, PartialEq};
-use core::iter::{Iterator, IteratorExt};
+use core::iter::Iterator;
 use core::iter::MultiplicativeIterator;
 use core::marker::Sized;
 use core::mem::size_of;
 use core::mem;
+#[cfg(stage0)]
 use core::num::wrapping::WrappingOps;
 use core::ops::FnMut;
 use core::option::Option::{self, Some, None};
@@ -131,7 +131,7 @@ mod hack {
     use alloc::boxed::Box;
     use core::clone::Clone;
     #[cfg(test)]
-    use core::iter::{Iterator, IteratorExt};
+    use core::iter::Iterator;
     use core::mem;
     #[cfg(test)]
     use core::option::Option::{Some, None};
@@ -611,9 +611,11 @@ pub fn get_mut(&mut self, index: usize) -> Option<&mut T> {
         core_slice::SliceExt::get_mut(self, index)
     }
 
-    /// Work with `self` as a mut slice.
-    /// Primarily intended for getting a &mut [T] from a [T; N].
-    #[stable(feature = "rust1", since = "1.0.0")]
+    /// Deprecated: use `&mut s[..]` instead.
+    #[unstable(feature = "collections",
+               reason = "will be replaced by slice syntax")]
+    #[deprecated(since = "1.0.0", reason = "use &mut s[..] instead")]
+    #[allow(deprecated)]
     pub fn as_mut_slice(&mut self) -> &mut [T] {
         core_slice::SliceExt::as_mut_slice(self)
     }
@@ -1319,10 +1321,10 @@ fn insertion_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> O
 
             if i != j {
                 let tmp = ptr::read(read_ptr);
-                ptr::copy(buf_v.offset(j + 1),
-                          &*buf_v.offset(j),
+                ptr::copy(&*buf_v.offset(j),
+                          buf_v.offset(j + 1),
                           (i - j) as usize);
-                ptr::copy_nonoverlapping(buf_v.offset(j), &tmp, 1);
+                ptr::copy_nonoverlapping(&tmp, buf_v.offset(j), 1);
                 mem::forget(tmp);
             }
         }
@@ -1395,10 +1397,10 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
                 // j + 1 could be `len` (for the last `i`), but in
                 // that case, `i == j` so we don't copy. The
                 // `.offset(j)` is always in bounds.
-                ptr::copy(buf_dat.offset(j + 1),
-                          &*buf_dat.offset(j),
+                ptr::copy(&*buf_dat.offset(j),
+                          buf_dat.offset(j + 1),
                           i - j as usize);
-                ptr::copy_nonoverlapping(buf_dat.offset(j), read_ptr, 1);
+                ptr::copy_nonoverlapping(read_ptr, buf_dat.offset(j), 1);
             }
         }
     }
@@ -1446,11 +1448,11 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
                     if left == right_start {
                         // the number remaining in this run.
                         let elems = (right_end as usize - right as usize) / mem::size_of::<T>();
-                        ptr::copy_nonoverlapping(out, &*right, elems);
+                        ptr::copy_nonoverlapping(&*right, out, elems);
                         break;
                     } else if right == right_end {
                         let elems = (right_start as usize - left as usize) / mem::size_of::<T>();
-                        ptr::copy_nonoverlapping(out, &*left, elems);
+                        ptr::copy_nonoverlapping(&*left, out, elems);
                         break;
                     }
 
@@ -1464,7 +1466,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
                     } else {
                         step(&mut left)
                     };
-                    ptr::copy_nonoverlapping(out, &*to_copy, 1);
+                    ptr::copy_nonoverlapping(&*to_copy, out, 1);
                     step(&mut out);
                 }
             }
@@ -1478,7 +1480,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
     // write the result to `v` in one go, so that there are never two copies
     // of the same object in `v`.
     unsafe {
-        ptr::copy_nonoverlapping(v.as_mut_ptr(), &*buf_dat, len);
+        ptr::copy_nonoverlapping(&*buf_dat, v.as_mut_ptr(), len);
     }
 
     // increment the pointer, returning the old pointer.
index aaa73badcac99a1b0c21bf7794b803a82317549f..9ddf8988f1ee7ee643e03b65dcde77b9effa0f53 100644 (file)
@@ -18,9 +18,6 @@
 //! (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 as methods on the `str` type.
-//!
 //! # Examples
 //!
 //! Here's some code that uses a `&str`:
@@ -58,7 +55,7 @@
 
 use core::clone::Clone;
 use core::iter::AdditiveIterator;
-use core::iter::{Iterator, IteratorExt, Extend};
+use core::iter::{Iterator, Extend};
 use core::option::Option::{self, Some, None};
 use core::result::Result;
 use core::str as core_str;
index a61eaecd2b1ea36dcf2b892b05c0df9a6eac7f50..dbf214a712b6528cecc3f57493aed7666ad5538d 100644 (file)
@@ -592,8 +592,8 @@ pub fn remove(&mut self, idx: usize) -> char {
         let ch = self.char_at(idx);
         let next = idx + ch.len_utf8();
         unsafe {
-            ptr::copy(self.vec.as_mut_ptr().offset(idx as isize),
-                      self.vec.as_ptr().offset(next as isize),
+            ptr::copy(self.vec.as_ptr().offset(next as isize),
+                      self.vec.as_mut_ptr().offset(idx as isize),
                       len - next);
             self.vec.set_len(len - (next - idx));
         }
@@ -622,11 +622,11 @@ pub fn insert(&mut self, idx: usize, ch: char) {
         let amt = ch.encode_utf8(&mut bits).unwrap();
 
         unsafe {
-            ptr::copy(self.vec.as_mut_ptr().offset((idx + amt) as isize),
-                      self.vec.as_ptr().offset(idx as isize),
+            ptr::copy(self.vec.as_ptr().offset(idx as isize),
+                      self.vec.as_mut_ptr().offset((idx + amt) as isize),
                       len - idx);
-            ptr::copy(self.vec.as_mut_ptr().offset(idx as isize),
-                      bits.as_ptr(),
+            ptr::copy(bits.as_ptr(),
+                      self.vec.as_mut_ptr().offset(idx as isize),
                       amt);
             self.vec.set_len(len + amt);
         }
@@ -903,13 +903,6 @@ fn add(mut self, other: &str) -> String {
 impl ops::Index<ops::Range<usize>> for String {
     type Output = str;
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::Range<usize>) -> &str {
-        &self[..][*index]
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::Range<usize>) -> &str {
         &self[..][index]
@@ -919,13 +912,6 @@ fn index(&self, index: ops::Range<usize>) -> &str {
 impl ops::Index<ops::RangeTo<usize>> for String {
     type Output = str;
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::RangeTo<usize>) -> &str {
-        &self[..][*index]
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::RangeTo<usize>) -> &str {
         &self[..][index]
@@ -935,13 +921,6 @@ fn index(&self, index: ops::RangeTo<usize>) -> &str {
 impl ops::Index<ops::RangeFrom<usize>> for String {
     type Output = str;
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::RangeFrom<usize>) -> &str {
-        &self[..][*index]
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::RangeFrom<usize>) -> &str {
         &self[..][index]
@@ -951,13 +930,6 @@ fn index(&self, index: ops::RangeFrom<usize>) -> &str {
 impl ops::Index<ops::RangeFull> for String {
     type Output = str;
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, _index: &ops::RangeFull) -> &str {
-        unsafe { mem::transmute(&*self.vec) }
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, _index: ops::RangeFull) -> &str {
         unsafe { mem::transmute(&*self.vec) }
@@ -1047,11 +1019,28 @@ fn as_ref(&self) -> &str {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> From<&'a str> for String {
+    #[inline]
     fn from(s: &'a str) -> String {
         s.to_string()
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> From<&'a str> for Cow<'a, str> {
+    #[inline]
+    fn from(s: &'a str) -> Cow<'a, str> {
+        Cow::Borrowed(s)
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> From<String> for Cow<'a, str> {
+    #[inline]
+    fn from(s: String) -> Cow<'a, str> {
+        Cow::Owned(s)
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Into<Vec<u8>> for String {
     fn into(self) -> Vec<u8> {
@@ -1059,7 +1048,7 @@ fn into(self) -> Vec<u8> {
     }
 }
 
-#[stable(feature = "rust1", since = "1.0.0")]
+#[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`")]
 impl IntoCow<'static, str> for String {
     #[inline]
     fn into_cow(self) -> Cow<'static, str> {
@@ -1067,7 +1056,7 @@ fn into_cow(self) -> Cow<'static, str> {
     }
 }
 
-#[stable(feature = "rust1", since = "1.0.0")]
+#[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`")]
 impl<'a> IntoCow<'a, str> for &'a str {
     #[inline]
     fn into_cow(self) -> Cow<'a, str> {
index e71077c96c774a4acbfb7bdf5174138ae39dd08e..3595288a6c94067d0126c23d74365932dc50913e 100644 (file)
@@ -52,7 +52,7 @@
 use alloc::boxed::Box;
 use alloc::heap::{EMPTY, allocate, reallocate, deallocate};
 use core::cmp::max;
-use core::cmp::{Ordering};
+use core::cmp::Ordering;
 use core::default::Default;
 use core::fmt;
 use core::hash::{self, Hash};
@@ -260,16 +260,17 @@ pub unsafe fn from_raw_parts(ptr: *mut T, length: usize,
 
     /// Creates a vector by copying the elements from a raw pointer.
     ///
-    /// This function will copy `elts` contiguous elements starting at `ptr` into a new allocation
-    /// owned by the returned `Vec<T>`. The elements of the buffer are copied into the vector
-    /// without cloning, as if `ptr::read()` were called on them.
+    /// This function will copy `elts` contiguous elements starting at `ptr`
+    /// into a new allocation owned by the returned `Vec<T>`. The elements of
+    /// the buffer are copied into the vector without cloning, as if
+    /// `ptr::read()` were called on them.
     #[inline]
     #[unstable(feature = "collections",
                reason = "may be better expressed via composition")]
     pub unsafe fn from_raw_buf(ptr: *const T, elts: usize) -> Vec<T> {
         let mut dst = Vec::with_capacity(elts);
         dst.set_len(elts);
-        ptr::copy_nonoverlapping(dst.as_mut_ptr(), ptr, elts);
+        ptr::copy_nonoverlapping(ptr, dst.as_mut_ptr(), elts);
         dst
     }
 
@@ -288,8 +289,9 @@ pub fn capacity(&self) -> usize {
         self.cap
     }
 
-    /// Reserves capacity for at least `additional` more elements to be inserted in the given
-    /// `Vec<T>`. The collection may reserve more space to avoid frequent reallocations.
+    /// Reserves capacity for at least `additional` more elements to be inserted
+    /// in the given `Vec<T>`. The collection may reserve more space to avoid
+    /// frequent reallocations.
     ///
     /// # Panics
     ///
@@ -423,24 +425,13 @@ pub fn truncate(&mut self, len: usize) {
         }
     }
 
-    /// Returns a mutable slice of the elements of `self`.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// fn foo(slice: &mut [i32]) {}
-    ///
-    /// let mut vec = vec![1, 2];
-    /// foo(vec.as_mut_slice());
-    /// ```
+    /// Deprecated: use `&mut s[..]` instead.
     #[inline]
-    #[stable(feature = "rust1", since = "1.0.0")]
+    #[unstable(feature = "collections",
+               reason = "will be replaced by slice syntax")]
+    #[deprecated(since = "1.0.0", reason = "use &mut s[..] instead")]
     pub fn as_mut_slice(&mut self) -> &mut [T] {
-        unsafe {
-            let ptr = *self.ptr;
-            assume(!ptr.is_null());
-            slice::from_raw_parts_mut(ptr, self.len)
-        }
+        &mut self[..]
     }
 
     /// Creates a consuming iterator, that is, one that moves each value out of
@@ -552,7 +543,7 @@ pub fn insert(&mut self, index: usize, element: T) {
                 let p = self.as_mut_ptr().offset(index as isize);
                 // Shift everything over to make space. (Duplicating the
                 // `index`th element into two consecutive places.)
-                ptr::copy(p.offset(1), &*p, len - index);
+                ptr::copy(&*p, p.offset(1), len - index);
                 // Write it in, overwriting the first copy of the `index`th
                 // element.
                 ptr::write(&mut *p, element);
@@ -590,7 +581,7 @@ pub fn remove(&mut self, index: usize) -> T {
                 ret = ptr::read(ptr);
 
                 // Shift everything down to fill in that spot.
-                ptr::copy(ptr, &*ptr.offset(1), len - index - 1);
+                ptr::copy(&*ptr.offset(1), ptr, len - index - 1);
             }
             self.set_len(len - 1);
             ret
@@ -732,8 +723,8 @@ pub fn append(&mut self, other: &mut Self) {
         let len = self.len();
         unsafe {
             ptr::copy_nonoverlapping(
-                self.get_unchecked_mut(len),
                 other.as_ptr(),
+                self.get_unchecked_mut(len),
                 other.len());
         }
 
@@ -1053,8 +1044,8 @@ pub fn split_off(&mut self, at: usize) -> Self {
             other.set_len(other_len);
 
             ptr::copy_nonoverlapping(
-                other.as_mut_ptr(),
                 self.as_ptr().offset(at as isize),
+                other.as_mut_ptr(),
                 other.len());
         }
         other
@@ -1343,15 +1334,6 @@ fn hash<H: hash::Hasher>(&self, state: &mut H) {
 impl<T> Index<usize> for Vec<T> {
     type Output = T;
 
-
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &usize) -> &T {
-        // NB built-in indexing via `&[T]`
-        &(**self)[*index]
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: usize) -> &T {
         // NB built-in indexing via `&[T]`
@@ -1361,15 +1343,6 @@ fn index(&self, index: usize) -> &T {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> IndexMut<usize> for Vec<T> {
-
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, index: &usize) -> &mut T {
-        // NB built-in indexing via `&mut [T]`
-        &mut (**self)[*index]
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, index: usize) -> &mut T {
         // NB built-in indexing via `&mut [T]`
@@ -1382,13 +1355,6 @@ fn index_mut(&mut self, index: usize) -> &mut T {
 impl<T> ops::Index<ops::Range<usize>> for Vec<T> {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::Range<usize>) -> &[T] {
-        Index::index(&**self, index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::Range<usize>) -> &[T] {
         Index::index(&**self, index)
@@ -1398,13 +1364,6 @@ fn index(&self, index: ops::Range<usize>) -> &[T] {
 impl<T> ops::Index<ops::RangeTo<usize>> for Vec<T> {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::RangeTo<usize>) -> &[T] {
-        Index::index(&**self, index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
         Index::index(&**self, index)
@@ -1414,13 +1373,6 @@ fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
 impl<T> ops::Index<ops::RangeFrom<usize>> for Vec<T> {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::RangeFrom<usize>) -> &[T] {
-        Index::index(&**self, index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
         Index::index(&**self, index)
@@ -1430,13 +1382,6 @@ fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
 impl<T> ops::Index<ops::RangeFull> for Vec<T> {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, _index: &ops::RangeFull) -> &[T] {
-        self
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, _index: ops::RangeFull) -> &[T] {
         self
@@ -1446,13 +1391,6 @@ fn index(&self, _index: ops::RangeFull) -> &[T] {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<ops::Range<usize>> for Vec<T> {
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, index: &ops::Range<usize>) -> &mut [T] {
-        IndexMut::index_mut(&mut **self, index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
         IndexMut::index_mut(&mut **self, index)
@@ -1461,13 +1399,6 @@ fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<ops::RangeTo<usize>> for Vec<T> {
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, index: &ops::RangeTo<usize>) -> &mut [T] {
-        IndexMut::index_mut(&mut **self, index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
         IndexMut::index_mut(&mut **self, index)
@@ -1476,13 +1407,6 @@ fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<ops::RangeFrom<usize>> for Vec<T> {
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, index: &ops::RangeFrom<usize>) -> &mut [T] {
-        IndexMut::index_mut(&mut **self, index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
         IndexMut::index_mut(&mut **self, index)
@@ -1491,16 +1415,9 @@ fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<ops::RangeFull> for Vec<T> {
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, _index: &ops::RangeFull) -> &mut [T] {
-        self.as_mut_slice()
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, _index: ops::RangeFull) -> &mut [T] {
-        self.as_mut_slice()
+        self
     }
 }
 
@@ -1519,7 +1436,13 @@ fn deref(&self) -> &[T] {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::DerefMut for Vec<T> {
-    fn deref_mut(&mut self) -> &mut [T] { self.as_mut_slice() }
+    fn deref_mut(&mut self) -> &mut [T] {
+        unsafe {
+            let ptr = *self.ptr;
+            assume(!ptr.is_null());
+            slice::from_raw_parts_mut(ptr, self.len)
+        }
+    }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -1656,21 +1579,13 @@ fn cmp(&self, other: &Vec<T>) -> Ordering {
     }
 }
 
+#[unstable(feature = "collections",
+           reason = "will be replaced by slice syntax")]
+#[deprecated(since = "1.0.0", reason = "use &mut s[..] instead")]
 #[allow(deprecated)]
 impl<T> AsSlice<T> for Vec<T> {
-    /// Returns a slice into `self`.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// # #![feature(core)]
-    /// fn foo(slice: &[i32]) {}
-    ///
-    /// let vec = vec![1, 2];
-    /// foo(vec.as_slice());
-    /// ```
+    /// Deprecated: use `&mut s[..]` instead.
     #[inline]
-    #[stable(feature = "rust1", since = "1.0.0")]
     fn as_slice(&self) -> &[T] {
         self
     }
@@ -1694,7 +1609,7 @@ impl<T> Drop for Vec<T> {
     fn drop(&mut self) {
         // This is (and should always remain) a no-op if the fields are
         // zeroed (when moving out, because of #[unsafe_no_drop_flag]).
-        if self.cap != 0 {
+        if self.cap != 0 && self.cap != mem::POST_DROP_USIZE {
             unsafe {
                 for x in &*self {
                     ptr::read(x);
@@ -1977,7 +1892,7 @@ impl<'a, T> ExactSizeIterator for Drain<'a, T> {}
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> Drop for Drain<'a, T> {
     fn drop(&mut self) {
-        // self.ptr == self.end == null if drop has already been called,
+        // self.ptr == self.end == mem::POST_DROP_USIZE if drop has already been called,
         // so we can use #[unsafe_no_drop_flag].
 
         // destroy the remaining elements
index af9db46f810b96b4a3fac3fcb3e97ef50f4cfb1f..392e5092e3b6a9845b0929e83da10f23ff959c77 100644 (file)
@@ -25,6 +25,7 @@
 use core::fmt;
 use core::iter::{self, repeat, FromIterator, IntoIterator, RandomAccessIterator};
 use core::mem;
+#[cfg(stage0)]
 use core::num::wrapping::WrappingOps;
 use core::ops::{Index, IndexMut};
 use core::ptr::{self, Unique};
@@ -142,8 +143,8 @@ unsafe fn copy(&self, dst: usize, src: usize, len: usize) {
         debug_assert!(src + len <= self.cap, "dst={} src={} len={} cap={}", dst, src, len,
                       self.cap);
         ptr::copy(
-            self.ptr.offset(dst as isize),
             self.ptr.offset(src as isize),
+            self.ptr.offset(dst as isize),
             len);
     }
 
@@ -155,8 +156,8 @@ unsafe fn copy_nonoverlapping(&self, dst: usize, src: usize, len: usize) {
         debug_assert!(src + len <= self.cap, "dst={} src={} len={} cap={}", dst, src, len,
                       self.cap);
         ptr::copy_nonoverlapping(
-            self.ptr.offset(dst as isize),
             self.ptr.offset(src as isize),
+            self.ptr.offset(dst as isize),
             len);
     }
 }
@@ -553,7 +554,7 @@ pub fn iter(&self) -> Iter<T> {
     ///     *num = *num - 2;
     /// }
     /// let b: &[_] = &[&mut 3, &mut 1, &mut 2];
-    /// assert_eq!(&buf.iter_mut().collect::<Vec<&mut i32>>()[], b);
+    /// assert_eq!(&buf.iter_mut().collect::<Vec<&mut i32>>()[..], b);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn iter_mut(&mut self) -> IterMut<T> {
@@ -1361,21 +1362,21 @@ pub fn split_off(&mut self, at: usize) -> Self {
                 // `at` lies in the first half.
                 let amount_in_first = first_len - at;
 
-                ptr::copy_nonoverlapping(*other.ptr,
-                                         first_half.as_ptr().offset(at as isize),
+                ptr::copy_nonoverlapping(first_half.as_ptr().offset(at as isize),
+                                         *other.ptr,
                                          amount_in_first);
 
                 // just take all of the second half.
-                ptr::copy_nonoverlapping(other.ptr.offset(amount_in_first as isize),
-                                         second_half.as_ptr(),
+                ptr::copy_nonoverlapping(second_half.as_ptr(),
+                                         other.ptr.offset(amount_in_first as isize),
                                          second_len);
             } else {
                 // `at` lies in the second half, need to factor in the elements we skipped
                 // in the first half.
                 let offset = at - first_len;
                 let amount_in_second = second_len - offset;
-                ptr::copy_nonoverlapping(*other.ptr,
-                                         second_half.as_ptr().offset(offset as isize),
+                ptr::copy_nonoverlapping(second_half.as_ptr().offset(offset as isize),
+                                         *other.ptr,
                                          amount_in_second);
             }
         }
@@ -1705,13 +1706,6 @@ fn hash<H: Hasher>(&self, state: &mut H) {
 impl<A> Index<usize> for VecDeque<A> {
     type Output = A;
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, i: &usize) -> &A {
-        self.get(*i).expect("Out of bounds access")
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, i: usize) -> &A {
         self.get(i).expect("Out of bounds access")
@@ -1720,13 +1714,6 @@ fn index(&self, i: usize) -> &A {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<A> IndexMut<usize> for VecDeque<A> {
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, i: &usize) -> &mut A {
-        self.get_mut(*i).expect("Out of bounds access")
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, i: usize) -> &mut A {
         self.get_mut(i).expect("Out of bounds access")
@@ -1799,7 +1786,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 #[cfg(test)]
 mod test {
-    use core::iter::{IteratorExt, self};
+    use core::iter::{Iterator, self};
     use core::option::Option::Some;
 
     use test;
index 58f9101d1d366046597aa756dcc5ab7eafc19f39..8900c7950458220f70c12816a5ea1d9995d15b60 100644 (file)
@@ -836,17 +836,6 @@ fn extend<I: IntoIterator<Item=(usize, V)>>(&mut self, iter: I) {
     }
 }
 
-#[cfg(stage0)]
-impl<V> Index<usize> for VecMap<V> {
-    type Output = V;
-
-    #[inline]
-    fn index<'a>(&'a self, i: &usize) -> &'a V {
-        self.get(i).expect("key not present")
-    }
-}
-
-#[cfg(not(stage0))]
 impl<V> Index<usize> for VecMap<V> {
     type Output = V;
 
@@ -856,7 +845,6 @@ fn index<'a>(&'a self, i: usize) -> &'a V {
     }
 }
 
-#[cfg(not(stage0))]
 impl<'a,V> Index<&'a usize> for VecMap<V> {
     type Output = V;
 
@@ -866,16 +854,6 @@ fn index(&self, i: &usize) -> &V {
     }
 }
 
-#[cfg(stage0)]
-#[stable(feature = "rust1", since = "1.0.0")]
-impl<V> IndexMut<usize> for VecMap<V> {
-    #[inline]
-    fn index_mut(&mut self, i: &usize) -> &mut V {
-        self.get_mut(&i).expect("key not present")
-    }
-}
-
-#[cfg(not(stage0))]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<V> IndexMut<usize> for VecMap<V> {
     #[inline]
@@ -884,7 +862,6 @@ fn index_mut(&mut self, i: usize) -> &mut V {
     }
 }
 
-#[cfg(not(stage0))]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, V> IndexMut<&'a usize> for VecMap<V> {
     #[inline]
index 2396a577589f2ee94f7a847372b68c4263bc3fd3..8f2e71b666c6b6dcdc1cea18da875e6123877b7d 100644 (file)
@@ -22,13 +22,13 @@ pub fn $name(b: &mut ::test::Bencher) {
             let mut rng = rand::weak_rng();
 
             for _ in 0..n {
-                let i = rng.gen() % n;
+                let i = rng.gen::<usize>() % n;
                 map.insert(i, i);
             }
 
             // measure
             b.iter(|| {
-                let k = rng.gen() % n;
+                let k = rng.gen::<usize>() % n;
                 map.insert(k, k);
                 map.remove(&k);
             });
@@ -66,7 +66,7 @@ macro_rules! map_find_rand_bench {
     ($name: ident, $n: expr, $map: ident) => (
         #[bench]
         pub fn $name(b: &mut ::test::Bencher) {
-            use std::iter::IteratorExt;
+            use std::iter::Iterator;
             use std::rand::Rng;
             use std::rand;
             use std::vec::Vec;
@@ -77,7 +77,7 @@ pub fn $name(b: &mut ::test::Bencher) {
 
             // setup
             let mut rng = rand::weak_rng();
-            let mut keys: Vec<_> = (0..n).map(|_| rng.gen() % n).collect();
+            let mut keys: Vec<_> = (0..n).map(|_| rng.gen::<usize>() % n).collect();
 
             for &k in &keys {
                 map.insert(k, k);
index c94d8e2ed0c8d8d5ee79f0743ff6a826c30968cd..d3bc07b173ac8e963f5541204ab68e3fded38731 100644 (file)
@@ -55,7 +55,7 @@
 //! }
 //!
 //! // This function wants to log its parameter out prior to doing work with it.
-//! fn do_work<T: Debug + 'static>(value: &T) {
+//! fn do_work<T: Any + Debug>(value: &T) {
 //!     log(value);
 //!     // ...do some other work
 //! }
@@ -76,7 +76,7 @@
 use option::Option::{self, Some, None};
 use raw::TraitObject;
 use intrinsics;
-use marker::Sized;
+use marker::{Reflect, Sized};
 
 ///////////////////////////////////////////////////////////////////////////////
 // Any trait
 ///
 /// [mod]: ../index.html
 #[stable(feature = "rust1", since = "1.0.0")]
-pub trait Any: 'static {
+pub trait Any: Reflect + 'static {
     /// Get the `TypeId` of `self`
     #[unstable(feature = "core",
                reason = "this method will likely be replaced by an associated static")]
     fn get_type_id(&self) -> TypeId;
 }
 
-impl<T: 'static> Any for T {
+impl<T> Any for T
+    where T: Reflect + 'static
+{
     fn get_type_id(&self) -> TypeId { TypeId::of::<T>() }
 }
 
@@ -107,7 +109,7 @@ impl Any {
     /// Returns true if the boxed type is the same as `T`
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn is<T: 'static>(&self) -> bool {
+    pub fn is<T: Any>(&self) -> bool {
         // Get TypeId of the type this function is instantiated with
         let t = TypeId::of::<T>();
 
@@ -122,7 +124,7 @@ pub fn is<T: 'static>(&self) -> bool {
     /// `None` if it isn't.
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn downcast_ref<T: 'static>(&self) -> Option<&T> {
+    pub fn downcast_ref<T: Any>(&self) -> Option<&T> {
         if self.is::<T>() {
             unsafe {
                 // Get the raw representation of the trait object
@@ -140,7 +142,7 @@ pub fn downcast_ref<T: 'static>(&self) -> Option<&T> {
     /// `None` if it isn't.
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> {
+    pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T> {
         if self.is::<T>() {
             unsafe {
                 // Get the raw representation of the trait object
@@ -159,21 +161,21 @@ impl Any+Send {
     /// Forwards to the method defined on the type `Any`.
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn is<T: 'static>(&self) -> bool {
+    pub fn is<T: Any>(&self) -> bool {
         Any::is::<T>(self)
     }
 
     /// Forwards to the method defined on the type `Any`.
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn downcast_ref<T: 'static>(&self) -> Option<&T> {
+    pub fn downcast_ref<T: Any>(&self) -> Option<&T> {
         Any::downcast_ref::<T>(self)
     }
 
     /// Forwards to the method defined on the type `Any`.
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> {
+    pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T> {
         Any::downcast_mut::<T>(self)
     }
 }
@@ -202,7 +204,7 @@ impl TypeId {
     /// instantiated with
     #[unstable(feature = "core",
                reason = "may grow a `Reflect` bound soon via marker traits")]
-    pub fn of<T: ?Sized + 'static>() -> TypeId {
+    pub fn of<T: ?Sized + Any>() -> TypeId {
         TypeId {
             t: unsafe { intrinsics::type_id::<T>() },
         }
index b2c23f051d5f1d1b96dd9eecd3b71915717c4078..91301ee558ca566315559f663a6948d11519f2ba 100644 (file)
@@ -18,6 +18,7 @@
 
 use clone::Clone;
 use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
+use convert::{AsRef, AsMut};
 use fmt;
 use hash::{Hash, self};
 use iter::IntoIterator;
@@ -53,6 +54,24 @@ fn as_mut_slice(&mut self) -> &mut [T] {
                 }
             }
 
+            #[unstable(feature = "array_as_ref",
+                       reason = "should ideally be implemented for all fixed-sized arrays")]
+            impl<T> AsRef<[T]> for [T; $N] {
+                #[inline]
+                fn as_ref(&self) -> &[T] {
+                    &self[..]
+                }
+            }
+
+            #[unstable(feature = "array_as_ref",
+                       reason = "should ideally be implemented for all fixed-sized arrays")]
+            impl<T> AsMut<[T]> for [T; $N] {
+                #[inline]
+                fn as_mut(&mut self) -> &mut [T] {
+                    &mut self[..]
+                }
+            }
+
             #[stable(feature = "rust1", since = "1.0.0")]
             impl<T:Copy> Clone for [T; $N] {
                 fn clone(&self) -> [T; $N] {
index c316236a8041291efd6ff1b588ecab8325b21921..91b4b46ac3979ec954968f7cda23b6475bb36d11 100644 (file)
@@ -252,7 +252,8 @@ pub fn swap(&self, val: bool, order: Ordering) -> bool {
 
     /// Stores a value into the bool if the current value is the same as the expected value.
     ///
-    /// If the return value is equal to `old` then the value was updated.
+    /// The return value is always the previous value. If it is equal to `old`, then the value was
+    /// updated.
     ///
     /// `swap` also takes an `Ordering` argument which describes the memory ordering of this
     /// operation.
@@ -489,7 +490,8 @@ pub fn swap(&self, val: isize, order: Ordering) -> isize {
 
     /// Stores a value into the isize if the current value is the same as the expected value.
     ///
-    /// If the return value is equal to `old` then the value was updated.
+    /// The return value is always the previous value. If it is equal to `old`, then the value was
+    /// updated.
     ///
     /// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
     /// this operation.
@@ -676,7 +678,8 @@ pub fn swap(&self, val: usize, order: Ordering) -> usize {
 
     /// Stores a value into the usize if the current value is the same as the expected value.
     ///
-    /// If the return value is equal to `old` then the value was updated.
+    /// The return value is always the previous value. If it is equal to `old`, then the value was
+    /// updated.
     ///
     /// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
     /// this operation.
@@ -873,7 +876,8 @@ pub fn swap(&self, ptr: *mut T, order: Ordering) -> *mut T {
 
     /// Stores a value into the pointer if the current value is the same as the expected value.
     ///
-    /// If the return value is equal to `old` then the value was updated.
+    /// The return value is always the previous value. If it is equal to `old`, then the value was
+    /// updated.
     ///
     /// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
     /// this operation.
@@ -1064,7 +1068,7 @@ pub fn fence(order: Ordering) {
              reason = "renamed to AtomicIsize")]
 #[allow(missing_docs)]
 pub struct AtomicInt {
-    v: UnsafeCell<int>,
+    v: UnsafeCell<isize>,
 }
 
 #[allow(deprecated)]
@@ -1075,7 +1079,7 @@ unsafe impl Sync for AtomicInt {}
              reason = "renamed to AtomicUsize")]
 #[allow(missing_docs)]
 pub struct AtomicUint {
-    v: UnsafeCell<uint>,
+    v: UnsafeCell<usize>,
 }
 
 #[allow(deprecated)]
@@ -1097,52 +1101,52 @@ unsafe impl Sync for AtomicUint {}
 #[allow(missing_docs, deprecated)]
 impl AtomicInt {
     #[inline]
-    pub fn new(v: int) -> AtomicInt {
+    pub fn new(v: isize) -> AtomicInt {
         AtomicInt {v: UnsafeCell::new(v)}
     }
 
     #[inline]
-    pub fn load(&self, order: Ordering) -> int {
+    pub fn load(&self, order: Ordering) -> isize {
         unsafe { atomic_load(self.v.get(), order) }
     }
 
     #[inline]
-    pub fn store(&self, val: int, order: Ordering) {
+    pub fn store(&self, val: isize, order: Ordering) {
         unsafe { atomic_store(self.v.get(), val, order); }
     }
 
     #[inline]
-    pub fn swap(&self, val: int, order: Ordering) -> int {
+    pub fn swap(&self, val: isize, order: Ordering) -> isize {
         unsafe { atomic_swap(self.v.get(), val, order) }
     }
 
     #[inline]
-    pub fn compare_and_swap(&self, old: int, new: int, order: Ordering) -> int {
+    pub fn compare_and_swap(&self, old: isize, new: isize, order: Ordering) -> isize {
         unsafe { atomic_compare_and_swap(self.v.get(), old, new, order) }
     }
 
     #[inline]
-    pub fn fetch_add(&self, val: int, order: Ordering) -> int {
+    pub fn fetch_add(&self, val: isize, order: Ordering) -> isize {
         unsafe { atomic_add(self.v.get(), val, order) }
     }
 
     #[inline]
-    pub fn fetch_sub(&self, val: int, order: Ordering) -> int {
+    pub fn fetch_sub(&self, val: isize, order: Ordering) -> isize {
         unsafe { atomic_sub(self.v.get(), val, order) }
     }
 
     #[inline]
-    pub fn fetch_and(&self, val: int, order: Ordering) -> int {
+    pub fn fetch_and(&self, val: isize, order: Ordering) -> isize {
         unsafe { atomic_and(self.v.get(), val, order) }
     }
 
     #[inline]
-    pub fn fetch_or(&self, val: int, order: Ordering) -> int {
+    pub fn fetch_or(&self, val: isize, order: Ordering) -> isize {
         unsafe { atomic_or(self.v.get(), val, order) }
     }
 
     #[inline]
-    pub fn fetch_xor(&self, val: int, order: Ordering) -> int {
+    pub fn fetch_xor(&self, val: isize, order: Ordering) -> isize {
         unsafe { atomic_xor(self.v.get(), val, order) }
     }
 }
@@ -1150,52 +1154,52 @@ pub fn fetch_xor(&self, val: int, order: Ordering) -> int {
 #[allow(missing_docs, deprecated)]
 impl AtomicUint {
     #[inline]
-    pub fn new(v: uint) -> AtomicUint {
+    pub fn new(v: usize) -> AtomicUint {
         AtomicUint { v: UnsafeCell::new(v) }
     }
 
     #[inline]
-    pub fn load(&self, order: Ordering) -> uint {
+    pub fn load(&self, order: Ordering) -> usize {
         unsafe { atomic_load(self.v.get(), order) }
     }
 
     #[inline]
-    pub fn store(&self, val: uint, order: Ordering) {
+    pub fn store(&self, val: usize, order: Ordering) {
         unsafe { atomic_store(self.v.get(), val, order); }
     }
 
     #[inline]
-    pub fn swap(&self, val: uint, order: Ordering) -> uint {
+    pub fn swap(&self, val: usize, order: Ordering) -> usize {
         unsafe { atomic_swap(self.v.get(), val, order) }
     }
 
     #[inline]
-    pub fn compare_and_swap(&self, old: uint, new: uint, order: Ordering) -> uint {
+    pub fn compare_and_swap(&self, old: usize, new: usize, order: Ordering) -> usize {
         unsafe { atomic_compare_and_swap(self.v.get(), old, new, order) }
     }
 
     #[inline]
-    pub fn fetch_add(&self, val: uint, order: Ordering) -> uint {
+    pub fn fetch_add(&self, val: usize, order: Ordering) -> usize {
         unsafe { atomic_add(self.v.get(), val, order) }
     }
 
     #[inline]
-    pub fn fetch_sub(&self, val: uint, order: Ordering) -> uint {
+    pub fn fetch_sub(&self, val: usize, order: Ordering) -> usize {
         unsafe { atomic_sub(self.v.get(), val, order) }
     }
 
     #[inline]
-    pub fn fetch_and(&self, val: uint, order: Ordering) -> uint {
+    pub fn fetch_and(&self, val: usize, order: Ordering) -> usize {
         unsafe { atomic_and(self.v.get(), val, order) }
     }
 
     #[inline]
-    pub fn fetch_or(&self, val: uint, order: Ordering) -> uint {
+    pub fn fetch_or(&self, val: usize, order: Ordering) -> usize {
         unsafe { atomic_or(self.v.get(), val, order) }
     }
 
     #[inline]
-    pub fn fetch_xor(&self, val: uint, order: Ordering) -> uint {
+    pub fn fetch_xor(&self, val: usize, order: Ordering) -> usize {
         unsafe { atomic_xor(self.v.get(), val, order) }
     }
 }
index 9ab8ab8672dfac71670014abe794beab39f3c505..9b8b59ec8ce6e0ffe3758e99ee3150fcf2fb9839 100644 (file)
@@ -20,8 +20,6 @@
 //!
 //! ```
 //! # #![feature(core)]
-//! use std::num::SignedInt;
-//!
 //! struct FuzzyNum {
 //!     num: i32,
 //! }
index 65a226d37cbc038c80f38c3ef532bc66a2c27ac6..21f9b1f5513aaaf7f7c8d5184616c3f3552371b8 100644 (file)
@@ -69,6 +69,14 @@ fn as_ref(&self) -> &U {
     }
 }
 
+// FIXME (#23442): replace the above impls for &/&mut with the following more general one:
+// // As lifts over Deref
+// impl<D: ?Sized + Deref, U: ?Sized> AsRef<U> for D where D::Target: AsRef<U> {
+//     fn as_ref(&self) -> &U {
+//         self.deref().as_ref()
+//     }
+// }
+
 // AsMut implies Into
 impl<'a, T: ?Sized, U: ?Sized> Into<&'a mut U> for &'a mut T where T: AsMut<U> {
     fn into(self) -> &'a mut U {
@@ -83,6 +91,14 @@ fn as_mut(&mut self) -> &mut U {
     }
 }
 
+// FIXME (#23442): replace the above impl for &mut with the following more general one:
+// // AsMut lifts over DerefMut
+// impl<D: ?Sized + Deref, U: ?Sized> AsMut<U> for D where D::Target: AsMut<U> {
+//     fn as_mut(&mut self) -> &mut U {
+//         self.deref_mut().as_mut()
+//     }
+// }
+
 // From implies Into
 impl<T, U> Into<U> for T where U: From<T> {
     fn into(self) -> U {
index d7b4c9411fb4efc0bfbd9f715dc5ab7cb2df5356..9430aa0066871326399b577f02d72884cf3eae68 100644 (file)
 //! For example,
 //!
 //! ```
-//! # #![feature(os, old_io, old_path)]
+//! #![feature(core)]
 //! use std::error::FromError;
-//! use std::old_io::{File, IoError};
-//! use std::os::{MemoryMap, MapError};
-//! use std::old_path::Path;
+//! use std::{io, str};
+//! use std::fs::File;
 //!
 //! enum MyError {
-//!     Io(IoError),
-//!     Map(MapError)
+//!     Io(io::Error),
+//!     Utf8(str::Utf8Error),
 //! }
 //!
-//! impl FromError<IoError> for MyError {
-//!     fn from_error(err: IoError) -> MyError {
-//!         MyError::Io(err)
-//!     }
+//! impl FromError<io::Error> for MyError {
+//!     fn from_error(err: io::Error) -> MyError { MyError::Io(err) }
 //! }
 //!
-//! impl FromError<MapError> for MyError {
-//!     fn from_error(err: MapError) -> MyError {
-//!         MyError::Map(err)
-//!     }
+//! impl FromError<str::Utf8Error> for MyError {
+//!     fn from_error(err: str::Utf8Error) -> MyError { MyError::Utf8(err) }
 //! }
 //!
 //! #[allow(unused_variables)]
 //! fn open_and_map() -> Result<(), MyError> {
-//!     let f = try!(File::open(&Path::new("foo.txt")));
-//!     let m = try!(MemoryMap::new(0, &[]));
+//!     let b = b"foo.txt";
+//!     let s = try!(str::from_utf8(b));
+//!     let f = try!(File::open(s));
+//!
 //!     // do something interesting here...
 //!     Ok(())
 //! }
@@ -87,7 +84,7 @@
 
 /// Base functionality for all errors in Rust.
 #[stable(feature = "rust1", since = "1.0.0")]
-pub trait Error: Debug + Display + Send {
+pub trait Error: Debug + Display {
     /// A short description of the error.
     ///
     /// The description should not contain newlines or sentence-ending
index 07f029cc15e2f219172350e7a6c15484f32271df..f61a7f2d30c62cd418b949bd0b301b2ee13a06d3 100644 (file)
@@ -177,22 +177,54 @@ fn is_pretty(&self) -> bool {
     }
 }
 
+struct DebugInner<'a, 'b: 'a> {
+    fmt: &'a mut fmt::Formatter<'b>,
+    result: fmt::Result,
+    has_fields: bool,
+}
+
+impl<'a, 'b: 'a> DebugInner<'a, 'b> {
+    fn entry(&mut self, entry: &fmt::Debug) {
+        self.result = self.result.and_then(|_| {
+            if self.is_pretty() {
+                let mut writer = PadAdapter::new(self.fmt);
+                let prefix = if self.has_fields { "," } else { "" };
+                fmt::write(&mut writer, format_args!("{}\n{:#?}", prefix, entry))
+            } else {
+                let prefix = if self.has_fields { ", " } else { "" };
+                write!(self.fmt, "{}{:?}", prefix, entry)
+            }
+        });
+
+        self.has_fields = true;
+    }
+
+    pub fn finish(&mut self) {
+        let prefix = if self.is_pretty() && self.has_fields { "\n" } else { "" };
+        self.result = self.result.and_then(|_| self.fmt.write_str(prefix));
+    }
+
+    fn is_pretty(&self) -> bool {
+        self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
+    }
+}
+
 /// A struct to help with `fmt::Debug` implementations.
 ///
 /// Constructed by the `Formatter::debug_set` method.
 #[must_use]
 pub struct DebugSet<'a, 'b: 'a> {
-    fmt: &'a mut fmt::Formatter<'b>,
-    result: fmt::Result,
-    has_fields: bool,
+    inner: DebugInner<'a, 'b>,
 }
 
-pub fn debug_set_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, name: &str) -> DebugSet<'a, 'b> {
-    let result = write!(fmt, "{} {{", name);
+pub fn debug_set_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugSet<'a, 'b> {
+    let result = write!(fmt, "{{");
     DebugSet {
-        fmt: fmt,
-        result: result,
-        has_fields: false,
+        inner: DebugInner {
+            fmt: fmt,
+            result: result,
+            has_fields: false,
+        }
     }
 }
 
@@ -200,41 +232,52 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {
     /// Adds a new entry to the set output.
     #[unstable(feature = "debug_builders", reason = "method was just created")]
     pub fn entry(mut self, entry: &fmt::Debug) -> DebugSet<'a, 'b> {
-        self.result = self.result.and_then(|_| {
-            let prefix = if self.has_fields {
-                ","
-            } else {
-                ""
-            };
-
-            if self.is_pretty() {
-                let mut writer = PadAdapter::new(self.fmt);
-                fmt::write(&mut writer, format_args!("{}\n{:#?}", prefix, entry))
-            } else {
-                write!(self.fmt, "{} {:?}", prefix, entry)
-            }
-        });
-
-        self.has_fields = true;
+        self.inner.entry(entry);
         self
     }
 
     /// Consumes the `DebugSet`, finishing output and returning any error
     /// encountered.
     #[unstable(feature = "debug_builders", reason = "method was just created")]
-    pub fn finish(self) -> fmt::Result {
-        self.result.and_then(|_| {
-            let end = match (self.has_fields, self.is_pretty()) {
-                (false, _) => "}",
-                (true, false) => " }",
-                (true, true) => "\n}",
-            };
-            self.fmt.write_str(end)
-        })
+    pub fn finish(mut self) -> fmt::Result {
+        self.inner.finish();
+        self.inner.result.and_then(|_| self.inner.fmt.write_str("}"))
     }
+}
 
-    fn is_pretty(&self) -> bool {
-        self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
+/// A struct to help with `fmt::Debug` implementations.
+///
+/// Constructed by the `Formatter::debug_list` method.
+#[must_use]
+pub struct DebugList<'a, 'b: 'a> {
+    inner: DebugInner<'a, 'b>,
+}
+
+pub fn debug_list_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugList<'a, 'b> {
+    let result = write!(fmt, "[");
+    DebugList {
+        inner: DebugInner {
+            fmt: fmt,
+            result: result,
+            has_fields: false,
+        }
+    }
+}
+
+impl<'a, 'b: 'a> DebugList<'a, 'b> {
+    /// Adds a new entry to the set output.
+    #[unstable(feature = "debug_builders", reason = "method was just created")]
+    pub fn entry(mut self, entry: &fmt::Debug) -> DebugList<'a, 'b> {
+        self.inner.entry(entry);
+        self
+    }
+
+    /// Consumes the `DebugSet`, finishing output and returning any error
+    /// encountered.
+    #[unstable(feature = "debug_builders", reason = "method was just created")]
+    pub fn finish(mut self) -> fmt::Result {
+        self.inner.finish();
+        self.inner.result.and_then(|_| self.inner.fmt.write_str("]"))
     }
 }
 
@@ -248,8 +291,8 @@ pub struct DebugMap<'a, 'b: 'a> {
     has_fields: bool,
 }
 
-pub fn debug_map_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, name: &str) -> DebugMap<'a, 'b> {
-    let result = write!(fmt, "{} {{", name);
+pub fn debug_map_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugMap<'a, 'b> {
+    let result = write!(fmt, "{{");
     DebugMap {
         fmt: fmt,
         result: result,
@@ -262,22 +305,17 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
     #[unstable(feature = "debug_builders", reason = "method was just created")]
     pub fn entry(mut self, key: &fmt::Debug, value: &fmt::Debug) -> DebugMap<'a, 'b> {
         self.result = self.result.and_then(|_| {
-            let prefix = if self.has_fields {
-                ","
-            } else {
-                ""
-            };
-
             if self.is_pretty() {
                 let mut writer = PadAdapter::new(self.fmt);
+                let prefix = if self.has_fields { "," } else { "" };
                 fmt::write(&mut writer, format_args!("{}\n{:#?}: {:#?}", prefix, key, value))
             } else {
-                write!(self.fmt, "{} {:?}: {:?}", prefix, key, value)
+                let prefix = if self.has_fields { ", " } else { "" };
+                write!(self.fmt, "{}{:?}: {:?}", prefix, key, value)
             }
         });
 
         self.has_fields = true;
-
         self
     }
 
@@ -285,14 +323,8 @@ pub fn entry(mut self, key: &fmt::Debug, value: &fmt::Debug) -> DebugMap<'a, 'b>
     /// encountered.
     #[unstable(feature = "debug_builders", reason = "method was just created")]
     pub fn finish(self) -> fmt::Result {
-        self.result.and_then(|_| {
-            let end = match (self.has_fields, self.is_pretty()) {
-                (false, _) => "}",
-                (true, false) => " }",
-                (true, true) => "\n}",
-            };
-            self.fmt.write_str(end)
-        })
+        let prefix = if self.is_pretty() && self.has_fields { "\n" } else { "" };
+        self.result.and_then(|_| write!(self.fmt, "{}}}", prefix))
     }
 
     fn is_pretty(&self) -> bool {
index 0df04c296c8aee771002f1438487a21355aef03e..6a5943265ca88fee04ccecb1ba986b6d7ab85ad0 100644 (file)
@@ -17,7 +17,7 @@
 use char;
 use char::CharExt;
 use fmt;
-use iter::IteratorExt;
+use iter::Iterator;
 use num::{cast, Float, ToPrimitive};
 use num::FpCategory as Fp;
 use ops::FnOnce;
@@ -125,7 +125,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
     // otherwise as well.
     let mut buf = [0; 1536];
     let mut end = 0;
-    let radix_gen: T = cast(radix as int).unwrap();
+    let radix_gen: T = cast(radix as isize).unwrap();
 
     let (num, exp) = match exp_format {
         ExpNone => (num, 0),
@@ -235,7 +235,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
             let extra_digit = ascii2value(buf[end - 1]);
             end -= 1;
             if extra_digit >= radix / 2 { // -> need to round
-                let mut i: int = end as int - 1;
+                let mut i: isize = end as isize - 1;
                 loop {
                     // If reached left end of number, have to
                     // insert additional digit:
@@ -316,8 +316,8 @@ struct Filler<'a> {
 
             impl<'a> fmt::Write for Filler<'a> {
                 fn write_str(&mut self, s: &str) -> fmt::Result {
-                    slice::bytes::copy_memory(&mut self.buf[(*self.end)..],
-                                              s.as_bytes());
+                    slice::bytes::copy_memory(s.as_bytes(),
+                                              &mut self.buf[(*self.end)..]);
                     *self.end += s.len();
                     Ok(())
                 }
index aa0d0a1539a30e045ba424a52b1f4861da689629..ffb358cdac84d90854623e1dc969473269edeb09 100644 (file)
@@ -15,7 +15,7 @@
 use any;
 use cell::{Cell, RefCell, Ref, RefMut, BorrowState};
 use char::CharExt;
-use iter::{Iterator, IteratorExt};
+use iter::Iterator;
 use marker::{Copy, PhantomData, Sized};
 use mem;
 use option::Option;
@@ -32,7 +32,7 @@
 pub use self::num::Radix;
 pub use self::num::RadixFmt;
 
-pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugMap};
+pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugList, DebugMap};
 
 mod num;
 mod float;
@@ -644,7 +644,7 @@ pub fn precision(&self) -> Option<usize> { self.precision }
     /// // prints "Foo { bar: 10, baz: "Hello World" }"
     /// println!("{:?}", Foo { bar: 10, baz: "Hello World".to_string() });
     /// ```
-    #[unstable(feature = "core", reason = "method was just created")]
+    #[unstable(feature = "debug_builders", reason = "method was just created")]
     #[inline]
     pub fn debug_struct<'b>(&'b mut self, name: &str) -> DebugStruct<'b, 'a> {
         builders::debug_struct_new(self, name)
@@ -673,12 +673,38 @@ pub fn debug_struct<'b>(&'b mut self, name: &str) -> DebugStruct<'b, 'a> {
     /// // prints "Foo(10, "Hello World")"
     /// println!("{:?}", Foo(10, "Hello World".to_string()));
     /// ```
-    #[unstable(feature = "core", reason = "method was just created")]
+    #[unstable(feature = "debug_builders", reason = "method was just created")]
     #[inline]
     pub fn debug_tuple<'b>(&'b mut self, name: &str) -> DebugTuple<'b, 'a> {
         builders::debug_tuple_new(self, name)
     }
 
+    /// Creates a `DebugList` builder designed to assist with creation of
+    /// `fmt::Debug` implementations for list-like structures.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// # #![feature(debug_builders, core)]
+    /// use std::fmt;
+    ///
+    /// struct Foo(Vec<i32>);
+    ///
+    /// impl fmt::Debug for Foo {
+    ///     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+    ///         self.0.iter().fold(fmt.debug_list(), |b, e| b.entry(e)).finish()
+    ///     }
+    /// }
+    ///
+    /// // prints "[10, 11]"
+    /// println!("{:?}", Foo(vec![10, 11]));
+    /// ```
+    #[unstable(feature = "debug_builders", reason = "method was just created")]
+    #[inline]
+    pub fn debug_list<'b>(&'b mut self) -> DebugList<'b, 'a> {
+        builders::debug_list_new(self)
+    }
+
     /// Creates a `DebugSet` builder designed to assist with creation of
     /// `fmt::Debug` implementations for set-like structures.
     ///
@@ -692,21 +718,17 @@ pub fn debug_tuple<'b>(&'b mut self, name: &str) -> DebugTuple<'b, 'a> {
     ///
     /// impl fmt::Debug for Foo {
     ///     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-    ///         let mut builder = fmt.debug_set("Foo");
-    ///         for i in &self.0 {
-    ///             builder = builder.entry(i);
-    ///         }
-    ///         builder.finish()
+    ///         self.0.iter().fold(fmt.debug_set(), |b, e| b.entry(e)).finish()
     ///     }
     /// }
     ///
-    /// // prints "Foo { 10, 11 }"
+    /// // prints "{10, 11}"
     /// println!("{:?}", Foo(vec![10, 11]));
     /// ```
-    #[unstable(feature = "core", reason = "method was just created")]
+    #[unstable(feature = "debug_builders", reason = "method was just created")]
     #[inline]
-    pub fn debug_set<'b>(&'b mut self, name: &str) -> DebugSet<'b, 'a> {
-        builders::debug_set_new(self, name)
+    pub fn debug_set<'b>(&'b mut self) -> DebugSet<'b, 'a> {
+        builders::debug_set_new(self)
     }
 
     /// Creates a `DebugMap` builder designed to assist with creation of
@@ -722,21 +744,17 @@ pub fn debug_set<'b>(&'b mut self, name: &str) -> DebugSet<'b, 'a> {
     ///
     /// impl fmt::Debug for Foo {
     ///     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-    ///         let mut builder = fmt.debug_map("Foo");
-    ///         for &(ref key, ref value) in &self.0 {
-    ///             builder = builder.entry(key, value);
-    ///         }
-    ///         builder.finish()
+    ///         self.0.iter().fold(fmt.debug_map(), |b, &(ref k, ref v)| b.entry(k, v)).finish()
     ///     }
     /// }
     ///
-    /// // prints "Foo { "A": 10, "B": 11 }"
+    /// // prints "{"A": 10, "B": 11}"
     /// println!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)]));
     /// ```
-    #[unstable(feature = "core", reason = "method was just created")]
+    #[unstable(feature = "debug_builders", reason = "method was just created")]
     #[inline]
-    pub fn debug_map<'b>(&'b mut self, name: &str) -> DebugMap<'b, 'a> {
-        builders::debug_map_new(self, name)
+    pub fn debug_map<'b>(&'b mut self) -> DebugMap<'b, 'a> {
+        builders::debug_map_new(self)
     }
 }
 
@@ -987,22 +1005,7 @@ fn fmt(&self, f: &mut Formatter) -> Result { f.pad("&Any") }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: Debug> Debug for [T] {
     fn fmt(&self, f: &mut Formatter) -> Result {
-        if f.flags & (1 << (FlagV1::Alternate as u32)) == 0 {
-            try!(write!(f, "["));
-        }
-        let mut is_first = true;
-        for x in self {
-            if is_first {
-                is_first = false;
-            } else {
-                try!(write!(f, ", "));
-            }
-            try!(write!(f, "{:?}", *x))
-        }
-        if f.flags & (1 << (FlagV1::Alternate as u32)) == 0 {
-            try!(write!(f, "]"));
-        }
-        Ok(())
+        self.iter().fold(f.debug_list(), |b, e| b.entry(e)).finish()
     }
 }
 
index 56d2eabc095a3f0f4aa538481a590fe12504df55..f3f5a0b70cb742117bd9cb3db937d653e16b5aba 100644 (file)
 // FIXME: #6220 Implement floating point formatting
 
 #![allow(unsigned_negation)]
-#![allow(trivial_numeric_casts)]
 
 use fmt;
-use iter::IteratorExt;
+use iter::Iterator;
 use num::{Int, cast};
 use slice::SliceExt;
 use str;
@@ -34,6 +33,7 @@ fn prefix(&self) -> &'static str { "" }
     fn digit(&self, x: u8) -> u8;
 
     /// Format an integer using the radix using a formatter.
+    #[allow(deprecated)] // Int
     fn fmt_int<T: Int>(&self, mut x: T, f: &mut fmt::Formatter) -> fmt::Result {
         // The radix can be as low as 2, so we need a buffer of at least 64
         // characters for a base 2 number.
index 2feb2f8b1e36372d8121b54f2167b631c2d04879..2375ae896500586799867ef4cd6ab5d23d76380a 100644 (file)
 ///
 /// The `H` type parameter is an abstract hash state that is used by the `Hash`
 /// to compute the hash.
+///
+/// If you are also implementing `Eq`, there is an additional property that
+/// is important:
+///
+/// ```text
+/// k1 == k2 -> hash(k1) == hash(k2)
+/// ```
+///
+/// In other words, if two keys are equal, their hashes should also be equal.
+/// `HashMap` and `HashSet` both rely on this behavior.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait Hash {
     /// Feeds this value into the state given, updating the hasher as necessary.
index bd1516e0cfcc8b49e57334af9a99036b14a5cc4f..e65fbac926bd91e854a12023b093f90412215896 100644 (file)
 
 //! An implementation of SipHash 2-4.
 
+#![allow(deprecated)] // until the next snapshot for inherent wrapping ops
+
 use prelude::*;
 use default::Default;
-use num::wrapping::WrappingOps;
 use super::Hasher;
 
 /// An implementation of SipHash 2-4.
@@ -71,7 +72,7 @@ macro_rules! u8to64_le {
 
 macro_rules! rotl {
     ($x:expr, $b:expr) =>
-    (($x << $b) | ($x >> (64.wrapping_sub($b))))
+    (($x << $b) | ($x >> (64_i32.wrapping_sub($b))))
 }
 
 macro_rules! compress {
index 1f1044b0b21520d0148877edbe132faf6e9c5a6e..43cf64bf3ad9dfbe2af6ec10269dd70c06aa7d94 100644 (file)
 
 use marker::Sized;
 
-#[cfg(stage0)] pub use self::copy_memory as copy;
-#[cfg(stage0)] pub use self::set_memory as write_bytes;
-#[cfg(stage0)] pub use self::copy_nonoverlapping_memory as copy_nonoverlapping;
-
 extern "rust-intrinsic" {
 
     // NB: These intrinsics take unsafe pointers because they mutate aliased
     pub fn pref_align_of<T>() -> usize;
 
     /// Gets a static string slice containing the name of a type.
-    #[cfg(not(stage0))]
     pub fn type_name<T: ?Sized>() -> &'static str;
 
     /// Gets an identifier which is globally unique to the specified type. This
     /// crate it is invoked in.
     pub fn type_id<T: ?Sized + 'static>() -> u64;
 
+    /// Create a value initialized to so that its drop flag,
+    /// if any, says that it has been dropped.
+    ///
+    /// `init_dropped` is unsafe because it returns a datum with all
+    /// of its bytes set to the drop flag, which generally does not
+    /// correspond to a valid value.
+    ///
+    /// This intrinsic is likely to be deprecated in the future when
+    /// Rust moves to non-zeroing dynamic drop (and thus removes the
+    /// embedded drop flags that are being established by this
+    /// intrinsic).
+    #[cfg(not(stage0))]
+    pub fn init_dropped<T>() -> T;
+
     /// Create a value initialized to zero.
     ///
     /// `init` is unsafe because it returns a zeroed-out datum,
-    /// which is unsafe unless T is Copy.
+    /// which is unsafe unless T is `Copy`.  Also, even if T is
+    /// `Copy`, an all-zero value may not correspond to any legitimate
+    /// state for the type in question.
     pub fn init<T>() -> T;
 
     /// Create an uninitialized value.
+    ///
+    /// `uninit` is unsafe because there is no guarantee of what its
+    /// contents are. In particular its drop-flag may be set to any
+    /// state, which means it may claim either dropped or
+    /// undropped. In the general case one must use `ptr::write` to
+    /// initialize memory previous set to the result of `uninit`.
     pub fn uninit<T>() -> T;
 
     /// Move a value out of scope without running drop glue.
     ///         let mut t: T = mem::uninitialized();
     ///
     ///         // Perform the swap, `&mut` pointers never alias
-    ///         ptr::copy_nonoverlapping(&mut t, &*x, 1);
-    ///         ptr::copy_nonoverlapping(x, &*y, 1);
-    ///         ptr::copy_nonoverlapping(y, &t, 1);
+    ///         ptr::copy_nonoverlapping(x, &mut t, 1);
+    ///         ptr::copy_nonoverlapping(y, x, 1);
+    ///         ptr::copy_nonoverlapping(&t, y, 1);
     ///
     ///         // y and t now point to the same thing, but we need to completely forget `tmp`
     ///         // because it's no longer relevant.
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[cfg(not(stage0))]
-    pub fn copy_nonoverlapping<T>(dst: *mut T, src: *const T, count: usize);
+    pub fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
 
     /// dox
     #[stable(feature = "rust1", since = "1.0.0")]
     #[cfg(stage0)]
-    pub fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: usize);
+    pub fn copy_nonoverlapping<T>(dst: *mut T, src: *const T, count: usize);
 
     /// Copies `count * size_of<T>` bytes from `src` to `dst`. The source
     /// and destination may overlap.
     /// # #![feature(core)]
     /// use std::ptr;
     ///
-    /// unsafe fn from_buf_raw<T>(ptr: *const T, elts: uint) -> Vec<T> {
+    /// unsafe fn from_buf_raw<T>(ptr: *const T, elts: usize) -> Vec<T> {
     ///     let mut dst = Vec::with_capacity(elts);
     ///     dst.set_len(elts);
-    ///     ptr::copy(dst.as_mut_ptr(), ptr, elts);
+    ///     ptr::copy(ptr, dst.as_mut_ptr(), elts);
     ///     dst
     /// }
     /// ```
     ///
-    #[cfg(not(stage0))]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn copy<T>(dst: *mut T, src: *const T, count: usize);
+    #[cfg(not(stage0))]
+    pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
 
     /// dox
-    #[cfg(stage0)]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn copy_memory<T>(dst: *mut T, src: *const T, count: usize);
+    #[cfg(stage0)]
+    pub fn copy<T>(dst: *mut T, src: *const T, count: usize);
 
     /// Invokes memset on the specified pointer, setting `count * size_of::<T>()`
     /// bytes of memory starting at `dst` to `c`.
-    #[cfg(not(stage0))]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
 
-    /// dox
-    #[cfg(stage0)]
-    #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn set_memory<T>(dst: *mut T, val: u8, count: usize);
-
     /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
     /// a size of `count` * `size_of::<T>()` and an alignment of
     /// `min_align_of::<T>()`
index 5f5b8ef73ef54edf1702e92c64369b5e318a38d6..44d48f9f4bf9d18d3ff023c3f9840b5a98dc99e5 100644 (file)
 use default::Default;
 use marker;
 use mem;
-use num::{ToPrimitive, Int};
-use ops::{Add, FnMut, RangeFrom};
+use num::{Int, Zero, One, ToPrimitive};
+use ops::{Add, Sub, FnMut, RangeFrom};
 use option::Option;
 use option::Option::{Some, None};
 use marker::Sized;
 use usize;
 
+fn _assert_is_object_safe(_: &Iterator) {}
+
 /// An interface for dealing with "external iterators". These types of iterators
 /// can be resumed at any time as all state is stored internally as opposed to
 /// being located on the call stack.
@@ -101,62 +103,7 @@ pub trait Iterator {
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn size_hint(&self) -> (usize, Option<usize>) { (0, None) }
-}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, I: Iterator + ?Sized> Iterator for &'a mut I {
-    type Item = I::Item;
-    fn next(&mut self) -> Option<I::Item> { (**self).next() }
-    fn size_hint(&self) -> (usize, Option<usize>) { (**self).size_hint() }
-}
-
-/// Conversion from an `Iterator`
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_on_unimplemented="a collection of type `{Self}` cannot be \
-                          built from an iterator over elements of type `{A}`"]
-pub trait FromIterator<A> {
-    /// Build a container with elements from something iterable.
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn from_iter<T: IntoIterator<Item=A>>(iterator: T) -> Self;
-}
-
-/// Conversion into an `Iterator`
-#[stable(feature = "rust1", since = "1.0.0")]
-pub trait IntoIterator {
-    /// The type of the elements being iterated
-    #[stable(feature = "rust1", since = "1.0.0")]
-    type Item;
-
-    /// A container for iterating over elements of type Item
-    #[stable(feature = "rust1", since = "1.0.0")]
-    type IntoIter: Iterator<Item=Self::Item>;
-
-    /// Consumes `Self` and returns an iterator over it
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn into_iter(self) -> Self::IntoIter;
-}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-impl<I: Iterator> IntoIterator for I {
-    type Item = I::Item;
-    type IntoIter = I;
-
-    fn into_iter(self) -> I {
-        self
-    }
-}
 
-/// A type growable from an `Iterator` implementation
-#[stable(feature = "rust1", since = "1.0.0")]
-pub trait Extend<A> {
-    /// Extend a container with the elements yielded by an arbitrary iterator
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn extend<T: IntoIterator<Item=A>>(&mut self, iterable: T);
-}
-
-/// An extension trait providing numerous methods applicable to all iterators.
-#[stable(feature = "rust1", since = "1.0.0")]
-pub trait IteratorExt: Iterator + Sized {
     /// Counts the number of elements in this iterator.
     ///
     /// # Examples
@@ -167,7 +114,7 @@ pub trait IteratorExt: Iterator + Sized {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn count(self) -> usize {
+    fn count(self) -> usize where Self: Sized {
         self.fold(0, |cnt, _x| cnt + 1)
     }
 
@@ -181,7 +128,7 @@ fn count(self) -> usize {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn last(self) -> Option<Self::Item> {
+    fn last(self) -> Option<Self::Item> where Self: Sized {
         let mut last = None;
         for x in self { last = Some(x); }
         last
@@ -200,7 +147,7 @@ fn last(self) -> Option<Self::Item> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn nth(&mut self, mut n: usize) -> Option<Self::Item> {
+    fn nth(&mut self, mut n: usize) -> Option<Self::Item> where Self: Sized {
         for x in self.by_ref() {
             if n == 0 { return Some(x) }
             n -= 1;
@@ -225,7 +172,7 @@ fn nth(&mut self, mut n: usize) -> Option<Self::Item> {
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn chain<U>(self, other: U) -> Chain<Self, U> where
-        U: Iterator<Item=Self::Item>,
+        Self: Sized, U: Iterator<Item=Self::Item>,
     {
         Chain{a: self, b: other, flag: false}
     }
@@ -244,9 +191,23 @@ fn chain<U>(self, other: U) -> Chain<Self, U> where
     /// assert_eq!(it.next().unwrap(), (&0, &1));
     /// assert!(it.next().is_none());
     /// ```
+    ///
+    /// `zip` can provide similar functionality to `enumerate`:
+    ///
+    /// ```
+    /// for pair in "foo".chars().enumerate() {
+    ///     println!("{:?}", pair);
+    /// }
+    ///
+    /// for pair in (0..).zip("foo".chars()) {
+    ///     println!("{:?}", pair);
+    /// }
+    /// ```
+    ///
+    /// both produce the same output.
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn zip<U: Iterator>(self, other: U) -> Zip<Self, U> {
+    fn zip<U: Iterator>(self, other: U) -> Zip<Self, U> where Self: Sized {
         Zip{a: self, b: other}
     }
 
@@ -265,7 +226,7 @@ fn zip<U: Iterator>(self, other: U) -> Zip<Self, U> {
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn map<B, F>(self, f: F) -> Map<Self, F> where
-        F: FnMut(Self::Item) -> B,
+        Self: Sized, F: FnMut(Self::Item) -> B,
     {
         Map{iter: self, f: f}
     }
@@ -285,7 +246,7 @@ fn map<B, F>(self, f: F) -> Map<Self, F> where
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn filter<P>(self, predicate: P) -> Filter<Self, P> where
-        P: FnMut(&Self::Item) -> bool,
+        Self: Sized, P: FnMut(&Self::Item) -> bool,
     {
         Filter{iter: self, predicate: predicate}
     }
@@ -305,7 +266,7 @@ fn filter<P>(self, predicate: P) -> Filter<Self, P> where
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where
-        F: FnMut(Self::Item) -> Option<B>,
+        Self: Sized, F: FnMut(Self::Item) -> Option<B>,
     {
         FilterMap { iter: self, f: f }
     }
@@ -313,6 +274,9 @@ fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where
     /// Creates an iterator that yields a pair of the value returned by this
     /// iterator plus the current index of iteration.
     ///
+    /// `enumerate` keeps its count as a `usize`. If you want to count by a
+    /// different sized integer, the `zip` function provides similar functionality.
+    ///
     /// # Examples
     ///
     /// ```
@@ -324,7 +288,7 @@ fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn enumerate(self) -> Enumerate<Self> {
+    fn enumerate(self) -> Enumerate<Self> where Self: Sized {
         Enumerate{iter: self, count: 0}
     }
 
@@ -348,7 +312,7 @@ fn enumerate(self) -> Enumerate<Self> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn peekable(self) -> Peekable<Self> {
+    fn peekable(self) -> Peekable<Self> where Self: Sized {
         Peekable{iter: self, peeked: None}
     }
 
@@ -369,7 +333,7 @@ fn peekable(self) -> Peekable<Self> {
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
-        P: FnMut(&Self::Item) -> bool,
+        Self: Sized, P: FnMut(&Self::Item) -> bool,
     {
         SkipWhile{iter: self, flag: false, predicate: predicate}
     }
@@ -390,7 +354,7 @@ fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where
-        P: FnMut(&Self::Item) -> bool,
+        Self: Sized, P: FnMut(&Self::Item) -> bool,
     {
         TakeWhile{iter: self, flag: false, predicate: predicate}
     }
@@ -409,7 +373,7 @@ fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn skip(self, n: usize) -> Skip<Self> {
+    fn skip(self, n: usize) -> Skip<Self> where Self: Sized {
         Skip{iter: self, n: n}
     }
 
@@ -428,7 +392,7 @@ fn skip(self, n: usize) -> Skip<Self> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn take(self, n: usize) -> Take<Self> {
+    fn take(self, n: usize) -> Take<Self> where Self: Sized, {
         Take{iter: self, n: n}
     }
 
@@ -455,7 +419,7 @@ fn take(self, n: usize) -> Take<Self> {
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
-        where F: FnMut(&mut St, Self::Item) -> Option<B>,
+        where Self: Sized, F: FnMut(&mut St, Self::Item) -> Option<B>,
     {
         Scan{iter: self, f: f, state: initial_state}
     }
@@ -478,7 +442,7 @@ fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
-        where U: Iterator, F: FnMut(Self::Item) -> U,
+        where Self: Sized, U: Iterator, F: FnMut(Self::Item) -> U,
     {
         FlatMap{iter: self, f: f, frontiter: None, backiter: None }
     }
@@ -512,7 +476,7 @@ fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fuse(self) -> Fuse<Self> {
+    fn fuse(self) -> Fuse<Self> where Self: Sized {
         Fuse{iter: self, done: false}
     }
 
@@ -538,7 +502,7 @@ fn fuse(self) -> Fuse<Self> {
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn inspect<F>(self, f: F) -> Inspect<Self, F> where
-        F: FnMut(&Self::Item),
+        Self: Sized, F: FnMut(&Self::Item),
     {
         Inspect{iter: self, f: f}
     }
@@ -558,7 +522,7 @@ fn inspect<F>(self, f: F) -> Inspect<Self, F> where
     /// assert!(it.next() == Some(5));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn by_ref(&mut self) -> &mut Self { self }
+    fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
 
     /// Loops through the entire iterator, collecting all of the elements into
     /// a container implementing `FromIterator`.
@@ -573,7 +537,7 @@ fn by_ref(&mut self) -> &mut Self { self }
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn collect<B: FromIterator<Self::Item>>(self) -> B {
+    fn collect<B: FromIterator<Self::Item>>(self) -> B where Self: Sized {
         FromIterator::from_iter(self)
     }
 
@@ -592,6 +556,7 @@ fn collect<B: FromIterator<Self::Item>>(self) -> B {
     #[unstable(feature = "core",
                reason = "recently added as part of collections reform")]
     fn partition<B, F>(self, mut f: F) -> (B, B) where
+        Self: Sized,
         B: Default + Extend<Self::Item>,
         F: FnMut(&Self::Item) -> bool
     {
@@ -621,7 +586,7 @@ fn partition<B, F>(self, mut f: F) -> (B, B) where
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn fold<B, F>(self, init: B, mut f: F) -> B where
-        F: FnMut(B, Self::Item) -> B,
+        Self: Sized, F: FnMut(B, Self::Item) -> B,
     {
         let mut accum = init;
         for x in self {
@@ -641,7 +606,9 @@ fn fold<B, F>(self, init: B, mut f: F) -> B where
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn all<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
+    fn all<F>(&mut self, mut f: F) -> bool where
+        Self: Sized, F: FnMut(Self::Item) -> bool
+    {
         for x in self.by_ref() { if !f(x) { return false; } }
         true
     }
@@ -662,7 +629,10 @@ fn all<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn any<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
+    fn any<F>(&mut self, mut f: F) -> bool where
+        Self: Sized,
+        F: FnMut(Self::Item) -> bool
+    {
         for x in self.by_ref() { if f(x) { return true; } }
         false
     }
@@ -682,6 +652,7 @@ fn any<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where
+        Self: Sized,
         P: FnMut(&Self::Item) -> bool,
     {
         for x in self.by_ref() {
@@ -705,6 +676,7 @@ fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn position<P>(&mut self, mut predicate: P) -> Option<usize> where
+        Self: Sized,
         P: FnMut(Self::Item) -> bool,
     {
         let mut i = 0;
@@ -735,7 +707,7 @@ fn position<P>(&mut self, mut predicate: P) -> Option<usize> where
     #[stable(feature = "rust1", since = "1.0.0")]
     fn rposition<P>(&mut self, mut predicate: P) -> Option<usize> where
         P: FnMut(Self::Item) -> bool,
-        Self: ExactSizeIterator + DoubleEndedIterator
+        Self: Sized + ExactSizeIterator + DoubleEndedIterator
     {
         let mut i = self.len();
 
@@ -758,7 +730,7 @@ fn rposition<P>(&mut self, mut predicate: P) -> Option<usize> where
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn max(self) -> Option<Self::Item> where Self::Item: Ord
+    fn max(self) -> Option<Self::Item> where Self: Sized, Self::Item: Ord
     {
         self.fold(None, |max, x| {
             match max {
@@ -778,7 +750,7 @@ fn max(self) -> Option<Self::Item> where Self::Item: Ord
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn min(self) -> Option<Self::Item> where Self::Item: Ord
+    fn min(self) -> Option<Self::Item> where Self: Sized, Self::Item: Ord
     {
         self.fold(None, |min, x| {
             match min {
@@ -820,7 +792,7 @@ fn min(self) -> Option<Self::Item> where Self::Item: Ord
     /// assert!(a.iter().min_max() == MinMax(&1, &1));
     /// ```
     #[unstable(feature = "core", reason = "return type may change")]
-    fn min_max(mut self) -> MinMaxResult<Self::Item> where Self::Item: Ord
+    fn min_max(mut self) -> MinMaxResult<Self::Item> where Self: Sized, Self::Item: Ord
     {
         let (mut min, mut max) = match self.next() {
             None => return NoElements,
@@ -871,15 +843,15 @@ fn min_max(mut self) -> MinMaxResult<Self::Item> where Self::Item: Ord
     ///
     /// ```
     /// # #![feature(core)]
-    /// use std::num::SignedInt;
     ///
-    /// let a = [-3, 0, 1, 5, -10];
+    /// let a = [-3_i32, 0, 1, 5, -10];
     /// assert_eq!(*a.iter().max_by(|x| x.abs()).unwrap(), -10);
     /// ```
     #[inline]
     #[unstable(feature = "core",
                reason = "may want to produce an Ordering directly; see #15311")]
     fn max_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where
+        Self: Sized,
         F: FnMut(&Self::Item) -> B,
     {
         self.fold(None, |max: Option<(Self::Item, B)>, x| {
@@ -902,15 +874,15 @@ fn max_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where
     ///
     /// ```
     /// # #![feature(core)]
-    /// use std::num::SignedInt;
     ///
-    /// let a = [-3, 0, 1, 5, -10];
+    /// let a = [-3_i32, 0, 1, 5, -10];
     /// assert_eq!(*a.iter().min_by(|x| x.abs()).unwrap(), 0);
     /// ```
     #[inline]
     #[unstable(feature = "core",
                reason = "may want to produce an Ordering directly; see #15311")]
     fn min_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where
+        Self: Sized,
         F: FnMut(&Self::Item) -> B,
     {
         self.fold(None, |min: Option<(Self::Item, B)>, x| {
@@ -940,7 +912,7 @@ fn min_by<B: Ord, F>(self, mut f: F) -> Option<Self::Item> where
     /// `std::usize::MAX` elements of the original iterator.
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn rev(self) -> Rev<Self> {
+    fn rev(self) -> Rev<Self> where Self: Sized {
         Rev{iter: self}
     }
 
@@ -962,7 +934,7 @@ fn rev(self) -> Rev<Self> {
     fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where
         FromA: Default + Extend<A>,
         FromB: Default + Extend<B>,
-        Self: Iterator<Item=(A, B)>,
+        Self: Sized + Iterator<Item=(A, B)>,
     {
         struct SizeHint<A>(usize, Option<usize>, marker::PhantomData<A>);
         impl<A> Iterator for SizeHint<A> {
@@ -993,7 +965,7 @@ fn size_hint(&self) -> (usize, Option<usize>) {
     /// converting an Iterator<&T> to an Iterator<T>.
     #[stable(feature = "rust1", since = "1.0.0")]
     fn cloned<'a, T: 'a>(self) -> Cloned<Self>
-        where Self: Iterator<Item=&'a T>, T: Clone
+        where Self: Sized + Iterator<Item=&'a T>, T: Clone
     {
         Cloned { it: self }
     }
@@ -1011,7 +983,7 @@ fn cloned<'a, T: 'a>(self) -> Cloned<Self>
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
-    fn cycle(self) -> Cycle<Self> where Self: Clone {
+    fn cycle(self) -> Cycle<Self> where Self: Sized + Clone {
         Cycle{orig: self.clone(), iter: self}
     }
 
@@ -1019,7 +991,7 @@ fn cycle(self) -> Cycle<Self> where Self: Clone {
     #[unstable(feature = "core",
                reason = "uncertain about placement or widespread use")]
     fn reverse_in_place<'a, T: 'a>(&mut self) where
-        Self: Iterator<Item=&'a mut T> + DoubleEndedIterator
+        Self: Sized + Iterator<Item=&'a mut T> + DoubleEndedIterator
     {
         loop {
             match (self.next(), self.next_back()) {
@@ -1031,7 +1003,76 @@ fn reverse_in_place<'a, T: 'a>(&mut self) where
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<I> IteratorExt for I where I: Iterator {}
+impl<'a, I: Iterator + ?Sized> Iterator for &'a mut I {
+    type Item = I::Item;
+    fn next(&mut self) -> Option<I::Item> { (**self).next() }
+    fn size_hint(&self) -> (usize, Option<usize>) { (**self).size_hint() }
+}
+
+/// Conversion from an `Iterator`
+#[stable(feature = "rust1", since = "1.0.0")]
+#[rustc_on_unimplemented="a collection of type `{Self}` cannot be \
+                          built from an iterator over elements of type `{A}`"]
+pub trait FromIterator<A> {
+    /// Build a container with elements from something iterable.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::collections::HashSet;
+    /// use std::iter::FromIterator;
+    ///
+    /// let colors_vec = vec!["red", "red", "yellow", "blue"];
+    /// let colors_set = HashSet::<&str>::from_iter(colors_vec);
+    /// assert_eq!(colors_set.len(), 3);
+    /// ```
+    ///
+    /// `FromIterator` is more commonly used implicitly via the `Iterator::collect` method:
+    ///
+    /// ```
+    /// use std::collections::HashSet;
+    ///
+    /// let colors_vec = vec!["red", "red", "yellow", "blue"];
+    /// let colors_set = colors_vec.into_iter().collect::<HashSet<&str>>();
+    /// assert_eq!(colors_set.len(), 3);
+    /// ```
+    #[stable(feature = "rust1", since = "1.0.0")]
+    fn from_iter<T: IntoIterator<Item=A>>(iterator: T) -> Self;
+}
+
+/// Conversion into an `Iterator`
+#[stable(feature = "rust1", since = "1.0.0")]
+pub trait IntoIterator {
+    /// The type of the elements being iterated
+    #[stable(feature = "rust1", since = "1.0.0")]
+    type Item;
+
+    /// A container for iterating over elements of type Item
+    #[stable(feature = "rust1", since = "1.0.0")]
+    type IntoIter: Iterator<Item=Self::Item>;
+
+    /// Consumes `Self` and returns an iterator over it
+    #[stable(feature = "rust1", since = "1.0.0")]
+    fn into_iter(self) -> Self::IntoIter;
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<I: Iterator> IntoIterator for I {
+    type Item = I::Item;
+    type IntoIter = I;
+
+    fn into_iter(self) -> I {
+        self
+    }
+}
+
+/// A type growable from an `Iterator` implementation
+#[stable(feature = "rust1", since = "1.0.0")]
+pub trait Extend<A> {
+    /// Extend a container with the elements yielded by an arbitrary iterator
+    #[stable(feature = "rust1", since = "1.0.0")]
+    fn extend<T: IntoIterator<Item=A>>(&mut self, iterable: T);
+}
 
 /// A range iterator able to yield elements from both ends
 ///
@@ -1239,7 +1280,7 @@ fn product(self) -> $A {
 impl_multiplicative! { f32,  1.0 }
 impl_multiplicative! { f64,  1.0 }
 
-/// `MinMaxResult` is an enum returned by `min_max`. See `IteratorOrdExt::min_max` for more detail.
+/// `MinMaxResult` is an enum returned by `min_max`. See `Iterator::min_max` for more detail.
 #[derive(Clone, PartialEq, Debug)]
 #[unstable(feature = "core",
            reason = "unclear whether such a fine-grained result is widely useful")]
@@ -2374,6 +2415,67 @@ fn size_hint(&self) -> (usize, Option<usize>) {
     }
 }
 
+/// Objects that can be stepped over in both directions.
+///
+/// The `steps_between` function provides a way to efficiently compare
+/// two `Step` objects.
+#[unstable(feature = "step_trait",
+           reason = "likely to be replaced by finer-grained traits")]
+pub trait Step: Ord {
+    /// Steps `self` if possible.
+    fn step(&self, by: &Self) -> Option<Self>;
+
+    /// The number of steps between two step objects.
+    ///
+    /// `start` should always be less than `end`, so the result should never
+    /// be negative.
+    ///
+    /// Return `None` if it is not possible to calculate steps_between
+    /// without overflow.
+    fn steps_between(start: &Self, end: &Self, by: &Self) -> Option<usize>;
+}
+
+macro_rules! step_impl {
+    ($($t:ty)*) => ($(
+        impl Step for $t {
+            #[inline]
+            fn step(&self, by: &$t) -> Option<$t> {
+                (*self).checked_add(*by)
+            }
+            #[inline]
+            #[allow(trivial_numeric_casts)]
+            fn steps_between(start: &$t, end: &$t, by: &$t) -> Option<usize> {
+                if *start <= *end {
+                    Some(((*end - *start) / *by) as usize)
+                } else {
+                    Some(0)
+                }
+            }
+        }
+    )*)
+}
+
+macro_rules! step_impl_no_between {
+    ($($t:ty)*) => ($(
+        impl Step for $t {
+            #[inline]
+            fn step(&self, by: &$t) -> Option<$t> {
+                (*self).checked_add(*by)
+            }
+            #[inline]
+            fn steps_between(_a: &$t, _b: &$t, _by: &$t) -> Option<usize> {
+                None
+            }
+        }
+    )*)
+}
+
+step_impl!(usize u8 u16 u32 isize i8 i16 i32);
+#[cfg(target_pointer_width = "64")]
+step_impl!(u64 i64);
+#[cfg(target_pointer_width = "32")]
+step_impl_no_between!(u64 i64);
+
 /// An adapter for stepping range iterators by a custom amount.
 ///
 /// The resulting iterator handles overflow by stopping. The `A`
@@ -2386,7 +2488,7 @@ pub struct StepBy<A, R> {
     range: R,
 }
 
-impl<A: Add> RangeFrom<A> {
+impl<A: Step> RangeFrom<A> {
     /// Creates an iterator starting at the same point, but stepping by
     /// the given amount at each iteration.
     ///
@@ -2408,7 +2510,8 @@ pub fn step_by(self, by: A) -> StepBy<A, Self> {
     }
 }
 
-impl<A: Int> ::ops::Range<A> {
+#[allow(deprecated)]
+impl<A: Step> ::ops::Range<A> {
     /// Creates an iterator with the same range, but stepping by the
     /// given amount at each iteration.
     ///
@@ -2462,14 +2565,17 @@ pub fn count<A>(start: A, step: A) -> Counter<A> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<A: Add<Output=A> + Clone> Iterator for StepBy<A, RangeFrom<A>> {
+impl<A> Iterator for StepBy<A, RangeFrom<A>> where
+    A: Clone,
+    for<'a> &'a A: Add<&'a A, Output = A>
+{
     type Item = A;
 
     #[inline]
     fn next(&mut self) -> Option<A> {
-        let result = self.range.start.clone();
-        self.range.start = result.clone() + self.step_by.clone();
-        Some(result)
+        let mut n = &self.range.start + &self.step_by;
+        mem::swap(&mut n, &mut self.range.start);
+        Some(n)
     }
 
     #[inline]
@@ -2672,19 +2778,27 @@ pub fn range_step<A: Int>(start: A, stop: A, step: A) -> RangeStep<A> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<A: Int> Iterator for StepBy<A, ::ops::Range<A>> {
+#[allow(deprecated)]
+impl<A: Step + Zero + Clone> Iterator for StepBy<A, ::ops::Range<A>> {
     type Item = A;
 
     #[inline]
     fn next(&mut self) -> Option<A> {
-        let rev = self.step_by < Int::zero();
-        let start = self.range.start;
-        if (rev && start > self.range.end) || (!rev && start < self.range.end) {
-            match start.checked_add(self.step_by) {
-                Some(x) => self.range.start = x,
-                None => self.range.start = self.range.end.clone()
+        let rev = self.step_by < A::zero();
+        if (rev && self.range.start > self.range.end) ||
+           (!rev && self.range.start < self.range.end)
+        {
+            match self.range.start.step(&self.step_by) {
+                Some(mut n) => {
+                    mem::swap(&mut self.range.start, &mut n);
+                    Some(n)
+                },
+                None => {
+                    let mut n = self.range.end.clone();
+                    mem::swap(&mut self.range.start, &mut n);
+                    Some(n)
+                }
             }
-            Some(start)
         } else {
             None
         }
@@ -2731,6 +2845,7 @@ pub struct RangeStepInclusive<A> {
 #[inline]
 #[unstable(feature = "core",
            reason = "likely to be replaced by range notation and adapters")]
+#[allow(deprecated)]
 pub fn range_step_inclusive<A: Int>(start: A, stop: A, step: A) -> RangeStepInclusive<A> {
     let rev = step < Int::zero();
     RangeStepInclusive {
@@ -2744,6 +2859,7 @@ pub fn range_step_inclusive<A: Int>(start: A, stop: A, step: A) -> RangeStepIncl
 
 #[unstable(feature = "core",
            reason = "likely to be replaced by range notation and adapters")]
+#[allow(deprecated)]
 impl<A: Int> Iterator for RangeStepInclusive<A> {
     type Item = A;
 
@@ -2771,15 +2887,25 @@ impl ExactSizeIterator for ::ops::Range<$t> { }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<A: Int> Iterator for ::ops::Range<A> {
+#[allow(deprecated)]
+impl<A: Step + One + Clone> Iterator for ::ops::Range<A> {
     type Item = A;
 
     #[inline]
     fn next(&mut self) -> Option<A> {
         if self.start < self.end {
-            let result = self.start;
-            self.start = self.start + Int::one();
-            Some(result)
+            match self.start.step(&A::one()) {
+                Some(mut n) => {
+                    mem::swap(&mut n, &mut self.start);
+                    Some(n)
+                },
+                None => {
+                    let mut n = self.end.clone();
+                    mem::swap(&mut n, &mut self.start);
+                    Some(n)
+
+                }
+            }
         } else {
             None
         }
@@ -2787,11 +2913,10 @@ fn next(&mut self) -> Option<A> {
 
     #[inline]
     fn size_hint(&self) -> (usize, Option<usize>) {
-        if self.start >= self.end {
-            (0, Some(0))
+        if let Some(hint) = Step::steps_between(&self.start, &self.end, &A::one()) {
+            (hint, Some(hint))
         } else {
-            let length = (self.end - self.start).to_usize();
-            (length.unwrap_or(0), length)
+            (0, None)
         }
     }
 }
@@ -2801,12 +2926,15 @@ fn size_hint(&self) -> (usize, Option<usize>) {
 range_exact_iter_impl!(usize u8 u16 u32 isize i8 i16 i32);
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<A: Int> DoubleEndedIterator for ::ops::Range<A> {
+#[allow(deprecated)]
+impl<A: Step + One + Clone> DoubleEndedIterator for ::ops::Range<A> where
+    for<'a> &'a A: Sub<&'a A, Output = A>
+{
     #[inline]
     fn next_back(&mut self) -> Option<A> {
         if self.start < self.end {
-            self.end = self.end - Int::one();
-            Some(self.end)
+            self.end = &self.end - &A::one();
+            Some(self.end.clone())
         } else {
             None
         }
@@ -2814,15 +2942,16 @@ fn next_back(&mut self) -> Option<A> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<A: Int> Iterator for ::ops::RangeFrom<A> {
+#[allow(deprecated)]
+impl<A: Step + One> Iterator for ::ops::RangeFrom<A> {
     type Item = A;
 
     #[inline]
     fn next(&mut self) -> Option<A> {
-        let result = self.start;
-        self.start = self.start + Int::one();
-        debug_assert!(result < self.start);
-        Some(result)
+        self.start.step(&A::one()).map(|mut n| {
+            mem::swap(&mut n, &mut self.start);
+            n
+        })
     }
 }
 
index a2b13584270940317f8935b3a7674d5e4d841b22..cf5cb0c2f5e3927cc4d247b0dda4b1099996e723 100644 (file)
@@ -63,7 +63,6 @@
 #![allow(raw_pointer_derive)]
 #![deny(missing_docs)]
 
-#![feature(int_uint)]
 #![feature(intrinsics, lang_items)]
 #![feature(on_unimplemented)]
 #![feature(simd, unsafe_destructor)]
@@ -72,6 +71,7 @@
 #![feature(rustc_attrs)]
 #![feature(optin_builtin_traits)]
 #![feature(concat_idents)]
+#![feature(reflect)]
 
 #[macro_use]
 mod macros;
index 40e32f4171a2d509900ccc4f685374710dfbef1f..d5a7c1d6b26472ac3fb49cadc6e0c764252593c8 100644 (file)
@@ -218,7 +218,7 @@ macro_rules! writeln {
 /// Match arms:
 ///
 /// ```
-/// fn foo(x: Option<int>) {
+/// fn foo(x: Option<i32>) {
 ///     match x {
 ///         Some(n) if n >= 0 => println!("Some(Non-negative)"),
 ///         Some(n) if n <  0 => println!("Some(Negative)"),
index 88c10e3661e7a7714bea28e9c8f7d6788cbcf743..3f4b39da4b3bb1e888cec84aaee71358644b7b0b 100644 (file)
@@ -450,3 +450,46 @@ unsafe impl<'a, T: Send + ?Sized> Send for &'a mut T {}
 #[deprecated(since = "1.0.0", reason = "Replace with `PhantomData<Cell<T>>`")]
 #[lang="invariant_type"]
 pub struct InvariantType<T>;
+
+/// A marker trait indicates a type that can be reflected over. This
+/// trait is implemented for all types. Its purpose is to ensure that
+/// when you write a generic function that will employ reflection,
+/// that must be reflected (no pun intended) in the generic bounds of
+/// that function. Here is an example:
+///
+/// ```
+/// #![feature(core)]
+/// use std::marker::Reflect;
+/// use std::any::Any;
+/// fn foo<T:Reflect+'static>(x: &T) {
+///     let any: &Any = x;
+///     if any.is::<u32>() { println!("u32"); }
+/// }
+/// ```
+///
+/// Without the declaration `T:Reflect`, `foo` would not type check
+/// (note: as a matter of style, it would be preferable to to write
+/// `T:Any`, because `T:Any` implies `T:Reflect` and `T:'static`, but
+/// we use `Reflect` here to show how it works). The `Reflect` bound
+/// thus serves to alert `foo`'s caller to the fact that `foo` may
+/// behave differently depending on whether `T=u32` or not. In
+/// particular, thanks to the `Reflect` bound, callers know that a
+/// function declared like `fn bar<T>(...)` will always act in
+/// precisely the same way no matter what type `T` is supplied,
+/// because there are no bounds declared on `T`. (The ability for a
+/// caller to reason about what a function may do based solely on what
+/// generic bounds are declared is often called the ["parametricity
+/// property"][1].)
+///
+/// [1]: http://en.wikipedia.org/wiki/Parametricity
+#[rustc_reflect_like]
+#[unstable(feature = "core", reason = "requires RFC and more experience")]
+pub trait Reflect : MarkerTrait {
+}
+
+#[cfg(stage0)]
+impl<T> Reflect for T { }
+
+#[cfg(not(stage0))]
+impl Reflect for .. { }
+
index 1e6fb51a8a528e9d75bac0d6fa36da598104f057..98e8668239bb8ee67e9aed5fcd3cce856c291838 100644 (file)
@@ -158,6 +158,32 @@ pub unsafe fn zeroed<T>() -> T {
     intrinsics::init()
 }
 
+/// Create a value initialized to an unspecified series of bytes.
+///
+/// The byte sequence usually indicates that the value at the memory
+/// in question has been dropped. Thus, *if* T carries a drop flag,
+/// any associated destructor will not be run when the value falls out
+/// of scope.
+///
+/// Some code at one time used the `zeroed` function above to
+/// accomplish this goal.
+///
+/// This function is expected to be deprecated with the transition
+/// to non-zeroing drop.
+#[inline]
+#[unstable(feature = "filling_drop")]
+pub unsafe fn dropped<T>() -> T {
+    #[cfg(stage0)]
+    #[inline(always)]
+    unsafe fn dropped_impl<T>() -> T { zeroed() }
+
+    #[cfg(not(stage0))]
+    #[inline(always)]
+    unsafe fn dropped_impl<T>() -> T { intrinsics::init_dropped() }
+
+    dropped_impl()
+}
+
 /// Create an uninitialized value.
 ///
 /// Care must be taken when using this function, if the type `T` has a destructor and the value
@@ -203,9 +229,9 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
         let mut t: T = uninitialized();
 
         // Perform the swap, `&mut` pointers never alias
-        ptr::copy_nonoverlapping(&mut t, &*x, 1);
-        ptr::copy_nonoverlapping(x, &*y, 1);
-        ptr::copy_nonoverlapping(y, &t, 1);
+        ptr::copy_nonoverlapping(&*x, &mut t, 1);
+        ptr::copy_nonoverlapping(&*y, x, 1);
+        ptr::copy_nonoverlapping(&t, y, 1);
 
         // y and t now point to the same thing, but we need to completely forget `t`
         // because it's no longer relevant.
@@ -291,6 +317,49 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn drop<T>(_x: T) { }
 
+macro_rules! repeat_u8_as_u32 {
+    ($name:expr) => { (($name as u32) << 24 |
+                       ($name as u32) << 16 |
+                       ($name as u32) <<  8 |
+                       ($name as u32)) }
+}
+macro_rules! repeat_u8_as_u64 {
+    ($name:expr) => { ((repeat_u8_as_u32!($name) as u64) << 32 |
+                       (repeat_u8_as_u32!($name) as u64)) }
+}
+
+// NOTE: Keep synchronized with values used in librustc_trans::trans::adt.
+//
+// In particular, the POST_DROP_U8 marker must never equal the
+// DTOR_NEEDED_U8 marker.
+//
+// For a while pnkfelix was using 0xc1 here.
+// But having the sign bit set is a pain, so 0x1d is probably better.
+//
+// And of course, 0x00 brings back the old world of zero'ing on drop.
+#[cfg(not(stage0))] #[unstable(feature = "filling_drop")]
+pub const POST_DROP_U8: u8 = 0x1d;
+#[cfg(not(stage0))] #[unstable(feature = "filling_drop")]
+pub const POST_DROP_U32: u32 = repeat_u8_as_u32!(POST_DROP_U8);
+#[cfg(not(stage0))]  #[unstable(feature = "filling_drop")]
+pub const POST_DROP_U64: u64 = repeat_u8_as_u64!(POST_DROP_U8);
+
+#[cfg(target_pointer_width = "32")]
+#[cfg(not(stage0))]  #[unstable(feature = "filling_drop")]
+pub const POST_DROP_USIZE: usize = POST_DROP_U32 as usize;
+#[cfg(target_pointer_width = "64")]
+#[cfg(not(stage0))]  #[unstable(feature = "filling_drop")]
+pub const POST_DROP_USIZE: usize = POST_DROP_U64 as usize;
+
+#[cfg(stage0)]  #[unstable(feature = "filling_drop")]
+pub const POST_DROP_U8: u8 = 0;
+#[cfg(stage0)]  #[unstable(feature = "filling_drop")]
+pub const POST_DROP_U32: u32 = 0;
+#[cfg(stage0)]  #[unstable(feature = "filling_drop")]
+pub const POST_DROP_U64: u64 = 0;
+#[cfg(stage0)]  #[unstable(feature = "filling_drop")]
+pub const POST_DROP_USIZE: usize = 0;
+
 /// Interprets `src` as `&U`, and then reads `src` without moving the contained value.
 ///
 /// This function will unsafely assume the pointer `src` is valid for `sizeof(U)` bytes by
index d211b0f9928cd2db17e276f8c72611462ff97b5e..12b45a766b63929da94dc01ff5d7d6761451407c 100644 (file)
 use num::FpCategory as Fp;
 use option::Option;
 
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const RADIX: u32 = 2;
 
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const MANTISSA_DIGITS: u32 = 24;
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const DIGITS: u32 = 6;
 
 #[stable(feature = "rust1", since = "1.0.0")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub const MAX: f32 = 3.40282347e+38_f32;
 
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const MIN_EXP: i32 = -125;
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const MAX_EXP: i32 = 128;
 
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const MIN_10_EXP: i32 = -37;
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const MAX_10_EXP: i32 = 38;
 
 #[stable(feature = "rust1", since = "1.0.0")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub const NEG_INFINITY: f32 = -1.0_f32/0.0_f32;
 
-/// Various useful constants.
-#[unstable(feature = "core",
-           reason = "naming scheme needs to be revisited")]
+/// Basic mathematial constants.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub mod consts {
     // FIXME: replace with mathematical constants from cmath.
 
     /// Archimedes' constant
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const PI: f32 = 3.14159265358979323846264338327950288_f32;
 
     /// pi * 2.0
+    #[unstable(feature = "core", reason = "unclear naming convention/usefulness")]
     pub const PI_2: f32 = 6.28318530717958647692528676655900576_f32;
 
     /// pi/2.0
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_PI_2: f32 = 1.57079632679489661923132169163975144_f32;
 
     /// pi/3.0
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_PI_3: f32 = 1.04719755119659774615421446109316763_f32;
 
     /// pi/4.0
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_PI_4: f32 = 0.785398163397448309615660845819875721_f32;
 
     /// pi/6.0
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_PI_6: f32 = 0.52359877559829887307710723054658381_f32;
 
     /// pi/8.0
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_PI_8: f32 = 0.39269908169872415480783042290993786_f32;
 
     /// 1.0/pi
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_1_PI: f32 = 0.318309886183790671537767526745028724_f32;
 
     /// 2.0/pi
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_2_PI: f32 = 0.636619772367581343075535053490057448_f32;
 
     /// 2.0/sqrt(pi)
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub const FRAC_2_SQRT_PI: f32 = 1.12837916709551257389615890312154517_f32;
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[deprecated(since = "1.0.0", reason = "renamed to FRAC_2_SQRT_PI")]
     pub const FRAC_2_SQRTPI: f32 = 1.12837916709551257389615890312154517_f32;
 
     /// sqrt(2.0)
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub const SQRT_2: f32 = 1.41421356237309504880168872420969808_f32;
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[deprecated(since = "1.0.0", reason = "renamed to SQRT_2")]
     pub const SQRT2: f32 = 1.41421356237309504880168872420969808_f32;
 
     /// 1.0/sqrt(2.0)
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub const FRAC_1_SQRT_2: f32 = 0.707106781186547524400844362104849039_f32;
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[deprecated(since = "1.0.0", reason = "renamed to FRAC_1_SQRT_2")]
     pub const FRAC_1_SQRT2: f32 = 0.707106781186547524400844362104849039_f32;
 
     /// Euler's number
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const E: f32 = 2.71828182845904523536028747135266250_f32;
 
     /// log2(e)
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const LOG2_E: f32 = 1.44269504088896340735992468100189214_f32;
 
     /// log10(e)
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const LOG10_E: f32 = 0.434294481903251827651128918916605082_f32;
 
     /// ln(2.0)
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const LN_2: f32 = 0.693147180559945309417232121458176568_f32;
 
     /// ln(10.0)
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32;
 }
 
@@ -193,12 +221,12 @@ fn classify(self) -> Fp {
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn mantissa_digits(_: Option<f32>) -> uint { MANTISSA_DIGITS as uint }
+    fn mantissa_digits(_: Option<f32>) -> usize { MANTISSA_DIGITS as usize }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn digits(_: Option<f32>) -> uint { DIGITS as uint }
+    fn digits(_: Option<f32>) -> usize { DIGITS as usize }
 
     #[inline]
     #[unstable(feature = "core")]
@@ -208,22 +236,22 @@ fn epsilon() -> f32 { EPSILON }
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn min_exp(_: Option<f32>) -> int { MIN_EXP as int }
+    fn min_exp(_: Option<f32>) -> isize { MIN_EXP as isize }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn max_exp(_: Option<f32>) -> int { MAX_EXP as int }
+    fn max_exp(_: Option<f32>) -> isize { MAX_EXP as isize }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn min_10_exp(_: Option<f32>) -> int { MIN_10_EXP as int }
+    fn min_10_exp(_: Option<f32>) -> isize { MIN_10_EXP as isize }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn max_10_exp(_: Option<f32>) -> int { MAX_10_EXP as int }
+    fn max_10_exp(_: Option<f32>) -> isize { MAX_10_EXP as isize }
 
     #[inline]
     #[unstable(feature = "core")]
index 1421fdd72f2335c09855183f991cedc228d9b754..058acedd9c98889096926ecc1d1873e611ec6cde 100644 (file)
 use num::FpCategory as Fp;
 use option::Option;
 
-// FIXME(#5527): These constants should be deprecated once associated
-// constants are implemented in favour of referencing the respective
-// members of `Bounded` and `Float`.
-
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const RADIX: u32 = 2;
 
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const MANTISSA_DIGITS: u32 = 53;
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const DIGITS: u32 = 15;
 
 #[stable(feature = "rust1", since = "1.0.0")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub const MAX: f64 = 1.7976931348623157e+308_f64;
 
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const MIN_EXP: i32 = -1021;
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const MAX_EXP: i32 = 1024;
 
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const MIN_10_EXP: i32 = -307;
-#[unstable(feature = "core", reason = "pending integer conventions")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub const MAX_10_EXP: i32 = 308;
 
 #[stable(feature = "rust1", since = "1.0.0")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub const NEG_INFINITY: f64 = -1.0_f64/0.0_f64;
 
-/// Various useful constants.
-#[unstable(feature = "core",
-           reason = "naming scheme needs to be revisited")]
+/// Basic mathematial constants.
+#[stable(feature = "rust1", since = "1.0.0")]
 pub mod consts {
     // FIXME: replace with mathematical constants from cmath.
 
-    // FIXME(#5527): These constants should be deprecated once associated
-    // constants are implemented in favour of referencing the respective members
-    // of `Float`.
-
     /// Archimedes' constant
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const PI: f64 = 3.14159265358979323846264338327950288_f64;
 
     /// pi * 2.0
+    #[unstable(feature = "core", reason = "unclear naming convention/usefulness")]
     pub const PI_2: f64 = 6.28318530717958647692528676655900576_f64;
 
     /// pi/2.0
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_PI_2: f64 = 1.57079632679489661923132169163975144_f64;
 
     /// pi/3.0
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_PI_3: f64 = 1.04719755119659774615421446109316763_f64;
 
     /// pi/4.0
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_PI_4: f64 = 0.785398163397448309615660845819875721_f64;
 
     /// pi/6.0
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_PI_6: f64 = 0.52359877559829887307710723054658381_f64;
 
     /// pi/8.0
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_PI_8: f64 = 0.39269908169872415480783042290993786_f64;
 
     /// 1.0/pi
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_1_PI: f64 = 0.318309886183790671537767526745028724_f64;
 
     /// 2.0/pi
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const FRAC_2_PI: f64 = 0.636619772367581343075535053490057448_f64;
 
     /// 2.0/sqrt(pi)
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub const FRAC_2_SQRT_PI: f64 = 1.12837916709551257389615890312154517_f64;
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[deprecated(since = "1.0.0", reason = "renamed to FRAC_2_SQRT_PI")]
     pub const FRAC_2_SQRTPI: f64 = 1.12837916709551257389615890312154517_f64;
 
     /// sqrt(2.0)
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub const SQRT_2: f64 = 1.41421356237309504880168872420969808_f64;
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[deprecated(since = "1.0.0", reason = "renamed to SQRT_2")]
     pub const SQRT2: f64 = 1.41421356237309504880168872420969808_f64;
 
     /// 1.0/sqrt(2.0)
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub const FRAC_1_SQRT_2: f64 = 0.707106781186547524400844362104849039_f64;
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[deprecated(since = "1.0.0", reason = "renamed to FRAC_1_SQRT_2")]
     pub const FRAC_1_SQRT2: f64 = 0.707106781186547524400844362104849039_f64;
 
     /// Euler's number
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const E: f64 = 2.71828182845904523536028747135266250_f64;
 
     /// log2(e)
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const LOG2_E: f64 = 1.44269504088896340735992468100189214_f64;
 
     /// log10(e)
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const LOG10_E: f64 = 0.434294481903251827651128918916605082_f64;
 
     /// ln(2.0)
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const LN_2: f64 = 0.693147180559945309417232121458176568_f64;
 
     /// ln(10.0)
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64;
 }
 
@@ -200,12 +221,12 @@ fn classify(self) -> Fp {
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn mantissa_digits(_: Option<f64>) -> uint { MANTISSA_DIGITS as uint }
+    fn mantissa_digits(_: Option<f64>) -> usize { MANTISSA_DIGITS as usize }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn digits(_: Option<f64>) -> uint { DIGITS as uint }
+    fn digits(_: Option<f64>) -> usize { DIGITS as usize }
 
     #[inline]
     #[unstable(feature = "core")]
@@ -215,22 +236,22 @@ fn epsilon() -> f64 { EPSILON }
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn min_exp(_: Option<f64>) -> int { MIN_EXP as int }
+    fn min_exp(_: Option<f64>) -> isize { MIN_EXP as isize }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn max_exp(_: Option<f64>) -> int { MAX_EXP as int }
+    fn max_exp(_: Option<f64>) -> isize { MAX_EXP as isize }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn min_10_exp(_: Option<f64>) -> int { MIN_10_EXP as int }
+    fn min_10_exp(_: Option<f64>) -> isize { MIN_10_EXP as isize }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn max_10_exp(_: Option<f64>) -> int { MAX_10_EXP as int }
+    fn max_10_exp(_: Option<f64>) -> isize { MAX_10_EXP as isize }
 
     #[inline]
     #[unstable(feature = "core")]
index efafce3fdefb04537a4b455af99ee20941e00ed9..5ea60d0d96d29f44943a0c751cf760d7c7deef0c 100644 (file)
@@ -12,6 +12,5 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(primitive = "i16")]
-#![allow(trivial_numeric_casts)]
 
 int_module! { i16, 16 }
index 72b0236a8d2a4c12814ab55febe6f2cda730bbbe..7d9faa998c12e87769a8519d416b7085d802dcbf 100644 (file)
@@ -12,6 +12,5 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(primitive = "i32")]
-#![allow(trivial_numeric_casts)]
 
 int_module! { i32, 32 }
index a64a4febd5a963448fab5c413646509871a896a6..5a70911387b9b7192ab7a86fae52a90e77ddaa7b 100644 (file)
@@ -12,6 +12,5 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(primitive = "i64")]
-#![allow(trivial_numeric_casts)]
 
 int_module! { i64, 64 }
index 459814875ee0ee1686bfe88b502784a9139ce70a..1d7d78ffa6c2352a20ad49cbfda99a0b3fc7ce17 100644 (file)
@@ -12,6 +12,5 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(primitive = "i8")]
-#![allow(trivial_numeric_casts)]
 
 int_module! { i8, 8 }
index 675f568a96099e7c8728f498d5168845c64d5292..fe0d6d13c4c06483649bdbf737fe89c68048cf43 100644 (file)
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 #![doc(hidden)]
-#![allow(trivial_numeric_casts)]
 
 macro_rules! int_module { ($T:ty, $bits:expr) => (
 
index 9af51a36748263a2474b26e4c9fc5f7878afe3c8..0fd0d90b12501ea87b257bb523b56a1c6d0f1b47 100644 (file)
@@ -16,7 +16,6 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(primitive = "isize")]
-#![allow(trivial_numeric_casts)]
 
 #[cfg(target_pointer_width = "32")]
 int_module! { isize, 32 }
index 0eec875afc3bb15a47e1734bb62468f2bc6d8479..64f8e7055a57ae57b0ab0cbe93812b6fcf1859e4 100644 (file)
@@ -14,7 +14,6 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![allow(missing_docs)]
-#![allow(trivial_numeric_casts)]
 
 use self::wrapping::{OverflowingOps, WrappingOps};
 
@@ -24,7 +23,7 @@
 use error::Error;
 use fmt;
 use intrinsics;
-use iter::IteratorExt;
+use iter::Iterator;
 use marker::Copy;
 use mem::size_of;
 use ops::{Add, Sub, Mul, Div, Rem, Neg};
 use result::Result::{self, Ok, Err};
 use str::{FromStr, StrExt};
 
+/// Provides intentionally-wrapped arithmetic on `T`.
+///
+/// Operations like `+` on `u32` values is intended to never overflow,
+/// and in some debug configurations overflow is detected and results
+/// in a panic. While most arithmetic falls into this category, some
+/// code explicitly expects and relies upon modular arithmetic (e.g.,
+/// hashing).
+///
+/// Wrapping arithmetic can be achieved either through methods like
+/// `wrapping_add`, or through the `Wrapping<T>` type, which says that
+/// all standard arithmetic operations on the underlying value are
+/// intended to have wrapping semantics.
+#[stable(feature = "rust1", since = "1.0.0")]
+#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Debug)]
+pub struct Wrapping<T>(pub T);
+
 #[unstable(feature = "core", reason = "may be removed or relocated")]
 pub mod wrapping;
 
+/// Types that have a "zero" value.
+///
+/// This trait is intended for use in conjunction with `Add`, as an identity:
+/// `x + T::zero() == x`.
+#[unstable(feature = "zero_one",
+           reason = "unsure of placement, wants to use associated constants")]
+pub trait Zero {
+    /// The "zero" (usually, additive identity) for this type.
+    fn zero() -> Self;
+}
+
+/// Types that have a "one" value.
+///
+/// This trait is intended for use in conjunction with `Mul`, as an identity:
+/// `x * T::one() == x`.
+#[unstable(feature = "zero_one",
+           reason = "unsure of placement, wants to use associated constants")]
+pub trait One {
+    /// The "one" (usually, multiplicative identity) for this type.
+    fn one() -> Self;
+}
+
+macro_rules! zero_one_impl {
+    ($($t:ty)*) => ($(
+        impl Zero for $t {
+            #[inline]
+            fn zero() -> $t { 0 }
+        }
+        impl One for $t {
+            #[inline]
+            fn one() -> $t { 1 }
+        }
+    )*)
+}
+zero_one_impl! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
+
 /// A built-in signed or unsigned integer.
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0",
+             reason = "replaced by inherent methods; for generics, use rust-lang/num")]
+#[allow(deprecated)]
 pub trait Int
     : Copy + Clone
     + NumCast
@@ -52,8 +106,8 @@ pub trait Int
     + BitAnd<Output=Self>
     + BitOr<Output=Self>
     + BitXor<Output=Self>
-    + Shl<uint, Output=Self>
-    + Shr<uint, Output=Self>
+    + Shl<usize, Output=Self>
+    + Shr<usize, Output=Self>
     + WrappingOps
     + OverflowingOps
 {
@@ -451,6 +505,7 @@ macro_rules! uint_impl {
      $sub_with_overflow:path,
      $mul_with_overflow:path) => {
         #[stable(feature = "rust1", since = "1.0.0")]
+        #[allow(deprecated)]
         impl Int for $T {
             #[inline]
             fn zero() -> $T { 0 }
@@ -565,7 +620,7 @@ unsafe fn bswap8(x: u8) -> u8 { x }
     intrinsics::u64_mul_with_overflow }
 
 #[cfg(target_pointer_width = "32")]
-uint_impl! { uint = u32, 32,
+uint_impl! { usize = u32, 32,
     intrinsics::ctpop32,
     intrinsics::ctlz32,
     intrinsics::cttz32,
@@ -575,7 +630,7 @@ unsafe fn bswap8(x: u8) -> u8 { x }
     intrinsics::u32_mul_with_overflow }
 
 #[cfg(target_pointer_width = "64")]
-uint_impl! { uint = u64, 64,
+uint_impl! { usize = u64, 64,
     intrinsics::ctpop64,
     intrinsics::ctlz64,
     intrinsics::cttz64,
@@ -590,6 +645,7 @@ macro_rules! int_impl {
      $sub_with_overflow:path,
      $mul_with_overflow:path) => {
         #[stable(feature = "rust1", since = "1.0.0")]
+        #[allow(deprecated)]
         impl Int for $T {
             #[inline]
             fn zero() -> $T { 0 }
@@ -680,19 +736,22 @@ fn checked_div(self, v: $T) -> Option<$T> {
     intrinsics::i64_mul_with_overflow }
 
 #[cfg(target_pointer_width = "32")]
-int_impl! { int = i32, u32, 32,
+int_impl! { isize = i32, u32, 32,
     intrinsics::i32_add_with_overflow,
     intrinsics::i32_sub_with_overflow,
     intrinsics::i32_mul_with_overflow }
 
 #[cfg(target_pointer_width = "64")]
-int_impl! { int = i64, u64, 64,
+int_impl! { isize = i64, u64, 64,
     intrinsics::i64_add_with_overflow,
     intrinsics::i64_sub_with_overflow,
     intrinsics::i64_mul_with_overflow }
 
 /// A built-in two's complement integer.
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0",
+             reason = "replaced by inherent methods; for generics, use rust-lang/num")]
+#[allow(deprecated)]
 pub trait SignedInt
     : Int
     + Neg<Output=Self>
@@ -724,6 +783,7 @@ pub trait SignedInt
 macro_rules! signed_int_impl {
     ($T:ty) => {
         #[stable(feature = "rust1", since = "1.0.0")]
+        #[allow(deprecated)]
         impl SignedInt for $T {
             #[inline]
             fn abs(self) -> $T {
@@ -752,7 +812,7 @@ fn is_negative(self) -> bool { self < 0 }
 signed_int_impl! { i16 }
 signed_int_impl! { i32 }
 signed_int_impl! { i64 }
-signed_int_impl! { int }
+signed_int_impl! { isize }
 
 // `Int` + `SignedInt` implemented for signed integers
 macro_rules! int_impl {
@@ -760,35 +820,25 @@ macro_rules! int_impl {
      $add_with_overflow:path,
      $sub_with_overflow:path,
      $mul_with_overflow:path) => {
-        /// Returns the `0` value of this integer type.
-        // FIXME (#5527): Should be an associated constant
-        #[unstable(feature = "core",
-                   reason = "unsure about its place in the world")]
-        #[inline]
-        pub fn zero() -> $T { 0 }
-
-        /// Returns the `1` value of this integer type.
-        // FIXME (#5527): Should be an associated constant
-        #[unstable(feature = "core",
-                   reason = "unsure about its place in the world")]
-        #[inline]
-        pub fn one() -> $T { 1 }
-
-        /// Returns the smallest value that can be represented by this integer
-        /// type.
-        // FIXME (#5527): Should be and associated constant
-        #[unstable(feature = "core",
-                   reason = "unsure about its place in the world")]
-        #[inline]
-        pub fn min_value() -> $T { (-1 as $T) << ($BITS - 1) }
-
-        /// Returns the largest value that can be represented by this integer
-        /// type.
-        // FIXME (#5527): Should be and associated constant
-        #[unstable(feature = "core",
-                   reason = "unsure about its place in the world")]
-        #[inline]
-        pub fn max_value() -> $T { let min: $T = <$T>::min_value(); !min }
+        /// Convert a string slice in a given base to an integer.
+        ///
+        /// Leading and trailing whitespace represent an error.
+        ///
+        /// # Arguments
+        ///
+        /// * src - A string slice
+        /// * radix - The base to use. Must lie in the range [2 .. 36]
+        ///
+        /// # Return value
+        ///
+        /// `None` if the string did not represent a valid number.
+        /// Otherwise, `Some(n)` where `n` is the integer represented
+        /// by `src`.
+        #[stable(feature = "rust1", since = "1.0.0")]
+        #[allow(deprecated)]
+        pub fn from_str_radix(src: &str, radix: u32) -> Result<$T, ParseIntError> {
+            <Self as FromStrRadix>::from_str_radix(src, radix)
+        }
 
         /// Returns the number of ones in the binary representation of `self`.
         ///
@@ -802,8 +852,7 @@ pub fn min_value() -> $T { (-1 as $T) << ($BITS - 1) }
         ///
         /// assert_eq!(n.count_ones(), 3);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn count_ones(self) -> u32 { (self as $UnsignedT).count_ones() }
 
@@ -819,8 +868,7 @@ pub fn count_ones(self) -> u32 { (self as $UnsignedT).count_ones() }
         ///
         /// assert_eq!(n.count_zeros(), 5);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn count_zeros(self) -> u32 {
             (!self).count_ones()
@@ -839,8 +887,7 @@ pub fn count_zeros(self) -> u32 {
         ///
         /// assert_eq!(n.leading_zeros(), 10);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn leading_zeros(self) -> u32 {
             (self as $UnsignedT).leading_zeros()
@@ -859,8 +906,7 @@ pub fn leading_zeros(self) -> u32 {
         ///
         /// assert_eq!(n.trailing_zeros(), 3);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn trailing_zeros(self) -> u32 {
             (self as $UnsignedT).trailing_zeros()
@@ -880,8 +926,7 @@ pub fn trailing_zeros(self) -> u32 {
         ///
         /// assert_eq!(n.rotate_left(12), m);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn rotate_left(self, n: u32) -> $T {
             (self as $UnsignedT).rotate_left(n) as $T
@@ -902,8 +947,7 @@ pub fn rotate_left(self, n: u32) -> $T {
         ///
         /// assert_eq!(n.rotate_right(12), m);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn rotate_right(self, n: u32) -> $T {
             (self as $UnsignedT).rotate_right(n) as $T
@@ -1104,8 +1148,8 @@ pub fn checked_div(self, v: $T) -> Option<$T> {
         pub fn saturating_add(self, other: $T) -> $T {
             match self.checked_add(other) {
                 Some(x)                       => x,
-                None if other >= <$T>::zero() => <$T>::max_value(),
-                None                          => <$T>::min_value(),
+                None if other >= <$T as Zero>::zero() => <$T>::max_value(),
+                None => <$T>::min_value(),
             }
         }
 
@@ -1116,8 +1160,38 @@ pub fn saturating_add(self, other: $T) -> $T {
         pub fn saturating_sub(self, other: $T) -> $T {
             match self.checked_sub(other) {
                 Some(x)                      => x,
-                None if other >= <$T>::zero() => <$T>::min_value(),
-                None                          => <$T>::max_value(),
+                None if other >= <$T as Zero>::zero() => <$T>::min_value(),
+                None => <$T>::max_value(),
+            }
+        }
+
+        /// Wrapping (modular) addition. Computes `self + other`,
+        /// wrapping around at the boundary of the type.
+        #[stable(feature = "rust1", since = "1.0.0")]
+        #[inline]
+        pub fn wrapping_add(self, rhs: $T) -> $T {
+            unsafe {
+                intrinsics::overflowing_add(self, rhs)
+            }
+        }
+
+        /// Wrapping (modular) subtraction. Computes `self - other`,
+        /// wrapping around at the boundary of the type.
+        #[stable(feature = "rust1", since = "1.0.0")]
+        #[inline]
+        pub fn wrapping_sub(self, rhs: $T) -> $T {
+            unsafe {
+                intrinsics::overflowing_sub(self, rhs)
+            }
+        }
+
+        /// Wrapping (modular) multiplication. Computes `self *
+        /// other`, wrapping around at the boundary of the type.
+        #[stable(feature = "rust1", since = "1.0.0")]
+        #[inline]
+        pub fn wrapping_mul(self, rhs: $T) -> $T {
+            unsafe {
+                intrinsics::overflowing_mul(self, rhs)
             }
         }
 
@@ -1131,12 +1205,11 @@ pub fn saturating_sub(self, other: $T) -> $T {
         ///
         /// assert_eq!(2.pow(4), 16);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn pow(self, mut exp: u32) -> $T {
             let mut base = self;
-            let mut acc = <$T>::one();
+            let mut acc = <$T as One>::one();
 
             let mut prev_base = self;
             let mut base_oflo = false;
@@ -1162,7 +1235,7 @@ pub fn pow(self, mut exp: u32) -> $T {
 
         /// Computes the absolute value of `self`. `Int::min_value()` will be
         /// returned if the number is `Int::min_value()`.
-        #[unstable(feature = "core", reason = "overflow in debug builds?")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn abs(self) -> $T {
             if self.is_negative() { -self } else { self }
@@ -1232,7 +1305,7 @@ impl i64 {
 #[cfg(target_pointer_width = "32")]
 #[lang = "isize"]
 impl isize {
-    int_impl! { int = i32, u32, 32,
+    int_impl! { isize = i32, u32, 32,
         intrinsics::i32_add_with_overflow,
         intrinsics::i32_sub_with_overflow,
         intrinsics::i32_mul_with_overflow }
@@ -1241,7 +1314,7 @@ impl isize {
 #[cfg(target_pointer_width = "64")]
 #[lang = "isize"]
 impl isize {
-    int_impl! { int = i64, u64, 64,
+    int_impl! { isize = i64, u64, 64,
         intrinsics::i64_add_with_overflow,
         intrinsics::i64_sub_with_overflow,
         intrinsics::i64_mul_with_overflow }
@@ -1257,35 +1330,25 @@ macro_rules! uint_impl {
      $add_with_overflow:path,
      $sub_with_overflow:path,
      $mul_with_overflow:path) => {
-        /// Returns the `0` value of this integer type.
-        // FIXME (#5527): Should be an associated constant
-        #[unstable(feature = "core",
-                   reason = "unsure about its place in the world")]
-        #[inline]
-        pub fn zero() -> $T { 0 }
-
-        /// Returns the `1` value of this integer type.
-        // FIXME (#5527): Should be an associated constant
-        #[unstable(feature = "core",
-                   reason = "unsure about its place in the world")]
-        #[inline]
-        pub fn one() -> $T { 1 }
-
-        /// Returns the smallest value that can be represented by this integer
-        /// type.
-        // FIXME (#5527): Should be and associated constant
-        #[unstable(feature = "core",
-                   reason = "unsure about its place in the world")]
-        #[inline]
-        pub fn min_value() -> $T { 0 }
-
-        /// Returns the largest value that can be represented by this integer
-        /// type.
-        // FIXME (#5527): Should be and associated constant
-        #[unstable(feature = "core",
-                   reason = "unsure about its place in the world")]
-        #[inline]
-        pub fn max_value() -> $T { -1 }
+        /// Convert a string slice in a given base to an integer.
+        ///
+        /// Leading and trailing whitespace represent an error.
+        ///
+        /// # Arguments
+        ///
+        /// * src - A string slice
+        /// * radix - The base to use. Must lie in the range [2 .. 36]
+        ///
+        /// # Return value
+        ///
+        /// `None` if the string did not represent a valid number.
+        /// Otherwise, `Some(n)` where `n` is the integer represented
+        /// by `src`.
+        #[stable(feature = "rust1", since = "1.0.0")]
+        #[allow(deprecated)]
+        pub fn from_str_radix(src: &str, radix: u32) -> Result<$T, ParseIntError> {
+            <Self as FromStrRadix>::from_str_radix(src, radix)
+        }
 
         /// Returns the number of ones in the binary representation of `self`.
         ///
@@ -1299,8 +1362,7 @@ pub fn max_value() -> $T { -1 }
         ///
         /// assert_eq!(n.count_ones(), 3);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn count_ones(self) -> u32 {
             unsafe { $ctpop(self as $ActualT) as u32 }
@@ -1318,8 +1380,7 @@ pub fn count_ones(self) -> u32 {
         ///
         /// assert_eq!(n.count_zeros(), 5);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn count_zeros(self) -> u32 {
             (!self).count_ones()
@@ -1338,8 +1399,7 @@ pub fn count_zeros(self) -> u32 {
         ///
         /// assert_eq!(n.leading_zeros(), 10);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn leading_zeros(self) -> u32 {
             unsafe { $ctlz(self as $ActualT) as u32 }
@@ -1358,8 +1418,7 @@ pub fn leading_zeros(self) -> u32 {
         ///
         /// assert_eq!(n.trailing_zeros(), 3);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn trailing_zeros(self) -> u32 {
             unsafe { $cttz(self as $ActualT) as u32 }
@@ -1379,8 +1438,7 @@ pub fn trailing_zeros(self) -> u32 {
         ///
         /// assert_eq!(n.rotate_left(12), m);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn rotate_left(self, n: u32) -> $T {
             // Protect against undefined behaviour for over-long bit shifts
@@ -1403,8 +1461,7 @@ pub fn rotate_left(self, n: u32) -> $T {
         ///
         /// assert_eq!(n.rotate_right(12), m);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn rotate_right(self, n: u32) -> $T {
             // Protect against undefined behaviour for over-long bit shifts
@@ -1605,8 +1662,8 @@ pub fn checked_div(self, v: $T) -> Option<$T> {
         pub fn saturating_add(self, other: $T) -> $T {
             match self.checked_add(other) {
                 Some(x)                       => x,
-                None if other >= <$T>::zero() => <$T>::max_value(),
-                None                          => <$T>::min_value(),
+                None if other >= <$T as Zero>::zero() => <$T>::max_value(),
+                None => <$T>::min_value(),
             }
         }
 
@@ -1617,8 +1674,38 @@ pub fn saturating_add(self, other: $T) -> $T {
         pub fn saturating_sub(self, other: $T) -> $T {
             match self.checked_sub(other) {
                 Some(x)                       => x,
-                None if other >= <$T>::zero() => <$T>::min_value(),
-                None                          => <$T>::max_value(),
+                None if other >= <$T as Zero>::zero() => <$T>::min_value(),
+                None => <$T>::max_value(),
+            }
+        }
+
+        /// Wrapping (modular) addition. Computes `self + other`,
+        /// wrapping around at the boundary of the type.
+        #[stable(feature = "rust1", since = "1.0.0")]
+        #[inline]
+        pub fn wrapping_add(self, rhs: $T) -> $T {
+            unsafe {
+                intrinsics::overflowing_add(self, rhs)
+            }
+        }
+
+        /// Wrapping (modular) subtraction. Computes `self - other`,
+        /// wrapping around at the boundary of the type.
+        #[stable(feature = "rust1", since = "1.0.0")]
+        #[inline]
+        pub fn wrapping_sub(self, rhs: $T) -> $T {
+            unsafe {
+                intrinsics::overflowing_sub(self, rhs)
+            }
+        }
+
+        /// Wrapping (modular) multiplication. Computes `self *
+        /// other`, wrapping around at the boundary of the type.
+        #[stable(feature = "rust1", since = "1.0.0")]
+        #[inline]
+        pub fn wrapping_mul(self, rhs: $T) -> $T {
+            unsafe {
+                intrinsics::overflowing_mul(self, rhs)
             }
         }
 
@@ -1632,12 +1719,11 @@ pub fn saturating_sub(self, other: $T) -> $T {
         ///
         /// assert_eq!(2.pow(4), 16);
         /// ```
-        #[unstable(feature = "core",
-                   reason = "pending integer conventions")]
+        #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn pow(self, mut exp: u32) -> $T {
             let mut base = self;
-            let mut acc = <$T>::one();
+            let mut acc = <$T as One>::one();
 
             let mut prev_base = self;
             let mut base_oflo = false;
@@ -1665,8 +1751,8 @@ pub fn pow(self, mut exp: u32) -> $T {
         #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
         pub fn is_power_of_two(self) -> bool {
-            (self.wrapping_sub(<$T>::one())) & self == <$T>::zero() &&
-                !(self == <$T>::zero())
+            (self.wrapping_sub(<$T as One>::one())) & self == <$T as Zero>::zero() &&
+                !(self == <$T as Zero>::zero())
         }
 
         /// Returns the smallest power of two greater than or equal to `self`.
@@ -1675,7 +1761,7 @@ pub fn is_power_of_two(self) -> bool {
         #[inline]
         pub fn next_power_of_two(self) -> $T {
             let bits = size_of::<$T>() * 8;
-            let one: $T = <$T>::one();
+            let one: $T = <$T as One>::one();
             one << ((bits - self.wrapping_sub(one).leading_zeros() as usize) % bits)
         }
 
@@ -1746,7 +1832,7 @@ impl u64 {
 #[cfg(target_pointer_width = "32")]
 #[lang = "usize"]
 impl usize {
-    uint_impl! { uint = u32, 32,
+    uint_impl! { usize = u32, 32,
         intrinsics::ctpop32,
         intrinsics::ctlz32,
         intrinsics::cttz32,
@@ -1759,7 +1845,7 @@ impl usize {
 #[cfg(target_pointer_width = "64")]
 #[lang = "usize"]
 impl usize {
-    uint_impl! { uint = u64, 64,
+    uint_impl! { usize = u64, 64,
         intrinsics::ctpop64,
         intrinsics::ctlz64,
         intrinsics::cttz64,
@@ -1772,11 +1858,11 @@ impl usize {
 /// A generic trait for converting a value to a number.
 #[unstable(feature = "core", reason = "trait is likely to be removed")]
 pub trait ToPrimitive {
-    /// Converts the value of `self` to an `int`.
+    /// Converts the value of `self` to an `isize`.
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0", reason = "use to_isize")]
-    fn to_int(&self) -> Option<int> {
+    fn to_int(&self) -> Option<isize> {
         self.to_i64().and_then(|x| x.to_isize())
     }
 
@@ -1807,11 +1893,11 @@ fn to_i32(&self) -> Option<i32> {
     /// Converts the value of `self` to an `i64`.
     fn to_i64(&self) -> Option<i64>;
 
-    /// Converts the value of `self` to an `uint`.
+    /// Converts the value of `self` to an `usize`.
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0", reason = "use to_usize")]
-    fn to_uint(&self) -> Option<uint> {
+    fn to_uint(&self) -> Option<usize> {
         self.to_u64().and_then(|x| x.to_usize())
     }
 
@@ -1893,7 +1979,7 @@ macro_rules! impl_to_primitive_int {
     ($T:ty) => (
         impl ToPrimitive for $T {
             #[inline]
-            fn to_int(&self) -> Option<int> { impl_to_primitive_int_to_int!($T, int, *self) }
+            fn to_int(&self) -> Option<isize> { impl_to_primitive_int_to_int!($T, isize, *self) }
             #[inline]
             fn to_isize(&self) -> Option<isize> { impl_to_primitive_int_to_int!($T, isize, *self) }
             #[inline]
@@ -1906,7 +1992,7 @@ fn to_i32(&self) -> Option<i32> { impl_to_primitive_int_to_int!($T, i32, *self)
             fn to_i64(&self) -> Option<i64> { impl_to_primitive_int_to_int!($T, i64, *self) }
 
             #[inline]
-            fn to_uint(&self) -> Option<uint> { impl_to_primitive_int_to_uint!($T, uint, *self) }
+            fn to_uint(&self) -> Option<usize> { impl_to_primitive_int_to_uint!($T, usize, *self) }
             #[inline]
             fn to_usize(&self) -> Option<usize> { impl_to_primitive_int_to_uint!($T, usize, *self) }
             #[inline]
@@ -1967,9 +2053,9 @@ macro_rules! impl_to_primitive_uint {
     ($T:ty) => (
         impl ToPrimitive for $T {
             #[inline]
-            fn to_int(&self) -> Option<int> { impl_to_primitive_uint_to_int!(int, *self) }
+            fn to_int(&self) -> Option<isize> { impl_to_primitive_uint_to_int!(isize, *self) }
             #[inline]
-            fn to_isize(&self) -> Option<int> { impl_to_primitive_uint_to_int!(isize, *self) }
+            fn to_isize(&self) -> Option<isize> { impl_to_primitive_uint_to_int!(isize, *self) }
             #[inline]
             fn to_i8(&self) -> Option<i8> { impl_to_primitive_uint_to_int!(i8, *self) }
             #[inline]
@@ -1980,9 +2066,11 @@ fn to_i32(&self) -> Option<i32> { impl_to_primitive_uint_to_int!(i32, *self) }
             fn to_i64(&self) -> Option<i64> { impl_to_primitive_uint_to_int!(i64, *self) }
 
             #[inline]
-            fn to_uint(&self) -> Option<uint> { impl_to_primitive_uint_to_uint!($T, uint, *self) }
+            fn to_uint(&self) -> Option<usize> { impl_to_primitive_uint_to_uint!($T, usize, *self) }
             #[inline]
-            fn to_usize(&self) -> Option<uint> { impl_to_primitive_uint_to_uint!($T, usize, *self) }
+            fn to_usize(&self) -> Option<usize> {
+                impl_to_primitive_uint_to_uint!($T, usize, *self)
+            }
             #[inline]
             fn to_u8(&self) -> Option<u8> { impl_to_primitive_uint_to_uint!($T, u8, *self) }
             #[inline]
@@ -2026,9 +2114,9 @@ macro_rules! impl_to_primitive_float {
     ($T:ident) => (
         impl ToPrimitive for $T {
             #[inline]
-            fn to_int(&self) -> Option<int> { Some(*self as int) }
+            fn to_int(&self) -> Option<isize> { Some(*self as isize) }
             #[inline]
-            fn to_isize(&self) -> Option<int> { Some(*self as isize) }
+            fn to_isize(&self) -> Option<isize> { Some(*self as isize) }
             #[inline]
             fn to_i8(&self) -> Option<i8> { Some(*self as i8) }
             #[inline]
@@ -2039,9 +2127,9 @@ fn to_i32(&self) -> Option<i32> { Some(*self as i32) }
             fn to_i64(&self) -> Option<i64> { Some(*self as i64) }
 
             #[inline]
-            fn to_uint(&self) -> Option<uint> { Some(*self as uint) }
+            fn to_uint(&self) -> Option<usize> { Some(*self as usize) }
             #[inline]
-            fn to_usize(&self) -> Option<uint> { Some(*self as usize) }
+            fn to_usize(&self) -> Option<usize> { Some(*self as usize) }
             #[inline]
             fn to_u8(&self) -> Option<u8> { Some(*self as u8) }
             #[inline]
@@ -2065,12 +2153,12 @@ fn to_f64(&self) -> Option<f64> { impl_to_primitive_float_to_float!($T, f64, *se
 /// A generic trait for converting a number to a value.
 #[unstable(feature = "core", reason = "trait is likely to be removed")]
 pub trait FromPrimitive : ::marker::Sized {
-    /// Convert an `int` to return an optional value of this type. If the
+    /// Convert an `isize` to return an optional value of this type. If the
     /// value cannot be represented by this value, the `None` is returned.
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0", reason = "use from_isize")]
-    fn from_int(n: int) -> Option<Self> {
+    fn from_int(n: isize) -> Option<Self> {
         FromPrimitive::from_i64(n as i64)
     }
 
@@ -2106,12 +2194,12 @@ fn from_i32(n: i32) -> Option<Self> {
     /// type cannot be represented by this value, the `None` is returned.
     fn from_i64(n: i64) -> Option<Self>;
 
-    /// Convert an `uint` to return an optional value of this type. If the
+    /// Convert an `usize` to return an optional value of this type. If the
     /// type cannot be represented by this value, the `None` is returned.
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0", reason = "use from_usize")]
-    fn from_uint(n: uint) -> Option<Self> {
+    fn from_uint(n: usize) -> Option<Self> {
         FromPrimitive::from_u64(n as u64)
     }
 
@@ -2165,7 +2253,7 @@ fn from_f64(n: f64) -> Option<Self> {
 /// A utility function that just calls `FromPrimitive::from_int`.
 #[unstable(feature = "core", reason = "likely to be removed")]
 #[deprecated(since = "1.0.0", reason = "use from_isize")]
-pub fn from_int<A: FromPrimitive>(n: int) -> Option<A> {
+pub fn from_int<A: FromPrimitive>(n: isize) -> Option<A> {
     FromPrimitive::from_isize(n)
 }
 
@@ -2202,7 +2290,7 @@ pub fn from_i64<A: FromPrimitive>(n: i64) -> Option<A> {
 /// A utility function that just calls `FromPrimitive::from_uint`.
 #[unstable(feature = "core", reason = "likely to be removed")]
 #[deprecated(since = "1.0.0", reason = "use from_uint")]
-pub fn from_uint<A: FromPrimitive>(n: uint) -> Option<A> {
+pub fn from_uint<A: FromPrimitive>(n: usize) -> Option<A> {
     FromPrimitive::from_usize(n)
 }
 
@@ -2252,13 +2340,13 @@ 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_int(n: isize) -> Option<$T> { n.$to_ty() }
             #[inline] fn from_i8(n: i8) -> Option<$T> { n.$to_ty() }
             #[inline] fn from_i16(n: i16) -> Option<$T> { n.$to_ty() }
             #[inline] fn from_i32(n: i32) -> Option<$T> { n.$to_ty() }
             #[inline] fn from_i64(n: i64) -> Option<$T> { n.$to_ty() }
 
-            #[inline] fn from_uint(n: uint) -> Option<$T> { n.$to_ty() }
+            #[inline] fn from_uint(n: usize) -> Option<$T> { n.$to_ty() }
             #[inline] fn from_u8(n: u8) -> Option<$T> { n.$to_ty() }
             #[inline] fn from_u16(n: u16) -> Option<$T> { n.$to_ty() }
             #[inline] fn from_u32(n: u32) -> Option<$T> { n.$to_ty() }
@@ -2270,12 +2358,12 @@ impl FromPrimitive for $T {
     )
 }
 
-impl_from_primitive! { int, to_int }
+impl_from_primitive! { isize, to_int }
 impl_from_primitive! { i8, to_i8 }
 impl_from_primitive! { i16, to_i16 }
 impl_from_primitive! { i32, to_i32 }
 impl_from_primitive! { i64, to_i64 }
-impl_from_primitive! { uint, to_uint }
+impl_from_primitive! { usize, to_uint }
 impl_from_primitive! { u8, to_u8 }
 impl_from_primitive! { u16, to_u16 }
 impl_from_primitive! { u32, to_u32 }
@@ -2327,28 +2415,37 @@ fn from<N: ToPrimitive>(n: N) -> Option<$T> {
 impl_num_cast! { u16,   to_u16 }
 impl_num_cast! { u32,   to_u32 }
 impl_num_cast! { u64,   to_u64 }
-impl_num_cast! { uint,  to_uint }
+impl_num_cast! { usize,  to_uint }
 impl_num_cast! { i8,    to_i8 }
 impl_num_cast! { i16,   to_i16 }
 impl_num_cast! { i32,   to_i32 }
 impl_num_cast! { i64,   to_i64 }
-impl_num_cast! { int,   to_int }
+impl_num_cast! { isize,   to_int }
 impl_num_cast! { f32,   to_f32 }
 impl_num_cast! { f64,   to_f64 }
 
 /// Used for representing the classification of floating point numbers
 #[derive(Copy, PartialEq, Debug)]
-#[unstable(feature = "core", reason = "may be renamed")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub enum FpCategory {
     /// "Not a Number", often obtained by dividing by zero
+    #[stable(feature = "rust1", since = "1.0.0")]
     Nan,
+
     /// Positive or negative infinity
+    #[stable(feature = "rust1", since = "1.0.0")]
     Infinite ,
+
     /// Positive or negative zero
+    #[stable(feature = "rust1", since = "1.0.0")]
     Zero,
+
     /// De-normalized floating point representation (less precise than `Normal`)
+    #[stable(feature = "rust1", since = "1.0.0")]
     Subnormal,
+
     /// A regular floating point number
+    #[stable(feature = "rust1", since = "1.0.0")]
     Normal,
 }
 
@@ -2392,12 +2489,12 @@ pub trait Float
     #[deprecated(since = "1.0.0",
                  reason = "use `std::f32::MANTISSA_DIGITS` or \
                            `std::f64::MANTISSA_DIGITS` as appropriate")]
-    fn mantissa_digits(unused_self: Option<Self>) -> uint;
+    fn mantissa_digits(unused_self: Option<Self>) -> usize;
     /// Returns the number of base-10 digits of precision that this type supports.
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
                  reason = "use `std::f32::DIGITS` or `std::f64::DIGITS` as appropriate")]
-    fn digits(unused_self: Option<Self>) -> uint;
+    fn digits(unused_self: Option<Self>) -> usize;
     /// Returns the difference between 1.0 and the smallest representable number larger than 1.0.
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
@@ -2407,22 +2504,22 @@ pub trait Float
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
                  reason = "use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` as appropriate")]
-    fn min_exp(unused_self: Option<Self>) -> int;
+    fn min_exp(unused_self: Option<Self>) -> isize;
     /// Returns the maximum binary exponent that this type can represent.
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
                  reason = "use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` as appropriate")]
-    fn max_exp(unused_self: Option<Self>) -> int;
+    fn max_exp(unused_self: Option<Self>) -> isize;
     /// Returns the minimum base-10 exponent that this type can represent.
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
                  reason = "use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` as appropriate")]
-    fn min_10_exp(unused_self: Option<Self>) -> int;
+    fn min_10_exp(unused_self: Option<Self>) -> isize;
     /// Returns the maximum base-10 exponent that this type can represent.
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
                  reason = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate")]
-    fn max_10_exp(unused_self: Option<Self>) -> int;
+    fn max_10_exp(unused_self: Option<Self>) -> isize;
     /// Returns the smallest finite value that this type can represent.
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
@@ -2525,13 +2622,24 @@ pub trait Float
 
 /// A generic trait for converting a string with a radix (base) to a value
 #[unstable(feature = "core", reason = "needs reevaluation")]
+#[deprecated(since = "1.0.0",
+             reason = "moved to inherent methods; use e.g. i32::from_str_radix")]
 pub trait FromStrRadix {
+    #[unstable(feature = "core", reason = "needs reevaluation")]
+    #[deprecated(since = "1.0.0", reason = "moved to inherent methods")]
     type Err;
+
+    #[unstable(feature = "core", reason = "needs reevaluation")]
+    #[deprecated(since = "1.0.0",
+                 reason = "moved to inherent methods; use e.g. i32::from_str_radix")]
+    #[allow(deprecated)]
     fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::Err>;
 }
 
 /// A utility function that just calls `FromStrRadix::from_str_radix`.
 #[unstable(feature = "core", reason = "needs reevaluation")]
+#[deprecated(since = "1.0.0", reason = "use e.g. i32::from_str_radix")]
+#[allow(deprecated)]
 pub fn from_str_radix<T: FromStrRadix>(str: &str, radix: u32)
                                        -> Result<T, T::Err> {
     FromStrRadix::from_str_radix(str, radix)
@@ -2569,12 +2677,14 @@ impl FromStr for $T {
             /// `None` if the string did not represent a valid number.  Otherwise,
             /// `Some(n)` where `n` is the floating-point number represented by `src`.
             #[inline]
+            #[allow(deprecated)]
             fn from_str(src: &str) -> Result<$T, ParseFloatError> {
                 from_str_radix(src, 10)
             }
         }
 
         #[stable(feature = "rust1", since = "1.0.0")]
+        #[allow(deprecated)]
         impl FromStrRadix for $T {
             type Err = ParseFloatError;
 
@@ -2625,7 +2735,7 @@ fn from_str_radix(src: &str, radix: u32)
                 let mut prev_sig = sig;
                 let mut cs = src.chars().enumerate();
                 // Exponent prefix and exponent index offset
-                let mut exp_info = None::<(char, uint)>;
+                let mut exp_info = None::<(char, usize)>;
 
                 // Parse the integer part of the significand
                 for (i, c) in cs.by_ref() {
@@ -2636,9 +2746,9 @@ fn from_str_radix(src: &str, radix: u32)
 
                             // add/subtract current digit depending on sign
                             if is_positive {
-                                sig = sig + ((digit as int) as $T);
+                                sig = sig + ((digit as isize) as $T);
                             } else {
-                                sig = sig - ((digit as int) as $T);
+                                sig = sig - ((digit as isize) as $T);
                             }
 
                             // Detect overflow by comparing to last value, except
@@ -2719,9 +2829,9 @@ fn from_str_radix(src: &str, radix: u32)
                         // Parse the exponent as decimal integer
                         let src = &src[offset..];
                         let (is_positive, exp) = match src.slice_shift_char() {
-                            Some(('-', src)) => (false, src.parse::<uint>()),
-                            Some(('+', src)) => (true,  src.parse::<uint>()),
-                            Some((_, _))     => (true,  src.parse::<uint>()),
+                            Some(('-', src)) => (false, src.parse::<usize>()),
+                            Some(('+', src)) => (true,  src.parse::<usize>()),
+                            Some((_, _))     => (true,  src.parse::<usize>()),
                             None             => return Err(PFE { kind: Invalid }),
                         };
 
@@ -2745,6 +2855,7 @@ fn from_str_radix(src: &str, radix: u32)
 macro_rules! from_str_radix_int_impl {
     ($T:ty) => {
         #[stable(feature = "rust1", since = "1.0.0")]
+        #[allow(deprecated)]
         impl FromStr for $T {
             type Err = ParseIntError;
             #[inline]
@@ -2754,6 +2865,7 @@ fn from_str(src: &str) -> Result<$T, ParseIntError> {
         }
 
         #[stable(feature = "rust1", since = "1.0.0")]
+        #[allow(deprecated)]
         impl FromStrRadix for $T {
             type Err = ParseIntError;
             fn from_str_radix(src: &str, radix: u32)
index 289c5dbd08ea0eb02bf6c028ff2ec62e79ca4e80..21635799a77a26a458619bcd3b3431ce2ae0c7ba 100644 (file)
@@ -12,6 +12,5 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(primitive = "u16")]
-#![allow(trivial_numeric_casts)]
 
 uint_module! { u16, i16, 16 }
index 6d0b6b0e5eaf9799a4f472bbc2efbbff8c8ea2c5..7d520770503d4b2507cb483afc8bcf04204ca443 100644 (file)
@@ -12,6 +12,5 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(primitive = "u32")]
-#![allow(trivial_numeric_casts)]
 
 uint_module! { u32, i32, 32 }
index bf8747fdb6e2f45461a50eeea9795a97e85ecb33..f10822077dc7511e3e44d12596e6e2198e0e941d 100644 (file)
@@ -12,6 +12,5 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(primitive = "u64")]
-#![allow(trivial_numeric_casts)]
 
 uint_module! { u64, i64, 64 }
index 05199735d4acb3f6aee6963963896308dab95ebd..3d6922b07b19407b325941dd14888e4fea334214 100644 (file)
@@ -12,6 +12,5 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(primitive = "u8")]
-#![allow(trivial_numeric_casts)]
 
 uint_module! { u8, i8, 8 }
index c22f31cc57ea84efba5238460fee13f32afd64ee..d0c4885ad00b77ebbfaef418cb230976e6955f21 100644 (file)
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 #![doc(hidden)]
-#![allow(trivial_numeric_casts)]
 
 macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => (
 
index 82dd3312782c554fdebaadb100d1d1c7df08d90f..602ef4fe45e734e0f1a931a2a50c98ce98e0511a 100644 (file)
@@ -16,6 +16,5 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(primitive = "usize")]
-#![allow(trivial_numeric_casts)]
 
 uint_module! { usize, isize, ::isize::BITS }
index f8fc4ef27a1c9e1812feeff04836cf56c31973a8..bda05a3d9e885aff66f7929816cbe13a360ac0d3 100644 (file)
@@ -7,7 +7,11 @@
 // <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(missing_docs)]
+#![allow(deprecated)]
+
+use super::Wrapping;
 
 use ops::*;
 
@@ -26,6 +30,8 @@
 use intrinsics::{i32_mul_with_overflow, u32_mul_with_overflow};
 use intrinsics::{i64_mul_with_overflow, u64_mul_with_overflow};
 
+#[unstable(feature = "core", reason = "may be removed, renamed, or relocated")]
+#[deprecated(since = "1.0.0", reason = "moved to inherent methods")]
 pub trait WrappingOps {
     fn wrapping_add(self, rhs: Self) -> Self;
     fn wrapping_sub(self, rhs: Self) -> Self;
@@ -39,6 +45,49 @@ pub trait OverflowingOps {
     fn overflowing_mul(self, rhs: Self) -> (Self, bool);
 }
 
+macro_rules! sh_impl {
+    ($t:ty, $f:ty) => (
+        #[stable(feature = "rust1", since = "1.0.0")]
+        impl Shl<$f> for Wrapping<$t> {
+            type Output = Wrapping<$t>;
+
+            #[inline(always)]
+            fn shl(self, other: $f) -> Wrapping<$t> {
+                Wrapping(self.0 << other)
+            }
+        }
+
+        #[stable(feature = "rust1", since = "1.0.0")]
+        impl Shr<$f> for Wrapping<$t> {
+            type Output = Wrapping<$t>;
+
+            #[inline(always)]
+            fn shr(self, other: $f) -> Wrapping<$t> {
+                Wrapping(self.0 >> other)
+            }
+        }
+    )
+}
+
+// FIXME (#23545): uncomment the remaining impls
+macro_rules! sh_impl_all {
+    ($($t:ty)*) => ($(
+        // sh_impl! { $t, u8 }
+        // sh_impl! { $t, u16 }
+        // sh_impl! { $t, u32 }
+        // sh_impl! { $t, u64 }
+        sh_impl! { $t, usize }
+
+        // sh_impl! { $t, i8 }
+        // sh_impl! { $t, i16 }
+        // sh_impl! { $t, i32 }
+        // sh_impl! { $t, i64 }
+        // sh_impl! { $t, isize }
+    )*)
+}
+
+sh_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
+
 macro_rules! wrapping_impl {
     ($($t:ty)*) => ($(
         impl WrappingOps for $t {
@@ -61,94 +110,79 @@ fn wrapping_mul(self, rhs: $t) -> $t {
                 }
             }
         }
-    )*)
-}
-
-wrapping_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 }
-
-#[unstable(feature = "core", reason = "may be removed, renamed, or relocated")]
-#[derive(PartialEq,Eq,PartialOrd,Ord,Clone,Copy)]
-pub struct Wrapping<T>(pub T);
-
-impl<T:WrappingOps> Add for Wrapping<T> {
-    type Output = Wrapping<T>;
-
-    #[inline(always)]
-    fn add(self, other: Wrapping<T>) -> Wrapping<T> {
-        Wrapping(self.0.wrapping_add(other.0))
-    }
-}
 
-impl<T:WrappingOps> Sub for Wrapping<T> {
-    type Output = Wrapping<T>;
+        #[stable(feature = "rust1", since = "1.0.0")]
+        impl Add for Wrapping<$t> {
+            type Output = Wrapping<$t>;
 
-    #[inline(always)]
-    fn sub(self, other: Wrapping<T>) -> Wrapping<T> {
-        Wrapping(self.0.wrapping_sub(other.0))
-    }
-}
+            #[inline(always)]
+            fn add(self, other: Wrapping<$t>) -> Wrapping<$t> {
+                Wrapping(self.0.wrapping_add(other.0))
+            }
+        }
 
-impl<T:WrappingOps> Mul for Wrapping<T> {
-    type Output = Wrapping<T>;
+        #[stable(feature = "rust1", since = "1.0.0")]
+        impl Sub for Wrapping<$t> {
+            type Output = Wrapping<$t>;
 
-    #[inline(always)]
-    fn mul(self, other: Wrapping<T>) -> Wrapping<T> {
-        Wrapping(self.0.wrapping_mul(other.0))
-    }
-}
+            #[inline(always)]
+            fn sub(self, other: Wrapping<$t>) -> Wrapping<$t> {
+                Wrapping(self.0.wrapping_sub(other.0))
+            }
+        }
 
-impl<T:WrappingOps+Not<Output=T>> Not for Wrapping<T> {
-    type Output = Wrapping<T>;
+        #[stable(feature = "rust1", since = "1.0.0")]
+        impl Mul for Wrapping<$t> {
+            type Output = Wrapping<$t>;
 
-    fn not(self) -> Wrapping<T> {
-        Wrapping(!self.0)
-    }
-}
+            #[inline(always)]
+            fn mul(self, other: Wrapping<$t>) -> Wrapping<$t> {
+                Wrapping(self.0.wrapping_mul(other.0))
+            }
+        }
 
-impl<T:WrappingOps+BitXor<Output=T>> BitXor for Wrapping<T> {
-    type Output = Wrapping<T>;
+        #[stable(feature = "rust1", since = "1.0.0")]
+        impl Not for Wrapping<$t> {
+            type Output = Wrapping<$t>;
 
-    #[inline(always)]
-    fn bitxor(self, other: Wrapping<T>) -> Wrapping<T> {
-        Wrapping(self.0 ^ other.0)
-    }
-}
+            fn not(self) -> Wrapping<$t> {
+                Wrapping(!self.0)
+            }
+        }
 
-impl<T:WrappingOps+BitOr<Output=T>> BitOr for Wrapping<T> {
-    type Output = Wrapping<T>;
+        #[stable(feature = "rust1", since = "1.0.0")]
+        impl BitXor for Wrapping<$t> {
+            type Output = Wrapping<$t>;
 
-    #[inline(always)]
-    fn bitor(self, other: Wrapping<T>) -> Wrapping<T> {
-        Wrapping(self.0 | other.0)
-    }
-}
+            #[inline(always)]
+            fn bitxor(self, other: Wrapping<$t>) -> Wrapping<$t> {
+                Wrapping(self.0 ^ other.0)
+            }
+        }
 
-impl<T:WrappingOps+BitAnd<Output=T>> BitAnd for Wrapping<T> {
-    type Output = Wrapping<T>;
+        #[stable(feature = "rust1", since = "1.0.0")]
+        impl BitOr for Wrapping<$t> {
+            type Output = Wrapping<$t>;
 
-    #[inline(always)]
-    fn bitand(self, other: Wrapping<T>) -> Wrapping<T> {
-        Wrapping(self.0 & other.0)
-    }
-}
+            #[inline(always)]
+            fn bitor(self, other: Wrapping<$t>) -> Wrapping<$t> {
+                Wrapping(self.0 | other.0)
+            }
+        }
 
-impl<T:WrappingOps+Shl<uint,Output=T>> Shl<uint> for Wrapping<T> {
-    type Output = Wrapping<T>;
+        #[stable(feature = "rust1", since = "1.0.0")]
+        impl BitAnd for Wrapping<$t> {
+            type Output = Wrapping<$t>;
 
-    #[inline(always)]
-    fn shl(self, other: uint) -> Wrapping<T> {
-        Wrapping(self.0 << other)
-    }
+            #[inline(always)]
+            fn bitand(self, other: Wrapping<$t>) -> Wrapping<$t> {
+                Wrapping(self.0 & other.0)
+            }
+        }
+    )*)
 }
 
-impl<T:WrappingOps+Shr<uint,Output=T>> Shr<uint> for Wrapping<T> {
-    type Output = Wrapping<T>;
-
-    #[inline(always)]
-    fn shr(self, other: uint) -> Wrapping<T> {
-        Wrapping(self.0 >> other)
-    }
-}
+wrapping_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
 
 macro_rules! overflowing_impl {
     ($($t:ident)*) => ($(
index 16d03901239b3ea417ba47c69c9987c13174933a..862eb16d0bfb3fcb26c5f7a11008e5b142d867b1 100644 (file)
@@ -485,6 +485,7 @@ pub trait Neg {
 macro_rules! neg_impl {
     ($($t:ty)*) => ($(
         #[stable(feature = "rust1", since = "1.0.0")]
+        #[allow(unsigned_negation)]
         impl Neg for $t {
             #[stable(feature = "rust1", since = "1.0.0")]
             type Output = $t;
@@ -498,28 +499,7 @@ fn neg(self) -> $t { -self }
     )*)
 }
 
-macro_rules! neg_uint_impl {
-    ($t:ty, $t_signed:ty) => {
-        #[stable(feature = "rust1", since = "1.0.0")]
-        impl Neg for $t {
-            type Output = $t;
-
-            #[inline]
-            fn neg(self) -> $t { -(self as $t_signed) as $t }
-        }
-
-        forward_ref_unop! { impl Neg, neg for $t }
-    }
-}
-
-neg_impl! { isize i8 i16 i32 i64 f32 f64 }
-
-neg_uint_impl! { usize, isize }
-neg_uint_impl! { u8, i8 }
-neg_uint_impl! { u16, i16 }
-neg_uint_impl! { u32, i32 }
-neg_uint_impl! { u64, i64 }
-
+neg_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
 
 /// The `Not` trait is used to specify the functionality of unary `!`.
 ///
@@ -917,12 +897,6 @@ pub trait Index<Idx: ?Sized> {
     type Output: ?Sized;
 
     /// The method for the indexing (`Foo[Bar]`) operation
-    #[cfg(stage0)]
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn index<'a>(&'a self, index: &Idx) -> &'a Self::Output;
-
-    /// The method for the indexing (`Foo[Bar]`) operation
-    #[cfg(not(stage0))]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn index<'a>(&'a self, index: Idx) -> &'a Self::Output;
 }
@@ -966,12 +940,6 @@ pub trait Index<Idx: ?Sized> {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
     /// The method for the indexing (`Foo[Bar]`) operation
-    #[cfg(stage0)]
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn index_mut<'a>(&'a mut self, index: &Idx) -> &'a mut Self::Output;
-
-    /// The method for the indexing (`Foo[Bar]`) operation
-    #[cfg(not(stage0))]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn index_mut<'a>(&'a mut self, index: Idx) -> &'a mut Self::Output;
 }
@@ -1149,20 +1117,6 @@ fn deref_mut(&mut self) -> &mut T { *self }
 #[lang="fn"]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[rustc_paren_sugar]
-#[cfg(stage0)]
-pub trait Fn<Args> {
-    /// The returned type after the call operator is used.
-    type Output;
-
-    /// This is called when the call operator is used.
-    extern "rust-call" fn call(&self, args: Args) -> Self::Output;
-}
-
-/// A version of the call operator that takes an immutable receiver.
-#[lang="fn"]
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_paren_sugar]
-#[cfg(not(stage0))]
 pub trait Fn<Args> : FnMut<Args> {
     /// This is called when the call operator is used.
     extern "rust-call" fn call(&self, args: Args) -> Self::Output;
@@ -1172,20 +1126,6 @@ pub trait Fn<Args> : FnMut<Args> {
 #[lang="fn_mut"]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[rustc_paren_sugar]
-#[cfg(stage0)]
-pub trait FnMut<Args> {
-    /// The returned type after the call operator is used.
-    type Output;
-
-    /// This is called when the call operator is used.
-    extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
-}
-
-/// A version of the call operator that takes a mutable receiver.
-#[lang="fn_mut"]
-#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_paren_sugar]
-#[cfg(not(stage0))]
 pub trait FnMut<Args> : FnOnce<Args> {
     /// This is called when the call operator is used.
     extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
@@ -1202,25 +1142,3 @@ pub trait FnOnce<Args> {
     /// This is called when the call operator is used.
     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
 }
-
-#[cfg(stage0)]
-impl<F: ?Sized, A> FnMut<A> for F
-    where F : Fn<A>
-{
-    type Output = <F as Fn<A>>::Output;
-
-    extern "rust-call" fn call_mut(&mut self, args: A) -> <F as Fn<A>>::Output {
-        self.call(args)
-    }
-}
-
-#[cfg(stage0)]
-impl<F,A> FnOnce<A> for F
-    where F : FnMut<A>
-{
-    type Output = <F as FnMut<A>>::Output;
-
-    extern "rust-call" fn call_once(mut self, args: A) -> <F as FnMut<A>>::Output {
-        self.call_mut(args)
-    }
-}
index a565b137cc852a5f84cd33885f87f0a954cd3e13..c5102ede29fcf82f0ab37905e444f973d492ba98 100644 (file)
 use clone::Clone;
 use cmp::{Eq, Ord};
 use default::Default;
-use iter::{ExactSizeIterator};
-use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator, IntoIterator};
+use iter::ExactSizeIterator;
+use iter::{Iterator, DoubleEndedIterator, FromIterator, IntoIterator};
 use mem;
-use ops::{Deref, FnOnce};
+use ops::FnOnce;
 use result::Result::{Ok, Err};
 use result::Result;
 #[allow(deprecated)]
@@ -320,7 +320,7 @@ pub fn as_mut_slice<'r>(&'r mut self) -> &'r mut [T] {
     /// assert_eq!(x.expect("the world is ending"), "value");
     /// ```
     ///
-    /// ```{.should_fail}
+    /// ```{.should_panic}
     /// let x: Option<&str> = None;
     /// x.expect("the world is ending"); // panics with `world is ending`
     /// ```
@@ -333,7 +333,7 @@ pub fn expect(self, msg: &str) -> T {
         }
     }
 
-    /// Returns the inner `T` of a `Some(T)`.
+    /// Moves the value `v` out of the `Option<T>` if it is `Some(v)`.
     ///
     /// # Panics
     ///
@@ -352,7 +352,7 @@ pub fn expect(self, msg: &str) -> T {
     /// assert_eq!(x.unwrap(), "air");
     /// ```
     ///
-    /// ```{.should_fail}
+    /// ```{.should_panic}
     /// let x: Option<&str> = None;
     /// assert_eq!(x.unwrap(), "air"); // fails
     /// ```
@@ -480,7 +480,7 @@ pub fn map_or_else<U, D: FnOnce() -> U, F: FnOnce(T) -> U>(self, def: D, f: F) -
     /// assert_eq!(x.ok_or(0), Err(0));
     /// ```
     #[inline]
-    #[unstable(feature = "core")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn ok_or<E>(self, err: E) -> Result<T, E> {
         match self {
             Some(v) => Ok(v),
@@ -502,7 +502,7 @@ pub fn ok_or<E>(self, err: E) -> Result<T, E> {
     /// assert_eq!(x.ok_or_else(|| 0), Err(0));
     /// ```
     #[inline]
-    #[unstable(feature = "core")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<T, E> {
         match self {
             Some(v) => Ok(v),
@@ -548,8 +548,7 @@ pub fn iter(&self) -> Iter<T> {
     /// assert_eq!(x.iter_mut().next(), None);
     /// ```
     #[inline]
-    #[unstable(feature = "core",
-               reason = "waiting for iterator conventions")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn iter_mut(&mut self) -> IterMut<T> {
         IterMut { inner: Item { opt: self.as_mut() } }
     }
@@ -721,13 +720,11 @@ pub fn as_slice<'a>(&'a self) -> &'a [T] {
     }
 }
 
-impl<'a, T: Clone, D: Deref<Target=T>> Option<D> {
-    /// Maps an Option<D> to an Option<T> by dereffing and cloning the contents of the Option.
-    /// Useful for converting an Option<&T> to an Option<T>.
-    #[unstable(feature = "core",
-               reason = "recently added as part of collections reform")]
+impl<'a, T: Clone> Option<&'a T> {
+    /// Maps an Option<&T> to an Option<T> by cloning the contents of the Option.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn cloned(self) -> Option<T> {
-        self.map(|t| t.deref().clone())
+        self.map(|t| t.clone())
     }
 }
 
index 377b5b57ae12c2b967a9fe5b66c087ba0271d284..d6e00df1fd7955ea88f773bef85ad4f7b80afb1b 100644 (file)
@@ -16,7 +16,7 @@
 //! interface for panicking is:
 //!
 //! ```ignore
-//! fn panic_impl(fmt: fmt::Arguments, &(&'static str, uint)) -> !;
+//! fn panic_impl(fmt: fmt::Arguments, &(&'static str, usize)) -> !;
 //! ```
 //!
 //! This definition allows for panicking with any general message, but it does not
@@ -58,8 +58,8 @@ pub fn panic_fmt(fmt: fmt::Arguments, file_line: &(&'static str, u32)) -> ! {
     #[allow(improper_ctypes)]
     extern {
         #[lang = "panic_fmt"]
-        fn panic_impl(fmt: fmt::Arguments, file: &'static str, line: uint) -> !;
+        fn panic_impl(fmt: fmt::Arguments, file: &'static str, line: usize) -> !;
     }
     let (file, line) = *file_line;
-    unsafe { panic_impl(fmt, file, line as uint) }
+    unsafe { panic_impl(fmt, file, line as usize) }
 }
index 424829939b92e89fbea8898bdcb7b71ff09dba54..448b90c0dbdaf5af2074f9df5ef6fc1e0290bd48 100644 (file)
@@ -37,7 +37,7 @@
 pub use clone::Clone;
 pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
 pub use convert::{AsRef, AsMut, Into, From};
-pub use iter::{Extend, IteratorExt};
+pub use iter::Extend;
 pub use iter::{Iterator, DoubleEndedIterator};
 pub use iter::{ExactSizeIterator};
 pub use option::Option::{self, Some, None};
index 9b3ee3ef5e0c28fb1a402d0b6100bf1af5ad2288..41a70ef708f30d85a5a49ff63c175cad0ccdb826 100644 (file)
 // FIXME #19649: intrinsic docs don't render, so these have no docs :(
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg(not(stage0))]
 pub use intrinsics::copy_nonoverlapping;
 
+/// dox
+#[cfg(stage0)]
 #[stable(feature = "rust1", since = "1.0.0")]
+pub unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) {
+    intrinsics::copy_nonoverlapping(dst, src, count)
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+#[cfg(not(stage0))]
 pub use intrinsics::copy;
 
+/// dox
+#[cfg(stage0)]
+#[stable(feature = "rust1", since = "1.0.0")]
+pub unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
+    intrinsics::copy(dst, src, count)
+}
+
+
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use intrinsics::write_bytes;
 
@@ -167,12 +184,11 @@ pub unsafe fn zero_memory<T>(dst: *mut T, count: usize) {
 pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
     // Give ourselves some scratch space to work with
     let mut tmp: T = mem::uninitialized();
-    let t: *mut T = &mut tmp;
 
     // Perform the swap
-    copy_nonoverlapping(t, &*x, 1);
-    copy(x, &*y, 1); // `x` and `y` may overlap
-    copy_nonoverlapping(y, &*t, 1);
+    copy_nonoverlapping(x, &mut tmp, 1);
+    copy(y, x, 1); // `x` and `y` may overlap
+    copy_nonoverlapping(&tmp, y, 1);
 
     // y and t now point to the same thing, but we need to completely forget `tmp`
     // because it's no longer relevant.
@@ -208,7 +224,7 @@ pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub unsafe fn read<T>(src: *const T) -> T {
     let mut tmp: T = mem::uninitialized();
-    copy_nonoverlapping(&mut tmp, src, 1);
+    copy_nonoverlapping(src, &mut tmp, 1);
     tmp
 }
 
@@ -230,6 +246,21 @@ pub unsafe fn read_and_zero<T>(dest: *mut T) -> T {
     tmp
 }
 
+/// Variant of read_and_zero that writes the specific drop-flag byte
+/// (which may be more appropriate than zero).
+#[inline(always)]
+#[unstable(feature = "core",
+           reason = "may play a larger role in std::ptr future extensions")]
+pub unsafe fn read_and_drop<T>(dest: *mut T) -> T {
+    // Copy the data out from `dest`:
+    let tmp = read(&*dest);
+
+    // Now mark `dest` as dropped:
+    write_bytes(dest, mem::POST_DROP_U8, 1);
+
+    tmp
+}
+
 /// Overwrites a memory location with the given value without reading or
 /// dropping the old value.
 ///
index 62e1bcd827ae7ccbac2b0a2c20965d84aa0f94d8..eff04dd5903936f997ff147a76d39b530349cb63 100644 (file)
 //! that make working with it more succinct.
 //!
 //! ```
-//! let good_result: Result<int, int> = Ok(10);
-//! let bad_result: Result<int, int> = Err(10);
+//! let good_result: Result<i32, i32> = Ok(10);
+//! let bad_result: Result<i32, i32> = Err(10);
 //!
 //! // The `is_ok` and `is_err` methods do what they say.
 //! assert!(good_result.is_ok() && !good_result.is_err());
 //! assert!(bad_result.is_err() && !bad_result.is_ok());
 //!
 //! // `map` consumes the `Result` and produces another.
-//! let good_result: Result<int, int> = good_result.map(|i| i + 1);
-//! let bad_result: Result<int, int> = bad_result.map(|i| i - 1);
+//! let good_result: Result<i32, i32> = good_result.map(|i| i + 1);
+//! let bad_result: Result<i32, i32> = bad_result.map(|i| i - 1);
 //!
 //! // Use `and_then` to continue the computation.
-//! let good_result: Result<bool, int> = good_result.and_then(|i| Ok(i == 11));
+//! let good_result: Result<bool, i32> = good_result.and_then(|i| Ok(i == 11));
 //!
 //! // Use `or_else` to handle the error.
-//! let bad_result: Result<int, int> = bad_result.or_else(|i| Ok(11));
+//! let bad_result: Result<i32, i32> = bad_result.or_else(|i| Ok(11));
 //!
 //! // Consume the result and return the contents with `unwrap`.
 //! let final_awesome_result = good_result.unwrap();
@@ -92,7 +92,7 @@
 //! useful value.
 //!
 //! Consider the `write_line` method defined for I/O types
-//! by the [`Writer`](../io/trait.Writer.html) trait:
+//! by the [`Writer`](../old_io/trait.Writer.html) trait:
 //!
 //! ```
 //! # #![feature(old_io)]
 //!
 //! struct Info {
 //!     name: String,
-//!     age: int,
-//!     rating: int
+//!     age: i32,
+//!     rating: i32,
 //! }
 //!
 //! fn write_info(info: &Info) -> Result<(), IoError> {
 //!
 //! struct Info {
 //!     name: String,
-//!     age: int,
-//!     rating: int
+//!     age: i32,
+//!     rating: i32,
 //! }
 //!
 //! fn write_info(info: &Info) -> Result<(), IoError> {
 
 use clone::Clone;
 use fmt;
-use iter::{Iterator, IteratorExt, DoubleEndedIterator,
-           FromIterator, ExactSizeIterator, IntoIterator};
+use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSizeIterator, IntoIterator};
 use ops::{FnMut, FnOnce};
 use option::Option::{self, None, Some};
 #[allow(deprecated)]
@@ -282,10 +281,10 @@ impl<T, E> Result<T, E> {
     /// # Examples
     ///
     /// ```
-    /// let x: Result<int, &str> = Ok(-3);
+    /// let x: Result<i32, &str> = Ok(-3);
     /// assert_eq!(x.is_ok(), true);
     ///
-    /// let x: Result<int, &str> = Err("Some error message");
+    /// let x: Result<i32, &str> = Err("Some error message");
     /// assert_eq!(x.is_ok(), false);
     /// ```
     #[inline]
@@ -302,10 +301,10 @@ pub fn is_ok(&self) -> bool {
     /// # Examples
     ///
     /// ```
-    /// let x: Result<int, &str> = Ok(-3);
+    /// let x: Result<i32, &str> = Ok(-3);
     /// assert_eq!(x.is_err(), false);
     ///
-    /// let x: Result<int, &str> = Err("Some error message");
+    /// let x: Result<i32, &str> = Err("Some error message");
     /// assert_eq!(x.is_err(), true);
     /// ```
     #[inline]
@@ -392,18 +391,18 @@ pub fn as_ref(&self) -> Result<&T, &E> {
     /// Convert from `Result<T, E>` to `Result<&mut T, &mut E>`
     ///
     /// ```
-    /// fn mutate(r: &mut Result<int, int>) {
+    /// fn mutate(r: &mut Result<i32, i32>) {
     ///     match r.as_mut() {
     ///         Ok(&mut ref mut v) => *v = 42,
     ///         Err(&mut ref mut e) => *e = 0,
     ///     }
     /// }
     ///
-    /// let mut x: Result<int, int> = Ok(2);
+    /// let mut x: Result<i32, i32> = Ok(2);
     /// mutate(&mut x);
     /// assert_eq!(x.unwrap(), 42);
     ///
-    /// let mut x: Result<int, int> = Err(13);
+    /// let mut x: Result<i32, i32> = Err(13);
     /// mutate(&mut x);
     /// assert_eq!(x.unwrap_err(), 0);
     /// ```
@@ -486,8 +485,8 @@ pub fn as_mut_slice(&mut self) -> &mut [T] {
     /// while !buffer.is_empty() {
     ///     let line: IoResult<String> = buffer.read_line();
     ///     // Convert the string line to a number using `map` and `from_str`
-    ///     let val: IoResult<int> = line.map(|line| {
-    ///         line.trim_right().parse::<int>().unwrap_or(0)
+    ///     let val: IoResult<i32> = line.map(|line| {
+    ///         line.trim_right().parse::<i32>().unwrap_or(0)
     ///     });
     ///     // Add the value if there were no errors, otherwise add 0
     ///     sum += val.unwrap_or(0);
@@ -762,7 +761,7 @@ impl<T, E: fmt::Debug> Result<T, E> {
     /// assert_eq!(x.unwrap(), 2);
     /// ```
     ///
-    /// ```{.should_fail}
+    /// ```{.should_panic}
     /// let x: Result<u32, &str> = Err("emergency failure");
     /// x.unwrap(); // panics with `emergency failure`
     /// ```
@@ -788,7 +787,7 @@ impl<T: fmt::Debug, E> Result<T, E> {
     ///
     /// # Examples
     ///
-    /// ```{.should_fail}
+    /// ```{.should_panic}
     /// let x: Result<u32, &str> = Ok(2);
     /// x.unwrap_err(); // panics with `2`
     /// ```
index fce29abed7300c161c416be5f78b8f379cb92594..223a0bdae36cd8c3cebe763a4192e2950732c4e6 100644 (file)
@@ -88,6 +88,9 @@ fn binary_search_by<F>(&self, f: F) -> Result<usize, usize> where
     fn len(&self) -> usize;
     fn is_empty(&self) -> bool { self.len() == 0 }
     fn get_mut<'a>(&'a mut self, index: usize) -> Option<&'a mut Self::Item>;
+    #[unstable(feature = "core",
+               reason = "will be replaced by slice syntax")]
+    #[deprecated(since = "1.0.0", reason = "use &mut s[..] instead")]
     fn as_mut_slice<'a>(&'a mut self) -> &'a mut [Self::Item];
     fn iter_mut<'a>(&'a mut self) -> IterMut<'a, Self::Item>;
     fn first_mut<'a>(&'a mut self) -> Option<&'a mut Self::Item>;
@@ -261,20 +264,11 @@ fn get_mut(&mut self, index: usize) -> Option<&mut T> {
     }
 
     #[inline]
+    #[unstable(feature = "core",
+               reason = "will be replaced by slice syntax")]
+    #[deprecated(since = "1.0.0", reason = "use &mut s[..] instead")]
     fn as_mut_slice(&mut self) -> &mut [T] { self }
 
-    #[cfg(stage0)]
-    #[inline]
-    fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) {
-        unsafe {
-            let self2: &mut [T] = mem::transmute_copy(&self);
-
-            (ops::IndexMut::index_mut(self, &ops::RangeTo { end: mid } ),
-             ops::IndexMut::index_mut(self2, &ops::RangeFrom { start: mid } ))
-        }
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) {
         unsafe {
@@ -507,14 +501,6 @@ fn clone_from_slice(&mut self, src: &[T]) -> usize where T: Clone {
 impl<T> ops::Index<usize> for [T] {
     type Output = T;
 
-    #[cfg(stage0)]
-    fn index(&self, &index: &usize) -> &T {
-        assert!(index < self.len());
-
-        unsafe { mem::transmute(self.repr().data.offset(index as isize)) }
-    }
-
-    #[cfg(not(stage0))]
     fn index(&self, index: usize) -> &T {
         assert!(index < self.len());
 
@@ -524,15 +510,6 @@ fn index(&self, index: usize) -> &T {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<usize> for [T] {
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, &index: &usize) -> &mut T {
-        assert!(index < self.len());
-
-        unsafe { mem::transmute(self.repr().data.offset(index as isize)) }
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, index: usize) -> &mut T {
         assert!(index < self.len());
@@ -545,20 +522,6 @@ fn index_mut(&mut self, index: usize) -> &mut T {
 impl<T> ops::Index<ops::Range<usize>> for [T] {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::Range<usize>) -> &[T] {
-        assert!(index.start <= index.end);
-        assert!(index.end <= self.len());
-        unsafe {
-            from_raw_parts (
-                self.as_ptr().offset(index.start as isize),
-                index.end - index.start
-            )
-        }
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::Range<usize>) -> &[T] {
         assert!(index.start <= index.end);
@@ -575,13 +538,6 @@ fn index(&self, index: ops::Range<usize>) -> &[T] {
 impl<T> ops::Index<ops::RangeTo<usize>> for [T] {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::RangeTo<usize>) -> &[T] {
-        self.index(&ops::Range{ start: 0, end: index.end })
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
         self.index(ops::Range{ start: 0, end: index.end })
@@ -591,13 +547,6 @@ fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
 impl<T> ops::Index<ops::RangeFrom<usize>> for [T] {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::RangeFrom<usize>) -> &[T] {
-        self.index(&ops::Range{ start: index.start, end: self.len() })
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
         self.index(ops::Range{ start: index.start, end: self.len() })
@@ -607,13 +556,6 @@ fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
 impl<T> ops::Index<RangeFull> for [T] {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, _index: &RangeFull) -> &[T] {
-        self
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, _index: RangeFull) -> &[T] {
         self
@@ -622,20 +564,6 @@ fn index(&self, _index: RangeFull) -> &[T] {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<ops::Range<usize>> for [T] {
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, index: &ops::Range<usize>) -> &mut [T] {
-        assert!(index.start <= index.end);
-        assert!(index.end <= self.len());
-        unsafe {
-            from_raw_parts_mut(
-                self.as_mut_ptr().offset(index.start as isize),
-                index.end - index.start
-            )
-        }
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
         assert!(index.start <= index.end);
@@ -650,13 +578,6 @@ fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<ops::RangeTo<usize>> for [T] {
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, index: &ops::RangeTo<usize>) -> &mut [T] {
-        self.index_mut(&ops::Range{ start: 0, end: index.end })
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
         self.index_mut(ops::Range{ start: 0, end: index.end })
@@ -664,14 +585,6 @@ fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<ops::RangeFrom<usize>> for [T] {
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, index: &ops::RangeFrom<usize>) -> &mut [T] {
-        let len = self.len();
-        self.index_mut(&ops::Range{ start: index.start, end: len })
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
         let len = self.len();
@@ -680,14 +593,6 @@ fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<RangeFull> for [T] {
-
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, _index: &RangeFull) -> &mut [T] {
-        self
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, _index: RangeFull) -> &mut [T] {
         self
@@ -875,13 +780,6 @@ unsafe impl<'a, T: Sync> Send for Iter<'a, T> {}
 impl<'a, T> ops::Index<ops::Range<usize>> for Iter<'a, T> {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::Range<usize>) -> &[T] {
-        self.as_slice().index(index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::Range<usize>) -> &[T] {
         self.as_slice().index(index)
@@ -892,13 +790,6 @@ fn index(&self, index: ops::Range<usize>) -> &[T] {
 impl<'a, T> ops::Index<ops::RangeTo<usize>> for Iter<'a, T> {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::RangeTo<usize>) -> &[T] {
-        self.as_slice().index(index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
         self.as_slice().index(index)
@@ -909,13 +800,6 @@ fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
 impl<'a, T> ops::Index<ops::RangeFrom<usize>> for Iter<'a, T> {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::RangeFrom<usize>) -> &[T] {
-        self.as_slice().index(index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
         self.as_slice().index(index)
@@ -926,13 +810,6 @@ fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
 impl<'a, T> ops::Index<RangeFull> for Iter<'a, T> {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, _index: &RangeFull) -> &[T] {
-        self.as_slice()
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, _index: RangeFull) -> &[T] {
         self.as_slice()
@@ -1000,13 +877,6 @@ unsafe impl<'a, T: Send> Send for IterMut<'a, T> {}
 impl<'a, T> ops::Index<ops::Range<usize>> for IterMut<'a, T> {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::Range<usize>) -> &[T] {
-        self.index(&RangeFull).index(index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::Range<usize>) -> &[T] {
         self.index(RangeFull).index(index)
@@ -1016,13 +886,6 @@ fn index(&self, index: ops::Range<usize>) -> &[T] {
 impl<'a, T> ops::Index<ops::RangeTo<usize>> for IterMut<'a, T> {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::RangeTo<usize>) -> &[T] {
-        self.index(&RangeFull).index(index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
         self.index(RangeFull).index(index)
@@ -1032,13 +895,6 @@ fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
 impl<'a, T> ops::Index<ops::RangeFrom<usize>> for IterMut<'a, T> {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, index: &ops::RangeFrom<usize>) -> &[T] {
-        self.index(&RangeFull).index(index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
         self.index(RangeFull).index(index)
@@ -1048,13 +904,6 @@ fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
 impl<'a, T> ops::Index<RangeFull> for IterMut<'a, T> {
     type Output = [T];
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index(&self, _index: &RangeFull) -> &[T] {
-        make_slice!(T => &[T]: self.ptr, self.end)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index(&self, _index: RangeFull) -> &[T] {
         make_slice!(T => &[T]: self.ptr, self.end)
@@ -1063,13 +912,6 @@ fn index(&self, _index: RangeFull) -> &[T] {
 
 #[unstable(feature = "core")]
 impl<'a, T> ops::IndexMut<ops::Range<usize>> for IterMut<'a, T> {
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, index: &ops::Range<usize>) -> &mut [T] {
-        self.index_mut(&RangeFull).index_mut(index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
         self.index_mut(RangeFull).index_mut(index)
@@ -1078,13 +920,6 @@ fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
 #[unstable(feature = "core")]
 impl<'a, T> ops::IndexMut<ops::RangeTo<usize>> for IterMut<'a, T> {
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, index: &ops::RangeTo<usize>) -> &mut [T] {
-        self.index_mut(&RangeFull).index_mut(index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
         self.index_mut(RangeFull).index_mut(index)
@@ -1093,13 +928,6 @@ fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
 #[unstable(feature = "core")]
 impl<'a, T> ops::IndexMut<ops::RangeFrom<usize>> for IterMut<'a, T> {
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, index: &ops::RangeFrom<usize>) -> &mut [T] {
-        self.index_mut(&RangeFull).index_mut(index)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
         self.index_mut(RangeFull).index_mut(index)
@@ -1108,13 +936,6 @@ fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
 #[unstable(feature = "core")]
 impl<'a, T> ops::IndexMut<RangeFull> for IterMut<'a, T> {
 
-    #[cfg(stage0)]
-    #[inline]
-    fn index_mut(&mut self, _index: &RangeFull) -> &mut [T] {
-        make_mut_slice!(T => &mut [T]: self.ptr, self.end)
-    }
-
-    #[cfg(not(stage0))]
     #[inline]
     fn index_mut(&mut self, _index: RangeFull) -> &mut [T] {
         make_mut_slice!(T => &mut [T]: self.ptr, self.end)
@@ -1756,14 +1577,14 @@ fn set_memory(&mut self, value: u8) {
     ///
     /// Panics if the length of `dst` is less than the length of `src`.
     #[inline]
-    pub fn copy_memory(dst: &mut [u8], src: &[u8]) {
+    pub fn copy_memory(src: &[u8], dst: &mut [u8]) {
         let len_src = src.len();
         assert!(dst.len() >= len_src);
         // `dst` is unaliasable, so we know statically it doesn't overlap
         // with `src`.
         unsafe {
-            ptr::copy_nonoverlapping(dst.as_mut_ptr(),
-                                     src.as_ptr(),
+            ptr::copy_nonoverlapping(src.as_ptr(),
+                                     dst.as_mut_ptr(),
                                      len_src);
         }
     }
index a629e0308e98299611940545977f165618499ac2..f9e2b47d9b63428ab8bb4c87a610ebb548ebc31d 100644 (file)
@@ -25,7 +25,7 @@
 use error::Error;
 use fmt;
 use iter::ExactSizeIterator;
-use iter::{Map, Iterator, IteratorExt, DoubleEndedIterator};
+use iter::{Map, Iterator, DoubleEndedIterator};
 use marker::Sized;
 use mem;
 #[allow(deprecated)]
@@ -541,17 +541,6 @@ fn next_back(&mut self) -> Option<(usize, char)> {
 #[derive(Copy, Clone)]
 struct BytesDeref;
 
-#[cfg(stage0)]
-impl<'a> Fn<(&'a u8,)> for BytesDeref {
-    type Output = u8;
-
-    #[inline]
-    extern "rust-call" fn call(&self, (ptr,): (&'a u8,)) -> u8 {
-        *ptr
-    }
-}
-
-#[cfg(not(stage0))]
 impl<'a> Fn<(&'a u8,)> for BytesDeref {
     #[inline]
     extern "rust-call" fn call(&self, (ptr,): (&'a u8,)) -> u8 {
@@ -559,7 +548,6 @@ extern "rust-call" fn call(&self, (ptr,): (&'a u8,)) -> u8 {
     }
 }
 
-#[cfg(not(stage0))]
 impl<'a> FnMut<(&'a u8,)> for BytesDeref {
     #[inline]
     extern "rust-call" fn call_mut(&mut self, (ptr,): (&'a u8,)) -> u8 {
@@ -567,7 +555,6 @@ extern "rust-call" fn call_mut(&mut self, (ptr,): (&'a u8,)) -> u8 {
     }
 }
 
-#[cfg(not(stage0))]
 impl<'a> FnOnce<(&'a u8,)> for BytesDeref {
     type Output = u8;
 
@@ -958,9 +945,9 @@ fn next(&mut self, haystack: &[u8], needle: &[u8], long_period: bool)
     // critical factorization (u, v) and p = period(v)
     #[inline]
     #[allow(dead_code)]
+    #[allow(deprecated)]
     fn maximal_suffix(arr: &[u8], reversed: bool) -> (usize, usize) {
-        use num::wrapping::WrappingOps;
-        let mut left = -1; // Corresponds to i in the paper
+        let mut left: usize = -1; // Corresponds to i in the paper
         let mut right = 0; // Corresponds to j in the paper
         let mut offset = 1; // Corresponds to k in the paper
         let mut period = 1; // Corresponds to p in the paper
@@ -1250,7 +1237,7 @@ pub struct CharRange {
 mod traits {
     use cmp::{Ordering, Ord, PartialEq, PartialOrd, Eq};
     use cmp::Ordering::{Less, Equal, Greater};
-    use iter::IteratorExt;
+    use iter::Iterator;
     use option::Option;
     use option::Option::Some;
     use ops;
@@ -1319,50 +1306,6 @@ fn partial_cmp(&self, other: &str) -> Option<Ordering> {
     /// // byte 100 is outside the string
     /// // &s[3 .. 100];
     /// ```
-    #[cfg(stage0)]
-    #[stable(feature = "rust1", since = "1.0.0")]
-    impl ops::Index<ops::Range<usize>> for str {
-        type Output = str;
-        #[inline]
-        fn index(&self, index: &ops::Range<usize>) -> &str {
-            // is_char_boundary checks that the index is in [0, .len()]
-            if index.start <= index.end &&
-               self.is_char_boundary(index.start) &&
-               self.is_char_boundary(index.end) {
-                unsafe { self.slice_unchecked(index.start, index.end) }
-            } else {
-                super::slice_error_fail(self, index.start, index.end)
-            }
-        }
-    }
-
-    /// Returns a slice of the given string from the byte range
-    /// [`begin`..`end`).
-    ///
-    /// This operation is `O(1)`.
-    ///
-    /// Panics when `begin` and `end` do not point to valid characters
-    /// or point beyond the last character of the string.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// let s = "Löwe 老虎 Léopard";
-    /// assert_eq!(&s[0 .. 1], "L");
-    ///
-    /// assert_eq!(&s[1 .. 9], "öwe 老");
-    ///
-    /// // these will panic:
-    /// // byte 2 lies within `ö`:
-    /// // &s[2 ..3];
-    ///
-    /// // byte 8 lies within `老`
-    /// // &s[1 .. 8];
-    ///
-    /// // byte 100 is outside the string
-    /// // &s[3 .. 100];
-    /// ```
-    #[cfg(not(stage0))]
     #[stable(feature = "rust1", since = "1.0.0")]
     impl ops::Index<ops::Range<usize>> for str {
         type Output = str;
@@ -1390,18 +1333,6 @@ fn index(&self, index: ops::Range<usize>) -> &str {
     impl ops::Index<ops::RangeTo<usize>> for str {
         type Output = str;
 
-        #[cfg(stage0)]
-        #[inline]
-        fn index(&self, index: &ops::RangeTo<usize>) -> &str {
-            // is_char_boundary checks that the index is in [0, .len()]
-            if self.is_char_boundary(index.end) {
-                unsafe { self.slice_unchecked(0, index.end) }
-            } else {
-                super::slice_error_fail(self, 0, index.end)
-            }
-        }
-
-        #[cfg(not(stage0))]
         #[inline]
         fn index(&self, index: ops::RangeTo<usize>) -> &str {
             // is_char_boundary checks that the index is in [0, .len()]
@@ -1423,18 +1354,6 @@ fn index(&self, index: ops::RangeTo<usize>) -> &str {
     impl ops::Index<ops::RangeFrom<usize>> for str {
         type Output = str;
 
-        #[cfg(stage0)]
-        #[inline]
-        fn index(&self, index: &ops::RangeFrom<usize>) -> &str {
-            // is_char_boundary checks that the index is in [0, .len()]
-            if self.is_char_boundary(index.start) {
-                unsafe { self.slice_unchecked(index.start, self.len()) }
-            } else {
-                super::slice_error_fail(self, index.start, self.len())
-            }
-        }
-
-        #[cfg(not(stage0))]
         #[inline]
         fn index(&self, index: ops::RangeFrom<usize>) -> &str {
             // is_char_boundary checks that the index is in [0, .len()]
@@ -1450,13 +1369,6 @@ fn index(&self, index: ops::RangeFrom<usize>) -> &str {
     impl ops::Index<ops::RangeFull> for str {
         type Output = str;
 
-        #[cfg(stage0)]
-        #[inline]
-        fn index(&self, _index: &ops::RangeFull) -> &str {
-            self
-        }
-
-        #[cfg(not(stage0))]
         #[inline]
         fn index(&self, _index: ops::RangeFull) -> &str {
             self
@@ -1704,7 +1616,7 @@ fn slice_chars(&self, begin: usize, end: usize) -> &str {
     #[inline]
     unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str {
         mem::transmute(Slice {
-            data: self.as_ptr().offset(begin as int),
+            data: self.as_ptr().offset(begin as isize),
             len: end - begin,
         })
     }
index 39f5d237a2b7364501ab7a52bbccc5ca2b8df2c4..eeaaa3e217e8f1c80bbb0aca874f3f688c3c42ce 100644 (file)
@@ -37,9 +37,9 @@ fn any_referenced() {
 fn any_owning() {
     let (a, b, c) = (box 5_usize as Box<Any>, box TEST as Box<Any>, box Test as Box<Any>);
 
-    assert!(a.is::<uint>());
-    assert!(!b.is::<uint>());
-    assert!(!c.is::<uint>());
+    assert!(a.is::<usize>());
+    assert!(!b.is::<usize>());
+    assert!(!c.is::<usize>());
 
     assert!(!a.is::<&'static str>());
     assert!(b.is::<&'static str>());
@@ -54,7 +54,7 @@ fn any_owning() {
 fn any_downcast_ref() {
     let a = &5_usize as &Any;
 
-    match a.downcast_ref::<uint>() {
+    match a.downcast_ref::<usize>() {
         Some(&5) => {}
         x => panic!("Unexpected value {:?}", x)
     }
@@ -71,10 +71,10 @@ fn any_downcast_mut() {
     let mut b: Box<_> = box 7_usize;
 
     let a_r = &mut a as &mut Any;
-    let tmp: &mut uint = &mut *b;
+    let tmp: &mut usize = &mut *b;
     let b_r = tmp as &mut Any;
 
-    match a_r.downcast_mut::<uint>() {
+    match a_r.downcast_mut::<usize>() {
         Some(x) => {
             assert_eq!(*x, 5);
             *x = 612;
@@ -82,7 +82,7 @@ fn any_downcast_mut() {
         x => panic!("Unexpected value {:?}", x)
     }
 
-    match b_r.downcast_mut::<uint>() {
+    match b_r.downcast_mut::<usize>() {
         Some(x) => {
             assert_eq!(*x, 7);
             *x = 413;
@@ -100,12 +100,12 @@ fn any_downcast_mut() {
         x => panic!("Unexpected value {:?}", x)
     }
 
-    match a_r.downcast_mut::<uint>() {
+    match a_r.downcast_mut::<usize>() {
         Some(&mut 612) => {}
         x => panic!("Unexpected value {:?}", x)
     }
 
-    match b_r.downcast_mut::<uint>() {
+    match b_r.downcast_mut::<usize>() {
         Some(&mut 413) => {}
         x => panic!("Unexpected value {:?}", x)
     }
@@ -115,8 +115,8 @@ fn any_downcast_mut() {
 fn any_fixed_vec() {
     let test = [0_usize; 8];
     let test = &test as &Any;
-    assert!(test.is::<[uint; 8]>());
-    assert!(!test.is::<[uint; 10]>());
+    assert!(test.is::<[usize; 8]>());
+    assert!(!test.is::<[usize; 10]>());
 }
 
 
@@ -126,6 +126,6 @@ fn bench_downcast_ref(b: &mut Bencher) {
         let mut x = 0;
         let mut y = &mut x as &mut Any;
         test::black_box(&mut y);
-        test::black_box(y.downcast_ref::<int>() == Some(&0));
+        test::black_box(y.downcast_ref::<isize>() == Some(&0));
     });
 }
index 3397cbb18faa09c38284194e5149a95cb7141047..fff3cc14eadfd45fb4127f3ea800c7a4ad39fae6 100644 (file)
@@ -134,19 +134,19 @@ fn clone_ref_updates_flag() {
 
 #[test]
 fn as_unsafe_cell() {
-    let c1: Cell<uint> = Cell::new(0);
+    let c1: Cell<usize> = Cell::new(0);
     c1.set(1);
     assert_eq!(1, unsafe { *c1.as_unsafe_cell().get() });
 
-    let c2: Cell<uint> = Cell::new(0);
+    let c2: Cell<usize> = Cell::new(0);
     unsafe { *c2.as_unsafe_cell().get() = 1; }
     assert_eq!(1, c2.get());
 
-    let r1: RefCell<uint> = RefCell::new(0);
+    let r1: RefCell<usize> = RefCell::new(0);
     *r1.borrow_mut() = 1;
     assert_eq!(1, unsafe { *r1.as_unsafe_cell().get() });
 
-    let r2: RefCell<uint> = RefCell::new(0);
+    let r2: RefCell<usize> = RefCell::new(0);
     unsafe { *r2.as_unsafe_cell().get() = 1; }
     assert_eq!(1, *r2.borrow());
 }
index 2e5c6fe5a2ff7bec0f1f4a3694a85a22957ee061..9ed1508c3eb7877c23b0831682569562ddea5a5f 100644 (file)
@@ -114,7 +114,7 @@ fn test_user_defined_eq() {
 
     // Our type.
     struct SketchyNum {
-        num : int
+        num : isize
     }
 
     // Our implementation of `PartialEq` to support `==` and `!=`.
index b2fbc90be591423ce50d5406fbf5f72e7f931914..885ee3f9c3be2e19ba39c658719e0a899b578f2b 100644 (file)
@@ -211,12 +211,12 @@ fn test_empty() {
 
         impl fmt::Debug for Foo {
             fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-                fmt.debug_map("Foo").finish()
+                fmt.debug_map().finish()
             }
         }
 
-        assert_eq!("Foo {}", format!("{:?}", Foo));
-        assert_eq!("Foo {}", format!("{:#?}", Foo));
+        assert_eq!("{}", format!("{:?}", Foo));
+        assert_eq!("{}", format!("{:#?}", Foo));
     }
 
     #[test]
@@ -225,15 +225,15 @@ fn test_single() {
 
         impl fmt::Debug for Foo {
             fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-                fmt.debug_map("Foo")
+                fmt.debug_map()
                     .entry(&"bar", &true)
                     .finish()
             }
         }
 
-        assert_eq!("Foo { \"bar\": true }", format!("{:?}", Foo));
+        assert_eq!("{\"bar\": true}", format!("{:?}", Foo));
         assert_eq!(
-"Foo {
+"{
     \"bar\": true
 }",
                    format!("{:#?}", Foo));
@@ -245,16 +245,16 @@ fn test_multiple() {
 
         impl fmt::Debug for Foo {
             fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-                fmt.debug_map("Foo")
+                fmt.debug_map()
                     .entry(&"bar", &true)
                     .entry(&10i32, &format_args!("{}/{}", 10i32, 20i32))
                     .finish()
             }
         }
 
-        assert_eq!("Foo { \"bar\": true, 10: 10/20 }", format!("{:?}", Foo));
+        assert_eq!("{\"bar\": true, 10: 10/20}", format!("{:?}", Foo));
         assert_eq!(
-"Foo {
+"{
     \"bar\": true,
     10: 10/20
 }",
@@ -267,7 +267,7 @@ fn test_nested() {
 
         impl fmt::Debug for Foo {
             fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-                fmt.debug_map("Foo")
+                fmt.debug_map()
                     .entry(&"bar", &true)
                     .entry(&10i32, &format_args!("{}/{}", 10i32, 20i32))
                     .finish()
@@ -278,23 +278,23 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
 
         impl fmt::Debug for Bar {
             fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-                fmt.debug_map("Bar")
+                fmt.debug_map()
                     .entry(&"foo", &Foo)
                     .entry(&Foo, &"world")
                     .finish()
             }
         }
 
-        assert_eq!("Bar { \"foo\": Foo { \"bar\": true, 10: 10/20 }, \
-                    Foo { \"bar\": true, 10: 10/20 }: \"world\" }",
+        assert_eq!("{\"foo\": {\"bar\": true, 10: 10/20}, \
+                    {\"bar\": true, 10: 10/20}: \"world\"}",
                    format!("{:?}", Bar));
         assert_eq!(
-"Bar {
-    \"foo\": Foo {
+"{
+    \"foo\": {
         \"bar\": true,
         10: 10/20
     },
-    Foo {
+    {
         \"bar\": true,
         10: 10/20
     }: \"world\"
@@ -312,12 +312,12 @@ fn test_empty() {
 
         impl fmt::Debug for Foo {
             fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-                fmt.debug_set("Foo").finish()
+                fmt.debug_set().finish()
             }
         }
 
-        assert_eq!("Foo {}", format!("{:?}", Foo));
-        assert_eq!("Foo {}", format!("{:#?}", Foo));
+        assert_eq!("{}", format!("{:?}", Foo));
+        assert_eq!("{}", format!("{:#?}", Foo));
     }
 
     #[test]
@@ -326,15 +326,15 @@ fn test_single() {
 
         impl fmt::Debug for Foo {
             fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-                fmt.debug_set("Foo")
+                fmt.debug_set()
                     .entry(&true)
                     .finish()
             }
         }
 
-        assert_eq!("Foo { true }", format!("{:?}", Foo));
+        assert_eq!("{true}", format!("{:?}", Foo));
         assert_eq!(
-"Foo {
+"{
     true
 }",
                    format!("{:#?}", Foo));
@@ -346,16 +346,16 @@ fn test_multiple() {
 
         impl fmt::Debug for Foo {
             fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-                fmt.debug_set("Foo")
+                fmt.debug_set()
                     .entry(&true)
                     .entry(&format_args!("{}/{}", 10i32, 20i32))
                     .finish()
             }
         }
 
-        assert_eq!("Foo { true, 10/20 }", format!("{:?}", Foo));
+        assert_eq!("{true, 10/20}", format!("{:?}", Foo));
         assert_eq!(
-"Foo {
+"{
     true,
     10/20
 }",
@@ -368,7 +368,7 @@ fn test_nested() {
 
         impl fmt::Debug for Foo {
             fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-                fmt.debug_set("Foo")
+                fmt.debug_set()
                     .entry(&true)
                     .entry(&format_args!("{}/{}", 10i32, 20i32))
                     .finish()
@@ -379,18 +379,18 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
 
         impl fmt::Debug for Bar {
             fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-                fmt.debug_set("Bar")
+                fmt.debug_set()
                     .entry(&Foo)
                     .entry(&"world")
                     .finish()
             }
         }
 
-        assert_eq!("Bar { Foo { true, 10/20 }, \"world\" }",
+        assert_eq!("{{true, 10/20}, \"world\"}",
                    format!("{:?}", Bar));
         assert_eq!(
-"Bar {
-    Foo {
+"{
+    {
         true,
         10/20
     },
@@ -399,3 +399,100 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
                    format!("{:#?}", Bar));
     }
 }
+
+mod debug_list {
+    use std::fmt;
+
+    #[test]
+    fn test_empty() {
+        struct Foo;
+
+        impl fmt::Debug for Foo {
+            fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+                fmt.debug_list().finish()
+            }
+        }
+
+        assert_eq!("[]", format!("{:?}", Foo));
+        assert_eq!("[]", format!("{:#?}", Foo));
+    }
+
+    #[test]
+    fn test_single() {
+        struct Foo;
+
+        impl fmt::Debug for Foo {
+            fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+                fmt.debug_list()
+                    .entry(&true)
+                    .finish()
+            }
+        }
+
+        assert_eq!("[true]", format!("{:?}", Foo));
+        assert_eq!(
+"[
+    true
+]",
+                   format!("{:#?}", Foo));
+    }
+
+    #[test]
+    fn test_multiple() {
+        struct Foo;
+
+        impl fmt::Debug for Foo {
+            fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+                fmt.debug_list()
+                    .entry(&true)
+                    .entry(&format_args!("{}/{}", 10i32, 20i32))
+                    .finish()
+            }
+        }
+
+        assert_eq!("[true, 10/20]", format!("{:?}", Foo));
+        assert_eq!(
+"[
+    true,
+    10/20
+]",
+                   format!("{:#?}", Foo));
+    }
+
+    #[test]
+    fn test_nested() {
+        struct Foo;
+
+        impl fmt::Debug for Foo {
+            fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+                fmt.debug_list()
+                    .entry(&true)
+                    .entry(&format_args!("{}/{}", 10i32, 20i32))
+                    .finish()
+            }
+        }
+
+        struct Bar;
+
+        impl fmt::Debug for Bar {
+            fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+                fmt.debug_list()
+                    .entry(&Foo)
+                    .entry(&"world")
+                    .finish()
+            }
+        }
+
+        assert_eq!("[[true, 10/20], \"world\"]",
+                   format!("{:?}", Bar));
+        assert_eq!(
+"[
+    [
+        true,
+        10/20
+    ],
+    \"world\"
+]",
+                   format!("{:#?}", Bar));
+    }
+}
index 52cc2519addaaeb13f4465d3ff2f2fbc4c9d8fb4..15938a5dcb4770bdac1d5b59c2856db5dc580ff5 100644 (file)
@@ -19,7 +19,7 @@
 
 #[test]
 fn test_lt() {
-    let empty: [int; 0] = [];
+    let empty: [isize; 0] = [];
     let xs = [1,2,3];
     let ys = [1,2,0];
 
@@ -73,7 +73,7 @@ fn test_multi_iter() {
 #[test]
 fn test_counter_from_iter() {
     let it = count(0, 5).take(10);
-    let xs: Vec<int> = FromIterator::from_iter(it);
+    let xs: Vec<isize> = FromIterator::from_iter(it);
     assert_eq!(xs, [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]);
 }
 
@@ -104,7 +104,7 @@ fn test_iterator_chain() {
 fn test_filter_map() {
     let it = count(0, 1).take(10)
         .filter_map(|x| if x % 2 == 0 { Some(x*x) } else { None });
-    assert_eq!(it.collect::<Vec<uint>>(), [0*0, 2*2, 4*4, 6*6, 8*8]);
+    assert_eq!(it.collect::<Vec<usize>>(), [0*0, 2*2, 4*4, 6*6, 8*8]);
 }
 
 #[test]
@@ -224,8 +224,8 @@ fn test_iterator_take_short() {
 #[test]
 fn test_iterator_scan() {
     // test the type inference
-    fn add(old: &mut int, new: &uint) -> Option<f64> {
-        *old += *new as int;
+    fn add(old: &mut isize, new: &usize) -> Option<f64> {
+        *old += *new as isize;
         Some(*old as f64)
     }
     let xs = [0, 1, 2, 3, 4];
@@ -261,7 +261,7 @@ fn test_inspect() {
     let ys = xs.iter()
                .cloned()
                .inspect(|_| n += 1)
-               .collect::<Vec<uint>>();
+               .collect::<Vec<usize>>();
 
     assert_eq!(n, xs.len());
     assert_eq!(&xs[..], &ys[..]);
@@ -269,7 +269,7 @@ fn test_inspect() {
 
 #[test]
 fn test_unfoldr() {
-    fn count(st: &mut uint) -> Option<uint> {
+    fn count(st: &mut usize) -> Option<usize> {
         if *st < 10 {
             let ret = Some(*st);
             *st += 1;
@@ -398,14 +398,14 @@ fn test_iterator_size_hint() {
 #[test]
 fn test_collect() {
     let a = vec![1, 2, 3, 4, 5];
-    let b: Vec<int> = a.iter().cloned().collect();
+    let b: Vec<isize> = a.iter().cloned().collect();
     assert!(a == b);
 }
 
 #[test]
 fn test_all() {
     // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-    let v: Box<[int]> = Box::new([1, 2, 3, 4, 5]);
+    let v: Box<[isize]> = Box::new([1, 2, 3, 4, 5]);
     assert!(v.iter().all(|&x| x < 10));
     assert!(!v.iter().all(|&x| x % 2 == 0));
     assert!(!v.iter().all(|&x| x > 100));
@@ -415,7 +415,7 @@ fn test_all() {
 #[test]
 fn test_any() {
     // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-    let v: Box<[int]> = Box::new([1, 2, 3, 4, 5]);
+    let v: Box<[isize]> = Box::new([1, 2, 3, 4, 5]);
     assert!(v.iter().any(|&x| x < 10));
     assert!(v.iter().any(|&x| x % 2 == 0));
     assert!(!v.iter().any(|&x| x > 100));
@@ -424,7 +424,7 @@ fn test_any() {
 
 #[test]
 fn test_find() {
-    let v: &[int] = &[1, 3, 9, 27, 103, 14, 11];
+    let v: &[isize] = &[1, 3, 9, 27, 103, 14, 11];
     assert_eq!(*v.iter().find(|&&x| x & 1 == 0).unwrap(), 14);
     assert_eq!(*v.iter().find(|&&x| x % 3 == 0).unwrap(), 3);
     assert!(v.iter().find(|&&x| x % 12 == 0).is_none());
@@ -448,13 +448,13 @@ fn test_count() {
 
 #[test]
 fn test_max_by() {
-    let xs: &[int] = &[-3, 0, 1, 5, -10];
+    let xs: &[isize] = &[-3, 0, 1, 5, -10];
     assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10);
 }
 
 #[test]
 fn test_min_by() {
-    let xs: &[int] = &[-3, 0, 1, 5, -10];
+    let xs: &[isize] = &[-3, 0, 1, 5, -10];
     assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0);
 }
 
@@ -473,7 +473,7 @@ fn test_rev() {
     let mut it = xs.iter();
     it.next();
     it.next();
-    assert!(it.rev().cloned().collect::<Vec<int>>() ==
+    assert!(it.rev().cloned().collect::<Vec<isize>>() ==
             vec![16, 14, 12, 10, 8, 6]);
 }
 
@@ -572,8 +572,8 @@ fn test_double_ended_chain() {
 
 #[test]
 fn test_rposition() {
-    fn f(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'b' }
-    fn g(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'd' }
+    fn f(xy: &(isize, char)) -> bool { let (_x, y) = *xy; y == 'b' }
+    fn g(xy: &(isize, char)) -> bool { let (_x, y) = *xy; y == 'd' }
     let v = [(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')];
 
     assert_eq!(v.iter().rposition(f), Some(3));
@@ -598,7 +598,7 @@ fn test_rposition_panic() {
 
 
 #[cfg(test)]
-fn check_randacc_iter<A, T>(a: T, len: uint) where
+fn check_randacc_iter<A, T>(a: T, len: usize) where
     A: PartialEq,
     T: Clone + RandomAccessIterator + Iterator<Item=A>,
 {
@@ -684,7 +684,7 @@ fn test_random_access_zip() {
 #[test]
 fn test_random_access_take() {
     let xs = [1, 2, 3, 4, 5];
-    let empty: &[int] = &[];
+    let empty: &[isize] = &[];
     check_randacc_iter(xs.iter().take(3), 3);
     check_randacc_iter(xs.iter().take(20), xs.len());
     check_randacc_iter(xs.iter().take(0), 0);
@@ -694,7 +694,7 @@ fn test_random_access_take() {
 #[test]
 fn test_random_access_skip() {
     let xs = [1, 2, 3, 4, 5];
-    let empty: &[int] = &[];
+    let empty: &[isize] = &[];
     check_randacc_iter(xs.iter().skip(2), xs.len() - 2);
     check_randacc_iter(empty.iter().skip(2), 0);
 }
@@ -726,7 +726,7 @@ fn test_random_access_map() {
 #[test]
 fn test_random_access_cycle() {
     let xs = [1, 2, 3, 4, 5];
-    let empty: &[int] = &[];
+    let empty: &[isize] = &[];
     check_randacc_iter(xs.iter().cycle().take(27), 27);
     check_randacc_iter(empty.iter().cycle(), 0);
 }
@@ -755,7 +755,7 @@ fn test_range() {
     assert_eq!((200..200).rev().count(), 0);
 
     assert_eq!((0..100).size_hint(), (100, Some(100)));
-    // this test is only meaningful when sizeof uint < sizeof u64
+    // this test is only meaningful when sizeof usize < sizeof u64
     assert_eq!((usize::MAX - 1..usize::MAX).size_hint(), (1, Some(1)));
     assert_eq!((-10..-1).size_hint(), (9, Some(9)));
     assert_eq!((-1..-10).size_hint(), (0, Some(0)));
@@ -763,34 +763,34 @@ fn test_range() {
 
 #[test]
 fn test_range_inclusive() {
-    assert!(range_inclusive(0, 5).collect::<Vec<int>>() ==
+    assert!(range_inclusive(0, 5).collect::<Vec<isize>>() ==
             vec![0, 1, 2, 3, 4, 5]);
-    assert!(range_inclusive(0, 5).rev().collect::<Vec<int>>() ==
+    assert!(range_inclusive(0, 5).rev().collect::<Vec<isize>>() ==
             vec![5, 4, 3, 2, 1, 0]);
     assert_eq!(range_inclusive(200, -5).count(), 0);
     assert_eq!(range_inclusive(200, -5).rev().count(), 0);
-    assert_eq!(range_inclusive(200, 200).collect::<Vec<int>>(), [200]);
-    assert_eq!(range_inclusive(200, 200).rev().collect::<Vec<int>>(), [200]);
+    assert_eq!(range_inclusive(200, 200).collect::<Vec<isize>>(), [200]);
+    assert_eq!(range_inclusive(200, 200).rev().collect::<Vec<isize>>(), [200]);
 }
 
 #[test]
 fn test_range_step() {
-    assert_eq!((0..20).step_by(5).collect::<Vec<int>>(), [0, 5, 10, 15]);
-    assert_eq!((20..0).step_by(-5).collect::<Vec<int>>(), [20, 15, 10, 5]);
-    assert_eq!((20..0).step_by(-6).collect::<Vec<int>>(), [20, 14, 8, 2]);
+    assert_eq!((0..20).step_by(5).collect::<Vec<isize>>(), [0, 5, 10, 15]);
+    assert_eq!((20..0).step_by(-5).collect::<Vec<isize>>(), [20, 15, 10, 5]);
+    assert_eq!((20..0).step_by(-6).collect::<Vec<isize>>(), [20, 14, 8, 2]);
     assert_eq!((200..255).step_by(50).collect::<Vec<u8>>(), [200, 250]);
-    assert_eq!((200..-5).step_by(1).collect::<Vec<int>>(), []);
-    assert_eq!((200..200).step_by(1).collect::<Vec<int>>(), []);
+    assert_eq!((200..-5).step_by(1).collect::<Vec<isize>>(), []);
+    assert_eq!((200..200).step_by(1).collect::<Vec<isize>>(), []);
 }
 
 #[test]
 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(0, 20, 5).collect::<Vec<isize>>(), [0, 5, 10, 15, 20]);
+    assert_eq!(range_step_inclusive(20, 0, -5).collect::<Vec<isize>>(), [20, 15, 10, 5, 0]);
+    assert_eq!(range_step_inclusive(20, 0, -6).collect::<Vec<isize>>(), [20, 14, 8, 2]);
     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]);
+    assert_eq!(range_step_inclusive(200, -5, 1).collect::<Vec<isize>>(), []);
+    assert_eq!(range_step_inclusive(200, 200, 1).collect::<Vec<isize>>(), [200]);
 }
 
 #[test]
@@ -811,7 +811,7 @@ fn test_peekable_is_empty() {
 
 #[test]
 fn test_min_max() {
-    let v: [int; 0] = [];
+    let v: [isize; 0] = [];
     assert_eq!(v.iter().min_max(), NoElements);
 
     let v = [1];
@@ -829,7 +829,7 @@ fn test_min_max() {
 
 #[test]
 fn test_min_max_result() {
-    let r: MinMaxResult<int> = NoElements;
+    let r: MinMaxResult<isize> = NoElements;
     assert_eq!(r.into_option(), None);
 
     let r = OneElement(1);
@@ -876,7 +876,7 @@ fn test_fuse() {
 
 #[bench]
 fn bench_rposition(b: &mut Bencher) {
-    let it: Vec<uint> = (0..300).collect();
+    let it: Vec<usize> = (0..300).collect();
     b.iter(|| {
         it.iter().rposition(|&x| x <= 150);
     });
index 33f9b63bc4907d006439c5a77f5d61a6ee8ea788..9cc3063dee678eece513b665e98ebc0b9a7af015 100644 (file)
@@ -26,6 +26,7 @@
 #![feature(debug_builders)]
 #![feature(unique)]
 #![feature(step_by)]
+#![feature(slice_patterns)]
 #![allow(deprecated)] // rand
 
 extern crate core;
index 17d6b684c50e80a1111ee80cc5e47a1b329f347d..fae36787c3dadf66df71995ae64b02ea9ad584c7 100644 (file)
@@ -21,15 +21,15 @@ fn size_of_basic() {
 #[test]
 #[cfg(target_pointer_width = "32")]
 fn size_of_32() {
-    assert_eq!(size_of::<uint>(), 4);
-    assert_eq!(size_of::<*const uint>(), 4);
+    assert_eq!(size_of::<usize>(), 4);
+    assert_eq!(size_of::<*const usize>(), 4);
 }
 
 #[test]
 #[cfg(target_pointer_width = "64")]
 fn size_of_64() {
-    assert_eq!(size_of::<uint>(), 8);
-    assert_eq!(size_of::<*const uint>(), 8);
+    assert_eq!(size_of::<usize>(), 8);
+    assert_eq!(size_of::<*const usize>(), 8);
 }
 
 #[test]
@@ -50,15 +50,15 @@ fn align_of_basic() {
 #[test]
 #[cfg(target_pointer_width = "32")]
 fn align_of_32() {
-    assert_eq!(align_of::<uint>(), 4);
-    assert_eq!(align_of::<*const uint>(), 4);
+    assert_eq!(align_of::<usize>(), 4);
+    assert_eq!(align_of::<*const usize>(), 4);
 }
 
 #[test]
 #[cfg(target_pointer_width = "64")]
 fn align_of_64() {
-    assert_eq!(align_of::<uint>(), 8);
-    assert_eq!(align_of::<*const uint>(), 8);
+    assert_eq!(align_of::<usize>(), 8);
+    assert_eq!(align_of::<*const usize>(), 8);
 }
 
 #[test]
@@ -93,12 +93,12 @@ fn test_transmute_copy() {
 #[test]
 fn test_transmute() {
     trait Foo { fn dummy(&self) { } }
-    impl Foo for int {}
+    impl Foo for isize {}
 
     let a = box 100isize as Box<Foo>;
     unsafe {
         let x: ::core::raw::TraitObject = transmute(a);
-        assert!(*(x.data as *const int) == 100);
+        assert!(*(x.data as *const isize) == 100);
         let _x: Box<Foo> = transmute(x);
     }
 
@@ -112,15 +112,15 @@ impl Foo for int {}
 // Static/dynamic method dispatch
 
 struct Struct {
-    field: int
+    field: isize
 }
 
 trait Trait {
-    fn method(&self) -> int;
+    fn method(&self) -> isize;
 }
 
 impl Trait for Struct {
-    fn method(&self) -> int {
+    fn method(&self) -> isize {
         self.field
     }
 }
index f60570eaaf417941f4e54b4cf6beb5b60f5b8dc2..7a367ddeec8d4599ec8543a712306059061edd91 100644 (file)
@@ -43,7 +43,7 @@ fn test_match_on_nonzero_option() {
 
 #[test]
 fn test_match_option_empty_vec() {
-    let a: Option<Vec<int>> = Some(vec![]);
+    let a: Option<Vec<isize>> = Some(vec![]);
     match a {
         None => panic!("unexpected None while matching on Some(vec![])"),
         _ => {}
index 0183e6a93cfd07272aab962f2458719f77279b0b..33674a3abd870271fa26c15453367bbfa5ee24df 100644 (file)
@@ -14,7 +14,7 @@
 // Overhead of dtors
 
 struct HasDtor {
-    _x: int
+    _x: isize
 }
 
 impl Drop for HasDtor {
index fe0b10e91192bce5c1b62e288d0b0c9df9ffc748..569142c0d7dc9609d0e1f04d7b837c6fb3bf9458 100644 (file)
 fn test_get_ptr() {
     unsafe {
         let x: Box<_> = box 0;
-        let addr_x: *const int = mem::transmute(&*x);
+        let addr_x: *const isize = mem::transmute(&*x);
         let opt = Some(x);
         let y = opt.unwrap();
-        let addr_y: *const int = mem::transmute(&*y);
+        let addr_y: *const isize = mem::transmute(&*y);
         assert_eq!(addr_x, addr_y);
     }
 }
@@ -41,7 +41,7 @@ fn test_get_resource() {
     use core::cell::RefCell;
 
     struct R {
-       i: Rc<RefCell<int>>,
+       i: Rc<RefCell<isize>>,
     }
 
     #[unsafe_destructor]
@@ -53,7 +53,7 @@ fn drop(&mut self) {
         }
     }
 
-    fn r(i: Rc<RefCell<int>>) -> R {
+    fn r(i: Rc<RefCell<isize>>) -> R {
         R {
             i: i
         }
@@ -89,44 +89,44 @@ fn test_option_too_much_dance() {
 
 #[test]
 fn test_and() {
-    let x: Option<int> = Some(1);
+    let x: Option<isize> = Some(1);
     assert_eq!(x.and(Some(2)), Some(2));
-    assert_eq!(x.and(None::<int>), None);
+    assert_eq!(x.and(None::<isize>), None);
 
-    let x: Option<int> = None;
+    let x: Option<isize> = None;
     assert_eq!(x.and(Some(2)), None);
-    assert_eq!(x.and(None::<int>), None);
+    assert_eq!(x.and(None::<isize>), None);
 }
 
 #[test]
 fn test_and_then() {
-    let x: Option<int> = Some(1);
+    let x: Option<isize> = Some(1);
     assert_eq!(x.and_then(|x| Some(x + 1)), Some(2));
-    assert_eq!(x.and_then(|_| None::<int>), None);
+    assert_eq!(x.and_then(|_| None::<isize>), None);
 
-    let x: Option<int> = None;
+    let x: Option<isize> = None;
     assert_eq!(x.and_then(|x| Some(x + 1)), None);
-    assert_eq!(x.and_then(|_| None::<int>), None);
+    assert_eq!(x.and_then(|_| None::<isize>), None);
 }
 
 #[test]
 fn test_or() {
-    let x: Option<int> = Some(1);
+    let x: Option<isize> = Some(1);
     assert_eq!(x.or(Some(2)), Some(1));
     assert_eq!(x.or(None), Some(1));
 
-    let x: Option<int> = None;
+    let x: Option<isize> = None;
     assert_eq!(x.or(Some(2)), Some(2));
     assert_eq!(x.or(None), None);
 }
 
 #[test]
 fn test_or_else() {
-    let x: Option<int> = Some(1);
+    let x: Option<isize> = Some(1);
     assert_eq!(x.or_else(|| Some(2)), Some(1));
     assert_eq!(x.or_else(|| None), Some(1));
 
-    let x: Option<int> = None;
+    let x: Option<isize> = None;
     assert_eq!(x.or_else(|| Some(2)), Some(2));
     assert_eq!(x.or_else(|| None), None);
 }
@@ -141,7 +141,7 @@ fn test_unwrap() {
 #[test]
 #[should_panic]
 fn test_unwrap_panic1() {
-    let x: Option<int> = None;
+    let x: Option<isize> = None;
     x.unwrap();
 }
 
@@ -154,19 +154,19 @@ fn test_unwrap_panic2() {
 
 #[test]
 fn test_unwrap_or() {
-    let x: Option<int> = Some(1);
+    let x: Option<isize> = Some(1);
     assert_eq!(x.unwrap_or(2), 1);
 
-    let x: Option<int> = None;
+    let x: Option<isize> = None;
     assert_eq!(x.unwrap_or(2), 2);
 }
 
 #[test]
 fn test_unwrap_or_else() {
-    let x: Option<int> = Some(1);
+    let x: Option<isize> = Some(1);
     assert_eq!(x.unwrap_or_else(|| 2), 1);
 
-    let x: Option<int> = None;
+    let x: Option<isize> = None;
     assert_eq!(x.unwrap_or_else(|| 2), 2);
 }
 
@@ -223,13 +223,13 @@ fn test_ord() {
 /* FIXME(#20575)
 #[test]
 fn test_collect() {
-    let v: Option<Vec<int>> = (0..0).map(|_| Some(0)).collect();
+    let v: Option<Vec<isize>> = (0..0).map(|_| Some(0)).collect();
     assert!(v == Some(vec![]));
 
-    let v: Option<Vec<int>> = (0..3).map(|x| Some(x)).collect();
+    let v: Option<Vec<isize>> = (0..3).map(|x| Some(x)).collect();
     assert!(v == Some(vec![0, 1, 2]));
 
-    let v: Option<Vec<int>> = (0..3).map(|x| {
+    let v: Option<Vec<isize>> = (0..3).map(|x| {
         if x > 1 { None } else { Some(x) }
     }).collect();
     assert!(v == None);
@@ -258,9 +258,6 @@ fn test_cloned() {
     assert_eq!(opt_none.clone(), None);
     assert_eq!(opt_none.cloned(), None);
 
-    // Mutable refs work
-    assert_eq!(opt_mut_ref.cloned(), Some(2u32));
-
     // Immutable ref works
     assert_eq!(opt_ref.clone(), Some(&val1));
     assert_eq!(opt_ref.cloned(), Some(1u32));
index 4f5f269d4375d0c0a6e2ec2c24ad3f19b476a065..8f1017c50a39d318b76152ffd7913294cae344d2 100644 (file)
 fn test() {
     unsafe {
         struct Pair {
-            fst: int,
-            snd: int
+            fst: isize,
+            snd: isize
         };
         let mut p = Pair {fst: 10, snd: 20};
         let pptr: *mut Pair = &mut p;
-        let iptr: *mut int = mem::transmute(pptr);
+        let iptr: *mut isize = mem::transmute(pptr);
         assert_eq!(*iptr, 10);
         *iptr = 30;
         assert_eq!(*iptr, 30);
@@ -35,18 +35,15 @@ struct Pair {
         let v0 = vec![32000u16, 32001u16, 32002u16];
         let mut v1 = vec![0u16, 0u16, 0u16];
 
-        copy(v1.as_mut_ptr().offset(1),
-             v0.as_ptr().offset(1), 1);
+        copy(v0.as_ptr().offset(1), v1.as_mut_ptr().offset(1), 1);
         assert!((v1[0] == 0u16 &&
                  v1[1] == 32001u16 &&
                  v1[2] == 0u16));
-        copy(v1.as_mut_ptr(),
-             v0.as_ptr().offset(2), 1);
+        copy(v0.as_ptr().offset(2), v1.as_mut_ptr(), 1);
         assert!((v1[0] == 32002u16 &&
                  v1[1] == 32001u16 &&
                  v1[2] == 0u16));
-        copy(v1.as_mut_ptr().offset(2),
-             v0.as_ptr(), 1);
+        copy(v0.as_ptr(), v1.as_mut_ptr().offset(2), 1);
         assert!((v1[0] == 32002u16 &&
                  v1[1] == 32001u16 &&
                  v1[2] == 32000u16));
@@ -55,13 +52,13 @@ struct Pair {
 
 #[test]
 fn test_is_null() {
-    let p: *const int = null();
+    let p: *const isize = null();
     assert!(p.is_null());
 
     let q = unsafe { p.offset(1) };
     assert!(!q.is_null());
 
-    let mp: *mut int = null_mut();
+    let mp: *mut isize = null_mut();
     assert!(mp.is_null());
 
     let mq = unsafe { mp.offset(1) };
@@ -71,22 +68,22 @@ fn test_is_null() {
 #[test]
 fn test_as_ref() {
     unsafe {
-        let p: *const int = null();
+        let p: *const isize = null();
         assert_eq!(p.as_ref(), None);
 
-        let q: *const int = &2;
+        let q: *const isize = &2;
         assert_eq!(q.as_ref().unwrap(), &2);
 
-        let p: *mut int = null_mut();
+        let p: *mut isize = null_mut();
         assert_eq!(p.as_ref(), None);
 
-        let q: *mut int = &mut 2;
+        let q: *mut isize = &mut 2;
         assert_eq!(q.as_ref().unwrap(), &2);
 
         // Lifetime inference
         let u = 2isize;
         {
-            let p = &u as *const int;
+            let p = &u as *const isize;
             assert_eq!(p.as_ref().unwrap(), &2);
         }
     }
@@ -95,16 +92,16 @@ fn test_as_ref() {
 #[test]
 fn test_as_mut() {
     unsafe {
-        let p: *mut int = null_mut();
+        let p: *mut isize = null_mut();
         assert!(p.as_mut() == None);
 
-        let q: *mut int = &mut 2;
+        let q: *mut isize = &mut 2;
         assert!(q.as_mut().unwrap() == &mut 2);
 
         // Lifetime inference
         let mut u = 2isize;
         {
-            let p = &mut u as *mut int;
+            let p = &mut u as *mut isize;
             assert!(p.as_mut().unwrap() == &mut 2);
         }
     }
@@ -143,7 +140,7 @@ fn test_ptr_subtraction() {
         let ptr = xs.as_ptr();
 
         while idx >= 0 {
-            assert_eq!(*(ptr.offset(idx as int)), idx as int);
+            assert_eq!(*(ptr.offset(idx as isize)), idx as isize);
             idx = idx - 1;
         }
 
index 1c175ba99f7739619bd7c7b90148666d27c41052..ac8c2b953ae965d185873e429c84a5f547f93e29 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub fn op1() -> Result<int, &'static str> { Ok(666) }
-pub fn op2() -> Result<int, &'static str> { Err("sadface") }
+pub fn op1() -> Result<isize, &'static str> { Ok(666) }
+pub fn op2() -> Result<isize, &'static str> { Err("sadface") }
 
 #[test]
 pub fn test_and() {
@@ -24,13 +24,13 @@ pub fn test_and() {
 
 #[test]
 pub fn test_and_then() {
-    assert_eq!(op1().and_then(|i| Ok::<int, &'static str>(i + 1)).unwrap(), 667);
-    assert_eq!(op1().and_then(|_| Err::<int, &'static str>("bad")).unwrap_err(),
+    assert_eq!(op1().and_then(|i| Ok::<isize, &'static str>(i + 1)).unwrap(), 667);
+    assert_eq!(op1().and_then(|_| Err::<isize, &'static str>("bad")).unwrap_err(),
                "bad");
 
-    assert_eq!(op2().and_then(|i| Ok::<int, &'static str>(i + 1)).unwrap_err(),
+    assert_eq!(op2().and_then(|i| Ok::<isize, &'static str>(i + 1)).unwrap_err(),
                "sadface");
-    assert_eq!(op2().and_then(|_| Err::<int, &'static str>("bad")).unwrap_err(),
+    assert_eq!(op2().and_then(|_| Err::<isize, &'static str>("bad")).unwrap_err(),
                "sadface");
 }
 
@@ -45,53 +45,53 @@ pub fn test_or() {
 
 #[test]
 pub fn test_or_else() {
-    assert_eq!(op1().or_else(|_| Ok::<int, &'static str>(667)).unwrap(), 666);
-    assert_eq!(op1().or_else(|e| Err::<int, &'static str>(e)).unwrap(), 666);
+    assert_eq!(op1().or_else(|_| Ok::<isize, &'static str>(667)).unwrap(), 666);
+    assert_eq!(op1().or_else(|e| Err::<isize, &'static str>(e)).unwrap(), 666);
 
-    assert_eq!(op2().or_else(|_| Ok::<int, &'static str>(667)).unwrap(), 667);
-    assert_eq!(op2().or_else(|e| Err::<int, &'static str>(e)).unwrap_err(),
+    assert_eq!(op2().or_else(|_| Ok::<isize, &'static str>(667)).unwrap(), 667);
+    assert_eq!(op2().or_else(|e| Err::<isize, &'static str>(e)).unwrap_err(),
                "sadface");
 }
 
 #[test]
 pub fn test_impl_map() {
-    assert!(Ok::<int, int>(1).map(|x| x + 1) == Ok(2));
-    assert!(Err::<int, int>(1).map(|x| x + 1) == Err(1));
+    assert!(Ok::<isize, isize>(1).map(|x| x + 1) == Ok(2));
+    assert!(Err::<isize, isize>(1).map(|x| x + 1) == Err(1));
 }
 
 #[test]
 pub fn test_impl_map_err() {
-    assert!(Ok::<int, int>(1).map_err(|x| x + 1) == Ok(1));
-    assert!(Err::<int, int>(1).map_err(|x| x + 1) == Err(2));
+    assert!(Ok::<isize, isize>(1).map_err(|x| x + 1) == Ok(1));
+    assert!(Err::<isize, isize>(1).map_err(|x| x + 1) == Err(2));
 }
 
 /* FIXME(#20575)
 #[test]
 fn test_collect() {
-    let v: Result<Vec<int>, ()> = (0..0).map(|_| Ok::<int, ()>(0)).collect();
+    let v: Result<Vec<isize>, ()> = (0..0).map(|_| Ok::<isize, ()>(0)).collect();
     assert!(v == Ok(vec![]));
 
-    let v: Result<Vec<int>, ()> = (0..3).map(|x| Ok::<int, ()>(x)).collect();
+    let v: Result<Vec<isize>, ()> = (0..3).map(|x| Ok::<isize, ()>(x)).collect();
     assert!(v == Ok(vec![0, 1, 2]));
 
-    let v: Result<Vec<int>, int> = (0..3).map(|x| {
+    let v: Result<Vec<isize>, isize> = (0..3).map(|x| {
         if x > 1 { Err(x) } else { Ok(x) }
     }).collect();
     assert!(v == Err(2));
 
     // test that it does not take more elements than it needs
-    let mut functions: [Box<Fn() -> Result<(), int>>; 3] =
+    let mut functions: [Box<Fn() -> Result<(), isize>>; 3] =
         [box || Ok(()), box || Err(1), box || panic!()];
 
-    let v: Result<Vec<()>, int> = functions.iter_mut().map(|f| (*f)()).collect();
+    let v: Result<Vec<()>, isize> = functions.iter_mut().map(|f| (*f)()).collect();
     assert!(v == Err(1));
 }
 */
 
 #[test]
 pub fn test_fmt_default() {
-    let ok: Result<int, &'static str> = Ok(100);
-    let err: Result<int, &'static str> = Err("Err");
+    let ok: Result<isize, &'static str> = Ok(100);
+    let err: Result<isize, &'static str> = Err("Err");
 
     let s = format!("{:?}", ok);
     assert_eq!(s, "Ok(100)");
@@ -101,8 +101,8 @@ pub fn test_fmt_default() {
 
 #[test]
 pub fn test_unwrap_or() {
-    let ok: Result<int, &'static str> = Ok(100);
-    let ok_err: Result<int, &'static str> = Err("Err");
+    let ok: Result<isize, &'static str> = Ok(100);
+    let ok_err: Result<isize, &'static str> = Err("Err");
 
     assert_eq!(ok.unwrap_or(50), 100);
     assert_eq!(ok_err.unwrap_or(50), 50);
@@ -110,7 +110,7 @@ pub fn test_unwrap_or() {
 
 #[test]
 pub fn test_unwrap_or_else() {
-    fn handler(msg: &'static str) -> int {
+    fn handler(msg: &'static str) -> isize {
         if msg == "I got this." {
             50
         } else {
@@ -118,8 +118,8 @@ fn handler(msg: &'static str) -> int {
         }
     }
 
-    let ok: Result<int, &'static str> = Ok(100);
-    let ok_err: Result<int, &'static str> = Err("I got this.");
+    let ok: Result<isize, &'static str> = Ok(100);
+    let ok_err: Result<isize, &'static str> = Err("I got this.");
 
     assert_eq!(ok.unwrap_or_else(handler), 100);
     assert_eq!(ok_err.unwrap_or_else(handler), 50);
@@ -128,7 +128,7 @@ fn handler(msg: &'static str) -> int {
 #[test]
 #[should_panic]
 pub fn test_unwrap_or_else_panic() {
-    fn handler(msg: &'static str) -> int {
+    fn handler(msg: &'static str) -> isize {
         if msg == "I got this." {
             50
         } else {
@@ -136,6 +136,6 @@ fn handler(msg: &'static str) -> int {
         }
     }
 
-    let bad_err: Result<int, &'static str> = Err("Unrecoverable mess.");
-    let _ : int = bad_err.unwrap_or_else(handler);
+    let bad_err: Result<isize, &'static str> = Err("Unrecoverable mess.");
+    let _ : isize = bad_err.unwrap_or_else(handler);
 }
index 206fdd243c783ab154fc90b1e67123d974f1875c..9a5dde8e45e2f92e91bb0c505f2778ab5967426d 100644 (file)
@@ -92,7 +92,6 @@
        html_playground_url = "http://play.rust-lang.org/")]
 
 #![deny(missing_docs)]
-#![feature(int_uint)]
 #![feature(staged_api)]
 #![feature(str_words)]
 #![feature(str_char)]
@@ -311,7 +310,7 @@ pub fn opt_present(&self, nm: &str) -> bool {
     }
 
     /// Returns the number of times an option was matched.
-    pub fn opt_count(&self, nm: &str) -> uint {
+    pub fn opt_count(&self, nm: &str) -> usize {
         self.opt_vals(nm).len()
     }
 
@@ -389,7 +388,7 @@ fn is_arg(arg: &str) -> bool {
     arg.len() > 1 && arg.as_bytes()[0] == b'-'
 }
 
-fn find_opt(opts: &[Opt], nm: Name) -> Option<uint> {
+fn find_opt(opts: &[Opt], nm: Name) -> Option<usize> {
     // Search main options.
     let pos = opts.iter().position(|opt| opt.name == nm);
     if pos.is_some() {
@@ -587,7 +586,7 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
     let opts: Vec<Opt> = optgrps.iter().map(|x| x.long_to_short()).collect();
     let n_opts = opts.len();
 
-    fn f(_x: uint) -> Vec<Optval> { return Vec::new(); }
+    fn f(_x: usize) -> Vec<Optval> { return Vec::new(); }
 
     let mut vals: Vec<_> = (0..n_opts).map(f).collect();
     let mut free: Vec<String> = Vec::new();
@@ -873,7 +872,7 @@ enum LengthLimit {
 ///
 /// Panics during iteration if the string contains a non-whitespace
 /// sequence longer than the limit.
-fn each_split_within<F>(ss: &str, lim: uint, mut it: F) -> bool where
+fn each_split_within<F>(ss: &str, lim: usize, mut it: F) -> bool where
     F: FnMut(&str) -> bool
 {
     // Just for fun, let's write this as a state machine:
@@ -892,7 +891,7 @@ fn each_split_within<F>(ss: &str, lim: uint, mut it: F) -> bool where
         lim = fake_i;
     }
 
-    let mut machine = |cont: &mut bool, (i, c): (uint, char)| -> bool {
+    let mut machine = |cont: &mut bool, (i, c): (usize, char)| -> bool {
         let whitespace = if c.is_whitespace() { Ws }       else { Cr };
         let limit      = if (i - slice_start + 1) <= lim  { UnderLim } else { OverLim };
 
@@ -954,7 +953,7 @@ fn each_split_within<F>(ss: &str, lim: uint, mut it: F) -> bool where
 
 #[test]
 fn test_split_within() {
-    fn t(s: &str, i: uint, u: &[String]) {
+    fn t(s: &str, i: usize, u: &[String]) {
         let mut v = Vec::new();
         each_split_within(s, i, |s| { v.push(s.to_string()); true });
         assert!(v.iter().zip(u.iter()).all(|(a,b)| a == b));
index ccf4a3f48d9a15aa2cc7106b9a878df808c556f2..b3a3f266a5ef33449a76658aeba5a9c4d77c6bd9 100644 (file)
 #![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/")]
-#![feature(int_uint)]
 #![feature(collections)]
 #![feature(into_cow)]
 
index 89843979cd01583346aef92808b3edafe843d9b0..b7162c4a177d6f0457bb30a40f729d19da2f7f38 100644 (file)
@@ -76,7 +76,7 @@
 
 #![allow(bad_style, raw_pointer_derive)]
 #![cfg_attr(target_os = "nacl", allow(unused_imports))]
-#[cfg(feature = "cargo-build")] extern crate "std" as core;
+#[cfg(feature = "cargo-build")] extern crate std as core;
 #[cfg(not(feature = "cargo-build"))] extern crate core;
 
 #[cfg(test)] extern crate std;
@@ -307,7 +307,10 @@ pub mod bsd44 {
                 #[derive(Copy)] pub struct sockaddr_storage {
                     pub ss_family: sa_family_t,
                     pub __ss_align: isize,
-                    pub __ss_pad2: [u8; 128 - 2 * (::core::isize::BYTES as usize)],
+                    #[cfg(target_pointer_width = "32")]
+                    pub __ss_pad2: [u8; 128 - 2 * 4],
+                    #[cfg(target_pointer_width = "64")]
+                    pub __ss_pad2: [u8; 128 - 2 * 8],
                 }
                 #[repr(C)]
                 #[derive(Copy)] pub struct sockaddr_in {
index 7ccd5401fdea47b58419244621a473b813d7e7e1..1cfac4d86680dc12f59e941aff3c5296f5d03f14 100644 (file)
 #![feature(alloc)]
 #![feature(staged_api)]
 #![feature(box_syntax)]
-#![feature(int_uint)]
 #![feature(core)]
 #![feature(std_misc)]
 
@@ -246,7 +245,7 @@ struct DefaultLogger { handle: Stderr }
 impl fmt::Display for LogLevel {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         let LogLevel(level) = *self;
-        match LOG_LEVEL_NAMES.get(level as uint - 1) {
+        match LOG_LEVEL_NAMES.get(level as usize - 1) {
             Some(ref name) => fmt::Display::fmt(name, fmt),
             None => fmt::Display::fmt(&level, fmt)
         }
@@ -289,7 +288,7 @@ pub fn log(level: u32, loc: &'static LogLocation, args: fmt::Arguments) {
     // is one.
     unsafe {
         let _g = LOCK.lock();
-        match FILTER as uint {
+        match FILTER as usize {
             0 => {}
             1 => panic!("cannot log after main thread has exited"),
             n => {
@@ -383,8 +382,8 @@ pub fn mod_enabled(level: u32, module: &str) -> bool {
 
     let _g = LOCK.lock();
     unsafe {
-        assert!(DIRECTIVES as uint != 0);
-        assert!(DIRECTIVES as uint != 1,
+        assert!(DIRECTIVES as usize != 0);
+        assert!(DIRECTIVES as usize != 1,
                 "cannot log after the main thread has exited");
 
         enabled(level, module, (*DIRECTIVES).iter())
index d54f183707475632089a14cd933c6ed2fa69a563..91abb548d2ee18520b13feabec69cc7a7fb60d89 100644 (file)
@@ -15,9 +15,9 @@
 use core::num::wrapping::WrappingOps;
 use {Rng, SeedableRng, Rand};
 
-const KEY_WORDS    : uint =  8; // 8 words for the 256-bit key
-const STATE_WORDS  : uint = 16;
-const CHACHA_ROUNDS: uint = 20; // Cryptographically secure from 8 upwards as of this writing
+const KEY_WORDS    : usize =  8; // 8 words for the 256-bit key
+const STATE_WORDS  : usize = 16;
+const CHACHA_ROUNDS: usize = 20; // Cryptographically secure from 8 upwards as of this writing
 
 /// A random number generator that uses the ChaCha20 algorithm [1].
 ///
@@ -32,7 +32,7 @@
 pub struct ChaChaRng {
     buffer:  [u32; STATE_WORDS], // Internal buffer of output
     state:   [u32; STATE_WORDS], // Initial state
-    index:   uint,                 // Index into state
+    index:   usize,                 // Index into state
 }
 
 static EMPTY: ChaChaRng = ChaChaRng {
index 5cafb8d2e5eae2ab6f61339c9f4f2c42536d75d8..62189e721e59d70f554bf6e0934a64858ad3c3d7 100644 (file)
@@ -76,7 +76,7 @@ fn ind_sample<R: Rng>(&self, rng: &mut R) -> Sup {
 /// A value with a particular weight for use with `WeightedChoice`.
 pub struct Weighted<T> {
     /// The numerical weight of this item
-    pub weight: uint,
+    pub weight: usize,
     /// The actual item which is being weighted
     pub item: T,
 }
@@ -88,7 +88,7 @@ pub struct Weighted<T> {
 ///
 /// The `Clone` restriction is a limitation of the `Sample` and
 /// `IndependentSample` traits. Note that `&T` is (cheaply) `Clone` for
-/// all `T`, as is `uint`, so one can store references or indices into
+/// all `T`, as is `usize`, so one can store references or indices into
 /// another vector.
 ///
 /// # Examples
@@ -101,7 +101,7 @@ pub struct Weighted<T> {
 /// let mut items = vec!(Weighted { weight: 2, item: 'a' },
 ///                      Weighted { weight: 4, item: 'b' },
 ///                      Weighted { weight: 1, item: 'c' });
-/// let wc = WeightedChoice::new(items.as_mut_slice());
+/// let wc = WeightedChoice::new(&mut items[..]);
 /// let mut rng = rand::thread_rng();
 /// for _ in 0..16 {
 ///      // on average prints 'a' 4 times, 'b' 8 and 'c' twice.
@@ -110,7 +110,7 @@ pub struct Weighted<T> {
 /// ```
 pub struct WeightedChoice<'a, T:'a> {
     items: &'a mut [Weighted<T>],
-    weight_range: Range<uint>
+    weight_range: Range<usize>
 }
 
 impl<'a, T: Clone> WeightedChoice<'a, T> {
@@ -119,7 +119,7 @@ impl<'a, T: Clone> WeightedChoice<'a, T> {
     /// Panics if:
     /// - `v` is empty
     /// - the total weight is 0
-    /// - the total weight is larger than a `uint` can contain.
+    /// - the total weight is larger than a `usize` can contain.
     pub fn new(items: &'a mut [Weighted<T>]) -> WeightedChoice<'a, T> {
         // strictly speaking, this is subsumed by the total weight == 0 case
         assert!(!items.is_empty(), "WeightedChoice::new called with no items");
@@ -133,7 +133,7 @@ pub fn new(items: &'a mut [Weighted<T>]) -> WeightedChoice<'a, T> {
             running_total = match running_total.checked_add(item.weight) {
                 Some(n) => n,
                 None => panic!("WeightedChoice::new called with a total weight \
-                               larger than a uint can contain")
+                               larger than a usize can contain")
             };
 
             item.weight = running_total;
@@ -238,7 +238,7 @@ fn ziggurat<R: Rng, P, Z>(
         // this may be slower than it would be otherwise.)
         // FIXME: investigate/optimise for the above.
         let bits: u64 = rng.gen();
-        let i = (bits & 0xff) as uint;
+        let i = (bits & 0xff) as usize;
         let f = (bits >> 11) as f64 / SCALE;
 
         // u is either U(-1, 1) or U(0, 1) depending on if this is a
@@ -256,7 +256,7 @@ fn ziggurat<R: Rng, P, Z>(
             return zero_case(rng, u);
         }
         // algebraically equivalent to f1 + DRanU()*(f0 - f1) < 1
-        if f_tab[i + 1] + (f_tab[i] - f_tab[i + 1]) * rng.gen() < pdf(x) {
+        if f_tab[i + 1] + (f_tab[i] - f_tab[i + 1]) * rng.gen::<f64>() < pdf(x) {
             return x;
         }
     }
@@ -270,7 +270,7 @@ mod tests {
     use super::{RandSample, WeightedChoice, Weighted, Sample, IndependentSample};
 
     #[derive(PartialEq, Debug)]
-    struct ConstRand(uint);
+    struct ConstRand(usize);
     impl Rand for ConstRand {
         fn rand<R: Rng>(_: &mut R) -> ConstRand {
             ConstRand(0)
@@ -352,7 +352,7 @@ macro_rules! t {
 
     #[test] #[should_panic]
     fn test_weighted_choice_no_items() {
-        WeightedChoice::<int>::new(&mut []);
+        WeightedChoice::<isize>::new(&mut []);
     }
     #[test] #[should_panic]
     fn test_weighted_choice_zero_weight() {
@@ -361,7 +361,7 @@ fn test_weighted_choice_zero_weight() {
     }
     #[test] #[should_panic]
     fn test_weighted_choice_weight_overflows() {
-        let x = (-1) as uint / 2; // x + x + 2 is the overflow
+        let x = (-1) as usize / 2; // x + x + 2 is the overflow
         WeightedChoice::new(&mut [Weighted { weight: x, item: 0 },
                                   Weighted { weight: 1, item: 1 },
                                   Weighted { weight: x, item: 2 },
index a682fa8584176977d02ccb2b942fd91b4e62e2ab..347d494259d08830fbbbf39df99764512ff68bc1 100644 (file)
 
 //! Generating numbers between two others.
 
-#![allow(trivial_numeric_casts)]
-
 // this is surprisingly complicated to be both generic & correct
 
-use core::prelude::{PartialOrd};
+use core::prelude::PartialOrd;
 use core::num::Int;
 use core::num::wrapping::WrappingOps;
 
@@ -138,12 +136,12 @@ fn sample_range<R: Rng>(r: &Range<$ty>, rng: &mut R) -> $ty {
 integer_impl! { i16, u16 }
 integer_impl! { i32, u32 }
 integer_impl! { i64, u64 }
-integer_impl! { int, uint }
+integer_impl! { isize, usize }
 integer_impl! { u8, u8 }
 integer_impl! { u16, u16 }
 integer_impl! { u32, u32 }
 integer_impl! { u64, u64 }
-integer_impl! { uint, uint }
+integer_impl! { usize, usize }
 
 macro_rules! float_impl {
     ($ty:ty) => {
@@ -156,7 +154,7 @@ fn construct_range(low: $ty, high: $ty) -> Range<$ty> {
                 }
             }
             fn sample_range<R: Rng>(r: &Range<$ty>, rng: &mut R) -> $ty {
-                r.low + r.range * rng.gen()
+                r.low + r.range * rng.gen::<$ty>()
             }
         }
     }
@@ -204,8 +202,8 @@ macro_rules! t {
                  )*
             }}
         }
-        t!(i8, i16, i32, i64, int,
-           u8, u16, u32, u64, uint)
+        t!(i8, i16, i32, i64, isize,
+           u8, u16, u32, u64, usize)
     }
 
     #[test]
index 14bebe0cd915cf167803a01a40d41227e389c387..a7f7889783f70b775d40791d669efb547023a4bb 100644 (file)
@@ -14,8 +14,8 @@
 
 use core::prelude::*;
 use core::slice;
-use core::iter::{range_step, repeat};
-use core::num::wrapping::Wrapping as w;
+use core::iter::repeat;
+use core::num::Wrapping as w;
 
 use {Rng, SeedableRng, Rand};
 
@@ -95,7 +95,7 @@ macro_rules! mix {
         if use_rsl {
             macro_rules! memloop {
                 ($arr:expr) => {{
-                    for i in range_step(0, RAND_SIZE_USIZE, 8) {
+                    for i in (0..RAND_SIZE_USIZE).step_by(8) {
                         a=a+$arr[i  ]; b=b+$arr[i+1];
                         c=c+$arr[i+2]; d=d+$arr[i+3];
                         e=e+$arr[i+4]; f=f+$arr[i+5];
@@ -112,7 +112,7 @@ macro_rules! memloop {
             memloop!(self.rsl);
             memloop!(self.mem);
         } else {
-            for i in range_step(0, RAND_SIZE_USIZE, 8) {
+            for i in (0..RAND_SIZE_USIZE).step_by(8) {
                 mix!();
                 self.mem[i  ]=a; self.mem[i+1]=b;
                 self.mem[i+2]=c; self.mem[i+3]=d;
@@ -136,7 +136,7 @@ fn isaac(&mut self) {
         const MIDPOINT: usize = RAND_SIZE_USIZE / 2;
 
         macro_rules! ind {
-            ($x:expr) => ( self.mem[($x >> 2).0 as usize & (RAND_SIZE_USIZE - 1)] )
+            ($x:expr) => (self.mem[($x >> 2).0 as usize & (RAND_SIZE_USIZE - 1)] )
         }
 
         let r = [(0, MIDPOINT), (MIDPOINT, 0)];
@@ -172,7 +172,7 @@ macro_rules! rngstepn {
                 }}
             }
 
-            for i in range_step(0, MIDPOINT, 4) {
+            for i in (0..MIDPOINT).step_by(4) {
                 rngstepp!(i + 0, 13);
                 rngstepn!(i + 1, 6);
                 rngstepp!(i + 2, 2);
@@ -447,7 +447,6 @@ fn next_u32(&mut self) -> u32 {
 
     #[inline]
     fn next_u64(&mut self) -> u64 {
-        #![allow(trivial_numeric_casts)]
         if self.cnt == 0 {
             // make some more numbers
             self.isaac64();
index 9f6399ff12dd659f792aa448eb1cb377456d06ca..85f3c621c7e88b9412c95600b1c6f379c0b381fd 100644 (file)
        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
        html_root_url = "http://doc.rust-lang.org/nightly/",
        html_playground_url = "http://play.rust-lang.org/")]
-#![feature(int_uint)]
 #![feature(no_std)]
 #![no_std]
 #![unstable(feature = "rand")]
 #![feature(staged_api)]
 #![staged_api]
 #![feature(core)]
+#![feature(step_by)]
 #![deprecated(reason = "use the crates.io `rand` library instead",
               since = "1.0.0-alpha")]
 
@@ -99,8 +99,8 @@ fn next_u64(&mut self) -> u64 {
     /// See `Closed01` for the closed interval `[0,1]`, and
     /// `Open01` for the open interval `(0,1)`.
     fn next_f32(&mut self) -> f32 {
-        const MANTISSA_BITS: uint = 24;
-        const IGNORED_BITS: uint = 8;
+        const MANTISSA_BITS: usize = 24;
+        const IGNORED_BITS: usize = 8;
         const SCALE: f32 = (1u64 << MANTISSA_BITS) as f32;
 
         // using any more than `MANTISSA_BITS` bits will
@@ -121,8 +121,8 @@ fn next_f32(&mut self) -> f32 {
     /// See `Closed01` for the closed interval `[0,1]`, and
     /// `Open01` for the open interval `(0,1)`.
     fn next_f64(&mut self) -> f64 {
-        const MANTISSA_BITS: uint = 53;
-        const IGNORED_BITS: uint = 11;
+        const MANTISSA_BITS: usize = 53;
+        const IGNORED_BITS: usize = 11;
         const SCALE: f64 = (1u64 << MANTISSA_BITS) as f64;
 
         (self.next_u64() >> IGNORED_BITS) as f64 / SCALE
@@ -189,7 +189,7 @@ fn fill_bytes(&mut self, dest: &mut [u8]) {
     /// use std::rand::{thread_rng, Rng};
     ///
     /// let mut rng = thread_rng();
-    /// let x: uint = rng.gen();
+    /// let x: usize = rng.gen();
     /// println!("{}", x);
     /// println!("{:?}", rng.gen::<(f64, bool)>());
     /// ```
@@ -208,7 +208,7 @@ fn gen<T: Rand>(&mut self) -> T {
     /// use std::rand::{thread_rng, Rng};
     ///
     /// let mut rng = thread_rng();
-    /// let x = rng.gen_iter::<uint>().take(10).collect::<Vec<uint>>();
+    /// let x = rng.gen_iter::<usize>().take(10).collect::<Vec<usize>>();
     /// println!("{:?}", x);
     /// println!("{:?}", rng.gen_iter::<(f64, bool)>().take(5)
     ///                     .collect::<Vec<(f64, bool)>>());
@@ -236,7 +236,7 @@ fn gen_iter<'a, T: Rand>(&'a mut self) -> Generator<'a, T, Self> {
     /// use std::rand::{thread_rng, Rng};
     ///
     /// let mut rng = thread_rng();
-    /// let n: uint = rng.gen_range(0, 10);
+    /// let n: usize = rng.gen_range(0, 10);
     /// println!("{}", n);
     /// let m: f64 = rng.gen_range(-40.0f64, 1.3e5f64);
     /// println!("{}", m);
@@ -257,7 +257,7 @@ fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T {
     /// let mut rng = thread_rng();
     /// println!("{}", rng.gen_weighted_bool(3));
     /// ```
-    fn gen_weighted_bool(&mut self, n: uint) -> bool {
+    fn gen_weighted_bool(&mut self, n: usize) -> bool {
         n <= 1 || self.gen_range(0, n) == 0
     }
 
index 95dd986d2e3c7be0556708349b6b55f3411ccdf5..ab4939f57d41a62ff357bd543db5d4fa3d2b9097 100644 (file)
 
 /// How many bytes of entropy the underling RNG is allowed to generate
 /// before it is reseeded.
-const DEFAULT_GENERATION_THRESHOLD: uint = 32 * 1024;
+const DEFAULT_GENERATION_THRESHOLD: usize = 32 * 1024;
 
 /// A wrapper around any RNG which reseeds the underlying RNG after it
 /// has generated a certain number of random bytes.
 pub struct ReseedingRng<R, Rsdr> {
     rng: R,
-    generation_threshold: uint,
-    bytes_generated: uint,
+    generation_threshold: usize,
+    bytes_generated: usize,
     /// Controls the behaviour when reseeding the RNG.
     pub reseeder: Rsdr,
 }
@@ -38,7 +38,7 @@ impl<R: Rng, Rsdr: Reseeder<R>> ReseedingRng<R, Rsdr> {
     /// * `rng`: the random number generator to use.
     /// * `generation_threshold`: the number of bytes of entropy at which to reseed the RNG.
     /// * `reseeder`: the reseeding object to use.
-    pub fn new(rng: R, generation_threshold: uint, reseeder: Rsdr) -> ReseedingRng<R,Rsdr> {
+    pub fn new(rng: R, generation_threshold: usize, reseeder: Rsdr) -> ReseedingRng<R,Rsdr> {
         ReseedingRng {
             rng: rng,
             generation_threshold: generation_threshold,
@@ -213,7 +213,7 @@ fn test_rng_reseed() {
         assert_eq!(string1, string2);
     }
 
-    const FILL_BYTES_V_LEN: uint = 13579;
+    const FILL_BYTES_V_LEN: usize = 13579;
     #[test]
     fn test_rng_fill_bytes() {
         let mut v = repeat(0).take(FILL_BYTES_V_LEN).collect::<Vec<_>>();
index 1ffc6001af5721b3163bac4e575a7c3dc21df67f..092cd780ec7c7cfb02efc8e16e996c3f8d5ae1d7 100644 (file)
@@ -27,7 +27,7 @@
 //! where the tag number is ORed with 0xf000. (E.g. tag 0x123 = `f1 23`)
 //!
 //! **Lengths** encode the length of the following data.
-//! It is a variable-length unsigned int, and one of the following forms:
+//! It is a variable-length unsigned isize, and one of the following forms:
 //!
 //! - `80` through `fe` for lengths up to 0x7e;
 //! - `40 ff` through `7f ff` for lengths up to 0x3fff;
@@ -83,7 +83,7 @@
 //! - `Sub32` (`0d`): 4-byte unsigned integer for supplementary information.
 //!   Those two tags normally occur as the first subdocument of certain tags,
 //!   namely `Enum`, `Vec` and `Map`, to provide a variant or size information.
-//!   They can be used interchangably.
+//!   They can be used interchangeably.
 //!
 //! Predefined tags with an explicit length:
 //!
 
 #![feature(io)]
 #![feature(core)]
-#![feature(int_uint)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
 
 #[derive(Clone, Copy)]
 pub struct Doc<'a> {
     pub data: &'a [u8],
-    pub start: uint,
-    pub end: uint,
+    pub start: usize,
+    pub end: usize,
 }
 
 impl<'doc> Doc<'doc> {
@@ -155,7 +154,7 @@ pub fn new(data: &'doc [u8]) -> Doc<'doc> {
         Doc { data: data, start: 0, end: data.len() }
     }
 
-    pub fn get<'a>(&'a self, tag: uint) -> Doc<'a> {
+    pub fn get<'a>(&'a self, tag: usize) -> Doc<'a> {
         reader::get_doc(*self, tag)
     }
 
@@ -173,7 +172,7 @@ pub fn as_str(&self) -> String {
 }
 
 pub struct TaggedDoc<'a> {
-    tag: uint,
+    tag: usize,
     pub doc: Doc<'a>,
 }
 
@@ -208,8 +207,8 @@ pub enum EbmlEncoderTag {
     EsOpaque   = 0x17,
 }
 
-const NUM_TAGS: uint = 0x1000;
-const NUM_IMPLICIT_TAGS: uint = 0x0e;
+const NUM_TAGS: usize = 0x1000;
+const NUM_IMPLICIT_TAGS: usize = 0x0e;
 
 static TAG_IMPLICIT_LEN: [i8; NUM_IMPLICIT_TAGS] = [
     1, 2, 4, 8, // EsU*
@@ -222,8 +221,8 @@ pub enum EbmlEncoderTag {
 
 #[derive(Debug)]
 pub enum Error {
-    IntTooBig(uint),
-    InvalidTag(uint),
+    IntTooBig(usize),
+    InvalidTag(usize),
     Expected(String),
     IoError(std::io::Error),
     ApplicationError(String)
@@ -242,7 +241,6 @@ pub mod reader {
 
     use std::isize;
     use std::mem::transmute;
-    use std::num::Int;
     use std::slice::bytes;
 
     use serialize;
@@ -270,16 +268,16 @@ macro_rules! try_or {
 
     #[derive(Copy)]
     pub struct Res {
-        pub val: uint,
-        pub next: uint
+        pub val: usize,
+        pub next: usize
     }
 
-    pub fn tag_at(data: &[u8], start: uint) -> DecodeResult<Res> {
-        let v = data[start] as uint;
+    pub fn tag_at(data: &[u8], start: usize) -> DecodeResult<Res> {
+        let v = data[start] as usize;
         if v < 0xf0 {
             Ok(Res { val: v, next: start + 1 })
         } else if v > 0xf0 {
-            Ok(Res { val: ((v & 0xf) << 8) | data[start + 1] as uint, next: start + 2 })
+            Ok(Res { val: ((v & 0xf) << 8) | data[start + 1] as usize, next: start + 2 })
         } else {
             // every tag starting with byte 0xf0 is an overlong form, which is prohibited.
             Err(InvalidTag(v))
@@ -287,33 +285,33 @@ pub fn tag_at(data: &[u8], start: uint) -> DecodeResult<Res> {
     }
 
     #[inline(never)]
-    fn vuint_at_slow(data: &[u8], start: uint) -> DecodeResult<Res> {
+    fn vuint_at_slow(data: &[u8], start: usize) -> DecodeResult<Res> {
         let a = data[start];
         if a & 0x80 != 0 {
-            return Ok(Res {val: (a & 0x7f) as uint, next: start + 1});
+            return Ok(Res {val: (a & 0x7f) as usize, next: start + 1});
         }
         if a & 0x40 != 0 {
-            return Ok(Res {val: ((a & 0x3f) as uint) << 8 |
-                        (data[start + 1] as uint),
+            return Ok(Res {val: ((a & 0x3f) as usize) << 8 |
+                        (data[start + 1] as usize),
                     next: start + 2});
         }
         if a & 0x20 != 0 {
-            return Ok(Res {val: ((a & 0x1f) as uint) << 16 |
-                        (data[start + 1] as uint) << 8 |
-                        (data[start + 2] as uint),
+            return Ok(Res {val: ((a & 0x1f) as usize) << 16 |
+                        (data[start + 1] as usize) << 8 |
+                        (data[start + 2] as usize),
                     next: start + 3});
         }
         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),
+            return Ok(Res {val: ((a & 0x0f) as usize) << 24 |
+                        (data[start + 1] as usize) << 16 |
+                        (data[start + 2] as usize) << 8 |
+                        (data[start + 3] as usize),
                     next: start + 4});
         }
-        Err(IntTooBig(a as uint))
+        Err(IntTooBig(a as usize))
     }
 
-    pub fn vuint_at(data: &[u8], start: uint) -> DecodeResult<Res> {
+    pub fn vuint_at(data: &[u8], start: usize) -> DecodeResult<Res> {
         if data.len() - start < 4 {
             return vuint_at_slow(data, start);
         }
@@ -337,7 +335,7 @@ pub fn vuint_at(data: &[u8], start: uint) -> DecodeResult<Res> {
         // most significant bit is set etc. we can replace up to three
         // "and+branch" with a single table lookup which gives us a measured
         // speedup of around 2x on x86_64.
-        static SHIFT_MASK_TABLE: [(uint, u32); 16] = [
+        static SHIFT_MASK_TABLE: [(usize, u32); 16] = [
             (0, 0x0), (0, 0x0fffffff),
             (8, 0x1fffff), (8, 0x1fffff),
             (16, 0x3fff), (16, 0x3fff), (16, 0x3fff), (16, 0x3fff),
@@ -346,10 +344,10 @@ pub fn vuint_at(data: &[u8], start: uint) -> DecodeResult<Res> {
         ];
 
         unsafe {
-            let ptr = data.as_ptr().offset(start as int) as *const u32;
-            let val = Int::from_be(*ptr);
+            let ptr = data.as_ptr().offset(start as isize) as *const u32;
+            let val = u32::from_be(*ptr);
 
-            let i = (val >> 28) as uint;
+            let i = (val >> 28) as usize;
             let (shift, mask) = SHIFT_MASK_TABLE[i];
             Ok(Res {
                 val: ((val >> shift) & mask) as usize,
@@ -360,13 +358,13 @@ pub fn vuint_at(data: &[u8], start: uint) -> DecodeResult<Res> {
 
     pub fn tag_len_at(data: &[u8], tag: Res) -> DecodeResult<Res> {
         if tag.val < NUM_IMPLICIT_TAGS && TAG_IMPLICIT_LEN[tag.val] >= 0 {
-            Ok(Res { val: TAG_IMPLICIT_LEN[tag.val] as uint, next: tag.next })
+            Ok(Res { val: TAG_IMPLICIT_LEN[tag.val] as usize, next: tag.next })
         } else {
             vuint_at(data, tag.next)
         }
     }
 
-    pub fn doc_at<'a>(data: &'a [u8], start: uint) -> DecodeResult<TaggedDoc<'a>> {
+    pub fn doc_at<'a>(data: &'a [u8], start: usize) -> DecodeResult<TaggedDoc<'a>> {
         let elt_tag = try!(tag_at(data, start));
         let elt_size = try!(tag_len_at(data, elt_tag));
         let end = elt_size.next + elt_size.val;
@@ -376,7 +374,7 @@ pub fn doc_at<'a>(data: &'a [u8], start: uint) -> DecodeResult<TaggedDoc<'a>> {
         })
     }
 
-    pub fn maybe_get_doc<'a>(d: Doc<'a>, tg: uint) -> Option<Doc<'a>> {
+    pub fn maybe_get_doc<'a>(d: Doc<'a>, tg: usize) -> Option<Doc<'a>> {
         let mut pos = d.start;
         while pos < d.end {
             let elt_tag = try_or!(tag_at(d.data, pos), None);
@@ -390,7 +388,7 @@ pub fn maybe_get_doc<'a>(d: Doc<'a>, tg: uint) -> Option<Doc<'a>> {
         None
     }
 
-    pub fn get_doc<'a>(d: Doc<'a>, tg: uint) -> Doc<'a> {
+    pub fn get_doc<'a>(d: Doc<'a>, tg: usize) -> Doc<'a> {
         match maybe_get_doc(d, tg) {
             Some(d) => d,
             None => {
@@ -401,7 +399,7 @@ pub fn get_doc<'a>(d: Doc<'a>, tg: uint) -> Doc<'a> {
     }
 
     pub fn docs<F>(d: Doc, mut it: F) -> bool where
-        F: FnMut(uint, Doc) -> bool,
+        F: FnMut(usize, Doc) -> bool,
     {
         let mut pos = d.start;
         while pos < d.end {
@@ -416,7 +414,7 @@ pub fn docs<F>(d: Doc, mut it: F) -> bool where
         return true;
     }
 
-    pub fn tagged_docs<F>(d: Doc, tg: uint, mut it: F) -> bool where
+    pub fn tagged_docs<F>(d: Doc, tg: usize, mut it: F) -> bool where
         F: FnMut(Doc) -> bool,
     {
         let mut pos = d.start;
@@ -450,21 +448,21 @@ pub fn doc_as_u8(d: Doc) -> u8 {
     pub fn doc_as_u16(d: Doc) -> u16 {
         assert_eq!(d.end, d.start + 2);
         let mut b = [0; 2];
-        bytes::copy_memory(&mut b, &d.data[d.start..d.end]);
+        bytes::copy_memory(&d.data[d.start..d.end], &mut b);
         unsafe { (*(b.as_ptr() as *const u16)).to_be() }
     }
 
     pub fn doc_as_u32(d: Doc) -> u32 {
         assert_eq!(d.end, d.start + 4);
         let mut b = [0; 4];
-        bytes::copy_memory(&mut b, &d.data[d.start..d.end]);
+        bytes::copy_memory(&d.data[d.start..d.end], &mut b);
         unsafe { (*(b.as_ptr() as *const u32)).to_be() }
     }
 
     pub fn doc_as_u64(d: Doc) -> u64 {
         assert_eq!(d.end, d.start + 8);
         let mut b = [0; 8];
-        bytes::copy_memory(&mut b, &d.data[d.start..d.end]);
+        bytes::copy_memory(&d.data[d.start..d.end], &mut b);
         unsafe { (*(b.as_ptr() as *const u64)).to_be() }
     }
 
@@ -475,7 +473,7 @@ pub fn doc_as_i64(d: Doc) -> i64 { doc_as_u64(d) as i64 }
 
     pub struct Decoder<'a> {
         parent: Doc<'a>,
-        pos: uint,
+        pos: usize,
     }
 
     impl<'doc> Decoder<'doc> {
@@ -501,7 +499,7 @@ fn next_doc(&mut self, exp_tag: EbmlEncoderTag) -> DecodeResult<Doc<'doc>> {
                    r_tag,
                    r_doc.start,
                    r_doc.end);
-            if r_tag != (exp_tag as uint) {
+            if r_tag != (exp_tag as usize) {
                 return Err(Expected(format!("expected EBML doc with tag {:?} but \
                                              found tag {:?}", exp_tag, r_tag)));
             }
@@ -528,7 +526,7 @@ fn push_doc<T, F>(&mut self, exp_tag: EbmlEncoderTag, f: F) -> DecodeResult<T> w
             Ok(r)
         }
 
-        fn _next_sub(&mut self) -> DecodeResult<uint> {
+        fn _next_sub(&mut self) -> DecodeResult<usize> {
             // empty vector/map optimization
             if self.parent.is_empty() {
                 return Ok(0);
@@ -536,10 +534,10 @@ fn _next_sub(&mut self) -> DecodeResult<uint> {
 
             let TaggedDoc { tag: r_tag, doc: r_doc } =
                 try!(doc_at(self.parent.data, self.pos));
-            let r = if r_tag == (EsSub8 as uint) {
-                doc_as_u8(r_doc) as uint
-            } else if r_tag == (EsSub32 as uint) {
-                doc_as_u32(r_doc) as uint
+            let r = if r_tag == (EsSub8 as usize) {
+                doc_as_u8(r_doc) as usize
+            } else if r_tag == (EsSub32 as usize) {
+                doc_as_u32(r_doc) as usize
             } else {
                 return Err(Expected(format!("expected EBML doc with tag {:?} or {:?} but \
                                              found tag {:?}", EsSub8, EsSub32, r_tag)));
@@ -568,8 +566,8 @@ fn _next_int(&mut self,
 
             let TaggedDoc { tag: r_tag, doc: r_doc } =
                 try!(doc_at(self.parent.data, self.pos));
-            let r = if first_tag as uint <= r_tag && r_tag <= last_tag as uint {
-                match r_tag - first_tag as uint {
+            let r = if first_tag as usize <= r_tag && r_tag <= last_tag as usize {
+                match r_tag - first_tag as usize {
                     0 => doc_as_u8(r_doc) as u64,
                     1 => doc_as_u16(r_doc) as u64,
                     2 => doc_as_u32(r_doc) as u64,
@@ -615,12 +613,12 @@ fn read_u64(&mut self) -> DecodeResult<u64> { self._next_int(EsU8, EsU64) }
         fn read_u32(&mut self) -> DecodeResult<u32> { Ok(try!(self._next_int(EsU8, EsU32)) as u32) }
         fn read_u16(&mut self) -> DecodeResult<u16> { Ok(try!(self._next_int(EsU8, EsU16)) as u16) }
         fn read_u8(&mut self) -> DecodeResult<u8> { Ok(doc_as_u8(try!(self.next_doc(EsU8)))) }
-        fn read_uint(&mut self) -> DecodeResult<uint> {
+        fn read_uint(&mut self) -> DecodeResult<usize> {
             let v = try!(self._next_int(EsU8, EsU64));
             if v > (::std::usize::MAX as u64) {
-                Err(IntTooBig(v as uint))
+                Err(IntTooBig(v as usize))
             } else {
-                Ok(v as uint)
+                Ok(v as usize)
             }
         }
 
@@ -628,13 +626,13 @@ fn read_i64(&mut self) -> DecodeResult<i64> { Ok(try!(self._next_int(EsI8, EsI64
         fn read_i32(&mut self) -> DecodeResult<i32> { Ok(try!(self._next_int(EsI8, EsI32)) as i32) }
         fn read_i16(&mut self) -> DecodeResult<i16> { Ok(try!(self._next_int(EsI8, EsI16)) as i16) }
         fn read_i8(&mut self) -> DecodeResult<i8> { Ok(doc_as_u8(try!(self.next_doc(EsI8))) as i8) }
-        fn read_int(&mut self) -> DecodeResult<int> {
+        fn read_int(&mut self) -> DecodeResult<isize> {
             let v = try!(self._next_int(EsI8, EsI64)) as i64;
             if v > (isize::MAX as i64) || v < (isize::MIN as i64) {
                 debug!("FIXME \\#6122: Removing this makes this function miscompile");
-                Err(IntTooBig(v as uint))
+                Err(IntTooBig(v as usize))
             } else {
-                Ok(v as int)
+                Ok(v as isize)
             }
         }
 
@@ -678,7 +676,7 @@ fn read_enum<T, F>(&mut self, name: &str, f: F) -> DecodeResult<T> where
 
         fn read_enum_variant<T, F>(&mut self, _: &[&str],
                                    mut f: F) -> DecodeResult<T>
-            where F: FnMut(&mut Decoder<'doc>, uint) -> DecodeResult<T>,
+            where F: FnMut(&mut Decoder<'doc>, usize) -> DecodeResult<T>,
         {
             debug!("read_enum_variant()");
             let idx = try!(self._next_sub());
@@ -687,7 +685,7 @@ fn read_enum_variant<T, F>(&mut self, _: &[&str],
             f(self, idx)
         }
 
-        fn read_enum_variant_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
+        fn read_enum_variant_arg<T, F>(&mut self, idx: usize, f: F) -> DecodeResult<T> where
             F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
         {
             debug!("read_enum_variant_arg(idx={})", idx);
@@ -696,7 +694,7 @@ fn read_enum_variant_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> wh
 
         fn read_enum_struct_variant<T, F>(&mut self, _: &[&str],
                                           mut f: F) -> DecodeResult<T>
-            where F: FnMut(&mut Decoder<'doc>, uint) -> DecodeResult<T>,
+            where F: FnMut(&mut Decoder<'doc>, usize) -> DecodeResult<T>,
         {
             debug!("read_enum_struct_variant()");
             let idx = try!(self._next_sub());
@@ -707,7 +705,7 @@ fn read_enum_struct_variant<T, F>(&mut self, _: &[&str],
 
         fn read_enum_struct_variant_field<T, F>(&mut self,
                                                 name: &str,
-                                                idx: uint,
+                                                idx: usize,
                                                 f: F)
                                                 -> DecodeResult<T> where
             F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
@@ -716,21 +714,21 @@ fn read_enum_struct_variant_field<T, F>(&mut self,
             f(self)
         }
 
-        fn read_struct<T, F>(&mut self, name: &str, _: uint, f: F) -> DecodeResult<T> where
+        fn read_struct<T, F>(&mut self, name: &str, _: usize, f: F) -> DecodeResult<T> where
             F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
         {
             debug!("read_struct(name={})", name);
             f(self)
         }
 
-        fn read_struct_field<T, F>(&mut self, name: &str, idx: uint, f: F) -> DecodeResult<T> where
+        fn read_struct_field<T, F>(&mut self, name: &str, idx: usize, f: F) -> DecodeResult<T> where
             F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
         {
             debug!("read_struct_field(name={}, idx={})", name, idx);
             f(self)
         }
 
-        fn read_tuple<T, F>(&mut self, tuple_len: uint, f: F) -> DecodeResult<T> where
+        fn read_tuple<T, F>(&mut self, tuple_len: usize, f: F) -> DecodeResult<T> where
             F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
         {
             debug!("read_tuple()");
@@ -744,14 +742,14 @@ fn read_tuple<T, F>(&mut self, tuple_len: uint, f: F) -> DecodeResult<T> where
             })
         }
 
-        fn read_tuple_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
+        fn read_tuple_arg<T, F>(&mut self, idx: usize, f: F) -> DecodeResult<T> where
             F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
         {
             debug!("read_tuple_arg(idx={})", idx);
             self.read_seq_elt(idx, f)
         }
 
-        fn read_tuple_struct<T, F>(&mut self, name: &str, len: uint, f: F) -> DecodeResult<T> where
+        fn read_tuple_struct<T, F>(&mut self, name: &str, len: usize, f: F) -> DecodeResult<T> where
             F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
         {
             debug!("read_tuple_struct(name={})", name);
@@ -759,7 +757,7 @@ fn read_tuple_struct<T, F>(&mut self, name: &str, len: uint, f: F) -> DecodeResu
         }
 
         fn read_tuple_struct_arg<T, F>(&mut self,
-                                       idx: uint,
+                                       idx: usize,
                                        f: F)
                                        -> DecodeResult<T> where
             F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
@@ -786,7 +784,7 @@ fn read_option<T, F>(&mut self, mut f: F) -> DecodeResult<T> where
         }
 
         fn read_seq<T, F>(&mut self, f: F) -> DecodeResult<T> where
-            F: FnOnce(&mut Decoder<'doc>, uint) -> DecodeResult<T>,
+            F: FnOnce(&mut Decoder<'doc>, usize) -> DecodeResult<T>,
         {
             debug!("read_seq()");
             self.push_doc(EsVec, move |d| {
@@ -796,7 +794,7 @@ fn read_seq<T, F>(&mut self, f: F) -> DecodeResult<T> where
             })
         }
 
-        fn read_seq_elt<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
+        fn read_seq_elt<T, F>(&mut self, idx: usize, f: F) -> DecodeResult<T> where
             F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
         {
             debug!("read_seq_elt(idx={})", idx);
@@ -804,7 +802,7 @@ fn read_seq_elt<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
         }
 
         fn read_map<T, F>(&mut self, f: F) -> DecodeResult<T> where
-            F: FnOnce(&mut Decoder<'doc>, uint) -> DecodeResult<T>,
+            F: FnOnce(&mut Decoder<'doc>, usize) -> DecodeResult<T>,
         {
             debug!("read_map()");
             self.push_doc(EsMap, move |d| {
@@ -814,14 +812,14 @@ fn read_map<T, F>(&mut self, f: F) -> DecodeResult<T> where
             })
         }
 
-        fn read_map_elt_key<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
+        fn read_map_elt_key<T, F>(&mut self, idx: usize, f: F) -> DecodeResult<T> where
             F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
         {
             debug!("read_map_elt_key(idx={})", idx);
             self.push_doc(EsMapKey, f)
         }
 
-        fn read_map_elt_val<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
+        fn read_map_elt_val<T, F>(&mut self, idx: usize, f: F) -> DecodeResult<T> where
             F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
         {
             debug!("read_map_elt_val(idx={})", idx);
@@ -836,7 +834,6 @@ fn error(&mut self, err: &str) -> Error {
 
 pub mod writer {
     use std::mem;
-    use std::num::Int;
     use std::io::prelude::*;
     use std::io::{self, SeekFrom, Cursor};
     use std::slice::bytes;
@@ -859,7 +856,7 @@ pub struct Encoder<'a> {
         relax_limit: u64, // do not move encoded bytes before this position
     }
 
-    fn write_tag<W: Write>(w: &mut W, n: uint) -> EncodeResult {
+    fn write_tag<W: Write>(w: &mut W, n: usize) -> EncodeResult {
         if n < 0xf0 {
             w.write_all(&[n as u8])
         } else if 0x100 <= n && n < NUM_TAGS {
@@ -870,7 +867,7 @@ fn write_tag<W: Write>(w: &mut W, n: uint) -> EncodeResult {
         }
     }
 
-    fn write_sized_vuint<W: Write>(w: &mut W, n: uint, size: uint) -> EncodeResult {
+    fn write_sized_vuint<W: Write>(w: &mut W, n: usize, size: usize) -> EncodeResult {
         match size {
             1 => w.write_all(&[0x80 | (n as u8)]),
             2 => w.write_all(&[0x40 | ((n >> 8) as u8), n as u8]),
@@ -879,16 +876,16 @@ fn write_sized_vuint<W: Write>(w: &mut W, n: uint, size: uint) -> EncodeResult {
             4 => w.write_all(&[0x10 | ((n >> 24) as u8), (n >> 16) as u8,
                             (n >> 8) as u8, n as u8]),
             _ => Err(io::Error::new(io::ErrorKind::Other,
-                                    "int too big", Some(n.to_string())))
+                                    "isize too big", Some(n.to_string())))
         }
     }
 
-    fn write_vuint<W: Write>(w: &mut W, n: uint) -> EncodeResult {
+    fn write_vuint<W: Write>(w: &mut W, n: usize) -> EncodeResult {
         if n < 0x7f { return write_sized_vuint(w, n, 1); }
         if n < 0x4000 { return write_sized_vuint(w, n, 2); }
         if n < 0x200000 { return write_sized_vuint(w, n, 3); }
         if n < 0x10000000 { return write_sized_vuint(w, n, 4); }
-        Err(io::Error::new(io::ErrorKind::Other, "int too big",
+        Err(io::Error::new(io::ErrorKind::Other, "isize too big",
                            Some(n.to_string())))
     }
 
@@ -910,7 +907,7 @@ pub unsafe fn unsafe_clone(&self) -> Encoder<'a> {
             }
         }
 
-        pub fn start_tag(&mut self, tag_id: uint) -> EncodeResult {
+        pub fn start_tag(&mut self, tag_id: usize) -> EncodeResult {
             debug!("Start tag {:?}", tag_id);
             assert!(tag_id >= NUM_IMPLICIT_TAGS);
 
@@ -932,14 +929,14 @@ pub fn end_tag(&mut self) -> EncodeResult {
 
             // relax the size encoding for small tags (bigger tags are costly to move).
             // we should never try to move the stable positions, however.
-            const RELAX_MAX_SIZE: uint = 0x100;
+            const RELAX_MAX_SIZE: usize = 0x100;
             if size <= RELAX_MAX_SIZE && last_size_pos >= self.relax_limit {
                 // we can't alter the buffer in place, so have a temporary buffer
                 let mut buf = [0u8; RELAX_MAX_SIZE];
                 {
                     let last_size_pos = last_size_pos as usize;
-                    let data = &self.writer.get_ref()[last_size_pos+4..cur_pos as uint];
-                    bytes::copy_memory(&mut buf, data);
+                    let data = &self.writer.get_ref()[last_size_pos+4..cur_pos as usize];
+                    bytes::copy_memory(data, &mut buf);
                 }
 
                 // overwrite the size and data and continue
@@ -955,7 +952,7 @@ pub fn end_tag(&mut self) -> EncodeResult {
             Ok(())
         }
 
-        pub fn wr_tag<F>(&mut self, tag_id: uint, blk: F) -> EncodeResult where
+        pub fn wr_tag<F>(&mut self, tag_id: usize, blk: F) -> EncodeResult where
             F: FnOnce() -> EncodeResult,
         {
             try!(self.start_tag(tag_id));
@@ -963,90 +960,90 @@ pub fn wr_tag<F>(&mut self, tag_id: uint, blk: F) -> EncodeResult where
             self.end_tag()
         }
 
-        pub fn wr_tagged_bytes(&mut self, tag_id: uint, b: &[u8]) -> EncodeResult {
+        pub fn wr_tagged_bytes(&mut self, tag_id: usize, b: &[u8]) -> EncodeResult {
             assert!(tag_id >= NUM_IMPLICIT_TAGS);
             try!(write_tag(self.writer, tag_id));
             try!(write_vuint(self.writer, b.len()));
             self.writer.write_all(b)
         }
 
-        pub fn wr_tagged_u64(&mut self, tag_id: uint, v: u64) -> EncodeResult {
+        pub fn wr_tagged_u64(&mut self, tag_id: usize, v: u64) -> EncodeResult {
             let bytes: [u8; 8] = unsafe { mem::transmute(v.to_be()) };
             self.wr_tagged_bytes(tag_id, &bytes)
         }
 
-        pub fn wr_tagged_u32(&mut self, tag_id: uint, v: u32)  -> EncodeResult{
+        pub fn wr_tagged_u32(&mut self, tag_id: usize, v: u32)  -> EncodeResult{
             let bytes: [u8; 4] = unsafe { mem::transmute(v.to_be()) };
             self.wr_tagged_bytes(tag_id, &bytes)
         }
 
-        pub fn wr_tagged_u16(&mut self, tag_id: uint, v: u16) -> EncodeResult {
+        pub fn wr_tagged_u16(&mut self, tag_id: usize, v: u16) -> EncodeResult {
             let bytes: [u8; 2] = unsafe { mem::transmute(v.to_be()) };
             self.wr_tagged_bytes(tag_id, &bytes)
         }
 
-        pub fn wr_tagged_u8(&mut self, tag_id: uint, v: u8) -> EncodeResult {
+        pub fn wr_tagged_u8(&mut self, tag_id: usize, v: u8) -> EncodeResult {
             self.wr_tagged_bytes(tag_id, &[v])
         }
 
-        pub fn wr_tagged_i64(&mut self, tag_id: uint, v: i64) -> EncodeResult {
+        pub fn wr_tagged_i64(&mut self, tag_id: usize, v: i64) -> EncodeResult {
             self.wr_tagged_u64(tag_id, v as u64)
         }
 
-        pub fn wr_tagged_i32(&mut self, tag_id: uint, v: i32) -> EncodeResult {
+        pub fn wr_tagged_i32(&mut self, tag_id: usize, v: i32) -> EncodeResult {
             self.wr_tagged_u32(tag_id, v as u32)
         }
 
-        pub fn wr_tagged_i16(&mut self, tag_id: uint, v: i16) -> EncodeResult {
+        pub fn wr_tagged_i16(&mut self, tag_id: usize, v: i16) -> EncodeResult {
             self.wr_tagged_u16(tag_id, v as u16)
         }
 
-        pub fn wr_tagged_i8(&mut self, tag_id: uint, v: i8) -> EncodeResult {
+        pub fn wr_tagged_i8(&mut self, tag_id: usize, v: i8) -> EncodeResult {
             self.wr_tagged_bytes(tag_id, &[v as u8])
         }
 
-        pub fn wr_tagged_str(&mut self, tag_id: uint, v: &str) -> EncodeResult {
+        pub fn wr_tagged_str(&mut self, tag_id: usize, v: &str) -> EncodeResult {
             self.wr_tagged_bytes(tag_id, v.as_bytes())
         }
 
         // for auto-serialization
-        fn wr_tagged_raw_bytes(&mut self, tag_id: uint, b: &[u8]) -> EncodeResult {
+        fn wr_tagged_raw_bytes(&mut self, tag_id: usize, b: &[u8]) -> EncodeResult {
             try!(write_tag(self.writer, tag_id));
             self.writer.write_all(b)
         }
 
-        fn wr_tagged_raw_u64(&mut self, tag_id: uint, v: u64) -> EncodeResult {
+        fn wr_tagged_raw_u64(&mut self, tag_id: usize, v: u64) -> EncodeResult {
             let bytes: [u8; 8] = unsafe { mem::transmute(v.to_be()) };
             self.wr_tagged_raw_bytes(tag_id, &bytes)
         }
 
-        fn wr_tagged_raw_u32(&mut self, tag_id: uint, v: u32)  -> EncodeResult{
+        fn wr_tagged_raw_u32(&mut self, tag_id: usize, v: u32)  -> EncodeResult{
             let bytes: [u8; 4] = unsafe { mem::transmute(v.to_be()) };
             self.wr_tagged_raw_bytes(tag_id, &bytes)
         }
 
-        fn wr_tagged_raw_u16(&mut self, tag_id: uint, v: u16) -> EncodeResult {
+        fn wr_tagged_raw_u16(&mut self, tag_id: usize, v: u16) -> EncodeResult {
             let bytes: [u8; 2] = unsafe { mem::transmute(v.to_be()) };
             self.wr_tagged_raw_bytes(tag_id, &bytes)
         }
 
-        fn wr_tagged_raw_u8(&mut self, tag_id: uint, v: u8) -> EncodeResult {
+        fn wr_tagged_raw_u8(&mut self, tag_id: usize, v: u8) -> EncodeResult {
             self.wr_tagged_raw_bytes(tag_id, &[v])
         }
 
-        fn wr_tagged_raw_i64(&mut self, tag_id: uint, v: i64) -> EncodeResult {
+        fn wr_tagged_raw_i64(&mut self, tag_id: usize, v: i64) -> EncodeResult {
             self.wr_tagged_raw_u64(tag_id, v as u64)
         }
 
-        fn wr_tagged_raw_i32(&mut self, tag_id: uint, v: i32) -> EncodeResult {
+        fn wr_tagged_raw_i32(&mut self, tag_id: usize, v: i32) -> EncodeResult {
             self.wr_tagged_raw_u32(tag_id, v as u32)
         }
 
-        fn wr_tagged_raw_i16(&mut self, tag_id: uint, v: i16) -> EncodeResult {
+        fn wr_tagged_raw_i16(&mut self, tag_id: usize, v: i16) -> EncodeResult {
             self.wr_tagged_raw_u16(tag_id, v as u16)
         }
 
-        fn wr_tagged_raw_i8(&mut self, tag_id: uint, v: i8) -> EncodeResult {
+        fn wr_tagged_raw_i8(&mut self, tag_id: usize, v: i8) -> EncodeResult {
             self.wr_tagged_raw_bytes(tag_id, &[v as u8])
         }
 
@@ -1073,11 +1070,11 @@ pub fn mark_stable_position(&mut self) -> u64 {
 
     impl<'a> Encoder<'a> {
         // used internally to emit things like the vector length and so on
-        fn _emit_tagged_sub(&mut self, v: uint) -> EncodeResult {
+        fn _emit_tagged_sub(&mut self, v: usize) -> EncodeResult {
             if let Some(v) = v.to_u8() {
-                self.wr_tagged_raw_u8(EsSub8 as uint, v)
+                self.wr_tagged_raw_u8(EsSub8 as usize, v)
             } else if let Some(v) = v.to_u32() {
-                self.wr_tagged_raw_u32(EsSub32 as uint, v)
+                self.wr_tagged_raw_u32(EsSub32 as usize, v)
             } else {
                 Err(io::Error::new(io::ErrorKind::Other,
                                    "length or variant id too big",
@@ -1088,7 +1085,7 @@ fn _emit_tagged_sub(&mut self, v: uint) -> EncodeResult {
         pub fn emit_opaque<F>(&mut self, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder) -> EncodeResult,
         {
-            try!(self.start_tag(EsOpaque as uint));
+            try!(self.start_tag(EsOpaque as usize));
             try!(f(self));
             self.end_tag()
         }
@@ -1101,88 +1098,88 @@ fn emit_nil(&mut self) -> EncodeResult {
             Ok(())
         }
 
-        fn emit_uint(&mut self, v: uint) -> EncodeResult {
+        fn emit_uint(&mut self, v: usize) -> EncodeResult {
             self.emit_u64(v as u64)
         }
         fn emit_u64(&mut self, v: u64) -> EncodeResult {
             match v.to_u32() {
                 Some(v) => self.emit_u32(v),
-                None => self.wr_tagged_raw_u64(EsU64 as uint, v)
+                None => self.wr_tagged_raw_u64(EsU64 as usize, v)
             }
         }
         fn emit_u32(&mut self, v: u32) -> EncodeResult {
             match v.to_u16() {
                 Some(v) => self.emit_u16(v),
-                None => self.wr_tagged_raw_u32(EsU32 as uint, v)
+                None => self.wr_tagged_raw_u32(EsU32 as usize, v)
             }
         }
         fn emit_u16(&mut self, v: u16) -> EncodeResult {
             match v.to_u8() {
                 Some(v) => self.emit_u8(v),
-                None => self.wr_tagged_raw_u16(EsU16 as uint, v)
+                None => self.wr_tagged_raw_u16(EsU16 as usize, v)
             }
         }
         fn emit_u8(&mut self, v: u8) -> EncodeResult {
-            self.wr_tagged_raw_u8(EsU8 as uint, v)
+            self.wr_tagged_raw_u8(EsU8 as usize, v)
         }
 
-        fn emit_int(&mut self, v: int) -> EncodeResult {
+        fn emit_int(&mut self, v: isize) -> EncodeResult {
             self.emit_i64(v as i64)
         }
         fn emit_i64(&mut self, v: i64) -> EncodeResult {
             match v.to_i32() {
                 Some(v) => self.emit_i32(v),
-                None => self.wr_tagged_raw_i64(EsI64 as uint, v)
+                None => self.wr_tagged_raw_i64(EsI64 as usize, v)
             }
         }
         fn emit_i32(&mut self, v: i32) -> EncodeResult {
             match v.to_i16() {
                 Some(v) => self.emit_i16(v),
-                None => self.wr_tagged_raw_i32(EsI32 as uint, v)
+                None => self.wr_tagged_raw_i32(EsI32 as usize, v)
             }
         }
         fn emit_i16(&mut self, v: i16) -> EncodeResult {
             match v.to_i8() {
                 Some(v) => self.emit_i8(v),
-                None => self.wr_tagged_raw_i16(EsI16 as uint, v)
+                None => self.wr_tagged_raw_i16(EsI16 as usize, v)
             }
         }
         fn emit_i8(&mut self, v: i8) -> EncodeResult {
-            self.wr_tagged_raw_i8(EsI8 as uint, v)
+            self.wr_tagged_raw_i8(EsI8 as usize, v)
         }
 
         fn emit_bool(&mut self, v: bool) -> EncodeResult {
-            self.wr_tagged_raw_u8(EsBool as uint, v as u8)
+            self.wr_tagged_raw_u8(EsBool as usize, v as u8)
         }
 
         fn emit_f64(&mut self, v: f64) -> EncodeResult {
             let bits = unsafe { mem::transmute(v) };
-            self.wr_tagged_raw_u64(EsF64 as uint, bits)
+            self.wr_tagged_raw_u64(EsF64 as usize, bits)
         }
         fn emit_f32(&mut self, v: f32) -> EncodeResult {
             let bits = unsafe { mem::transmute(v) };
-            self.wr_tagged_raw_u32(EsF32 as uint, bits)
+            self.wr_tagged_raw_u32(EsF32 as usize, bits)
         }
         fn emit_char(&mut self, v: char) -> EncodeResult {
-            self.wr_tagged_raw_u32(EsChar as uint, v as u32)
+            self.wr_tagged_raw_u32(EsChar as usize, v as u32)
         }
 
         fn emit_str(&mut self, v: &str) -> EncodeResult {
-            self.wr_tagged_str(EsStr as uint, v)
+            self.wr_tagged_str(EsStr as usize, v)
         }
 
         fn emit_enum<F>(&mut self, _name: &str, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
-            try!(self.start_tag(EsEnum as uint));
+            try!(self.start_tag(EsEnum as usize));
             try!(f(self));
             self.end_tag()
         }
 
         fn emit_enum_variant<F>(&mut self,
                                 _: &str,
-                                v_id: uint,
-                                _: uint,
+                                v_id: usize,
+                                _: usize,
                                 f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
@@ -1190,7 +1187,7 @@ fn emit_enum_variant<F>(&mut self,
             f(self)
         }
 
-        fn emit_enum_variant_arg<F>(&mut self, _: uint, f: F) -> EncodeResult where
+        fn emit_enum_variant_arg<F>(&mut self, _: usize, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
             f(self)
@@ -1198,8 +1195,8 @@ fn emit_enum_variant_arg<F>(&mut self, _: uint, f: F) -> EncodeResult where
 
         fn emit_enum_struct_variant<F>(&mut self,
                                        v_name: &str,
-                                       v_id: uint,
-                                       cnt: uint,
+                                       v_id: usize,
+                                       cnt: usize,
                                        f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
@@ -1208,42 +1205,42 @@ fn emit_enum_struct_variant<F>(&mut self,
 
         fn emit_enum_struct_variant_field<F>(&mut self,
                                              _: &str,
-                                             idx: uint,
+                                             idx: usize,
                                              f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
             self.emit_enum_variant_arg(idx, f)
         }
 
-        fn emit_struct<F>(&mut self, _: &str, _len: uint, f: F) -> EncodeResult where
+        fn emit_struct<F>(&mut self, _: &str, _len: usize, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
             f(self)
         }
 
-        fn emit_struct_field<F>(&mut self, _name: &str, _: uint, f: F) -> EncodeResult where
+        fn emit_struct_field<F>(&mut self, _name: &str, _: usize, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
             f(self)
         }
 
-        fn emit_tuple<F>(&mut self, len: uint, f: F) -> EncodeResult where
+        fn emit_tuple<F>(&mut self, len: usize, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
             self.emit_seq(len, f)
         }
-        fn emit_tuple_arg<F>(&mut self, idx: uint, f: F) -> EncodeResult where
+        fn emit_tuple_arg<F>(&mut self, idx: usize, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
             self.emit_seq_elt(idx, f)
         }
 
-        fn emit_tuple_struct<F>(&mut self, _: &str, len: uint, f: F) -> EncodeResult where
+        fn emit_tuple_struct<F>(&mut self, _: &str, len: usize, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
             self.emit_seq(len, f)
         }
-        fn emit_tuple_struct_arg<F>(&mut self, idx: uint, f: F) -> EncodeResult where
+        fn emit_tuple_struct_arg<F>(&mut self, idx: usize, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
             self.emit_seq_elt(idx, f)
@@ -1264,56 +1261,56 @@ fn emit_option_some<F>(&mut self, f: F) -> EncodeResult where
             self.emit_enum_variant("Some", 1, 1, f)
         }
 
-        fn emit_seq<F>(&mut self, len: uint, f: F) -> EncodeResult where
+        fn emit_seq<F>(&mut self, len: usize, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
             if len == 0 {
                 // empty vector optimization
-                return self.wr_tagged_bytes(EsVec as uint, &[]);
+                return self.wr_tagged_bytes(EsVec as usize, &[]);
             }
 
-            try!(self.start_tag(EsVec as uint));
+            try!(self.start_tag(EsVec as usize));
             try!(self._emit_tagged_sub(len));
             try!(f(self));
             self.end_tag()
         }
 
-        fn emit_seq_elt<F>(&mut self, _idx: uint, f: F) -> EncodeResult where
+        fn emit_seq_elt<F>(&mut self, _idx: usize, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
 
-            try!(self.start_tag(EsVecElt as uint));
+            try!(self.start_tag(EsVecElt as usize));
             try!(f(self));
             self.end_tag()
         }
 
-        fn emit_map<F>(&mut self, len: uint, f: F) -> EncodeResult where
+        fn emit_map<F>(&mut self, len: usize, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
             if len == 0 {
                 // empty map optimization
-                return self.wr_tagged_bytes(EsMap as uint, &[]);
+                return self.wr_tagged_bytes(EsMap as usize, &[]);
             }
 
-            try!(self.start_tag(EsMap as uint));
+            try!(self.start_tag(EsMap as usize));
             try!(self._emit_tagged_sub(len));
             try!(f(self));
             self.end_tag()
         }
 
-        fn emit_map_elt_key<F>(&mut self, _idx: uint, f: F) -> EncodeResult where
+        fn emit_map_elt_key<F>(&mut self, _idx: usize, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
 
-            try!(self.start_tag(EsMapKey as uint));
+            try!(self.start_tag(EsMapKey as usize));
             try!(f(self));
             self.end_tag()
         }
 
-        fn emit_map_elt_val<F>(&mut self, _idx: uint, f: F) -> EncodeResult where
+        fn emit_map_elt_val<F>(&mut self, _idx: usize, f: F) -> EncodeResult where
             F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
         {
-            try!(self.start_tag(EsMapVal as uint));
+            try!(self.start_tag(EsMapVal as usize));
             try!(f(self));
             self.end_tag()
         }
@@ -1381,7 +1378,7 @@ fn test_vuint_at() {
 
     #[test]
     fn test_option_int() {
-        fn test_v(v: Option<int>) {
+        fn test_v(v: Option<isize>) {
             debug!("v == {:?}", v);
             let mut wr = Cursor::new(Vec::new());
             {
index e8af07e43815919ef4a23410a662770d90047409..f31f8e8d4ce2708894ccf804ffaac8c1aee544a7 100644 (file)
@@ -30,9 +30,7 @@
 #![feature(collections)]
 #![feature(core)]
 #![feature(hash)]
-#![feature(int_uint)]
 #![feature(libc)]
-#![feature(old_path)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
 #![feature(str_char)]
 #![feature(convert)]
 #![feature(into_cow)]
+#![feature(slice_patterns)]
 #![cfg_attr(test, feature(test))]
 
 #![allow(trivial_casts)]
-#![allow(trivial_numeric_casts)]
 
 extern crate arena;
 extern crate flate;
@@ -65,7 +63,7 @@
 #[macro_use] extern crate syntax;
 #[macro_use] #[no_link] extern crate rustc_bitflags;
 
-extern crate "serialize" as rustc_serialize; // used by deriving
+extern crate serialize as rustc_serialize; // used by deriving
 
 #[cfg(test)]
 extern crate test;
index 2cc47f258f0764db771e1a7dd1feb00b51e9f092..9093cd00ca0014d4b729239ca382c95f055bd282 100644 (file)
 
 declare_lint! {
     pub TRIVIAL_CASTS,
-    Warn,
+    Allow,
     "detects trivial casts which could be removed"
 }
 
 declare_lint! {
     pub TRIVIAL_NUMERIC_CASTS,
-    Warn,
+    Allow,
     "detects trivial casts of numeric types which could be removed"
 }
 /// Does nothing as a lint pass, but registers some `Lint`s
index 081c64ecae88102920ea0bbaa03e0b4a57d16422..e4c0eda0448bdae443eeaeed4503b5dee84ff8d8 100644 (file)
 // 0xf0..0xff: internally used by RBML to encode 0x100..0xfff in two bytes
 // 0x100..0xfff: free for use, preferred for infrequent tags
 
-pub const tag_items: uint = 0x100; // top-level only
+pub const tag_items: usize = 0x100; // top-level only
 
-pub const tag_paths_data_name: uint = 0x20;
+pub const tag_paths_data_name: usize = 0x20;
 
-pub const tag_def_id: uint = 0x21;
+pub const tag_def_id: usize = 0x21;
 
-pub const tag_items_data: uint = 0x22;
+pub const tag_items_data: usize = 0x22;
 
-pub const tag_items_data_item: uint = 0x23;
+pub const tag_items_data_item: usize = 0x23;
 
-pub const tag_items_data_item_family: uint = 0x24;
+pub const tag_items_data_item_family: usize = 0x24;
 
-pub const tag_items_data_item_type: uint = 0x25;
+pub const tag_items_data_item_type: usize = 0x25;
 
-pub const tag_items_data_item_symbol: uint = 0x26;
+pub const tag_items_data_item_symbol: usize = 0x26;
 
-pub const tag_items_data_item_variant: uint = 0x27;
+pub const tag_items_data_item_variant: usize = 0x27;
 
-pub const tag_items_data_parent_item: uint = 0x28;
+pub const tag_items_data_parent_item: usize = 0x28;
 
-pub const tag_items_data_item_is_tuple_struct_ctor: uint = 0x29;
+pub const tag_items_data_item_is_tuple_struct_ctor: usize = 0x29;
 
-pub const tag_index: uint = 0x2a;
+pub const tag_index: usize = 0x2a;
 
-pub const tag_index_buckets: uint = 0x2b;
+pub const tag_index_buckets: usize = 0x2b;
 
-pub const tag_index_buckets_bucket: uint = 0x2c;
+pub const tag_index_buckets_bucket: usize = 0x2c;
 
-pub const tag_index_buckets_bucket_elt: uint = 0x2d;
+pub const tag_index_buckets_bucket_elt: usize = 0x2d;
 
-pub const tag_index_table: uint = 0x2e;
+pub const tag_index_table: usize = 0x2e;
 
-pub const tag_meta_item_name_value: uint = 0x2f;
+pub const tag_meta_item_name_value: usize = 0x2f;
 
-pub const tag_meta_item_name: uint = 0x30;
+pub const tag_meta_item_name: usize = 0x30;
 
-pub const tag_meta_item_value: uint = 0x31;
+pub const tag_meta_item_value: usize = 0x31;
 
-pub const tag_attributes: uint = 0x101; // top-level only
+pub const tag_attributes: usize = 0x101; // top-level only
 
-pub const tag_attribute: uint = 0x32;
+pub const tag_attribute: usize = 0x32;
 
-pub const tag_meta_item_word: uint = 0x33;
+pub const tag_meta_item_word: usize = 0x33;
 
-pub const tag_meta_item_list: uint = 0x34;
+pub const tag_meta_item_list: usize = 0x34;
 
 // The list of crates that this crate depends on
-pub const tag_crate_deps: uint = 0x102; // top-level only
+pub const tag_crate_deps: usize = 0x102; // top-level only
 
 // A single crate dependency
-pub const tag_crate_dep: uint = 0x35;
+pub const tag_crate_dep: usize = 0x35;
 
-pub const tag_crate_hash: uint = 0x103; // top-level only
-pub const tag_crate_crate_name: uint = 0x104; // top-level only
+pub const tag_crate_hash: usize = 0x103; // top-level only
+pub const tag_crate_crate_name: usize = 0x104; // top-level only
 
-pub const tag_crate_dep_crate_name: uint = 0x36;
-pub const tag_crate_dep_hash: uint = 0x37;
+pub const tag_crate_dep_crate_name: usize = 0x36;
+pub const tag_crate_dep_hash: usize = 0x37;
 
-pub const tag_mod_impl: uint = 0x38;
+pub const tag_mod_impl: usize = 0x38;
 
-pub const tag_item_trait_item: uint = 0x39;
+pub const tag_item_trait_item: usize = 0x39;
 
-pub const tag_item_trait_ref: uint = 0x3a;
+pub const tag_item_trait_ref: usize = 0x3a;
 
 // discriminator value for variants
-pub const tag_disr_val: uint = 0x3c;
+pub const tag_disr_val: usize = 0x3c;
 
 // used to encode ast_map::PathElem
-pub const tag_path: uint = 0x3d;
-pub const tag_path_len: uint = 0x3e;
-pub const tag_path_elem_mod: uint = 0x3f;
-pub const tag_path_elem_name: uint = 0x40;
-pub const tag_item_field: uint = 0x41;
-pub const tag_item_field_origin: uint = 0x42;
-
-pub const tag_item_variances: uint = 0x43;
+pub const tag_path: usize = 0x3d;
+pub const tag_path_len: usize = 0x3e;
+pub const tag_path_elem_mod: usize = 0x3f;
+pub const tag_path_elem_name: usize = 0x40;
+pub const tag_item_field: usize = 0x41;
+pub const tag_item_field_origin: usize = 0x42;
+
+pub const tag_item_variances: usize = 0x43;
 /*
   trait items contain tag_item_trait_item elements,
   impl items contain tag_item_impl_item elements, and classes
@@ -105,19 +105,19 @@ impl items contain tag_item_impl_item elements, and classes
   both, tag_item_trait_item and tag_item_impl_item have to be two
   different tags.
  */
-pub const tag_item_impl_item: uint = 0x44;
-pub const tag_item_trait_method_explicit_self: uint = 0x45;
+pub const tag_item_impl_item: usize = 0x44;
+pub const tag_item_trait_method_explicit_self: usize = 0x45;
 
 
 // Reexports are found within module tags. Each reexport contains def_ids
 // and names.
-pub const tag_items_data_item_reexport: uint = 0x46;
-pub const tag_items_data_item_reexport_def_id: uint = 0x47;
-pub const tag_items_data_item_reexport_name: uint = 0x48;
+pub const tag_items_data_item_reexport: usize = 0x46;
+pub const tag_items_data_item_reexport_def_id: usize = 0x47;
+pub const tag_items_data_item_reexport_name: usize = 0x48;
 
 // used to encode crate_ctxt side tables
 #[derive(Copy, PartialEq, FromPrimitive)]
-#[repr(uint)]
+#[repr(usize)]
 pub enum astencode_tag { // Reserves 0x50 -- 0x6f
     tag_ast = 0x50,
 
@@ -149,15 +149,15 @@ pub enum astencode_tag { // Reserves 0x50 -- 0x6f
     tag_table_const_qualif = 0x69,
 }
 
-pub const tag_item_trait_item_sort: uint = 0x70;
+pub const tag_item_trait_item_sort: usize = 0x70;
 
-pub const tag_item_trait_parent_sort: uint = 0x71;
+pub const tag_item_trait_parent_sort: usize = 0x71;
 
-pub const tag_item_impl_type_basename: uint = 0x72;
+pub const tag_item_impl_type_basename: usize = 0x72;
 
-pub const tag_crate_triple: uint = 0x105; // top-level only
+pub const tag_crate_triple: usize = 0x105; // top-level only
 
-pub const tag_dylib_dependency_formats: uint = 0x106; // top-level only
+pub const tag_dylib_dependency_formats: usize = 0x106; // top-level only
 
 // Language items are a top-level directory (for speed). Hierarchy:
 //
@@ -166,47 +166,47 @@ pub enum astencode_tag { // Reserves 0x50 -- 0x6f
 //   - tag_lang_items_item_id: u32
 //   - tag_lang_items_item_node_id: u32
 
-pub const tag_lang_items: uint = 0x107; // top-level only
-pub const tag_lang_items_item: uint = 0x73;
-pub const tag_lang_items_item_id: uint = 0x74;
-pub const tag_lang_items_item_node_id: uint = 0x75;
-pub const tag_lang_items_missing: uint = 0x76;
+pub const tag_lang_items: usize = 0x107; // top-level only
+pub const tag_lang_items_item: usize = 0x73;
+pub const tag_lang_items_item_id: usize = 0x74;
+pub const tag_lang_items_item_node_id: usize = 0x75;
+pub const tag_lang_items_missing: usize = 0x76;
 
-pub const tag_item_unnamed_field: uint = 0x77;
-pub const tag_items_data_item_visibility: uint = 0x78;
+pub const tag_item_unnamed_field: usize = 0x77;
+pub const tag_items_data_item_visibility: usize = 0x78;
 
-pub const tag_item_method_tps: uint = 0x79;
-pub const tag_item_method_fty: uint = 0x7a;
+pub const tag_item_method_tps: usize = 0x79;
+pub const tag_item_method_fty: usize = 0x7a;
 
-pub const tag_mod_child: uint = 0x7b;
-pub const tag_misc_info: uint = 0x108; // top-level only
-pub const tag_misc_info_crate_items: uint = 0x7c;
+pub const tag_mod_child: usize = 0x7b;
+pub const tag_misc_info: usize = 0x108; // top-level only
+pub const tag_misc_info_crate_items: usize = 0x7c;
 
-pub const tag_item_method_provided_source: uint = 0x7d;
-pub const tag_item_impl_vtables: uint = 0x7e;
+pub const tag_item_method_provided_source: usize = 0x7d;
+pub const tag_item_impl_vtables: usize = 0x7e;
 
-pub const tag_impls: uint = 0x109; // top-level only
-pub const tag_impls_impl: uint = 0x7f;
+pub const tag_impls: usize = 0x109; // top-level only
+pub const tag_impls_impl: usize = 0x7f;
 
-pub const tag_items_data_item_inherent_impl: uint = 0x80;
-pub const tag_items_data_item_extension_impl: uint = 0x81;
+pub const tag_items_data_item_inherent_impl: usize = 0x80;
+pub const tag_items_data_item_extension_impl: usize = 0x81;
 
-pub const tag_native_libraries: uint = 0x10a; // top-level only
-pub const tag_native_libraries_lib: uint = 0x82;
-pub const tag_native_libraries_name: uint = 0x83;
-pub const tag_native_libraries_kind: uint = 0x84;
+pub const tag_native_libraries: usize = 0x10a; // top-level only
+pub const tag_native_libraries_lib: usize = 0x82;
+pub const tag_native_libraries_name: usize = 0x83;
+pub const tag_native_libraries_kind: usize = 0x84;
 
-pub const tag_plugin_registrar_fn: uint = 0x10b; // top-level only
+pub const tag_plugin_registrar_fn: usize = 0x10b; // top-level only
 
-pub const tag_method_argument_names: uint = 0x85;
-pub const tag_method_argument_name: uint = 0x86;
+pub const tag_method_argument_names: usize = 0x85;
+pub const tag_method_argument_name: usize = 0x86;
 
-pub const tag_reachable_extern_fns: uint = 0x10c; // top-level only
-pub const tag_reachable_extern_fn_id: uint = 0x87;
+pub const tag_reachable_extern_fns: usize = 0x10c; // top-level only
+pub const tag_reachable_extern_fn_id: usize = 0x87;
 
-pub const tag_items_data_item_stability: uint = 0x88;
+pub const tag_items_data_item_stability: usize = 0x88;
 
-pub const tag_items_data_item_repr: uint = 0x89;
+pub const tag_items_data_item_repr: usize = 0x89;
 
 #[derive(Clone, Debug)]
 pub struct LinkMeta {
@@ -214,45 +214,45 @@ pub struct LinkMeta {
     pub crate_hash: Svh,
 }
 
-pub const tag_struct_fields: uint = 0x10d; // top-level only
-pub const tag_struct_field: uint = 0x8a;
-pub const tag_struct_field_id: uint = 0x8b;
+pub const tag_struct_fields: usize = 0x10d; // top-level only
+pub const tag_struct_field: usize = 0x8a;
+pub const tag_struct_field_id: usize = 0x8b;
 
-pub const tag_attribute_is_sugared_doc: uint = 0x8c;
+pub const tag_attribute_is_sugared_doc: usize = 0x8c;
 
-pub const tag_items_data_region: uint = 0x8e;
+pub const tag_items_data_region: usize = 0x8e;
 
-pub const tag_region_param_def: uint = 0x8f;
-pub const tag_region_param_def_ident: uint = 0x90;
-pub const tag_region_param_def_def_id: uint = 0x91;
-pub const tag_region_param_def_space: uint = 0x92;
-pub const tag_region_param_def_index: uint = 0x93;
+pub const tag_region_param_def: usize = 0x8f;
+pub const tag_region_param_def_ident: usize = 0x90;
+pub const tag_region_param_def_def_id: usize = 0x91;
+pub const tag_region_param_def_space: usize = 0x92;
+pub const tag_region_param_def_index: usize = 0x93;
 
-pub const tag_type_param_def: uint = 0x94;
+pub const tag_type_param_def: usize = 0x94;
 
-pub const tag_item_generics: uint = 0x95;
-pub const tag_method_ty_generics: uint = 0x96;
+pub const tag_item_generics: usize = 0x95;
+pub const tag_method_ty_generics: usize = 0x96;
 
-pub const tag_predicate: uint = 0x97;
-pub const tag_predicate_space: uint = 0x98;
-pub const tag_predicate_data: uint = 0x99;
+pub const tag_predicate: usize = 0x97;
+pub const tag_predicate_space: usize = 0x98;
+pub const tag_predicate_data: usize = 0x99;
 
-pub const tag_unsafety: uint = 0x9a;
+pub const tag_unsafety: usize = 0x9a;
 
-pub const tag_associated_type_names: uint = 0x9b;
-pub const tag_associated_type_name: uint = 0x9c;
+pub const tag_associated_type_names: usize = 0x9b;
+pub const tag_associated_type_name: usize = 0x9c;
 
-pub const tag_polarity: uint = 0x9d;
+pub const tag_polarity: usize = 0x9d;
 
-pub const tag_macro_defs: uint = 0x10e; // top-level only
-pub const tag_macro_def: uint = 0x9e;
-pub const tag_macro_def_body: uint = 0x9f;
+pub const tag_macro_defs: usize = 0x10e; // top-level only
+pub const tag_macro_def: usize = 0x9e;
+pub const tag_macro_def_body: usize = 0x9f;
 
-pub const tag_paren_sugar: uint = 0xa0;
+pub const tag_paren_sugar: usize = 0xa0;
 
-pub const tag_codemap: uint = 0xa1;
-pub const tag_codemap_filemap: uint = 0xa2;
+pub const tag_codemap: usize = 0xa1;
+pub const tag_codemap_filemap: usize = 0xa2;
 
-pub const tag_item_super_predicates: uint = 0xa3;
+pub const tag_item_super_predicates: usize = 0xa3;
 
-pub const tag_defaulted_trait: uint = 0xa4;
+pub const tag_defaulted_trait: usize = 0xa4;
index 7d8789c3cd1a81873f6a32c5ecb25781a6bbe9af..b6a8525675e456c64afad6b7c8ee895eebb3d948 100644 (file)
@@ -73,24 +73,20 @@ struct CrateInfo {
 }
 
 pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
-    let say = |s: &str, warn: bool| {
+    let say = |s: &str| {
         match (sp, sess) {
             (_, None) => panic!("{}", s),
-            (Some(sp), Some(sess)) if warn => sess.span_warn(sp, s),
             (Some(sp), Some(sess)) => sess.span_err(sp, s),
-            (None, Some(sess)) if warn => sess.warn(s),
             (None, Some(sess)) => sess.err(s),
         }
     };
     if s.len() == 0 {
-        say("crate name must not be empty", false);
-    } else if s.contains("-") {
-        say(&format!("crate names soon cannot contain hyphens: {}", s), true);
+        say("crate name must not be empty");
     }
     for c in s.chars() {
         if c.is_alphanumeric() { continue }
-        if c == '_' || c == '-' { continue }
-        say(&format!("invalid character `{}` in crate name: `{}`", c, s), false);
+        if c == '_'  { continue }
+        say(&format!("invalid character `{}` in crate name: `{}`", c, s));
     }
     match sess {
         Some(sess) => sess.abort_if_errors(),
@@ -306,13 +302,7 @@ fn existing_match(&self, name: &str, hash: Option<&Svh>, kind: PathKind)
                       -> Option<ast::CrateNum> {
         let mut ret = None;
         self.sess.cstore.iter_crate_data(|cnum, data| {
-            // For now we do a "fuzzy match" on crate names by considering
-            // hyphens equal to underscores. This is purely meant to be a
-            // transitionary feature while we deprecate the quote syntax of
-            // `extern crate` statements.
-            if data.name != name.replace("-", "_") {
-                return
-            }
+            if data.name != name { return }
 
             match hash {
                 Some(hash) if *hash == data.hash() => { ret = Some(cnum); return }
index ca8ae83ab80a80e976ed1af1931fa5cd7ba15870..ebc3a6fd52c939b0afaf4b9004970f9450314bd5 100644 (file)
@@ -46,7 +46,7 @@ pub fn each_lang_item<F>(cstore: &cstore::CStore,
                          cnum: ast::CrateNum,
                          f: F)
                          -> bool where
-    F: FnMut(ast::NodeId, uint) -> bool,
+    F: FnMut(ast::NodeId, usize) -> bool,
 {
     let crate_data = cstore.get_crate_data(cnum);
     decoder::each_lang_item(&*crate_data, f)
index f201ff374ea0f058db497bebce436a4dc34d06ea..811aa21a0b7b986ce8888cf73b83ad0ed2a25184 100644 (file)
@@ -252,7 +252,7 @@ pub fn as_slice<'a>(&'a self) -> &'a [u8] {
             let len = (((slice[0] as u32) << 24) |
                        ((slice[1] as u32) << 16) |
                        ((slice[2] as u32) << 8) |
-                       ((slice[3] as u32) << 0)) as uint;
+                       ((slice[3] as u32) << 0)) as usize;
             if len + 4 <= slice.len() {
                 &slice[4.. len + 4]
             } else {
index c0bad80ab594aa74dd6c505a3482745129bedf39..92810b407f039dde41f2dc16ee97e6878585ed43 100644 (file)
@@ -35,7 +35,7 @@
 use std::hash::{self, Hash, SipHasher};
 use std::io::prelude::*;
 use std::io;
-use std::num::{FromPrimitive, Int};
+use std::num::FromPrimitive;
 use std::rc::Rc;
 use std::slice::bytes;
 use std::str;
@@ -62,7 +62,7 @@
 
 fn u32_from_be_bytes(bytes: &[u8]) -> u32 {
     let mut b = [0; 4];
-    bytes::copy_memory(&mut b, &bytes[..4]);
+    bytes::copy_memory(&bytes[..4], &mut b);
     unsafe { (*(b.as_ptr() as *const u32)).to_be() }
 }
 
@@ -71,15 +71,15 @@ fn lookup_hash<'a, F>(d: rbml::Doc<'a>, mut eq_fn: F, hash: u64) -> Option<rbml:
 {
     let index = reader::get_doc(d, tag_index);
     let table = reader::get_doc(index, tag_index_table);
-    let hash_pos = table.start + (hash % 256 * 4) as uint;
-    let pos = u32_from_be_bytes(&d.data[hash_pos..]) as uint;
+    let hash_pos = table.start + (hash % 256 * 4) as usize;
+    let pos = u32_from_be_bytes(&d.data[hash_pos..]) as usize;
     let tagged_doc = reader::doc_at(d.data, pos).unwrap();
 
     let belt = tag_index_buckets_bucket_elt;
 
     let mut ret = None;
     reader::tagged_docs(tagged_doc.doc, belt, |elt| {
-        let pos = u32_from_be_bytes(&elt.data[elt.start..]) as uint;
+        let pos = u32_from_be_bytes(&elt.data[elt.start..]) as usize;
         if eq_fn(&elt.data[elt.start + 4 .. elt.end]) {
             ret = Some(reader::doc_at(d.data, pos).unwrap().doc);
             false
@@ -274,7 +274,7 @@ fn item_path(item_doc: rbml::Doc) -> Vec<ast_map::PathElem> {
     let path_doc = reader::get_doc(item_doc, tag_path);
 
     let len_doc = reader::get_doc(path_doc, tag_path_len);
-    let len = reader::doc_as_u32(len_doc) as uint;
+    let len = reader::doc_as_u32(len_doc) as usize;
 
     let mut result = Vec::with_capacity(len);
     reader::docs(path_doc, |tag, elt_doc| {
@@ -513,13 +513,13 @@ pub enum DefLike {
 
 /// Iterates over the language items in the given crate.
 pub fn each_lang_item<F>(cdata: Cmd, mut f: F) -> bool where
-    F: FnMut(ast::NodeId, uint) -> bool,
+    F: FnMut(ast::NodeId, usize) -> bool,
 {
     let root = rbml::Doc::new(cdata.data());
     let lang_items = reader::get_doc(root, tag_lang_items);
     reader::tagged_docs(lang_items, tag_lang_items_item, |item_doc| {
         let id_doc = reader::get_doc(item_doc, tag_lang_items_item_id);
-        let id = reader::doc_as_u32(id_doc) as uint;
+        let id = reader::doc_as_u32(id_doc) as usize;
         let node_id_doc = reader::get_doc(item_doc,
                                           tag_lang_items_item_node_id);
         let node_id = reader::doc_as_u32(node_id_doc) as ast::NodeId;
@@ -1194,7 +1194,7 @@ pub fn get_crate_deps(data: &[u8]) -> Vec<CrateDep> {
     let cratedoc = rbml::Doc::new(data);
     let depsdoc = reader::get_doc(cratedoc, tag_crate_deps);
     let mut crate_num = 1;
-    fn docstr(doc: rbml::Doc, tag_: uint) -> String {
+    fn docstr(doc: rbml::Doc, tag_: usize) -> String {
         let d = reader::get_doc(doc, tag_);
         d.as_str_slice().to_string()
     }
@@ -1454,7 +1454,7 @@ pub fn is_typedef(cdata: Cmd, id: ast::NodeId) -> bool {
 fn doc_generics<'tcx>(base_doc: rbml::Doc,
                       tcx: &ty::ctxt<'tcx>,
                       cdata: Cmd,
-                      tag: uint)
+                      tag: usize)
                       -> ty::Generics<'tcx>
 {
     let doc = reader::get_doc(base_doc, tag);
@@ -1479,7 +1479,7 @@ fn doc_generics<'tcx>(base_doc: rbml::Doc,
         let def_id = translate_def_id(cdata, def_id);
 
         let doc = reader::get_doc(rp_doc, tag_region_param_def_space);
-        let space = subst::ParamSpace::from_uint(reader::doc_as_u64(doc) as uint);
+        let space = subst::ParamSpace::from_uint(reader::doc_as_u64(doc) as usize);
 
         let doc = reader::get_doc(rp_doc, tag_region_param_def_index);
         let index = reader::doc_as_u64(doc) as u32;
@@ -1508,7 +1508,7 @@ fn doc_generics<'tcx>(base_doc: rbml::Doc,
 fn doc_predicates<'tcx>(base_doc: rbml::Doc,
                         tcx: &ty::ctxt<'tcx>,
                         cdata: Cmd,
-                        tag: uint)
+                        tag: usize)
                         -> ty::GenericPredicates<'tcx>
 {
     let doc = reader::get_doc(base_doc, tag);
@@ -1516,7 +1516,7 @@ fn doc_predicates<'tcx>(base_doc: rbml::Doc,
     let mut predicates = subst::VecPerParamSpace::empty();
     reader::tagged_docs(doc, tag_predicate, |predicate_doc| {
         let space_doc = reader::get_doc(predicate_doc, tag_predicate_space);
-        let space = subst::ParamSpace::from_uint(reader::doc_as_u8(space_doc) as uint);
+        let space = subst::ParamSpace::from_uint(reader::doc_as_u8(space_doc) as usize);
 
         let data_doc = reader::get_doc(predicate_doc, tag_predicate_data);
         let data = parse_predicate_data(data_doc.data, data_doc.start, cdata.cnum, tcx,
index fa8d0b2a56e4ee34b8e062ed0bac19948f730897..a8f83bee7f6824a1accd17dca0dda02f87fa2aea 100644 (file)
@@ -22,7 +22,7 @@
 use metadata::decoder;
 use metadata::tyencode;
 use middle::def;
-use middle::ty::{lookup_item_type};
+use middle::ty::lookup_item_type;
 use middle::ty::{self, Ty};
 use middle::stability;
 use util::nodemap::{FnvHashMap, NodeMap, NodeSet};
@@ -105,7 +105,7 @@ struct entry<T> {
 fn encode_trait_ref<'a, 'tcx>(rbml_w: &mut Encoder,
                               ecx: &EncodeContext<'a, 'tcx>,
                               trait_ref: &ty::TraitRef<'tcx>,
-                              tag: uint) {
+                              tag: usize) {
     let ty_str_ctxt = &tyencode::ctxt {
         diag: ecx.diag,
         ds: def_to_string,
@@ -703,7 +703,7 @@ fn encode_generics<'a, 'tcx>(rbml_w: &mut Encoder,
                              ecx: &EncodeContext<'a, 'tcx>,
                              generics: &ty::Generics<'tcx>,
                              predicates: &ty::GenericPredicates<'tcx>,
-                             tag: uint)
+                             tag: usize)
 {
     rbml_w.start_tag(tag);
 
@@ -777,7 +777,7 @@ fn encode_predicates_in_current_doc<'a,'tcx>(rbml_w: &mut Encoder,
 fn encode_predicates<'a,'tcx>(rbml_w: &mut Encoder,
                               ecx: &EncodeContext<'a,'tcx>,
                               predicates: &ty::GenericPredicates<'tcx>,
-                              tag: uint)
+                              tag: usize)
 {
     rbml_w.start_tag(tag);
     encode_predicates_in_current_doc(rbml_w, ecx, predicates);
@@ -1538,7 +1538,7 @@ fn encode_index<T, F>(rbml_w: &mut Encoder, index: Vec<entry<T>>, mut write_fn:
     for elt in index {
         let mut s = SipHasher::new();
         elt.val.hash(&mut s);
-        let h = s.finish() as uint;
+        let h = s.finish() as usize;
         (&mut buckets[h % 256]).push(elt);
     }
 
@@ -1944,7 +1944,7 @@ pub fn encode_metadata(parms: EncodeParams, krate: &ast::Crate) -> Vec<u8> {
 
     // RBML compacts the encoded bytes whenever appropriate,
     // so there are some garbages left after the end of the data.
-    let metalen = wr.seek(SeekFrom::Current(0)).unwrap() as uint;
+    let metalen = wr.seek(SeekFrom::Current(0)).unwrap() as usize;
     let mut v = wr.into_inner();
     v.truncate(metalen);
     assert_eq!(v.len(), metalen);
index 80fc3769453427f4815464ccbca410dd2c4129d4..7b63e38b585980cce03c4b7839e23f997ec5cc4a 100644 (file)
 //! no means all of the necessary details. Take a look at the rest of
 //! metadata::loader or metadata::creader for all the juicy details!
 
-use back::archive::{METADATA_FILENAME};
+use back::archive::METADATA_FILENAME;
 use back::svh::Svh;
 use session::Session;
 use session::search_paths::PathKind;
@@ -745,7 +745,7 @@ fn get_metadata_section_imp(is_osx: bool, filename: &Path) -> Result<MetadataBlo
     unsafe {
         let buf = common::path2cstr(filename);
         let mb = llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf.as_ptr());
-        if mb as int == 0 {
+        if mb as isize == 0 {
             return Err(format!("error reading library: '{}'",
                                filename.display()))
         }
@@ -761,12 +761,12 @@ fn get_metadata_section_imp(is_osx: bool, filename: &Path) -> Result<MetadataBlo
             let mut name_buf = ptr::null();
             let name_len = llvm::LLVMRustGetSectionName(si.llsi, &mut name_buf);
             let name = slice::from_raw_parts(name_buf as *const u8,
-                                             name_len as uint).to_vec();
+                                             name_len as usize).to_vec();
             let name = String::from_utf8(name).unwrap();
             debug!("get_metadata_section: name {}", name);
             if read_meta_section_name(is_osx) == name {
                 let cbuf = llvm::LLVMGetSectionContents(si.llsi);
-                let csz = llvm::LLVMGetSectionSize(si.llsi) as uint;
+                let csz = llvm::LLVMGetSectionSize(si.llsi) as usize;
                 let cvbuf: *const u8 = cbuf as *const u8;
                 let vlen = encoder::metadata_encoding_version.len();
                 debug!("checking {} bytes of metadata-version stamp",
@@ -779,7 +779,7 @@ fn get_metadata_section_imp(is_osx: bool, filename: &Path) -> Result<MetadataBlo
                                         filename.display())));
                 }
 
-                let cvbuf1 = cvbuf.offset(vlen as int);
+                let cvbuf1 = cvbuf.offset(vlen as isize);
                 debug!("inflating {} bytes of compressed metadata",
                        csz - vlen);
                 let bytes = slice::from_raw_parts(cvbuf1, csz - vlen);
index 3714e3b8c73da6a7cc4ca9eecb641743c7751388..c2d7911d151fbfb7f3a79e2e4d61776a4e851a59 100644 (file)
@@ -79,15 +79,6 @@ fn visit_item(&mut self, item: &ast::Item) {
         for attr in &item.attrs {
             let mut used = true;
             match &attr.name()[..] {
-                "phase" => {
-                    self.sess.span_err(attr.span, "#[phase] is deprecated");
-                }
-                "plugin" => {
-                    self.sess.span_err(attr.span, "#[plugin] on `extern crate` is deprecated");
-                    self.sess.fileline_help(attr.span, &format!("use a crate attribute instead, \
-                                                            i.e. #![plugin({})]",
-                                                            item.ident.as_str()));
-                }
                 "macro_use" => {
                     let names = attr.meta_item_list();
                     if names.is_none() {
index d1a946d933f142fae19c0b351a437475f4c3b564..e2eebbfdc724d255056aad3cb6ba03d08a39e7c9 100644 (file)
@@ -66,7 +66,7 @@ pub enum DefIdSource {
 pub struct PState<'a, 'tcx: 'a> {
     data: &'a [u8],
     krate: ast::CrateNum,
-    pos: uint,
+    pos: usize,
     tcx: &'a ty::ctxt<'tcx>
 }
 
@@ -119,7 +119,7 @@ fn parse_name_<F>(st: &mut PState, is_last: F) -> ast::Name where
 }
 
 pub fn parse_state_from_data<'a, 'tcx>(data: &'a [u8], crate_num: ast::CrateNum,
-                                       pos: uint, tcx: &'a ty::ctxt<'tcx>)
+                                       pos: usize, tcx: &'a ty::ctxt<'tcx>)
                                        -> PState<'a, 'tcx> {
     PState {
         data: data,
@@ -129,7 +129,7 @@ pub fn parse_state_from_data<'a, 'tcx>(data: &'a [u8], crate_num: ast::CrateNum,
     }
 }
 
-fn data_log_string(data: &[u8], pos: uint) -> String {
+fn data_log_string(data: &[u8], pos: usize) -> String {
     let mut buf = String::new();
     buf.push_str("<<");
     for i in pos..data.len() {
@@ -146,7 +146,7 @@ fn data_log_string(data: &[u8], pos: uint) -> String {
 
 pub fn parse_ty_closure_data<'tcx, F>(data: &[u8],
                                       crate_num: ast::CrateNum,
-                                      pos: uint,
+                                      pos: usize,
                                       tcx: &ty::ctxt<'tcx>,
                                       conv: F)
                                       -> ty::ClosureTy<'tcx> where
@@ -156,7 +156,7 @@ pub fn parse_ty_closure_data<'tcx, F>(data: &[u8],
     parse_closure_ty(&mut st, conv)
 }
 
-pub fn parse_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: uint,
+pub fn parse_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: usize,
                               tcx: &ty::ctxt<'tcx>, conv: F) -> Ty<'tcx> where
     F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
 {
@@ -165,7 +165,7 @@ pub fn parse_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: uint,
     parse_ty(&mut st, conv)
 }
 
-pub fn parse_region_data<F>(data: &[u8], crate_num: ast::CrateNum, pos: uint, tcx: &ty::ctxt,
+pub fn parse_region_data<F>(data: &[u8], crate_num: ast::CrateNum, pos: usize, tcx: &ty::ctxt,
                             conv: F) -> ty::Region where
     F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
 {
@@ -174,7 +174,7 @@ pub fn parse_region_data<F>(data: &[u8], crate_num: ast::CrateNum, pos: uint, tc
     parse_region(&mut st, conv)
 }
 
-pub fn parse_bare_fn_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: uint,
+pub fn parse_bare_fn_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: usize,
                                       tcx: &ty::ctxt<'tcx>, conv: F)
                                       -> ty::BareFnTy<'tcx> where
     F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
@@ -184,7 +184,7 @@ pub fn parse_bare_fn_ty_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos
     parse_bare_fn_ty(&mut st, conv)
 }
 
-pub fn parse_trait_ref_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: uint,
+pub fn parse_trait_ref_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: usize,
                                      tcx: &ty::ctxt<'tcx>, conv: F)
                                      -> Rc<ty::TraitRef<'tcx>> where
     F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
@@ -194,7 +194,7 @@ pub fn parse_trait_ref_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos:
     parse_trait_ref(&mut st, conv)
 }
 
-pub fn parse_substs_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: uint,
+pub fn parse_substs_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: usize,
                                   tcx: &ty::ctxt<'tcx>, conv: F) -> subst::Substs<'tcx> where
     F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
 {
@@ -204,7 +204,7 @@ pub fn parse_substs_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: ui
 }
 
 pub fn parse_bounds_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum,
-                                  pos: uint, tcx: &ty::ctxt<'tcx>, conv: F)
+                                  pos: usize, tcx: &ty::ctxt<'tcx>, conv: F)
                                   -> ty::ParamBounds<'tcx> where
     F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
 {
@@ -213,7 +213,7 @@ pub fn parse_bounds_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum,
 }
 
 pub fn parse_existential_bounds_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum,
-                                              pos: uint, tcx: &ty::ctxt<'tcx>, conv: F)
+                                              pos: usize, tcx: &ty::ctxt<'tcx>, conv: F)
                                               -> ty::ExistentialBounds<'tcx> where
     F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
 {
@@ -222,7 +222,7 @@ pub fn parse_existential_bounds_data<'tcx, F>(data: &[u8], crate_num: ast::Crate
 }
 
 pub fn parse_builtin_bounds_data<F>(data: &[u8], crate_num: ast::CrateNum,
-                                    pos: uint, tcx: &ty::ctxt, conv: F)
+                                    pos: usize, tcx: &ty::ctxt, conv: F)
                                     -> ty::BuiltinBounds where
     F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
 {
@@ -230,7 +230,7 @@ pub fn parse_builtin_bounds_data<F>(data: &[u8], crate_num: ast::CrateNum,
     parse_builtin_bounds(&mut st, conv)
 }
 
-fn parse_size(st: &mut PState) -> Option<uint> {
+fn parse_size(st: &mut PState) -> Option<usize> {
     assert_eq!(next(st), '/');
 
     if peek(st) == '|' {
@@ -447,8 +447,8 @@ fn parse_ty_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) -> Ty<'tcx> w
     let tcx = st.tcx;
     match next(st) {
       'b' => return tcx.types.bool,
-      'i' => { /* eat the s of is */ next(st); return tcx.types.int },
-      'u' => { /* eat the s of us */ next(st); return tcx.types.uint },
+      'i' => { /* eat the s of is */ next(st); return tcx.types.isize },
+      'u' => { /* eat the s of us */ next(st); return tcx.types.usize },
       'M' => {
         match next(st) {
           'b' => return tcx.types.u8,
@@ -592,21 +592,21 @@ fn parse_def_<F>(st: &mut PState, source: DefIdSource, conv: &mut F) -> ast::Def
     return (*conv)(source, scan(st, |c| { c == '|' }, parse_def_id));
 }
 
-fn parse_uint(st: &mut PState) -> uint {
+fn parse_uint(st: &mut PState) -> usize {
     let mut n = 0;
     loop {
         let cur = peek(st);
         if cur < '0' || cur > '9' { return n; }
         st.pos = st.pos + 1;
         n *= 10;
-        n += (cur as uint) - ('0' as uint);
+        n += (cur as usize) - ('0' as usize);
     };
 }
 
 fn parse_u32(st: &mut PState) -> u32 {
     let n = parse_uint(st);
     let m = n as u32;
-    assert_eq!(m as uint, n);
+    assert_eq!(m as usize, n);
     m
 }
 
@@ -614,7 +614,7 @@ fn parse_param_space(st: &mut PState) -> subst::ParamSpace {
     subst::ParamSpace::from_uint(parse_uint(st))
 }
 
-fn parse_hex(st: &mut PState) -> uint {
+fn parse_hex(st: &mut PState) -> usize {
     let mut n = 0;
     loop {
         let cur = peek(st);
@@ -622,8 +622,8 @@ fn parse_hex(st: &mut PState) -> uint {
         st.pos = st.pos + 1;
         n *= 16;
         if '0' <= cur && cur <= '9' {
-            n += (cur as uint) - ('0' as uint);
-        } else { n += 10 + (cur as uint) - ('a' as uint); }
+            n += (cur as usize) - ('0' as usize);
+        } else { n += 10 + (cur as usize) - ('a' as usize); }
     };
 }
 
@@ -725,14 +725,14 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId {
     let def_part = &buf[colon_idx + 1..len];
 
     let crate_num = match str::from_utf8(crate_part).ok().and_then(|s| {
-        s.parse::<uint>().ok()
+        s.parse::<usize>().ok()
     }) {
        Some(cn) => cn as ast::CrateNum,
        None => panic!("internal error: parse_def_id: crate number expected, found {:?}",
                      crate_part)
     };
     let def_num = match str::from_utf8(def_part).ok().and_then(|s| {
-        s.parse::<uint>().ok()
+        s.parse::<usize>().ok()
     }) {
        Some(dn) => dn as ast::NodeId,
        None => panic!("internal error: parse_def_id: id expected, found {:?}",
@@ -742,7 +742,7 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId {
 }
 
 pub fn parse_predicate_data<'tcx, F>(data: &[u8],
-                                     start: uint,
+                                     start: usize,
                                      crate_num: ast::CrateNum,
                                      tcx: &ty::ctxt<'tcx>,
                                      conv: F)
@@ -794,7 +794,7 @@ fn parse_projection_predicate_<'a,'tcx, F>(
     }
 }
 
-pub fn parse_type_param_def_data<'tcx, F>(data: &[u8], start: uint,
+pub fn parse_type_param_def_data<'tcx, F>(data: &[u8], start: usize,
                                           crate_num: ast::CrateNum, tcx: &ty::ctxt<'tcx>,
                                           conv: F) -> ty::TypeParameterDef<'tcx> where
     F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
index b0fa0e757fe05b1f0a644e230653574cf9d8da8b..7a2df4966283a6d7339d3040e2e312fa927a32c5 100644 (file)
@@ -64,7 +64,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut Encoder, cx: &ctxt<'a, 'tcx>, t: Ty<'tcx>) {
         ty::ty_char => mywrite!(w, "c"),
         ty::ty_int(t) => {
             match t {
-                ast::TyIs(_) => mywrite!(w, "is"),
+                ast::TyIs => mywrite!(w, "is"),
                 ast::TyI8 => mywrite!(w, "MB"),
                 ast::TyI16 => mywrite!(w, "MW"),
                 ast::TyI32 => mywrite!(w, "ML"),
@@ -73,7 +73,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut Encoder, cx: &ctxt<'a, 'tcx>, t: Ty<'tcx>) {
         }
         ty::ty_uint(t) => {
             match t {
-                ast::TyUs(_) => mywrite!(w, "us"),
+                ast::TyUs => mywrite!(w, "us"),
                 ast::TyU8 => mywrite!(w, "Mb"),
                 ast::TyU16 => mywrite!(w, "Mw"),
                 ast::TyU32 => mywrite!(w, "Ml"),
index 0f98b3c33fb8d61dc1bf055cd6c44e6a2bcbf83a..698cf105ae53c12d6b1a5d4dabec5175f1dc6c63 100644 (file)
 use syntax::ast;
 use util::ppaux::Repr;
 
-pub const NO_REGIONS: uint = 1;
-pub const NO_TPS: uint = 2;
+pub const NO_REGIONS: usize = 1;
+pub const NO_TPS: usize = 2;
 
-pub fn check_path_args(tcx: &ty::ctxt, segments: &[ast::PathSegment], flags: uint) {
+pub fn check_path_args(tcx: &ty::ctxt, segments: &[ast::PathSegment], flags: usize) {
     for segment in segments {
         if (flags & NO_TPS) != 0 {
             for typ in segment.parameters.types() {
index 801350e8a1e9c1d50d29d9f28d66f9c7add566ad..1ea632d9618fc709fc969c813600fd00f3d38ad3 100644 (file)
@@ -50,7 +50,7 @@
 use rbml;
 use serialize;
 use serialize::{Decodable, Decoder, DecoderHelpers, Encodable};
-use serialize::{EncoderHelpers};
+use serialize::EncoderHelpers;
 
 #[cfg(test)] use std::io::Cursor;
 #[cfg(test)] use syntax::parse;
@@ -93,7 +93,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
     let ii = simplify_ast(ii);
     let id_range = ast_util::compute_id_range_for_inlined_item(&ii);
 
-    rbml_w.start_tag(c::tag_ast as uint);
+    rbml_w.start_tag(c::tag_ast as usize);
     id_range.encode(rbml_w);
     encode_ast(rbml_w, &ii);
     encode_side_tables_for_ii(ecx, rbml_w, &ii);
@@ -360,7 +360,7 @@ fn read_def_id_nodcx(&mut self,
 // but eventually we should add entries to the local codemap as required.
 
 fn encode_ast(rbml_w: &mut Encoder, item: &ast::InlinedItem) {
-    rbml_w.start_tag(c::tag_tree as uint);
+    rbml_w.start_tag(c::tag_tree as usize);
     item.encode(rbml_w);
     rbml_w.end_tag();
 }
@@ -437,7 +437,7 @@ fn simplify_ast(ii: e::InlinedItemRef) -> ast::InlinedItem {
 }
 
 fn decode_ast(par_doc: rbml::Doc) -> ast::InlinedItem {
-    let chi_doc = par_doc.get(c::tag_tree as uint);
+    let chi_doc = par_doc.get(c::tag_tree as usize);
     let mut d = reader::Decoder::new(chi_doc);
     Decodable::decode(&mut d).unwrap()
 }
@@ -1150,7 +1150,7 @@ fn tag<F>(&mut self,
               f: F) where
         F: FnOnce(&mut Encoder<'a>),
     {
-        self.start_tag(tag_id as uint);
+        self.start_tag(tag_id as usize);
         f(self);
         self.end_tag();
     }
@@ -1175,7 +1175,7 @@ fn visit_id(&mut self, id: ast::NodeId) {
 fn encode_side_tables_for_ii(ecx: &e::EncodeContext,
                              rbml_w: &mut Encoder,
                              ii: &ast::InlinedItem) {
-    rbml_w.start_tag(c::tag_table as uint);
+    rbml_w.start_tag(c::tag_table as usize);
     ast_util::visit_ids_for_inlined_item(ii, &mut SideTableEncodingIdVisitor {
         ecx: ecx,
         rbml_w: rbml_w
@@ -1323,14 +1323,14 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
 }
 
 trait doc_decoder_helpers {
-    fn as_int(&self) -> int;
+    fn as_int(&self) -> isize;
     fn opt_child(&self, tag: c::astencode_tag) -> Option<Self>;
 }
 
 impl<'a> doc_decoder_helpers for rbml::Doc<'a> {
-    fn as_int(&self) -> int { reader::doc_as_u64(*self) as int }
+    fn as_int(&self) -> isize { reader::doc_as_u64(*self) as isize }
     fn opt_child(&self, tag: c::astencode_tag) -> Option<rbml::Doc<'a>> {
-        reader::maybe_get_doc(*self, tag as uint)
+        reader::maybe_get_doc(*self, tag as usize)
     }
 }
 
@@ -1746,7 +1746,7 @@ fn read_unsize_kind<'b, 'c>(&mut self, dcx: &DecodeContext<'b, 'c, 'tcx>)
             this.read_enum_variant(variants, |this, i| {
                 Ok(match i {
                     0 => {
-                        let len: uint =
+                        let len: usize =
                             this.read_enum_variant_arg(0, |this| Decodable::decode(this)).unwrap();
 
                         ty::UnsizeLength(len)
@@ -1755,7 +1755,7 @@ fn read_unsize_kind<'b, 'c>(&mut self, dcx: &DecodeContext<'b, 'c, 'tcx>)
                         let uk: ty::UnsizeKind =
                             this.read_enum_variant_arg(0,
                                 |this| Ok(this.read_unsize_kind(dcx))).unwrap();
-                        let idx: uint =
+                        let idx: usize =
                             this.read_enum_variant_arg(1, |this| Decodable::decode(this)).unwrap();
 
                         ty::UnsizeStruct(box uk, idx)
@@ -1851,7 +1851,7 @@ fn convert_def_id(&mut self,
 
 fn decode_side_tables(dcx: &DecodeContext,
                       ast_doc: rbml::Doc) {
-    let tbl_doc = ast_doc.get(c::tag_table as uint);
+    let tbl_doc = ast_doc.get(c::tag_table as usize);
     reader::docs(tbl_doc, |tag, entry_doc| {
         let mut entry_dsr = reader::Decoder::new(entry_doc);
         let id0: ast::NodeId = Decodable::decode(&mut entry_dsr).unwrap();
@@ -1969,14 +1969,14 @@ fn decode_side_tables(dcx: &DecodeContext,
 
 #[cfg(test)]
 fn encode_item_ast(rbml_w: &mut Encoder, item: &ast::Item) {
-    rbml_w.start_tag(c::tag_tree as uint);
+    rbml_w.start_tag(c::tag_tree as usize);
     (*item).encode(rbml_w);
     rbml_w.end_tag();
 }
 
 #[cfg(test)]
 fn decode_item_ast(par_doc: rbml::Doc) -> ast::Item {
-    let chi_doc = par_doc.get(c::tag_tree as uint);
+    let chi_doc = par_doc.get(c::tag_tree as usize);
     let mut d = reader::Decoder::new(chi_doc);
     Decodable::decode(&mut d).unwrap()
 }
@@ -2035,7 +2035,7 @@ fn foo() {}
 fn test_smalltalk() {
     let cx = mk_ctxt();
     roundtrip(quote_item!(&cx,
-        fn foo() -> int { 3 + 4 } // first smalltalk program ever executed.
+        fn foo() -> isize { 3 + 4 } // first smalltalk program ever executed.
     ));
 }
 */
@@ -2044,7 +2044,7 @@ fn foo() -> int { 3 + 4 } // first smalltalk program ever executed.
 fn test_more() {
     let cx = mk_ctxt();
     roundtrip(quote_item!(&cx,
-        fn foo(x: uint, y: uint) -> uint {
+        fn foo(x: usize, y: usize) -> usize {
             let z = x + y;
             return z;
         }
@@ -2055,15 +2055,15 @@ fn foo(x: uint, y: uint) -> uint {
 fn test_simplification() {
     let cx = mk_ctxt();
     let item = quote_item!(&cx,
-        fn new_int_alist<B>() -> alist<int, B> {
-            fn eq_int(a: int, b: int) -> bool { a == b }
+        fn new_int_alist<B>() -> alist<isize, B> {
+            fn eq_int(a: isize, b: isize) -> bool { a == b }
             return alist {eq_fn: eq_int, data: Vec::new()};
         }
     ).unwrap();
     let item_in = e::IIItemRef(&*item);
     let item_out = simplify_ast(item_in);
     let item_exp = ast::IIItem(quote_item!(&cx,
-        fn new_int_alist<B>() -> alist<int, B> {
+        fn new_int_alist<B>() -> alist<isize, B> {
             return alist {eq_fn: eq_int, data: Vec::new()};
         }
     ).unwrap());
index 97cd9456098b1bbab4fb5b8947975d9d46af1399..01692158c17f43355296dcf9e7c022d379ec5e3b 100644 (file)
@@ -18,7 +18,7 @@
 use middle::def::*;
 use middle::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Init};
 use middle::expr_use_visitor::{JustWrite, LoanCause, MutateMode};
-use middle::expr_use_visitor::{WriteAndRead};
+use middle::expr_use_visitor::WriteAndRead;
 use middle::expr_use_visitor as euv;
 use middle::mem_categorization::cmt;
 use middle::pat_util::*;
@@ -72,7 +72,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
         let column_count = m.iter().map(|row| row.len()).max().unwrap_or(0);
         assert!(m.iter().all(|row| row.len() == column_count));
-        let column_widths: Vec<uint> = (0..column_count).map(|col| {
+        let column_widths: Vec<usize> = (0..column_count).map(|col| {
             pretty_printed_matrix.iter().map(|row| row[col].len()).max().unwrap_or(0)
         }).collect();
 
@@ -116,9 +116,9 @@ pub enum Constructor {
     /// Ranges of literal values (2..5).
     ConstantRange(const_val, const_val),
     /// Array patterns of length n.
-    Slice(uint),
+    Slice(usize),
     /// Array patterns with a subslice.
-    SliceWithSubslice(uint, uint)
+    SliceWithSubslice(usize, usize)
 }
 
 #[derive(Clone, PartialEq)]
@@ -498,7 +498,7 @@ fn record_renamings(const_expr: &ast::Expr,
 /// left_ty: tuple of 3 elements
 /// pats: [10, 20, _]           => (10, 20, _)
 ///
-/// left_ty: struct X { a: (bool, &'static str), b: uint}
+/// left_ty: struct X { a: (bool, &'static str), b: usize}
 /// pats: [(false, "foo"), 42]  => X { a: (false, "foo"), b: 42 }
 fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
                      pats: Vec<&Pat>, left_ty: Ty) -> P<Pat> {
@@ -580,7 +580,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
 }
 
 fn missing_constructor(cx: &MatchCheckCtxt, &Matrix(ref rows): &Matrix,
-                       left_ty: Ty, max_slice_length: uint) -> Option<Constructor> {
+                       left_ty: Ty, max_slice_length: usize) -> Option<Constructor> {
     let used_constructors: Vec<Constructor> = rows.iter()
         .flat_map(|row| pat_constructors(cx, row[0], left_ty, max_slice_length).into_iter())
         .collect();
@@ -594,7 +594,7 @@ fn missing_constructor(cx: &MatchCheckCtxt, &Matrix(ref rows): &Matrix,
 /// but is instead bounded by the maximum fixed length of slice patterns in
 /// the column of patterns being analyzed.
 fn all_constructors(cx: &MatchCheckCtxt, left_ty: Ty,
-                    max_slice_length: uint) -> Vec<Constructor> {
+                    max_slice_length: usize) -> Vec<Constructor> {
     match left_ty.sty {
         ty::ty_bool =>
             [true, false].iter().map(|b| ConstantValue(const_bool(*b))).collect(),
@@ -741,7 +741,7 @@ fn is_useful_specialized(cx: &MatchCheckCtxt, &Matrix(ref m): &Matrix,
 /// On the other hand, a wild pattern and an identifier pattern cannot be
 /// specialized in any way.
 fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
-                    left_ty: Ty, max_slice_length: uint) -> Vec<Constructor> {
+                    left_ty: Ty, max_slice_length: usize) -> Vec<Constructor> {
     let pat = raw_pat(p);
     match pat.node {
         ast::PatIdent(..) =>
@@ -798,7 +798,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
 ///
 /// For instance, a tuple pattern (_, 42, Some([])) has the arity of 3.
 /// A struct pattern's arity is the number of fields it contains, etc.
-pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> uint {
+pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> usize {
     match ty.sty {
         ty::ty_tup(ref fs) => fs.len(),
         ty::ty_uniq(_) => 1,
@@ -850,7 +850,7 @@ fn range_covered_by_constructor(ctor: &Constructor,
 /// Structure patterns with a partial wild pattern (Foo { a: 42, .. }) have their missing
 /// fields filled with wild patterns.
 pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
-                      constructor: &Constructor, col: uint, arity: uint) -> Option<Vec<&'a Pat>> {
+                      constructor: &Constructor, col: usize, arity: usize) -> Option<Vec<&'a Pat>> {
     let &Pat {
         id: pat_id, ref node, span: pat_span
     } = raw_pat(r[col]);
index f9598237ff460805cc0494475f97820ff385fb3d..0d9e0d14def645ced90898ae7b5c300def44859e 100644 (file)
@@ -262,8 +262,8 @@ pub fn description(&self) -> Cow<str> {
             CannotCastTo(s) => format!("can't cast this type to {}", s).into_cow(),
             InvalidOpForBools(_) =>  "can't do this op on bools".into_cow(),
             InvalidOpForFloats(_) => "can't do this op on floats".into_cow(),
-            InvalidOpForIntUint(..) => "can't do this op on an int and uint".into_cow(),
-            InvalidOpForUintInt(..) => "can't do this op on a uint and int".into_cow(),
+            InvalidOpForIntUint(..) => "can't do this op on an isize and usize".into_cow(),
+            InvalidOpForUintInt(..) => "can't do this op on a usize and isize".into_cow(),
             NegateOnString => "negate on string".into_cow(),
             NegateOnBoolean => "negate on boolean".into_cow(),
             NegateOnBinary => "negate on binary literal".into_cow(),
@@ -369,7 +369,7 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
       }
       ast::ExprBinary(op, ref a, ref b) => {
         let b_ty = match op.node {
-            ast::BiShl | ast::BiShr => Some(tcx.types.uint),
+            ast::BiShl | ast::BiShr => Some(tcx.types.usize),
             _ => ety
         };
         match (try!(eval_const_expr_partial(tcx, &**a, ety)),
@@ -396,7 +396,7 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
                     Some(&ty::ty_int(int_ty)) => int_ty,
                     _ => return false
                 };
-                let int_ty = if let ast::TyIs(_) = int_ty {
+                let int_ty = if let ast::TyIs = int_ty {
                     tcx.sess.target.int_type
                 } else {
                     int_ty
@@ -406,7 +406,7 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
                     ast::TyI16 =>  (a as i16) == i16::MIN,
                     ast::TyI32 =>  (a as i32) == i32::MIN,
                     ast::TyI64 =>  (a as i64) == i64::MIN,
-                    ast::TyIs(_) => unreachable!()
+                    ast::TyIs => unreachable!()
                 }
             };
             match op.node {
@@ -434,8 +434,8 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
               ast::BiAnd | ast::BiBitAnd => const_int(a & b),
               ast::BiOr | ast::BiBitOr => const_int(a | b),
               ast::BiBitXor => const_int(a ^ b),
-              ast::BiShl => const_int(a << b as uint),
-              ast::BiShr => const_int(a >> b as uint),
+              ast::BiShl => const_int(a << b as usize),
+              ast::BiShr => const_int(a >> b as usize),
               ast::BiEq => fromb(a == b),
               ast::BiLt => fromb(a < b),
               ast::BiLe => fromb(a <= b),
@@ -456,8 +456,8 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
               ast::BiAnd | ast::BiBitAnd => const_uint(a & b),
               ast::BiOr | ast::BiBitOr => const_uint(a | b),
               ast::BiBitXor => const_uint(a ^ b),
-              ast::BiShl => const_uint(a << b as uint),
-              ast::BiShr => const_uint(a >> b as uint),
+              ast::BiShl => const_uint(a << b as usize),
+              ast::BiShr => const_uint(a >> b as usize),
               ast::BiEq => fromb(a == b),
               ast::BiLt => fromb(a < b),
               ast::BiLe => fromb(a <= b),
@@ -469,15 +469,15 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
           // shifts can have any integral type as their rhs
           (const_int(a), const_uint(b)) => {
             match op.node {
-              ast::BiShl => const_int(a << b as uint),
-              ast::BiShr => const_int(a >> b as uint),
+              ast::BiShl => const_int(a << b as usize),
+              ast::BiShr => const_int(a >> b as usize),
               _ => signal!(e, InvalidOpForIntUint(op.node)),
             }
           }
           (const_uint(a), const_int(b)) => {
             match op.node {
-              ast::BiShl => const_uint(a << b as uint),
-              ast::BiShr => const_uint(a >> b as uint),
+              ast::BiShl => const_uint(a << b as usize),
+              ast::BiShr => const_uint(a >> b as usize),
               _ => signal!(e, InvalidOpForUintInt(op.node)),
             }
           }
@@ -628,12 +628,12 @@ macro_rules! define_casts {
     }
 
     define_casts!{
-        ty::ty_int(ast::TyIs(_)) => (int, const_int, i64),
+        ty::ty_int(ast::TyIs) => (isize, const_int, i64),
         ty::ty_int(ast::TyI8) => (i8, const_int, i64),
         ty::ty_int(ast::TyI16) => (i16, const_int, i64),
         ty::ty_int(ast::TyI32) => (i32, const_int, i64),
         ty::ty_int(ast::TyI64) => (i64, const_int, i64),
-        ty::ty_uint(ast::TyUs(_)) => (uint, const_uint, u64),
+        ty::ty_uint(ast::TyUs) => (usize, const_uint, u64),
         ty::ty_uint(ast::TyU8) => (u8, const_uint, u64),
         ty::ty_uint(ast::TyU16) => (u16, const_uint, u64),
         ty::ty_uint(ast::TyU32) => (u32, const_uint, u64),
index 0d58fd2702f680e692933464c594e232ec1d1188..a112ce6bd287c6053b6d2d82684ee8f9287321b0 100644 (file)
@@ -45,11 +45,11 @@ pub struct DataFlowContext<'a, 'tcx: 'a, O> {
     oper: O,
 
     /// number of bits to propagate per id
-    bits_per_id: uint,
+    bits_per_id: usize,
 
     /// number of words we will use to store bits_per_id.
     /// equal to bits_per_id/usize::BITS rounded up.
-    words_per_id: uint,
+    words_per_id: usize,
 
     // mapping from node to cfg node index
     // FIXME (#6298): Shouldn't this go with CFG?
@@ -62,19 +62,19 @@ pub struct DataFlowContext<'a, 'tcx: 'a, O> {
     // the full vector (see the method `compute_id_range()`).
 
     /// bits generated as we exit the cfg node. Updated by `add_gen()`.
-    gens: Vec<uint>,
+    gens: Vec<usize>,
 
     /// bits killed as we exit the cfg node. Updated by `add_kill()`.
-    kills: Vec<uint>,
+    kills: Vec<usize>,
 
     /// bits that are valid on entry to the cfg node. Updated by
     /// `propagate()`.
-    on_entry: Vec<uint>,
+    on_entry: Vec<usize>,
 }
 
 pub trait BitwiseOperator {
     /// Joins two predecessor bits together, typically either `|` or `&`
-    fn join(&self, succ: uint, pred: uint) -> uint;
+    fn join(&self, succ: usize, pred: usize) -> usize;
 }
 
 /// Parameterization for the precise form of data flow that is used.
@@ -194,7 +194,7 @@ pub fn new(tcx: &'a ty::ctxt<'tcx>,
                cfg: &cfg::CFG,
                oper: O,
                id_range: IdRange,
-               bits_per_id: uint) -> DataFlowContext<'a, 'tcx, O> {
+               bits_per_id: usize) -> DataFlowContext<'a, 'tcx, O> {
         let words_per_id = (bits_per_id + usize::BITS as usize - 1) / usize::BITS as usize;
         let num_nodes = cfg.graph.all_nodes().len();
 
@@ -225,7 +225,7 @@ pub fn new(tcx: &'a ty::ctxt<'tcx>,
         }
     }
 
-    pub fn add_gen(&mut self, id: ast::NodeId, bit: uint) {
+    pub fn add_gen(&mut self, id: ast::NodeId, bit: usize) {
         //! Indicates that `id` generates `bit`
         debug!("{} add_gen(id={}, bit={})",
                self.analysis_name, id, bit);
@@ -240,7 +240,7 @@ pub fn add_gen(&mut self, id: ast::NodeId, bit: uint) {
         }
     }
 
-    pub fn add_kill(&mut self, id: ast::NodeId, bit: uint) {
+    pub fn add_kill(&mut self, id: ast::NodeId, bit: usize) {
         //! Indicates that `id` kills `bit`
         debug!("{} add_kill(id={}, bit={})",
                self.analysis_name, id, bit);
@@ -255,7 +255,7 @@ pub fn add_kill(&mut self, id: ast::NodeId, bit: uint) {
         }
     }
 
-    fn apply_gen_kill(&self, cfgidx: CFGIndex, bits: &mut [uint]) {
+    fn apply_gen_kill(&self, cfgidx: CFGIndex, bits: &mut [usize]) {
         //! Applies the gen and kill sets for `cfgidx` to `bits`
         debug!("{} apply_gen_kill(cfgidx={:?}, bits={}) [before]",
                self.analysis_name, cfgidx, mut_bits_to_string(bits));
@@ -271,7 +271,7 @@ fn apply_gen_kill(&self, cfgidx: CFGIndex, bits: &mut [uint]) {
                self.analysis_name, cfgidx, mut_bits_to_string(bits));
     }
 
-    fn compute_id_range(&self, cfgidx: CFGIndex) -> (uint, uint) {
+    fn compute_id_range(&self, cfgidx: CFGIndex) -> (usize, usize) {
         let n = cfgidx.node_id();
         let start = n * self.words_per_id;
         let end = start + self.words_per_id;
@@ -286,7 +286,7 @@ fn compute_id_range(&self, cfgidx: CFGIndex) -> (uint, uint) {
 
 
     pub fn each_bit_on_entry<F>(&self, id: ast::NodeId, mut f: F) -> bool where
-        F: FnMut(uint) -> bool,
+        F: FnMut(usize) -> bool,
     {
         //! Iterates through each bit that is set on entry to `id`.
         //! Only useful after `propagate()` has been called.
@@ -303,7 +303,7 @@ pub fn each_bit_on_entry<F>(&self, id: ast::NodeId, mut f: F) -> bool where
     }
 
     pub fn each_bit_for_node<F>(&self, e: EntryOrExit, cfgidx: CFGIndex, f: F) -> bool where
-        F: FnMut(uint) -> bool,
+        F: FnMut(usize) -> bool,
     {
         //! Iterates through each bit that is set on entry/exit to `cfgidx`.
         //! Only useful after `propagate()` has been called.
@@ -332,7 +332,7 @@ pub fn each_bit_for_node<F>(&self, e: EntryOrExit, cfgidx: CFGIndex, f: F) -> bo
     }
 
     pub fn each_gen_bit<F>(&self, id: ast::NodeId, mut f: F) -> bool where
-        F: FnMut(uint) -> bool,
+        F: FnMut(usize) -> bool,
     {
         //! Iterates through each bit in the gen set for `id`.
         if !self.has_bitset_for_nodeid(id) {
@@ -358,8 +358,8 @@ pub fn each_gen_bit<F>(&self, id: ast::NodeId, mut f: F) -> bool where
         return true;
     }
 
-    fn each_bit<F>(&self, words: &[uint], mut f: F) -> bool where
-        F: FnMut(uint) -> bool,
+    fn each_bit<F>(&self, words: &[usize], mut f: F) -> bool where
+        F: FnMut(usize) -> bool,
     {
         //! Helper for iterating over the bits in a bit set.
         //! Returns false on the first call to `f` that returns false;
@@ -495,7 +495,7 @@ fn pretty_print_to<'b>(&self, wr: Box<io::Write + 'b>,
 impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
     fn walk_cfg(&mut self,
                 cfg: &cfg::CFG,
-                in_out: &mut [uint]) {
+                in_out: &mut [usize]) {
         debug!("DataFlowContext::walk_cfg(in_out={}) {}",
                bits_to_string(in_out), self.dfcx.analysis_name);
         assert!(self.dfcx.bits_per_id > 0);
@@ -519,7 +519,7 @@ fn walk_cfg(&mut self,
         });
     }
 
-    fn reset(&mut self, bits: &mut [uint]) {
+    fn reset(&mut self, bits: &mut [usize]) {
         let e = if self.dfcx.oper.initial_value() {usize::MAX} else {0};
         for b in bits {
             *b = e;
@@ -527,7 +527,7 @@ fn reset(&mut self, bits: &mut [uint]) {
     }
 
     fn propagate_bits_into_graph_successors_of(&mut self,
-                                               pred_bits: &[uint],
+                                               pred_bits: &[usize],
                                                cfg: &cfg::CFG,
                                                cfgidx: CFGIndex) {
         cfg.graph.each_outgoing_edge(cfgidx, |_e_idx, edge| {
@@ -537,7 +537,7 @@ fn propagate_bits_into_graph_successors_of(&mut self,
     }
 
     fn propagate_bits_into_entry_set_for(&mut self,
-                                         pred_bits: &[uint],
+                                         pred_bits: &[usize],
                                          edge: &cfg::CFGEdge) {
         let source = edge.source();
         let cfgidx = edge.target();
@@ -560,11 +560,11 @@ fn propagate_bits_into_entry_set_for(&mut self,
     }
 }
 
-fn mut_bits_to_string(words: &mut [uint]) -> String {
+fn mut_bits_to_string(words: &mut [usize]) -> String {
     bits_to_string(words)
 }
 
-fn bits_to_string(words: &[uint]) -> String {
+fn bits_to_string(words: &[usize]) -> String {
     let mut result = String::new();
     let mut sep = '[';
 
@@ -584,8 +584,8 @@ fn bits_to_string(words: &[uint]) -> String {
 }
 
 #[inline]
-fn bitwise<Op:BitwiseOperator>(out_vec: &mut [uint],
-                               in_vec: &[uint],
+fn bitwise<Op:BitwiseOperator>(out_vec: &mut [usize],
+                               in_vec: &[usize],
                                op: &Op) -> bool {
     assert_eq!(out_vec.len(), in_vec.len());
     let mut changed = false;
@@ -598,7 +598,7 @@ fn bitwise<Op:BitwiseOperator>(out_vec: &mut [uint],
     changed
 }
 
-fn set_bit(words: &mut [uint], bit: uint) -> bool {
+fn set_bit(words: &mut [usize], bit: usize) -> bool {
     debug!("set_bit: words={} bit={}",
            mut_bits_to_string(words), bit_str(bit));
     let word = bit / usize::BITS as usize;
@@ -611,7 +611,7 @@ fn set_bit(words: &mut [uint], bit: uint) -> bool {
     oldv != newv
 }
 
-fn bit_str(bit: uint) -> String {
+fn bit_str(bit: usize) -> String {
     let byte = bit >> 8;
     let lobits = 1 << (bit & 0xFF);
     format!("[{}:{}-{:02x}]", bit, byte, lobits)
@@ -619,9 +619,9 @@ fn bit_str(bit: uint) -> String {
 
 struct Union;
 impl BitwiseOperator for Union {
-    fn join(&self, a: uint, b: uint) -> uint { a | b }
+    fn join(&self, a: usize, b: usize) -> usize { a | b }
 }
 struct Subtract;
 impl BitwiseOperator for Subtract {
-    fn join(&self, a: uint, b: uint) -> uint { a & !b }
+    fn join(&self, a: usize, b: usize) -> usize { a & !b }
 }
index 6d4d759476ed5330edde04b58b498f294dc99498..568375597c0de1bfd9f1d2dd9db2ee5a9a2fa108 100644 (file)
@@ -145,7 +145,7 @@ fn handle_field_access(&mut self, lhs: &ast::Expr, name: &ast::Ident) {
         }
     }
 
-    fn handle_tup_field_access(&mut self, lhs: &ast::Expr, idx: uint) {
+    fn handle_tup_field_access(&mut self, lhs: &ast::Expr, idx: usize) {
         match ty::expr_ty_adjusted(self.tcx, lhs).sty {
             ty::ty_struct(id, _) => {
                 let fields = ty::lookup_struct_fields(self.tcx, id);
index 40e7610582f9c7454846a43c3bb06fec1aaebb54..0b688e1e08a2e3eabdc7a7324b3eb2cf05c0784c 100644 (file)
@@ -172,7 +172,7 @@ fn calculate_type(sess: &session::Session,
             assert!(src.rlib.is_some());
             debug!("adding staticlib: {}", data.name);
             add_library(sess, cnum, cstore::RequireStatic, &mut formats);
-            ret[cnum as uint - 1] = Some(cstore::RequireStatic);
+            ret[cnum as usize - 1] = Some(cstore::RequireStatic);
         }
     });
 
index 97314b57ef656802a6b773495566051c7a27978c..e98b438d370c70055c9cbda771733033b8464814 100644 (file)
@@ -823,7 +823,7 @@ fn walk_adjustment(&mut self, expr: &ast::Expr) {
     /// `deref()` is declared with `&self`, this is an autoref of `x`.
     fn walk_autoderefs(&mut self,
                        expr: &ast::Expr,
-                       autoderefs: uint) {
+                       autoderefs: usize) {
         debug!("walk_autoderefs expr={} autoderefs={}", expr.repr(self.tcx()), autoderefs);
 
         for i in 0..autoderefs {
@@ -855,7 +855,7 @@ fn walk_autoderefs(&mut self,
     fn walk_autoref(&mut self,
                     expr: &ast::Expr,
                     autoref: &ty::AutoRef,
-                    n: uint) {
+                    n: usize) {
         debug!("walk_autoref expr={}", expr.repr(self.tcx()));
 
         match *autoref {
@@ -885,6 +885,11 @@ fn walk_autoref(&mut self,
         }
     }
 
+    // When this returns true, it means that the expression *is* a
+    // method-call (i.e. via the operator-overload).  This true result
+    // also implies that walk_overloaded_operator already took care of
+    // recursively processing the input arguments, and thus the caller
+    // should not do so.
     fn walk_overloaded_operator(&mut self,
                                 expr: &ast::Expr,
                                 receiver: &ast::Expr,
index f9bdc5dc313f4af4ca8a6f99ebf5fbf45d91c653..36065aaca57f33b4708d7ce721d95cc54238b6fa 100644 (file)
@@ -25,11 +25,11 @@ pub enum SimplifiedType {
     StrSimplifiedType,
     VecSimplifiedType,
     PtrSimplifiedType,
-    TupleSimplifiedType(uint),
+    TupleSimplifiedType(usize),
     TraitSimplifiedType(ast::DefId),
     StructSimplifiedType(ast::DefId),
     ClosureSimplifiedType(ast::DefId),
-    FunctionSimplifiedType(uint),
+    FunctionSimplifiedType(usize),
     ParameterSimplifiedType,
 }
 
index 436f04fc9e9cf9744f7d484757c9022146e47883..8673273f9b3c9c3c4fdd947ea14c462110fbc5b3 100644 (file)
@@ -62,33 +62,33 @@ fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
 }
 
 #[derive(Clone, Copy, PartialEq, Debug)]
-pub struct NodeIndex(pub uint);
+pub struct NodeIndex(pub usize);
 #[allow(non_upper_case_globals)]
 pub const InvalidNodeIndex: NodeIndex = NodeIndex(usize::MAX);
 
 #[derive(Copy, PartialEq, Debug)]
-pub struct EdgeIndex(pub uint);
+pub struct EdgeIndex(pub usize);
 #[allow(non_upper_case_globals)]
 pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(usize::MAX);
 
 // Use a private field here to guarantee no more instances are created:
 #[derive(Copy, Debug)]
-pub struct Direction { repr: uint }
+pub struct Direction { repr: usize }
 #[allow(non_upper_case_globals)]
 pub const Outgoing: Direction = Direction { repr: 0 };
 #[allow(non_upper_case_globals)]
 pub const Incoming: Direction = Direction { repr: 1 };
 
 impl NodeIndex {
-    fn get(&self) -> uint { let NodeIndex(v) = *self; v }
+    fn get(&self) -> usize { let NodeIndex(v) = *self; v }
     /// Returns unique id (unique with respect to the graph holding associated node).
-    pub fn node_id(&self) -> uint { self.get() }
+    pub fn node_id(&self) -> usize { self.get() }
 }
 
 impl EdgeIndex {
-    fn get(&self) -> uint { let EdgeIndex(v) = *self; v }
+    fn get(&self) -> usize { let EdgeIndex(v) = *self; v }
     /// Returns unique id (unique with respect to the graph holding associated edge).
-    pub fn edge_id(&self) -> uint { self.get() }
+    pub fn edge_id(&self) -> usize { self.get() }
 }
 
 impl<N,E> Graph<N,E> {
@@ -99,8 +99,8 @@ pub fn new() -> Graph<N,E> {
         }
     }
 
-    pub fn with_capacity(num_nodes: uint,
-                         num_edges: uint) -> Graph<N,E> {
+    pub fn with_capacity(num_nodes: usize,
+                         num_edges: usize) -> Graph<N,E> {
         Graph {
             nodes: Vec::with_capacity(num_nodes),
             edges: Vec::with_capacity(num_edges),
@@ -275,7 +275,7 @@ pub fn each_adjacent_edge<'a, F>(&'a self,
     // computation.
 
     pub fn iterate_until_fixed_point<'a, F>(&'a self, mut op: F) where
-        F: FnMut(uint, EdgeIndex, &'a Edge<E>) -> bool,
+        F: FnMut(usize, EdgeIndex, &'a Edge<E>) -> bool,
     {
         let mut iteration = 0;
         let mut changed = true;
index cedb30eebfd7817e885297b66693ff0e15f30843..17b0d788590c4c18a41a33ac61a068dbc8741bf0 100644 (file)
 //! In particular, it might be enough to say (A,B) are bivariant for
 //! all (A,B).
 
-use middle::ty::{BuiltinBounds};
+use middle::ty::BuiltinBounds;
 use middle::ty::{self, Ty};
 use middle::ty::TyVar;
 use middle::infer::combine::*;
-use middle::infer::{cres};
-use middle::infer::type_variable::{BiTo};
-use util::ppaux::{Repr};
+use middle::infer::cres;
+use middle::infer::type_variable::BiTo;
+use util::ppaux::Repr;
 
 pub struct Bivariate<'f, 'tcx: 'f> {
     fields: CombineFields<'f, 'tcx>
index 930e95d1f939a474590138324dbacc9dd1b5dac7..9aa17b2b1d9fe2f6a4c6e33e0f90f14181e26515 100644 (file)
@@ -46,7 +46,7 @@
 use middle::subst::{ErasedRegions, NonerasedRegions, Substs};
 use middle::ty::{FloatVar, FnSig, IntVar, TyVar};
 use middle::ty::{IntType, UintType};
-use middle::ty::{BuiltinBounds};
+use middle::ty::BuiltinBounds;
 use middle::ty::{self, Ty};
 use middle::ty_fold;
 use middle::ty_fold::{TypeFolder, TypeFoldable};
index c2b73bca8584e3a7a63d9cb98912c341b0bcd3ff..59ed2dfd24f258f8b33aa76cc8fe34fa56abf8dc 100644 (file)
 use middle::ty::{self, Ty};
 use middle::ty::TyVar;
 use middle::infer::combine::*;
-use middle::infer::{cres};
-use middle::infer::{Subtype};
-use middle::infer::type_variable::{EqTo};
-use util::ppaux::{Repr};
+use middle::infer::cres;
+use middle::infer::Subtype;
+use middle::infer::type_variable::EqTo;
+use util::ppaux::Repr;
 
 pub struct Equate<'f, 'tcx: 'f> {
     fields: CombineFields<'f, 'tcx>
index 80e8ed47d305299a24db2908d4e9fc3fb1e7ec92..36229a558e95585756eeff466e5ef13af245575c 100644 (file)
@@ -1752,7 +1752,7 @@ fn lifetimes_in_scope(tcx: &ty::ctxt,
 // LifeGiver is responsible for generating fresh lifetime names
 struct LifeGiver {
     taken: HashSet<String>,
-    counter: Cell<uint>,
+    counter: Cell<usize>,
     generated: RefCell<Vec<ast::Lifetime>>,
 }
 
@@ -1792,7 +1792,7 @@ fn give_lifetime(&self) -> ast::Lifetime {
         return lifetime;
 
         // 0 .. 25 generates a .. z, 26 .. 51 generates aa .. zz, and so on
-        fn num_to_string(counter: uint) -> String {
+        fn num_to_string(counter: usize) -> String {
             let mut s = String::new();
             let (n, r) = (counter/26 + 1, counter % 26);
             let letter: char = from_u32((r+97) as u32).unwrap();
index e17155a2ae69b304f8ef677d03bd14e5829752d0..3b83d37f58234a6f046cffdadaff8fe209470867 100644 (file)
@@ -11,7 +11,7 @@
 use super::combine::*;
 use super::lattice::*;
 use super::higher_ranked::HigherRankedRelations;
-use super::{cres};
+use super::cres;
 use super::Subtype;
 
 use middle::ty::{self, Ty};
index 121e5405f26dc79c0595c91f5c71018082a54705..9c764628c14f8602599658392514c6c62abdb76b 100644 (file)
@@ -34,7 +34,7 @@
 use super::glb::Glb;
 use super::lub::Lub;
 
-use middle::ty::{TyVar};
+use middle::ty::TyVar;
 use middle::ty::{self, Ty};
 use util::ppaux::Repr;
 
index be814b2acc10a234d448c6600ab62cab28cb3baf..5000ab32ff671a3af264176b55375375e61f4c47 100644 (file)
@@ -11,8 +11,8 @@
 use super::combine::*;
 use super::higher_ranked::HigherRankedRelations;
 use super::lattice::*;
-use super::{cres};
-use super::{Subtype};
+use super::cres;
+use super::Subtype;
 
 use middle::ty::{self, Ty};
 use util::ppaux::Repr;
index 8bd3ca826a6b202561d9a041ef26d70313c3ec01..4cc9b65c2dab300d14e8b6b637422380c66d8ef6 100644 (file)
 use middle::ty::replace_late_bound_regions;
 use middle::ty::{self, Ty};
 use middle::ty_fold::{TypeFolder, TypeFoldable};
-use std::cell::{RefCell};
+use std::cell::RefCell;
 use std::fmt;
 use std::rc::Rc;
 use syntax::ast;
 use syntax::codemap;
 use syntax::codemap::Span;
 use util::nodemap::FnvHashMap;
-use util::ppaux::{ty_to_string};
+use util::ppaux::ty_to_string;
 use util::ppaux::{Repr, UserString};
 
 use self::combine::{Combine, Combineable, CombineFields};
@@ -836,7 +836,7 @@ pub fn next_diverging_ty_var(&self) -> Ty<'tcx> {
         ty::mk_var(self.tcx, self.next_ty_var_id(true))
     }
 
-    pub fn next_ty_vars(&self, n: uint) -> Vec<Ty<'tcx>> {
+    pub fn next_ty_vars(&self, n: usize) -> Vec<Ty<'tcx>> {
         (0..n).map(|_i| self.next_ty_var()).collect()
     }
 
index 5be3310926c8764efa6ca14d2bc42a43070428e3..1fcbf80c904e0d7175c6cd69341529d0aa122f3a 100644 (file)
@@ -121,7 +121,7 @@ struct ConstraintGraph<'a, 'tcx: 'a> {
     tcx: &'a ty::ctxt<'tcx>,
     graph_name: String,
     map: &'a FnvHashMap<Constraint, SubregionOrigin<'tcx>>,
-    node_ids: FnvHashMap<Node, uint>,
+    node_ids: FnvHashMap<Node, usize>,
 }
 
 #[derive(Clone, Hash, PartialEq, Eq, Debug, Copy)]
index 553e3601806677ed1bc37f4ba22ddc4a9fbe7a3e..c432d114b6eed5cbe38d42c5dc5c4baeefb1f9a3 100644 (file)
@@ -86,7 +86,7 @@ pub enum UndoLogEntry {
     CommitedSnapshot,
     AddVar(RegionVid),
     AddConstraint(Constraint),
-    AddVerify(uint),
+    AddVerify(usize),
     AddGiven(ty::FreeRegion, ty::RegionVid),
     AddCombination(CombineMapType, TwoRegions)
 }
@@ -224,7 +224,7 @@ pub struct RegionVarBindings<'a, 'tcx: 'a> {
 
 #[derive(Debug)]
 pub struct RegionSnapshot {
-    length: uint,
+    length: usize,
     skolemization_count: u32,
 }
 
@@ -284,7 +284,7 @@ pub fn rollback_to(&self, snapshot: RegionSnapshot) {
                 AddVar(vid) => {
                     let mut var_origins = self.var_origins.borrow_mut();
                     var_origins.pop().unwrap();
-                    assert_eq!(var_origins.len(), vid.index as uint);
+                    assert_eq!(var_origins.len(), vid.index as usize);
                 }
                 AddConstraint(ref constraint) => {
                     self.constraints.borrow_mut().remove(constraint);
@@ -312,7 +312,7 @@ pub fn rollback_to(&self, snapshot: RegionSnapshot) {
     pub fn num_vars(&self) -> u32 {
         let len = self.var_origins.borrow().len();
         // enforce no overflow
-        assert!(len as u32 as uint == len);
+        assert!(len as u32 as usize == len);
         len as u32
     }
 
@@ -557,7 +557,7 @@ pub fn resolve_var(&self, rid: RegionVid) -> ty::Region {
         match *self.values.borrow() {
             None => {
                 self.tcx.sess.span_bug(
-                    (*self.var_origins.borrow())[rid.index as uint].span(),
+                    (*self.var_origins.borrow())[rid.index as usize].span(),
                     "attempt to resolve region variable before values have \
                      been computed!")
             }
@@ -629,7 +629,7 @@ pub fn tainted(&self, mark: &RegionSnapshot, r0: Region) -> Vec<Region> {
         let mut result_set = vec!(r0);
         let mut result_index = 0;
         while result_index < result_set.len() {
-            // nb: can't use uint::range() here because result_set grows
+            // nb: can't use usize::range() here because result_set grows
             let r = result_set[result_index];
             debug!("result_index={}, r={:?}", result_index, r);
 
@@ -746,7 +746,7 @@ fn lub_concrete_regions(&self, a: Region, b: Region) -> Region {
 
           (ReInfer(ReVar(v_id)), _) | (_, ReInfer(ReVar(v_id))) => {
             self.tcx.sess.span_bug(
-                (*self.var_origins.borrow())[v_id.index as uint].span(),
+                (*self.var_origins.borrow())[v_id.index as usize].span(),
                 &format!("lub_concrete_regions invoked with \
                          non-concrete regions: {:?}, {:?}",
                         a,
@@ -850,7 +850,7 @@ fn glb_concrete_regions(&self,
             (ReInfer(ReVar(v_id)), _) |
             (_, ReInfer(ReVar(v_id))) => {
                 self.tcx.sess.span_bug(
-                    (*self.var_origins.borrow())[v_id.index as uint].span(),
+                    (*self.var_origins.borrow())[v_id.index as usize].span(),
                     &format!("glb_concrete_regions invoked with \
                              non-concrete regions: {:?}, {:?}",
                             a,
@@ -984,7 +984,7 @@ fn infer_variable_values(&self,
     }
 
     fn construct_var_data(&self) -> Vec<VarData> {
-        (0..self.num_vars() as uint).map(|_| {
+        (0..self.num_vars() as usize).map(|_| {
             VarData {
                 // All nodes are initially classified as contracting; during
                 // the expansion phase, we will shift the classification for
@@ -1013,14 +1013,14 @@ fn expansion(&self, var_data: &mut [VarData]) {
                                    .repr(self.tcx));
             match *constraint {
               ConstrainRegSubVar(a_region, b_vid) => {
-                let b_data = &mut var_data[b_vid.index as uint];
+                let b_data = &mut var_data[b_vid.index as usize];
                 self.expand_node(a_region, b_vid, b_data)
               }
               ConstrainVarSubVar(a_vid, b_vid) => {
-                match var_data[a_vid.index as uint].value {
+                match var_data[a_vid.index as usize].value {
                   NoValue | ErrorValue => false,
                   Value(a_region) => {
-                    let b_node = &mut var_data[b_vid.index as uint];
+                    let b_node = &mut var_data[b_vid.index as usize];
                     self.expand_node(a_region, b_vid, b_node)
                   }
                 }
@@ -1101,16 +1101,16 @@ fn contraction(&self,
                 false
               }
               ConstrainVarSubVar(a_vid, b_vid) => {
-                match var_data[b_vid.index as uint].value {
+                match var_data[b_vid.index as usize].value {
                   NoValue | ErrorValue => false,
                   Value(b_region) => {
-                    let a_data = &mut var_data[a_vid.index as uint];
+                    let a_data = &mut var_data[a_vid.index as usize];
                     self.contract_node(a_vid, a_data, b_region)
                   }
                 }
               }
               ConstrainVarSubReg(a_vid, b_region) => {
-                let a_data = &mut var_data[a_vid.index as uint];
+                let a_data = &mut var_data[a_vid.index as usize];
                 self.contract_node(a_vid, a_data, b_region)
               }
             }
@@ -1250,11 +1250,11 @@ fn extract_values_and_collect_conflicts(
         // idea is to report errors that derive from independent
         // regions of the graph, but not those that derive from
         // overlapping locations.
-        let mut dup_vec: Vec<_> = repeat(u32::MAX).take(self.num_vars() as uint).collect();
+        let mut dup_vec: Vec<_> = repeat(u32::MAX).take(self.num_vars() as usize).collect();
 
         let mut opt_graph = None;
 
-        for idx in 0..self.num_vars() as uint {
+        for idx in 0..self.num_vars() as usize {
             match var_data[idx].value {
                 Value(_) => {
                     /* Inference successful */
@@ -1311,7 +1311,7 @@ fn extract_values_and_collect_conflicts(
             }
         }
 
-        (0..self.num_vars() as uint).map(|idx| var_data[idx].value).collect()
+        (0..self.num_vars() as usize).map(|idx| var_data[idx].value).collect()
     }
 
     fn construct_graph(&self) -> RegionGraph {
@@ -1320,7 +1320,7 @@ fn construct_graph(&self) -> RegionGraph {
         let constraints = self.constraints.borrow();
         let num_edges = constraints.len();
 
-        let mut graph = graph::Graph::with_capacity(num_vars as uint + 1,
+        let mut graph = graph::Graph::with_capacity(num_vars as usize + 1,
                                                     num_edges);
 
         for _ in 0..num_vars {
@@ -1331,17 +1331,17 @@ fn construct_graph(&self) -> RegionGraph {
         for (constraint, _) in &*constraints {
             match *constraint {
                 ConstrainVarSubVar(a_id, b_id) => {
-                    graph.add_edge(NodeIndex(a_id.index as uint),
-                                   NodeIndex(b_id.index as uint),
+                    graph.add_edge(NodeIndex(a_id.index as usize),
+                                   NodeIndex(b_id.index as usize),
                                    *constraint);
                 }
                 ConstrainRegSubVar(_, b_id) => {
                     graph.add_edge(dummy_idx,
-                                   NodeIndex(b_id.index as uint),
+                                   NodeIndex(b_id.index as usize),
                                    *constraint);
                 }
                 ConstrainVarSubReg(a_id, _) => {
-                    graph.add_edge(NodeIndex(a_id.index as uint),
+                    graph.add_edge(NodeIndex(a_id.index as usize),
                                    dummy_idx,
                                    *constraint);
                 }
@@ -1395,7 +1395,7 @@ fn free_regions_first(a: &RegionAndOrigin,
                     debug!("pushing SubSupConflict sub: {:?} sup: {:?}",
                            lower_bound.region, upper_bound.region);
                     errors.push(SubSupConflict(
-                        (*self.var_origins.borrow())[node_idx.index as uint].clone(),
+                        (*self.var_origins.borrow())[node_idx.index as usize].clone(),
                         lower_bound.origin.clone(),
                         lower_bound.region,
                         upper_bound.origin.clone(),
@@ -1406,7 +1406,7 @@ fn free_regions_first(a: &RegionAndOrigin,
         }
 
         self.tcx.sess.span_bug(
-            (*self.var_origins.borrow())[node_idx.index as uint].span(),
+            (*self.var_origins.borrow())[node_idx.index as usize].span(),
             &format!("collect_error_for_expanding_node() could not find error \
                     for var {:?}, lower_bounds={}, upper_bounds={}",
                     node_idx,
@@ -1439,7 +1439,7 @@ fn collect_error_for_contracting_node(
                   Ok(_) => {}
                   Err(_) => {
                     errors.push(SupSupConflict(
-                        (*self.var_origins.borrow())[node_idx.index as uint].clone(),
+                        (*self.var_origins.borrow())[node_idx.index as usize].clone(),
                         upper_bound_1.origin.clone(),
                         upper_bound_1.region,
                         upper_bound_2.origin.clone(),
@@ -1451,7 +1451,7 @@ fn collect_error_for_contracting_node(
         }
 
         self.tcx.sess.span_bug(
-            (*self.var_origins.borrow())[node_idx.index as uint].span(),
+            (*self.var_origins.borrow())[node_idx.index as usize].span(),
             &format!("collect_error_for_contracting_node() could not find error \
                      for var {:?}, upper_bounds={}",
                     node_idx,
@@ -1485,12 +1485,12 @@ struct WalkState<'tcx> {
 
         while !state.stack.is_empty() {
             let node_idx = state.stack.pop().unwrap();
-            let classification = var_data[node_idx.index as uint].classification;
+            let classification = var_data[node_idx.index as usize].classification;
 
             // check whether we've visited this node on some previous walk
-            if dup_vec[node_idx.index as uint] == u32::MAX {
-                dup_vec[node_idx.index as uint] = orig_node_idx.index;
-            } else if dup_vec[node_idx.index as uint] != orig_node_idx.index {
+            if dup_vec[node_idx.index as usize] == u32::MAX {
+                dup_vec[node_idx.index as usize] = orig_node_idx.index;
+            } else if dup_vec[node_idx.index as usize] != orig_node_idx.index {
                 state.dup_found = true;
             }
 
@@ -1518,7 +1518,7 @@ fn process_edges<'a, 'tcx>(this: &RegionVarBindings<'a, 'tcx>,
                          dir: Direction) {
             debug!("process_edges(source_vid={:?}, dir={:?})", source_vid, dir);
 
-            let source_node_index = NodeIndex(source_vid.index as uint);
+            let source_node_index = NodeIndex(source_vid.index as usize);
             graph.each_adjacent_edge(source_node_index, dir, |_, edge| {
                 match edge.data {
                     ConstrainVarSubVar(from_vid, to_vid) => {
@@ -1603,7 +1603,7 @@ fn normalize(values: &Vec<VarValue>, r: ty::Region) -> ty::Region {
 }
 
 fn lookup(values: &Vec<VarValue>, rid: ty::RegionVid) -> ty::Region {
-    match values[rid.index as uint] {
+    match values[rid.index as usize] {
         Value(r) => r,
         NoValue => ReEmpty, // No constraints, return ty::ReEmpty
         ErrorValue => ReStatic, // Previously reported error.
index 423fb86dc5c855fe6320e6d5f4d2278fc4f373ad..5d23fe3f1348dc0657adf9a41dc8e3a4e94ff2d0 100644 (file)
@@ -9,14 +9,14 @@
 // except according to those terms.
 
 use super::combine::*;
-use super::{cres};
+use super::cres;
 use super::higher_ranked::HigherRankedRelations;
-use super::{Subtype};
+use super::Subtype;
 use super::type_variable::{SubtypeOf, SupertypeOf};
 
 use middle::ty::{self, Ty};
 use middle::ty::TyVar;
-use util::ppaux::{Repr};
+use util::ppaux::Repr;
 
 /// "Greatest lower bound" (common subtype)
 pub struct Sub<'f, 'tcx: 'f> {
index a856137af090a706c68461ad0beac834086e1aa5..553ef9afc28165da821f6dad614e8d2d30d6a78d 100644 (file)
@@ -69,11 +69,11 @@ pub fn new() -> TypeVariableTable<'tcx> {
     }
 
     fn relations<'a>(&'a mut self, a: ty::TyVid) -> &'a mut Vec<Relation> {
-        relations(self.values.get_mut(a.index as uint))
+        relations(self.values.get_mut(a.index as usize))
     }
 
     pub fn var_diverges<'a>(&'a self, vid: ty::TyVid) -> bool {
-        self.values.get(vid.index as uint).diverging
+        self.values.get(vid.index as usize).diverging
     }
 
     /// Records that `a <: b`, `a :> b`, or `a == b`, depending on `dir`.
@@ -97,7 +97,7 @@ pub fn instantiate_and_push(
         stack: &mut Vec<(Ty<'tcx>, RelationDir, ty::TyVid)>)
     {
         let old_value = {
-            let value_ptr = &mut self.values.get_mut(vid.index as uint).value;
+            let value_ptr = &mut self.values.get_mut(vid.index as usize).value;
             mem::replace(value_ptr, Known(ty))
         };
 
@@ -123,7 +123,7 @@ pub fn new_var(&mut self, diverging: bool) -> ty::TyVid {
     }
 
     pub fn probe(&self, vid: ty::TyVid) -> Option<Ty<'tcx>> {
-        match self.values.get(vid.index as uint).value {
+        match self.values.get(vid.index as usize).value {
             Bounded(..) => None,
             Known(t) => Some(t)
         }
@@ -206,12 +206,12 @@ fn reverse(&mut self,
                action: UndoEntry) {
         match action {
             SpecifyVar(vid, relations) => {
-                values[vid.index as uint].value = Bounded(relations);
+                values[vid.index as usize].value = Bounded(relations);
             }
 
             Relate(a, b) => {
-                relations(&mut (*values)[a.index as uint]).pop();
-                relations(&mut (*values)[b.index as uint]).pop();
+                relations(&mut (*values)[a.index as usize]).pop();
+                relations(&mut (*values)[b.index as usize]).pop();
             }
         }
     }
index 0675cec6f69b5d61a0dac228d73d24f8c3108cf3..8a736d47b5d8944a338c1ad9a9dcdc3ee2bea29f 100644 (file)
@@ -35,9 +35,9 @@
 pub trait UnifyKey : Clone + Debug + PartialEq {
     type Value : UnifyValue;
 
-    fn index(&self) -> uint;
+    fn index(&self) -> usize;
 
-    fn from_index(u: uint) -> Self;
+    fn from_index(u: usize) -> Self;
 
     // Given an inference context, returns the unification table
     // appropriate to this key type.
@@ -67,7 +67,7 @@ pub trait UnifyValue : Clone + PartialEq + Debug {
 #[derive(PartialEq,Clone,Debug)]
 pub enum VarValue<K:UnifyKey> {
     Redirect(K),
-    Root(K::Value, uint),
+    Root(K::Value, usize),
 }
 
 /// Table of unification keys and their values.
@@ -89,7 +89,7 @@ pub struct Snapshot<K:UnifyKey> {
 pub struct Node<K:UnifyKey> {
     pub key: K,
     pub value: K::Value,
-    pub rank: uint,
+    pub rank: usize,
 }
 
 #[derive(Copy)]
@@ -186,7 +186,7 @@ pub fn unify<'tcx>(&mut self,
                        tcx: &ty::ctxt<'tcx>,
                        node_a: &Node<K>,
                        node_b: &Node<K>)
-                       -> (K, uint)
+                       -> (K, usize)
     {
         debug!("unify(node_a(id={:?}, rank={:?}), node_b(id={:?}, rank={:?}))",
                node_a.key,
@@ -358,9 +358,9 @@ fn probe_var(&self, a_id: K) -> Option<Ty<'tcx>> {
 impl UnifyKey for ty::IntVid {
     type Value = Option<IntVarValue>;
 
-    fn index(&self) -> uint { self.index as uint }
+    fn index(&self) -> usize { self.index as usize }
 
-    fn from_index(i: uint) -> ty::IntVid { ty::IntVid { index: i as u32 } }
+    fn from_index(i: usize) -> ty::IntVid { ty::IntVid { index: i as u32 } }
 
     fn unification_table<'v>(infcx: &'v InferCtxt) -> &'v RefCell<UnificationTable<ty::IntVid>> {
         return &infcx.int_unification_table;
@@ -391,9 +391,9 @@ impl UnifyValue for Option<IntVarValue> { }
 impl UnifyKey for ty::FloatVid {
     type Value = Option<ast::FloatTy>;
 
-    fn index(&self) -> uint { self.index as uint }
+    fn index(&self) -> usize { self.index as usize }
 
-    fn from_index(i: uint) -> ty::FloatVid { ty::FloatVid { index: i as u32 } }
+    fn from_index(i: usize) -> ty::FloatVid { ty::FloatVid { index: i as u32 } }
 
     fn unification_table<'v>(infcx: &'v InferCtxt) -> &'v RefCell<UnificationTable<ty::FloatVid>> {
         return &infcx.float_unification_table;
index bd96a8a0f2cd78f980ea42ecb19fcb9749f59321..2a4c25345447fb84e980525862e8b8b984fafbd5 100644 (file)
@@ -28,8 +28,8 @@ pub fn check_crate(tcx: &ctxt) {
     let mut visitor = IntrinsicCheckingVisitor {
         tcx: tcx,
         param_envs: Vec::new(),
-        dummy_sized_ty: tcx.types.int,
-        dummy_unsized_ty: ty::mk_vec(tcx, tcx.types.int, None),
+        dummy_sized_ty: tcx.types.isize,
+        dummy_unsized_ty: ty::mk_vec(tcx, tcx.types.isize, None),
     };
     visit::walk_crate(&mut visitor, tcx.map.krate());
 }
index 73d31a1f6201d6c3a0baa006778cc13d89b8fdac..b9a82669f65d3910f0606e884f88aafc7d64f141 100644 (file)
@@ -70,7 +70,7 @@ pub fn items<'a>(&'a self) -> Enumerate<slice::Iter<'a, Option<ast::DefId>>> {
         self.items.iter().enumerate()
     }
 
-    pub fn item_name(index: uint) -> &'static str {
+    pub fn item_name(index: usize) -> &'static str {
         let item: Option<LangItem> = FromPrimitive::from_usize(index);
         match item {
             $( Some($variant) => $name, )*
@@ -79,11 +79,11 @@ pub fn item_name(index: uint) -> &'static str {
     }
 
     pub fn require(&self, it: LangItem) -> Result<ast::DefId, String> {
-        match self.items[it as uint] {
+        match self.items[it as usize] {
             Some(id) => Ok(id),
             None => {
                 Err(format!("requires `{}` lang_item",
-                            LanguageItems::item_name(it as uint)))
+                            LanguageItems::item_name(it as usize)))
             }
         }
     }
@@ -132,7 +132,7 @@ pub fn fn_trait_kind(&self, id: ast::DefId) -> Option<ty::ClosureKind> {
     $(
         #[allow(dead_code)]
         pub fn $method(&self) -> Option<ast::DefId> {
-            self.items[$variant as uint]
+            self.items[$variant as usize]
         }
     )*
 }
@@ -142,7 +142,7 @@ struct LanguageItemCollector<'a> {
 
     session: &'a Session,
 
-    item_refs: FnvHashMap<&'static str, uint>,
+    item_refs: FnvHashMap<&'static str, usize>,
 }
 
 impl<'a, 'v> Visitor<'v> for LanguageItemCollector<'a> {
@@ -163,7 +163,7 @@ impl<'a> LanguageItemCollector<'a> {
     pub fn new(session: &'a Session) -> LanguageItemCollector<'a> {
         let mut item_refs = FnvHashMap();
 
-        $( item_refs.insert($name, $variant as uint); )*
+        $( item_refs.insert($name, $variant as usize); )*
 
         LanguageItemCollector {
             session: session,
@@ -172,7 +172,7 @@ pub fn new(session: &'a Session) -> LanguageItemCollector<'a> {
         }
     }
 
-    pub fn collect_item(&mut self, item_index: uint,
+    pub fn collect_item(&mut self, item_index: usize,
                         item_def_id: ast::DefId, span: Span) {
         // Check for duplicates.
         match self.items.items[item_index] {
index bdcfc67f92b997a370cad0693f2eab1f729c626f..3738e38f68704988e75dfc6c1231570f1e6c2fa2 100644 (file)
 pub use self::deref_kind::*;
 pub use self::categorization::*;
 
+use self::Aliasability::*;
+
 use middle::check_const;
 use middle::def;
 use middle::region;
 use middle::ty::{self, Ty};
-use util::nodemap::{NodeMap};
+use util::nodemap::NodeMap;
 use util::ppaux::{Repr, UserString};
 
 use syntax::ast::{MutImmutable, MutMutable};
@@ -94,7 +96,7 @@ pub enum categorization<'tcx> {
     cat_static_item,
     cat_upvar(Upvar),                          // upvar referenced by closure env
     cat_local(ast::NodeId),                    // local variable
-    cat_deref(cmt<'tcx>, uint, PointerKind),   // deref of a ptr
+    cat_deref(cmt<'tcx>, usize, PointerKind),   // deref of a ptr
     cat_interior(cmt<'tcx>, InteriorKind),     // something interior: field, tuple, etc
     cat_downcast(cmt<'tcx>, ast::DefId),       // selects a particular enum variant (*1)
 
@@ -135,7 +137,7 @@ pub enum InteriorKind {
 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
 pub enum FieldName {
     NamedField(ast::Name),
-    PositionalField(uint)
+    PositionalField(usize)
 }
 
 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
@@ -295,23 +297,29 @@ fn node_method_origin(&self, method_call: ty::MethodCall)
 
 impl MutabilityCategory {
     pub fn from_mutbl(m: ast::Mutability) -> MutabilityCategory {
-        match m {
+        let ret = match m {
             MutImmutable => McImmutable,
             MutMutable => McDeclared
-        }
+        };
+        debug!("MutabilityCategory::{}({:?}) => {:?}",
+               "from_mutbl", m, ret);
+        ret
     }
 
     pub fn from_borrow_kind(borrow_kind: ty::BorrowKind) -> MutabilityCategory {
-        match borrow_kind {
+        let ret = match borrow_kind {
             ty::ImmBorrow => McImmutable,
             ty::UniqueImmBorrow => McImmutable,
             ty::MutBorrow => McDeclared,
-        }
+        };
+        debug!("MutabilityCategory::{}({:?}) => {:?}",
+               "from_borrow_kind", borrow_kind, ret);
+        ret
     }
 
-    pub fn from_pointer_kind(base_mutbl: MutabilityCategory,
-                             ptr: PointerKind) -> MutabilityCategory {
-        match ptr {
+    fn from_pointer_kind(base_mutbl: MutabilityCategory,
+                         ptr: PointerKind) -> MutabilityCategory {
+        let ret = match ptr {
             Unique => {
                 base_mutbl.inherit()
             }
@@ -321,11 +329,14 @@ pub fn from_pointer_kind(base_mutbl: MutabilityCategory,
             UnsafePtr(m) => {
                 MutabilityCategory::from_mutbl(m)
             }
-        }
+        };
+        debug!("MutabilityCategory::{}({:?}, {:?}) => {:?}",
+               "from_pointer_kind", base_mutbl, ptr, ret);
+        ret
     }
 
     fn from_local(tcx: &ty::ctxt, id: ast::NodeId) -> MutabilityCategory {
-        match tcx.map.get(id) {
+        let ret = match tcx.map.get(id) {
             ast_map::NodeLocal(p) | ast_map::NodeArg(p) => match p.node {
                 ast::PatIdent(bind_mode, _, _) => {
                     if bind_mode == ast::BindByValue(ast::MutMutable) {
@@ -337,30 +348,39 @@ fn from_local(tcx: &ty::ctxt, id: ast::NodeId) -> MutabilityCategory {
                 _ => tcx.sess.span_bug(p.span, "expected identifier pattern")
             },
             _ => tcx.sess.span_bug(tcx.map.span(id), "expected identifier pattern")
-        }
+        };
+        debug!("MutabilityCategory::{}(tcx, id={:?}) => {:?}",
+               "from_local", id, ret);
+        ret
     }
 
     pub fn inherit(&self) -> MutabilityCategory {
-        match *self {
+        let ret = match *self {
             McImmutable => McImmutable,
             McDeclared => McInherited,
             McInherited => McInherited,
-        }
+        };
+        debug!("{:?}.inherit() => {:?}", self, ret);
+        ret
     }
 
     pub fn is_mutable(&self) -> bool {
-        match *self {
+        let ret = match *self {
             McImmutable => false,
             McInherited => true,
             McDeclared => true,
-        }
+        };
+        debug!("{:?}.is_mutable() => {:?}", self, ret);
+        ret
     }
 
     pub fn is_immutable(&self) -> bool {
-        match *self {
+        let ret = match *self {
             McImmutable => true,
             McDeclared | McInherited => false
-        }
+        };
+        debug!("{:?}.is_immutable() => {:?}", self, ret);
+        ret
     }
 
     pub fn to_user_str(&self) -> &'static str {
@@ -462,7 +482,7 @@ pub fn cat_expr(&self, expr: &ast::Expr) -> McResult<cmt<'tcx>> {
 
     pub fn cat_expr_autoderefd(&self,
                                expr: &ast::Expr,
-                               autoderefs: uint)
+                               autoderefs: usize)
                                -> McResult<cmt<'tcx>> {
         let mut cmt = try!(self.cat_expr_unadjusted(expr));
         debug!("cat_expr_autoderefd: autoderefs={}, cmt={}",
@@ -733,7 +753,9 @@ fn cat_upvar(&self,
             }
         };
 
-        Ok(Rc::new(cmt_result))
+        let ret = Rc::new(cmt_result);
+        debug!("cat_upvar ret={}", ret.repr(self.tcx()));
+        Ok(ret)
     }
 
     fn env_deref(&self,
@@ -794,14 +816,18 @@ fn env_deref(&self,
             McDeclared | McInherited => { }
         }
 
-        cmt_ {
+        let ret = cmt_ {
             id: id,
             span: span,
             cat: cat_deref(Rc::new(cmt_result), 0, env_ptr),
             mutbl: deref_mutbl,
             ty: var_ty,
             note: NoteClosureEnv(upvar_id)
-        }
+        };
+
+        debug!("env_deref ret {}", ret.repr(self.tcx()));
+
+        ret
     }
 
     pub fn cat_rvalue_node(&self,
@@ -831,7 +857,9 @@ pub fn cat_rvalue_node(&self,
                 }
             }
         };
-        self.cat_rvalue(id, span, re, expr_ty)
+        let ret = self.cat_rvalue(id, span, re, expr_ty);
+        debug!("cat_rvalue_node ret {}", ret.repr(self.tcx()));
+        ret
     }
 
     pub fn cat_rvalue(&self,
@@ -839,14 +867,16 @@ pub fn cat_rvalue(&self,
                       span: Span,
                       temp_scope: ty::Region,
                       expr_ty: Ty<'tcx>) -> cmt<'tcx> {
-        Rc::new(cmt_ {
+        let ret = Rc::new(cmt_ {
             id:cmt_id,
             span:span,
             cat:cat_rvalue(temp_scope),
             mutbl:McDeclared,
             ty:expr_ty,
             note: NoteNone
-        })
+        });
+        debug!("cat_rvalue ret {}", ret.repr(self.tcx()));
+        ret
     }
 
     pub fn cat_field<N:ast_node>(&self,
@@ -855,36 +885,40 @@ pub fn cat_field<N:ast_node>(&self,
                                  f_name: ast::Name,
                                  f_ty: Ty<'tcx>)
                                  -> cmt<'tcx> {
-        Rc::new(cmt_ {
+        let ret = Rc::new(cmt_ {
             id: node.id(),
             span: node.span(),
             mutbl: base_cmt.mutbl.inherit(),
             cat: cat_interior(base_cmt, InteriorField(NamedField(f_name))),
             ty: f_ty,
             note: NoteNone
-        })
+        });
+        debug!("cat_field ret {}", ret.repr(self.tcx()));
+        ret
     }
 
     pub fn cat_tup_field<N:ast_node>(&self,
                                      node: &N,
                                      base_cmt: cmt<'tcx>,
-                                     f_idx: uint,
+                                     f_idx: usize,
                                      f_ty: Ty<'tcx>)
                                      -> cmt<'tcx> {
-        Rc::new(cmt_ {
+        let ret = Rc::new(cmt_ {
             id: node.id(),
             span: node.span(),
             mutbl: base_cmt.mutbl.inherit(),
             cat: cat_interior(base_cmt, InteriorField(PositionalField(f_idx))),
             ty: f_ty,
             note: NoteNone
-        })
+        });
+        debug!("cat_tup_field ret {}", ret.repr(self.tcx()));
+        ret
     }
 
     fn cat_deref<N:ast_node>(&self,
                              node: &N,
                              base_cmt: cmt<'tcx>,
-                             deref_cnt: uint,
+                             deref_cnt: usize,
                              deref_context: DerefKindContext)
                              -> McResult<cmt<'tcx>> {
         let adjustment = match self.typer.adjustments().borrow().get(&node.id()) {
@@ -913,10 +947,14 @@ fn cat_deref<N:ast_node>(&self,
         };
         let base_cmt_ty = base_cmt.ty;
         match ty::deref(base_cmt_ty, true) {
-            Some(mt) => self.cat_deref_common(node, base_cmt, deref_cnt,
+            Some(mt) => {
+                let ret = self.cat_deref_common(node, base_cmt, deref_cnt,
                                               mt.ty,
                                               deref_context,
-                                              /* implicit: */ false),
+                                                /* implicit: */ false);
+                debug!("cat_deref ret {}", ret.repr(self.tcx()));
+                ret
+            }
             None => {
                 debug!("Explicit deref of non-derefable type: {}",
                        base_cmt_ty.repr(self.tcx()));
@@ -928,7 +966,7 @@ fn cat_deref<N:ast_node>(&self,
     fn cat_deref_common<N:ast_node>(&self,
                                     node: &N,
                                     base_cmt: cmt<'tcx>,
-                                    deref_cnt: uint,
+                                    deref_cnt: usize,
                                     deref_ty: Ty<'tcx>,
                                     deref_context: DerefKindContext,
                                     implicit: bool)
@@ -954,14 +992,16 @@ fn cat_deref_common<N:ast_node>(&self,
                 (base_cmt.mutbl.inherit(), cat_interior(base_cmt, interior))
             }
         };
-        Ok(Rc::new(cmt_ {
+        let ret = Rc::new(cmt_ {
             id: node.id(),
             span: node.span(),
             cat: cat,
             mutbl: m,
             ty: deref_ty,
             note: NoteNone
-        }))
+        });
+        debug!("cat_deref_common ret {}", ret.repr(self.tcx()));
+        Ok(ret)
     }
 
     pub fn cat_index<N:ast_node>(&self,
@@ -1009,8 +1049,10 @@ pub fn cat_index<N:ast_node>(&self,
         };
 
         let m = base_cmt.mutbl.inherit();
-        return Ok(interior(elt, base_cmt.clone(), base_cmt.ty,
-                           m, context, element_ty));
+        let ret = interior(elt, base_cmt.clone(), base_cmt.ty,
+                           m, context, element_ty);
+        debug!("cat_index ret {}", ret.repr(self.tcx()));
+        return Ok(ret);
 
         fn interior<'tcx, N: ast_node>(elt: &N,
                                        of_cmt: cmt<'tcx>,
@@ -1039,14 +1081,14 @@ fn deref_vec<N:ast_node>(&self,
                              context: InteriorOffsetKind)
                              -> McResult<cmt<'tcx>>
     {
-        match try!(deref_kind(base_cmt.ty, Some(context))) {
+        let ret = match try!(deref_kind(base_cmt.ty, Some(context))) {
             deref_ptr(ptr) => {
                 // for unique ptrs, we inherit mutability from the
                 // owning reference.
                 let m = MutabilityCategory::from_pointer_kind(base_cmt.mutbl, ptr);
 
                 // the deref is explicit in the resulting cmt
-                Ok(Rc::new(cmt_ {
+                Rc::new(cmt_ {
                     id:elt.id(),
                     span:elt.span(),
                     cat:cat_deref(base_cmt.clone(), 0, ptr),
@@ -1056,13 +1098,15 @@ fn deref_vec<N:ast_node>(&self,
                         None => self.tcx().sess.bug("Found non-derefable type")
                     },
                     note: NoteNone
-                }))
+                })
             }
 
             deref_interior(_) => {
-                Ok(base_cmt)
+                base_cmt
             }
-        }
+        };
+        debug!("deref_vec ret {}", ret.repr(self.tcx()));
+        Ok(ret)
     }
 
     /// Given a pattern P like: `[_, ..Q, _]`, where `vec_cmt` is the cmt for `P`, `slice_pat` is
@@ -1112,14 +1156,16 @@ pub fn cat_imm_interior<N:ast_node>(&self,
                                         interior_ty: Ty<'tcx>,
                                         interior: InteriorKind)
                                         -> cmt<'tcx> {
-        Rc::new(cmt_ {
+        let ret = Rc::new(cmt_ {
             id: node.id(),
             span: node.span(),
             mutbl: base_cmt.mutbl.inherit(),
             cat: cat_interior(base_cmt, interior),
             ty: interior_ty,
             note: NoteNone
-        })
+        });
+        debug!("cat_imm_interior ret={}", ret.repr(self.tcx()));
+        ret
     }
 
     pub fn cat_downcast<N:ast_node>(&self,
@@ -1128,14 +1174,16 @@ pub fn cat_downcast<N:ast_node>(&self,
                                     downcast_ty: Ty<'tcx>,
                                     variant_did: ast::DefId)
                                     -> cmt<'tcx> {
-        Rc::new(cmt_ {
+        let ret = Rc::new(cmt_ {
             id: node.id(),
             span: node.span(),
             mutbl: base_cmt.mutbl.inherit(),
             cat: cat_downcast(base_cmt, variant_did),
             ty: downcast_ty,
             note: NoteNone
-        })
+        });
+        debug!("cat_downcast ret={}", ret.repr(self.tcx()));
+        ret
     }
 
     pub fn cat_pattern<F>(&self, cmt: cmt<'tcx>, pat: &ast::Pat, mut op: F) -> McResult<()>
@@ -1341,17 +1389,25 @@ fn overloaded_method_return_ty(&self,
     }
 }
 
-#[derive(Copy)]
+#[derive(Copy, Clone, Debug)]
 pub enum InteriorSafety {
     InteriorUnsafe,
     InteriorSafe
 }
 
-#[derive(Copy)]
+#[derive(Clone, Debug)]
+pub enum Aliasability {
+    FreelyAliasable(AliasableReason),
+    NonAliasable,
+    ImmutableUnique(Box<Aliasability>),
+}
+
+#[derive(Copy, Clone, Debug)]
 pub enum AliasableReason {
     AliasableBorrowed,
     AliasableClosure(ast::NodeId), // Aliasable due to capture Fn closure env
     AliasableOther,
+    UnaliasableImmutable, // Created as needed upon seeing ImmutableUnique
     AliasableStatic(InteriorSafety),
     AliasableStaticMut(InteriorSafety),
 }
@@ -1380,9 +1436,9 @@ pub fn guarantor(&self) -> cmt<'tcx> {
         }
     }
 
-    /// Returns `Some(_)` if this lvalue represents a freely aliasable pointer type.
+    /// Returns `FreelyAliasable(_)` if this lvalue represents a freely aliasable pointer type.
     pub fn freely_aliasable(&self, ctxt: &ty::ctxt<'tcx>)
-                            -> Option<AliasableReason> {
+                            -> Aliasability {
         // Maybe non-obvious: copied upvars can only be considered
         // non-aliasable in once closures, since any other kind can be
         // aliased and eventually recused.
@@ -1393,17 +1449,27 @@ pub fn freely_aliasable(&self, ctxt: &ty::ctxt<'tcx>)
             cat_deref(ref b, _, BorrowedPtr(ty::UniqueImmBorrow, _)) |
             cat_deref(ref b, _, Implicit(ty::UniqueImmBorrow, _)) |
             cat_downcast(ref b, _) |
-            cat_deref(ref b, _, Unique) |
             cat_interior(ref b, _) => {
                 // Aliasability depends on base cmt
                 b.freely_aliasable(ctxt)
             }
 
+            cat_deref(ref b, _, Unique) => {
+                let sub = b.freely_aliasable(ctxt);
+                if b.mutbl.is_mutable() {
+                    // Aliasability depends on base cmt alone
+                    sub
+                } else {
+                    // Do not allow mutation through an immutable box.
+                    ImmutableUnique(Box::new(sub))
+                }
+            }
+
             cat_rvalue(..) |
             cat_local(..) |
             cat_upvar(..) |
             cat_deref(_, _, UnsafePtr(..)) => { // yes, it's aliasable, but...
-                None
+                NonAliasable
             }
 
             cat_static_item(..) => {
@@ -1414,17 +1480,18 @@ pub fn freely_aliasable(&self, ctxt: &ty::ctxt<'tcx>)
                 };
 
                 if self.mutbl.is_mutable() {
-                    Some(AliasableStaticMut(int_safe))
+                    FreelyAliasable(AliasableStaticMut(int_safe))
                 } else {
-                    Some(AliasableStatic(int_safe))
+                    FreelyAliasable(AliasableStatic(int_safe))
                 }
             }
 
             cat_deref(ref base, _, BorrowedPtr(ty::ImmBorrow, _)) |
             cat_deref(ref base, _, Implicit(ty::ImmBorrow, _)) => {
                 match base.cat {
-                    cat_upvar(Upvar{ id, .. }) => Some(AliasableClosure(id.closure_expr_id)),
-                    _ => Some(AliasableBorrowed)
+                    cat_upvar(Upvar{ id, .. }) =>
+                        FreelyAliasable(AliasableClosure(id.closure_expr_id)),
+                    _ => FreelyAliasable(AliasableBorrowed)
                 }
             }
         }
index 4f365beed213f2a44f57d238779cb69d84cebcd7..12b56562c84d6b825087ef50c0aab5bf4d0caa31 100644 (file)
@@ -13,7 +13,7 @@
 use util::nodemap::FnvHashMap;
 
 use syntax::ast;
-use syntax::ast_util::{walk_pat};
+use syntax::ast_util::walk_pat;
 use syntax::codemap::{Span, DUMMY_SP};
 
 pub type PatIdMap = FnvHashMap<ast::Ident, ast::NodeId>;
index b4db3aba7867dc72cbaec8a3519dd07c5725a32f..d8c5f89325b34f101dc3c70086c7b2f0e692cf9b 100644 (file)
@@ -25,7 +25,7 @@
 use syntax::codemap::{self, Span};
 use syntax::{ast, visit};
 use syntax::ast::{Block, Item, FnDecl, NodeId, Arm, Pat, Stmt, Expr, Local};
-use syntax::ast_util::{stmt_id};
+use syntax::ast_util::stmt_id;
 use syntax::ast_map;
 use syntax::ptr::P;
 use syntax::visit::{Visitor, FnKind};
@@ -136,7 +136,7 @@ pub fn to_code_extent(&self) -> CodeExtent {
          RustcDecodable, Debug, Copy)]
 pub struct BlockRemainder {
     pub block: ast::NodeId,
-    pub first_statement_index: uint,
+    pub first_statement_index: usize,
 }
 
 impl CodeExtent {
@@ -284,7 +284,7 @@ fn to_code_extent(&self) -> Option<CodeExtent> {
 struct DeclaringStatementContext {
     stmt_id: ast::NodeId,
     block_id: ast::NodeId,
-    stmt_index: uint,
+    stmt_index: usize,
 }
 
 impl DeclaringStatementContext {
index e33a255343161b17769f70912d74badd77e7d394..a3d71c989bfdf8303c65e66e74db66c8a0a030e1 100644 (file)
@@ -28,7 +28,7 @@
 use syntax::codemap::Span;
 use syntax::parse::token::special_idents;
 use syntax::parse::token;
-use syntax::print::pprust::{lifetime_to_string};
+use syntax::print::pprust::lifetime_to_string;
 use syntax::visit;
 use syntax::visit::Visitor;
 use util::nodemap::NodeMap;
index 684b28d03739e3fe28b84a524b120e4b48a32d3a..e2ebe2bc0f1e53fa1ad1cb39aebf17f116469f9b 100644 (file)
@@ -98,7 +98,7 @@ pub fn is_noop(&self) -> bool {
     }
 
     pub fn type_for_def(&self, ty_param_def: &ty::TypeParameterDef) -> Ty<'tcx> {
-        *self.types.get(ty_param_def.space, ty_param_def.index as uint)
+        *self.types.get(ty_param_def.space, ty_param_def.index as usize)
     }
 
     pub fn has_regions_escaping_depth(&self, depth: u32) -> bool {
@@ -193,7 +193,7 @@ impl ParamSpace {
         [TypeSpace, SelfSpace, FnSpace]
     }
 
-    pub fn to_uint(self) -> uint {
+    pub fn to_uint(self) -> usize {
         match self {
             TypeSpace => 0,
             SelfSpace => 1,
@@ -201,7 +201,7 @@ pub fn to_uint(self) -> uint {
         }
     }
 
-    pub fn from_uint(u: uint) -> ParamSpace {
+    pub fn from_uint(u: usize) -> ParamSpace {
         match u {
             0 => TypeSpace,
             1 => SelfSpace,
@@ -226,8 +226,8 @@ pub struct VecPerParamSpace<T> {
     // AF(self) = (self.content[..self.type_limit],
     //             self.content[self.type_limit..self.self_limit],
     //             self.content[self.self_limit..])
-    type_limit: uint,
-    self_limit: uint,
+    type_limit: usize,
+    self_limit: usize,
     content: Vec<T>,
 }
 
@@ -251,7 +251,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
 }
 
 impl<T> VecPerParamSpace<T> {
-    fn limits(&self, space: ParamSpace) -> (uint, uint) {
+    fn limits(&self, space: ParamSpace) -> (usize, usize) {
         match space {
             TypeSpace => (0, self.type_limit),
             SelfSpace => (self.type_limit, self.self_limit),
@@ -290,7 +290,7 @@ pub fn new(t: Vec<T>, s: Vec<T>, f: Vec<T>) -> VecPerParamSpace<T> {
         }
     }
 
-    fn new_internal(content: Vec<T>, type_limit: uint, self_limit: uint)
+    fn new_internal(content: Vec<T>, type_limit: usize, self_limit: usize)
                     -> VecPerParamSpace<T>
     {
         VecPerParamSpace {
@@ -343,7 +343,7 @@ pub fn pop(&mut self, space: ParamSpace) -> Option<T> {
         }
     }
 
-    pub fn truncate(&mut self, space: ParamSpace, len: uint) {
+    pub fn truncate(&mut self, space: ParamSpace, len: usize) {
         // FIXME (#15435): slow; O(n^2); could enhance vec to make it O(n).
         while self.len(space) > len {
             self.pop(space);
@@ -364,7 +364,7 @@ pub fn get_self<'a>(&'a self) -> Option<&'a T> {
         if v.len() == 0 { None } else { Some(&v[0]) }
     }
 
-    pub fn len(&self, space: ParamSpace) -> uint {
+    pub fn len(&self, space: ParamSpace) -> usize {
         self.get_slice(space).len()
     }
 
@@ -384,13 +384,13 @@ pub fn get_mut_slice<'a>(&'a mut self, space: ParamSpace) -> &'a mut [T] {
 
     pub fn opt_get<'a>(&'a self,
                        space: ParamSpace,
-                       index: uint)
+                       index: usize)
                        -> Option<&'a T> {
         let v = self.get_slice(space);
         if index < v.len() { Some(&v[index]) } else { None }
     }
 
-    pub fn get<'a>(&'a self, space: ParamSpace, index: uint) -> &'a T {
+    pub fn get<'a>(&'a self, space: ParamSpace, index: usize) -> &'a T {
         &self.get_slice(space)[index]
     }
 
@@ -441,7 +441,7 @@ pub fn map<U, P>(&self, pred: P) -> VecPerParamSpace<U> where P: FnMut(&T) -> U
     }
 
     pub fn map_enumerated<U, P>(&self, pred: P) -> VecPerParamSpace<U> where
-        P: FnMut((ParamSpace, uint, &T)) -> U,
+        P: FnMut((ParamSpace, usize, &T)) -> U,
     {
         let result = self.iter_enumerated().map(pred).collect();
         VecPerParamSpace::new_internal(result,
@@ -487,8 +487,8 @@ pub fn with_vec(mut self, space: ParamSpace, vec: Vec<T>)
 #[derive(Clone)]
 pub struct EnumeratedItems<'a,T:'a> {
     vec: &'a VecPerParamSpace<T>,
-    space_index: uint,
-    elem_index: uint
+    space_index: usize,
+    elem_index: usize
 }
 
 impl<'a,T> EnumeratedItems<'a,T> {
@@ -511,9 +511,9 @@ fn adjust_space(&mut self) {
 }
 
 impl<'a,T> Iterator for EnumeratedItems<'a,T> {
-    type Item = (ParamSpace, uint, &'a T);
+    type Item = (ParamSpace, usize, &'a T);
 
-    fn next(&mut self) -> Option<(ParamSpace, uint, &'a T)> {
+    fn next(&mut self) -> Option<(ParamSpace, usize, &'a T)> {
         let spaces = ParamSpace::all();
         if self.space_index < spaces.len() {
             let space = spaces[self.space_index];
@@ -598,7 +598,7 @@ struct SubstFolder<'a, 'tcx: 'a> {
     root_ty: Option<Ty<'tcx>>,
 
     // Depth of type stack
-    ty_stack_depth: uint,
+    ty_stack_depth: usize,
 
     // Number of region binders we have passed through while doing the substitution
     region_binders_passed: u32,
@@ -626,7 +626,7 @@ fn fold_region(&mut self, r: ty::Region) -> ty::Region {
                 match self.substs.regions {
                     ErasedRegions => ty::ReStatic,
                     NonerasedRegions(ref regions) =>
-                        match regions.opt_get(space, i as uint) {
+                        match regions.opt_get(space, i as usize) {
                             Some(&r) => {
                                 self.shift_region_through_binders(r)
                             }
@@ -682,7 +682,7 @@ fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
 impl<'a,'tcx> SubstFolder<'a,'tcx> {
     fn ty_for_param(&self, p: ty::ParamTy, source_ty: Ty<'tcx>) -> Ty<'tcx> {
         // Look up the type in the substitutions. It really should be in there.
-        let opt_ty = self.substs.types.opt_get(p.space, p.idx as uint);
+        let opt_ty = self.substs.types.opt_get(p.space, p.idx as usize);
         let ty = match opt_ty {
             Some(t) => *t,
             None => {
index 62b81f0ebe7dba8b98e7d4368d755f4aba55da64..11d073ce72e735990c61f70ab273b6c21ea8783d 100644 (file)
@@ -12,7 +12,7 @@
 
 use super::Normalized;
 use super::SelectionContext;
-use super::{ObligationCause};
+use super::ObligationCause;
 use super::PredicateObligation;
 use super::project;
 use super::util;
index 3d46f93914a589c53d21354b1aeff8fde7c63deb..ffd3299175de9de09c43efe9f0e0f0d48d6d878e 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use middle::infer::{InferCtxt};
+use middle::infer::InferCtxt;
 use middle::ty::{self, RegionEscape, Ty};
 use std::collections::HashSet;
 use std::default::Default;
@@ -53,7 +53,7 @@ pub struct FulfillmentContext<'tcx> {
     // Remembers the count of trait obligations that we have already
     // attempted to select. This is used to avoid repeating work
     // when `select_new_obligations` is called.
-    attempted_mark: uint,
+    attempted_mark: usize,
 
     // A set of constraints that regionck must validate. Each
     // constraint has the form `T:'a`, meaning "some type `T` must
@@ -163,6 +163,8 @@ pub fn register_predicate_obligation<'a>(&mut self,
         // debug output much nicer to read and so on.
         let obligation = infcx.resolve_type_vars_if_possible(&obligation);
 
+        assert!(!obligation.has_escaping_regions());
+
         if !self.duplicate_set.insert(obligation.predicate.clone()) {
             debug!("register_predicate({}) -- already seen, skip", obligation.repr(infcx.tcx));
             return;
index 24b201c960f16ffe001b9914c2010b81170e4946..8809abdd70e62b10d664263917bdab2ed643f5b6 100644 (file)
@@ -39,6 +39,7 @@
 pub use self::object_safety::object_safety_violations;
 pub use self::object_safety::ObjectSafetyViolation;
 pub use self::object_safety::MethodViolationCode;
+pub use self::object_safety::is_vtable_safe_method;
 pub use self::select::SelectionContext;
 pub use self::select::SelectionCache;
 pub use self::select::{MethodMatchResult, MethodMatched, MethodAmbiguous, MethodDidNotMatch};
@@ -48,6 +49,8 @@
 pub use self::util::trait_ref_for_builtin_bound;
 pub use self::util::supertraits;
 pub use self::util::Supertraits;
+pub use self::util::supertrait_def_ids;
+pub use self::util::SupertraitDefIds;
 pub use self::util::transitive_bounds;
 pub use self::util::upcast;
 
@@ -68,7 +71,7 @@
 #[derive(Clone, PartialEq, Eq)]
 pub struct Obligation<'tcx, T> {
     pub cause: ObligationCause<'tcx>,
-    pub recursion_depth: uint,
+    pub recursion_depth: usize,
     pub predicate: T,
 }
 
@@ -482,7 +485,7 @@ pub fn new(cause: ObligationCause<'tcx>,
     }
 
     fn with_depth(cause: ObligationCause<'tcx>,
-                  recursion_depth: uint,
+                  recursion_depth: usize,
                   trait_ref: O)
                   -> Obligation<'tcx, O>
     {
@@ -640,7 +643,7 @@ fn new(obligation: PredicateObligation<'tcx>,
 }
 
 impl<'tcx> TraitObligation<'tcx> {
-    fn self_ty(&self) -> Ty<'tcx> {
-        self.predicate.0.self_ty()
+    fn self_ty(&self) -> ty::Binder<Ty<'tcx>> {
+        ty::Binder(self.predicate.skip_binder().self_ty())
     }
 }
index 881487a2dad1150b6e9423075c14fbfb042258db..af6bb4ccccd8026d35a4d3d9d7c5d7f57a597695 100644 (file)
@@ -53,36 +53,36 @@ pub enum MethodViolationCode {
 }
 
 pub fn is_object_safe<'tcx>(tcx: &ty::ctxt<'tcx>,
-                            trait_ref: ty::PolyTraitRef<'tcx>)
+                            trait_def_id: ast::DefId)
                             -> bool
 {
     // Because we query yes/no results frequently, we keep a cache:
     let cached_result =
-        tcx.object_safety_cache.borrow().get(&trait_ref.def_id()).cloned();
+        tcx.object_safety_cache.borrow().get(&trait_def_id).cloned();
 
     let result =
         cached_result.unwrap_or_else(|| {
-            let result = object_safety_violations(tcx, trait_ref.clone()).is_empty();
+            let result = object_safety_violations(tcx, trait_def_id).is_empty();
 
             // Record just a yes/no result in the cache; this is what is
             // queried most frequently. Note that this may overwrite a
             // previous result, but always with the same thing.
-            tcx.object_safety_cache.borrow_mut().insert(trait_ref.def_id(), result);
+            tcx.object_safety_cache.borrow_mut().insert(trait_def_id, result);
 
             result
         });
 
-    debug!("is_object_safe({}) = {}", trait_ref.repr(tcx), result);
+    debug!("is_object_safe({}) = {}", trait_def_id.repr(tcx), result);
 
     result
 }
 
 pub fn object_safety_violations<'tcx>(tcx: &ty::ctxt<'tcx>,
-                                      sub_trait_ref: ty::PolyTraitRef<'tcx>)
+                                      trait_def_id: ast::DefId)
                                       -> Vec<ObjectSafetyViolation<'tcx>>
 {
-    supertraits(tcx, sub_trait_ref)
-        .flat_map(|tr| object_safety_violations_for_trait(tcx, tr.def_id()).into_iter())
+    traits::supertrait_def_ids(tcx, trait_def_id)
+        .flat_map(|def_id| object_safety_violations_for_trait(tcx, def_id).into_iter())
         .collect()
 }
 
@@ -96,7 +96,7 @@ fn object_safety_violations_for_trait<'tcx>(tcx: &ty::ctxt<'tcx>,
         .flat_map(|item| {
             match *item {
                 ty::MethodTraitItem(ref m) => {
-                    object_safety_violations_for_method(tcx, trait_def_id, &**m)
+                    object_safety_violation_for_method(tcx, trait_def_id, &**m)
                         .map(|code| ObjectSafetyViolation::Method(m.clone(), code))
                         .into_iter()
                 }
@@ -193,10 +193,11 @@ fn generics_require_sized_self<'tcx>(tcx: &ty::ctxt<'tcx>,
         })
 }
 
-fn object_safety_violations_for_method<'tcx>(tcx: &ty::ctxt<'tcx>,
-                                             trait_def_id: ast::DefId,
-                                             method: &ty::Method<'tcx>)
-                                             -> Option<MethodViolationCode>
+/// Returns `Some(_)` if this method makes the containing trait not object safe.
+fn object_safety_violation_for_method<'tcx>(tcx: &ty::ctxt<'tcx>,
+                                            trait_def_id: ast::DefId,
+                                            method: &ty::Method<'tcx>)
+                                            -> Option<MethodViolationCode>
 {
     // Any method that has a `Self : Sized` requisite is otherwise
     // exempt from the regulations.
@@ -204,6 +205,30 @@ fn object_safety_violations_for_method<'tcx>(tcx: &ty::ctxt<'tcx>,
         return None;
     }
 
+    virtual_call_violation_for_method(tcx, trait_def_id, method)
+}
+
+/// We say a method is *vtable safe* if it can be invoked on a trait
+/// object.  Note that object-safe traits can have some
+/// non-vtable-safe methods, so long as they require `Self:Sized` or
+/// otherwise ensure that they cannot be used when `Self=Trait`.
+pub fn is_vtable_safe_method<'tcx>(tcx: &ty::ctxt<'tcx>,
+                                   trait_def_id: ast::DefId,
+                                   method: &ty::Method<'tcx>)
+                                   -> bool
+{
+    virtual_call_violation_for_method(tcx, trait_def_id, method).is_none()
+}
+
+/// Returns `Some(_)` if this method cannot be called on a trait
+/// object; this does not necessarily imply that the enclosing trait
+/// is not object safe, because the method might have a where clause
+/// `Self:Sized`.
+fn virtual_call_violation_for_method<'tcx>(tcx: &ty::ctxt<'tcx>,
+                                           trait_def_id: ast::DefId,
+                                           method: &ty::Method<'tcx>)
+                                           -> Option<MethodViolationCode>
+{
     // The method's first parameter must be something that derefs (or
     // autorefs) to `&self`. For now, we only accept `self`, `&self`
     // and `Box<Self>`.
index 2232bb7bcdbf3698510c56e4f40808c205664dc0..1594d8b2e0d047b06a836e72ea02afe7a307416d 100644 (file)
@@ -197,7 +197,7 @@ pub fn normalize<'a,'b,'tcx,T>(selcx: &'a mut SelectionContext<'b,'tcx>,
 /// As `normalize`, but with a custom depth.
 pub fn normalize_with_depth<'a,'b,'tcx,T>(selcx: &'a mut SelectionContext<'b,'tcx>,
                                           cause: ObligationCause<'tcx>,
-                                          depth: uint,
+                                          depth: usize,
                                           value: &T)
                                           -> Normalized<'tcx, T>
     where T : TypeFoldable<'tcx> + HasProjectionTypes + Clone + Repr<'tcx>
@@ -214,13 +214,13 @@ struct AssociatedTypeNormalizer<'a,'b:'a,'tcx:'b> {
     selcx: &'a mut SelectionContext<'b,'tcx>,
     cause: ObligationCause<'tcx>,
     obligations: Vec<PredicateObligation<'tcx>>,
-    depth: uint,
+    depth: usize,
 }
 
 impl<'a,'b,'tcx> AssociatedTypeNormalizer<'a,'b,'tcx> {
     fn new(selcx: &'a mut SelectionContext<'b,'tcx>,
            cause: ObligationCause<'tcx>,
-           depth: uint)
+           depth: usize)
            -> AssociatedTypeNormalizer<'a,'b,'tcx>
     {
         AssociatedTypeNormalizer {
@@ -314,7 +314,7 @@ pub fn normalize_projection_type<'a,'b,'tcx>(
     selcx: &'a mut SelectionContext<'b,'tcx>,
     projection_ty: ty::ProjectionTy<'tcx>,
     cause: ObligationCause<'tcx>,
-    depth: uint)
+    depth: usize)
     -> NormalizedTy<'tcx>
 {
     opt_normalize_projection_type(selcx, projection_ty.clone(), cause.clone(), depth)
@@ -344,7 +344,7 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
     selcx: &'a mut SelectionContext<'b,'tcx>,
     projection_ty: ty::ProjectionTy<'tcx>,
     cause: ObligationCause<'tcx>,
-    depth: uint)
+    depth: usize)
     -> Option<NormalizedTy<'tcx>>
 {
     debug!("normalize_projection_type(\
@@ -412,7 +412,7 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
 fn normalize_to_error<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
                                projection_ty: ty::ProjectionTy<'tcx>,
                                cause: ObligationCause<'tcx>,
-                               depth: uint)
+                               depth: usize)
                                -> NormalizedTy<'tcx>
 {
     let trait_ref = projection_ty.trait_ref.to_poly_trait_ref();
@@ -699,10 +699,10 @@ fn assemble_candidates_from_impls<'cx,'tcx>(
             // But wait, you say! What about an example like this:
             //
             // ```
-            // fn bar<T:SomeTrait<Foo=uint>>(...) { ... }
+            // fn bar<T:SomeTrait<Foo=usize>>(...) { ... }
             // ```
             //
-            // Doesn't the `T : Sometrait<Foo=uint>` predicate help
+            // Doesn't the `T : Sometrait<Foo=usize>` predicate help
             // resolve `T::Foo`? And of course it does, but in fact
             // that single predicate is desugared into two predicates
             // in the compiler: a trait predicate (`T : SomeTrait`) and a
index 0d6a1f7df5e564cd8d26bf8d7beebec1ba9f4201..9e4f63dca45659fc5acdf7894e24f7bd979c65e5 100644 (file)
 use super::project;
 use super::project::{normalize_with_depth, Normalized};
 use super::{PredicateObligation, TraitObligation, ObligationCause};
-use super::{report_overflow_error};
+use super::report_overflow_error;
 use super::{ObligationCauseCode, BuiltinDerivedObligation, ImplDerivedObligation};
 use super::{SelectionError, Unimplemented, OutputTypeParameterMismatch};
-use super::{Selection};
-use super::{SelectionResult};
+use super::Selection;
+use super::SelectionResult;
 use super::{VtableBuiltin, VtableImpl, VtableParam, VtableClosure,
             VtableFnPointer, VtableObject, VtableDefaultImpl};
 use super::{VtableImplData, VtableObjectData, VtableBuiltinData, VtableDefaultImplData};
 use super::object_safety;
-use super::{util};
+use super::util;
 
 use middle::fast_reject;
 use middle::subst::{Subst, Substs, TypeSpace, VecPerParamSpace};
@@ -110,7 +110,7 @@ pub enum MethodMatchedData {
 /// The selection process begins by considering all impls, where
 /// clauses, and so forth that might resolve an obligation.  Sometimes
 /// we'll be able to say definitively that (e.g.) an impl does not
-/// apply to the obligation: perhaps it is defined for `uint` but the
+/// apply to the obligation: perhaps it is defined for `usize` but the
 /// obligation is for `int`. In that case, we drop the impl out of the
 /// list.  But the other cases are considered *candidates*.
 ///
@@ -138,6 +138,7 @@ enum SelectionCandidate<'tcx> {
     ParamCandidate(ty::PolyTraitRef<'tcx>),
     ImplCandidate(ast::DefId),
     DefaultImplCandidate(ast::DefId),
+    DefaultImplObjectCandidate(ast::DefId),
 
     /// This is a trait matching with a projected type as `Self`, and
     /// we found an applicable bound in the trait definition.
@@ -171,7 +172,7 @@ struct SelectionCandidateSet<'tcx> {
 }
 
 enum BuiltinBoundConditions<'tcx> {
-    If(Vec<Ty<'tcx>>),
+    If(ty::Binder<Vec<Ty<'tcx>>>),
     ParameterBuiltin,
     AmbiguousBuiltin
 }
@@ -292,7 +293,7 @@ fn consider_unification_despite_ambiguity(&mut self, obligation: &TraitObligatio
         // because if it is a closure type, it must be a closure type from
         // within this current fn, and hence none of the higher-ranked
         // lifetimes can appear inside the self-type.
-        let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
+        let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
         let (closure_def_id, substs) = match self_ty.sty {
             ty::ty_closure(id, ref substs) => (id, substs.clone()),
             _ => { return; }
@@ -627,7 +628,7 @@ fn candidate_from_obligation_no_cache<'o>(&mut self,
         // for example, we are looking for $0:Eq where $0 is some
         // unconstrained type variable. In that case, we'll get a
         // candidate which assumes $0 == int, one that assumes $0 ==
-        // uint, etc. This spells an ambiguity.
+        // usize, etc. This spells an ambiguity.
 
         // If there is more than one candidate, first winnow them down
         // by considering extra conditions (nested obligations and so
@@ -1050,7 +1051,10 @@ fn assemble_closure_candidates(&mut self,
             None => { return Ok(()); }
         };
 
-        let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
+        // ok to skip binder because the substs on closure types never
+        // touch bound regions, they just capture the in-scope
+        // type/region parameters
+        let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
         let (closure_def_id, substs) = match self_ty.sty {
             ty::ty_closure(id, ref substs) => (id, substs.clone()),
             ty::ty_infer(ty::TyVar(_)) => {
@@ -1093,7 +1097,8 @@ fn assemble_fn_pointer_candidates(&mut self,
             return Ok(());
         }
 
-        let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
+        // ok to skip binder because what we are inspecting doesn't involve bound regions
+        let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
         match self_ty.sty {
             ty::ty_infer(ty::TyVar(_)) => {
                 debug!("assemble_fn_pointer_candidates: ambiguous self-type");
@@ -1125,8 +1130,7 @@ fn assemble_candidates_from_impls(&mut self,
                                       candidates: &mut SelectionCandidateSet<'tcx>)
                                       -> Result<(), SelectionError<'tcx>>
     {
-        let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
-        debug!("assemble_candidates_from_impls(self_ty={})", self_ty.repr(self.tcx()));
+        debug!("assemble_candidates_from_impls(obligation={})", obligation.repr(self.tcx()));
 
         let def_id = obligation.predicate.def_id();
         let all_impls = self.all_impls(def_id);
@@ -1152,15 +1156,28 @@ fn assemble_candidates_from_default_impls(&mut self,
                                               candidates: &mut SelectionCandidateSet<'tcx>)
                                               -> Result<(), SelectionError<'tcx>>
     {
-
-        let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
+        // OK to skip binder here because the tests we do below do not involve bound regions
+        let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
         debug!("assemble_candidates_from_default_impls(self_ty={})", self_ty.repr(self.tcx()));
 
         let def_id = obligation.predicate.def_id();
 
         if ty::trait_has_default_impl(self.tcx(), def_id) {
             match self_ty.sty {
-                ty::ty_trait(..) |
+                ty::ty_trait(..) => {
+                    // For object types, we don't know what the closed
+                    // over types are. For most traits, this means we
+                    // conservatively say nothing; a candidate may be
+                    // added by `assemble_candidates_from_object_ty`.
+                    // However, for the kind of magic reflect trait,
+                    // we consider it to be implemented even for
+                    // object types, because it just lets you reflect
+                    // onto the object type, not into the object's
+                    // interior.
+                    if ty::has_attr(self.tcx(), def_id, "rustc_reflect_like") {
+                        candidates.vec.push(DefaultImplObjectCandidate(def_id));
+                    }
+                }
                 ty::ty_param(..) |
                 ty::ty_projection(..) => {
                     // In these cases, we don't know what the actual
@@ -1210,10 +1227,8 @@ fn assemble_candidates_from_object_ty(&mut self,
                                           obligation: &TraitObligation<'tcx>,
                                           candidates: &mut SelectionCandidateSet<'tcx>)
     {
-        let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
-
         debug!("assemble_candidates_from_object_ty(self_ty={})",
-               self_ty.repr(self.tcx()));
+               self.infcx.shallow_resolve(*obligation.self_ty().skip_binder()).repr(self.tcx()));
 
         // Object-safety candidates are only applicable to object-safe
         // traits. Including this check is useful because it helps
@@ -1222,47 +1237,56 @@ fn assemble_candidates_from_object_ty(&mut self,
         // self-type from one of the other inputs. Without this check,
         // these cases wind up being considered ambiguous due to a
         // (spurious) ambiguity introduced here.
-        if !object_safety::is_object_safe(self.tcx(), obligation.predicate.to_poly_trait_ref()) {
+        let predicate_trait_ref = obligation.predicate.to_poly_trait_ref();
+        if !object_safety::is_object_safe(self.tcx(), predicate_trait_ref.def_id()) {
             return;
         }
 
-        let poly_trait_ref = match self_ty.sty {
-            ty::ty_trait(ref data) => {
-                match self.tcx().lang_items.to_builtin_kind(obligation.predicate.def_id()) {
-                    Some(bound @ ty::BoundSend) | Some(bound @ ty::BoundSync) => {
-                        if data.bounds.builtin_bounds.contains(&bound) {
-                            debug!("assemble_candidates_from_object_ty: matched builtin bound, \
-                            pushing candidate");
-                            candidates.vec.push(BuiltinObjectCandidate);
-                            return;
+        self.infcx.try(|snapshot| {
+            let bound_self_ty =
+                self.infcx.resolve_type_vars_if_possible(&obligation.self_ty());
+            let (self_ty, _) =
+                self.infcx().skolemize_late_bound_regions(&bound_self_ty, snapshot);
+            let poly_trait_ref = match self_ty.sty {
+                ty::ty_trait(ref data) => {
+                    match self.tcx().lang_items.to_builtin_kind(obligation.predicate.def_id()) {
+                        Some(bound @ ty::BoundSend) | Some(bound @ ty::BoundSync) => {
+                            if data.bounds.builtin_bounds.contains(&bound) {
+                                debug!("assemble_candidates_from_object_ty: matched builtin bound, \
+                                        pushing candidate");
+                                candidates.vec.push(BuiltinObjectCandidate);
+                                return Ok(());
+                            }
                         }
+                        _ => {}
                     }
-                    _ => {}
+
+                    data.principal_trait_ref_with_self_ty(self.tcx(), self_ty)
+                }
+                ty::ty_infer(ty::TyVar(_)) => {
+                    debug!("assemble_candidates_from_object_ty: ambiguous");
+                    candidates.ambiguous = true; // could wind up being an object type
+                    return Ok(());
+                }
+                _ => {
+                    return Ok(());
                 }
+            };
 
-                data.principal_trait_ref_with_self_ty(self.tcx(), self_ty)
-            }
-            ty::ty_infer(ty::TyVar(_)) => {
-                debug!("assemble_candidates_from_object_ty: ambiguous");
-                candidates.ambiguous = true; // could wind up being an object type
-                return;
-            }
-            _ => {
-                return;
-            }
-        };
+            debug!("assemble_candidates_from_object_ty: poly_trait_ref={}",
+                   poly_trait_ref.repr(self.tcx()));
 
-        debug!("assemble_candidates_from_object_ty: poly_trait_ref={}",
-               poly_trait_ref.repr(self.tcx()));
+            // see whether the object trait can be upcast to the trait we are looking for
+            let upcast_trait_refs = self.upcast(poly_trait_ref, obligation);
+            if upcast_trait_refs.len() > 1 {
+                // can be upcast in many ways; need more type information
+                candidates.ambiguous = true;
+            } else if upcast_trait_refs.len() == 1 {
+                candidates.vec.push(ObjectCandidate);
+            }
 
-        // see whether the object trait can be upcast to the trait we are looking for
-        let upcast_trait_refs = self.upcast(poly_trait_ref, obligation);
-        if upcast_trait_refs.len() > 1 {
-            // can be upcast in many ways; need more type information
-            candidates.ambiguous = true;
-        } else if upcast_trait_refs.len() == 1 {
-            candidates.vec.push(ObjectCandidate);
-        }
+            Ok::<(),()>(())
+        }).unwrap();
     }
 
     ///////////////////////////////////////////////////////////////////////////
@@ -1397,23 +1421,23 @@ fn builtin_bound(&mut self,
 
         let self_ty = self.infcx.shallow_resolve(obligation.predicate.0.self_ty());
         return match self_ty.sty {
-            ty::ty_infer(ty::IntVar(_))
-            | ty::ty_infer(ty::FloatVar(_))
-            | ty::ty_uint(_)
-            | ty::ty_int(_)
-            | ty::ty_bool
-            | ty::ty_float(_)
-            | ty::ty_bare_fn(..)
-            ty::ty_char => {
+            ty::ty_infer(ty::IntVar(_)) |
+            ty::ty_infer(ty::FloatVar(_)) |
+            ty::ty_uint(_) |
+            ty::ty_int(_) |
+            ty::ty_bool |
+            ty::ty_float(_) |
+            ty::ty_bare_fn(..) |
+            ty::ty_char => {
                 // safe for everything
-                Ok(If(Vec::new()))
+                ok_if(Vec::new())
             }
 
             ty::ty_uniq(_) => {  // Box<T>
                 match bound {
                     ty::BoundCopy => Err(Unimplemented),
 
-                    ty::BoundSized => Ok(If(Vec::new())),
+                    ty::BoundSized => ok_if(Vec::new()),
 
                     ty::BoundSync | ty::BoundSend => {
                         self.tcx().sess.bug("Send/Sync shouldn't occur in builtin_bounds()");
@@ -1423,7 +1447,7 @@ fn builtin_bound(&mut self,
 
             ty::ty_ptr(..) => {     // *const T, *mut T
                 match bound {
-                    ty::BoundCopy | ty::BoundSized => Ok(If(Vec::new())),
+                    ty::BoundCopy | ty::BoundSized => ok_if(Vec::new()),
 
                     ty::BoundSync | ty::BoundSend => {
                         self.tcx().sess.bug("Send/Sync shouldn't occur in builtin_bounds()");
@@ -1436,7 +1460,7 @@ fn builtin_bound(&mut self,
                     ty::BoundSized => Err(Unimplemented),
                     ty::BoundCopy => {
                         if data.bounds.builtin_bounds.contains(&bound) {
-                            Ok(If(Vec::new()))
+                            ok_if(Vec::new())
                         } else {
                             // Recursively check all supertraits to find out if any further
                             // bounds are required and thus we must fulfill.
@@ -1446,7 +1470,7 @@ fn builtin_bound(&mut self,
                             let desired_def_id = obligation.predicate.def_id();
                             for tr in util::supertraits(self.tcx(), principal) {
                                 if tr.def_id() == desired_def_id {
-                                    return Ok(If(Vec::new()))
+                                    return ok_if(Vec::new())
                                 }
                             }
 
@@ -1468,11 +1492,11 @@ fn builtin_bound(&mut self,
                             ast::MutMutable => Err(Unimplemented),
 
                             // &T is always copyable
-                            ast::MutImmutable => Ok(If(Vec::new())),
+                            ast::MutImmutable => ok_if(Vec::new()),
                         }
                     }
 
-                    ty::BoundSized => Ok(If(Vec::new())),
+                    ty::BoundSized => ok_if(Vec::new()),
 
                     ty::BoundSync | ty::BoundSend => {
                         self.tcx().sess.bug("Send/Sync shouldn't occur in builtin_bounds()");
@@ -1486,7 +1510,7 @@ fn builtin_bound(&mut self,
                     ty::BoundCopy => {
                         match *len {
                             // [T, ..n] is copy iff T is copy
-                            Some(_) => Ok(If(vec![element_ty])),
+                            Some(_) => ok_if(vec![element_ty]),
 
                             // [T] is unsized and hence affine
                             None => Err(Unimplemented),
@@ -1495,7 +1519,7 @@ fn builtin_bound(&mut self,
 
                     ty::BoundSized => {
                         if len.is_some() {
-                            Ok(If(Vec::new()))
+                            ok_if(Vec::new())
                         } else {
                             Err(Unimplemented)
                         }
@@ -1519,7 +1543,7 @@ fn builtin_bound(&mut self,
             }
 
             // (T1, ..., Tn) -- meets any bound that all of T1...Tn meet
-            ty::ty_tup(ref tys) => Ok(If(tys.clone())),
+            ty::ty_tup(ref tys) => ok_if(tys.clone()),
 
             ty::ty_closure(def_id, substs) => {
                 // FIXME -- This case is tricky. In the case of by-ref
@@ -1544,11 +1568,11 @@ fn builtin_bound(&mut self,
                 // unsized, so the closure struct as a whole must be
                 // Sized.
                 if bound == ty::BoundSized {
-                    return Ok(If(Vec::new()));
+                    return ok_if(Vec::new());
                 }
 
                 match self.closure_typer.closure_upvars(def_id, substs) {
-                    Some(upvars) => Ok(If(upvars.iter().map(|c| c.ty).collect())),
+                    Some(upvars) => ok_if(upvars.iter().map(|c| c.ty).collect()),
                     None => {
                         debug!("assemble_builtin_bound_candidates: no upvar types available yet");
                         Ok(AmbiguousBuiltin)
@@ -1590,7 +1614,7 @@ fn builtin_bound(&mut self,
                 Ok(AmbiguousBuiltin)
             }
 
-            ty::ty_err => Ok(If(Vec::new())),
+            ty::ty_err => ok_if(Vec::new()),
 
             ty::ty_infer(ty::FreshTy(_))
             | ty::ty_infer(ty::FreshIntTy(_)) => {
@@ -1601,6 +1625,11 @@ fn builtin_bound(&mut self,
             }
         };
 
+        fn ok_if<'tcx>(v: Vec<Ty<'tcx>>)
+                       -> Result<BuiltinBoundConditions<'tcx>, SelectionError<'tcx>> {
+            Ok(If(ty::Binder(v)))
+        }
+
         fn nominal<'cx, 'tcx>(bound: ty::BuiltinBound,
                               types: Vec<Ty<'tcx>>)
                               -> Result<BuiltinBoundConditions<'tcx>, SelectionError<'tcx>>
@@ -1611,7 +1640,7 @@ fn nominal<'cx, 'tcx>(bound: ty::BuiltinBound,
                 ty::BoundCopy => Ok(ParameterBuiltin),
 
                 // Sized if all the component types are sized.
-                ty::BoundSized => Ok(If(types)),
+                ty::BoundSized => ok_if(types),
 
                 // Shouldn't be coming through here.
                 ty::BoundSend | ty::BoundSync => unreachable!(),
@@ -1714,8 +1743,9 @@ fn constituent_types_for_ty(&self, t: Ty<'tcx>) -> Option<Vec<Ty<'tcx>>> {
     fn collect_predicates_for_types(&mut self,
                                     obligation: &TraitObligation<'tcx>,
                                     trait_def_id: ast::DefId,
-                                    types: Vec<Ty<'tcx>>) -> Vec<PredicateObligation<'tcx>> {
-
+                                    types: ty::Binder<Vec<Ty<'tcx>>>)
+                                    -> Vec<PredicateObligation<'tcx>>
+    {
         let derived_cause = match self.tcx().lang_items.to_builtin_kind(trait_def_id) {
             Some(_) => {
                 self.derived_cause(obligation, BuiltinDerivedObligation)
@@ -1725,43 +1755,52 @@ fn collect_predicates_for_types(&mut self,
             }
         };
 
-        let normalized = project::normalize_with_depth(self, obligation.cause.clone(),
-                                                       obligation.recursion_depth + 1,
-                                                       &types);
-
-        let obligations = normalized.value.iter().map(|&nested_ty| {
-            // the obligation might be higher-ranked, e.g. for<'a> &'a
-            // int : Copy. In that case, we will wind up with
-            // late-bound regions in the `nested` vector. So for each
-            // one we instantiate to a skolemized region, do our work
-            // to produce something like `&'0 int : Copy`, and then
-            // re-bind it. This is a bit of busy-work but preserves
-            // the invariant that we only manipulate free regions, not
-            // bound ones.
+        // Because the types were potentially derived from
+        // higher-ranked obligations they may reference late-bound
+        // regions. For example, `for<'a> Foo<&'a int> : Copy` would
+        // yield a type like `for<'a> &'a int`. In general, we
+        // maintain the invariant that we never manipulate bound
+        // regions, so we have to process these bound regions somehow.
+        //
+        // The strategy is to:
+        //
+        // 1. Instantiate those regions to skolemized regions (e.g.,
+        //    `for<'a> &'a int` becomes `&0 int`.
+        // 2. Produce something like `&'0 int : Copy`
+        // 3. Re-bind the regions back to `for<'a> &'a int : Copy`
+
+        // Move the binder into the individual types
+        let bound_types: Vec<ty::Binder<Ty<'tcx>>> =
+            types.skip_binder()
+                 .iter()
+                 .map(|&nested_ty| ty::Binder(nested_ty))
+                 .collect();
+
+        // For each type, produce a vector of resulting obligations
+        let obligations: Result<Vec<Vec<_>>, _> = bound_types.iter().map(|nested_ty| {
             self.infcx.try(|snapshot| {
                 let (skol_ty, skol_map) =
-                    self.infcx().skolemize_late_bound_regions(&ty::Binder(nested_ty), snapshot);
-                let skol_predicate =
-                    util::predicate_for_trait_def(
-                        self.tcx(),
-                        derived_cause.clone(),
-                        trait_def_id,
-                        obligation.recursion_depth + 1,
-                        skol_ty);
-                match skol_predicate {
-                    Ok(skol_predicate) => Ok(self.infcx().plug_leaks(skol_map, snapshot,
-                                                                     &skol_predicate)),
-                    Err(ErrorReported) => Err(ErrorReported)
-                }
+                    self.infcx().skolemize_late_bound_regions(nested_ty, snapshot);
+                let Normalized { value: normalized_ty, mut obligations } =
+                    project::normalize_with_depth(self,
+                                                  obligation.cause.clone(),
+                                                  obligation.recursion_depth + 1,
+                                                  &skol_ty);
+                let skol_obligation =
+                    try!(util::predicate_for_trait_def(self.tcx(),
+                                                       derived_cause.clone(),
+                                                       trait_def_id,
+                                                       obligation.recursion_depth + 1,
+                                                       normalized_ty));
+                obligations.push(skol_obligation);
+                Ok(self.infcx().plug_leaks(skol_map, snapshot, &obligations))
             })
-        }).collect::<Result<Vec<PredicateObligation<'tcx>>, _>>();
+        }).collect();
 
+        // Flatten those vectors (couldn't do it above due `collect`)
         match obligations {
-            Ok(mut obls) => {
-                obls.push_all(&normalized.obligations);
-                obls
-            },
-            Err(ErrorReported) => Vec::new()
+            Ok(obligations) => obligations.into_iter().flat_map(|o| o.into_iter()).collect(),
+            Err(ErrorReported) => Vec::new(),
         }
     }
 
@@ -1798,7 +1837,12 @@ fn confirm_candidate(&mut self,
             }
 
             DefaultImplCandidate(trait_def_id) => {
-                let data = try!(self.confirm_default_impl_candidate(obligation, trait_def_id));
+                let data = self.confirm_default_impl_candidate(obligation, trait_def_id);
+                Ok(VtableDefaultImpl(data))
+            }
+
+            DefaultImplObjectCandidate(trait_def_id) => {
+                let data = self.confirm_default_impl_object_candidate(obligation, trait_def_id);
                 Ok(VtableDefaultImpl(data))
             }
 
@@ -1900,7 +1944,7 @@ fn confirm_builtin_candidate(&mut self,
     fn vtable_builtin_data(&mut self,
                            obligation: &TraitObligation<'tcx>,
                            bound: ty::BuiltinBound,
-                           nested: Vec<Ty<'tcx>>)
+                           nested: ty::Binder<Vec<Ty<'tcx>>>)
                            -> VtableBuiltinData<PredicateObligation<'tcx>>
     {
         let trait_def = match self.tcx().lang_items.from_builtin_kind(bound) {
@@ -1927,17 +1971,17 @@ fn vtable_builtin_data(&mut self,
     /// 2. For each where-clause `C` declared on `Foo`, `[Self => X] C` holds.
     fn confirm_default_impl_candidate(&mut self,
                                       obligation: &TraitObligation<'tcx>,
-                                      impl_def_id: ast::DefId)
-                              -> Result<VtableDefaultImplData<PredicateObligation<'tcx>>,
-                                        SelectionError<'tcx>>
+                                      trait_def_id: ast::DefId)
+                                      -> VtableDefaultImplData<PredicateObligation<'tcx>>
     {
         debug!("confirm_default_impl_candidate({}, {})",
                obligation.repr(self.tcx()),
-               impl_def_id.repr(self.tcx()));
+               trait_def_id.repr(self.tcx()));
 
-        let self_ty = self.infcx.shallow_resolve(obligation.predicate.0.self_ty());
+        // binder is moved below
+        let self_ty = self.infcx.shallow_resolve(obligation.predicate.skip_binder().self_ty());
         match self.constituent_types_for_ty(self_ty) {
-            Some(types) => Ok(self.vtable_default_impl(obligation, impl_def_id, types)),
+            Some(types) => self.vtable_default_impl(obligation, trait_def_id, ty::Binder(types)),
             None => {
                 self.tcx().sess.bug(
                     &format!(
@@ -1947,33 +1991,72 @@ fn confirm_default_impl_candidate(&mut self,
         }
     }
 
+    fn confirm_default_impl_object_candidate(&mut self,
+                                             obligation: &TraitObligation<'tcx>,
+                                             trait_def_id: ast::DefId)
+                                             -> VtableDefaultImplData<PredicateObligation<'tcx>>
+    {
+        debug!("confirm_default_impl_object_candidate({}, {})",
+               obligation.repr(self.tcx()),
+               trait_def_id.repr(self.tcx()));
+
+        assert!(ty::has_attr(self.tcx(), trait_def_id, "rustc_reflect_like"));
+
+        // OK to skip binder, it is reintroduced below
+        let self_ty = self.infcx.shallow_resolve(obligation.predicate.skip_binder().self_ty());
+        match self_ty.sty {
+            ty::ty_trait(ref data) => {
+                // OK to skip the binder, it is reintroduced below
+                let input_types = data.principal.skip_binder().substs.types.get_slice(TypeSpace);
+                let assoc_types = data.bounds.projection_bounds
+                                             .iter()
+                                             .map(|pb| pb.skip_binder().ty);
+                let all_types: Vec<_> = input_types.iter().cloned()
+                                                          .chain(assoc_types)
+                                                          .collect();
+
+                // reintroduce the two binding levels we skipped, then flatten into one
+                let all_types = ty::Binder(ty::Binder(all_types));
+                let all_types = ty::flatten_late_bound_regions(self.tcx(), &all_types);
+
+                self.vtable_default_impl(obligation, trait_def_id, all_types)
+            }
+            _ => {
+                self.tcx().sess.bug(
+                    &format!(
+                        "asked to confirm default object implementation for non-object type: {}",
+                        self_ty.repr(self.tcx())));
+            }
+        }
+    }
+
     /// See `confirm_default_impl_candidate`
     fn vtable_default_impl(&mut self,
                            obligation: &TraitObligation<'tcx>,
                            trait_def_id: ast::DefId,
-                           nested: Vec<Ty<'tcx>>)
+                           nested: ty::Binder<Vec<Ty<'tcx>>>)
                            -> VtableDefaultImplData<PredicateObligation<'tcx>>
     {
+        debug!("vtable_default_impl_data: nested={}", nested.repr(self.tcx()));
 
         let mut obligations = self.collect_predicates_for_types(obligation,
                                                                 trait_def_id,
                                                                 nested);
 
-        let _: Result<(),()> = self.infcx.try(|snapshot| {
-            let (_, skol_map) =
-                self.infcx().skolemize_late_bound_regions(&obligation.predicate, snapshot);
-
-            let substs = obligation.predicate.to_poly_trait_ref().substs();
-            let trait_obligations = self.impl_or_trait_obligations(obligation.cause.clone(),
-                                                                   obligation.recursion_depth + 1,
-                                                                   trait_def_id,
-                                                                   substs,
-                                                                   skol_map,
-                                                                   snapshot);
-            obligations.push_all(trait_obligations.as_slice());
-            Ok(())
+        let trait_obligations: Result<VecPerParamSpace<_>,()> = self.infcx.try(|snapshot| {
+            let poly_trait_ref = obligation.predicate.to_poly_trait_ref();
+            let (trait_ref, skol_map) =
+                self.infcx().skolemize_late_bound_regions(&poly_trait_ref, snapshot);
+            Ok(self.impl_or_trait_obligations(obligation.cause.clone(),
+                                              obligation.recursion_depth + 1,
+                                              trait_def_id,
+                                              &trait_ref.substs,
+                                              skol_map,
+                                              snapshot))
         });
 
+        obligations.extend(trait_obligations.unwrap().into_iter()); // no Errors in that code above
+
         debug!("vtable_default_impl_data: obligations={}", obligations.repr(self.tcx()));
 
         VtableDefaultImplData {
@@ -2010,7 +2093,7 @@ fn vtable_impl(&mut self,
                    impl_def_id: ast::DefId,
                    substs: Normalized<'tcx, Substs<'tcx>>,
                    cause: ObligationCause<'tcx>,
-                   recursion_depth: uint,
+                   recursion_depth: usize,
                    skol_map: infer::SkolemizationMap,
                    snapshot: &infer::CombinedSnapshot)
                    -> VtableImplData<'tcx, PredicateObligation<'tcx>>
@@ -2047,7 +2130,11 @@ fn confirm_object_candidate(&mut self,
         debug!("confirm_object_candidate({})",
                obligation.repr(self.tcx()));
 
-        let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
+        // FIXME skipping binder here seems wrong -- we should
+        // probably flatten the binder from the obligation and the
+        // binder from the object. Have to try to make a broken test
+        // case that results. -nmatsakis
+        let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
         let poly_trait_ref = match self_ty.sty {
             ty::ty_trait(ref data) => {
                 data.principal_trait_ref_with_self_ty(self.tcx(), self_ty)
@@ -2085,15 +2172,16 @@ fn confirm_fn_pointer_candidate(&mut self,
         debug!("confirm_fn_pointer_candidate({})",
                obligation.repr(self.tcx()));
 
-        let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
+        // ok to skip binder; it is reintroduced below
+        let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
         let sig = ty::ty_fn_sig(self_ty);
-        let ty::Binder((trait_ref, _)) =
+        let trait_ref =
             util::closure_trait_ref_and_return_type(self.tcx(),
                                                     obligation.predicate.def_id(),
                                                     self_ty,
                                                     sig,
-                                                    util::TupleArgumentsFlag::Yes);
-        let trait_ref = ty::Binder(trait_ref);
+                                                    util::TupleArgumentsFlag::Yes)
+            .map_bound(|(trait_ref, _)| trait_ref);
 
         try!(self.confirm_poly_trait_refs(obligation.cause.clone(),
                                           obligation.predicate.to_poly_trait_ref(),
@@ -2142,9 +2230,9 @@ fn confirm_closure_candidate(&mut self,
     ///
     ///     impl Fn(int) for Closure { ... }
     ///
-    /// Now imagine our obligation is `Fn(uint) for Closure`. So far
+    /// Now imagine our obligation is `Fn(usize) for Closure`. So far
     /// we have matched the self-type `Closure`. At this point we'll
-    /// compare the `int` to `uint` and generate an error.
+    /// compare the `int` to `usize` and generate an error.
     ///
     /// Note that this checking occurs *after* the impl has selected,
     /// because these output type parameters should not affect the
@@ -2441,13 +2529,15 @@ fn closure_trait_ref(&self,
     /// impl.
     fn impl_or_trait_obligations(&mut self,
                                  cause: ObligationCause<'tcx>,
-                                 recursion_depth: uint,
+                                 recursion_depth: usize,
                                  def_id: ast::DefId, // of impl or trait
                                  substs: &Substs<'tcx>, // for impl or trait
                                  skol_map: infer::SkolemizationMap,
                                  snapshot: &infer::CombinedSnapshot)
                                  -> VecPerParamSpace<PredicateObligation<'tcx>>
     {
+        debug!("impl_or_trait_obligations(def_id={})", def_id.repr(self.tcx()));
+
         let predicates = ty::lookup_predicates(self.tcx(), def_id);
         let predicates = predicates.instantiate(self.tcx(), substs);
         let predicates = normalize_with_depth(self, cause.clone(), recursion_depth, &predicates);
@@ -2530,6 +2620,7 @@ fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
             ParamCandidate(ref a) => format!("ParamCandidate({})", a.repr(tcx)),
             ImplCandidate(a) => format!("ImplCandidate({})", a.repr(tcx)),
             DefaultImplCandidate(t) => format!("DefaultImplCandidate({:?})", t),
+            DefaultImplObjectCandidate(t) => format!("DefaultImplObjectCandidate({:?})", t),
             ProjectionCandidate => format!("ProjectionCandidate"),
             FnPointerCandidate => format!("FnPointerCandidate"),
             ObjectCandidate => format!("ObjectCandidate"),
index 965aaf12044ec20692b20ca403d9234580c25a04..7c7db4a64c02eec186a47ad066fbe5100361d566 100644 (file)
@@ -209,6 +209,47 @@ pub fn transitive_bounds<'cx, 'tcx>(tcx: &'cx ty::ctxt<'tcx>,
     elaborate_trait_refs(tcx, bounds).filter_to_traits()
 }
 
+///////////////////////////////////////////////////////////////////////////
+// Iterator over def-ids of supertraits
+
+pub struct SupertraitDefIds<'cx, 'tcx:'cx> {
+    tcx: &'cx ty::ctxt<'tcx>,
+    stack: Vec<ast::DefId>,
+    visited: FnvHashSet<ast::DefId>,
+}
+
+pub fn supertrait_def_ids<'cx, 'tcx>(tcx: &'cx ty::ctxt<'tcx>,
+                                     trait_def_id: ast::DefId)
+                                     -> SupertraitDefIds<'cx, 'tcx>
+{
+    SupertraitDefIds {
+        tcx: tcx,
+        stack: vec![trait_def_id],
+        visited: Some(trait_def_id).into_iter().collect(),
+    }
+}
+
+impl<'cx, 'tcx> Iterator for SupertraitDefIds<'cx, 'tcx> {
+    type Item = ast::DefId;
+
+    fn next(&mut self) -> Option<ast::DefId> {
+        let def_id = match self.stack.pop() {
+            Some(def_id) => def_id,
+            None => { return None; }
+        };
+
+        let predicates = ty::lookup_super_predicates(self.tcx, def_id);
+        let visited = &mut self.visited;
+        self.stack.extend(
+            predicates.predicates
+                      .iter()
+                      .filter_map(|p| p.to_opt_poly_trait_ref())
+                      .map(|t| t.def_id())
+                      .filter(|&super_def_id| visited.insert(super_def_id)));
+        Some(def_id)
+    }
+}
+
 ///////////////////////////////////////////////////////////////////////////
 // Other
 ///////////////////////////////////////////////////////////////////////////
@@ -278,7 +319,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 /// See `super::obligations_for_generics`
 pub fn predicates_for_generics<'tcx>(tcx: &ty::ctxt<'tcx>,
                                      cause: ObligationCause<'tcx>,
-                                     recursion_depth: uint,
+                                     recursion_depth: usize,
                                      generic_bounds: &ty::InstantiatedPredicates<'tcx>)
                                      -> VecPerParamSpace<PredicateObligation<'tcx>>
 {
@@ -316,7 +357,7 @@ pub fn trait_ref_for_builtin_bound<'tcx>(
 pub fn predicate_for_trait_ref<'tcx>(
     cause: ObligationCause<'tcx>,
     trait_ref: Rc<ty::TraitRef<'tcx>>,
-    recursion_depth: uint)
+    recursion_depth: usize)
     -> Result<PredicateObligation<'tcx>, ErrorReported>
 {
     Ok(Obligation {
@@ -330,7 +371,7 @@ pub fn predicate_for_trait_def<'tcx>(
     tcx: &ty::ctxt<'tcx>,
     cause: ObligationCause<'tcx>,
     trait_def_id: ast::DefId,
-    recursion_depth: uint,
+    recursion_depth: usize,
     param_ty: Ty<'tcx>)
     -> Result<PredicateObligation<'tcx>, ErrorReported>
 {
@@ -345,7 +386,7 @@ pub fn predicate_for_builtin_bound<'tcx>(
     tcx: &ty::ctxt<'tcx>,
     cause: ObligationCause<'tcx>,
     builtin_bound: ty::BuiltinBound,
-    recursion_depth: uint,
+    recursion_depth: usize,
     param_ty: Ty<'tcx>)
     -> Result<PredicateObligation<'tcx>, ErrorReported>
 {
@@ -377,7 +418,7 @@ pub fn upcast<'tcx>(tcx: &ty::ctxt<'tcx>,
 pub fn get_vtable_index_of_object_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                                                object_trait_ref: ty::PolyTraitRef<'tcx>,
                                                trait_def_id: ast::DefId,
-                                               method_offset_in_trait: uint) -> uint {
+                                               method_offset_in_trait: usize) -> usize {
     // We need to figure the "real index" of the method in a
     // listing of all the methods of an object. We do this by
     // iterating down the supertraits of the object's trait until
index 23fba5ead22598df14a75fa8eced8f960053ed28..161fae11ea6d42c1f254f80f5db9e700c447e72e 100644 (file)
@@ -64,7 +64,7 @@
 use util::ppaux::{Repr, UserString};
 use util::common::{memoized, ErrorReported};
 use util::nodemap::{NodeMap, NodeSet, DefIdMap, DefIdSet};
-use util::nodemap::{FnvHashMap};
+use util::nodemap::FnvHashMap;
 
 use arena::TypedArena;
 use std::borrow::{Borrow, Cow};
@@ -261,8 +261,8 @@ pub struct field_ty {
 #[derive(Copy, PartialEq, Eq, Hash)]
 pub struct creader_cache_key {
     pub cnum: CrateNum,
-    pub pos: uint,
-    pub len: uint
+    pub pos: usize,
+    pub len: usize
 }
 
 #[derive(Clone, PartialEq, RustcDecodable, RustcEncodable)]
@@ -288,18 +288,18 @@ pub enum AutoAdjustment<'tcx> {
 
 #[derive(Clone, PartialEq, Debug)]
 pub enum UnsizeKind<'tcx> {
-    // [T, ..n] -> [T], the uint field is n.
-    UnsizeLength(uint),
+    // [T, ..n] -> [T], the usize field is n.
+    UnsizeLength(usize),
     // An unsize coercion applied to the tail field of a struct.
-    // The uint is the index of the type parameter which is unsized.
-    UnsizeStruct(Box<UnsizeKind<'tcx>>, uint),
+    // The usize is the index of the type parameter which is unsized.
+    UnsizeStruct(Box<UnsizeKind<'tcx>>, usize),
     UnsizeVtable(TyTrait<'tcx>, /* the self type of the trait */ Ty<'tcx>),
     UnsizeUpcast(Ty<'tcx>),
 }
 
 #[derive(Clone, Debug)]
 pub struct AutoDerefRef<'tcx> {
-    pub autoderefs: uint,
+    pub autoderefs: usize,
     pub autoref: Option<AutoRef<'tcx>>
 }
 
@@ -423,7 +423,7 @@ fn type_of_autoref<'tcx>(cx: &ctxt<'tcx>, autoref: &AutoRef<'tcx>) -> Option<Ty<
 #[derive(Clone, Copy, RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Debug)]
 pub struct param_index {
     pub space: subst::ParamSpace,
-    pub index: uint
+    pub index: usize
 }
 
 #[derive(Clone, Debug)]
@@ -452,10 +452,10 @@ pub struct MethodParam<'tcx> {
     // instantiated with fresh variables at this point.
     pub trait_ref: Rc<ty::TraitRef<'tcx>>,
 
-    // index of uint in the list of trait items. Note that this is NOT
+    // index of usize in the list of trait items. Note that this is NOT
     // the index into the vtable, because the list of trait items
     // includes associated types.
-    pub method_num: uint,
+    pub method_num: usize,
 
     /// The impl for the trait from which the method comes. This
     /// should only be used for certain linting/heuristic purposes
@@ -474,13 +474,13 @@ pub struct MethodObject<'tcx> {
     pub object_trait_id: ast::DefId,
 
     // index of the method to be invoked amongst the trait's items
-    pub method_num: uint,
+    pub method_num: usize,
 
     // index into the actual runtime vtable.
     // the vtable is formed by concatenating together the method lists of
     // the base object trait and all supertraits; this is the index into
     // that vtable
-    pub vtable_index: uint,
+    pub vtable_index: usize,
 }
 
 #[derive(Clone)]
@@ -511,7 +511,7 @@ pub struct MethodCall {
 #[derive(Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable, Copy)]
 pub enum ExprAdjustment {
     NoAdjustment,
-    AutoDeref(uint),
+    AutoDeref(usize),
     AutoObject
 }
 
@@ -530,7 +530,7 @@ pub fn autoobject(id: ast::NodeId) -> MethodCall {
         }
     }
 
-    pub fn autoderef(expr_id: ast::NodeId, autoderef: uint) -> MethodCall {
+    pub fn autoderef(expr_id: ast::NodeId, autoderef: usize) -> MethodCall {
         MethodCall {
             expr_id: expr_id,
             adjustment: AutoDeref(1 + autoderef)
@@ -564,7 +564,7 @@ fn foo<T:quux,baz,bar>(a: T) -- a's vtable would have a
       The first argument is the param index (identifying T in the example),
       and the second is the bound number (identifying baz)
      */
-    vtable_param(param_index, uint),
+    vtable_param(param_index, usize),
 
     /*
       Vtable automatically generated for a closure. The def ID is the
@@ -639,12 +639,12 @@ pub fn new() -> CtxtArenas<'tcx> {
 pub struct CommonTypes<'tcx> {
     pub bool: Ty<'tcx>,
     pub char: Ty<'tcx>,
-    pub int: Ty<'tcx>,
+    pub isize: Ty<'tcx>,
     pub i8: Ty<'tcx>,
     pub i16: Ty<'tcx>,
     pub i32: Ty<'tcx>,
     pub i64: Ty<'tcx>,
-    pub uint: Ty<'tcx>,
+    pub usize: Ty<'tcx>,
     pub u8: Ty<'tcx>,
     pub u16: Ty<'tcx>,
     pub u32: Ty<'tcx>,
@@ -877,10 +877,10 @@ mod inner {
             use middle::ty;
             #[derive(Copy)]
             struct DebugStat {
-                total: uint,
-                region_infer: uint,
-                ty_infer: uint,
-                both_infer: uint,
+                total: usize,
+                region_infer: usize,
+                ty_infer: usize,
+                both_infer: usize,
             }
 
             pub fn go(tcx: &ty::ctxt) {
@@ -1024,7 +1024,7 @@ pub fn type_has_late_bound_regions(ty: Ty) -> bool {
 ///
 /// So, for example, consider a type like the following, which has two binders:
 ///
-///    for<'a> fn(x: for<'b> fn(&'a int, &'b int))
+///    for<'a> fn(x: for<'b> fn(&'a isize, &'b isize))
 ///    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ outer scope
 ///                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~  inner scope
 ///
@@ -1108,16 +1108,16 @@ pub struct FnSig<'tcx> {
 
 impl<'tcx> PolyFnSig<'tcx> {
     pub fn inputs(&self) -> ty::Binder<Vec<Ty<'tcx>>> {
-        ty::Binder(self.0.inputs.clone())
+        self.map_bound_ref(|fn_sig| fn_sig.inputs.clone())
     }
-    pub fn input(&self, index: uint) -> ty::Binder<Ty<'tcx>> {
-        ty::Binder(self.0.inputs[index])
+    pub fn input(&self, index: usize) -> ty::Binder<Ty<'tcx>> {
+        self.map_bound_ref(|fn_sig| fn_sig.inputs[index])
     }
     pub fn output(&self) -> ty::Binder<FnOutput<'tcx>> {
-        ty::Binder(self.0.output.clone())
+        self.map_bound_ref(|fn_sig| fn_sig.output.clone())
     }
     pub fn variadic(&self) -> bool {
-        self.0.variadic
+        self.skip_binder().variadic
     }
 }
 
@@ -1132,7 +1132,7 @@ pub struct ParamTy {
 /// regions (and perhaps later types) in a higher-ranked setting. In
 /// particular, imagine a type like this:
 ///
-///     for<'a> fn(for<'b> fn(&'b int, &'a int), &'a char)
+///     for<'a> fn(for<'b> fn(&'b isize, &'a isize), &'a char)
 ///     ^          ^            |        |         |
 ///     |          |            |        |         |
 ///     |          +------------+ 1      |         |
@@ -1149,11 +1149,11 @@ pub struct ParamTy {
 /// count the number of binders, inside out. Some examples should help
 /// clarify what I mean.
 ///
-/// Let's start with the reference type `&'b int` that is the first
+/// Let's start with the reference type `&'b isize` that is the first
 /// argument to the inner function. This region `'b` is assigned a De
 /// Bruijn index of 1, meaning "the innermost binder" (in this case, a
 /// fn). The region `'a` that appears in the second argument type (`&'a
-/// int`) would then be assigned a De Bruijn index of 2, meaning "the
+/// isize`) would then be assigned a De Bruijn index of 2, meaning "the
 /// second-innermost binder". (These indices are written on the arrays
 /// in the diagram).
 ///
@@ -1234,14 +1234,14 @@ pub enum BorrowKind {
     /// implicit closure bindings. It is needed when you the closure
     /// is borrowing or mutating a mutable referent, e.g.:
     ///
-    ///    let x: &mut int = ...;
+    ///    let x: &mut isize = ...;
     ///    let y = || *x += 5;
     ///
     /// If we were to try to translate this closure into a more explicit
     /// form, we'd encounter an error with the code as written:
     ///
-    ///    struct Env { x: & &mut int }
-    ///    let x: &mut int = ...;
+    ///    struct Env { x: & &mut isize }
+    ///    let x: &mut isize = ...;
     ///    let y = (&mut Env { &x }, fn_ptr);  // Closure is pair of env and fn
     ///    fn fn_ptr(env: &mut Env) { **env.x += 5; }
     ///
@@ -1249,8 +1249,8 @@ pub enum BorrowKind {
     /// in an aliasable location. To solve, you'd have to translate with
     /// an `&mut` borrow:
     ///
-    ///    struct Env { x: & &mut int }
-    ///    let x: &mut int = ...;
+    ///    struct Env { x: & &mut isize }
+    ///    let x: &mut isize = ...;
     ///    let y = (&mut Env { &mut x }, fn_ptr); // changed from &x to &mut x
     ///    fn fn_ptr(env: &mut Env) { **env.x += 5; }
     ///
@@ -1361,7 +1361,7 @@ pub enum sty<'tcx> {
     ty_enum(DefId, &'tcx Substs<'tcx>),
     ty_uniq(Ty<'tcx>),
     ty_str,
-    ty_vec(Ty<'tcx>, Option<uint>), // Second field is length.
+    ty_vec(Ty<'tcx>, Option<usize>), // Second field is length.
     ty_ptr(mt<'tcx>),
     ty_rptr(&'tcx Region, mt<'tcx>),
 
@@ -1491,7 +1491,7 @@ pub fn to_poly_trait_predicate(&self) -> PolyTraitPredicate<'tcx> {
 }
 
 /// Binder is a binder for higher-ranked lifetimes. It is part of the
-/// compiler's representation for things like `for<'a> Fn(&'a int)`
+/// compiler's representation for things like `for<'a> Fn(&'a isize)`
 /// (which would be represented by the type `PolyTraitRef ==
 /// Binder<TraitRef>`). Note that when we skolemize, instantiate,
 /// erase, or otherwise "discharge" these bound regions, we change the
@@ -1519,6 +1519,22 @@ impl<T> Binder<T> {
     pub fn skip_binder(&self) -> &T {
         &self.0
     }
+
+    pub fn as_ref(&self) -> Binder<&T> {
+        ty::Binder(&self.0)
+    }
+
+    pub fn map_bound_ref<F,U>(&self, f: F) -> Binder<U>
+        where F: FnOnce(&T) -> U
+    {
+        self.as_ref().map_bound(f)
+    }
+
+    pub fn map_bound<F,U>(self, f: F) -> Binder<U>
+        where F: FnOnce(T) -> U
+    {
+        ty::Binder(f(self.0))
+    }
 }
 
 #[derive(Clone, Copy, PartialEq)]
@@ -1552,9 +1568,9 @@ pub enum type_err<'tcx> {
     terr_ptr_mutability,
     terr_ref_mutability,
     terr_vec_mutability,
-    terr_tuple_size(expected_found<uint>),
-    terr_fixed_array_size(expected_found<uint>),
-    terr_ty_param_size(expected_found<uint>),
+    terr_tuple_size(expected_found<usize>),
+    terr_fixed_array_size(expected_found<usize>),
+    terr_ty_param_size(expected_found<usize>),
     terr_arg_count,
     terr_regions_does_not_outlive(Region, Region),
     terr_regions_not_same(Region, Region),
@@ -1571,7 +1587,7 @@ pub enum type_err<'tcx> {
     terr_cyclic_ty,
     terr_convergence_mismatch(expected_found<bool>),
     terr_projection_name_mismatched(expected_found<ast::Name>),
-    terr_projection_bounds_length(expected_found<uint>),
+    terr_projection_bounds_length(expected_found<usize>),
 }
 
 /// Bounds suitable for a named type parameter like `A` in `fn foo<A>`
@@ -1600,7 +1616,7 @@ pub struct ExistentialBounds<'tcx> {
 
 #[derive(Clone, RustcEncodable, PartialEq, Eq, RustcDecodable, Hash,
            Debug, Copy)]
-#[repr(uint)]
+#[repr(usize)]
 pub enum BuiltinBound {
     BoundSend,
     BoundSized,
@@ -1628,10 +1644,10 @@ pub fn region_existential_bound<'tcx>(r: ty::Region) -> ExistentialBounds<'tcx>
 }
 
 impl CLike for BuiltinBound {
-    fn to_usize(&self) -> uint {
-        *self as uint
+    fn to_usize(&self) -> usize {
+        *self as usize
     }
-    fn from_usize(v: uint) -> BuiltinBound {
+    fn from_usize(v: usize) -> BuiltinBound {
         unsafe { mem::transmute(v) }
     }
 }
@@ -2062,8 +2078,7 @@ fn to_poly_trait_ref(&self) -> PolyTraitRef<'tcx> {
 
 impl<'tcx> ToPolyTraitRef<'tcx> for PolyTraitPredicate<'tcx> {
     fn to_poly_trait_ref(&self) -> PolyTraitRef<'tcx> {
-        // We are just preserving the binder levels here
-        ty::Binder(self.0.trait_ref.clone())
+        self.map_bound_ref(|trait_pred| trait_pred.trait_ref.clone())
     }
 }
 
@@ -2202,8 +2217,8 @@ pub fn to_opt_poly_trait_ref(&self) -> Option<PolyTraitRef<'tcx>> {
 ///
 /// Here, the `GenericPredicates` for `Foo` would contain a list of bounds like
 /// `[[], [U:Bar<T>]]`.  Now if there were some particular reference
-/// like `Foo<int,uint>`, then the `InstantiatedPredicates` would be `[[],
-/// [uint:Bar<int>]]`.
+/// like `Foo<isize,usize>`, then the `InstantiatedPredicates` would be `[[],
+/// [usize:Bar<isize>]]`.
 #[derive(Clone, Debug)]
 pub struct InstantiatedPredicates<'tcx> {
     pub predicates: VecPerParamSpace<Predicate<'tcx>>,
@@ -2545,12 +2560,12 @@ fn new(arena: &'tcx TypedArena<TyS<'tcx>>,
             bool: intern_ty(arena, interner, ty_bool),
             char: intern_ty(arena, interner, ty_char),
             err: intern_ty(arena, interner, ty_err),
-            int: intern_ty(arena, interner, ty_int(ast::TyIs(false))),
+            isize: intern_ty(arena, interner, ty_int(ast::TyIs)),
             i8: intern_ty(arena, interner, ty_int(ast::TyI8)),
             i16: intern_ty(arena, interner, ty_int(ast::TyI16)),
             i32: intern_ty(arena, interner, ty_int(ast::TyI32)),
             i64: intern_ty(arena, interner, ty_int(ast::TyI64)),
-            uint: intern_ty(arena, interner, ty_uint(ast::TyUs(false))),
+            usize: intern_ty(arena, interner, ty_uint(ast::TyUs)),
             u8: intern_ty(arena, interner, ty_uint(ast::TyU8)),
             u16: intern_ty(arena, interner, ty_uint(ast::TyU16)),
             u32: intern_ty(arena, interner, ty_uint(ast::TyU32)),
@@ -2935,7 +2950,7 @@ fn add_bounds(&mut self, bounds: &ExistentialBounds) {
 
 pub fn mk_mach_int<'tcx>(tcx: &ctxt<'tcx>, tm: ast::IntTy) -> Ty<'tcx> {
     match tm {
-        ast::TyIs(_)   => tcx.types.int,
+        ast::TyIs   => tcx.types.isize,
         ast::TyI8   => tcx.types.i8,
         ast::TyI16  => tcx.types.i16,
         ast::TyI32  => tcx.types.i32,
@@ -2945,7 +2960,7 @@ pub fn mk_mach_int<'tcx>(tcx: &ctxt<'tcx>, tm: ast::IntTy) -> Ty<'tcx> {
 
 pub fn mk_mach_uint<'tcx>(tcx: &ctxt<'tcx>, tm: ast::UintTy) -> Ty<'tcx> {
     match tm {
-        ast::TyUs(_)   => tcx.types.uint,
+        ast::TyUs   => tcx.types.usize,
         ast::TyU8   => tcx.types.u8,
         ast::TyU16  => tcx.types.u16,
         ast::TyU32  => tcx.types.u32,
@@ -3004,7 +3019,7 @@ pub fn mk_nil_ptr<'tcx>(cx: &ctxt<'tcx>) -> Ty<'tcx> {
     mk_ptr(cx, mt {ty: mk_nil(cx), mutbl: ast::MutImmutable})
 }
 
-pub fn mk_vec<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>, sz: Option<uint>) -> Ty<'tcx> {
+pub fn mk_vec<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>, sz: Option<usize>) -> Ty<'tcx> {
     mk_t(cx, ty_vec(ty, sz))
 }
 
@@ -3024,6 +3039,10 @@ pub fn mk_nil<'tcx>(cx: &ctxt<'tcx>) -> Ty<'tcx> {
     mk_tup(cx, Vec::new())
 }
 
+pub fn mk_bool<'tcx>(cx: &ctxt<'tcx>) -> Ty<'tcx> {
+    mk_t(cx, ty_bool)
+}
+
 pub fn mk_bare_fn<'tcx>(cx: &ctxt<'tcx>,
                         opt_def_id: Option<ast::DefId>,
                         fty: &'tcx BareFnTy<'tcx>) -> Ty<'tcx> {
@@ -3130,9 +3149,9 @@ impl<'tcx> TyS<'tcx> {
     /// structs or variants. For example:
     ///
     /// ```notrust
-    /// int => { int }
-    /// Foo<Bar<int>> => { Foo<Bar<int>>, Bar<int>, int }
-    /// [int] => { [int], int }
+    /// isize => { isize }
+    /// Foo<Bar<isize>> => { Foo<Bar<isize>>, Bar<isize>, isize }
+    /// [isize] => { [isize], isize }
     /// ```
     pub fn walk(&'tcx self) -> TypeWalker<'tcx> {
         TypeWalker::new(self)
@@ -3143,9 +3162,9 @@ pub fn walk(&'tcx self) -> TypeWalker<'tcx> {
     /// example:
     ///
     /// ```notrust
-    /// int => { }
-    /// Foo<Bar<int>> => { Bar<int>, int }
-    /// [int] => { int }
+    /// isize => { }
+    /// Foo<Bar<isize>> => { Bar<isize>, isize }
+    /// [isize] => { isize }
     /// ```
     pub fn walk_children(&'tcx self) -> TypeWalker<'tcx> {
         // Walks type reachable from `self` but not `self
@@ -3343,7 +3362,7 @@ pub fn simd_type<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
     }
 }
 
-pub fn simd_size(cx: &ctxt, ty: Ty) -> uint {
+pub fn simd_size(cx: &ctxt, ty: Ty) -> usize {
     match ty.sty {
         ty_struct(did, _) => {
             let fields = lookup_struct_fields(cx, did);
@@ -3391,8 +3410,12 @@ pub fn type_is_scalar(ty: Ty) -> bool {
 /// Returns true if this type is a floating point type and false otherwise.
 pub fn type_is_floating_point(ty: Ty) -> bool {
     match ty.sty {
-        ty_float(_) => true,
-        _ => false,
+        ty_float(_) |
+        ty_infer(FloatVar(_)) =>
+            true,
+
+        _ =>
+            false,
     }
 }
 
@@ -3611,8 +3634,8 @@ fn tc_ty<'tcx>(cx: &ctxt<'tcx>,
         cache.insert(ty, TC::None);
 
         let result = match ty.sty {
-            // uint and int are ffi-unsafe
-            ty_uint(ast::TyUs(_)) | ty_int(ast::TyIs(_)) => {
+            // usize and isize are ffi-unsafe
+            ty_uint(ast::TyUs) | ty_int(ast::TyIs) => {
                 TC::ReachesFfiUnsafe
             }
 
@@ -4175,7 +4198,7 @@ pub fn type_is_fresh(ty: Ty) -> bool {
 
 pub fn type_is_uint(ty: Ty) -> bool {
     match ty.sty {
-      ty_infer(IntVar(_)) | ty_uint(ast::TyUs(_)) => true,
+      ty_infer(IntVar(_)) | ty_uint(ast::TyUs) => true,
       _ => false
     }
 }
@@ -4221,7 +4244,7 @@ pub fn type_is_signed(ty: Ty) -> bool {
 
 pub fn type_is_machine(ty: Ty) -> bool {
     match ty.sty {
-        ty_int(ast::TyIs(_)) | ty_uint(ast::TyUs(_)) => false,
+        ty_int(ast::TyIs) | ty_uint(ast::TyUs) => false,
         ty_int(..) | ty_uint(..) | ty_float(..) => true,
         _ => false
     }
@@ -4292,7 +4315,7 @@ pub fn array_element_ty<'tcx>(tcx: &ctxt<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'tcx>
 /// For an enum `t`, `variant` is None only if `t` is a univariant enum.
 pub fn positional_element_ty<'tcx>(cx: &ctxt<'tcx>,
                                    ty: Ty<'tcx>,
-                                   i: uint,
+                                   i: usize,
                                    variant: Option<ast::DefId>) -> Option<Ty<'tcx>> {
 
     match (&ty.sty, variant) {
@@ -4468,8 +4491,8 @@ pub fn pat_ty_opt<'tcx>(cx: &ctxt<'tcx>, pat: &ast::Pat) -> Option<Ty<'tcx>> {
 // adjustments.  See `expr_ty_adjusted()` instead.
 //
 // NB (2): This type doesn't provide type parameter substitutions; e.g. if you
-// ask for the type of "id" in "id(3)", it will return "fn(&int) -> int"
-// instead of "fn(ty) -> T with T = int".
+// ask for the type of "id" in "id(3)", it will return "fn(&isize) -> isize"
+// instead of "fn(ty) -> T with T = isize".
 pub fn expr_ty<'tcx>(cx: &ctxt<'tcx>, expr: &ast::Expr) -> Ty<'tcx> {
     return node_id_to_type(cx, expr.id);
 }
@@ -4879,7 +4902,7 @@ pub fn stmt_node_id(s: &ast::Stmt) -> ast::NodeId {
 }
 
 pub fn field_idx_strict(tcx: &ctxt, name: ast::Name, fields: &[field])
-                     -> uint {
+                     -> usize {
     let mut i = 0;
     for f in fields { if f.name == name { return i; } i += 1; }
     tcx.sess.bug(&format!(
@@ -4891,7 +4914,7 @@ pub fn field_idx_strict(tcx: &ctxt, name: ast::Name, fields: &[field])
 }
 
 pub fn impl_or_trait_item_idx(id: ast::Name, trait_items: &[ImplOrTraitItem])
-                              -> Option<uint> {
+                              -> Option<usize> {
     trait_items.iter().position(|m| m.name() == id)
 }
 
@@ -5163,7 +5186,7 @@ fn lookup_locally_or_in_crate_store<V, F>(descr: &str,
     v
 }
 
-pub fn trait_item<'tcx>(cx: &ctxt<'tcx>, trait_did: ast::DefId, idx: uint)
+pub fn trait_item<'tcx>(cx: &ctxt<'tcx>, trait_did: ast::DefId, idx: usize)
                         -> ImplOrTraitItem<'tcx> {
     let method_def_id = (*ty::trait_item_def_ids(cx, trait_did))[idx].def_id();
     impl_or_trait_item(cx, method_def_id)
@@ -5238,10 +5261,10 @@ pub fn is_associated_type(cx: &ctxt, id: ast::DefId) -> bool {
 pub fn associated_type_parameter_index(cx: &ctxt,
                                        trait_def: &TraitDef,
                                        associated_type_id: ast::DefId)
-                                       -> uint {
+                                       -> usize {
     for type_parameter_def in trait_def.generics.types.iter() {
         if type_parameter_def.def_id == associated_type_id {
-            return type_parameter_def.index as uint
+            return type_parameter_def.index as usize
         }
     }
     cx.sess.bug("couldn't find associated type parameter index")
@@ -5468,7 +5491,6 @@ pub fn type_is_empty(cx: &ctxt, ty: Ty) -> bool {
 
 pub fn enum_variants<'tcx>(cx: &ctxt<'tcx>, id: ast::DefId)
                            -> Rc<Vec<Rc<VariantInfo<'tcx>>>> {
-    use std::num::Int; // For checked_add
     memoized(&cx.enum_var_cache, id, |id: ast::DefId| {
         if ast::LOCAL_CRATE != id.krate {
             Rc::new(csearch::get_enum_variants(cx, id))
@@ -5790,85 +5812,13 @@ pub fn closure_upvars<'tcx>(typer: &mc::Typer<'tcx>,
     }
 }
 
-pub fn is_binopable<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>, op: ast::BinOp) -> bool {
-    #![allow(non_upper_case_globals)]
-    const tycat_other: int = 0;
-    const tycat_bool: int = 1;
-    const tycat_char: int = 2;
-    const tycat_int: int = 3;
-    const tycat_float: int = 4;
-    const tycat_raw_ptr: int = 6;
-
-    const opcat_add: int = 0;
-    const opcat_sub: int = 1;
-    const opcat_mult: int = 2;
-    const opcat_shift: int = 3;
-    const opcat_rel: int = 4;
-    const opcat_eq: int = 5;
-    const opcat_bit: int = 6;
-    const opcat_logic: int = 7;
-    const opcat_mod: int = 8;
-
-    fn opcat(op: ast::BinOp) -> int {
-        match op.node {
-          ast::BiAdd => opcat_add,
-          ast::BiSub => opcat_sub,
-          ast::BiMul => opcat_mult,
-          ast::BiDiv => opcat_mult,
-          ast::BiRem => opcat_mod,
-          ast::BiAnd => opcat_logic,
-          ast::BiOr => opcat_logic,
-          ast::BiBitXor => opcat_bit,
-          ast::BiBitAnd => opcat_bit,
-          ast::BiBitOr => opcat_bit,
-          ast::BiShl => opcat_shift,
-          ast::BiShr => opcat_shift,
-          ast::BiEq => opcat_eq,
-          ast::BiNe => opcat_eq,
-          ast::BiLt => opcat_rel,
-          ast::BiLe => opcat_rel,
-          ast::BiGe => opcat_rel,
-          ast::BiGt => opcat_rel
-        }
-    }
-
-    fn tycat<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> int {
-        if type_is_simd(cx, ty) {
-            return tycat(cx, simd_type(cx, ty))
-        }
-        match ty.sty {
-          ty_char => tycat_char,
-          ty_bool => tycat_bool,
-          ty_int(_) | ty_uint(_) | ty_infer(IntVar(_)) => tycat_int,
-          ty_float(_) | ty_infer(FloatVar(_)) => tycat_float,
-          ty_ptr(_) => tycat_raw_ptr,
-          _ => tycat_other
-        }
-    }
-
-    const t: bool = true;
-    const f: bool = false;
-
-    let tbl = [
-    //           +, -, *, shift, rel, ==, bit, logic, mod
-    /*other*/   [f, f, f, f,     f,   f,  f,   f,     f],
-    /*bool*/    [f, f, f, f,     t,   t,  t,   t,     f],
-    /*char*/    [f, f, f, f,     t,   t,  f,   f,     f],
-    /*int*/     [t, t, t, t,     t,   t,  t,   f,     t],
-    /*float*/   [t, t, t, f,     t,   t,  f,   f,     f],
-    /*bot*/     [t, t, t, t,     t,   t,  t,   t,     t],
-    /*raw ptr*/ [f, f, f, f,     t,   t,  f,   f,     f]];
-
-    return tbl[tycat(cx, ty) as uint ][opcat(op) as uint];
-}
-
 // Returns the repeat count for a repeating vector expression.
-pub fn eval_repeat_count(tcx: &ctxt, count_expr: &ast::Expr) -> uint {
-    match const_eval::eval_const_expr_partial(tcx, count_expr, Some(tcx.types.uint)) {
+pub fn eval_repeat_count(tcx: &ctxt, count_expr: &ast::Expr) -> usize {
+    match const_eval::eval_const_expr_partial(tcx, count_expr, Some(tcx.types.usize)) {
         Ok(val) => {
             let found = match val {
-                const_eval::const_uint(count) => return count as uint,
-                const_eval::const_int(count) if count >= 0 => return count as uint,
+                const_eval::const_uint(count) => return count as usize,
+                const_eval::const_int(count) if count >= 0 => return count as usize,
                 const_eval::const_int(_) => "negative integer",
                 const_eval::const_float(_) => "float",
                 const_eval::const_str(_) => "string",
@@ -6737,7 +6687,7 @@ pub fn liberate_late_bound_regions<'tcx, T>(
 pub fn count_late_bound_regions<'tcx, T>(
     tcx: &ty::ctxt<'tcx>,
     value: &Binder<T>)
-    -> uint
+    -> usize
     where T : TypeFoldable<'tcx> + Repr<'tcx>
 {
     let (_, skol_map) = replace_late_bound_regions(tcx, value, |_| ty::ReStatic);
@@ -6753,6 +6703,30 @@ pub fn binds_late_bound_regions<'tcx, T>(
     count_late_bound_regions(tcx, value) > 0
 }
 
+/// Flattens two binding levels into one. So `for<'a> for<'b> Foo`
+/// becomes `for<'a,'b> Foo`.
+pub fn flatten_late_bound_regions<'tcx, T>(
+    tcx: &ty::ctxt<'tcx>,
+    bound2_value: &Binder<Binder<T>>)
+    -> Binder<T>
+    where T: TypeFoldable<'tcx> + Repr<'tcx>
+{
+    let bound0_value = bound2_value.skip_binder().skip_binder();
+    let value = ty_fold::fold_regions(tcx, bound0_value, |region, current_depth| {
+        match region {
+            ty::ReLateBound(debruijn, br) if debruijn.depth >= current_depth => {
+                // should be true if no escaping regions from bound2_value
+                assert!(debruijn.depth - current_depth <= 1);
+                ty::ReLateBound(DebruijnIndex::new(current_depth), br)
+            }
+            _ => {
+                region
+            }
+        }
+    });
+    Binder(value)
+}
+
 pub fn no_late_bound_regions<'tcx, T>(
     tcx: &ty::ctxt<'tcx>,
     value: &Binder<T>)
@@ -6783,8 +6757,8 @@ pub fn erase_late_bound_regions<'tcx, T>(
 ///
 /// The chief purpose of this function is to canonicalize regions so that two
 /// `FnSig`s or `TraitRef`s which are equivalent up to region naming will become
-/// structurally identical.  For example, `for<'a, 'b> fn(&'a int, &'b int)` and
-/// `for<'a, 'b> fn(&'b int, &'a int)` will become identical after anonymization.
+/// structurally identical.  For example, `for<'a, 'b> fn(&'a isize, &'b isize)` and
+/// `for<'a, 'b> fn(&'b isize, &'a isize)` will become identical after anonymization.
 pub fn anonymize_late_bound_regions<'tcx, T>(
     tcx: &ctxt<'tcx>,
     sig: &Binder<T>)
@@ -7089,6 +7063,12 @@ fn has_regions_escaping_depth(&self, depth: u32) -> bool {
     }
 }
 
+impl<'tcx,P:RegionEscape> RegionEscape for traits::Obligation<'tcx,P> {
+    fn has_regions_escaping_depth(&self, depth: u32) -> bool {
+        self.predicate.has_regions_escaping_depth(depth)
+    }
+}
+
 impl<'tcx> RegionEscape for TraitRef<'tcx> {
     fn has_regions_escaping_depth(&self, depth: u32) -> bool {
         self.substs.types.iter().any(|t| t.has_regions_escaping_depth(depth)) ||
index 1069d1282eab1e9f5b37ab7998f3d6bf7f3823b3..5d492f1c95e11c81ccb8b4a528e2484a4a3712af 100644 (file)
@@ -15,7 +15,7 @@
 
 pub struct TypeWalker<'tcx> {
     stack: Vec<Ty<'tcx>>,
-    last_subtree: uint,
+    last_subtree: usize,
 }
 
 impl<'tcx> TypeWalker<'tcx> {
@@ -80,14 +80,14 @@ fn push_reversed(&mut self, tys: &[Ty<'tcx>]) {
     /// Skips the subtree of types corresponding to the last type
     /// returned by `next()`.
     ///
-    /// Example: Imagine you are walking `Foo<Bar<int>, uint>`.
+    /// Example: Imagine you are walking `Foo<Bar<int>, usize>`.
     ///
     /// ```
     /// let mut iter: TypeWalker = ...;
     /// iter.next(); // yields Foo
     /// iter.next(); // yields Bar<int>
     /// iter.skip_current_subtree(); // skips int
-    /// iter.next(); // yields uint
+    /// iter.next(); // yields usize
     /// ```
     pub fn skip_current_subtree(&mut self) {
         self.stack.truncate(self.last_subtree);
index 6fd74479f759654c12e1d78211606cd568082864..752e71bc19131b3dad208ac4f7a9559cf8883d6e 100644 (file)
 use std::dynamic_lib::DynamicLibrary;
 use std::env;
 use std::mem;
-
-#[allow(deprecated)]
-use std::old_path;
-
 use std::path::PathBuf;
 use syntax::ast;
 use syntax::codemap::{Span, COMMAND_LINE_SP};
@@ -110,7 +106,6 @@ fn dylink_registrar(&mut self,
                         symbol: String) -> PluginRegistrarFun {
         // Make sure the path contains a / or the linker will search for it.
         let path = env::current_dir().unwrap().join(&path);
-        let path = old_path::Path::new(path.to_str().unwrap());
 
         let lib = match DynamicLibrary::open(Some(&path)) {
             Ok(lib) => lib,
index 711ed43fe06062eec3590fa6b52ceeebeaaf398c..3162c4fc570236d75246364cea365867f97e9ed6 100644 (file)
@@ -47,7 +47,7 @@
 //! #![plugin(myplugin)]
 //! ```
 //!
-//! See [the compiler plugin guide](../../guide-plugin.html)
+//! See the [Plugins Chapter](../../book/plugins.html) of the book
 //! for more examples.
 
 pub use self::registry::Registry;
index 78f7b3b91ddf74d5c9935466183229933fd87dda..a73ed04ac0a41b974cbe7133ef06e4fb07f5fe97 100644 (file)
@@ -15,7 +15,7 @@
 
 use syntax::ext::base::{SyntaxExtension, NamedSyntaxExtension, NormalTT};
 use syntax::ext::base::{IdentTT, Decorator, Modifier, MultiModifier, MacroRulesTT};
-use syntax::ext::base::{MacroExpanderFn};
+use syntax::ext::base::MacroExpanderFn;
 use syntax::codemap::Span;
 use syntax::parse::token;
 use syntax::ptr::P;
index 931cfc7999281cecd767328b1b6a47126f958d47..c67819ab7e3c42751c327342ed53ab86f73f8bf1 100644 (file)
@@ -439,14 +439,14 @@ fn parse_opt_list(slot: &mut Option<Vec<String>>, v: Option<&str>)
             }
         }
 
-        fn parse_uint(slot: &mut uint, v: Option<&str>) -> bool {
+        fn parse_uint(slot: &mut usize, v: Option<&str>) -> bool {
             match v.and_then(|s| s.parse().ok()) {
                 Some(i) => { *slot = i; true },
                 None => false
             }
         }
 
-        fn parse_opt_uint(slot: &mut Option<uint>, v: Option<&str>) -> bool {
+        fn parse_opt_uint(slot: &mut Option<usize>, v: Option<&str>) -> bool {
             match v {
                 Some(s) => { *slot = s.parse().ok(); slot.is_some() }
                 None => { *slot = None; true }
@@ -518,16 +518,16 @@ fn parse_passes(slot: &mut Passes, v: Option<&str>) -> bool {
          "metadata to mangle symbol names with"),
     extra_filename: String = ("".to_string(), parse_string,
          "extra data to put in each output filename"),
-    codegen_units: uint = (1, parse_uint,
+    codegen_units: usize = (1, parse_uint,
         "divide crate into N units to optimize in parallel"),
     remark: Passes = (SomePasses(Vec::new()), parse_passes,
         "print remarks for these optimization passes (space separated, or \"all\")"),
     no_stack_check: bool = (false, parse_bool,
         "disable checks for stack exhaustion (a memory-safety hazard!)"),
-    debuginfo: Option<uint> = (None, parse_opt_uint,
+    debuginfo: Option<usize> = (None, parse_opt_uint,
         "debug info emission level, 0 = no debug info, 1 = line tables only, \
          2 = full debug info with variable and type information"),
-    opt_level: Option<uint> = (None, parse_opt_uint,
+    opt_level: Option<usize> = (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"),
@@ -604,6 +604,8 @@ fn parse_passes(slot: &mut Passes, v: Option<&str>) -> bool {
           "Print the size of enums and their variants"),
     force_overflow_checks: Option<bool> = (None, parse_opt_bool,
           "Force overflow checks on or off"),
+    force_dropflag_checks: Option<bool> = (None, parse_opt_bool,
+          "Force drop flag checks on or off"),
 }
 
 pub fn default_lib_output() -> CrateType {
@@ -958,24 +960,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
     let libs = matches.opt_strs("l").into_iter().map(|s| {
         let mut parts = s.splitn(1, '=');
         let kind = parts.next().unwrap();
-        if let Some(name) = parts.next() {
-            let kind = match kind {
-                "dylib" => cstore::NativeUnknown,
-                "framework" => cstore::NativeFramework,
-                "static" => cstore::NativeStatic,
-                s => {
-                    early_error(&format!("unknown library kind `{}`, expected \
-                                          one of dylib, framework, or static",
-                                         s));
-                }
-            };
-            return (name.to_string(), kind)
-        }
-
-        // FIXME(acrichto) remove this once crates have stopped using it, this
-        //                 is deprecated behavior now.
-        let mut parts = s.rsplitn(1, ':');
-        let kind = parts.next().unwrap();
         let (name, kind) = match (parts.next(), kind) {
             (None, name) |
             (Some(name), "dylib") => (name, cstore::NativeUnknown),
index 8bc842671a0a96da425b7e9257dc81c8a40c2733..3e3e5e17963cd1ac294782be0b19838f2132c91c 100644 (file)
@@ -58,7 +58,7 @@ pub struct Session {
 
     /// The maximum recursion limit for potentially infinitely recursive
     /// operations such as auto-dereference and monomorphization.
-    pub recursion_limit: Cell<uint>,
+    pub recursion_limit: Cell<usize>,
 
     pub can_print_warnings: bool
 }
@@ -106,7 +106,7 @@ pub fn err(&self, msg: &str) {
         }
         self.diagnostic().handler().err(msg)
     }
-    pub fn err_count(&self) -> uint {
+    pub fn err_count(&self) -> usize {
         self.diagnostic().handler().err_count()
     }
     pub fn has_errors(&self) -> bool {
index 38502e3c10241cbc333fb673df2de2e1a892d58e..60ae053dbaf04eeabc5f1b6684bf6347a8768e6c 100644 (file)
@@ -35,7 +35,7 @@
 pub fn time<T, U, F>(do_it: bool, what: &str, u: U, f: F) -> T where
     F: FnOnce(U) -> T,
 {
-    thread_local!(static DEPTH: Cell<uint> = Cell::new(0));
+    thread_local!(static DEPTH: Cell<usize> = Cell::new(0));
     if !do_it { return f(u); }
 
     let old = DEPTH.with(|slot| {
@@ -196,10 +196,10 @@ pub fn can_reach<T, S>(edges_map: &HashMap<T, Vec<T>, S>, source: T,
 /// # Examples
 /// ```
 /// struct Context {
-///    cache: RefCell<HashMap<uint, uint>>
+///    cache: RefCell<HashMap<usize, usize>>
 /// }
 ///
-/// fn factorial(ctxt: &Context, n: uint) -> uint {
+/// fn factorial(ctxt: &Context, n: usize) -> usize {
 ///     memoized(&ctxt.cache, n, |n| match n {
 ///         0 | 1 => n,
 ///         _ => factorial(ctxt, n - 2) + factorial(ctxt, n - 1)
index d3b9b07ea416970daecfaab42dec9f9cf22de738..28f8510ce3fee150100523f49c455f82e2c6e7c3 100644 (file)
@@ -10,7 +10,7 @@
 
 use std::cmp;
 
-pub fn lev_distance(me: &str, t: &str) -> uint {
+pub fn lev_distance(me: &str, t: &str) -> usize {
     if me.is_empty() { return t.chars().count(); }
     if t.is_empty() { return me.chars().count(); }
 
index 0f69aa941a31e67b51080dd3051068f5f5362aee..61d28e0ca1e646f51d28ab90ca98fa84dc419c47 100644 (file)
@@ -12,7 +12,7 @@
 
 #![allow(non_snake_case)]
 
-use std::collections::hash_state::{DefaultState};
+use std::collections::hash_state::DefaultState;
 use std::collections::{HashMap, HashSet};
 use std::default::Default;
 use std::hash::{Hasher, Hash};
index 60540a9cfa6605391f07bf41af9bcf56bfa08967..452589a2407545100b3da60857c9901629e4b8b2 100644 (file)
@@ -21,7 +21,7 @@
 use middle::ty::{ty_bool, ty_char, ty_struct, ty_enum};
 use middle::ty::{ty_err, ty_str, ty_vec, ty_float, ty_bare_fn};
 use middle::ty::{ty_param, ty_ptr, ty_rptr, ty_tup};
-use middle::ty::{ty_closure};
+use middle::ty::ty_closure;
 use middle::ty::{ty_uniq, ty_trait, ty_int, ty_uint, ty_infer};
 use middle::ty;
 use middle::ty_fold::TypeFoldable;
index 8fbc682246f470078c18e5f6025ccbfc2e61b4d7..d2e0b3aec2f40236d3ac6615a42b8f4629858486 100644 (file)
@@ -30,10 +30,10 @@ pub enum UndoLog<D:SnapshotVecDelegate> {
     CommittedSnapshot,
 
     /// New variable with given index was created.
-    NewElem(uint),
+    NewElem(usize),
 
     /// Variable with given index was changed *from* the given value.
-    SetElem(uint, D::Value),
+    SetElem(usize, D::Value),
 
     /// Extensible set of actions
     Other(D::Undo)
@@ -48,7 +48,7 @@ pub struct SnapshotVec<D:SnapshotVecDelegate> {
 // Snapshots are tokens that should be created/consumed linearly.
 pub struct Snapshot {
     // Length of the undo log at the time the snapshot was taken.
-    length: uint,
+    length: usize,
 }
 
 pub trait SnapshotVecDelegate {
@@ -77,7 +77,7 @@ pub fn record(&mut self, action: D::Undo) {
         }
     }
 
-    pub fn push(&mut self, elem: D::Value) -> uint {
+    pub fn push(&mut self, elem: D::Value) -> usize {
         let len = self.values.len();
         self.values.push(elem);
 
@@ -88,20 +88,20 @@ pub fn push(&mut self, elem: D::Value) -> uint {
         len
     }
 
-    pub fn get<'a>(&'a self, index: uint) -> &'a D::Value {
+    pub fn get<'a>(&'a self, index: usize) -> &'a D::Value {
         &self.values[index]
     }
 
     /// Returns a mutable pointer into the vec; whatever changes you make here cannot be undone
     /// automatically, so you should be sure call `record()` with some sort of suitable undo
     /// action.
-    pub fn get_mut<'a>(&'a mut self, index: uint) -> &'a mut D::Value {
+    pub fn get_mut<'a>(&'a mut self, index: usize) -> &'a mut D::Value {
         &mut self.values[index]
     }
 
     /// Updates the element at the given index. The old value will saved (and perhaps restored) if
     /// a snapshot is active.
-    pub fn set(&mut self, index: uint, new_elem: D::Value) {
+    pub fn set(&mut self, index: usize, new_elem: D::Value) {
         let old_elem = mem::replace(&mut self.values[index], new_elem);
         if self.in_snapshot() {
             self.undo_log.push(SetElem(index, old_elem));
index 4b9064aaa05f9ecc8e6970457ed6062a00361b96..c3a3a8d582aff91f2fc400141e0b57d16d605234 100644 (file)
@@ -8,17 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub const BOX_FIELD_DROP_GLUE: uint = 1;
-pub const BOX_FIELD_BODY: uint = 4;
+pub const BOX_FIELD_DROP_GLUE: usize = 1;
+pub const BOX_FIELD_BODY: usize = 4;
 
 /// The first half of a fat pointer.
 /// - For a closure, this is the code address.
 /// - For an object or trait instance, this is the address of the box.
 /// - For a slice, this is the base address.
-pub const FAT_PTR_ADDR: uint = 0;
+pub const FAT_PTR_ADDR: usize = 0;
 
 /// The second half of a fat pointer.
 /// - For a closure, this is the address of the environment.
 /// - For an object or trait instance, this is the address of the vtable.
 /// - For a slice, this is the length.
-pub const FAT_PTR_EXTRA: uint = 1;
+pub const FAT_PTR_EXTRA: usize = 1;
index 2cc51a723f2370c96a362fb87b2de0e83ecd18ed..9f5751c421ecebe39ad56cc1f866e2bd0a916b19 100644 (file)
@@ -246,7 +246,7 @@ pub fn build(self) -> Archive<'a> {
         // Don't allow the total size of `args` to grow beyond 32,000 bytes.
         // Windows will raise an error if the argument string is longer than
         // 32,768, and we leave a bit of extra space for the program name.
-        const ARG_LENGTH_LIMIT: uint = 32_000;
+        const ARG_LENGTH_LIMIT: usize = 32_000;
 
         for member_name in &self.members {
             let len = member_name.to_string_lossy().len();
index f7ee76c0a4397450ce8a258e67d51439bd90ac3f..fe457841e9116c81c5ea88b21240f13b9f3a6c45 100644 (file)
@@ -36,7 +36,6 @@
 #![feature(collections)]
 #![feature(core)]
 #![feature(old_fs)]
-#![feature(int_uint)]
 #![feature(io)]
 #![feature(old_io)]
 #![feature(old_path)]
index 1a399519296a829ecd782994096376ff890a392b..8f0387059e4a9d2418026461782f3d9c585f4008 100644 (file)
@@ -64,7 +64,7 @@ fn to_bits(self) -> (u64, u64) {
 fn add_bytes_to_bits<T: Int + ToBits>(bits: T, bytes: T) -> T {
     let (new_high_bits, new_low_bits) = bytes.to_bits();
 
-    if new_high_bits > Int::zero() {
+    if new_high_bits > T::zero() {
         panic!("numeric overflow occurred.")
     }
 
@@ -90,29 +90,29 @@ fn input<F>(&mut self, input: &[u8], func: F) where
 
     /// Zero the buffer up until the specified index. The buffer position currently must not be
     /// greater than that index.
-    fn zero_until(&mut self, idx: uint);
+    fn zero_until(&mut self, idx: usize);
 
     /// Get a slice of the buffer of the specified size. There must be at least that many bytes
     /// remaining in the buffer.
-    fn next<'s>(&'s mut self, len: uint) -> &'s mut [u8];
+    fn next<'s>(&'s mut self, len: usize) -> &'s mut [u8];
 
     /// Get the current buffer. The buffer must already be full. This clears the buffer as well.
     fn full_buffer<'s>(&'s mut self) -> &'s [u8];
 
     /// Get the current position of the buffer.
-    fn position(&self) -> uint;
+    fn position(&self) -> usize;
 
     /// Get the number of bytes remaining in the buffer until it is full.
-    fn remaining(&self) -> uint;
+    fn remaining(&self) -> usize;
 
     /// Get the size of the buffer
-    fn size(&self) -> uint;
+    fn size(&self) -> usize;
 }
 
 /// A FixedBuffer of 64 bytes useful for implementing Sha256 which has a 64 byte blocksize.
 struct FixedBuffer64 {
     buffer: [u8; 64],
-    buffer_idx: uint,
+    buffer_idx: usize,
 }
 
 impl FixedBuffer64 {
@@ -139,15 +139,15 @@ fn input<F>(&mut self, input: &[u8], mut func: F) where
             let buffer_remaining = size - self.buffer_idx;
             if input.len() >= buffer_remaining {
                     copy_memory(
-                        &mut self.buffer[self.buffer_idx..size],
-                        &input[..buffer_remaining]);
+                        &input[..buffer_remaining],
+                        &mut self.buffer[self.buffer_idx..size]);
                 self.buffer_idx = 0;
                 func(&self.buffer);
                 i += buffer_remaining;
             } else {
                 copy_memory(
-                    &mut self.buffer[self.buffer_idx..self.buffer_idx + input.len()],
-                    input);
+                    input,
+                    &mut self.buffer[self.buffer_idx..self.buffer_idx + input.len()]);
                 self.buffer_idx += input.len();
                 return;
             }
@@ -165,8 +165,8 @@ fn input<F>(&mut self, input: &[u8], mut func: F) where
         // be empty.
         let input_remaining = input.len() - i;
         copy_memory(
-            &mut self.buffer[..input_remaining],
-            &input[i..]);
+            &input[i..],
+            &mut self.buffer[..input_remaining]);
         self.buffer_idx += input_remaining;
     }
 
@@ -174,13 +174,13 @@ fn reset(&mut self) {
         self.buffer_idx = 0;
     }
 
-    fn zero_until(&mut self, idx: uint) {
+    fn zero_until(&mut self, idx: usize) {
         assert!(idx >= self.buffer_idx);
         self.buffer[self.buffer_idx..idx].set_memory(0);
         self.buffer_idx = idx;
     }
 
-    fn next<'s>(&'s mut self, len: uint) -> &'s mut [u8] {
+    fn next<'s>(&'s mut self, len: usize) -> &'s mut [u8] {
         self.buffer_idx += len;
         return &mut self.buffer[self.buffer_idx - len..self.buffer_idx];
     }
@@ -191,11 +191,11 @@ fn full_buffer<'s>(&'s mut self) -> &'s [u8] {
         return &self.buffer[..64];
     }
 
-    fn position(&self) -> uint { self.buffer_idx }
+    fn position(&self) -> usize { self.buffer_idx }
 
-    fn remaining(&self) -> uint { 64 - self.buffer_idx }
+    fn remaining(&self) -> usize { 64 - self.buffer_idx }
 
-    fn size(&self) -> uint { 64 }
+    fn size(&self) -> usize { 64 }
 }
 
 /// The StandardPadding trait adds a method useful for Sha256 to a FixedBuffer struct.
@@ -204,11 +204,11 @@ trait StandardPadding {
     /// guaranteed to have exactly rem remaining bytes when it returns. If there are not at least
     /// rem bytes available, the buffer will be zero padded, processed, cleared, and then filled
     /// with zeros again until only rem bytes are remaining.
-    fn standard_padding<F>(&mut self, rem: uint, func: F) where F: FnMut(&[u8]);
+    fn standard_padding<F>(&mut self, rem: usize, func: F) where F: FnMut(&[u8]);
 }
 
 impl <T: FixedBuffer> StandardPadding for T {
-    fn standard_padding<F>(&mut self, rem: uint, mut func: F) where F: FnMut(&[u8]) {
+    fn standard_padding<F>(&mut self, rem: usize, mut func: F) where F: FnMut(&[u8]) {
         let size = self.size();
 
         self.next(1)[0] = 128;
@@ -244,7 +244,7 @@ pub trait Digest {
     fn reset(&mut self);
 
     /// Get the output size in bits.
-    fn output_bits(&self) -> uint;
+    fn output_bits(&self) -> usize;
 
     /// Convenience function that feeds a string into a digest.
     ///
@@ -514,7 +514,7 @@ fn reset(&mut self) {
         self.engine.reset(&H256);
     }
 
-    fn output_bits(&self) -> uint { 256 }
+    fn output_bits(&self) -> usize { 256 }
 }
 
 static H256: [u32; 8] = [
@@ -537,7 +537,7 @@ mod tests {
     use self::rand::isaac::IsaacRng;
     use serialize::hex::FromHex;
     use std::iter::repeat;
-    use std::num::Int;
+    use std::u64;
     use super::{Digest, Sha256, FixedBuffer};
 
     // A normal addition - no overflow occurs
@@ -550,7 +550,7 @@ fn test_add_bytes_to_bits_ok() {
     #[test]
     #[should_panic]
     fn test_add_bytes_to_bits_overflow() {
-        super::add_bytes_to_bits::<u64>(Int::max_value(), 1);
+        super::add_bytes_to_bits::<u64>(u64::MAX, 1);
     }
 
     struct Test {
@@ -613,7 +613,7 @@ fn test_sha256() {
 
     /// Feed 1,000,000 'a's into the digest with varying input sizes and check that the result is
     /// correct.
-    fn test_digest_1million_random<D: Digest>(digest: &mut D, blocksize: uint, expected: &str) {
+    fn test_digest_1million_random<D: Digest>(digest: &mut D, blocksize: usize, expected: &str) {
         let total_size = 1000000;
         let buffer: Vec<u8> = repeat('a' as u8).take(blocksize * 2).collect();
         let mut rng = IsaacRng::new_unseeded();
@@ -622,7 +622,7 @@ fn test_digest_1million_random<D: Digest>(digest: &mut D, blocksize: uint, expec
         digest.reset();
 
         while count < total_size {
-            let next: uint = rng.gen_range(0, 2 * blocksize + 1);
+            let next: usize = rng.gen_range(0, 2 * blocksize + 1);
             let remaining = total_size - count;
             let size = if next > remaining { remaining } else { next };
             digest.input(&buffer[..size]);
index 5aae0e9dbdcf06a2729a338d5624c1a74265b0df..f9416d53a8fa3a51dcf74ab662d2393d152ab8d3 100644 (file)
@@ -221,7 +221,7 @@ pub enum SawExprComponent<'a> {
 
         SawExprLoop(Option<token::InternedString>),
         SawExprField(token::InternedString),
-        SawExprTupField(uint),
+        SawExprTupField(usize),
         SawExprBreak(Option<token::InternedString>),
         SawExprAgain(Option<token::InternedString>),
 
index c464658f447acd973d1568b93dca9285c59dd21b..07528df97f1334686123652efacf0c9525324fd0 100644 (file)
@@ -157,7 +157,7 @@ pub struct TargetOptions {
     /// particular running dsymutil and some other stuff like `-dead_strip`. Defaults to false.
     pub is_like_osx: bool,
     /// Whether the target toolchain is like Windows'. Only useful for compiling against Windows,
-    /// only realy used for figuring out how to find libraries, since Windows uses its own
+    /// only really used for figuring out how to find libraries, since Windows uses its own
     /// library naming convention. Defaults to false.
     pub is_like_windows: bool,
     /// Whether the target toolchain is like Android's. Only useful for compiling against Android.
index 0e87ba278db21f520286843306901c2494beac2f..d4503ae7fc9872e3309111bb953f80a9324e9ca2 100644 (file)
@@ -27,7 +27,7 @@ pub struct TempDir {
 // 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;
+const NUM_RAND_CHARS: usize = 12;
 
 impl TempDir {
     /// Attempts to make a temporary directory inside of `tmpdir` whose name
index 23ca5b636815b0ae8512de888a10f3bd1a25947f..ce7b492c51af158de887e36a92efb09feacb8a6e 100644 (file)
@@ -335,7 +335,7 @@ fn each_in_scope_loan_affecting_path<F>(&self,
         return true;
     }
 
-    pub fn loans_generated_by(&self, scope: region::CodeExtent) -> Vec<uint> {
+    pub fn loans_generated_by(&self, scope: region::CodeExtent) -> Vec<usize> {
         //! Returns a vector of the loans that are generated as
         //! we enter `scope`.
 
@@ -727,7 +727,7 @@ fn check_if_path_is_moved(&self,
     /// let a: int;
     /// a = 10; // ok, even though a is uninitialized
     ///
-    /// struct Point { x: uint, y: uint }
+    /// struct Point { x: usize, y: usize }
     /// let p: Point;
     /// p.x = 22; // ok, even though `p` is uninitialized
     ///
@@ -943,13 +943,20 @@ fn check_for_aliasability_violation<'a, 'tcx>(this: &CheckLoanCtxt<'a, 'tcx>,
                                                       cmt: mc::cmt<'tcx>)
                                                       -> bool {
             match cmt.freely_aliasable(this.tcx()) {
-                None => {
+                mc::Aliasability::NonAliasable => {
                     return true;
                 }
-                Some(mc::AliasableStaticMut(..)) => {
+                mc::Aliasability::FreelyAliasable(mc::AliasableStaticMut(..)) => {
                     return true;
                 }
-                Some(cause) => {
+                mc::Aliasability::ImmutableUnique(_) => {
+                    this.bccx.report_aliasability_violation(
+                        span,
+                        MutabilityViolation,
+                        mc::AliasableReason::UnaliasableImmutable);
+                    return false;
+                }
+                mc::Aliasability::FreelyAliasable(cause) => {
                     this.bccx.report_aliasability_violation(
                         span,
                         MutabilityViolation,
index f3abcb4376c9851b9997a350f3733cb5fd276516..a13d1d1112a84ff923f936fe66c1274e7c78e05e 100644 (file)
 use self::Fragment::*;
 
 use borrowck::InteriorKind::{InteriorField, InteriorElement};
-use borrowck::{LoanPath};
+use borrowck::LoanPath;
 use borrowck::LoanPathKind::{LpVar, LpUpvar, LpDowncast, LpExtend};
 use borrowck::LoanPathElem::{LpDeref, LpInterior};
-use borrowck::move_data::{InvalidMovePathIndex};
+use borrowck::move_data::InvalidMovePathIndex;
 use borrowck::move_data::{MoveData, MovePathIndex};
 use rustc::middle::ty;
 use rustc::middle::mem_categorization as mc;
index 7d77eb23b6ed01c5f961e1aed739e48c92b2f5c1..733d486d2d22d3ae495b10f2ddc233b423a1de4a 100644 (file)
@@ -22,7 +22,7 @@
 use rustc::middle::mem_categorization as mc;
 use rustc::middle::region;
 use rustc::middle::ty;
-use rustc::util::ppaux::{Repr};
+use rustc::util::ppaux::Repr;
 use syntax::ast;
 use syntax::codemap::Span;
 use syntax::visit;
@@ -151,10 +151,11 @@ fn mutate(&mut self,
               assignee_cmt: mc::cmt<'tcx>,
               mode: euv::MutateMode)
     {
-        debug!("mutate(assignment_id={}, assignee_cmt={})",
-               assignment_id, assignee_cmt.repr(self.tcx()));
+        let opt_lp = opt_loan_path(&assignee_cmt);
+        debug!("mutate(assignment_id={}, assignee_cmt={}) opt_lp={:?}",
+               assignment_id, assignee_cmt.repr(self.tcx()), opt_lp);
 
-        match opt_loan_path(&assignee_cmt) {
+        match opt_lp {
             Some(lp) => {
                 gather_moves::gather_assignment(self.bccx, &self.move_data,
                                                 assignment_id, assignment_span,
@@ -181,12 +182,16 @@ fn check_aliasability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                                 req_kind: ty::BorrowKind)
                                 -> Result<(),()> {
 
-    match (cmt.freely_aliasable(bccx.tcx), req_kind) {
-        (None, _) => {
+    let aliasability = cmt.freely_aliasable(bccx.tcx);
+    debug!("check_aliasability aliasability={:?} req_kind={:?}",
+           aliasability, req_kind);
+
+    match (aliasability, req_kind) {
+        (mc::Aliasability::NonAliasable, _) => {
             /* Uniquely accessible path -- OK for `&` and `&mut` */
             Ok(())
         }
-        (Some(mc::AliasableStatic(safety)), ty::ImmBorrow) => {
+        (mc::Aliasability::FreelyAliasable(mc::AliasableStatic(safety)), ty::ImmBorrow) => {
             // Borrow of an immutable static item:
             match safety {
                 mc::InteriorUnsafe => {
@@ -202,13 +207,20 @@ fn check_aliasability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                 }
             }
         }
-        (Some(mc::AliasableStaticMut(..)), _) => {
+        (mc::Aliasability::FreelyAliasable(mc::AliasableStaticMut(..)), _) => {
             // Even touching a static mut is considered unsafe. We assume the
             // user knows what they're doing in these cases.
             Ok(())
         }
-        (Some(alias_cause), ty::UniqueImmBorrow) |
-        (Some(alias_cause), ty::MutBorrow) => {
+        (mc::Aliasability::ImmutableUnique(_), ty::MutBorrow) => {
+            bccx.report_aliasability_violation(
+                        borrow_span,
+                        BorrowViolation(loan_cause),
+                        mc::AliasableReason::UnaliasableImmutable);
+            Err(())
+        }
+        (mc::Aliasability::FreelyAliasable(alias_cause), ty::UniqueImmBorrow) |
+        (mc::Aliasability::FreelyAliasable(alias_cause), ty::MutBorrow) => {
             bccx.report_aliasability_violation(
                         borrow_span,
                         BorrowViolation(loan_cause),
@@ -376,7 +388,8 @@ fn check_mutability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                                       req_kind: ty::BorrowKind)
                                       -> Result<(),()> {
             //! Implements the M-* rules in README.md.
-
+            debug!("check_mutability(cause={:?} cmt={} req_kind={:?}",
+                   cause, cmt.repr(bccx.tcx), req_kind);
             match req_kind {
                 ty::UniqueImmBorrow | ty::ImmBorrow => {
                     match cmt.mutbl {
index b176d8d4118a394cf2186a27c976d9c8ce0d6e99..268e469b7f91580b0e5a0773baea799e5e27f19e 100644 (file)
@@ -88,7 +88,7 @@ pub fn check_crate(tcx: &ty::ctxt) {
                  make_stat(&bccx, bccx.stats.stable_paths));
     }
 
-    fn make_stat(bccx: &BorrowckCtxt, stat: uint) -> String {
+    fn make_stat(bccx: &BorrowckCtxt, stat: usize) -> String {
         let total = bccx.stats.guaranteed_paths as f64;
         let perc = if total == 0.0 { 0.0 } else { stat as f64 * 100.0 / total };
         format!("{} ({:.0}%)", stat, perc)
@@ -238,10 +238,10 @@ pub struct BorrowckCtxt<'a, 'tcx: 'a> {
 }
 
 struct BorrowStats {
-    loaned_paths_same: uint,
-    loaned_paths_imm: uint,
-    stable_paths: uint,
-    guaranteed_paths: uint
+    loaned_paths_same: usize,
+    loaned_paths_imm: usize,
+    stable_paths: usize,
+    guaranteed_paths: usize
 }
 
 pub type BckResult<'tcx, T> = Result<T, BckError<'tcx>>;
@@ -251,7 +251,7 @@ struct BorrowStats {
 
 /// Record of a loan that was issued.
 pub struct Loan<'tcx> {
-    index: uint,
+    index: usize,
     loan_path: Rc<LoanPath<'tcx>>,
     kind: ty::BorrowKind,
     restricted_paths: Vec<Rc<LoanPath<'tcx>>>,
@@ -382,7 +382,7 @@ fn has_fork(&self, other: &LoanPath<'tcx>) -> bool {
         }
     }
 
-    fn depth(&self) -> uint {
+    fn depth(&self) -> usize {
         match self.kind {
             LpExtend(ref base, _, LpDeref(_)) => base.depth(),
             LpExtend(ref base, _, LpInterior(_)) => base.depth() + 1,
@@ -844,6 +844,12 @@ pub fn report_aliasability_violation(&self,
                     &format!("{} in an aliasable location",
                              prefix));
             }
+            mc::AliasableReason::UnaliasableImmutable => {
+                self.tcx.sess.span_err(
+                    span,
+                    &format!("{} in an immutable container",
+                             prefix));
+            }
             mc::AliasableClosure(id) => {
                 self.tcx.sess.span_err(span,
                                        &format!("{} in a captured outer \
@@ -1043,7 +1049,7 @@ fn is_statement_scope(tcx: &ty::ctxt, region: ty::Region) -> bool {
 
 impl BitwiseOperator for LoanDataFlowOperator {
     #[inline]
-    fn join(&self, succ: uint, pred: uint) -> uint {
+    fn join(&self, succ: usize, pred: usize) -> usize {
         succ | pred // loans from both preds are in scope
     }
 }
index 2834fce5278c85ab7b3caf36f3de0a47425e6a30..a4470acbe4d20dc8f043943759a32982c7a4ba6b 100644 (file)
@@ -76,10 +76,10 @@ pub struct FlowedMoveData<'a, 'tcx: 'a> {
 
 /// Index into `MoveData.paths`, used like a pointer
 #[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
-pub struct MovePathIndex(uint);
+pub struct MovePathIndex(usize);
 
 impl MovePathIndex {
-    fn get(&self) -> uint {
+    fn get(&self) -> usize {
         let MovePathIndex(v) = *self; v
     }
 }
@@ -95,10 +95,10 @@ fn clone(&self) -> MovePathIndex {
 
 /// Index into `MoveData.moves`, used like a pointer
 #[derive(Copy, PartialEq)]
-pub struct MoveIndex(uint);
+pub struct MoveIndex(usize);
 
 impl MoveIndex {
-    fn get(&self) -> uint {
+    fn get(&self) -> usize {
         let MoveIndex(v) = *self; v
     }
 }
@@ -740,7 +740,7 @@ pub fn each_assignment_of<F>(&self,
 
 impl BitwiseOperator for MoveDataFlowOperator {
     #[inline]
-    fn join(&self, succ: uint, pred: uint) -> uint {
+    fn join(&self, succ: usize, pred: usize) -> usize {
         succ | pred // moves from both preds are in scope
     }
 }
@@ -754,7 +754,7 @@ fn initial_value(&self) -> bool {
 
 impl BitwiseOperator for AssignDataFlowOperator {
     #[inline]
-    fn join(&self, succ: uint, pred: uint) -> uint {
+    fn join(&self, succ: usize, pred: usize) -> usize {
         succ | pred // moves from both preds are in scope
     }
 }
index a2c9930c0ed2fdc36f4469af01af05eb292f4c28..fb8afa83d864d5dfc9f10a449945019284d06c81 100644 (file)
@@ -20,7 +20,7 @@
 use borrowck;
 use borrowck::{BorrowckCtxt, LoanPath};
 use dot;
-use rustc::middle::cfg::{CFGIndex};
+use rustc::middle::cfg::CFGIndex;
 use rustc::middle::dataflow::{DataFlowOperator, DataFlowContext, EntryOrExit};
 use rustc::middle::dataflow;
 use std::rc::Rc;
@@ -79,7 +79,7 @@ fn build_set<O:DataFlowOperator, F>(&self,
                                         cfgidx: CFGIndex,
                                         dfcx: &DataFlowContext<'a, 'tcx, O>,
                                         mut to_lp: F) -> String where
-        F: FnMut(uint) -> Rc<LoanPath<'tcx>>,
+        F: FnMut(usize) -> Rc<LoanPath<'tcx>>,
     {
         let mut saw_some = false;
         let mut set = "{".to_string();
index e927ea5b86cdd27bc3416ced57069c96bf3b5e22..54feed930a80d7b9766d1e54bade1090abcf5da6 100644 (file)
@@ -21,8 +21,6 @@
 
 #![allow(non_camel_case_types)]
 
-#![feature(core)]
-#![feature(int_uint)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
@@ -35,7 +33,7 @@
 
 // for "clarity", rename the graphviz crate to dot; graphviz within `borrowck`
 // refers to the borrowck-specific graphviz adapter traits.
-extern crate "graphviz" as dot;
+extern crate graphviz as dot;
 extern crate rustc;
 
 pub use borrowck::check_crate;
index 4c654cbf27de05fd5bfecd79ba31d0b91a3a857e..fe05b489229ad6841feadab13d0009193d0fcd7f 100644 (file)
@@ -39,7 +39,7 @@
 use syntax::ast;
 use syntax::ast_map;
 use syntax::attr;
-use syntax::attr::{AttrMetaMethods};
+use syntax::attr::AttrMetaMethods;
 use syntax::diagnostics;
 use syntax::parse;
 use syntax::parse::token;
@@ -501,8 +501,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
         let features =
             syntax::feature_gate::check_crate(sess.codemap(),
                                               &sess.parse_sess.span_diagnostic,
-                                              &krate,
-                                              true);
+                                              &krate);
         *sess.features.borrow_mut() = features;
         sess.abort_if_errors();
     });
@@ -532,8 +531,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
         let features =
             syntax::feature_gate::check_crate(sess.codemap(),
                                               &sess.parse_sess.span_diagnostic,
-                                              &krate,
-                                              false);
+                                              &krate);
         *sess.features.borrow_mut() = features;
         sess.abort_if_errors();
     });
index 5e6f2fb835bb2a01787ebf36f027bcf5e1a4ed58..456d5f7a60ab7bec88aa167507125b6da085e801 100644 (file)
@@ -28,7 +28,6 @@
 #![feature(box_syntax)]
 #![feature(collections)]
 #![feature(core)]
-#![feature(int_uint)]
 #![feature(libc)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
@@ -55,7 +54,7 @@
 extern crate rustc_trans;
 extern crate rustc_typeck;
 extern crate serialize;
-extern crate "rustc_llvm" as llvm;
+extern crate rustc_llvm as llvm;
 #[macro_use] extern crate log;
 #[macro_use] extern crate syntax;
 
     "https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports";
 
 
-pub fn run(args: Vec<String>) -> int {
+pub fn run(args: Vec<String>) -> isize {
     monitor(move || run_compiler(&args, &mut RustcDefaultCalls));
     0
 }
@@ -795,7 +794,7 @@ fn parse_crate_attrs(sess: &Session, input: &Input) ->
 /// errors of the compiler.
 #[allow(deprecated)]
 pub fn monitor<F:FnOnce()+Send+'static>(f: F) {
-    const STACK_SIZE: uint = 8 * 1024 * 1024; // 8MB
+    const STACK_SIZE: usize = 8 * 1024 * 1024; // 8MB
 
     struct Sink(Arc<Mutex<Vec<u8>>>);
     impl Write for Sink {
index 23f07c8e25c1145126c61554503a2e269110d82f..fcb0b9bdd3cfb05db2e0d6fefd0e54ae999227e3 100644 (file)
@@ -88,13 +88,13 @@ fn custom_emit(&mut self,
     }
 }
 
-fn errors(msgs: &[&str]) -> (Box<Emitter+Send>, uint) {
+fn errors(msgs: &[&str]) -> (Box<Emitter+Send>, usize) {
     let v = msgs.iter().map(|m| m.to_string()).collect();
     (box ExpectErrorEmitter { messages: v } as Box<Emitter+Send>, msgs.len())
 }
 
 fn test_env<F>(source_string: &str,
-               (emitter, expected_err_count): (Box<Emitter+Send>, uint),
+               (emitter, expected_err_count): (Box<Emitter+Send>, usize),
                body: F) where
     F: FnOnce(Env),
 {
@@ -178,7 +178,7 @@ pub fn lookup_item(&self, names: &[String]) -> ast::NodeId {
 
         fn search_mod(this: &Env,
                       m: &ast::Mod,
-                      idx: uint,
+                      idx: usize,
                       names: &[String])
                       -> Option<ast::NodeId> {
             assert!(idx < names.len());
@@ -192,7 +192,7 @@ fn search_mod(this: &Env,
 
         fn search(this: &Env,
                   it: &ast::Item,
-                  idx: uint,
+                  idx: usize,
                   names: &[String])
                   -> Option<ast::NodeId> {
             if idx == names.len() {
@@ -300,14 +300,14 @@ pub fn re_late_bound_with_debruijn(&self, id: u32, debruijn: ty::DebruijnIndex)
     pub fn t_rptr(&self, r: ty::Region) -> Ty<'tcx> {
         ty::mk_imm_rptr(self.infcx.tcx,
                         self.infcx.tcx.mk_region(r),
-                        self.tcx().types.int)
+                        self.tcx().types.isize)
     }
 
     pub fn t_rptr_late_bound(&self, id: u32) -> Ty<'tcx> {
         let r = self.re_late_bound_with_debruijn(id, ty::DebruijnIndex::new(1));
         ty::mk_imm_rptr(self.infcx.tcx,
                         self.infcx.tcx.mk_region(r),
-                        self.tcx().types.int)
+                        self.tcx().types.isize)
     }
 
     pub fn t_rptr_late_bound_with_debruijn(&self,
@@ -317,13 +317,13 @@ pub fn t_rptr_late_bound_with_debruijn(&self,
         let r = self.re_late_bound_with_debruijn(id, debruijn);
         ty::mk_imm_rptr(self.infcx.tcx,
                         self.infcx.tcx.mk_region(r),
-                        self.tcx().types.int)
+                        self.tcx().types.isize)
     }
 
     pub fn t_rptr_scope(&self, id: ast::NodeId) -> Ty<'tcx> {
         let r = ty::ReScope(CodeExtent::from_node_id(id));
         ty::mk_imm_rptr(self.infcx.tcx, self.infcx.tcx.mk_region(r),
-                        self.tcx().types.int)
+                        self.tcx().types.isize)
     }
 
     pub fn re_free(&self, nid: ast::NodeId, id: u32) -> ty::Region {
@@ -335,13 +335,13 @@ pub fn t_rptr_free(&self, nid: ast::NodeId, id: u32) -> Ty<'tcx> {
         let r = self.re_free(nid, id);
         ty::mk_imm_rptr(self.infcx.tcx,
                         self.infcx.tcx.mk_region(r),
-                        self.tcx().types.int)
+                        self.tcx().types.isize)
     }
 
     pub fn t_rptr_static(&self) -> Ty<'tcx> {
         ty::mk_imm_rptr(self.infcx.tcx,
                         self.infcx.tcx.mk_region(ty::ReStatic),
-                        self.tcx().types.int)
+                        self.tcx().types.isize)
     }
 
     pub fn dummy_type_trace(&self) -> infer::TypeTrace<'tcx> {
@@ -464,15 +464,15 @@ fn contravariant_region_ptr_err() {
 fn sub_free_bound_false() {
     //! Test that:
     //!
-    //!     fn(&'a int) <: for<'b> fn(&'b int)
+    //!     fn(&'a isize) <: for<'b> fn(&'b isize)
     //!
     //! does NOT hold.
 
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_free1 = env.t_rptr_free(0, 1);
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
-        env.check_not_sub(env.t_fn(&[t_rptr_free1], env.tcx().types.int),
-                          env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        env.check_not_sub(env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
+                          env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
     })
 }
 
@@ -480,15 +480,15 @@ fn sub_free_bound_false() {
 fn sub_bound_free_true() {
     //! Test that:
     //!
-    //!     for<'a> fn(&'a int) <: fn(&'b int)
+    //!     for<'a> fn(&'a isize) <: fn(&'b isize)
     //!
     //! DOES hold.
 
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_free1 = env.t_rptr_free(0, 1);
-        env.check_sub(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free1], env.tcx().types.int));
+        env.check_sub(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free1], env.tcx().types.isize));
     })
 }
 
@@ -496,15 +496,15 @@ fn sub_bound_free_true() {
 fn sub_free_bound_false_infer() {
     //! Test that:
     //!
-    //!     fn(_#1) <: for<'b> fn(&'b int)
+    //!     fn(_#1) <: for<'b> fn(&'b isize)
     //!
     //! does NOT hold for any instantiation of `_#1`.
 
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_infer1 = env.infcx.next_ty_var();
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
-        env.check_not_sub(env.t_fn(&[t_infer1], env.tcx().types.int),
-                          env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        env.check_not_sub(env.t_fn(&[t_infer1], env.tcx().types.isize),
+                          env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
     })
 }
 
@@ -512,19 +512,19 @@ fn sub_free_bound_false_infer() {
 fn lub_free_bound_infer() {
     //! Test result of:
     //!
-    //!     LUB(fn(_#1), for<'b> fn(&'b int))
+    //!     LUB(fn(_#1), for<'b> fn(&'b isize))
     //!
-    //! This should yield `fn(&'_ int)`. We check
-    //! that it yields `fn(&'x int)` for some free `'x`,
+    //! This should yield `fn(&'_ isize)`. We check
+    //! that it yields `fn(&'x isize)` for some free `'x`,
     //! anyhow.
 
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_infer1 = env.infcx.next_ty_var();
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_free1 = env.t_rptr_free(0, 1);
-        env.check_lub(env.t_fn(&[t_infer1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free1], env.tcx().types.int));
+        env.check_lub(env.t_fn(&[t_infer1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free1], env.tcx().types.isize));
     });
 }
 
@@ -533,9 +533,9 @@ fn lub_bound_bound() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_bound2 = env.t_rptr_late_bound(2);
-        env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound2], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound2], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
     })
 }
 
@@ -544,9 +544,9 @@ fn lub_bound_free() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_free1 = env.t_rptr_free(0, 1);
-        env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free1], env.tcx().types.int));
+        env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free1], env.tcx().types.isize));
     })
 }
 
@@ -555,9 +555,9 @@ fn lub_bound_static() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_static = env.t_rptr_static();
-        env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_static], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_static], env.tcx().types.int));
+        env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_static], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_static], env.tcx().types.isize));
     })
 }
 
@@ -578,9 +578,9 @@ fn lub_free_free() {
         let t_rptr_free1 = env.t_rptr_free(0, 1);
         let t_rptr_free2 = env.t_rptr_free(0, 2);
         let t_rptr_static = env.t_rptr_static();
-        env.check_lub(env.t_fn(&[t_rptr_free1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free2], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_static], env.tcx().types.int));
+        env.check_lub(env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free2], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_static], env.tcx().types.isize));
     })
 }
 
@@ -603,9 +603,9 @@ fn glb_free_free_with_common_scope() {
         let t_rptr_free1 = env.t_rptr_free(0, 1);
         let t_rptr_free2 = env.t_rptr_free(0, 2);
         let t_rptr_scope = env.t_rptr_scope(0);
-        env.check_glb(env.t_fn(&[t_rptr_free1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free2], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_scope], env.tcx().types.int));
+        env.check_glb(env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free2], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_scope], env.tcx().types.isize));
     })
 }
 
@@ -614,9 +614,9 @@ fn glb_bound_bound() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_bound2 = env.t_rptr_late_bound(2);
-        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound2], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound2], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
     })
 }
 
@@ -625,9 +625,9 @@ fn glb_bound_free() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_free1 = env.t_rptr_free(0, 1);
-        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_free1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
     })
 }
 
@@ -637,14 +637,14 @@ fn glb_bound_free_infer() {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_infer1 = env.infcx.next_ty_var();
 
-        // compute GLB(fn(_) -> int, for<'b> fn(&'b int) -> int),
-        // which should yield for<'b> fn(&'b int) -> int
-        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_infer1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        // compute GLB(fn(_) -> isize, for<'b> fn(&'b isize) -> isize),
+        // which should yield for<'b> fn(&'b isize) -> isize
+        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_infer1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
 
         // as a side-effect, computing GLB should unify `_` with
-        // `&'_ int`
+        // `&'_ isize`
         let t_resolve1 = env.infcx.shallow_resolve(t_infer1);
         match t_resolve1.sty {
             ty::ty_rptr(..) => { }
@@ -658,9 +658,9 @@ fn glb_bound_static() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
         let t_rptr_static = env.t_rptr_static();
-        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_static], env.tcx().types.int),
-                      env.t_fn(&[t_rptr_bound1], env.tcx().types.int));
+        env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_static], env.tcx().types.isize),
+                      env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
     })
 }
 
@@ -684,7 +684,7 @@ fn subst_ty_renumber_bound() {
         let substs = subst::Substs::new_type(vec![t_rptr_bound1], vec![]);
         let t_substituted = t_source.subst(env.infcx.tcx, &substs);
 
-        // t_expected = fn(&'a int)
+        // t_expected = fn(&'a isize)
         let t_expected = {
             let t_ptr_bound2 = env.t_rptr_late_bound_with_debruijn(1, ty::DebruijnIndex::new(2));
             env.t_fn(&[t_ptr_bound2], env.t_nil())
@@ -719,7 +719,7 @@ fn subst_ty_renumber_some_bounds() {
         let substs = subst::Substs::new_type(vec![t_rptr_bound1], vec![]);
         let t_substituted = t_source.subst(env.infcx.tcx, &substs);
 
-        // t_expected = (&'a int, fn(&'a int))
+        // t_expected = (&'a isize, fn(&'a isize))
         //
         // but not that the Debruijn index is different in the different cases.
         let t_expected = {
@@ -771,7 +771,7 @@ fn subst_region_renumber_region() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let re_bound1 = env.re_late_bound_with_debruijn(1, ty::DebruijnIndex::new(1));
 
-        // type t_source<'a> = fn(&'a int)
+        // type t_source<'a> = fn(&'a isize)
         let t_source = {
             let re_early = env.re_early_bound(subst::TypeSpace, 0, "'a");
             env.t_fn(&[env.t_rptr(re_early)], env.t_nil())
@@ -780,7 +780,7 @@ fn subst_region_renumber_region() {
         let substs = subst::Substs::new_type(vec![], vec![re_bound1]);
         let t_substituted = t_source.subst(env.infcx.tcx, &substs);
 
-        // t_expected = fn(&'a int)
+        // t_expected = fn(&'a isize)
         //
         // but not that the Debruijn index is different in the different cases.
         let t_expected = {
@@ -802,8 +802,8 @@ fn subst_region_renumber_region() {
 fn walk_ty() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let tcx = env.infcx.tcx;
-        let int_ty = tcx.types.int;
-        let uint_ty = tcx.types.uint;
+        let int_ty = tcx.types.isize;
+        let uint_ty = tcx.types.usize;
         let tup1_ty = ty::mk_tup(tcx, vec!(int_ty, uint_ty, int_ty, uint_ty));
         let tup2_ty = ty::mk_tup(tcx, vec!(tup1_ty, tup1_ty, uint_ty));
         let uniq_ty = ty::mk_uniq(tcx, tup2_ty);
@@ -821,8 +821,8 @@ fn walk_ty() {
 fn walk_ty_skip_subtree() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let tcx = env.infcx.tcx;
-        let int_ty = tcx.types.int;
-        let uint_ty = tcx.types.uint;
+        let int_ty = tcx.types.isize;
+        let uint_ty = tcx.types.usize;
         let tup1_ty = ty::mk_tup(tcx, vec!(int_ty, uint_ty, int_ty, uint_ty));
         let tup2_ty = ty::mk_tup(tcx, vec!(tup1_ty, tup1_ty, uint_ty));
         let uniq_ty = ty::mk_uniq(tcx, tup2_ty);
@@ -836,7 +836,7 @@ fn walk_ty_skip_subtree() {
                                 (uint_ty, false),
                                 (int_ty, false),
                                 (uint_ty, false),
-                                (tup1_ty, true), // skip the int/uint/int/uint
+                                (tup1_ty, true), // skip the isize/usize/isize/usize
                                 (uint_ty, false));
         expected.reverse();
 
index 8b57a48f3ce728355e345cb4b3415009ab00e885..e7443af3013aeff4519b5eae2585187b7257782f 100644 (file)
 use middle::{def, pat_util, stability};
 use middle::const_eval::{eval_const_expr_partial, const_int, const_uint};
 use middle::cfg;
-use util::ppaux::{ty_to_string};
+use util::ppaux::ty_to_string;
 use util::nodemap::{FnvHashMap, NodeSet};
 use lint::{Level, Context, LintPass, LintArray, Lint};
 
-use std::collections::BitSet;
+use std::collections::{HashSet, BitSet};
 use std::collections::hash_map::Entry::{Occupied, Vacant};
-use std::num::SignedInt;
 use std::{cmp, slice};
 use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
 
@@ -180,7 +179,7 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
                             if let ast::LitInt(shift, _) = lit.node { shift >= bits }
                             else { false }
                         } else {
-                            match eval_const_expr_partial(cx.tcx, &**r, Some(cx.tcx.types.uint)) {
+                            match eval_const_expr_partial(cx.tcx, &**r, Some(cx.tcx.types.usize)) {
                                 Ok(const_int(shift)) => { shift as u64 >= bits },
                                 Ok(const_uint(shift)) => { shift >= bits },
                                 _ => { false }
@@ -199,7 +198,7 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
                         match lit.node {
                             ast::LitInt(v, ast::SignedIntLit(_, ast::Plus)) |
                             ast::LitInt(v, ast::UnsuffixedIntLit(ast::Plus)) => {
-                                let int_type = if let ast::TyIs(_) = t {
+                                let int_type = if let ast::TyIs = t {
                                     cx.sess().target.int_type
                                 } else {
                                     t
@@ -218,7 +217,7 @@ fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
                         };
                     },
                     ty::ty_uint(t) => {
-                        let uint_type = if let ast::TyUs(_) = t {
+                        let uint_type = if let ast::TyUs = t {
                             cx.sess().target.uint_type
                         } else {
                             t
@@ -283,7 +282,7 @@ fn rev_binop(binop: ast::BinOp) -> ast::BinOp {
         // warnings are consistent between 32- and 64-bit platforms
         fn int_ty_range(int_ty: ast::IntTy) -> (i64, i64) {
             match int_ty {
-                ast::TyIs(_) => (i64::MIN,        i64::MAX),
+                ast::TyIs => (i64::MIN,        i64::MAX),
                 ast::TyI8 =>    (i8::MIN  as i64, i8::MAX  as i64),
                 ast::TyI16 =>   (i16::MIN as i64, i16::MAX as i64),
                 ast::TyI32 =>   (i32::MIN as i64, i32::MAX as i64),
@@ -293,7 +292,7 @@ fn int_ty_range(int_ty: ast::IntTy) -> (i64, i64) {
 
         fn uint_ty_range(uint_ty: ast::UintTy) -> (u64, u64) {
             match uint_ty {
-                ast::TyUs(_) => (u64::MIN,         u64::MAX),
+                ast::TyUs => (u64::MIN,         u64::MAX),
                 ast::TyU8 =>    (u8::MIN   as u64, u8::MAX   as u64),
                 ast::TyU16 =>   (u16::MIN  as u64, u16::MAX  as u64),
                 ast::TyU32 =>   (u32::MIN  as u64, u32::MAX  as u64),
@@ -310,7 +309,7 @@ fn float_ty_range(float_ty: ast::FloatTy) -> (f64, f64) {
 
         fn int_ty_bits(int_ty: ast::IntTy, target_int_ty: ast::IntTy) -> u64 {
             match int_ty {
-                ast::TyIs(_) => int_ty_bits(target_int_ty, target_int_ty),
+                ast::TyIs => int_ty_bits(target_int_ty, target_int_ty),
                 ast::TyI8 =>    i8::BITS  as u64,
                 ast::TyI16 =>   i16::BITS as u64,
                 ast::TyI32 =>   i32::BITS as u64,
@@ -320,7 +319,7 @@ fn int_ty_bits(int_ty: ast::IntTy, target_int_ty: ast::IntTy) -> u64 {
 
         fn uint_ty_bits(uint_ty: ast::UintTy, target_uint_ty: ast::UintTy) -> u64 {
             match uint_ty {
-                ast::TyUs(_) => uint_ty_bits(target_uint_ty, target_uint_ty),
+                ast::TyUs => uint_ty_bits(target_uint_ty, target_uint_ty),
                 ast::TyU8 =>    u8::BITS  as u64,
                 ast::TyU16 =>   u16::BITS as u64,
                 ast::TyU32 =>   u32::BITS as u64,
@@ -395,12 +394,12 @@ struct ImproperCTypesVisitor<'a, 'tcx: 'a> {
 impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
     fn check_def(&mut self, sp: Span, id: ast::NodeId) {
         match self.cx.tcx.def_map.borrow().get(&id).unwrap().full_def() {
-            def::DefPrimTy(ast::TyInt(ast::TyIs(_))) => {
+            def::DefPrimTy(ast::TyInt(ast::TyIs)) => {
                 self.cx.span_lint(IMPROPER_CTYPES, sp,
                                   "found rust type `isize` in foreign module, while \
                                    libc::c_int or libc::c_long should be used");
             }
-            def::DefPrimTy(ast::TyUint(ast::TyUs(_))) => {
+            def::DefPrimTy(ast::TyUint(ast::TyUs)) => {
                 self.cx.span_lint(IMPROPER_CTYPES, sp,
                                   "found rust type `usize` in foreign module, while \
                                    libc::c_uint or libc::c_ulong should be used");
@@ -1437,6 +1436,9 @@ pub struct MissingDoc {
     /// Stack of whether #[doc(hidden)] is set
     /// at each level which has lint attributes.
     doc_hidden_stack: Vec<bool>,
+
+    /// Private traits or trait items that leaked through. Don't check their methods.
+    private_traits: HashSet<ast::NodeId>,
 }
 
 impl MissingDoc {
@@ -1445,6 +1447,7 @@ pub fn new() -> MissingDoc {
             struct_def_stack: vec!(),
             in_variant: false,
             doc_hidden_stack: vec!(false),
+            private_traits: HashSet::new(),
         }
     }
 
@@ -1531,18 +1534,46 @@ fn check_item(&mut self, cx: &Context, it: &ast::Item) {
             ast::ItemMod(..) => "a module",
             ast::ItemEnum(..) => "an enum",
             ast::ItemStruct(..) => "a struct",
-            ast::ItemTrait(..) => "a trait",
+            ast::ItemTrait(_, _, _, ref items) => {
+                // Issue #11592, traits are always considered exported, even when private.
+                if it.vis == ast::Visibility::Inherited {
+                    self.private_traits.insert(it.id);
+                    for itm in items {
+                        self.private_traits.insert(itm.id);
+                    }
+                    return
+                }
+                "a trait"
+            },
             ast::ItemTy(..) => "a type alias",
+            ast::ItemImpl(_, _, _, Some(ref trait_ref), _, ref impl_items) => {
+                // If the trait is private, add the impl items to private_traits so they don't get
+                // reported for missing docs.
+                let real_trait = ty::trait_ref_to_def_id(cx.tcx, trait_ref);
+                match cx.tcx.map.find(real_trait.node) {
+                    Some(ast_map::NodeItem(item)) => if item.vis == ast::Visibility::Inherited {
+                        for itm in impl_items {
+                            self.private_traits.insert(itm.id);
+                        }
+                    },
+                    _ => { }
+                }
+                return
+            },
             _ => return
         };
+
         self.check_missing_docs_attrs(cx, Some(it.id), &it.attrs, it.span, desc);
     }
 
     fn check_trait_item(&mut self, cx: &Context, trait_item: &ast::TraitItem) {
+        if self.private_traits.contains(&trait_item.id) { return }
+
         let desc = match trait_item.node {
             ast::MethodTraitItem(..) => "a trait method",
             ast::TypeTraitItem(..) => "an associated type"
         };
+
         self.check_missing_docs_attrs(cx, Some(trait_item.id),
                                       &trait_item.attrs,
                                       trait_item.span, desc);
index e158541cd1cfffe8471fc3a9662070de078949c1..34f7436d0cd5d8d7cc5ccc9be4e2b88664b1183e 100644 (file)
@@ -34,7 +34,6 @@
 #![feature(box_syntax)]
 #![feature(collections)]
 #![feature(core)]
-#![feature(int_uint)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
index 0728d5b46e2c37f3d538db738ca1b70772b6f9cc..cc6a85e86ce077646aa5ee75b4c0c0cb0899cd94 100644 (file)
@@ -61,7 +61,7 @@ pub fn read<'a>(&'a self, file: &str) -> Option<&'a [u8]> {
             if ptr.is_null() {
                 None
             } else {
-                Some(slice::from_raw_parts(ptr as *const u8, size as uint))
+                Some(slice::from_raw_parts(ptr as *const u8, size as usize))
             }
         }
     }
index 9d564fa56f54d88391f62a02fbe7690870f38d93..c7b5b2e75346f9d2f77b31d24fe276eae5332e4c 100644 (file)
@@ -15,7 +15,6 @@
 #![allow(non_snake_case)]
 #![allow(dead_code)]
 #![allow(trivial_casts)]
-#![allow(trivial_numeric_casts)]
 
 #![crate_name = "rustc_llvm"]
 #![unstable(feature = "rustc_private")]
@@ -28,7 +27,6 @@
 
 #![feature(box_syntax)]
 #![feature(collections)]
-#![feature(int_uint)]
 #![feature(libc)]
 #![feature(link_args)]
 #![feature(staged_api)]
@@ -77,7 +75,7 @@
 pub const True: Bool = 1 as Bool;
 pub const False: Bool = 0 as Bool;
 
-// Consts for the LLVM CallConv type, pre-cast to uint.
+// Consts for the LLVM CallConv type, pre-cast to usize.
 
 #[derive(Copy, PartialEq)]
 pub enum CallConv {
@@ -242,7 +240,7 @@ fn apply_callsite(&self, idx: c_uint, callsite: ValueRef) {
 }
 
 pub struct AttrBuilder {
-    attrs: Vec<(uint, Box<AttrHelper+'static>)>
+    attrs: Vec<(usize, Box<AttrHelper+'static>)>
 }
 
 impl AttrBuilder {
@@ -252,13 +250,13 @@ pub fn new() -> AttrBuilder {
         }
     }
 
-    pub fn arg<'a, T: AttrHelper + 'static>(&'a mut self, idx: uint, a: T) -> &'a mut AttrBuilder {
+    pub fn arg<'a, T: AttrHelper + 'static>(&'a mut self, idx: usize, a: T) -> &'a mut AttrBuilder {
         self.attrs.push((idx, box a as Box<AttrHelper+'static>));
         self
     }
 
     pub fn ret<'a, T: AttrHelper + 'static>(&'a mut self, a: T) -> &'a mut AttrBuilder {
-        self.attrs.push((ReturnIndex as uint, box a as Box<AttrHelper+'static>));
+        self.attrs.push((ReturnIndex as usize, box a as Box<AttrHelper+'static>));
         self
     }
 
@@ -693,7 +691,7 @@ pub fn LLVMConstICmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
                          -> ValueRef;
     pub fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef)
                          -> ValueRef;
-    /* only for int/vector */
+    /* only for isize/vector */
     pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
     pub fn LLVMIsConstant(Val: ValueRef) -> Bool;
     pub fn LLVMIsNull(Val: ValueRef) -> Bool;
@@ -2167,7 +2165,7 @@ impl ObjectFile {
     pub fn new(llmb: MemoryBufferRef) -> Option<ObjectFile> {
         unsafe {
             let llof = LLVMCreateObjectFile(llmb);
-            if llof as int == 0 {
+            if llof as isize == 0 {
                 // LLVMCreateObjectFile took ownership of llmb
                 return None
             }
@@ -2227,7 +2225,7 @@ pub enum RustString_opaque {}
 pub unsafe extern "C" fn rust_llvm_string_write_impl(sr: RustStringRef,
                                                      ptr: *const c_char,
                                                      size: size_t) {
-    let slice = slice::from_raw_parts(ptr as *const u8, size as uint);
+    let slice = slice::from_raw_parts(ptr as *const u8, size as usize);
 
     let sr: RustStringRepr = mem::transmute(sr);
     (*sr).borrow_mut().push_all(slice);
index 2e7fe91365a13475dabf5e99106be2e2b82421dd..44ab09628137112f028fd9d0bb2b360d10b4b2d7 100644 (file)
@@ -19,7 +19,6 @@
       html_favicon_url = "http://www.rust-lang.org/favicon.ico",
       html_root_url = "http://doc.rust-lang.org/nightly/")]
 
-#![feature(int_uint)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
@@ -43,7 +42,7 @@
 use rustc::middle::ty::{MethodTypeParam, MethodStatic};
 use rustc::middle::ty::{MethodCall, MethodMap, MethodOrigin, MethodParam};
 use rustc::middle::ty::{MethodStaticClosure, MethodObject};
-use rustc::middle::ty::{MethodTraitObject};
+use rustc::middle::ty::MethodTraitObject;
 use rustc::middle::ty::{self, Ty};
 use rustc::util::nodemap::{NodeMap, NodeSet};
 
@@ -378,7 +377,7 @@ enum PrivacyResult {
 }
 
 enum FieldName {
-    UnnamedField(uint), // index
+    UnnamedField(usize), // index
     // (Name, not Ident, because struct fields are not macro-hygienic)
     NamedField(ast::Name),
 }
index e62300098f678bb6d26d8d80b2a2c8f06a40b5b7..5bff5479e2ea3ac82a77872f8aa5e7b681a2e9f4 100644 (file)
@@ -47,7 +47,7 @@
 use syntax::ast::TupleVariantKind;
 use syntax::ast::UnnamedField;
 use syntax::ast::{Variant, ViewPathGlob, ViewPathList, ViewPathSimple};
-use syntax::ast::{Visibility};
+use syntax::ast::Visibility;
 use syntax::ast;
 use syntax::ast_util::local_def;
 use syntax::attr::AttrMetaMethods;
index 5bf561c218d044365f88de58687a99b0a078a6ac..ff635a6c46b22a34c6d4e2f913bad68e46f7d793 100644 (file)
@@ -21,8 +21,6 @@
 
 #![feature(alloc)]
 #![feature(collections)]
-#![feature(core)]
-#![feature(int_uint)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
@@ -77,7 +75,7 @@
 use syntax::ast::{TyF64, TyFloat, TyIs, TyI8, TyI16, TyI32, TyI64, TyInt};
 use syntax::ast::{TyPath, TyPtr};
 use syntax::ast::{TyRptr, TyStr, TyUs, TyU8, TyU16, TyU32, TyU64, TyUint};
-use syntax::ast::{TypeImplItem};
+use syntax::ast::TypeImplItem;
 use syntax::ast;
 use syntax::ast_map;
 use syntax::ast_util::{local_def, walk_pat};
@@ -326,7 +324,7 @@ enum UseLexicalScopeFlag {
 
 enum ModulePrefixResult {
     NoPrefixFound,
-    PrefixFound(Rc<Module>, uint)
+    PrefixFound(Rc<Module>, usize)
 }
 
 #[derive(Copy, PartialEq)]
@@ -414,10 +412,10 @@ pub struct Module {
     import_resolutions: RefCell<HashMap<Name, ImportResolution>>,
 
     // The number of unresolved globs that this module exports.
-    glob_count: Cell<uint>,
+    glob_count: Cell<usize>,
 
     // The index of the import we're resolving.
-    resolved_import_count: Cell<uint>,
+    resolved_import_count: Cell<usize>,
 
     // Whether this module is populated. If not populated, any attempt to
     // access the children must be preceded with a
@@ -743,15 +741,13 @@ fn new() -> PrimitiveTypeTable {
         table.intern("char",    TyChar);
         table.intern("f32",     TyFloat(TyF32));
         table.intern("f64",     TyFloat(TyF64));
-        table.intern("int",     TyInt(TyIs(true)));
-        table.intern("isize",   TyInt(TyIs(false)));
+        table.intern("isize",   TyInt(TyIs));
         table.intern("i8",      TyInt(TyI8));
         table.intern("i16",     TyInt(TyI16));
         table.intern("i32",     TyInt(TyI32));
         table.intern("i64",     TyInt(TyI64));
         table.intern("str",     TyStr);
-        table.intern("uint",    TyUint(TyUs(true)));
-        table.intern("usize",   TyUint(TyUs(false)));
+        table.intern("usize",   TyUint(TyUs));
         table.intern("u8",      TyUint(TyU8));
         table.intern("u16",     TyUint(TyU16));
         table.intern("u32",     TyUint(TyU32));
@@ -778,7 +774,7 @@ pub struct Resolver<'a, 'tcx:'a> {
     structs: FnvHashMap<DefId, Vec<Name>>,
 
     // The number of imports that are currently unresolved.
-    unresolved_imports: uint,
+    unresolved_imports: usize,
 
     // The module that represents the current item scope.
     current_module: Rc<Module>,
@@ -960,7 +956,7 @@ fn check_for_conflicts_between_external_crates_and_items(&self,
     fn resolve_module_path_from_root(&mut self,
                                      module_: Rc<Module>,
                                      module_path: &[Name],
-                                     index: uint,
+                                     index: usize,
                                      span: Span,
                                      name_search_type: NameSearchType,
                                      lp: LastPrivate)
@@ -3054,12 +3050,12 @@ fn is_static_method(this: &Resolver, did: DefId) -> bool {
         NoSuggestion
     }
 
-    fn find_best_match_for_name(&mut self, name: &str, max_distance: uint)
+    fn find_best_match_for_name(&mut self, name: &str, max_distance: usize)
                                 -> Option<String> {
         let this = &mut *self;
 
         let mut maybes: Vec<token::InternedString> = Vec::new();
-        let mut values: Vec<uint> = Vec::new();
+        let mut values: Vec<usize> = Vec::new();
 
         for rib in this.value_ribs.iter().rev() {
             for (&k, _) in &rib.bindings {
index 662b5a366431ca785460742cc0775e2fb0ca6f42..44c803c77656d68e3704f4549e30d7ee99dbb306 100644 (file)
@@ -115,7 +115,7 @@ pub struct ImportResolution {
     // Note that this is usually either 0 or 1 - shadowing is forbidden the only
     // way outstanding_references is > 1 in a legal program is if the name is
     // used in both namespaces.
-    pub outstanding_references: uint,
+    pub outstanding_references: usize,
 
     /// The value that this `use` directive names, if there is one.
     pub value_target: Option<Target>,
index bb7880161d5d4e364b2ebc7701468e64d3820a77..ad777351898912f6608370e51c4c63c78e477309 100644 (file)
 pub const RLIB_BYTECODE_OBJECT_VERSION: u32 = 1;
 
 // The offset in bytes the bytecode object format version number can be found at
-pub const RLIB_BYTECODE_OBJECT_VERSION_OFFSET: uint = 11;
+pub const RLIB_BYTECODE_OBJECT_VERSION_OFFSET: usize = 11;
 
 // The offset in bytes the size of the compressed bytecode can be found at in
 // format version 1
-pub const RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET: uint =
+pub const RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET: usize =
     RLIB_BYTECODE_OBJECT_VERSION_OFFSET + 4;
 
 // The offset in bytes the compressed LLVM bytecode can be found at in format
 // version 1
-pub const RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET: uint =
+pub const RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET: usize =
     RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET + 8;
 
 
@@ -159,11 +159,19 @@ pub fn find_crate_name(sess: Option<&Session>,
     }
     if let Input::File(ref path) = *input {
         if let Some(s) = path.file_stem().and_then(|s| s.to_str()) {
-            return validate(s.to_string(), None);
+            if s.starts_with("-") {
+                let msg = format!("crate names cannot start with a `-`, but \
+                                   `{}` has a leading hyphen", s);
+                if let Some(sess) = sess {
+                    sess.err(&msg);
+                }
+            } else {
+                return validate(s.replace("-", "_"), None);
+            }
         }
     }
 
-    "rust-out".to_string()
+    "rust_out".to_string()
 }
 
 pub fn build_link_meta(sess: &Session, krate: &ast::Crate,
@@ -323,7 +331,7 @@ pub fn mangle_exported_name<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, path: PathEl
         "abcdefghijklmnopqrstuvwxyz\
          ABCDEFGHIJKLMNOPQRSTUVWXYZ\
          0123456789";
-    let id = id as uint;
+    let id = id as usize;
     let extra1 = id % EXTRA_CHARS.len();
     let id = id / EXTRA_CHARS.len();
     let extra2 = id % EXTRA_CHARS.len();
@@ -455,7 +463,11 @@ pub fn filename_for_input(sess: &Session,
         }
         config::CrateTypeExecutable => {
             let suffix = &sess.target.target.options.exe_suffix;
-            out_filename.with_file_name(&format!("{}{}", libname, suffix))
+            if suffix.len() == 0 {
+                out_filename.to_path_buf()
+            } else {
+                out_filename.with_extension(&suffix[1..])
+            }
         }
     }
 }
@@ -695,7 +707,7 @@ fn write_rlib_bytecode_object_v1(writer: &mut Write,
         RLIB_BYTECODE_OBJECT_MAGIC.len() +                // magic id
         mem::size_of_val(&RLIB_BYTECODE_OBJECT_VERSION) + // version
         mem::size_of_val(&bc_data_deflated_size) +        // data size field
-        bc_data_deflated_size as uint;                    // actual data
+        bc_data_deflated_size as usize;                    // actual data
 
     // If the number of bytes written to the object so far is odd, add a
     // padding byte to make it even. This works around a crash bug in LLDB
@@ -1154,7 +1166,7 @@ fn add_upstream_rust_crates(cmd: &mut Command, sess: &Session,
         // We may not pass all crates through to the linker. Some crates may
         // appear statically in an existing dylib, meaning we'll pick up all the
         // symbols from the dylib.
-        let kind = match data[cnum as uint - 1] {
+        let kind = match data[cnum as usize - 1] {
             Some(t) => t,
             None => continue
         };
index a3ab863c4eca475e026792ccb6ec0e1ff066cad6..4e099a4ca875e1b6873ad1aa59006b9ea1e58fb2 100644 (file)
@@ -22,6 +22,7 @@
 
 use std::ffi::CString;
 use std::mem;
+#[allow(deprecated)]
 use std::num::Int;
 
 pub fn run(sess: &session::Session, llmod: ModuleRef,
@@ -92,7 +93,7 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
                         let data_size = extract_compressed_bytecode_size_v1(bc_encoded);
                         let compressed_data = &bc_encoded[
                             link::RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET..
-                            (link::RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET + data_size as uint)];
+                            (link::RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET + data_size as usize)];
 
                         match flate::inflate_bytes(compressed_data) {
                             Ok(inflated) => inflated,
@@ -204,7 +205,8 @@ fn extract_compressed_bytecode_size_v1(bc: &[u8]) -> u64 {
     return read_from_le_bytes::<u64>(bc, link::RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET);
 }
 
-fn read_from_le_bytes<T: Int>(bytes: &[u8], position_in_bytes: uint) -> T {
+#[allow(deprecated)]
+fn read_from_le_bytes<T: Int>(bytes: &[u8], position_in_bytes: usize) -> T {
     let byte_data = &bytes[position_in_bytes..position_in_bytes + mem::size_of::<T>()];
     let data = unsafe {
         *(byte_data.as_ptr() as *const T)
index 156cfa6c4b23a852ebd6076da31617770f1b55a0..cc588a365f6e68c5ab2ca3d950f1787d5eee82e6 100644 (file)
@@ -898,7 +898,7 @@ fn run_work_singlethreaded(sess: &Session,
 
 fn run_work_multithreaded(sess: &Session,
                           work_items: Vec<WorkItem>,
-                          num_workers: uint) {
+                          num_workers: usize) {
     // Run some workers to process the work items.
     let work_items_arc = Arc::new(Mutex::new(work_items));
     let mut diag_emitter = SharedEmitter::new();
index 99a64156d667b96d89a3cef297d4500ed0f6c33c..a3ac0473bfa26c3b31b0fb751b48a4af5207a048 100644 (file)
@@ -30,7 +30,6 @@
 #![feature(box_syntax)]
 #![feature(collections)]
 #![feature(core)]
-#![feature(int_uint)]
 #![feature(libc)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
@@ -44,7 +43,6 @@
 #![feature(path_relative_from)]
 
 #![allow(trivial_casts)]
-#![allow(trivial_numeric_casts)]
 
 extern crate arena;
 extern crate flate;
@@ -54,7 +52,7 @@
 extern crate rustc;
 extern crate rustc_back;
 extern crate serialize;
-extern crate "rustc_llvm" as llvm;
+extern crate rustc_llvm as llvm;
 
 #[macro_use] extern crate log;
 #[macro_use] extern crate syntax;
index 327e5ab38822950ed2433a544687345e9fcc4e90..a415875d852cc8bb8a94ae4d0fba41156c674f75 100644 (file)
@@ -465,7 +465,7 @@ fn process_generic_params(&mut self,
         // However full span is the entire enum/fn/struct block, so we only want
         // the first few to match the number of generics we're looking for.
         let param_sub_spans = self.span.spans_for_ty_params(full_span,
-                                                           (generics.ty_params.len() as int));
+                                                           (generics.ty_params.len() as isize));
         for (param, param_ss) in generics.ty_params.iter().zip(param_sub_spans.iter()) {
             // Append $id to name to make sure each one is unique
             let name = format!("{}::{}${}",
index 8de046fa6ebb6c8486604be025597ffd6684a976..84a7678959d3efdcb792489e81aff6e98f913441 100644 (file)
@@ -24,7 +24,7 @@
 #[derive(Clone)]
 pub struct SpanUtils<'a> {
     pub sess: &'a Session,
-    pub err_count: Cell<int>,
+    pub err_count: Cell<isize>,
 }
 
 impl<'a> SpanUtils<'a> {
@@ -232,7 +232,7 @@ pub fn sub_span_for_type_name(&self, span: Span) -> Option<Span> {
     // example with Foo<Bar<T,V>, Bar<T,V>>
     // Nesting = 0: all idents outside of brackets: ~[Foo]
     // Nesting = 1: idents within one level of brackets: ~[Bar, Bar]
-    pub fn spans_with_brackets(&self, span: Span, nesting: int, limit: int) -> Vec<Span> {
+    pub fn spans_with_brackets(&self, span: Span, nesting: isize, limit: isize) -> Vec<Span> {
         let mut result: Vec<Span> = vec!();
 
         let mut toks = self.retokenise_span(span);
@@ -250,7 +250,7 @@ pub fn spans_with_brackets(&self, span: Span, nesting: int, limit: int) -> Vec<S
                 }
                 return result
             }
-            if (result.len() as int) == limit {
+            if (result.len() as isize) == limit {
                 return result;
             }
             bracket_count += match ts.tok {
@@ -347,7 +347,7 @@ pub fn spans_for_path_segments(&self, path: &ast::Path) -> Vec<Span> {
 
     // Return an owned vector of the subspans of the param identifier
     // tokens found in span.
-    pub fn spans_for_ty_params(&self, span: Span, number: int) -> Vec<Span> {
+    pub fn spans_for_ty_params(&self, span: Span, number: isize) -> Vec<Span> {
         if generated_code(span) {
             return vec!();
         }
index c48b63cdcb6c4bccc640fff215ce3a650a90c720..ea8197d0c407e57a841e85f32488e072b8c2cf67 100644 (file)
@@ -28,7 +28,7 @@
 //! constituent pattern.  N here is usually the number of arms but may be
 //! greater, if some arms have multiple alternatives.  For example, here:
 //!
-//!     enum Foo { A, B(int), C(uint, uint) }
+//!     enum Foo { A, B(int), C(usize, usize) }
 //!     match foo {
 //!         A => ...,
 //!         B(x) => ...,
@@ -246,9 +246,9 @@ enum Opt<'a, 'tcx> {
     ConstantValue(ConstantExpr<'a>, DebugLoc),
     ConstantRange(ConstantExpr<'a>, ConstantExpr<'a>, DebugLoc),
     Variant(ty::Disr, Rc<adt::Repr<'tcx>>, ast::DefId, DebugLoc),
-    SliceLengthEqual(uint, DebugLoc),
-    SliceLengthGreaterOrEqual(/* prefix length */ uint,
-                              /* suffix length */ uint,
+    SliceLengthEqual(usize, DebugLoc),
+    SliceLengthGreaterOrEqual(/* prefix length */ usize,
+                              /* suffix length */ usize,
                               DebugLoc),
 }
 
@@ -381,7 +381,7 @@ fn repr(&self, tcx: &ty::ctxt) -> String {
     }
 }
 
-fn has_nested_bindings(m: &[Match], col: uint) -> bool {
+fn has_nested_bindings(m: &[Match], col: usize) -> bool {
     for br in m {
         match br.pats[col].node {
             ast::PatIdent(_, _, Some(_)) => return true,
@@ -393,7 +393,7 @@ fn has_nested_bindings(m: &[Match], col: uint) -> bool {
 
 fn expand_nested_bindings<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                               m: &[Match<'a, 'p, 'blk, 'tcx>],
-                                              col: uint,
+                                              col: usize,
                                               val: ValueRef)
                                               -> Vec<Match<'a, 'p, 'blk, 'tcx>> {
     debug!("expand_nested_bindings(bcx={}, m={}, col={}, val={})",
@@ -430,7 +430,7 @@ fn expand_nested_bindings<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 fn enter_match<'a, 'b, 'p, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
                                           dm: &DefMap,
                                           m: &[Match<'a, 'p, 'blk, 'tcx>],
-                                          col: uint,
+                                          col: usize,
                                           val: ValueRef,
                                           mut e: F)
                                           -> Vec<Match<'a, 'p, 'blk, 'tcx>> where
@@ -476,7 +476,7 @@ fn enter_match<'a, 'b, 'p, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
 fn enter_default<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                      dm: &DefMap,
                                      m: &[Match<'a, 'p, 'blk, 'tcx>],
-                                     col: uint,
+                                     col: usize,
                                      val: ValueRef)
                                      -> Vec<Match<'a, 'p, 'blk, 'tcx>> {
     debug!("enter_default(bcx={}, m={}, col={}, val={})",
@@ -532,8 +532,8 @@ fn enter_opt<'a, 'p, 'blk, 'tcx>(
              dm: &DefMap,
              m: &[Match<'a, 'p, 'blk, 'tcx>],
              opt: &Opt,
-             col: uint,
-             variant_size: uint,
+             col: usize,
+             variant_size: usize,
              val: ValueRef)
              -> Vec<Match<'a, 'p, 'blk, 'tcx>> {
     debug!("enter_opt(bcx={}, m={}, opt={:?}, col={}, val={})",
@@ -575,7 +575,7 @@ fn enter_opt<'a, 'p, 'blk, 'tcx>(
 // on a set of enum variants or a literal.
 fn get_branches<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                     m: &[Match<'a, 'p, 'blk, 'tcx>],
-                                    col: uint)
+                                    col: usize)
                                     -> Vec<Opt<'p, 'tcx>> {
     let tcx = bcx.tcx();
 
@@ -656,8 +656,8 @@ fn match_datum<'tcx>(val: ValueRef, left_ty: Ty<'tcx>) -> Datum<'tcx, Lvalue> {
 fn bind_subslice_pat(bcx: Block,
                      pat_id: ast::NodeId,
                      val: ValueRef,
-                     offset_left: uint,
-                     offset_right: uint) -> ValueRef {
+                     offset_left: usize,
+                     offset_right: usize) -> ValueRef {
     let _icx = push_ctxt("match::bind_subslice_pat");
     let vec_ty = node_id_type(bcx, pat_id);
     let unit_ty = ty::sequence_element_type(bcx.tcx(), ty::type_content(vec_ty));
@@ -679,8 +679,8 @@ fn bind_subslice_pat(bcx: Block,
 
 fn extract_vec_elems<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                  left_ty: Ty<'tcx>,
-                                 before: uint,
-                                 after: uint,
+                                 before: usize,
+                                 after: usize,
                                  val: ValueRef)
                                  -> ExtractedBlock<'blk, 'tcx> {
     let _icx = push_ctxt("match::extract_vec_elems");
@@ -711,15 +711,15 @@ macro_rules! any_pat {
     )
 }
 
-fn any_uniq_pat(m: &[Match], col: uint) -> bool {
+fn any_uniq_pat(m: &[Match], col: usize) -> bool {
     any_pat!(m, col, ast::PatBox(_))
 }
 
-fn any_region_pat(m: &[Match], col: uint) -> bool {
+fn any_region_pat(m: &[Match], col: usize) -> bool {
     any_pat!(m, col, ast::PatRegion(..))
 }
 
-fn any_irrefutable_adt_pat(tcx: &ty::ctxt, m: &[Match], col: uint) -> bool {
+fn any_irrefutable_adt_pat(tcx: &ty::ctxt, m: &[Match], col: usize) -> bool {
     m.iter().any(|br| {
         let pat = br.pats[col];
         match pat.node {
@@ -772,8 +772,8 @@ fn handle_fail(&self, bcx: Block) {
     }
 }
 
-fn pick_column_to_specialize(def_map: &DefMap, m: &[Match]) -> Option<uint> {
-    fn pat_score(def_map: &DefMap, pat: &ast::Pat) -> uint {
+fn pick_column_to_specialize(def_map: &DefMap, m: &[Match]) -> Option<usize> {
+    fn pat_score(def_map: &DefMap, pat: &ast::Pat) -> usize {
         match pat.node {
             ast::PatIdent(_, _, Some(ref inner)) => pat_score(def_map, &**inner),
             _ if pat_is_refutable(def_map, pat) => 1,
@@ -781,7 +781,7 @@ fn pat_score(def_map: &DefMap, pat: &ast::Pat) -> uint {
         }
     }
 
-    let column_score = |m: &[Match], col: uint| -> uint {
+    let column_score = |m: &[Match], col: usize| -> usize {
         let total_score = m.iter()
             .map(|row| row.pats[col])
             .map(|pat| pat_score(def_map, pat))
@@ -795,7 +795,7 @@ fn pat_score(def_map: &DefMap, pat: &ast::Pat) -> uint {
         }
     };
 
-    let column_contains_any_nonwild_patterns = |&col: &uint| -> bool {
+    let column_contains_any_nonwild_patterns = |&col: &usize| -> bool {
         m.iter().any(|row| match row.pats[col].node {
             ast::PatWild(_) => false,
             _ => true
@@ -1047,7 +1047,7 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
                                                  m: &[Match<'a, 'p, 'blk, 'tcx>],
                                                  vals: &[ValueRef],
                                                  chk: &FailureHandler,
-                                                 col: uint,
+                                                 col: usize,
                                                  val: ValueRef,
                                                  has_genuine_default: bool) {
     let fcx = bcx.fcx;
@@ -1187,7 +1187,7 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
                     let t = if kind == Compare {
                         left_ty
                     } else {
-                        tcx.types.uint // vector length
+                        tcx.types.usize // vector length
                     };
                     let Result { bcx: after_cx, val: matches } = {
                         match opt.trans(bcx) {
@@ -1528,7 +1528,7 @@ fn create_dummy_locals<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
             let scope = cleanup::var_scope(tcx, p_id);
             bcx = mk_binding_alloca(
                 bcx, p_id, &path1.node, scope, (),
-                |(), bcx, llval, ty| { zero_mem(bcx, llval, ty); bcx });
+                |(), bcx, llval, ty| { drop_done_fill_mem(bcx, llval, ty); bcx });
         });
         bcx
     }
index 61214f65c87ea2d60951f044df44de9944aa97d3..e32d8e2b9cfdf8a7924442365489a2fb75598cd5 100644 (file)
@@ -45,6 +45,7 @@
 
 pub use self::Repr::*;
 
+#[allow(deprecated)]
 use std::num::Int;
 use std::rc::Rc;
 
@@ -81,14 +82,18 @@ pub enum Repr<'tcx> {
     /// Structs with destructors need a dynamic destroyedness flag to
     /// avoid running the destructor too many times; this is included
     /// in the `Struct` if present.
-    Univariant(Struct<'tcx>, bool),
+    /// (The flag if nonzero, represents the initialization value to use;
+    ///  if zero, then use no flag at all.)
+    Univariant(Struct<'tcx>, u8),
     /// General-case enums: for each case there is a struct, and they
     /// all start with a field for the discriminant.
     ///
     /// Types with destructors need a dynamic destroyedness flag to
     /// avoid running the destructor too many times; the last argument
     /// indicates whether such a flag is present.
-    General(IntType, Vec<Struct<'tcx>>, bool),
+    /// (The flag, if nonzero, represents the initialization value to use;
+    ///  if zero, then use no flag at all.)
+    General(IntType, Vec<Struct<'tcx>>, u8),
     /// Two cases distinguished by a nullable pointer: the case with discriminant
     /// `nndiscr` must have single field which is known to be nonnull due to its type.
     /// The other case is known to be zero sized. Hence we represent the enum
@@ -151,11 +156,59 @@ pub fn represent_type<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
     repr
 }
 
+macro_rules! repeat_u8_as_u32 {
+    ($name:expr) => { (($name as u32) << 24 |
+                       ($name as u32) << 16 |
+                       ($name as u32) <<  8 |
+                       ($name as u32)) }
+}
+macro_rules! repeat_u8_as_u64 {
+    ($name:expr) => { ((repeat_u8_as_u32!($name) as u64) << 32 |
+                       (repeat_u8_as_u32!($name) as u64)) }
+}
+
+pub const DTOR_NEEDED: u8 = 0xd4;
+pub const DTOR_NEEDED_U32: u32 = repeat_u8_as_u32!(DTOR_NEEDED);
+pub const DTOR_NEEDED_U64: u64 = repeat_u8_as_u64!(DTOR_NEEDED);
+#[allow(dead_code)]
+pub fn dtor_needed_usize(ccx: &CrateContext) -> usize {
+    match &ccx.tcx().sess.target.target.target_pointer_width[..] {
+        "32" => DTOR_NEEDED_U32 as usize,
+        "64" => DTOR_NEEDED_U64 as usize,
+        tws => panic!("Unsupported target word size for int: {}", tws),
+    }
+}
+
+pub const DTOR_DONE: u8 = 0x1d;
+pub const DTOR_DONE_U32: u32 = repeat_u8_as_u32!(DTOR_DONE);
+pub const DTOR_DONE_U64: u64 = repeat_u8_as_u64!(DTOR_DONE);
+#[allow(dead_code)]
+pub fn dtor_done_usize(ccx: &CrateContext) -> usize {
+    match &ccx.tcx().sess.target.target.target_pointer_width[..] {
+        "32" => DTOR_DONE_U32 as usize,
+        "64" => DTOR_DONE_U64 as usize,
+        tws => panic!("Unsupported target word size for int: {}", tws),
+    }
+}
+
+fn dtor_to_init_u8(dtor: bool) -> u8 {
+    if dtor { DTOR_NEEDED } else { 0 }
+}
+
+pub trait GetDtorType<'tcx> { fn dtor_type(&self) -> Ty<'tcx>; }
+impl<'tcx> GetDtorType<'tcx> for ty::ctxt<'tcx> {
+    fn dtor_type(&self) -> Ty<'tcx> { self.types.u8 }
+}
+
+fn dtor_active(flag: u8) -> bool {
+    flag != 0
+}
+
 fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                      t: Ty<'tcx>) -> Repr<'tcx> {
     match t.sty {
         ty::ty_tup(ref elems) => {
-            Univariant(mk_struct(cx, &elems[..], false, t), false)
+            Univariant(mk_struct(cx, &elems[..], false, t), 0)
         }
         ty::ty_struct(def_id, substs) => {
             let fields = ty::lookup_struct_fields(cx.tcx(), def_id);
@@ -165,15 +218,15 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             }).collect::<Vec<_>>();
             let packed = ty::lookup_packed(cx.tcx(), def_id);
             let dtor = ty::ty_dtor(cx.tcx(), def_id).has_drop_flag();
-            if dtor { ftys.push(cx.tcx().types.bool); }
+            if dtor { ftys.push(cx.tcx().dtor_type()); }
 
-            Univariant(mk_struct(cx, &ftys[..], packed, t), dtor)
+            Univariant(mk_struct(cx, &ftys[..], packed, t), dtor_to_init_u8(dtor))
         }
         ty::ty_closure(def_id, substs) => {
             let typer = NormalizingClosureTyper::new(cx.tcx());
             let upvars = typer.closure_upvars(def_id, substs).unwrap();
             let upvar_types = upvars.iter().map(|u| u.ty).collect::<Vec<_>>();
-            Univariant(mk_struct(cx, &upvar_types[..], false, t), false)
+            Univariant(mk_struct(cx, &upvar_types[..], false, t), 0)
         }
         ty::ty_enum(def_id, substs) => {
             let cases = get_cases(cx.tcx(), def_id, substs);
@@ -186,9 +239,9 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                 // Uninhabitable; represent as unit
                 // (Typechecking will reject discriminant-sizing attrs.)
                 assert_eq!(hint, attr::ReprAny);
-                let ftys = if dtor { vec!(cx.tcx().types.bool) } else { vec!() };
+                let ftys = if dtor { vec!(cx.tcx().dtor_type()) } else { vec!() };
                 return Univariant(mk_struct(cx, &ftys[..], false, t),
-                                  dtor);
+                                  dtor_to_init_u8(dtor));
             }
 
             if !dtor && cases.iter().all(|c| c.tys.len() == 0) {
@@ -218,9 +271,9 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                 // (Typechecking will reject discriminant-sizing attrs.)
                 assert_eq!(hint, attr::ReprAny);
                 let mut ftys = cases[0].tys.clone();
-                if dtor { ftys.push(cx.tcx().types.bool); }
+                if dtor { ftys.push(cx.tcx().dtor_type()); }
                 return Univariant(mk_struct(cx, &ftys[..], false, t),
-                                  dtor);
+                                  dtor_to_init_u8(dtor));
             }
 
             if !dtor && cases.len() == 2 && hint == attr::ReprAny {
@@ -266,7 +319,7 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             let fields : Vec<_> = cases.iter().map(|c| {
                 let mut ftys = vec!(ty_of_inttype(cx.tcx(), min_ity));
                 ftys.push_all(&c.tys);
-                if dtor { ftys.push(cx.tcx().types.bool); }
+                if dtor { ftys.push(cx.tcx().dtor_type()); }
                 mk_struct(cx, &ftys, false, t)
             }).collect();
 
@@ -319,13 +372,13 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             let fields : Vec<_> = cases.iter().map(|c| {
                 let mut ftys = vec!(ty_of_inttype(cx.tcx(), ity));
                 ftys.push_all(&c.tys);
-                if dtor { ftys.push(cx.tcx().types.bool); }
+                if dtor { ftys.push(cx.tcx().dtor_type()); }
                 mk_struct(cx, &ftys[..], false, t)
             }).collect();
 
             ensure_enum_fits_in_address_space(cx, &fields[..], t);
 
-            General(ity, fields, dtor)
+            General(ity, fields, dtor_to_init_u8(dtor))
         }
         _ => cx.sess().bug(&format!("adt::represent_type called on non-ADT type: {}",
                            ty_to_string(cx.tcx(), t)))
@@ -339,7 +392,7 @@ struct Case<'tcx> {
 }
 
 /// This represents the (GEP) indices to follow to get to the discriminant field
-pub type DiscrField = Vec<uint>;
+pub type DiscrField = Vec<usize>;
 
 fn find_discr_field_candidate<'tcx>(tcx: &ty::ctxt<'tcx>,
                                     ty: Ty<'tcx>,
@@ -776,7 +829,7 @@ fn load_discr(bcx: Block, ity: IntType, ptr: ValueRef, min: Disr, max: Disr)
     assert_eq!(val_ty(ptr), llty.ptr_to());
     let bits = machine::llbitsize_of_real(bcx.ccx(), llty);
     assert!(bits <= 64);
-    let  bits = bits as uint;
+    let  bits = bits as usize;
     let mask = (-1u64 >> (64 - bits)) as Disr;
     // For a (max) discr of -1, max will be `-1 as usize`, which overflows.
     // However, that is fine here (it would still represent the full range),
@@ -830,18 +883,18 @@ pub fn trans_set_discr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, r: &Repr<'tcx>,
                   val)
         }
         General(ity, ref cases, dtor) => {
-            if dtor {
+            if dtor_active(dtor) {
                 let ptr = trans_field_ptr(bcx, r, val, discr,
-                                          cases[discr as uint].fields.len() - 2);
-                Store(bcx, C_u8(bcx.ccx(), 1), ptr);
+                                          cases[discr as usize].fields.len() - 2);
+                Store(bcx, C_u8(bcx.ccx(), DTOR_NEEDED as usize), ptr);
             }
             Store(bcx, C_integral(ll_inttype(bcx.ccx(), ity), discr as u64, true),
                   GEPi(bcx, val, &[0, 0]))
         }
         Univariant(ref st, dtor) => {
             assert_eq!(discr, 0);
-            if dtor {
-                Store(bcx, C_u8(bcx.ccx(), 1),
+            if dtor_active(dtor) {
+                Store(bcx, C_u8(bcx.ccx(), DTOR_NEEDED as usize),
                     GEPi(bcx, val, &[0, st.fields.len() - 1]));
             }
         }
@@ -870,15 +923,15 @@ fn assert_discr_in_range(ity: IntType, min: Disr, max: Disr, discr: Disr) {
 
 /// The number of fields in a given case; for use when obtaining this
 /// information from the type or definition is less convenient.
-pub fn num_args(r: &Repr, discr: Disr) -> uint {
+pub fn num_args(r: &Repr, discr: Disr) -> usize {
     match *r {
         CEnum(..) => 0,
         Univariant(ref st, dtor) => {
             assert_eq!(discr, 0);
-            st.fields.len() - (if dtor { 1 } else { 0 })
+            st.fields.len() - (if dtor_active(dtor) { 1 } else { 0 })
         }
         General(_, ref cases, dtor) => {
-            cases[discr as uint].fields.len() - 1 - (if dtor { 1 } else { 0 })
+            cases[discr as usize].fields.len() - 1 - (if dtor_active(dtor) { 1 } else { 0 })
         }
         RawNullablePointer { nndiscr, ref nullfields, .. } => {
             if discr == nndiscr { 1 } else { nullfields.len() }
@@ -892,7 +945,7 @@ pub fn num_args(r: &Repr, discr: Disr) -> uint {
 
 /// Access a field, at a point when the value's case is known.
 pub fn trans_field_ptr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, r: &Repr<'tcx>,
-                                   val: ValueRef, discr: Disr, ix: uint) -> ValueRef {
+                                   val: ValueRef, discr: Disr, ix: usize) -> ValueRef {
     // Note: if this ever needs to generate conditionals (e.g., if we
     // decide to do some kind of cdr-coding-like non-unique repr
     // someday), it will need to return a possibly-new bcx as well.
@@ -905,7 +958,7 @@ pub fn trans_field_ptr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, r: &Repr<'tcx>,
             struct_field_ptr(bcx, st, val, ix, false)
         }
         General(_, ref cases, _) => {
-            struct_field_ptr(bcx, &cases[discr as uint], val, ix + 1, true)
+            struct_field_ptr(bcx, &cases[discr as usize], val, ix + 1, true)
         }
         RawNullablePointer { nndiscr, ref nullfields, .. } |
         StructWrappedNullablePointer { nndiscr, ref nullfields, .. } if discr != nndiscr => {
@@ -931,7 +984,7 @@ pub fn trans_field_ptr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, r: &Repr<'tcx>,
 }
 
 pub fn struct_field_ptr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, st: &Struct<'tcx>, val: ValueRef,
-                                    ix: uint, needs_cast: bool) -> ValueRef {
+                                    ix: usize, needs_cast: bool) -> ValueRef {
     let val = if needs_cast {
         let ccx = bcx.ccx();
         let fields = st.fields.iter().map(|&ty| type_of::type_of(ccx, ty)).collect::<Vec<_>>();
@@ -992,17 +1045,17 @@ pub fn trans_drop_flag_ptr<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, r: &Repr<'tcx
                                        -> datum::DatumBlock<'blk, 'tcx, datum::Expr>
 {
     let tcx = bcx.tcx();
-    let ptr_ty = ty::mk_imm_ptr(bcx.tcx(), tcx.types.bool);
+    let ptr_ty = ty::mk_imm_ptr(bcx.tcx(), tcx.dtor_type());
     match *r {
-        Univariant(ref st, true) => {
+        Univariant(ref st, dtor) if dtor_active(dtor) => {
             let flag_ptr = GEPi(bcx, val, &[0, st.fields.len() - 1]);
             datum::immediate_rvalue_bcx(bcx, flag_ptr, ptr_ty).to_expr_datumblock()
         }
-        General(_, _, true) => {
+        General(_, _, dtor) if dtor_active(dtor) => {
             let fcx = bcx.fcx;
             let custom_cleanup_scope = fcx.push_custom_cleanup_scope();
             let scratch = unpack_datum!(bcx, datum::lvalue_scratch_datum(
-                bcx, tcx.types.bool, "drop_flag",
+                bcx, tcx.dtor_type(), "drop_flag",
                 cleanup::CustomScope(custom_cleanup_scope), (), |_, bcx, _| bcx
             ));
             bcx = fold_variants(bcx, r, val, |variant_cx, st, value| {
@@ -1046,7 +1099,7 @@ pub fn trans_const<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, r: &Repr<'tcx>, discr
             C_integral(ll_inttype(ccx, ity), discr as u64, true)
         }
         General(ity, ref cases, _) => {
-            let case = &cases[discr as uint];
+            let case = &cases[discr as usize];
             let (max_sz, _) = union_size_and_align(&cases[..]);
             let lldiscr = C_integral(ll_inttype(ccx, ity), discr as u64, true);
             let mut f = vec![lldiscr];
@@ -1184,7 +1237,7 @@ pub fn const_get_discrim(ccx: &CrateContext, r: &Repr, val: ValueRef) -> Disr {
 /// (Not to be confused with `common::const_get_elt`, which operates on
 /// raw LLVM-level structs and arrays.)
 pub fn const_get_field(ccx: &CrateContext, r: &Repr, val: ValueRef,
-                       _discr: Disr, ix: uint) -> ValueRef {
+                       _discr: Disr, ix: usize) -> ValueRef {
     match *r {
         CEnum(..) => ccx.sess().bug("element access in C-like enum const"),
         Univariant(..) => const_struct_field(ccx, val, ix),
@@ -1198,7 +1251,7 @@ pub fn const_get_field(ccx: &CrateContext, r: &Repr, val: ValueRef,
 }
 
 /// Extract field of struct-like const, skipping our alignment padding.
-fn const_struct_field(ccx: &CrateContext, val: ValueRef, ix: uint) -> ValueRef {
+fn const_struct_field(ccx: &CrateContext, val: ValueRef, ix: usize) -> ValueRef {
     // Get the ix-th non-undef element of the struct.
     let mut real_ix = 0; // actual position in the struct
     let mut ix = ix; // logical index relative to real_ix
index 2f944e49b15161dc6d6243d9aebed4eb49fdb95f..61e332f87ad1a2683aeb65b8676b7e4cfc570509 100644 (file)
@@ -30,7 +30,7 @@
 use super::CrateTranslation;
 use super::ModuleTranslation;
 
-use back::link::{mangle_exported_name};
+use back::link::mangle_exported_name;
 use back::{link, abi};
 use lint;
 use llvm::{AttrHelper, BasicBlockRef, Linkage, ValueRef, Vector, get_param};
@@ -151,7 +151,7 @@ pub fn push_ctxt(s: &'static str) -> _InsnCtxt {
 pub struct StatRecorder<'a, 'tcx: 'a> {
     ccx: &'a CrateContext<'a, 'tcx>,
     name: Option<String>,
-    istart: uint,
+    istart: usize,
 }
 
 impl<'a, 'tcx> StatRecorder<'a, 'tcx> {
@@ -560,7 +560,7 @@ pub fn compare_scalar_types<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                 _ => bcx.sess().bug("compare_scalar_types: must be a comparison operator")
             }
         }
-        ty::ty_bool | ty::ty_uint(_) | ty::ty_char => {
+        ty::ty_bare_fn(..) | ty::ty_bool | ty::ty_uint(_) | ty::ty_char => {
             ICmp(bcx, bin_op_to_icmp_predicate(bcx.ccx(), op, false), lhs, rhs, debug_loc)
         }
         ty::ty_ptr(mt) if common::type_is_sized(bcx.tcx(), mt.ty) => {
@@ -707,7 +707,7 @@ fn iter_variant<'blk, 'tcx, F>(cx: Block<'blk, 'tcx>,
                                     substs, &mut f);
               }
               (_match::Switch, Some(lldiscrim_a)) => {
-                  cx = f(cx, lldiscrim_a, cx.tcx().types.int);
+                  cx = f(cx, lldiscrim_a, cx.tcx().types.isize);
                   let unr_cx = fcx.new_temp_block("enum-iter-unr");
                   Unreachable(unr_cx);
                   let llswitch = Switch(cx, lldiscrim_a, unr_cx.llbb,
@@ -847,8 +847,8 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>(
             ty::ty_int(t) => {
                 let llty = Type::int_from_ty(cx.ccx(), t);
                 let min = match t {
-                    ast::TyIs(_) if llty == Type::i32(cx.ccx()) => i32::MIN as u64,
-                    ast::TyIs(_) => i64::MIN as u64,
+                    ast::TyIs if llty == Type::i32(cx.ccx()) => i32::MIN as u64,
+                    ast::TyIs => i64::MIN as u64,
                     ast::TyI8 => i8::MIN as u64,
                     ast::TyI16 => i16::MIN as u64,
                     ast::TyI32 => i32::MIN as u64,
@@ -1146,20 +1146,27 @@ pub fn memcpy_ty<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     }
 }
 
-pub fn zero_mem<'blk, 'tcx>(cx: Block<'blk, 'tcx>, llptr: ValueRef, t: Ty<'tcx>) {
+pub fn drop_done_fill_mem<'blk, 'tcx>(cx: Block<'blk, 'tcx>, llptr: ValueRef, t: Ty<'tcx>) {
     if cx.unreachable.get() { return; }
-    let _icx = push_ctxt("zero_mem");
+    let _icx = push_ctxt("drop_done_fill_mem");
     let bcx = cx;
-    memzero(&B(bcx), llptr, t);
+    memfill(&B(bcx), llptr, t, adt::DTOR_DONE);
 }
 
-// Always use this function instead of storing a zero constant to the memory
-// in question. If you store a zero constant, LLVM will drown in vreg
+pub fn init_zero_mem<'blk, 'tcx>(cx: Block<'blk, 'tcx>, llptr: ValueRef, t: Ty<'tcx>) {
+    if cx.unreachable.get() { return; }
+    let _icx = push_ctxt("init_zero_mem");
+    let bcx = cx;
+    memfill(&B(bcx), llptr, t, 0);
+}
+
+// Always use this function instead of storing a constant byte to the memory
+// in question. e.g. if you store a zero constant, LLVM will drown in vreg
 // allocation for large data structures, and the generated code will be
 // awful. (A telltale sign of this is large quantities of
 // `mov [byte ptr foo],0` in the generated code.)
-fn memzero<'a, 'tcx>(b: &Builder<'a, 'tcx>, llptr: ValueRef, ty: Ty<'tcx>) {
-    let _icx = push_ctxt("memzero");
+fn memfill<'a, 'tcx>(b: &Builder<'a, 'tcx>, llptr: ValueRef, ty: Ty<'tcx>, byte: u8) {
+    let _icx = push_ctxt("memfill");
     let ccx = b.ccx;
 
     let llty = type_of::type_of(ccx, ty);
@@ -1172,7 +1179,7 @@ fn memzero<'a, 'tcx>(b: &Builder<'a, 'tcx>, llptr: ValueRef, ty: Ty<'tcx>) {
 
     let llintrinsicfn = ccx.get_intrinsic(&intrinsic_key);
     let llptr = b.pointercast(llptr, Type::i8(ccx).ptr_to());
-    let llzeroval = C_u8(ccx, 0);
+    let llzeroval = C_u8(ccx, byte as usize);
     let size = machine::llsize_of(ccx, llty);
     let align = C_i32(ccx, type_of::align_of(ccx, ty) as i32);
     let volatile = C_bool(ccx, false);
@@ -3022,6 +3029,12 @@ pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
         tcx.sess.opts.debug_assertions
     };
 
+    let check_dropflag = if let Some(v) = tcx.sess.opts.debugging_opts.force_dropflag_checks {
+        v
+    } else {
+        tcx.sess.opts.debug_assertions
+    };
+
     // Before we touch LLVM, make sure that multithreading is enabled.
     unsafe {
         use std::sync::{Once, ONCE_INIT};
@@ -3050,7 +3063,8 @@ pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
                                              Sha256::new(),
                                              link_meta.clone(),
                                              reachable,
-                                             check_overflow);
+                                             check_overflow,
+                                             check_dropflag);
 
     {
         let ccx = shared_ccx.get_ccx(0);
index f11c3154274e7f741bb824532795d2e4803c6080..a0aca17538fa9966269d8ed15ee10c6ccd65969b 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use llvm;
-use llvm::{BasicBlockRef};
+use llvm::BasicBlockRef;
 use trans::value::{Users, Value};
 use std::iter::{Filter, Map};
 
index 2fcfc5e43931d2770391bde8b4c03e92b6505954..a16c4d6c2c4a78f1e1bb42a1095df124622a7167 100644 (file)
@@ -105,7 +105,7 @@ pub fn CondBr(cx: Block,
     B(cx).cond_br(if_, then, else_);
 }
 
-pub fn Switch(cx: Block, v: ValueRef, else_: BasicBlockRef, num_cases: uint)
+pub fn Switch(cx: Block, v: ValueRef, else_: BasicBlockRef, num_cases: usize)
     -> ValueRef {
     if cx.unreachable.get() { return _Undef(v); }
     check_not_terminated(cx);
@@ -122,7 +122,7 @@ pub fn AddCase(s: ValueRef, on_val: ValueRef, dest: BasicBlockRef) {
 
 pub fn IndirectBr(cx: Block,
                   addr: ValueRef,
-                  num_dests: uint,
+                  num_dests: usize,
                   debug_loc: DebugLoc) {
     if cx.unreachable.get() {
         return;
@@ -673,7 +673,7 @@ pub fn GEP(cx: Block, pointer: ValueRef, indices: &[ValueRef]) -> ValueRef {
 // Simple wrapper around GEP that takes an array of ints and wraps them
 // in C_i32()
 #[inline]
-pub fn GEPi(cx: Block, base: ValueRef, ixs: &[uint]) -> ValueRef {
+pub fn GEPi(cx: Block, base: ValueRef, ixs: &[usize]) -> ValueRef {
     unsafe {
         if cx.unreachable.get() {
             return llvm::LLVMGetUndef(Type::nil(cx.ccx()).ptr_to().to_ref());
@@ -691,7 +691,7 @@ pub fn InBoundsGEP(cx: Block, pointer: ValueRef, indices: &[ValueRef]) -> ValueR
     }
 }
 
-pub fn StructGEP(cx: Block, pointer: ValueRef, idx: uint) -> ValueRef {
+pub fn StructGEP(cx: Block, pointer: ValueRef, idx: usize) -> ValueRef {
     unsafe {
         if cx.unreachable.get() {
             return llvm::LLVMGetUndef(Type::nil(cx.ccx()).ptr_to().to_ref());
@@ -1011,7 +1011,7 @@ pub fn ShuffleVector(cx: Block, v1: ValueRef, v2: ValueRef,
     }
 }
 
-pub fn VectorSplat(cx: Block, num_elts: uint, elt_val: ValueRef) -> ValueRef {
+pub fn VectorSplat(cx: Block, num_elts: usize, elt_val: ValueRef) -> ValueRef {
     unsafe {
         if cx.unreachable.get() {
             return llvm::LLVMGetUndef(Type::nil(cx.ccx()).to_ref());
@@ -1020,7 +1020,7 @@ pub fn VectorSplat(cx: Block, num_elts: uint, elt_val: ValueRef) -> ValueRef {
     }
 }
 
-pub fn ExtractValue(cx: Block, agg_val: ValueRef, index: uint) -> ValueRef {
+pub fn ExtractValue(cx: Block, agg_val: ValueRef, index: usize) -> ValueRef {
     unsafe {
         if cx.unreachable.get() {
             return llvm::LLVMGetUndef(Type::nil(cx.ccx()).to_ref());
@@ -1029,7 +1029,7 @@ pub fn ExtractValue(cx: Block, agg_val: ValueRef, index: uint) -> ValueRef {
     }
 }
 
-pub fn InsertValue(cx: Block, agg_val: ValueRef, elt_val: ValueRef, index: uint) -> ValueRef {
+pub fn InsertValue(cx: Block, agg_val: ValueRef, elt_val: ValueRef, index: usize) -> ValueRef {
     unsafe {
         if cx.unreachable.get() {
             return llvm::LLVMGetUndef(Type::nil(cx.ccx()).to_ref());
@@ -1070,7 +1070,7 @@ pub fn Trap(cx: Block) {
 }
 
 pub fn LandingPad(cx: Block, ty: Type, pers_fn: ValueRef,
-                  num_clauses: uint) -> ValueRef {
+                  num_clauses: usize) -> ValueRef {
     check_not_terminated(cx);
     assert!(!cx.unreachable.get());
     B(cx).landing_pad(ty, pers_fn, num_clauses)
index 8199e6189c93b495c926ac1d9715ee29b1ddb90f..92bc20bafcfbe59412f82290db5173b71a044e6c 100644 (file)
@@ -140,13 +140,13 @@ pub fn cond_br(&self, cond: ValueRef, then_llbb: BasicBlockRef, else_llbb: Basic
         }
     }
 
-    pub fn switch(&self, v: ValueRef, else_llbb: BasicBlockRef, num_cases: uint) -> ValueRef {
+    pub fn switch(&self, v: ValueRef, else_llbb: BasicBlockRef, num_cases: usize) -> ValueRef {
         unsafe {
             llvm::LLVMBuildSwitch(self.llbuilder, v, else_llbb, num_cases as c_uint)
         }
     }
 
-    pub fn indirect_br(&self, addr: ValueRef, num_dests: uint) {
+    pub fn indirect_br(&self, addr: ValueRef, num_dests: usize) {
         self.count_insn("indirectbr");
         unsafe {
             llvm::LLVMBuildIndirectBr(self.llbuilder, addr, num_dests as c_uint);
@@ -555,7 +555,7 @@ pub fn gep(&self, ptr: ValueRef, indices: &[ValueRef]) -> ValueRef {
     // Simple wrapper around GEP that takes an array of ints and wraps them
     // in C_i32()
     #[inline]
-    pub fn gepi(&self, base: ValueRef, ixs: &[uint]) -> ValueRef {
+    pub fn gepi(&self, base: ValueRef, ixs: &[usize]) -> ValueRef {
         // Small vector optimization. This should catch 100% of the cases that
         // we care about.
         if ixs.len() < 16 {
@@ -579,7 +579,7 @@ pub fn inbounds_gep(&self, ptr: ValueRef, indices: &[ValueRef]) -> ValueRef {
         }
     }
 
-    pub fn struct_gep(&self, ptr: ValueRef, idx: uint) -> ValueRef {
+    pub fn struct_gep(&self, ptr: ValueRef, idx: usize) -> ValueRef {
         self.count_insn("structgep");
         unsafe {
             llvm::LLVMBuildStructGEP(self.llbuilder, ptr, idx as c_uint, noname())
@@ -886,7 +886,7 @@ pub fn shuffle_vector(&self, v1: ValueRef, v2: ValueRef, mask: ValueRef) -> Valu
         }
     }
 
-    pub fn vector_splat(&self, num_elts: uint, elt: ValueRef) -> ValueRef {
+    pub fn vector_splat(&self, num_elts: usize, elt: ValueRef) -> ValueRef {
         unsafe {
             let elt_ty = val_ty(elt);
             let undef = llvm::LLVMGetUndef(Type::vector(&elt_ty, num_elts as u64).to_ref());
@@ -896,7 +896,7 @@ pub fn vector_splat(&self, num_elts: uint, elt: ValueRef) -> ValueRef {
         }
     }
 
-    pub fn extract_value(&self, agg_val: ValueRef, idx: uint) -> ValueRef {
+    pub fn extract_value(&self, agg_val: ValueRef, idx: usize) -> ValueRef {
         self.count_insn("extractvalue");
         unsafe {
             llvm::LLVMBuildExtractValue(self.llbuilder, agg_val, idx as c_uint, noname())
@@ -904,7 +904,7 @@ pub fn extract_value(&self, agg_val: ValueRef, idx: uint) -> ValueRef {
     }
 
     pub fn insert_value(&self, agg_val: ValueRef, elt: ValueRef,
-                       idx: uint) -> ValueRef {
+                       idx: usize) -> ValueRef {
         self.count_insn("insertvalue");
         unsafe {
             llvm::LLVMBuildInsertValue(self.llbuilder, agg_val, elt, idx as c_uint,
@@ -940,7 +940,7 @@ pub fn trap(&self) {
             let m: ModuleRef = llvm::LLVMGetGlobalParent(fn_);
             let p = "llvm.trap\0".as_ptr();
             let t: ValueRef = llvm::LLVMGetNamedFunction(m, p as *const _);
-            assert!((t as int != 0));
+            assert!((t as isize != 0));
             let args: &[ValueRef] = &[];
             self.count_insn("trap");
             llvm::LLVMBuildCall(
@@ -948,7 +948,7 @@ pub fn trap(&self) {
         }
     }
 
-    pub fn landing_pad(&self, ty: Type, pers_fn: ValueRef, num_clauses: uint) -> ValueRef {
+    pub fn landing_pad(&self, ty: Type, pers_fn: ValueRef, num_clauses: usize) -> ValueRef {
         self.count_insn("landingpad");
         unsafe {
             llvm::LLVMBuildLandingPad(
index 03496a966bf30e8d617652b6746b176a186f5162..8ac4f84d6ef9f9088db9e15af7ac05c49e36f148 100644 (file)
 
 use std::cmp;
 
-fn align_up_to(off: uint, a: uint) -> uint {
+fn align_up_to(off: usize, a: usize) -> usize {
     return (off + a - 1) / a * a;
 }
 
-fn align(off: uint, ty: Type) -> uint {
+fn align(off: usize, ty: Type) -> usize {
     let a = ty_align(ty);
     return align_up_to(off, a);
 }
 
-fn ty_align(ty: Type) -> uint {
+fn ty_align(ty: Type) -> usize {
     match ty.kind() {
-        Integer => ((ty.int_width() as uint) + 7) / 8,
+        Integer => ((ty.int_width() as usize) + 7) / 8,
         Pointer => 8,
         Float => 4,
         Double => 8,
@@ -54,9 +54,9 @@ fn ty_align(ty: Type) -> uint {
     }
 }
 
-fn ty_size(ty: Type) -> uint {
+fn ty_size(ty: Type) -> usize {
     match ty.kind() {
-        Integer => ((ty.int_width() as uint) + 7) / 8,
+        Integer => ((ty.int_width() as usize) + 7) / 8,
         Pointer => 8,
         Float => 4,
         Double => 8,
index 50014230df67b2f88a5207f42f9901d4d2f24739..941c065e3d5d43b9769ce8bc49bf44c60dd0bf64 100644 (file)
@@ -23,20 +23,20 @@ pub enum Flavor {
     Ios
 }
 
-type TyAlignFn = fn(ty: Type) -> uint;
+type TyAlignFn = fn(ty: Type) -> usize;
 
-fn align_up_to(off: uint, a: uint) -> uint {
+fn align_up_to(off: usize, a: usize) -> usize {
     return (off + a - 1) / a * a;
 }
 
-fn align(off: uint, ty: Type, align_fn: TyAlignFn) -> uint {
+fn align(off: usize, ty: Type, align_fn: TyAlignFn) -> usize {
     let a = align_fn(ty);
     return align_up_to(off, a);
 }
 
-fn general_ty_align(ty: Type) -> uint {
+fn general_ty_align(ty: Type) -> usize {
     match ty.kind() {
-        Integer => ((ty.int_width() as uint) + 7) / 8,
+        Integer => ((ty.int_width() as usize) + 7) / 8,
         Pointer => 4,
         Float => 4,
         Double => 8,
@@ -68,9 +68,9 @@ fn general_ty_align(ty: Type) -> uint {
 // ARMv6
 // https://developer.apple.com/library/ios/documentation/Xcode/Conceptual
 //    /iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html
-fn ios_ty_align(ty: Type) -> uint {
+fn ios_ty_align(ty: Type) -> usize {
     match ty.kind() {
-        Integer => cmp::min(4, ((ty.int_width() as uint) + 7) / 8),
+        Integer => cmp::min(4, ((ty.int_width() as usize) + 7) / 8),
         Pointer => 4,
         Float => 4,
         Double => 4,
@@ -95,9 +95,9 @@ fn ios_ty_align(ty: Type) -> uint {
     }
 }
 
-fn ty_size(ty: Type, align_fn: TyAlignFn) -> uint {
+fn ty_size(ty: Type, align_fn: TyAlignFn) -> usize {
     match ty.kind() {
-        Integer => ((ty.int_width() as uint) + 7) / 8,
+        Integer => ((ty.int_width() as usize) + 7) / 8,
         Pointer => 4,
         Float => 4,
         Double => 8,
index bc171e3ae4381fbbce881c5fdc3e3627b53e1d1e..2d7fdd2f2eba47a0acdcff06e96804d69bb680e3 100644 (file)
 use trans::context::CrateContext;
 use trans::type_::Type;
 
-fn align_up_to(off: uint, a: uint) -> uint {
+fn align_up_to(off: usize, a: usize) -> usize {
     return (off + a - 1) / a * a;
 }
 
-fn align(off: uint, ty: Type) -> uint {
+fn align(off: usize, ty: Type) -> usize {
     let a = ty_align(ty);
     return align_up_to(off, a);
 }
 
-fn ty_align(ty: Type) -> uint {
+fn ty_align(ty: Type) -> usize {
     match ty.kind() {
-        Integer => ((ty.int_width() as uint) + 7) / 8,
+        Integer => ((ty.int_width() as usize) + 7) / 8,
         Pointer => 4,
         Float => 4,
         Double => 8,
@@ -55,9 +55,9 @@ fn ty_align(ty: Type) -> uint {
     }
 }
 
-fn ty_size(ty: Type) -> uint {
+fn ty_size(ty: Type) -> usize {
     match ty.kind() {
-        Integer => ((ty.int_width() as uint) + 7) / 8,
+        Integer => ((ty.int_width() as usize) + 7) / 8,
         Pointer => 4,
         Float => 4,
         Double => 8,
@@ -96,7 +96,7 @@ fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
     }
 }
 
-fn classify_arg_ty(ccx: &CrateContext, ty: Type, offset: &mut uint) -> ArgType {
+fn classify_arg_ty(ccx: &CrateContext, ty: Type, offset: &mut usize) -> ArgType {
     let orig_offset = *offset;
     let size = ty_size(ty) * 8;
     let mut align = ty_align(ty);
@@ -129,7 +129,7 @@ fn is_reg_ty(ty: Type) -> bool {
     };
 }
 
-fn padding_ty(ccx: &CrateContext, align: uint, offset: uint) -> Option<Type> {
+fn padding_ty(ccx: &CrateContext, align: usize, offset: usize) -> Option<Type> {
     if ((align - 1 ) & offset) > 0 {
         Some(Type::i32(ccx))
     } else {
@@ -137,7 +137,7 @@ fn padding_ty(ccx: &CrateContext, align: uint, offset: uint) -> Option<Type> {
     }
 }
 
-fn coerce_to_int(ccx: &CrateContext, size: uint) -> Vec<Type> {
+fn coerce_to_int(ccx: &CrateContext, size: usize) -> Vec<Type> {
     let int_ty = Type::i32(ccx);
     let mut args = Vec::new();
 
index 4871617e89f3bfd1b0b9c5f319f984cd774ac18c..8c30d4fcc2b1f2c35310ee9dd557819f4e1f8842 100644 (file)
 
 use std::cmp;
 
-fn align_up_to(off: uint, a: uint) -> uint {
+fn align_up_to(off: usize, a: usize) -> usize {
     return (off + a - 1) / a * a;
 }
 
-fn align(off: uint, ty: Type) -> uint {
+fn align(off: usize, ty: Type) -> usize {
     let a = ty_align(ty);
     return align_up_to(off, a);
 }
 
-fn ty_align(ty: Type) -> uint {
+fn ty_align(ty: Type) -> usize {
     match ty.kind() {
         Integer => {
             unsafe {
-                ((llvm::LLVMGetIntTypeWidth(ty.to_ref()) as uint) + 7) / 8
+                ((llvm::LLVMGetIntTypeWidth(ty.to_ref()) as usize) + 7) / 8
             }
         }
         Pointer => 4,
@@ -53,11 +53,11 @@ fn ty_align(ty: Type) -> uint {
     }
 }
 
-fn ty_size(ty: Type) -> uint {
+fn ty_size(ty: Type) -> usize {
     match ty.kind() {
         Integer => {
             unsafe {
-                ((llvm::LLVMGetIntTypeWidth(ty.to_ref()) as uint) + 7) / 8
+                ((llvm::LLVMGetIntTypeWidth(ty.to_ref()) as usize) + 7) / 8
             }
         }
         Pointer => 4,
@@ -92,7 +92,7 @@ fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
     }
 }
 
-fn classify_arg_ty(ccx: &CrateContext, ty: Type, offset: &mut uint) -> ArgType {
+fn classify_arg_ty(ccx: &CrateContext, ty: Type, offset: &mut usize) -> ArgType {
     let orig_offset = *offset;
     let size = ty_size(ty) * 8;
     let mut align = ty_align(ty);
@@ -124,7 +124,7 @@ fn is_reg_ty(ty: Type) -> bool {
     };
 }
 
-fn padding_ty(ccx: &CrateContext, align: uint, offset: uint) -> Option<Type> {
+fn padding_ty(ccx: &CrateContext, align: usize, offset: usize) -> Option<Type> {
     if ((align - 1 ) & offset) > 0 {
         Some(Type::i32(ccx))
     } else {
@@ -132,7 +132,7 @@ fn padding_ty(ccx: &CrateContext, align: uint, offset: uint) -> Option<Type> {
     }
 }
 
-fn coerce_to_int(ccx: &CrateContext, size: uint) -> Vec<Type> {
+fn coerce_to_int(ccx: &CrateContext, size: usize) -> Vec<Type> {
     let int_ty = Type::i32(ccx);
     let mut args = Vec::new();
 
index ab41fe31a6e20b0343e7fbe409b75404119557b3..754b7ee5cf555d7c26ad89e7ecb3947d8b759ef3 100644 (file)
@@ -86,14 +86,14 @@ fn is_ret_bysret(&self) -> bool {
 }
 
 fn classify_ty(ty: Type) -> Vec<RegClass> {
-    fn align(off: uint, ty: Type) -> uint {
+    fn align(off: usize, ty: Type) -> usize {
         let a = ty_align(ty);
         return (off + a - 1) / a * a;
     }
 
-    fn ty_align(ty: Type) -> uint {
+    fn ty_align(ty: Type) -> usize {
         match ty.kind() {
-            Integer => ((ty.int_width() as uint) + 7) / 8,
+            Integer => ((ty.int_width() as usize) + 7) / 8,
             Pointer => 8,
             Float => 4,
             Double => 8,
@@ -118,9 +118,9 @@ fn ty_align(ty: Type) -> uint {
         }
     }
 
-    fn ty_size(ty: Type) -> uint {
+    fn ty_size(ty: Type) -> usize {
         match ty.kind() {
-            Integer => (ty.int_width() as uint + 7) / 8,
+            Integer => (ty.int_width() as usize + 7) / 8,
             Pointer => 8,
             Float => 4,
             Double => 8,
@@ -157,7 +157,7 @@ fn all_mem(cls: &mut [RegClass]) {
     }
 
     fn unify(cls: &mut [RegClass],
-             i: uint,
+             i: usize,
              newv: RegClass) {
         if cls[i] == newv { return }
 
@@ -191,8 +191,8 @@ fn unify(cls: &mut [RegClass],
 
     fn classify_struct(tys: &[Type],
                        cls: &mut [RegClass],
-                       i: uint,
-                       off: uint,
+                       i: usize,
+                       off: usize,
                        packed: bool) {
         let mut field_off = off;
         for ty in tys {
@@ -205,8 +205,8 @@ fn classify_struct(tys: &[Type],
     }
 
     fn classify(ty: Type,
-                cls: &mut [RegClass], ix: uint,
-                off: uint) {
+                cls: &mut [RegClass], ix: usize,
+                off: usize) {
         let t_align = ty_align(ty);
         let t_size = ty_size(ty);
 
@@ -331,7 +331,7 @@ fn fixup(ty: Type, cls: &mut [RegClass]) {
 }
 
 fn llreg_ty(ccx: &CrateContext, cls: &[RegClass]) -> Type {
-    fn llvec_len(cls: &[RegClass]) -> uint {
+    fn llvec_len(cls: &[RegClass]) -> usize {
         let mut len = 1;
         for c in cls {
             if *c != SSEUp {
index e7911d5cc197006942987d85575ad302488b5037..e33ec29017cc8120b02f945f047a5c052e1ff3c1 100644 (file)
@@ -21,7 +21,7 @@
 use arena::TypedArena;
 use back::link;
 use session;
-use llvm::{ValueRef};
+use llvm::ValueRef;
 use llvm::get_param;
 use llvm;
 use metadata::csearch;
index ad07f3953ccc5176b8d54a3376617e6016d7a95f..4897ae286d3e96354b19cbeb5dbbf3bb40beddb9 100644 (file)
@@ -155,12 +155,12 @@ pub struct CleanupScope<'blk, 'tcx: 'blk> {
 
 #[derive(Copy, Debug)]
 pub struct CustomScopeIndex {
-    index: uint
+    index: usize
 }
 
-pub const EXIT_BREAK: uint = 0;
-pub const EXIT_LOOP: uint = 1;
-pub const EXIT_MAX: uint = 2;
+pub const EXIT_BREAK: usize = 0;
+pub const EXIT_LOOP: usize = 1;
+pub const EXIT_MAX: usize = 2;
 
 pub enum CleanupScopeKind<'blk, 'tcx: 'blk> {
     CustomScopeKind,
@@ -188,7 +188,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 pub enum EarlyExitLabel {
     UnwindExit,
     ReturnExit,
-    LoopExit(ast::NodeId, uint)
+    LoopExit(ast::NodeId, usize)
 }
 
 #[derive(Copy)]
@@ -357,7 +357,7 @@ fn top_loop_scope(&self) -> ast::NodeId {
     /// break/continue (depending on `exit`) out of the loop with id `cleanup_scope`
     fn normal_exit_block(&'blk self,
                          cleanup_scope: ast::NodeId,
-                         exit: uint) -> BasicBlockRef {
+                         exit: usize) -> BasicBlockRef {
         self.trans_cleanups_to_exit_scope(LoopExit(cleanup_scope, exit))
     }
 
@@ -585,7 +585,7 @@ fn top_ast_scope(&self) -> Option<ast::NodeId> {
         None
     }
 
-    fn top_nonempty_cleanup_scope(&self) -> Option<uint> {
+    fn top_nonempty_cleanup_scope(&self) -> Option<usize> {
         self.scopes.borrow().iter().rev().position(|s| !s.cleanups.is_empty())
     }
 
@@ -614,7 +614,7 @@ fn trans_scope_cleanups(&self, // cannot borrow self, will recurse
         bcx
     }
 
-    fn scopes_len(&self) -> uint {
+    fn scopes_len(&self) -> usize {
         self.scopes.borrow().len()
     }
 
@@ -962,7 +962,7 @@ fn is_loop_with_id(&self, id: ast::NodeId) -> bool {
     /// If this is a loop scope with id `id`, return the early exit block `exit`, else `None`
     fn early_exit_block(&self,
                         id: ast::NodeId,
-                        exit: uint) -> Option<BasicBlockRef> {
+                        exit: usize) -> Option<BasicBlockRef> {
         match *self {
             LoopScopeKind(i, ref exits) if id == i => Some(exits[exit].llbb),
             _ => None,
@@ -1015,7 +1015,7 @@ fn trans<'blk>(&self,
             glue::drop_ty(bcx, self.val, self.ty, debug_loc)
         };
         if self.zero {
-            base::zero_mem(bcx, self.val, self.ty);
+            base::drop_done_fill_mem(bcx, self.val, self.ty);
         }
         bcx
     }
@@ -1182,7 +1182,7 @@ fn pop_and_trans_custom_cleanup_scope(&self,
     fn top_loop_scope(&self) -> ast::NodeId;
     fn normal_exit_block(&'blk self,
                          cleanup_scope: ast::NodeId,
-                         exit: uint) -> BasicBlockRef;
+                         exit: usize) -> BasicBlockRef;
     fn return_exit_block(&'blk self) -> BasicBlockRef;
     fn schedule_lifetime_end(&self,
                          cleanup_scope: ScopeId,
@@ -1225,7 +1225,7 @@ fn schedule_clean_in_custom_scope(&self,
 
 trait CleanupHelperMethods<'blk, 'tcx> {
     fn top_ast_scope(&self) -> Option<ast::NodeId>;
-    fn top_nonempty_cleanup_scope(&self) -> Option<uint>;
+    fn top_nonempty_cleanup_scope(&self) -> Option<usize>;
     fn is_valid_to_pop_custom_scope(&self, custom_scope: CustomScopeIndex) -> bool;
     fn is_valid_custom_scope(&self, custom_scope: CustomScopeIndex) -> bool;
     fn trans_scope_cleanups(&self,
@@ -1235,7 +1235,7 @@ fn trans_cleanups_to_exit_scope(&'blk self,
                                     label: EarlyExitLabel)
                                     -> BasicBlockRef;
     fn get_or_create_landing_pad(&'blk self) -> BasicBlockRef;
-    fn scopes_len(&self) -> uint;
+    fn scopes_len(&self) -> usize;
     fn push_scope(&self, scope: CleanupScope<'blk, 'tcx>);
     fn pop_scope(&self) -> CleanupScope<'blk, 'tcx>;
     fn top_scope<R, F>(&self, f: F) -> R where F: FnOnce(&CleanupScope<'blk, 'tcx>) -> R;
index 5a48b8e4bce1d37acb4ae77844ff80a2e674c864..c1aade3663e6e8f37ec7dde9f1547d95d961c546 100644 (file)
@@ -24,7 +24,7 @@
 use trans::monomorphize::{self, MonoId};
 use trans::type_of::*;
 use middle::ty::{self, ClosureTyper};
-use middle::subst::{Substs};
+use middle::subst::Substs;
 use session::config::FullDebugInfo;
 use util::ppaux::Repr;
 
index 61cdde3bfbecd775a24346f063341a12e8bff644..745098d6e87d11f9b1b8cac372e313dadbb91e40 100644 (file)
@@ -459,7 +459,7 @@ pub struct FunctionContext<'a, 'tcx: 'a> {
 }
 
 impl<'a, 'tcx> FunctionContext<'a, 'tcx> {
-    pub fn arg_pos(&self, arg: uint) -> uint {
+    pub fn arg_pos(&self, arg: usize) -> usize {
         let arg = self.env_arg_pos() + arg;
         if self.llenv.is_some() {
             arg + 1
@@ -468,7 +468,7 @@ pub fn arg_pos(&self, arg: uint) -> uint {
         }
     }
 
-    pub fn env_arg_pos(&self) -> uint {
+    pub fn env_arg_pos(&self) -> usize {
         if self.caller_expects_out_pointer {
             1
         } else {
@@ -846,13 +846,13 @@ pub fn C_uint<I: AsU64>(ccx: &CrateContext, i: I) -> ValueRef {
 // are host-architecture-dependent
 impl AsI64 for i64 { fn as_i64(self) -> i64 { self as i64 }}
 impl AsI64 for i32 { fn as_i64(self) -> i64 { self as i64 }}
-impl AsI64 for int { fn as_i64(self) -> i64 { self as i64 }}
+impl AsI64 for isize { fn as_i64(self) -> i64 { self as i64 }}
 
 impl AsU64 for u64  { fn as_u64(self) -> u64 { self as u64 }}
 impl AsU64 for u32  { fn as_u64(self) -> u64 { self as u64 }}
-impl AsU64 for uint { fn as_u64(self) -> u64 { self as u64 }}
+impl AsU64 for usize { fn as_u64(self) -> u64 { self as u64 }}
 
-pub fn C_u8(ccx: &CrateContext, i: uint) -> ValueRef {
+pub fn C_u8(ccx: &CrateContext, i: usize) -> ValueRef {
     C_integral(Type::i8(ccx), i as u64, false)
 }
 
@@ -1069,17 +1069,30 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     vtable
 }
 
-pub fn predicates_hold<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
-                                 predicates: Vec<ty::Predicate<'tcx>>)
-                                 -> bool
+/// Normalizes the predicates and checks whether they hold.  If this
+/// returns false, then either normalize encountered an error or one
+/// of the predicates did not hold. Used when creating vtables to
+/// check for unsatisfiable methods.
+pub fn normalize_and_test_predicates<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+                                               predicates: Vec<ty::Predicate<'tcx>>)
+                                               -> bool
 {
-    debug!("predicates_hold(predicates={})",
+    debug!("normalize_and_test_predicates(predicates={})",
            predicates.repr(ccx.tcx()));
 
-    let infcx = infer::new_infer_ctxt(ccx.tcx());
+    let tcx = ccx.tcx();
+    let infcx = infer::new_infer_ctxt(tcx);
+    let typer = NormalizingClosureTyper::new(tcx);
+    let mut selcx = traits::SelectionContext::new(&infcx, &typer);
     let mut fulfill_cx = traits::FulfillmentContext::new();
+    let cause = traits::ObligationCause::dummy();
+    let traits::Normalized { value: predicates, obligations } =
+        traits::normalize(&mut selcx, cause.clone(), &predicates);
+    for obligation in obligations {
+        fulfill_cx.register_predicate_obligation(&infcx, obligation);
+    }
     for predicate in predicates {
-        let obligation = traits::Obligation::new(traits::ObligationCause::dummy(), predicate);
+        let obligation = traits::Obligation::new(cause.clone(), predicate);
         fulfill_cx.register_predicate_obligation(&infcx, obligation);
     }
     drain_fulfillment_cx(&infcx, &mut fulfill_cx, &()).is_ok()
index 4b1a03e47e7aebb1f2ef30bf261659b61204e2b4..0a9df2b5dc180dba91802d120abf6ea96d901e8c 100644 (file)
@@ -53,7 +53,7 @@ pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: &ast::Lit)
                 }
                 _ => cx.sess().span_bug(lit.span,
                         &format!("integer literal has type {} (expected int \
-                                 or uint)",
+                                 or usize)",
                                 ty_to_string(cx.tcx(), lit_int_ty)))
             }
         }
@@ -351,7 +351,14 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
 fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                    e: &ast::Expr,
                                    ety: Ty<'tcx>,
-                                   param_substs: &'tcx Substs<'tcx>) -> ValueRef {
+                                   param_substs: &'tcx Substs<'tcx>)
+                                   -> ValueRef
+{
+    debug!("const_expr_unadjusted(e={}, ety={}, param_substs={})",
+           e.repr(cx.tcx()),
+           ety.repr(cx.tcx()),
+           param_substs.repr(cx.tcx()));
+
     let map_list = |exprs: &[P<ast::Expr>]| {
         exprs.iter().map(|e| const_expr(cx, &**e, param_substs).0)
              .fold(Vec::new(), |mut l, val| { l.push(val); l })
@@ -366,6 +373,9 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             /* Neither type is bottom, and we expect them to be unified
              * already, so the following is safe. */
             let (te1, ty) = const_expr(cx, &**e1, param_substs);
+            debug!("const_expr_unadjusted: te1={}, ty={}",
+                   cx.tn().val_to_string(te1),
+                   ty.repr(cx.tcx()));
             let is_simd = ty::type_is_simd(cx.tcx(), ty);
             let intype = if is_simd {
                 ty::simd_type(cx.tcx(), ty)
@@ -652,8 +662,8 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             let unit_ty = ty::sequence_element_type(cx.tcx(), ety);
             let llunitty = type_of::type_of(cx, unit_ty);
             let n = match const_eval::eval_const_expr_partial(cx.tcx(), &**count, None) {
-                Ok(const_eval::const_int(i))  => i as uint,
-                Ok(const_eval::const_uint(i)) => i as uint,
+                Ok(const_eval::const_int(i))  => i as usize,
+                Ok(const_eval::const_uint(i)) => i as usize,
                 _ => cx.sess().span_bug(count.span, "count must be integral const expression.")
             };
             let unit_val = const_expr(cx, &**elem, param_substs).0;
index 6614d538971ddc1c7cc8a74bc9abff22841d24b1..3542bcd081f31c3e744988daac3d34750c3ff353 100644 (file)
@@ -10,7 +10,7 @@
 
 use llvm;
 use llvm::{ContextRef, ModuleRef, ValueRef, BuilderRef};
-use llvm::{TargetData};
+use llvm::TargetData;
 use llvm::mk_target_data;
 use metadata::common::LinkMeta;
 use middle::def::ExportMap;
 use syntax::parse::token::InternedString;
 
 pub struct Stats {
-    pub n_glues_created: Cell<uint>,
-    pub n_null_glues: Cell<uint>,
-    pub n_real_glues: Cell<uint>,
-    pub n_fns: Cell<uint>,
-    pub n_monos: Cell<uint>,
-    pub n_inlines: Cell<uint>,
-    pub n_closures: Cell<uint>,
-    pub n_llvm_insns: Cell<uint>,
-    pub llvm_insns: RefCell<FnvHashMap<String, uint>>,
+    pub n_glues_created: Cell<usize>,
+    pub n_null_glues: Cell<usize>,
+    pub n_real_glues: Cell<usize>,
+    pub n_fns: Cell<usize>,
+    pub n_monos: Cell<usize>,
+    pub n_inlines: Cell<usize>,
+    pub n_closures: Cell<usize>,
+    pub n_llvm_insns: Cell<usize>,
+    pub llvm_insns: RefCell<FnvHashMap<String, usize>>,
     // (ident, llvm-instructions)
-    pub fn_stats: RefCell<Vec<(String, uint)> >,
+    pub fn_stats: RefCell<Vec<(String, usize)> >,
 }
 
 /// The shared portion of a `CrateContext`.  There is one `SharedCrateContext`
@@ -69,6 +69,7 @@ pub struct SharedCrateContext<'tcx> {
     tcx: ty::ctxt<'tcx>,
     stats: Stats,
     check_overflow: bool,
+    check_drop_flag_for_sanity: bool,
 
     available_monomorphizations: RefCell<FnvHashSet<String>>,
     available_drop_glues: RefCell<FnvHashMap<Ty<'tcx>, String>>,
@@ -95,7 +96,7 @@ pub struct LocalCrateContext<'tcx> {
     external_srcs: RefCell<NodeMap<ast::DefId>>,
     /// Cache instances of monomorphized functions
     monomorphized: RefCell<FnvHashMap<MonoId<'tcx>, ValueRef>>,
-    monomorphizing: RefCell<DefIdMap<uint>>,
+    monomorphizing: RefCell<DefIdMap<usize>>,
     /// Cache generated vtables
     vtables: RefCell<FnvHashMap<ty::PolyTraitRef<'tcx>, ValueRef>>,
     /// Cache of constant strings,
@@ -149,7 +150,7 @@ pub struct LocalCrateContext<'tcx> {
     /// Number of LLVM instructions translated into this `LocalCrateContext`.
     /// This is used to perform some basic load-balancing to keep all LLVM
     /// contexts around the same size.
-    n_llvm_insns: Cell<uint>,
+    n_llvm_insns: Cell<usize>,
 
     trait_cache: RefCell<FnvHashMap<ty::PolyTraitRef<'tcx>,
                                     traits::Vtable<'tcx, ()>>>,
@@ -160,12 +161,12 @@ pub struct CrateContext<'a, 'tcx: 'a> {
     local: &'a LocalCrateContext<'tcx>,
     /// The index of `local` in `shared.local_ccxs`.  This is used in
     /// `maybe_iter(true)` to identify the original `LocalCrateContext`.
-    index: uint,
+    index: usize,
 }
 
 pub struct CrateContextIterator<'a, 'tcx: 'a> {
     shared: &'a SharedCrateContext<'tcx>,
-    index: uint,
+    index: usize,
 }
 
 impl<'a, 'tcx> Iterator for CrateContextIterator<'a,'tcx> {
@@ -190,9 +191,9 @@ fn next(&mut self) -> Option<CrateContext<'a, 'tcx>> {
 /// The iterator produced by `CrateContext::maybe_iter`.
 pub struct CrateContextMaybeIterator<'a, 'tcx: 'a> {
     shared: &'a SharedCrateContext<'tcx>,
-    index: uint,
+    index: usize,
     single: bool,
-    origin: uint,
+    origin: usize,
 }
 
 impl<'a, 'tcx> Iterator for CrateContextMaybeIterator<'a, 'tcx> {
@@ -236,13 +237,14 @@ unsafe fn create_context_and_module(sess: &Session, mod_name: &str) -> (ContextR
 
 impl<'tcx> SharedCrateContext<'tcx> {
     pub fn new(crate_name: &str,
-               local_count: uint,
+               local_count: usize,
                tcx: ty::ctxt<'tcx>,
                export_map: ExportMap,
                symbol_hasher: Sha256,
                link_meta: LinkMeta,
                reachable: NodeSet,
-               check_overflow: bool)
+               check_overflow: bool,
+               check_drop_flag_for_sanity: bool)
                -> SharedCrateContext<'tcx> {
         let (metadata_llcx, metadata_llmod) = unsafe {
             create_context_and_module(&tcx.sess, "metadata")
@@ -271,6 +273,7 @@ pub fn new(crate_name: &str,
                 fn_stats: RefCell::new(Vec::new()),
             },
             check_overflow: check_overflow,
+            check_drop_flag_for_sanity: check_drop_flag_for_sanity,
             available_monomorphizations: RefCell::new(FnvHashSet()),
             available_drop_glues: RefCell::new(FnvHashMap()),
         };
@@ -299,7 +302,7 @@ pub fn iter<'a>(&'a self) -> CrateContextIterator<'a, 'tcx> {
         }
     }
 
-    pub fn get_ccx<'a>(&'a self, index: uint) -> CrateContext<'a, 'tcx> {
+    pub fn get_ccx<'a>(&'a self, index: usize) -> CrateContext<'a, 'tcx> {
         CrateContext {
             shared: self,
             local: &self.local_ccxs[index],
@@ -456,7 +459,7 @@ fn dummy_ccx<'a>(&'a self, shared: &'a SharedCrateContext<'tcx>)
         CrateContext {
             shared: shared,
             local: self,
-            index: -1 as uint,
+            index: -1 as usize,
         }
     }
 }
@@ -588,7 +591,7 @@ pub fn monomorphized<'a>(&'a self) -> &'a RefCell<FnvHashMap<MonoId<'tcx>, Value
         &self.local.monomorphized
     }
 
-    pub fn monomorphizing<'a>(&'a self) -> &'a RefCell<DefIdMap<uint>> {
+    pub fn monomorphizing<'a>(&'a self) -> &'a RefCell<DefIdMap<usize>> {
         &self.local.monomorphizing
     }
 
@@ -727,6 +730,13 @@ pub fn report_overbig_object(&self, obj: Ty<'tcx>) -> ! {
     pub fn check_overflow(&self) -> bool {
         self.shared.check_overflow
     }
+
+    pub fn check_drop_flag_for_sanity(&self) -> bool {
+        // This controls whether we emit a conditional llvm.debugtrap
+        // guarded on whether the dropflag is one of its (two) valid
+        // values.
+        self.shared.check_drop_flag_for_sanity
+    }
 }
 
 fn declare_intrinsic(ccx: &CrateContext, key: & &'static str) -> Option<ValueRef> {
index 85d0bc0319f308d93998463b3c2c410d5af30e53..bd31580333fab25f5cfba61820afbdfcea84dfb0 100644 (file)
@@ -293,7 +293,7 @@ pub fn trans_loop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 pub fn trans_break_cont<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                     expr: &ast::Expr,
                                     opt_label: Option<Ident>,
-                                    exit: uint)
+                                    exit: usize)
                                     -> Block<'blk, 'tcx> {
     let _icx = push_ctxt("trans_break_cont");
     let fcx = bcx.fcx;
index 15738d1e61ac14122f0161df205f0d536ebca146..7b983ca4ac6ac9cfaa394724febd87674c79b84f 100644 (file)
 use trans::tvec;
 use trans::type_of;
 use middle::ty::{self, Ty};
-use util::ppaux::{ty_to_string};
+use util::ppaux::ty_to_string;
 
 use std::fmt;
 use syntax::ast;
@@ -307,8 +307,8 @@ fn post_store<'blk, 'tcx>(&self,
                               -> Block<'blk, 'tcx> {
         let _icx = push_ctxt("<Lvalue as KindOps>::post_store");
         if bcx.fcx.type_needs_drop(ty) {
-            // cancel cleanup of affine values by zeroing out
-            let () = zero_mem(bcx, val, ty);
+            // cancel cleanup of affine values by drop-filling the memory
+            let () = drop_done_fill_mem(bcx, val, ty);
             bcx
         } else {
             bcx
index b9c59a0bc78d671f59e3b8a13b74a8b4612f9931..f2c24501c66c8e6c97856919fa471b01f01b0fcb 100644 (file)
@@ -694,7 +694,7 @@ fn should_be_ignored_message() -> &'static str {
 struct FunctionDebugContextData {
     scope_map: RefCell<NodeMap<DIScope>>,
     fn_metadata: DISubprogram,
-    argument_counter: Cell<uint>,
+    argument_counter: Cell<usize>,
     source_locations_enabled: Cell<bool>,
     source_location_override: Cell<bool>,
 }
@@ -708,7 +708,7 @@ enum VariableAccess<'a> {
 }
 
 enum VariableKind {
-    ArgumentVariable(uint /*index*/),
+    ArgumentVariable(usize /*index*/),
     LocalVariable,
     CapturedVariable,
 }
@@ -876,7 +876,7 @@ pub fn create_local_var_metadata(bcx: Block, local: &ast::Local) {
 pub fn create_captured_var_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                                 node_id: ast::NodeId,
                                                 env_pointer: ValueRef,
-                                                env_index: uint,
+                                                env_index: usize,
                                                 captured_by_ref: bool,
                                                 span: Span) {
     if bcx.unreachable.get() ||
@@ -1814,14 +1814,14 @@ fn basic_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         ty::ty_bool => ("bool".to_string(), DW_ATE_boolean),
         ty::ty_char => ("char".to_string(), DW_ATE_unsigned_char),
         ty::ty_int(int_ty) => match int_ty {
-            ast::TyIs(_) => ("isize".to_string(), DW_ATE_signed),
+            ast::TyIs => ("isize".to_string(), DW_ATE_signed),
             ast::TyI8 => ("i8".to_string(), DW_ATE_signed),
             ast::TyI16 => ("i16".to_string(), DW_ATE_signed),
             ast::TyI32 => ("i32".to_string(), DW_ATE_signed),
             ast::TyI64 => ("i64".to_string(), DW_ATE_signed)
         },
         ty::ty_uint(uint_ty) => match uint_ty {
-            ast::TyUs(_) => ("usize".to_string(), DW_ATE_unsigned),
+            ast::TyUs => ("usize".to_string(), DW_ATE_unsigned),
             ast::TyU8 => ("u8".to_string(), DW_ATE_unsigned),
             ast::TyU16 => ("u16".to_string(), DW_ATE_unsigned),
             ast::TyU32 => ("u32".to_string(), DW_ATE_unsigned),
@@ -1873,7 +1873,7 @@ fn pointer_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
 //=-----------------------------------------------------------------------------
 
 enum MemberOffset {
-    FixedMemberOffset { bytes: uint },
+    FixedMemberOffset { bytes: usize },
     // For ComputedMemberOffset, the offset is read from the llvm type definition
     ComputedMemberOffset
 }
@@ -2022,7 +2022,7 @@ fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
         }
 
         let field_size = if self.is_simd {
-            machine::llsize_of_alloc(cx, type_of::type_of(cx, self.fields[0].mt.ty)) as uint
+            machine::llsize_of_alloc(cx, type_of::type_of(cx, self.fields[0].mt.ty)) as usize
         } else {
             0xdeadbeef
         };
@@ -2245,7 +2245,7 @@ fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
                 // DWARF representation of enums uniform.
 
                 // First create a description of the artificial wrapper struct:
-                let non_null_variant = &(*self.variants)[non_null_variant_index as uint];
+                let non_null_variant = &(*self.variants)[non_null_variant_index as usize];
                 let non_null_variant_name = token::get_name(non_null_variant.name);
 
                 // The llvm type and metadata of the pointer
@@ -2290,7 +2290,7 @@ fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
 
                 // Encode the information about the null variant in the union
                 // member's name.
-                let null_variant_index = (1 - non_null_variant_index) as uint;
+                let null_variant_index = (1 - non_null_variant_index) as usize;
                 let null_variant_name = token::get_name((*self.variants)[null_variant_index].name);
                 let union_member_name = format!("RUST$ENCODED$ENUM${}${}",
                                                 0,
@@ -2316,7 +2316,7 @@ fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
                     describe_enum_variant(cx,
                                           self.enum_type,
                                           struct_def,
-                                          &*(*self.variants)[nndiscr as uint],
+                                          &*(*self.variants)[nndiscr as usize],
                                           OptimizedDiscriminant,
                                           self.containing_scope,
                                           self.span);
@@ -2331,7 +2331,7 @@ fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
 
                 // Encode the information about the null variant in the union
                 // member's name.
-                let null_variant_index = (1 - nndiscr) as uint;
+                let null_variant_index = (1 - nndiscr) as usize;
                 let null_variant_name = token::get_name((*self.variants)[null_variant_index].name);
                 let discrfield = discrfield.iter()
                                            .skip(1)
@@ -2813,7 +2813,7 @@ fn vec_slice_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         MemberDescription {
             name: "length".to_string(),
             llvm_type: member_llvm_types[1],
-            type_metadata: type_metadata(cx, cx.tcx().types.uint, span),
+            type_metadata: type_metadata(cx, cx.tcx().types.usize, span),
             offset: ComputedMemberOffset,
             flags: FLAGS_NONE
         },
@@ -3108,12 +3108,12 @@ fn new(metadata: DIType, already_stored_in_typemap: bool) -> MetadataCreationRes
 
 #[derive(Copy, PartialEq)]
 enum InternalDebugLocation {
-    KnownLocation { scope: DIScope, line: uint, col: uint },
+    KnownLocation { scope: DIScope, line: usize, col: usize },
     UnknownLocation
 }
 
 impl InternalDebugLocation {
-    fn new(scope: DIScope, line: uint, col: uint) -> InternalDebugLocation {
+    fn new(scope: DIScope, line: usize, col: usize) -> InternalDebugLocation {
         KnownLocation {
             scope: scope,
             line: line,
@@ -3745,12 +3745,12 @@ fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         ty::ty_bool              => output.push_str("bool"),
         ty::ty_char              => output.push_str("char"),
         ty::ty_str               => output.push_str("str"),
-        ty::ty_int(ast::TyIs(_))     => output.push_str("isize"),
+        ty::ty_int(ast::TyIs)     => output.push_str("isize"),
         ty::ty_int(ast::TyI8)    => output.push_str("i8"),
         ty::ty_int(ast::TyI16)   => output.push_str("i16"),
         ty::ty_int(ast::TyI32)   => output.push_str("i32"),
         ty::ty_int(ast::TyI64)   => output.push_str("i64"),
-        ty::ty_uint(ast::TyUs(_))    => output.push_str("usize"),
+        ty::ty_uint(ast::TyUs)    => output.push_str("usize"),
         ty::ty_uint(ast::TyU8)   => output.push_str("u8"),
         ty::ty_uint(ast::TyU16)  => output.push_str("u16"),
         ty::ty_uint(ast::TyU32)  => output.push_str("u32"),
index ba8de6da42f72210abebe59610ea99cec0d99617..46cbd1936002aef12621e03f91d45205ea0eb74b 100644 (file)
@@ -73,7 +73,7 @@
 use trans::type_of;
 use middle::ty::{struct_fields, tup_fields};
 use middle::ty::{AdjustDerefRef, AdjustReifyFnPointer, AdjustUnsafeFnPointer, AutoUnsafe};
-use middle::ty::{AutoPtr};
+use middle::ty::AutoPtr;
 use middle::ty::{self, Ty};
 use middle::ty::MethodCall;
 use util::common::indenter;
@@ -521,7 +521,7 @@ fn unsize_expr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     fn unsize_unique_vec<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                      expr: &ast::Expr,
                                      datum: Datum<'tcx, Expr>,
-                                     len: uint)
+                                     len: usize)
                                      -> DatumBlock<'blk, 'tcx, Expr> {
         let mut bcx = bcx;
         let tcx = bcx.tcx();
@@ -744,7 +744,7 @@ fn trans_field<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
                               base: &ast::Expr,
                               get_idx: F)
                               -> DatumBlock<'blk, 'tcx, Expr> where
-    F: FnOnce(&'blk ty::ctxt<'tcx>, &[ty::field<'tcx>]) -> uint,
+    F: FnOnce(&'blk ty::ctxt<'tcx>, &[ty::field<'tcx>]) -> usize,
 {
     let mut bcx = bcx;
     let _icx = push_ctxt("trans_rec_field");
@@ -785,7 +785,7 @@ fn trans_rec_field<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 /// Translates `base.<idx>`.
 fn trans_rec_tup_field<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                    base: &ast::Expr,
-                                   idx: uint)
+                                   idx: usize)
                                    -> DatumBlock<'blk, 'tcx, Expr> {
     trans_field(bcx, base, |_, _| idx)
 }
@@ -1149,7 +1149,7 @@ fn make_field(field_name: &str, expr: P<ast::Expr>) -> ast::Field {
             }
         }
         ast::ExprTup(ref args) => {
-            let numbered_fields: Vec<(uint, &ast::Expr)> =
+            let numbered_fields: Vec<(usize, &ast::Expr)> =
                 args.iter().enumerate().map(|(i, arg)| (i, &**arg)).collect();
             trans_adt(bcx,
                       expr_ty(bcx, expr),
@@ -1485,7 +1485,7 @@ pub struct StructBaseInfo<'a, 'tcx> {
     /// The base expression; will be evaluated after all explicit fields.
     expr: &'a ast::Expr,
     /// The indices of fields to copy paired with their types.
-    fields: Vec<(uint, Ty<'tcx>)>
+    fields: Vec<(usize, Ty<'tcx>)>
 }
 
 /// Constructs an ADT instance:
@@ -1499,7 +1499,7 @@ pub struct StructBaseInfo<'a, 'tcx> {
 pub fn trans_adt<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
                                  ty: Ty<'tcx>,
                                  discr: ty::Disr,
-                                 fields: &[(uint, &ast::Expr)],
+                                 fields: &[(usize, &ast::Expr)],
                                  optbase: Option<StructBaseInfo<'a, 'tcx>>,
                                  dest: Dest,
                                  debug_location: DebugLoc)
@@ -2228,7 +2228,7 @@ fn auto_ref<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 fn deref_multiple<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                               expr: &ast::Expr,
                               datum: Datum<'tcx, Expr>,
-                              times: uint)
+                              times: usize)
                               -> DatumBlock<'blk, 'tcx, Expr> {
     let mut bcx = bcx;
     let mut datum = datum;
@@ -2384,6 +2384,7 @@ fn deref_owned_pointer<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     }
 }
 
+#[derive(Debug)]
 enum OverflowOp {
     Add,
     Sub,
@@ -2413,6 +2414,7 @@ enum OverflowCodegen {
 
 enum OverflowOpViaInputCheck { Shl, Shr, }
 
+#[derive(Debug)]
 enum OverflowOpViaIntrinsic { Add, Sub, Mul, }
 
 impl OverflowOpViaIntrinsic {
@@ -2426,18 +2428,19 @@ fn to_intrinsic_name(&self, tcx: &ty::ctxt, ty: Ty) -> &'static str {
         use middle::ty::{ty_int, ty_uint};
 
         let new_sty = match ty.sty {
-            ty_int(TyIs(_)) => match &tcx.sess.target.target.target_pointer_width[..] {
+            ty_int(TyIs) => match &tcx.sess.target.target.target_pointer_width[..] {
                 "32" => ty_int(TyI32),
                 "64" => ty_int(TyI64),
                 _ => panic!("unsupported target word size")
             },
-            ty_uint(TyUs(_)) => match &tcx.sess.target.target.target_pointer_width[..] {
+            ty_uint(TyUs) => match &tcx.sess.target.target.target_pointer_width[..] {
                 "32" => ty_uint(TyU32),
                 "64" => ty_uint(TyU64),
                 _ => panic!("unsupported target word size")
             },
             ref t @ ty_uint(_) | ref t @ ty_int(_) => t.clone(),
-            _ => panic!("tried to get overflow intrinsic for non-int type")
+            _ => panic!("tried to get overflow intrinsic for {:?} applied to non-int type",
+                        *self)
         };
 
         match *self {
index dfc7e7f604f3d8b4f69a9c9f4cefa657e066cf68..e87a5865df05446f5f08f51a649348d648547b87 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-use back::{link};
+use back::link;
 use llvm::{ValueRef, CallConv, get_param};
 use llvm;
 use middle::weak_lang_items;
@@ -35,7 +35,7 @@
 use syntax::codemap::Span;
 use syntax::parse::token::{InternedString, special_idents};
 use syntax::parse::token;
-use syntax::{ast};
+use syntax::ast;
 use syntax::{attr, ast_map};
 use syntax::print::pprust;
 use util::ppaux::Repr;
index b2de8435f641bd5c4e8d6340ba27379805ee4a43..32b4d14177c2a050fbd512c4df1b0efe32b09448 100644 (file)
@@ -21,6 +21,7 @@
 use middle::subst;
 use middle::subst::{Subst, Substs};
 use trans::adt;
+use trans::adt::GetDtorType; // for tcx.dtor_type()
 use trans::base::*;
 use trans::build::*;
 use trans::callee;
@@ -231,9 +232,31 @@ fn trans_struct_drop_flag<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
         Load(bcx, llval)
     };
     let drop_flag = unpack_datum!(bcx, adt::trans_drop_flag_ptr(bcx, &*repr, struct_data));
-    with_cond(bcx, load_ty(bcx, drop_flag.val, bcx.tcx().types.bool), |cx| {
+    let loaded = load_ty(bcx, drop_flag.val, bcx.tcx().dtor_type());
+    let drop_flag_llty = type_of(bcx.fcx.ccx, bcx.tcx().dtor_type());
+    let init_val = C_integral(drop_flag_llty, adt::DTOR_NEEDED as u64, false);
+
+    let bcx = if !bcx.ccx().check_drop_flag_for_sanity() {
+        bcx
+    } else {
+        let drop_flag_llty = type_of(bcx.fcx.ccx, bcx.tcx().dtor_type());
+        let done_val = C_integral(drop_flag_llty, adt::DTOR_DONE as u64, false);
+        let not_init = ICmp(bcx, llvm::IntNE, loaded, init_val, DebugLoc::None);
+        let not_done = ICmp(bcx, llvm::IntNE, loaded, done_val, DebugLoc::None);
+        let drop_flag_neither_initialized_nor_cleared =
+            And(bcx, not_init, not_done, DebugLoc::None);
+        with_cond(bcx, drop_flag_neither_initialized_nor_cleared, |cx| {
+            let llfn = cx.ccx().get_intrinsic(&("llvm.debugtrap"));
+            Call(cx, llfn, &[], None, DebugLoc::None);
+            cx
+        })
+    };
+
+    let drop_flag_dtor_needed = ICmp(bcx, llvm::IntEQ, loaded, init_val, DebugLoc::None);
+    with_cond(bcx, drop_flag_dtor_needed, |cx| {
         trans_struct_drop(cx, t, v0, dtor_did, class_did, substs)
     })
+
 }
 
 fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
@@ -395,13 +418,24 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: Ty<'tcx>)
                               -> Block<'blk, 'tcx> {
     // NB: v0 is an *alias* of type t here, not a direct value.
     let _icx = push_ctxt("make_drop_glue");
+
+    // Only drop the value when it ... well, we used to check for
+    // non-null, (and maybe we need to continue doing so), but we now
+    // must definitely check for special bit-patterns corresponding to
+    // the special dtor markings.
+
+    let inttype = Type::int(bcx.ccx());
+    let dropped_pattern = C_integral(inttype, adt::dtor_done_usize(bcx.fcx.ccx) as u64, false);
+
     match t.sty {
         ty::ty_uniq(content_ty) => {
             if !type_is_sized(bcx.tcx(), content_ty) {
                 let llval = GEPi(bcx, v0, &[0, abi::FAT_PTR_ADDR]);
                 let llbox = Load(bcx, llval);
-                let not_null = IsNotNull(bcx, llbox);
-                with_cond(bcx, not_null, |bcx| {
+                let llbox_as_usize = PtrToInt(bcx, llbox, Type::int(bcx.ccx()));
+                let drop_flag_not_dropped_already =
+                    ICmp(bcx, llvm::IntNE, llbox_as_usize, dropped_pattern, DebugLoc::None);
+                with_cond(bcx, drop_flag_not_dropped_already, |bcx| {
                     let bcx = drop_ty(bcx, v0, content_ty, DebugLoc::None);
                     let info = GEPi(bcx, v0, &[0, abi::FAT_PTR_EXTRA]);
                     let info = Load(bcx, info);
@@ -420,8 +454,10 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: Ty<'tcx>)
             } else {
                 let llval = v0;
                 let llbox = Load(bcx, llval);
-                let not_null = IsNotNull(bcx, llbox);
-                with_cond(bcx, not_null, |bcx| {
+                let llbox_as_usize = PtrToInt(bcx, llbox, inttype);
+                let drop_flag_not_dropped_already =
+                    ICmp(bcx, llvm::IntNE, llbox_as_usize, dropped_pattern, DebugLoc::None);
+                with_cond(bcx, drop_flag_not_dropped_already, |bcx| {
                     let bcx = drop_ty(bcx, llbox, content_ty, DebugLoc::None);
                     trans_exchange_free_ty(bcx, llbox, content_ty, DebugLoc::None)
                 })
index f714c5800c57b3717f5fb2532413b7e5159f17a3..62a6ede4c2f936bdcdefaec91e8e21c5e12cca96 100644 (file)
@@ -121,10 +121,10 @@ pub fn check_intrinsics(ccx: &CrateContext) {
                     &format!("transmute called on types with potentially different sizes: \
                               {} (could be {} bit{}) to {} (could be {} bit{})",
                              ty_to_string(ccx.tcx(), transmute_restriction.original_from),
-                             from_type_size as uint,
+                             from_type_size as usize,
                              if from_type_size == 1 {""} else {"s"},
                              ty_to_string(ccx.tcx(), transmute_restriction.original_to),
-                             to_type_size as uint,
+                             to_type_size as usize,
                              if to_type_size == 1 {""} else {"s"}));
             } else {
                 ccx.sess().span_err(
@@ -132,10 +132,10 @@ pub fn check_intrinsics(ccx: &CrateContext) {
                     &format!("transmute called on types with different sizes: \
                               {} ({} bit{}) to {} ({} bit{})",
                              ty_to_string(ccx.tcx(), transmute_restriction.original_from),
-                             from_type_size as uint,
+                             from_type_size as usize,
                              if from_type_size == 1 {""} else {"s"},
                              ty_to_string(ccx.tcx(), transmute_restriction.original_to),
-                             to_type_size as uint,
+                             to_type_size as usize,
                              if to_type_size == 1 {""} else {"s"}));
             }
         }
@@ -359,11 +359,18 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
                 &ccx.link_meta().crate_hash);
             C_u64(ccx, hash)
         }
+        (_, "init_dropped") => {
+            let tp_ty = *substs.types.get(FnSpace, 0);
+            if !return_type_is_void(ccx, tp_ty) {
+                drop_done_fill_mem(bcx, llresult, tp_ty);
+            }
+            C_nil(ccx)
+        }
         (_, "init") => {
             let tp_ty = *substs.types.get(FnSpace, 0);
             if !return_type_is_void(ccx, tp_ty) {
                 // Just zero out the stack slot. (See comment on base::memzero for explanation)
-                zero_mem(bcx, llresult, tp_ty);
+                init_zero_mem(bcx, llresult, tp_ty);
             }
             C_nil(ccx)
         }
@@ -391,8 +398,8 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
                            false,
                            false,
                            *substs.types.get(FnSpace, 0),
-                           llargs[0],
                            llargs[1],
+                           llargs[0],
                            llargs[2],
                            call_debug_location)
         }
@@ -401,8 +408,8 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
                            true,
                            false,
                            *substs.types.get(FnSpace, 0),
-                           llargs[0],
                            llargs[1],
+                           llargs[0],
                            llargs[2],
                            call_debug_location)
         }
index 9b17c4f8baac9818afe039966f0767c88757ed13..ce37d38dc894fb3ff2efcedfca6c705bf8d0266c 100644 (file)
@@ -99,7 +99,7 @@ pub fn llalign_of_min(cx: &CrateContext, ty: Type) -> llalign {
     }
 }
 
-pub fn llelement_offset(cx: &CrateContext, struct_ty: Type, element: uint) -> u64 {
+pub fn llelement_offset(cx: &CrateContext, struct_ty: Type, element: usize) -> u64 {
     unsafe {
         return llvm::LLVMOffsetOfElement(cx.td().lltd, struct_ty.to_ref(),
                                          element as u32);
index 1a38b3d142676f1a717c395a702d4a6a5302e0fe..190e44c9674cb5a13d10826aa60156fb15b40adc 100644 (file)
@@ -13,7 +13,7 @@
 use back::link;
 use llvm::{ValueRef, get_param};
 use metadata::csearch;
-use middle::subst::Substs;
+use middle::subst::{Subst, Substs};
 use middle::subst::VecPerParamSpace;
 use middle::subst;
 use middle::traits;
@@ -47,7 +47,7 @@
 use syntax::ptr::P;
 
 // drop_glue pointer, size, align.
-const VTABLE_OFFSET: uint = 3;
+const VTABLE_OFFSET: usize = 3;
 
 /// The main "translation" pass for methods.  Generates code
 /// for non-monomorphized methods only.  Other methods will
@@ -325,7 +325,7 @@ fn method_with_name(ccx: &CrateContext, impl_id: ast::DefId, name: ast::Name)
 fn trans_monomorphized_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                           method_call: MethodCall,
                                           trait_id: ast::DefId,
-                                          n_method: uint,
+                                          n_method: usize,
                                           vtable: traits::Vtable<'tcx, ()>)
                                           -> Callee<'blk, 'tcx> {
     let _icx = push_ctxt("meth::trans_monomorphized_callee");
@@ -437,7 +437,7 @@ fn combine_impl_and_methods_tps<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 /// extract the self data and vtable out of the pair.
 fn trans_trait_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                   method_ty: Ty<'tcx>,
-                                  vtable_index: uint,
+                                  vtable_index: usize,
                                   self_expr: &ast::Expr,
                                   arg_cleanup_scope: cleanup::ScopeId)
                                   -> Callee<'blk, 'tcx> {
@@ -474,7 +474,7 @@ fn trans_trait_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 /// pair.
 pub fn trans_trait_callee_from_llval<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                                  callee_ty: Ty<'tcx>,
-                                                 vtable_index: uint,
+                                                 vtable_index: usize,
                                                  llpair: ValueRef)
                                                  -> Callee<'blk, 'tcx> {
     let _icx = push_ctxt("meth::trans_trait_callee");
@@ -547,7 +547,7 @@ pub fn trans_object_shim<'a, 'tcx>(
     ccx: &'a CrateContext<'a, 'tcx>,
     object_ty: Ty<'tcx>,
     upcast_trait_ref: ty::PolyTraitRef<'tcx>,
-    method_offset_in_trait: uint)
+    method_offset_in_trait: usize)
     -> (ValueRef, Ty<'tcx>)
 {
     let _icx = push_ctxt("trans_object_shim");
@@ -784,6 +784,7 @@ fn emit_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
 
     ty::populate_implementations_for_trait_if_necessary(tcx, trt_id);
 
+    let nullptr = C_null(Type::nil(ccx).ptr_to());
     let trait_item_def_ids = ty::trait_item_def_ids(tcx, trt_id);
     trait_item_def_ids
         .iter()
@@ -809,6 +810,12 @@ fn emit_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             };
             let name = trait_method_type.name;
 
+            // Some methods cannot be called on an object; skip those.
+            if !traits::is_vtable_safe_method(tcx, trt_id, &trait_method_type) {
+                debug!("emit_vtable_methods: not vtable safe");
+                return nullptr;
+            }
+
             debug!("emit_vtable_methods: trait_method_type={}",
                    trait_method_type.repr(tcx));
 
@@ -820,35 +827,17 @@ fn emit_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                 ty::TypeTraitItem(_) => ccx.sess().bug("should be a method, not assoc type")
             };
 
-            debug!("emit_vtable_methods: m={}",
+            debug!("emit_vtable_methods: impl_method_type={}",
                    impl_method_type.repr(tcx));
 
-            let nullptr = C_null(Type::nil(ccx).ptr_to());
-
-            if impl_method_type.generics.has_type_params(subst::FnSpace) {
-                debug!("emit_vtable_methods: generic");
-                return nullptr;
-            }
-
-            let bare_fn_ty =
-                ty::mk_bare_fn(tcx, None, tcx.mk_bare_fn(impl_method_type.fty.clone()));
-            if ty::type_has_self(bare_fn_ty) {
-                debug!("emit_vtable_methods: type_has_self {}",
-                       bare_fn_ty.repr(tcx));
-                return nullptr;
-            }
-
             // If this is a default method, it's possible that it
             // relies on where clauses that do not hold for this
             // particular set of type parameters. Note that this
             // method could then never be called, so we do not want to
             // try and trans it, in that case. Issue #23435.
             if ty::provided_source(tcx, impl_method_def_id).is_some() {
-                let predicates =
-                    monomorphize::apply_param_substs(tcx,
-                                                     &substs,
-                                                     &impl_method_type.predicates.predicates);
-                if !predicates_hold(ccx, predicates.into_vec()) {
+                let predicates = impl_method_type.predicates.predicates.subst(tcx, &substs);
+                if !normalize_and_test_predicates(ccx, predicates.into_vec()) {
                     debug!("emit_vtable_methods: predicates do not hold");
                     return nullptr;
                 }
index 6a35a1a55b6f7cd9ecabc842d432b08e8421ea0e..34dfb0eebcf9d47cfb7cacbce210dd8d35f175f1 100644 (file)
@@ -12,7 +12,7 @@
 
 use back::abi;
 use llvm;
-use llvm::{ValueRef};
+use llvm::ValueRef;
 use trans::base::*;
 use trans::base;
 use trans::build::*;
@@ -265,7 +265,7 @@ fn vec_types<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, unit_ty: Ty<'tcx>)
     }
 }
 
-fn elements_required(bcx: Block, content_expr: &ast::Expr) -> uint {
+fn elements_required(bcx: Block, content_expr: &ast::Expr) -> usize {
     //! Figure out the number of elements we need to store this content
 
     match content_expr.node {
@@ -291,7 +291,7 @@ fn elements_required(bcx: Block, content_expr: &ast::Expr) -> uint {
 /// which should be by ref.
 pub fn get_fixed_base_and_len(bcx: Block,
                               llval: ValueRef,
-                              vec_length: uint)
+                              vec_length: usize)
                               -> (ValueRef, ValueRef) {
     let ccx = bcx.ccx();
 
index dcb57fd9cdebd8ebd0406cac204ed6f70dad255b..339b4734ee4b1b82da3ed88cf46794314666ade2 100644 (file)
@@ -118,7 +118,7 @@ pub fn int(ccx: &CrateContext) -> Type {
 
     pub fn int_from_ty(ccx: &CrateContext, t: ast::IntTy) -> Type {
         match t {
-            ast::TyIs(_) => ccx.int_type(),
+            ast::TyIs => ccx.int_type(),
             ast::TyI8 => Type::i8(ccx),
             ast::TyI16 => Type::i16(ccx),
             ast::TyI32 => Type::i32(ccx),
@@ -128,7 +128,7 @@ pub fn int_from_ty(ccx: &CrateContext, t: ast::IntTy) -> Type {
 
     pub fn uint_from_ty(ccx: &CrateContext, t: ast::UintTy) -> Type {
         match t {
-            ast::TyUs(_) => ccx.int_type(),
+            ast::TyUs => ccx.int_type(),
             ast::TyU8 => Type::i8(ccx),
             ast::TyU16 => Type::i16(ccx),
             ast::TyU32 => Type::i32(ccx),
@@ -239,21 +239,21 @@ pub fn element_type(&self) -> Type {
     }
 
     /// Return the number of elements in `self` if it is a LLVM vector type.
-    pub fn vector_length(&self) -> uint {
+    pub fn vector_length(&self) -> usize {
         unsafe {
-            llvm::LLVMGetVectorSize(self.to_ref()) as uint
+            llvm::LLVMGetVectorSize(self.to_ref()) as usize
         }
     }
 
-    pub fn array_length(&self) -> uint {
+    pub fn array_length(&self) -> usize {
         unsafe {
-            llvm::LLVMGetArrayLength(self.to_ref()) as uint
+            llvm::LLVMGetArrayLength(self.to_ref()) as usize
         }
     }
 
     pub fn field_types(&self) -> Vec<Type> {
         unsafe {
-            let n_elts = llvm::LLVMCountStructElementTypes(self.to_ref()) as uint;
+            let n_elts = llvm::LLVMCountStructElementTypes(self.to_ref()) as usize;
             if n_elts == 0 {
                 return Vec::new();
             }
@@ -270,7 +270,7 @@ pub fn return_type(&self) -> Type {
 
     pub fn func_params(&self) -> Vec<Type> {
         unsafe {
-            let n_args = llvm::LLVMCountParamTypes(self.to_ref()) as uint;
+            let n_args = llvm::LLVMCountParamTypes(self.to_ref()) as usize;
             let mut args: Vec<_> = repeat(Type { rf: ptr::null_mut() }).take(n_args).collect();
             llvm::LLVMGetParamTypes(self.to_ref(),
                                     args.as_mut_ptr() as *mut TypeRef);
@@ -278,7 +278,7 @@ pub fn func_params(&self) -> Vec<Type> {
         }
     }
 
-    pub fn float_width(&self) -> uint {
+    pub fn float_width(&self) -> usize {
         match self.kind() {
             Float => 32,
             Double => 64,
index 8d228c22c3cfa54056cedc2fdc0b7da4d1eb5d0b..2e577a0bd19b0a0e232dd0a01de4e1a86fd2723d 100644 (file)
@@ -21,6 +21,7 @@
 
 use trans::type_::Type;
 
+#[allow(deprecated)]
 use std::num::Int;
 use syntax::abi;
 use syntax::ast;
@@ -361,7 +362,7 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
                   let unsized_part = unsized_part_of_type(cx.tcx(), ty);
                   let info_ty = match unsized_part.sty {
                       ty::ty_str | ty::ty_vec(..) => {
-                          Type::uint_from_ty(cx, ast::TyUs(false))
+                          Type::uint_from_ty(cx, ast::TyUs)
                       }
                       ty::ty_trait(_) => Type::vtable_ptr(cx),
                       _ => panic!("Unexpected type returned from \
index 464522f167b472b6aa46667095e1b1ba999bc547..c2d91e4e160248925d084b34c5e259515b0645f9 100644 (file)
@@ -107,7 +107,7 @@ pub fn user_iter(self) -> Users {
 
     /// Returns the requested operand of this instruction
     /// Returns None, if there's no operand at the given index
-    pub fn get_operand(self, i: uint) -> Option<Value> {
+    pub fn get_operand(self, i: usize) -> Option<Value> {
         opt_val!(llvm::LLVMGetOperand(self.get(), i as c_uint))
     }
 
index e9de8bd879e202342cbe00df6e0d61ec3adf812c..0d6ca7430d38ed0792bba57990444c3697090ea4 100644 (file)
@@ -504,9 +504,9 @@ fn convert_angle_bracketed_parameters<'tcx>(this: &AstConv<'tcx>,
 /// (if one exists) and a vector of the (pattern, number of lifetimes)
 /// corresponding to each input type/pattern.
 fn find_implied_output_region(input_tys: &[Ty], input_pats: Vec<String>)
-                              -> (Option<ty::Region>, Vec<(String, uint)>)
+                              -> (Option<ty::Region>, Vec<(String, usize)>)
 {
-    let mut lifetimes_for_params: Vec<(String, uint)> = Vec::new();
+    let mut lifetimes_for_params: Vec<(String, usize)> = Vec::new();
     let mut possible_implied_output_region = None;
 
     for (input_type, input_pat) in input_tys.iter().zip(input_pats.into_iter()) {
@@ -534,7 +534,7 @@ fn find_implied_output_region(input_tys: &[Ty], input_pats: Vec<String>)
 
 fn convert_ty_with_lifetime_elision<'tcx>(this: &AstConv<'tcx>,
                                           implied_output_region: Option<ty::Region>,
-                                          param_lifetimes: Vec<(String, uint)>,
+                                          param_lifetimes: Vec<(String, usize)>,
                                           ty: &ast::Ty)
                                           -> Ty<'tcx>
 {
@@ -1401,15 +1401,15 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
             ty
         }
         ast::TyFixedLengthVec(ref ty, ref e) => {
-            match const_eval::eval_const_expr_partial(tcx, &**e, Some(tcx.types.uint)) {
+            match const_eval::eval_const_expr_partial(tcx, &**e, Some(tcx.types.usize)) {
                 Ok(r) => {
                     match r {
                         const_eval::const_int(i) =>
                             ty::mk_vec(tcx, ast_ty_to_ty(this, rscope, &**ty),
-                                        Some(i as uint)),
+                                        Some(i as usize)),
                         const_eval::const_uint(i) =>
                             ty::mk_vec(tcx, ast_ty_to_ty(this, rscope, &**ty),
-                                        Some(i as uint)),
+                                        Some(i as usize)),
                         _ => {
                             span_err!(tcx.sess, ast_ty.span, E0249,
                                       "expected constant expr for array length");
@@ -1666,7 +1666,7 @@ fn determine_explicit_self_category<'a, 'tcx>(this: &AstConv<'tcx>,
         }
     };
 
-    fn count_modifiers(ty: Ty) -> uint {
+    fn count_modifiers(ty: Ty) -> usize {
         match ty.sty {
             ty::ty_rptr(_, mt) => count_modifiers(mt.ty) + 1,
             ty::ty_uniq(t) => count_modifiers(t) + 1,
index e8da19efa06afd790bb966de830e877e5f9e498f..8f1a67723cb79c90dc06e35af8a30dde6124724a 100644 (file)
@@ -12,7 +12,7 @@
 use middle::def;
 use middle::infer;
 use middle::pat_util::{PatIdMap, pat_id_map, pat_is_binding, pat_is_const};
-use middle::subst::{Substs};
+use middle::subst::Substs;
 use middle::ty::{self, Ty};
 use check::{check_expr, check_expr_has_type, check_expr_with_expectation};
 use check::{check_expr_coercable_to_type, demand, FnCtxt, Expectation};
index 6ba21e25e1fe5c62d48f4ca1c1f65465893005a5..31ac0a57ba0e14361d7c990855a02f01c1048e42 100644 (file)
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 use super::autoderef;
-use super::AutorefArgs;
 use super::check_argument_types;
 use super::check_expr;
 use super::check_method_argument_types;
@@ -258,7 +257,6 @@ fn confirm_builtin_call<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                          &fn_sig.inputs,
                          &expected_arg_tys[..],
                          arg_exprs,
-                         AutorefArgs::No,
                          fn_sig.variadic,
                          TupleArgumentsFlag::DontTupleArguments);
 
@@ -288,7 +286,6 @@ fn confirm_deferred_closure_call<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                          &*fn_sig.inputs,
                          &*expected_arg_tys,
                          arg_exprs,
-                         AutorefArgs::No,
                          fn_sig.variadic,
                          TupleArgumentsFlag::TupleArguments);
 
@@ -308,7 +305,6 @@ fn confirm_overloaded_call<'a,'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                     method_callee.ty,
                                     callee_expr,
                                     arg_exprs,
-                                    AutorefArgs::No,
                                     TupleArgumentsFlag::TupleArguments,
                                     expected);
     write_call(fcx, call_expr, output_type);
index 1e1d7e0926038ee833713e13e6f1ca8b7928bbae..1c5f2c5607857bfb2ccb923238500431054e1b3a 100644 (file)
@@ -15,7 +15,7 @@
 use util::ppaux::{self, Repr};
 
 use syntax::ast;
-use syntax::codemap::{Span};
+use syntax::codemap::Span;
 use syntax::parse::token;
 
 use super::assoc;
index c48033cab897f612c1a371d365340655c634dcda..49f4399b2c7b43b32638072928b096ef9be7a3b4 100644 (file)
@@ -339,8 +339,8 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'tcx>(
     ty_root: ty::Ty<'tcx>,
     span: Span,
     scope: region::CodeExtent,
-    depth: uint,
-    xref_depth: uint) -> Result<(), Error<'tcx>>
+    depth: usize,
+    xref_depth: usize) -> Result<(), Error<'tcx>>
 {
     // Issue #22443: Watch out for overflow. While we are careful to
     // handle regular types properly, non-regular ones cause problems.
index 6b4a7761d0a9b836bf913d611d03aea86f7b3bac..a4a18c7cfdea6722908ec88400c9e15aa050a59f 100644 (file)
@@ -12,7 +12,7 @@
 
 use astconv::object_region_bounds;
 use middle::infer::{InferCtxt, GenericKind};
-use middle::subst::{Substs};
+use middle::subst::Substs;
 use middle::traits;
 use middle::ty::{self, ToPolyTraitRef, Ty};
 use middle::ty_fold::{TypeFoldable, TypeFolder};
index 7ef2db2c28d883f59c4f36a2fd34120aad269704..af33cdb39326371cbe42205ad6c3d92ef8ed5c96 100644 (file)
@@ -11,7 +11,7 @@
 //! Method lookup: the secret sauce of Rust. See `README.md`.
 
 use astconv::AstConv;
-use check::{FnCtxt};
+use check::FnCtxt;
 use check::vtable;
 use check::vtable::select_new_fcx_obligations;
 use middle::def;
@@ -24,7 +24,7 @@
 use util::ppaux::Repr;
 
 use std::rc::Rc;
-use syntax::ast::{DefId};
+use syntax::ast::DefId;
 use syntax::ast;
 use syntax::codemap::Span;
 
@@ -58,7 +58,7 @@ pub enum CandidateSource {
     TraitSource(/* trait id */ ast::DefId),
 }
 
-type MethodIndex = uint; // just for doc purposes
+type MethodIndex = usize; // just for doc purposes
 
 /// Determines whether the type `self_ty` supports a method name `method_name` or not.
 pub fn exists<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
@@ -334,7 +334,7 @@ pub fn resolve_ufcs<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 fn trait_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                       trait_def_id: ast::DefId,
                       method_name: ast::Name)
-                      -> Option<(uint, Rc<ty::Method<'tcx>>)>
+                      -> Option<(usize, Rc<ty::Method<'tcx>>)>
 {
     let trait_items = ty::trait_items(tcx, trait_def_id);
     trait_items
index b95e0ce8cb3c59e512d65101884e5fbd1d9b1697..6349ea57f2ff15d96801592117cc9fc0ace1d2a5 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use super::{MethodError};
+use super::MethodError;
 use super::MethodIndex;
 use super::{CandidateSource,ImplSource,TraitSource};
 use super::suggest;
@@ -60,7 +60,7 @@ struct Candidate<'tcx> {
 
 enum CandidateKind<'tcx> {
     InherentImplCandidate(/* Impl */ ast::DefId, subst::Substs<'tcx>),
-    ObjectCandidate(/* Trait */ ast::DefId, /* method_num */ uint, /* vtable index */ uint),
+    ObjectCandidate(/* Trait */ ast::DefId, /* method_num */ usize, /* vtable index */ usize),
     ExtensionImplCandidate(/* Impl */ ast::DefId, Rc<ty::TraitRef<'tcx>>,
                            subst::Substs<'tcx>, MethodIndex),
     ClosureCandidate(/* Trait */ ast::DefId, MethodIndex),
@@ -77,7 +77,7 @@ pub struct Pick<'tcx> {
 #[derive(Clone,Debug)]
 pub enum PickKind<'tcx> {
     InherentImplPick(/* Impl */ ast::DefId),
-    ObjectPick(/* Trait */ ast::DefId, /* method_num */ uint, /* real_index */ uint),
+    ObjectPick(/* Trait */ ast::DefId, /* method_num */ usize, /* real_index */ usize),
     ExtensionImplPick(/* Impl */ ast::DefId, MethodIndex),
     TraitPick(/* Trait */ ast::DefId, MethodIndex),
     WhereClausePick(/* Trait */ ty::PolyTraitRef<'tcx>, MethodIndex),
@@ -94,14 +94,14 @@ pub enum PickAdjustment {
     // Indicates that the source expression should be autoderef'd N times
     //
     // A = expr | *expr | **expr
-    AutoDeref(uint),
+    AutoDeref(usize),
 
     // Indicates that the source expression should be autoderef'd N
     // times and then "unsized". This should probably eventually go
     // away in favor of just coercing method receivers.
     //
     // A = unsize(expr | *expr | **expr)
-    AutoUnsizeLength(/* number of autoderefs */ uint, /* length*/ uint),
+    AutoUnsizeLength(/* number of autoderefs */ usize, /* length*/ usize),
 
     // Indicates that an autoref is applied after some number of other adjustments
     //
@@ -325,7 +325,7 @@ fn assemble_probe(&mut self, self_ty: Ty<'tcx>) {
                 let lang_def_id = self.tcx().lang_items.i64_impl();
                 self.assemble_inherent_impl_for_primitive(lang_def_id);
             }
-            ty::ty_int(ast::TyIs(_)) => {
+            ty::ty_int(ast::TyIs) => {
                 let lang_def_id = self.tcx().lang_items.isize_impl();
                 self.assemble_inherent_impl_for_primitive(lang_def_id);
             }
@@ -345,7 +345,7 @@ fn assemble_probe(&mut self, self_ty: Ty<'tcx>) {
                 let lang_def_id = self.tcx().lang_items.u64_impl();
                 self.assemble_inherent_impl_for_primitive(lang_def_id);
             }
-            ty::ty_uint(ast::TyUs(_)) => {
+            ty::ty_uint(ast::TyUs) => {
                 let lang_def_id = self.tcx().lang_items.usize_impl();
                 self.assemble_inherent_impl_for_primitive(lang_def_id);
             }
@@ -526,7 +526,7 @@ fn elaborate_bounds<F>(
             &mut ProbeContext<'b, 'tcx>,
             ty::PolyTraitRef<'tcx>,
             Rc<ty::Method<'tcx>>,
-            uint,
+            usize,
         ),
     {
         debug!("elaborate_bounds(bounds={})", bounds.repr(self.tcx()));
@@ -625,7 +625,7 @@ fn assemble_extension_candidates_for_trait(&mut self,
     fn assemble_extension_candidates_for_trait_impls(&mut self,
                                                      trait_def_id: ast::DefId,
                                                      method: Rc<ty::Method<'tcx>>,
-                                                     method_index: uint)
+                                                     method_index: usize)
     {
         ty::populate_implementations_for_trait_if_necessary(self.tcx(),
                                                             trait_def_id);
@@ -692,7 +692,7 @@ fn impl_can_possibly_match(&self, impl_def_id: ast::DefId) -> bool {
     fn assemble_closure_candidates(&mut self,
                                    trait_def_id: ast::DefId,
                                    method_ty: Rc<ty::Method<'tcx>>,
-                                   method_index: uint)
+                                   method_index: usize)
                                    -> Result<(),MethodError>
     {
         // Check if this is one of the Fn,FnMut,FnOnce traits.
@@ -754,7 +754,7 @@ fn assemble_closure_candidates(&mut self,
     fn assemble_projection_candidates(&mut self,
                                       trait_def_id: ast::DefId,
                                       method: Rc<ty::Method<'tcx>>,
-                                      method_index: uint)
+                                      method_index: usize)
     {
         debug!("assemble_projection_candidates(\
                trait_def_id={}, \
@@ -815,7 +815,7 @@ fn assemble_projection_candidates(&mut self,
     fn assemble_where_clause_candidates(&mut self,
                                         trait_def_id: ast::DefId,
                                         method_ty: Rc<ty::Method<'tcx>>,
-                                        method_index: uint)
+                                        method_index: usize)
     {
         debug!("assemble_where_clause_candidates(trait_def_id={})",
                trait_def_id.repr(self.tcx()));
@@ -933,7 +933,7 @@ fn pick_by_value_method(&mut self,
 
         return self.pick_method(step.self_ty).map(|r| self.adjust(r, adjustment.clone()));
 
-        fn consider_reborrow<'tcx>(ty: Ty<'tcx>, d: uint) -> PickAdjustment {
+        fn consider_reborrow<'tcx>(ty: Ty<'tcx>, d: usize) -> PickAdjustment {
             // Insert a `&*` or `&mut *` if this is a reference type:
             match ty.sty {
                 ty::ty_rptr(_, ref mt) => AutoRef(mt.mutbl, box AutoDeref(d+1)),
@@ -1100,7 +1100,7 @@ fn consider_probe(&self, self_ty: Ty<'tcx>, probe: &Candidate<'tcx>) -> bool {
     /// ```
     /// trait Foo { ... }
     /// impl Foo for Vec<int> { ... }
-    /// impl Foo for Vec<uint> { ... }
+    /// impl Foo for Vec<usize> { ... }
     /// ```
     ///
     /// Now imagine the receiver is `Vec<_>`. It doesn't really matter at this time which impl we
@@ -1281,7 +1281,7 @@ fn impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
 fn trait_method<'tcx>(tcx: &ty::ctxt<'tcx>,
                       trait_def_id: ast::DefId,
                       method_name: ast::Name)
-                      -> Option<(uint, Rc<ty::Method<'tcx>>)>
+                      -> Option<(usize, Rc<ty::Method<'tcx>>)>
 {
     let trait_items = ty::trait_items(tcx, trait_def_id);
     debug!("trait_method; items: {:?}", trait_items);
index 0f9836bc0734606cd504c05f52229fe9010f5ab5..16501ec280791d2886daffee7a0d39d9e71d4645 100644 (file)
@@ -79,7 +79,6 @@
 pub use self::LvaluePreference::*;
 pub use self::Expectation::*;
 pub use self::compare_method::compare_impl_method;
-use self::IsBinopAssignment::*;
 use self::TupleArgumentsFlag::*;
 
 use astconv::{self, ast_region_to_region, ast_ty_to_ty, AstConv, PathParamMode};
 mod closure;
 mod callee;
 mod compare_method;
+mod op;
 
 /// closures defined within the function.  For example:
 ///
@@ -288,15 +288,6 @@ pub fn recurse(&mut self, blk: &ast::Block) -> UnsafetyState {
     }
 }
 
-/// Whether `check_binop` is part of an assignment or not.
-/// Used to know whether we allow user overloads and to print
-/// better messages on error.
-#[derive(PartialEq)]
-enum IsBinopAssignment{
-    SimpleBinop,
-    BinopAssignment,
-}
-
 #[derive(Clone)]
 pub struct FnCtxt<'a, 'tcx: 'a> {
     body_id: ast::NodeId,
@@ -309,7 +300,7 @@ pub struct FnCtxt<'a, 'tcx: 'a> {
     // checking this function. On exit, if we find that *more* errors
     // have been reported, we will skip regionck and other work that
     // expects the types within the function to be consistent.
-    err_count_on_creation: uint,
+    err_count_on_creation: usize,
 
     ret_ty: ty::FnOutput<'tcx>,
 
@@ -467,7 +458,7 @@ fn visit_item(&mut self, i: &'tcx ast::Item) {
     fn visit_ty(&mut self, t: &'tcx ast::Ty) {
         match t.node {
             ast::TyFixedLengthVec(_, ref expr) => {
-                check_const_in_type(self.ccx, &**expr, self.ccx.tcx.types.uint);
+                check_const_in_type(self.ccx, &**expr, self.ccx.tcx.types.usize);
             }
             _ => {}
         }
@@ -611,7 +602,7 @@ fn visit_ty(&mut self, t: &'tcx ast::Ty) {
         match t.node {
             ast::TyFixedLengthVec(ref ty, ref count_expr) => {
                 self.visit_ty(&**ty);
-                check_expr_with_hint(self.fcx, &**count_expr, self.fcx.tcx().types.uint);
+                check_expr_with_hint(self.fcx, &**count_expr, self.fcx.tcx().types.usize);
             }
             _ => visit::walk_ty(self, t)
         }
@@ -1104,14 +1095,18 @@ fn cast_through_integer_err<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                 fcx.tcx().sess.add_lint(lint::builtin::TRIVIAL_NUMERIC_CASTS,
                                         e.id,
                                         span,
-                                        format!("trivial numeric cast: `{}` as `{}`",
+                                        format!("trivial numeric cast: `{}` as `{}`. Cast can be \
+                                                 replaced by coercion, this might require type \
+                                                 ascription or a temporary variable",
                                                 fcx.infcx().ty_to_string(t_e),
                                                 fcx.infcx().ty_to_string(t_1)));
             } else {
                 fcx.tcx().sess.add_lint(lint::builtin::TRIVIAL_CASTS,
                                         e.id,
                                         span,
-                                        format!("trivial cast: `{}` as `{}`",
+                                        format!("trivial cast: `{}` as `{}`. Cast can be \
+                                                 replaced by coercion, this might require type \
+                                                 ascription or a temporary variable",
                                                 fcx.infcx().ty_to_string(t_e),
                                                 fcx.infcx().ty_to_string(t_1)));
             }
@@ -1313,7 +1308,7 @@ pub fn sess(&self) -> &Session {
         &self.tcx().sess
     }
 
-    pub fn err_count_since_creation(&self) -> uint {
+    pub fn err_count_since_creation(&self) -> usize {
         self.ccx.tcx.sess.err_count() - self.err_count_on_creation
     }
 
@@ -1321,14 +1316,18 @@ pub fn err_count_since_creation(&self) -> uint {
     /// version, this version will also select obligations if it seems
     /// useful, in an effort to get more type information.
     fn resolve_type_vars_if_possible(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
+        debug!("resolve_type_vars_if_possible(ty={})", ty.repr(self.tcx()));
+
         // No ty::infer()? Nothing needs doing.
         if !ty::type_has_ty_infer(ty) {
+            debug!("resolve_type_vars_if_possible: ty={}", ty.repr(self.tcx()));
             return ty;
         }
 
         // If `ty` is a type variable, see whether we already know what it is.
         ty = self.infcx().resolve_type_vars_if_possible(&ty);
         if !ty::type_has_ty_infer(ty) {
+            debug!("resolve_type_vars_if_possible: ty={}", ty.repr(self.tcx()));
             return ty;
         }
 
@@ -1336,6 +1335,7 @@ fn resolve_type_vars_if_possible(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
         vtable::select_new_fcx_obligations(self);
         ty = self.infcx().resolve_type_vars_if_possible(&ty);
         if !ty::type_has_ty_infer(ty) {
+            debug!("resolve_type_vars_if_possible: ty={}", ty.repr(self.tcx()));
             return ty;
         }
 
@@ -1344,7 +1344,10 @@ fn resolve_type_vars_if_possible(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
         // indirect dependencies that don't seem worth tracking
         // precisely.
         vtable::select_fcx_obligations_where_possible(self);
-        self.infcx().resolve_type_vars_if_possible(&ty)
+        ty = self.infcx().resolve_type_vars_if_possible(&ty);
+
+        debug!("resolve_type_vars_if_possible: ty={}", ty.repr(self.tcx()));
+        ty
     }
 
     /// Resolves all type variables in `t` and then, if any were left
@@ -1432,7 +1435,7 @@ pub fn write_substs(&self, node_id: ast::NodeId, substs: ty::ItemSubsts<'tcx>) {
     pub fn write_autoderef_adjustment(&self,
                                       node_id: ast::NodeId,
                                       span: Span,
-                                      derefs: uint) {
+                                      derefs: usize) {
         if derefs == 0 { return; }
         self.write_adjustment(
             node_id,
@@ -1909,7 +1912,7 @@ pub fn lookup_tup_field_ty(&self,
                                span: Span,
                                class_id: ast::DefId,
                                items: &[ty::field_ty],
-                               idx: uint,
+                               idx: usize,
                                substs: &subst::Substs<'tcx>)
                                -> Option<Ty<'tcx>>
     {
@@ -1940,8 +1943,8 @@ fn object_lifetime_default(&self, span: Span) -> Option<ty::Region> {
         Some(self.infcx().next_region_var(infer::MiscVariable(span)))
     }
 
-    fn anon_regions(&self, span: Span, count: uint)
-                    -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>> {
+    fn anon_regions(&self, span: Span, count: usize)
+                    -> Result<Vec<ty::Region>, Option<Vec<(String, usize)>>> {
         Ok((0..count).map(|_| {
             self.infcx().next_region_var(infer::MiscVariable(span))
         }).collect())
@@ -1977,8 +1980,8 @@ pub fn autoderef<'a, 'tcx, T, F>(fcx: &FnCtxt<'a, 'tcx>,
                                  unresolved_type_action: UnresolvedTypeAction,
                                  mut lvalue_pref: LvaluePreference,
                                  mut should_stop: F)
-                                 -> (Ty<'tcx>, uint, Option<T>)
-    where F: FnMut(Ty<'tcx>, uint) -> Option<T>,
+                                 -> (Ty<'tcx>, usize, Option<T>)
+    where F: FnMut(Ty<'tcx>, usize) -> Option<T>,
 {
     debug!("autoderef(base_ty={}, opt_expr={}, lvalue_pref={:?})",
            base_ty.repr(fcx.tcx()),
@@ -2088,24 +2091,17 @@ fn make_overloaded_lvalue_return_type<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 {
     match method {
         Some(method) => {
-            let ref_ty = // invoked methods have all LB regions instantiated
-                ty::no_late_bound_regions(
-                    fcx.tcx(), &ty::ty_fn_ret(method.ty)).unwrap();
-            match method_call {
-                Some(method_call) => {
-                    fcx.inh.method_map.borrow_mut().insert(method_call,
-                                                           method);
-                }
-                None => {}
-            }
-            match ref_ty {
-                ty::FnConverging(ref_ty) => {
-                    ty::deref(ref_ty, true)
-                }
-                ty::FnDiverging => {
-                    fcx.tcx().sess.bug("index/deref traits do not define a `!` return")
-                }
+            // extract method method return type, which will be &T;
+            // all LB regions should have been instantiated during method lookup
+            let ret_ty = ty::ty_fn_ret(method.ty);
+            let ret_ty = ty::no_late_bound_regions(fcx.tcx(), &ret_ty).unwrap().unwrap();
+
+            if let Some(method_call) = method_call {
+                fcx.inh.method_map.borrow_mut().insert(method_call, method);
             }
+
+            // method returns &T, but the type as visible to user is T, so deref
+            ty::deref(ret_ty, true)
         }
         None => None,
     }
@@ -2181,10 +2177,10 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 
     // First, try built-in indexing.
     match (ty::index(adjusted_ty), &index_ty.sty) {
-        (Some(ty), &ty::ty_uint(ast::TyUs(_))) | (Some(ty), &ty::ty_infer(ty::IntVar(_))) => {
+        (Some(ty), &ty::ty_uint(ast::TyUs)) | (Some(ty), &ty::ty_infer(ty::IntVar(_))) => {
             debug!("try_index_step: success, using built-in indexing");
             fcx.write_adjustment(base_expr.id, base_expr.span, ty::AdjustDerefRef(adjustment));
-            return Some((tcx.types.uint, ty));
+            return Some((tcx.types.usize, ty));
         }
         _ => {}
     }
@@ -2234,7 +2230,6 @@ fn check_method_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                          method_fn_ty: Ty<'tcx>,
                                          callee_expr: &'tcx ast::Expr,
                                          args_no_rcvr: &'tcx [P<ast::Expr>],
-                                         autoref_args: AutorefArgs,
                                          tuple_arguments: TupleArgumentsFlag,
                                          expected: Expectation<'tcx>)
                                          -> ty::FnOutput<'tcx> {
@@ -2251,7 +2246,6 @@ fn check_method_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                              &err_inputs[..],
                              &[],
                              args_no_rcvr,
-                             autoref_args,
                              false,
                              tuple_arguments);
         ty::FnConverging(fcx.tcx().types.err)
@@ -2269,7 +2263,6 @@ fn check_method_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                      &fty.sig.0.inputs[1..],
                                      &expected_arg_tys[..],
                                      args_no_rcvr,
-                                     autoref_args,
                                      fty.sig.0.variadic,
                                      tuple_arguments);
                 fty.sig.0.output
@@ -2289,7 +2282,6 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                   fn_inputs: &[Ty<'tcx>],
                                   expected_arg_tys: &[Ty<'tcx>],
                                   args: &'tcx [P<ast::Expr>],
-                                  autoref_args: AutorefArgs,
                                   variadic: bool,
                                   tuple_arguments: TupleArgumentsFlag) {
     let tcx = fcx.ccx.tcx;
@@ -2402,26 +2394,7 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 
             if is_block == check_blocks {
                 debug!("checking the argument");
-                let mut formal_ty = formal_tys[i];
-
-                match autoref_args {
-                    AutorefArgs::Yes => {
-                        match formal_ty.sty {
-                            ty::ty_rptr(_, mt) => formal_ty = mt.ty,
-                            ty::ty_err => (),
-                            _ => {
-                                // So we hit this case when one implements the
-                                // operator traits but leaves an argument as
-                                // just T instead of &T. We'll catch it in the
-                                // mismatch impl/trait method phase no need to
-                                // ICE here.
-                                // See: #11450
-                                formal_ty = tcx.types.err;
-                            }
-                        }
-                    }
-                    AutorefArgs::No => {}
-                }
+                let formal_ty = formal_tys[i];
 
                 // The special-cased logic below has three functions:
                 // 1. Provide as good of an expected type as possible.
@@ -2485,7 +2458,7 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 }
 
 // FIXME(#17596) Ty<'tcx> is incorrectly invariant w.r.t 'tcx.
-fn err_args<'tcx>(tcx: &ty::ctxt<'tcx>, len: uint) -> Vec<Ty<'tcx>> {
+fn err_args<'tcx>(tcx: &ty::ctxt<'tcx>, len: usize) -> Vec<Ty<'tcx>> {
     (0..len).map(|_| tcx.types.err).collect()
 }
 
@@ -2523,8 +2496,8 @@ fn check_lit<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                 match ty.sty {
                     ty::ty_int(_) | ty::ty_uint(_) => Some(ty),
                     ty::ty_char => Some(tcx.types.u8),
-                    ty::ty_ptr(..) => Some(tcx.types.uint),
-                    ty::ty_bare_fn(..) => Some(tcx.types.uint),
+                    ty::ty_ptr(..) => Some(tcx.types.usize),
+                    ty::ty_bare_fn(..) => Some(tcx.types.usize),
                     _ => None
                 }
             });
@@ -2618,14 +2591,6 @@ pub fn impl_self_ty<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     TypeAndSubsts { substs: substs, ty: substd_ty }
 }
 
-// Controls whether the arguments are automatically referenced. This is useful
-// for overloaded binary and unary operators.
-#[derive(Copy, PartialEq)]
-pub enum AutorefArgs {
-    Yes,
-    No,
-}
-
 /// Controls whether the arguments are tupled. This is used for the call
 /// operator.
 ///
@@ -2633,7 +2598,7 @@ pub enum AutorefArgs {
 /// passed as a single parameter. For example, if tupling is enabled, this
 /// function:
 ///
-///     fn f(x: (int, int))
+///     fn f(x: (isize, isize))
 ///
 /// Can be called as:
 ///
@@ -2751,7 +2716,6 @@ fn check_method_call<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                                  fn_ty,
                                                  expr,
                                                  &args[1..],
-                                                 AutorefArgs::No,
                                                  DontTupleArguments,
                                                  expected);
 
@@ -2802,277 +2766,6 @@ fn check_then_else<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         fcx.write_ty(id, if_ty);
     }
 
-    fn lookup_op_method<'a, 'tcx, F>(fcx: &'a FnCtxt<'a, 'tcx>,
-                                     op_ex: &'tcx ast::Expr,
-                                     lhs_ty: Ty<'tcx>,
-                                     opname: ast::Name,
-                                     trait_did: Option<ast::DefId>,
-                                     lhs: &'a ast::Expr,
-                                     rhs: Option<&'tcx P<ast::Expr>>,
-                                     unbound_method: F,
-                                     autoref_args: AutorefArgs) -> Ty<'tcx> where
-        F: FnOnce(),
-    {
-        let method = match trait_did {
-            Some(trait_did) => {
-                // We do eager coercions to make using operators
-                // more ergonomic:
-                //
-                // - If the input is of type &'a T (resp. &'a mut T),
-                //   then reborrow it to &'b T (resp. &'b mut T) where
-                //   'b <= 'a.  This makes things like `x == y`, where
-                //   `x` and `y` are both region pointers, work.  We
-                //   could also solve this with variance or different
-                //   traits that don't force left and right to have same
-                //   type.
-                let (adj_ty, adjustment) = match lhs_ty.sty {
-                    ty::ty_rptr(r_in, mt) => {
-                        let r_adj = fcx.infcx().next_region_var(infer::Autoref(lhs.span));
-                        fcx.mk_subr(infer::Reborrow(lhs.span), r_adj, *r_in);
-                        let adjusted_ty = ty::mk_rptr(fcx.tcx(), fcx.tcx().mk_region(r_adj), mt);
-                        let autoptr = ty::AutoPtr(r_adj, mt.mutbl, None);
-                        let adjustment = ty::AutoDerefRef { autoderefs: 1, autoref: Some(autoptr) };
-                        (adjusted_ty, adjustment)
-                    }
-                    _ => {
-                        (lhs_ty, ty::AutoDerefRef { autoderefs: 0, autoref: None })
-                    }
-                };
-
-                debug!("adjusted_ty={} adjustment={:?}",
-                       adj_ty.repr(fcx.tcx()),
-                       adjustment);
-
-                method::lookup_in_trait_adjusted(fcx, op_ex.span, Some(lhs), opname,
-                                                 trait_did, adjustment, adj_ty, None)
-            }
-            None => None
-        };
-        let args = match rhs {
-            Some(rhs) => slice::ref_slice(rhs),
-            None => &[][..]
-        };
-        match method {
-            Some(method) => {
-                let method_ty = method.ty;
-                // HACK(eddyb) Fully qualified path to work around a resolve bug.
-                let method_call = ::middle::ty::MethodCall::expr(op_ex.id);
-                fcx.inh.method_map.borrow_mut().insert(method_call, method);
-                match check_method_argument_types(fcx,
-                                                  op_ex.span,
-                                                  method_ty,
-                                                  op_ex,
-                                                  args,
-                                                  autoref_args,
-                                                  DontTupleArguments,
-                                                  NoExpectation) {
-                    ty::FnConverging(result_type) => result_type,
-                    ty::FnDiverging => fcx.tcx().types.err
-                }
-            }
-            None => {
-                unbound_method();
-                // Check the args anyway
-                // so we get all the error messages
-                let expected_ty = fcx.tcx().types.err;
-                check_method_argument_types(fcx,
-                                            op_ex.span,
-                                            expected_ty,
-                                            op_ex,
-                                            args,
-                                            autoref_args,
-                                            DontTupleArguments,
-                                            NoExpectation);
-                fcx.tcx().types.err
-            }
-        }
-    }
-
-    // could be either an expr_binop or an expr_assign_binop
-    fn check_binop<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
-                            expr: &'tcx ast::Expr,
-                            op: ast::BinOp,
-                            lhs: &'tcx ast::Expr,
-                            rhs: &'tcx P<ast::Expr>,
-                            is_binop_assignment: IsBinopAssignment) {
-        let tcx = fcx.ccx.tcx;
-
-        let lvalue_pref = match is_binop_assignment {
-            BinopAssignment => PreferMutLvalue,
-            SimpleBinop => NoPreference
-        };
-        check_expr_with_lvalue_pref(fcx, lhs, lvalue_pref);
-
-        // Callee does bot / err checking
-        let lhs_t =
-            structurally_resolve_type_or_else(fcx, lhs.span, fcx.expr_ty(lhs), || {
-                if ast_util::is_symmetric_binop(op.node) {
-                    // Try RHS first
-                    check_expr(fcx, &**rhs);
-                    fcx.expr_ty(&**rhs)
-                } else {
-                    fcx.tcx().types.err
-                }
-            });
-
-        if ty::type_is_integral(lhs_t) && ast_util::is_shift_binop(op.node) {
-            // Shift is a special case: rhs must be uint, no matter what lhs is
-            check_expr(fcx, &**rhs);
-            let rhs_ty = fcx.expr_ty(&**rhs);
-            let rhs_ty = structurally_resolved_type(fcx, rhs.span, rhs_ty);
-            if ty::type_is_integral(rhs_ty) {
-                fcx.write_ty(expr.id, lhs_t);
-            } else {
-                fcx.type_error_message(
-                    expr.span,
-                    |actual| {
-                        format!(
-                            "right-hand-side of a shift operation must have integral type, \
-                             not `{}`",
-                            actual)
-                    },
-                    rhs_ty,
-                    None);
-                fcx.write_ty(expr.id, fcx.tcx().types.err);
-            }
-            return;
-        }
-
-        if ty::is_binopable(tcx, lhs_t, op) {
-            let tvar = fcx.infcx().next_ty_var();
-            demand::suptype(fcx, expr.span, tvar, lhs_t);
-            check_expr_has_type(fcx, &**rhs, tvar);
-
-            let result_t = match op.node {
-                ast::BiEq | ast::BiNe | ast::BiLt | ast::BiLe | ast::BiGe |
-                ast::BiGt => {
-                    if ty::type_is_simd(tcx, lhs_t) {
-                        if ty::type_is_fp(ty::simd_type(tcx, lhs_t)) {
-                            fcx.type_error_message(expr.span,
-                                |actual| {
-                                    format!("binary comparison \
-                                             operation `{}` not \
-                                             supported for floating \
-                                             point SIMD vector `{}`",
-                                            ast_util::binop_to_string(op.node),
-                                            actual)
-                                },
-                                lhs_t,
-                                None
-                            );
-                            fcx.tcx().types.err
-                        } else {
-                            lhs_t
-                        }
-                    } else {
-                        fcx.tcx().types.bool
-                    }
-                },
-                _ => lhs_t,
-            };
-
-            fcx.write_ty(expr.id, result_t);
-            return;
-        }
-
-        if op.node == ast::BiOr || op.node == ast::BiAnd {
-            // This is an error; one of the operands must have the wrong
-            // type
-            fcx.write_error(expr.id);
-            fcx.write_error(rhs.id);
-            fcx.type_error_message(expr.span,
-                                   |actual| {
-                    format!("binary operation `{}` cannot be applied \
-                             to type `{}`",
-                            ast_util::binop_to_string(op.node),
-                            actual)
-                },
-                lhs_t,
-                None)
-        }
-
-        // Check for overloaded operators if not an assignment.
-        let result_t = if is_binop_assignment == SimpleBinop {
-            check_user_binop(fcx, expr, lhs, lhs_t, op, rhs)
-        } else {
-            fcx.type_error_message(expr.span,
-                                   |actual| {
-                                        format!("binary assignment \
-                                                 operation `{}=` \
-                                                 cannot be applied to \
-                                                 type `{}`",
-                                                ast_util::binop_to_string(op.node),
-                                                actual)
-                                   },
-                                   lhs_t,
-                                   None);
-            check_expr(fcx, &**rhs);
-            fcx.tcx().types.err
-        };
-
-        fcx.write_ty(expr.id, result_t);
-        if ty::type_is_error(result_t) {
-            fcx.write_ty(rhs.id, result_t);
-        }
-    }
-
-    fn check_user_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
-                                  ex: &'tcx ast::Expr,
-                                  lhs_expr: &'tcx ast::Expr,
-                                  lhs_resolved_t: Ty<'tcx>,
-                                  op: ast::BinOp,
-                                  rhs: &'tcx P<ast::Expr>) -> Ty<'tcx> {
-        let tcx = fcx.ccx.tcx;
-        let lang = &tcx.lang_items;
-        let (name, trait_did) = match op.node {
-            ast::BiAdd => ("add", lang.add_trait()),
-            ast::BiSub => ("sub", lang.sub_trait()),
-            ast::BiMul => ("mul", lang.mul_trait()),
-            ast::BiDiv => ("div", lang.div_trait()),
-            ast::BiRem => ("rem", lang.rem_trait()),
-            ast::BiBitXor => ("bitxor", lang.bitxor_trait()),
-            ast::BiBitAnd => ("bitand", lang.bitand_trait()),
-            ast::BiBitOr => ("bitor", lang.bitor_trait()),
-            ast::BiShl => ("shl", lang.shl_trait()),
-            ast::BiShr => ("shr", lang.shr_trait()),
-            ast::BiLt => ("lt", lang.ord_trait()),
-            ast::BiLe => ("le", lang.ord_trait()),
-            ast::BiGe => ("ge", lang.ord_trait()),
-            ast::BiGt => ("gt", lang.ord_trait()),
-            ast::BiEq => ("eq", lang.eq_trait()),
-            ast::BiNe => ("ne", lang.eq_trait()),
-            ast::BiAnd | ast::BiOr => {
-                check_expr(fcx, &**rhs);
-                return tcx.types.err;
-            }
-        };
-        lookup_op_method(fcx, ex, lhs_resolved_t, token::intern(name),
-                         trait_did, lhs_expr, Some(rhs), || {
-            fcx.type_error_message(ex.span, |actual| {
-                format!("binary operation `{}` cannot be applied to type `{}`",
-                        ast_util::binop_to_string(op.node),
-                        actual)
-            }, lhs_resolved_t, None)
-        }, if ast_util::is_by_value_binop(op.node) { AutorefArgs::No } else { AutorefArgs::Yes })
-    }
-
-    fn check_user_unop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
-                                 op_str: &str,
-                                 mname: &str,
-                                 trait_did: Option<ast::DefId>,
-                                 ex: &'tcx ast::Expr,
-                                 rhs_expr: &'tcx ast::Expr,
-                                 rhs_t: Ty<'tcx>,
-                                 op: ast::UnOp) -> Ty<'tcx> {
-       lookup_op_method(fcx, ex, rhs_t, token::intern(mname),
-                        trait_did, rhs_expr, None, || {
-            fcx.type_error_message(ex.span, |actual| {
-                format!("cannot apply unary operator `{}` to type `{}`",
-                        op_str, actual)
-            }, rhs_t, None);
-        }, if ast_util::is_by_value_unop(op) { AutorefArgs::No } else { AutorefArgs::Yes })
-    }
-
     // Check field access expressions
     fn check_field<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                             expr: &'tcx ast::Expr,
@@ -3179,7 +2872,7 @@ fn check_tup_field<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                                 expr: &'tcx ast::Expr,
                                 lvalue_pref: LvaluePreference,
                                 base: &'tcx ast::Expr,
-                                idx: codemap::Spanned<uint>) {
+                                idx: codemap::Spanned<usize>) {
         let tcx = fcx.ccx.tcx;
         check_expr_with_lvalue_pref(fcx, base, lvalue_pref);
         let expr_t = structurally_resolved_type(fcx, expr.span,
@@ -3475,35 +3168,10 @@ fn check_struct_fields_on_error<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
         fcx.write_ty(id, typ);
       }
       ast::ExprBinary(op, ref lhs, ref rhs) => {
-        check_binop(fcx, expr, op, &**lhs, rhs, SimpleBinop);
-
-        let lhs_ty = fcx.expr_ty(&**lhs);
-        let rhs_ty = fcx.expr_ty(&**rhs);
-        if ty::type_is_error(lhs_ty) ||
-            ty::type_is_error(rhs_ty) {
-            fcx.write_error(id);
-        }
+        op::check_binop(fcx, expr, op, lhs, rhs);
       }
       ast::ExprAssignOp(op, ref lhs, ref rhs) => {
-        check_binop(fcx, expr, op, &**lhs, rhs, BinopAssignment);
-
-        let lhs_t = fcx.expr_ty(&**lhs);
-        let result_t = fcx.expr_ty(expr);
-        demand::suptype(fcx, expr.span, result_t, lhs_t);
-
-        let tcx = fcx.tcx();
-        if !ty::expr_is_lval(tcx, &**lhs) {
-            span_err!(tcx.sess, lhs.span, E0067, "illegal left-hand side expression");
-        }
-
-        fcx.require_expr_have_sized_type(&**lhs, traits::AssignmentLhsSized);
-
-        // Overwrite result of check_binop...this preserves existing behavior
-        // but seems quite dubious with regard to user-defined methods
-        // and so forth. - Niko
-        if !ty::type_is_error(result_t) {
-            fcx.write_nil(expr.id);
-        }
+        op::check_binop_assign(fcx, expr, op, lhs, rhs);
       }
       ast::ExprUnary(unop, ref oprnd) => {
         let expected_inner = expected.to_option(fcx).map_or(NoExpectation, |ty| {
@@ -3576,9 +3244,9 @@ fn check_struct_fields_on_error<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                                                          oprnd_t);
                     if !(ty::type_is_integral(oprnd_t) ||
                          oprnd_t.sty == ty::ty_bool) {
-                        oprnd_t = check_user_unop(fcx, "!", "not",
-                                                  tcx.lang_items.not_trait(),
-                                                  expr, &**oprnd, oprnd_t, unop);
+                        oprnd_t = op::check_user_unop(fcx, "!", "not",
+                                                      tcx.lang_items.not_trait(),
+                                                      expr, &**oprnd, oprnd_t, unop);
                     }
                 }
                 ast::UnNeg => {
@@ -3586,9 +3254,9 @@ fn check_struct_fields_on_error<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
                                                          oprnd_t);
                     if !(ty::type_is_integral(oprnd_t) ||
                          ty::type_is_fp(oprnd_t)) {
-                        oprnd_t = check_user_unop(fcx, "-", "neg",
-                                                  tcx.lang_items.neg_trait(),
-                                                  expr, &**oprnd, oprnd_t, unop);
+                        oprnd_t = op::check_user_unop(fcx, "-", "neg",
+                                                      tcx.lang_items.neg_trait(),
+                                                      expr, &**oprnd, oprnd_t, unop);
                     }
                 }
             }
@@ -3829,7 +3497,7 @@ fn check_struct_fields_on_error<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
       }
       ast::ExprCast(ref e, ref t) => {
         if let ast::TyFixedLengthVec(_, ref count_expr) = t.node {
-            check_expr_with_hint(fcx, &**count_expr, tcx.types.uint);
+            check_expr_with_hint(fcx, &**count_expr, tcx.types.usize);
         }
 
         // Find the type of `e`. Supply hints based on the type we are casting to,
@@ -3886,7 +3554,7 @@ fn check_struct_fields_on_error<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
         fcx.write_ty(id, typ);
       }
       ast::ExprRepeat(ref element, ref count_expr) => {
-        check_expr_has_type(fcx, &**count_expr, tcx.types.uint);
+        check_expr_has_type(fcx, &**count_expr, tcx.types.usize);
         let count = ty::eval_repeat_count(fcx.tcx(), &**count_expr);
 
         let uty = match expected {
@@ -4069,9 +3737,8 @@ fn check_struct_fields_on_error<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
 
                   match result {
                       Some((index_ty, element_ty)) => {
-                          // FIXME: we've already checked idx above, we should
-                          // probably just demand subtype or something here.
-                          check_expr_has_type(fcx, &**idx, index_ty);
+                          let idx_expr_ty = fcx.expr_ty(idx);
+                          demand::eqtype(fcx, expr.span, index_ty, idx_expr_ty);
                           fcx.write_ty(id, element_ty);
                       }
                       _ => {
@@ -4194,16 +3861,16 @@ impl<'tcx> Expectation<'tcx> {
     /// is useful in determining the concrete type.
     ///
     /// The primary use case is where the expected type is a fat pointer,
-    /// like `&[int]`. For example, consider the following statement:
+    /// like `&[isize]`. For example, consider the following statement:
     ///
-    ///    let x: &[int] = &[1, 2, 3];
+    ///    let x: &[isize] = &[1, 2, 3];
     ///
     /// In this case, the expected type for the `&[1, 2, 3]` expression is
-    /// `&[int]`. If however we were to say that `[1, 2, 3]` has the
-    /// expectation `ExpectHasType([int])`, that would be too strong --
-    /// `[1, 2, 3]` does not have the type `[int]` but rather `[int; 3]`.
+    /// `&[isize]`. If however we were to say that `[1, 2, 3]` has the
+    /// expectation `ExpectHasType([isize])`, that would be too strong --
+    /// `[1, 2, 3]` does not have the type `[isize]` but rather `[isize; 3]`.
     /// It is only the `&[1, 2, 3]` expression as a whole that can be coerced
-    /// to the type `&[int]`. Therefore, we propagate this more limited hint,
+    /// to the type `&[isize]`. Therefore, we propagate this more limited hint,
     /// which still is useful, because it informs integer literals and the like.
     /// See the test case `test/run-pass/coerce-expect-unsized.rs` and #20169
     /// for examples of where this comes up,.
@@ -4590,14 +4257,12 @@ fn disr_in_range(ccx: &CrateCtxt,
                      ty: attr::IntType,
                      disr: ty::Disr) -> bool {
         fn uint_in_range(ccx: &CrateCtxt, ty: ast::UintTy, disr: ty::Disr) -> bool {
-            #![allow(trivial_numeric_casts)]
-
             match ty {
                 ast::TyU8 => disr as u8 as Disr == disr,
                 ast::TyU16 => disr as u16 as Disr == disr,
                 ast::TyU32 => disr as u32 as Disr == disr,
                 ast::TyU64 => disr as u64 as Disr == disr,
-                ast::TyUs(_) => uint_in_range(ccx, ccx.tcx.sess.target.uint_type, disr)
+                ast::TyUs => uint_in_range(ccx, ccx.tcx.sess.target.uint_type, disr)
             }
         }
         fn int_in_range(ccx: &CrateCtxt, ty: ast::IntTy, disr: ty::Disr) -> bool {
@@ -4606,7 +4271,7 @@ fn int_in_range(ccx: &CrateCtxt, ty: ast::IntTy, disr: ty::Disr) -> bool {
                 ast::TyI16 => disr as i16 as Disr == disr,
                 ast::TyI32 => disr as i32 as Disr == disr,
                 ast::TyI64 => disr as i64 as Disr == disr,
-                ast::TyIs(_) => int_in_range(ccx, ccx.tcx.sess.target.int_type, disr)
+                ast::TyIs => int_in_range(ccx, ccx.tcx.sess.target.int_type, disr)
             }
         }
         match ty {
@@ -4621,7 +4286,6 @@ fn do_check<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                           hint: attr::ReprAttr)
                           -> Vec<Rc<ty::VariantInfo<'tcx>>> {
         #![allow(trivial_numeric_casts)]
-        use std::num::Int;
 
         let rty = ty::node_id_to_type(ccx.tcx, id);
         let mut variants: Vec<Rc<ty::VariantInfo>> = Vec::new();
@@ -4650,7 +4314,9 @@ fn do_check<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                     let inh = static_inherited_fields(ccx);
                     let fcx = blank_fn_ctxt(ccx, &inh, ty::FnConverging(rty), e.id);
                     let declty = match hint {
-                        attr::ReprAny | attr::ReprPacked | attr::ReprExtern => fcx.tcx().types.int,
+                        attr::ReprAny | attr::ReprPacked |
+                        attr::ReprExtern => fcx.tcx().types.isize,
+
                         attr::ReprInt(_, attr::SignedInt(ity)) => {
                             ty::mk_mach_int(fcx.tcx(), ity)
                         }
@@ -5319,7 +4985,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
             match t.sty {
                 ty::ty_param(ParamTy {idx, ..}) => {
                     debug!("Found use of ty param num {}", idx);
-                    tps_used[idx as uint] = true;
+                    tps_used[idx as usize] = true;
                 }
                 _ => ()
             }
@@ -5378,8 +5044,8 @@ fn param<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, n: u32) -> Ty<'tcx> {
         let (n_tps, inputs, output) = match &name[..] {
             "breakpoint" => (0, Vec::new(), ty::mk_nil(tcx)),
             "size_of" |
-            "pref_align_of" | "min_align_of" => (1, Vec::new(), ccx.tcx.types.uint),
-            "init" => (1, Vec::new(), param(ccx, 0)),
+            "pref_align_of" | "min_align_of" => (1, Vec::new(), ccx.tcx.types.usize),
+            "init" | "init_dropped" => (1, Vec::new(), param(ccx, 0)),
             "uninit" => (1, Vec::new(), param(ccx, 0)),
             "forget" => (1, vec!( param(ccx, 0) ), ty::mk_nil(tcx)),
             "transmute" => (2, vec!( param(ccx, 0) ), param(ccx, 1)),
@@ -5407,14 +5073,28 @@ fn param<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, n: u32) -> Ty<'tcx> {
                       ty: param(ccx, 0),
                       mutbl: ast::MutImmutable
                   }),
-                  ccx.tcx.types.int
+                  ccx.tcx.types.isize
                ),
                ty::mk_ptr(tcx, ty::mt {
                    ty: param(ccx, 0),
                    mutbl: ast::MutImmutable
                }))
             }
-            "copy" | "copy_nonoverlapping" |
+            "copy" | "copy_nonoverlapping" => {
+              (1,
+               vec!(
+                  ty::mk_ptr(tcx, ty::mt {
+                      ty: param(ccx, 0),
+                      mutbl: ast::MutImmutable
+                  }),
+                  ty::mk_ptr(tcx, ty::mt {
+                      ty: param(ccx, 0),
+                      mutbl: ast::MutMutable
+                  }),
+                  tcx.types.usize,
+               ),
+               ty::mk_nil(tcx))
+            }
             "volatile_copy_memory" | "volatile_copy_nonoverlapping_memory" => {
               (1,
                vec!(
@@ -5426,7 +5106,7 @@ fn param<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, n: u32) -> Ty<'tcx> {
                       ty: param(ccx, 0),
                       mutbl: ast::MutImmutable
                   }),
-                  tcx.types.uint,
+                  tcx.types.usize,
                ),
                ty::mk_nil(tcx))
             }
@@ -5438,7 +5118,7 @@ fn param<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, n: u32) -> Ty<'tcx> {
                       mutbl: ast::MutMutable
                   }),
                   tcx.types.u8,
-                  tcx.types.uint,
+                  tcx.types.usize,
                ),
                ty::mk_nil(tcx))
             }
diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs
new file mode 100644 (file)
index 0000000..49e88dc
--- /dev/null
@@ -0,0 +1,481 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Code related to processing overloaded binary and unary operators.
+
+use super::{
+    check_expr,
+    check_expr_coercable_to_type,
+    check_expr_with_lvalue_pref,
+    demand,
+    method,
+    FnCtxt,
+    PreferMutLvalue,
+    structurally_resolved_type,
+};
+use middle::infer;
+use middle::traits;
+use middle::ty::{self, Ty};
+use syntax::ast;
+use syntax::ast_util;
+use syntax::parse::token;
+use util::ppaux::{Repr, UserString};
+
+/// Check a `a <op>= b`
+pub fn check_binop_assign<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
+                                   expr: &'tcx ast::Expr,
+                                   op: ast::BinOp,
+                                   lhs_expr: &'tcx ast::Expr,
+                                   rhs_expr: &'tcx ast::Expr)
+{
+    let tcx = fcx.ccx.tcx;
+
+    check_expr_with_lvalue_pref(fcx, lhs_expr, PreferMutLvalue);
+    check_expr(fcx, rhs_expr);
+
+    let lhs_ty = structurally_resolved_type(fcx, lhs_expr.span, fcx.expr_ty(lhs_expr));
+    let rhs_ty = structurally_resolved_type(fcx, rhs_expr.span, fcx.expr_ty(rhs_expr));
+
+    if is_builtin_binop(fcx.tcx(), lhs_ty, rhs_ty, op) {
+        enforce_builtin_binop_types(fcx, lhs_expr, lhs_ty, rhs_expr, rhs_ty, op);
+        fcx.write_nil(expr.id);
+    } else {
+        // error types are considered "builtin"
+        assert!(!ty::type_is_error(lhs_ty) || !ty::type_is_error(rhs_ty));
+        span_err!(tcx.sess, lhs_expr.span, E0368,
+                  "binary assignment operation `{}=` cannot be applied to types `{}` and `{}`",
+                  ast_util::binop_to_string(op.node),
+                  lhs_ty.user_string(fcx.tcx()),
+                  rhs_ty.user_string(fcx.tcx()));
+        fcx.write_error(expr.id);
+    }
+
+    let tcx = fcx.tcx();
+    if !ty::expr_is_lval(tcx, lhs_expr) {
+        span_err!(tcx.sess, lhs_expr.span, E0067, "illegal left-hand side expression");
+    }
+
+    fcx.require_expr_have_sized_type(lhs_expr, traits::AssignmentLhsSized);
+}
+
+/// Check a potentially overloaded binary operator.
+pub fn check_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
+                             expr: &'tcx ast::Expr,
+                             op: ast::BinOp,
+                             lhs_expr: &'tcx ast::Expr,
+                             rhs_expr: &'tcx ast::Expr)
+{
+    let tcx = fcx.ccx.tcx;
+
+    debug!("check_binop(expr.id={}, expr={}, op={:?}, lhs_expr={}, rhs_expr={})",
+           expr.id,
+           expr.repr(tcx),
+           op,
+           lhs_expr.repr(tcx),
+           rhs_expr.repr(tcx));
+
+    check_expr(fcx, lhs_expr);
+    let lhs_ty = fcx.resolve_type_vars_if_possible(fcx.expr_ty(lhs_expr));
+
+    // Annoyingly, SIMD ops don't fit into the PartialEq/PartialOrd
+    // traits, because their return type is not bool. Perhaps this
+    // should change, but for now if LHS is SIMD we go down a
+    // different path that bypassess all traits.
+    if ty::type_is_simd(fcx.tcx(), lhs_ty) {
+        check_expr_coercable_to_type(fcx, rhs_expr, lhs_ty);
+        let rhs_ty = fcx.resolve_type_vars_if_possible(fcx.expr_ty(lhs_expr));
+        let return_ty = enforce_builtin_binop_types(fcx, lhs_expr, lhs_ty, rhs_expr, rhs_ty, op);
+        fcx.write_ty(expr.id, return_ty);
+        return;
+    }
+
+    match BinOpCategory::from(op) {
+        BinOpCategory::Shortcircuit => {
+            // && and || are a simple case.
+            demand::suptype(fcx, lhs_expr.span, ty::mk_bool(tcx), lhs_ty);
+            check_expr_coercable_to_type(fcx, rhs_expr, ty::mk_bool(tcx));
+            fcx.write_ty(expr.id, ty::mk_bool(tcx));
+        }
+        _ => {
+            // Otherwise, we always treat operators as if they are
+            // overloaded. This is the way to be most flexible w/r/t
+            // types that get inferred.
+            let (rhs_ty, return_ty) =
+                check_overloaded_binop(fcx, expr, lhs_expr, lhs_ty, rhs_expr, op);
+
+            // Supply type inference hints if relevant. Probably these
+            // hints should be enforced during select as part of the
+            // `consider_unification_despite_ambiguity` routine, but this
+            // more convenient for now.
+            //
+            // The basic idea is to help type inference by taking
+            // advantage of things we know about how the impls for
+            // scalar types are arranged. This is important in a
+            // scenario like `1_u32 << 2`, because it lets us quickly
+            // deduce that the result type should be `u32`, even
+            // though we don't know yet what type 2 has and hence
+            // can't pin this down to a specific impl.
+            let rhs_ty = fcx.resolve_type_vars_if_possible(rhs_ty);
+            if
+                !ty::type_is_ty_var(lhs_ty) &&
+                !ty::type_is_ty_var(rhs_ty) &&
+                is_builtin_binop(fcx.tcx(), lhs_ty, rhs_ty, op)
+            {
+                let builtin_return_ty =
+                    enforce_builtin_binop_types(fcx, lhs_expr, lhs_ty, rhs_expr, rhs_ty, op);
+                demand::suptype(fcx, expr.span, builtin_return_ty, return_ty);
+            }
+
+            fcx.write_ty(expr.id, return_ty);
+        }
+    }
+}
+
+fn enforce_builtin_binop_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
+                                         lhs_expr: &'tcx ast::Expr,
+                                         lhs_ty: Ty<'tcx>,
+                                         rhs_expr: &'tcx ast::Expr,
+                                         rhs_ty: Ty<'tcx>,
+                                         op: ast::BinOp)
+                                         -> Ty<'tcx>
+{
+    debug_assert!(is_builtin_binop(fcx.tcx(), lhs_ty, rhs_ty, op));
+
+    let tcx = fcx.tcx();
+    match BinOpCategory::from(op) {
+        BinOpCategory::Shortcircuit => {
+            demand::suptype(fcx, lhs_expr.span, ty::mk_bool(tcx), lhs_ty);
+            demand::suptype(fcx, rhs_expr.span, ty::mk_bool(tcx), rhs_ty);
+            ty::mk_bool(tcx)
+        }
+
+        BinOpCategory::Shift => {
+            // For integers, the shift amount can be of any integral
+            // type. For simd, the type must match exactly.
+            if ty::type_is_simd(tcx, lhs_ty) {
+                demand::suptype(fcx, rhs_expr.span, lhs_ty, rhs_ty);
+            }
+
+            // result type is same as LHS always
+            lhs_ty
+        }
+
+        BinOpCategory::Math |
+        BinOpCategory::Bitwise => {
+            // both LHS and RHS and result will have the same type
+            demand::suptype(fcx, rhs_expr.span, lhs_ty, rhs_ty);
+            lhs_ty
+        }
+
+        BinOpCategory::Comparison => {
+            // both LHS and RHS and result will have the same type
+            demand::suptype(fcx, rhs_expr.span, lhs_ty, rhs_ty);
+
+            // if this is simd, result is same as lhs, else bool
+            if ty::type_is_simd(tcx, lhs_ty) {
+                let unit_ty = ty::simd_type(tcx, lhs_ty);
+                debug!("enforce_builtin_binop_types: lhs_ty={} unit_ty={}",
+                       lhs_ty.repr(tcx),
+                       unit_ty.repr(tcx));
+                if !ty::type_is_integral(unit_ty) {
+                    tcx.sess.span_err(
+                        lhs_expr.span,
+                        &format!("binary comparison operation `{}` not supported \
+                                  for floating point SIMD vector `{}`",
+                                 ast_util::binop_to_string(op.node),
+                                 lhs_ty.user_string(tcx)));
+                    tcx.types.err
+                } else {
+                    lhs_ty
+                }
+            } else {
+                ty::mk_bool(tcx)
+            }
+        }
+    }
+}
+
+fn check_overloaded_binop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
+                                    expr: &'tcx ast::Expr,
+                                    lhs_expr: &'tcx ast::Expr,
+                                    lhs_ty: Ty<'tcx>,
+                                    rhs_expr: &'tcx ast::Expr,
+                                    op: ast::BinOp)
+                                    -> (Ty<'tcx>, Ty<'tcx>)
+{
+    debug!("check_overloaded_binop(expr.id={}, lhs_ty={})",
+           expr.id,
+           lhs_ty.repr(fcx.tcx()));
+
+    let (name, trait_def_id) = name_and_trait_def_id(fcx, op);
+
+    // NB: As we have not yet type-checked the RHS, we don't have the
+    // type at hand. Make a variable to represent it. The whole reason
+    // for this indirection is so that, below, we can check the expr
+    // using this variable as the expected type, which sometimes lets
+    // us do better coercions than we would be able to do otherwise,
+    // particularly for things like `String + &String`.
+    let rhs_ty_var = fcx.infcx().next_ty_var();
+
+    let return_ty = match lookup_op_method(fcx, expr, lhs_ty, vec![rhs_ty_var],
+                                           token::intern(name), trait_def_id,
+                                           lhs_expr) {
+        Ok(return_ty) => return_ty,
+        Err(()) => {
+            // error types are considered "builtin"
+            if !ty::type_is_error(lhs_ty) {
+                span_err!(fcx.tcx().sess, lhs_expr.span, E0369,
+                          "binary operation `{}` cannot be applied to type `{}`",
+                          ast_util::binop_to_string(op.node),
+                          lhs_ty.user_string(fcx.tcx()));
+            }
+            fcx.tcx().types.err
+        }
+    };
+
+    // see `NB` above
+    check_expr_coercable_to_type(fcx, rhs_expr, rhs_ty_var);
+
+    (rhs_ty_var, return_ty)
+}
+
+pub fn check_user_unop<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
+                                 op_str: &str,
+                                 mname: &str,
+                                 trait_did: Option<ast::DefId>,
+                                 ex: &'tcx ast::Expr,
+                                 operand_expr: &'tcx ast::Expr,
+                                 operand_ty: Ty<'tcx>,
+                                 op: ast::UnOp)
+                                 -> Ty<'tcx>
+{
+    assert!(ast_util::is_by_value_unop(op));
+    match lookup_op_method(fcx, ex, operand_ty, vec![],
+                           token::intern(mname), trait_did,
+                           operand_expr) {
+        Ok(t) => t,
+        Err(()) => {
+            fcx.type_error_message(ex.span, |actual| {
+                format!("cannot apply unary operator `{}` to type `{}`",
+                        op_str, actual)
+            }, operand_ty, None);
+            fcx.tcx().types.err
+        }
+    }
+}
+
+fn name_and_trait_def_id(fcx: &FnCtxt, op: ast::BinOp) -> (&'static str, Option<ast::DefId>) {
+    let lang = &fcx.tcx().lang_items;
+    match op.node {
+        ast::BiAdd => ("add", lang.add_trait()),
+        ast::BiSub => ("sub", lang.sub_trait()),
+        ast::BiMul => ("mul", lang.mul_trait()),
+        ast::BiDiv => ("div", lang.div_trait()),
+        ast::BiRem => ("rem", lang.rem_trait()),
+        ast::BiBitXor => ("bitxor", lang.bitxor_trait()),
+        ast::BiBitAnd => ("bitand", lang.bitand_trait()),
+        ast::BiBitOr => ("bitor", lang.bitor_trait()),
+        ast::BiShl => ("shl", lang.shl_trait()),
+        ast::BiShr => ("shr", lang.shr_trait()),
+        ast::BiLt => ("lt", lang.ord_trait()),
+        ast::BiLe => ("le", lang.ord_trait()),
+        ast::BiGe => ("ge", lang.ord_trait()),
+        ast::BiGt => ("gt", lang.ord_trait()),
+        ast::BiEq => ("eq", lang.eq_trait()),
+        ast::BiNe => ("ne", lang.eq_trait()),
+        ast::BiAnd | ast::BiOr => {
+            fcx.tcx().sess.span_bug(op.span, "&& and || are not overloadable")
+        }
+    }
+}
+
+fn lookup_op_method<'a, 'tcx>(fcx: &'a FnCtxt<'a, 'tcx>,
+                              expr: &'tcx ast::Expr,
+                              lhs_ty: Ty<'tcx>,
+                              other_tys: Vec<Ty<'tcx>>,
+                              opname: ast::Name,
+                              trait_did: Option<ast::DefId>,
+                              lhs_expr: &'a ast::Expr)
+                              -> Result<Ty<'tcx>,()>
+{
+    debug!("lookup_op_method(expr={}, lhs_ty={}, opname={:?}, trait_did={}, lhs_expr={})",
+           expr.repr(fcx.tcx()),
+           lhs_ty.repr(fcx.tcx()),
+           opname,
+           trait_did.repr(fcx.tcx()),
+           lhs_expr.repr(fcx.tcx()));
+
+    let method = match trait_did {
+        Some(trait_did) => {
+            // We do eager coercions to make using operators
+            // more ergonomic:
+            //
+            // - If the input is of type &'a T (resp. &'a mut T),
+            //   then reborrow it to &'b T (resp. &'b mut T) where
+            //   'b <= 'a.  This makes things like `x == y`, where
+            //   `x` and `y` are both region pointers, work.  We
+            //   could also solve this with variance or different
+            //   traits that don't force left and right to have same
+            //   type.
+            let (adj_ty, adjustment) = match lhs_ty.sty {
+                ty::ty_rptr(r_in, mt) => {
+                    let r_adj = fcx.infcx().next_region_var(infer::Autoref(lhs_expr.span));
+                    fcx.mk_subr(infer::Reborrow(lhs_expr.span), r_adj, *r_in);
+                    let adjusted_ty = ty::mk_rptr(fcx.tcx(), fcx.tcx().mk_region(r_adj), mt);
+                    let autoptr = ty::AutoPtr(r_adj, mt.mutbl, None);
+                    let adjustment = ty::AutoDerefRef { autoderefs: 1, autoref: Some(autoptr) };
+                    (adjusted_ty, adjustment)
+                }
+                _ => {
+                    (lhs_ty, ty::AutoDerefRef { autoderefs: 0, autoref: None })
+                }
+            };
+
+            debug!("adjusted_ty={} adjustment={:?}",
+                   adj_ty.repr(fcx.tcx()),
+                   adjustment);
+
+            method::lookup_in_trait_adjusted(fcx, expr.span, Some(lhs_expr), opname,
+                                             trait_did, adjustment, adj_ty, Some(other_tys))
+        }
+        None => None
+    };
+
+    match method {
+        Some(method) => {
+            let method_ty = method.ty;
+
+            // HACK(eddyb) Fully qualified path to work around a resolve bug.
+            let method_call = ::middle::ty::MethodCall::expr(expr.id);
+            fcx.inh.method_map.borrow_mut().insert(method_call, method);
+
+            // extract return type for method; all late bound regions
+            // should have been instantiated by now
+            let ret_ty = ty::ty_fn_ret(method_ty);
+            Ok(ty::no_late_bound_regions(fcx.tcx(), &ret_ty).unwrap().unwrap())
+        }
+        None => {
+            Err(())
+        }
+    }
+}
+
+// Binary operator categories. These categories summarize the behavior
+// with respect to the builtin operationrs supported.
+enum BinOpCategory {
+    /// &&, || -- cannot be overridden
+    Shortcircuit,
+
+    /// <<, >> -- when shifting a single integer, rhs can be any
+    /// integer type. For simd, types must match.
+    Shift,
+
+    /// +, -, etc -- takes equal types, produces same type as input,
+    /// applicable to ints/floats/simd
+    Math,
+
+    /// &, |, ^ -- takes equal types, produces same type as input,
+    /// applicable to ints/floats/simd/bool
+    Bitwise,
+
+    /// ==, !=, etc -- takes equal types, produces bools, except for simd,
+    /// which produce the input type
+    Comparison,
+}
+
+impl BinOpCategory {
+    fn from(op: ast::BinOp) -> BinOpCategory {
+        match op.node {
+            ast::BiShl | ast::BiShr =>
+                BinOpCategory::Shift,
+
+            ast::BiAdd |
+            ast::BiSub |
+            ast::BiMul |
+            ast::BiDiv |
+            ast::BiRem =>
+                BinOpCategory::Math,
+
+            ast::BiBitXor |
+            ast::BiBitAnd |
+            ast::BiBitOr =>
+                BinOpCategory::Bitwise,
+
+            ast::BiEq |
+            ast::BiNe |
+            ast::BiLt |
+            ast::BiLe |
+            ast::BiGe |
+            ast::BiGt =>
+                BinOpCategory::Comparison,
+
+            ast::BiAnd |
+            ast::BiOr =>
+                BinOpCategory::Shortcircuit,
+        }
+    }
+}
+
+/// Returns true if this is a built-in arithmetic operation (e.g. u32
+/// + u32, i16x4 == i16x4) and false if these types would have to be
+/// overloaded to be legal. There are two reasons that we distinguish
+/// builtin operations from overloaded ones (vs trying to drive
+/// everything uniformly through the trait system and intrinsics or
+/// something like that):
+///
+/// 1. Builtin operations can trivially be evaluated in constants.
+/// 2. For comparison operators applied to SIMD types the result is
+///    not of type `bool`. For example, `i16x4==i16x4` yields a
+///    type like `i16x4`. This means that the overloaded trait
+///    `PartialEq` is not applicable.
+///
+/// Reason #2 is the killer. I tried for a while to always use
+/// overloaded logic and just check the types in constants/trans after
+/// the fact, and it worked fine, except for SIMD types. -nmatsakis
+fn is_builtin_binop<'tcx>(cx: &ty::ctxt<'tcx>,
+                          lhs: Ty<'tcx>,
+                          rhs: Ty<'tcx>,
+                          op: ast::BinOp)
+                          -> bool
+{
+    match BinOpCategory::from(op) {
+        BinOpCategory::Shortcircuit => {
+            true
+        }
+
+        BinOpCategory::Shift => {
+            ty::type_is_error(lhs) || ty::type_is_error(rhs) ||
+                ty::type_is_integral(lhs) && ty::type_is_integral(rhs) ||
+                ty::type_is_simd(cx, lhs) && ty::type_is_simd(cx, rhs)
+        }
+
+        BinOpCategory::Math => {
+            ty::type_is_error(lhs) || ty::type_is_error(rhs) ||
+                ty::type_is_integral(lhs) && ty::type_is_integral(rhs) ||
+                ty::type_is_floating_point(lhs) && ty::type_is_floating_point(rhs) ||
+                ty::type_is_simd(cx, lhs) && ty::type_is_simd(cx, rhs)
+        }
+
+        BinOpCategory::Bitwise => {
+            ty::type_is_error(lhs) || ty::type_is_error(rhs) ||
+                ty::type_is_integral(lhs) && ty::type_is_integral(rhs) ||
+                ty::type_is_floating_point(lhs) && ty::type_is_floating_point(rhs) ||
+                ty::type_is_simd(cx, lhs) && ty::type_is_simd(cx, rhs) ||
+                ty::type_is_bool(lhs) && ty::type_is_bool(rhs)
+        }
+
+        BinOpCategory::Comparison => {
+            ty::type_is_error(lhs) || ty::type_is_error(rhs) ||
+                ty::type_is_scalar(lhs) && ty::type_is_scalar(rhs) ||
+                ty::type_is_simd(cx, lhs) && ty::type_is_simd(cx, rhs)
+        }
+    }
+}
+
index 5a4ccc0b7b410cbb250693776365117bf7e12874..3edea6d3004449b3e8d586902180feb24886e07c 100644 (file)
@@ -319,7 +319,7 @@ fn visit_region_obligations(&mut self, node_id: ast::NodeId)
     /// This method populates the region map's `free_region_map`. It walks over the transformed
     /// argument and return types for each function just before we check the body of that function,
     /// looking for types where you have a borrowed pointer to other borrowed data (e.g., `&'a &'b
-    /// [uint]`.  We do not allow references to outlive the things they point at, so we can assume
+    /// [usize]`.  We do not allow references to outlive the things they point at, so we can assume
     /// that `'a <= 'b`. This holds for both the argument and return types, basically because, on
     /// the caller side, the caller is responsible for checking that the type of every expression
     /// (including the actual values for the arguments, as well as the return type of the fn call)
@@ -862,7 +862,7 @@ fn constrain_call<'a, I: Iterator<Item=&'a ast::Expr>>(rcx: &mut Rcx,
 /// dereferenced, the lifetime of the pointer includes the deref expr.
 fn constrain_autoderefs<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
                                   deref_expr: &ast::Expr,
-                                  derefs: uint,
+                                  derefs: usize,
                                   mut derefd_ty: Ty<'tcx>)
 {
     debug!("constrain_autoderefs(deref_expr={}, derefs={}, derefd_ty={})",
@@ -1118,7 +1118,7 @@ fn link_pattern<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
 /// autoref'd.
 fn link_autoref(rcx: &Rcx,
                 expr: &ast::Expr,
-                autoderefs: uint,
+                autoderefs: usize,
                 autoref: &ty::AutoRef) {
 
     debug!("link_autoref(autoref={:?})", autoref);
index 2858dc9b569fe1adaa22ffb7cde199e4e375404a..63c34b65d77841ec2018aa68d55880f9c24f70b9 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use check::{FnCtxt};
+use check::FnCtxt;
 use middle::traits::{self, ObjectSafetyViolation, MethodViolationCode};
 use middle::traits::{Obligation, ObligationCause};
 use middle::traits::report_fulfillment_errors;
@@ -28,18 +28,17 @@ pub fn check_object_safety<'tcx>(tcx: &ty::ctxt<'tcx>,
                                  object_trait: &ty::TyTrait<'tcx>,
                                  span: Span)
 {
-    let object_trait_ref =
-        object_trait.principal_trait_ref_with_self_ty(tcx, tcx.types.err);
+    let trait_def_id = object_trait.principal_def_id();
 
-    if traits::is_object_safe(tcx, object_trait_ref.clone()) {
+    if traits::is_object_safe(tcx, trait_def_id) {
         return;
     }
 
     span_err!(tcx.sess, span, E0038,
               "cannot convert to a trait object because trait `{}` is not object-safe",
-              ty::item_path_str(tcx, object_trait_ref.def_id()));
+              ty::item_path_str(tcx, trait_def_id));
 
-    let violations = traits::object_safety_violations(tcx, object_trait_ref.clone());
+    let violations = traits::object_safety_violations(tcx, trait_def_id);
     for violation in violations {
         match violation {
             ObjectSafetyViolation::SizedSelf => {
index adbf4c6b210e83a345146680bb601525da776f89..23e31df5395268971b0c821f8ffd96a08da76d0d 100644 (file)
@@ -22,8 +22,7 @@
 
 use std::collections::HashSet;
 use syntax::ast;
-use syntax::ast_util::{local_def};
-use syntax::attr;
+use syntax::ast_util::local_def;
 use syntax::codemap::Span;
 use syntax::parse::token::{self, special_idents};
 use syntax::visit;
@@ -250,22 +249,6 @@ fn check_impl(&mut self,
                                                         &fcx.inh.param_env.free_substs,
                                                         &trait_ref);
 
-            // There are special rules that apply to drop.
-            if
-                fcx.tcx().lang_items.drop_trait() == Some(trait_ref.def_id) &&
-                !attr::contains_name(&item.attrs, "unsafe_destructor")
-            {
-                match self_ty.sty {
-                    ty::ty_struct(def_id, _) |
-                    ty::ty_enum(def_id, _) => {
-                        check_struct_safe_for_destructor(fcx, item.span, def_id);
-                    }
-                    _ => {
-                        // Coherence already reports an error in this case.
-                    }
-                }
-            }
-
             if fcx.tcx().lang_items.copy_trait() == Some(trait_ref.def_id) {
                 // This is checked in coherence.
                 return
@@ -528,7 +511,7 @@ pub struct BoundsChecker<'cx,'tcx:'cx> {
     // has left it as a NodeId rather than porting to CodeExtent.
     scope: ast::NodeId,
 
-    binding_count: uint,
+    binding_count: usize,
     cache: Option<&'cx mut HashSet<Ty<'tcx>>>,
 }
 
@@ -761,22 +744,3 @@ fn filter_to_trait_obligations<'tcx>(bounds: ty::InstantiatedPredicates<'tcx>)
     }
     result
 }
-
-///////////////////////////////////////////////////////////////////////////
-// Special drop trait checking
-
-fn check_struct_safe_for_destructor<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
-                                              span: Span,
-                                              struct_did: ast::DefId) {
-    let struct_tpt = ty::lookup_item_type(fcx.tcx(), struct_did);
-    if struct_tpt.generics.has_type_params(subst::TypeSpace)
-        || struct_tpt.generics.has_region_params(subst::TypeSpace)
-    {
-        span_err!(fcx.tcx().sess, span, E0141,
-                  "cannot implement a destructor on a structure \
-                   with type parameters");
-        span_note!(fcx.tcx().sess, span,
-                   "use \"#[unsafe_destructor]\" on the implementation \
-                    to force the compiler to allow this");
-    }
-}
index 2537f9362bf310f88ed8e60d302487da33102d04..4d7a046fc607bd125df812c1d6fd86d5343b76af 100644 (file)
@@ -26,6 +26,7 @@
 use std::cell::Cell;
 
 use syntax::ast;
+use syntax::ast_util;
 use syntax::codemap::{DUMMY_SP, Span};
 use syntax::print::pprust::pat_to_string;
 use syntax::visit;
@@ -113,6 +114,31 @@ fn visit_expr(&mut self, e: &ast::Expr) {
             return;
         }
 
+        // Hacky hack: During type-checking, we treat *all* operators
+        // as potentially overloaded. But then, during writeback, if
+        // we observe that something like `a+b` is (known to be)
+        // operating on scalars, we clear the overload.
+        match e.node {
+            ast::ExprBinary(ref op, ref lhs, ref rhs) => {
+                let lhs_ty = self.fcx.expr_ty(lhs);
+                let lhs_ty = self.fcx.infcx().resolve_type_vars_if_possible(&lhs_ty);
+                let rhs_ty = self.fcx.expr_ty(rhs);
+                let rhs_ty = self.fcx.infcx().resolve_type_vars_if_possible(&rhs_ty);
+                if ty::type_is_scalar(lhs_ty) && ty::type_is_scalar(rhs_ty) {
+                    self.fcx.inh.method_map.borrow_mut().remove(&MethodCall::expr(e.id));
+
+                    // weird but true: the by-ref binops put an
+                    // adjustment on the lhs but not the rhs; the
+                    // adjustment for rhs is kind of baked into the
+                    // system.
+                    if !ast_util::is_by_value_binop(op.node) {
+                        self.fcx.inh.adjustments.borrow_mut().remove(&lhs.id);
+                    }
+                }
+            }
+            _ => { }
+        }
+
         self.visit_node_id(ResolvingExpr(e.span), e.id);
         self.visit_method_map_entry(ResolvingExpr(e.span),
                                     MethodCall::expr(e.id));
@@ -169,7 +195,7 @@ fn visit_ty(&mut self, t: &ast::Ty) {
         match t.node {
             ast::TyFixedLengthVec(ref ty, ref count_expr) => {
                 self.visit_ty(&**ty);
-                write_ty_to_tcx(self.tcx(), count_expr.id, self.tcx().types.uint);
+                write_ty_to_tcx(self.tcx(), count_expr.id, self.tcx().types.usize);
             }
             _ => visit::walk_ty(self, t)
         }
index ffd99ff2eece081f7390195ea24506fe83ebb302..eaf07a3ef13a7d6326711ddeadfe5b6ca00c6f95 100644 (file)
 use middle::ty::{ty_rptr, ty_struct, ty_trait, ty_tup};
 use middle::ty::{ty_str, ty_vec, ty_float, ty_infer, ty_int};
 use middle::ty::{ty_uint, ty_closure, ty_uniq, ty_bare_fn};
-use middle::ty::{ty_projection};
+use middle::ty::ty_projection;
 use middle::ty;
 use CrateCtxt;
 use middle::infer::combine::Combine;
 use middle::infer::InferCtxt;
-use middle::infer::{new_infer_ctxt};
-use std::collections::{HashSet};
+use middle::infer::new_infer_ctxt;
+use std::collections::HashSet;
 use std::cell::RefCell;
 use std::rc::Rc;
 use syntax::ast::{Crate, DefId};
@@ -42,8 +42,8 @@
 use syntax::ast;
 use syntax::ast_map::NodeItem;
 use syntax::ast_map;
-use syntax::ast_util::{local_def};
-use syntax::codemap::{Span};
+use syntax::ast_util::local_def;
+use syntax::codemap::Span;
 use syntax::parse::token;
 use syntax::visit;
 use util::nodemap::{DefIdMap, FnvHashMap};
index ab694d26b155c9c10a36cbad6becc685d28c7631..7b76f3681c16330bcef1e1bae46ab7679427cb6c 100644 (file)
@@ -143,7 +143,7 @@ fn check_item(&self, item: &ast::Item) {
                                                   "i64",
                                                   item.span);
                     }
-                    ty::ty_int(ast::TyIs(_)) => {
+                    ty::ty_int(ast::TyIs) => {
                         self.check_primitive_impl(def_id,
                                                   self.tcx.lang_items.isize_impl(),
                                                   "isize",
@@ -178,7 +178,7 @@ fn check_item(&self, item: &ast::Item) {
                                                   "u64",
                                                   item.span);
                     }
-                    ty::ty_uint(ast::TyUs(_)) => {
+                    ty::ty_uint(ast::TyUs) => {
                         self.check_primitive_impl(def_id,
                                                   self.tcx.lang_items.usize_impl(),
                                                   "usize",
index 466d00b348b94d33d029c7a34ecbb43b30f71030..f8ca51b9e496aa164a127c88252f111084ad1156 100644 (file)
@@ -14,8 +14,8 @@
 use middle::traits;
 use middle::ty;
 use middle::infer::{self, new_infer_ctxt};
-use syntax::ast::{DefId};
-use syntax::ast::{LOCAL_CRATE};
+use syntax::ast::DefId;
+use syntax::ast::LOCAL_CRATE;
 use syntax::ast;
 use syntax::ast_util;
 use syntax::visit;
index 5816fe58bc9b1b25948ae56670bb2032fb94470e..dd306c4da862d79a3f21587f65addc567ef03f06 100644 (file)
@@ -91,7 +91,7 @@
 use syntax::ast_map;
 use syntax::ast_util::local_def;
 use syntax::codemap::Span;
-use syntax::parse::token::{special_idents};
+use syntax::parse::token::special_idents;
 use syntax::parse::token;
 use syntax::ptr::P;
 use syntax::visit;
@@ -2208,18 +2208,10 @@ fn enforce_impl_ty_params_are_constrained<'tcx>(tcx: &ty::ctxt<'tcx>,
                                      idx: index as u32,
                                      name: ty_param.ident.name };
         if !input_parameters.contains(&param_ty) {
-            if ty::has_attr(tcx, impl_def_id, "old_impl_check") {
-                tcx.sess.span_warn(
-                    ty_param.span,
-                    &format!("the type parameter `{}` is not constrained by the \
-                              impl trait, self type, or predicates",
-                             param_ty.user_string(tcx)));
-            } else {
-                span_err!(tcx.sess, ty_param.span, E0207,
-                    "the type parameter `{}` is not constrained by the \
-                             impl trait, self type, or predicates",
-                            param_ty.user_string(tcx));
-            }
+            span_err!(tcx.sess, ty_param.span, E0207,
+                "the type parameter `{}` is not constrained by the \
+                         impl trait, self type, or predicates",
+                        param_ty.user_string(tcx));
         }
     }
 }
index 95e06879fb2235a066c2aa83104fe7ec9ca643b0..7d01bece01cb808188d027b30b37b22736fbbb49 100644 (file)
     E0321, // extended coherence rules for defaulted traits violated
     E0322, // cannot implement Sized explicitly
     E0366, // dropck forbid specialization to concrete type or region
-    E0367  // dropck forbid specialization to predicate not in struct/enum
+    E0367, // dropck forbid specialization to predicate not in struct/enum
+    E0368, // binary operation `<op>=` cannot be applied to types
+    E0369  // binary operation `<op>` cannot be applied to types
 }
 
 __build_diagnostic_array! { DIAGNOSTICS }
index 4e7e63a5d7779a6787e1d732aa67e22646ecdbe1..91410fa808c78a8436c7d639ba2a78a1eabac0fb 100644 (file)
@@ -79,7 +79,6 @@
 #![feature(box_syntax)]
 #![feature(collections)]
 #![feature(core)]
-#![feature(int_uint)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
@@ -281,10 +280,10 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
                 abi: abi::Rust,
                 sig: ty::Binder(ty::FnSig {
                     inputs: vec!(
-                        tcx.types.int,
+                        tcx.types.isize,
                         ty::mk_imm_ptr(tcx, ty::mk_imm_ptr(tcx, tcx.types.u8))
                     ),
-                    output: ty::FnConverging(tcx.types.int),
+                    output: ty::FnConverging(tcx.types.isize),
                     variadic: false,
                 }),
             }));
index b591209a6383a8685ff78d550650c43c1cf55001..f1050a936e276f480f5ff0f822432dafe4ba90de 100644 (file)
@@ -29,8 +29,8 @@
 pub trait RegionScope {
     fn anon_regions(&self,
                     span: Span,
-                    count: uint)
-                    -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>>;
+                    count: usize)
+                    -> Result<Vec<ty::Region>, Option<Vec<(String, usize)>>>;
 
     /// If an object omits any explicit lifetime bound, and none can
     /// be derived from the object traits, what should we use? If
@@ -50,17 +50,17 @@ fn object_lifetime_default(&self, _span: Span) -> Option<ty::Region> {
 
     fn anon_regions(&self,
                     _span: Span,
-                    _count: uint)
-                    -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>> {
+                    _count: usize)
+                    -> Result<Vec<ty::Region>, Option<Vec<(String, usize)>>> {
         Err(None)
     }
 }
 
 // Same as `ExplicitRscope`, but provides some extra information for diagnostics
-pub struct UnelidableRscope(Vec<(String, uint)>);
+pub struct UnelidableRscope(Vec<(String, usize)>);
 
 impl UnelidableRscope {
-    pub fn new(v: Vec<(String, uint)>) -> UnelidableRscope {
+    pub fn new(v: Vec<(String, usize)>) -> UnelidableRscope {
         UnelidableRscope(v)
     }
 }
@@ -72,8 +72,8 @@ fn object_lifetime_default(&self, _span: Span) -> Option<ty::Region> {
 
     fn anon_regions(&self,
                     _span: Span,
-                    _count: uint)
-                    -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>> {
+                    _count: usize)
+                    -> Result<Vec<ty::Region>, Option<Vec<(String, usize)>>> {
         let UnelidableRscope(ref v) = *self;
         Err(Some(v.clone()))
     }
@@ -103,8 +103,8 @@ fn object_lifetime_default(&self, _span: Span) -> Option<ty::Region> {
 
     fn anon_regions(&self,
                     _span: Span,
-                    count: uint)
-                    -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>>
+                    count: usize)
+                    -> Result<Vec<ty::Region>, Option<Vec<(String, usize)>>>
     {
         Ok(repeat(self.default).take(count).collect())
     }
@@ -140,8 +140,8 @@ fn object_lifetime_default(&self, _span: Span) -> Option<ty::Region> {
 
     fn anon_regions(&self,
                     _: Span,
-                    count: uint)
-                    -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>>
+                    count: usize)
+                    -> Result<Vec<ty::Region>, Option<Vec<(String, usize)>>>
     {
         Ok((0..count).map(|_| self.next_region()).collect())
     }
@@ -176,8 +176,8 @@ fn object_lifetime_default(&self, span: Span) -> Option<ty::Region> {
 
     fn anon_regions(&self,
                     span: Span,
-                    count: uint)
-                    -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>>
+                    count: usize)
+                    -> Result<Vec<ty::Region>, Option<Vec<(String, usize)>>>
     {
         self.base_scope.anon_regions(span, count)
     }
@@ -203,8 +203,8 @@ fn object_lifetime_default(&self, span: Span) -> Option<ty::Region> {
 
     fn anon_regions(&self,
                     span: Span,
-                    count: uint)
-                    -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>>
+                    count: usize)
+                    -> Result<Vec<ty::Region>, Option<Vec<(String, usize)>>>
     {
         match self.base_scope.anon_regions(span, count) {
             Ok(mut v) => {
index ac1ff29e7f5455407c9eecd35e1dc4c46c2cc493..b014238b6f286d32fa50502c38188f21234a7d47 100644 (file)
@@ -296,7 +296,7 @@ pub fn infer_variance(tcx: &ty::ctxt) {
 type VarianceTermPtr<'a> = &'a VarianceTerm<'a>;
 
 #[derive(Copy, Debug)]
-struct InferredIndex(uint);
+struct InferredIndex(usize);
 
 #[derive(Copy)]
 enum VarianceTerm<'a> {
@@ -346,7 +346,7 @@ struct InferredInfo<'a> {
     item_id: ast::NodeId,
     kind: ParamKind,
     space: ParamSpace,
-    index: uint,
+    index: usize,
     param_id: ast::NodeId,
     term: VarianceTermPtr<'a>,
 
@@ -457,7 +457,7 @@ fn add_inferred(&mut self,
                     item_id: ast::NodeId,
                     kind: ParamKind,
                     space: ParamSpace,
-                    index: uint,
+                    index: usize,
                     param_id: ast::NodeId) {
         let inf_index = InferredIndex(self.inferred_infos.len());
         let term = self.arena.alloc(InferredTerm(inf_index));
@@ -488,7 +488,7 @@ fn add_inferred(&mut self,
     fn pick_initial_variance(&self,
                              item_id: ast::NodeId,
                              space: ParamSpace,
-                             index: uint)
+                             index: usize)
                              -> ty::Variance
     {
         match space {
@@ -505,7 +505,7 @@ fn pick_initial_variance(&self,
         }
     }
 
-    fn num_inferred(&self) -> uint {
+    fn num_inferred(&self) -> usize {
         self.inferred_infos.len()
     }
 }
@@ -791,7 +791,7 @@ fn declared_variance(&self,
                          item_def_id: ast::DefId,
                          kind: ParamKind,
                          space: ParamSpace,
-                         index: uint)
+                         index: usize)
                          -> VarianceTermPtr<'a> {
         assert_eq!(param_def_id.krate, item_def_id.krate);
 
@@ -977,7 +977,7 @@ fn add_constraints_from_ty(&mut self,
             }
 
             ty::ty_param(ref data) => {
-                let def_id = generics.types.get(data.space, data.idx as uint).def_id;
+                let def_id = generics.types.get(data.space, data.idx as usize).def_id;
                 assert_eq!(def_id.krate, ast::LOCAL_CRATE);
                 match self.terms_cx.inferred_map.get(&def_id.node) {
                     Some(&index) => {
@@ -1027,9 +1027,9 @@ fn add_constraints_from_substs(&mut self,
         for p in type_param_defs {
             let variance_decl =
                 self.declared_variance(p.def_id, def_id, TypeParam,
-                                       p.space, p.index as uint);
+                                       p.space, p.index as usize);
             let variance_i = self.xform(variance, variance_decl);
-            let substs_ty = *substs.types.get(p.space, p.index as uint);
+            let substs_ty = *substs.types.get(p.space, p.index as usize);
             debug!("add_constraints_from_substs: variance_decl={:?} variance_i={:?}",
                    variance_decl, variance_i);
             self.add_constraints_from_ty(generics, substs_ty, variance_i);
@@ -1038,9 +1038,9 @@ fn add_constraints_from_substs(&mut self,
         for p in region_param_defs {
             let variance_decl =
                 self.declared_variance(p.def_id, def_id,
-                                       RegionParam, p.space, p.index as uint);
+                                       RegionParam, p.space, p.index as usize);
             let variance_i = self.xform(variance, variance_decl);
-            let substs_r = *substs.regions().get(p.space, p.index as uint);
+            let substs_r = *substs.regions().get(p.space, p.index as usize);
             self.add_constraints_from_region(generics, substs_r, variance_i);
         }
     }
@@ -1059,14 +1059,29 @@ fn add_constraints_from_predicates(&mut self,
                 }
 
                 ty::Predicate::Equate(ty::Binder(ref data)) => {
-                    self.add_constraints_from_ty(generics, data.0, variance);
-                    self.add_constraints_from_ty(generics, data.1, variance);
+                    // A == B is only true if A and B are the same
+                    // types, not subtypes of one another, so this is
+                    // an invariant position:
+                    self.add_constraints_from_ty(generics, data.0, self.invariant);
+                    self.add_constraints_from_ty(generics, data.1, self.invariant);
                 }
 
                 ty::Predicate::TypeOutlives(ty::Binder(ref data)) => {
-                    self.add_constraints_from_ty(generics, data.0, variance);
+                    // Why contravariant on both? Let's consider:
+                    //
+                    // Under what conditions is `(T:'t) <: (U:'u)`,
+                    // meaning that `(T:'t) => (U:'u)`. The answer is
+                    // if `U <: T` or `'u <= 't`. Let's see some examples:
+                    //
+                    //   (T: 'big) => (T: 'small)
+                    //   where 'small <= 'big
+                    //
+                    //   (&'small Foo: 't) => (&'big Foo: 't)
+                    //   where 'small <= 'big
+                    //   note that &'big Foo <: &'small Foo
 
                     let variance_r = self.xform(variance, self.contravariant);
+                    self.add_constraints_from_ty(generics, data.0, variance_r);
                     self.add_constraints_from_region(generics, data.1, variance_r);
                 }
 
@@ -1084,6 +1099,9 @@ fn add_constraints_from_predicates(&mut self,
                                                         &*data.projection_ty.trait_ref,
                                                         variance);
 
+                    // as the equality predicate above, a binder is a
+                    // type equality relation, not a subtyping
+                    // relation
                     self.add_constraints_from_ty(generics, data.ty, self.invariant);
                 }
             }
index 41e05ff5162cfca0e849b00ca76d13f981572a2e..e4d9fac5b9cb53e5d90bb790ef877d10879efecc 100644 (file)
@@ -1322,7 +1322,7 @@ pub enum Type {
     /// For parameterized types, so the consumer of the JSON don't go
     /// looking for types which don't exist anywhere.
     Generic(String),
-    /// Primitives are the fixed-size numeric types (plus int/uint/float), char,
+    /// Primitives are the fixed-size numeric types (plus int/usize/float), char,
     /// arrays, slices, and tuples.
     Primitive(PrimitiveType),
     /// extern "ABI" fn
@@ -1383,12 +1383,12 @@ pub enum TypeKind {
 impl PrimitiveType {
     fn from_str(s: &str) -> Option<PrimitiveType> {
         match s {
-            "isize" | "int" => Some(Isize),
+            "isize" => Some(Isize),
             "i8" => Some(I8),
             "i16" => Some(I16),
             "i32" => Some(I32),
             "i64" => Some(I64),
-            "usize" | "uint" => Some(Usize),
+            "usize" => Some(Usize),
             "u8" => Some(U8),
             "u16" => Some(U16),
             "u32" => Some(U32),
@@ -1516,12 +1516,12 @@ fn clean(&self, cx: &DocContext) -> Type {
         match self.sty {
             ty::ty_bool => Primitive(Bool),
             ty::ty_char => Primitive(Char),
-            ty::ty_int(ast::TyIs(_)) => Primitive(Isize),
+            ty::ty_int(ast::TyIs) => Primitive(Isize),
             ty::ty_int(ast::TyI8) => Primitive(I8),
             ty::ty_int(ast::TyI16) => Primitive(I16),
             ty::ty_int(ast::TyI32) => Primitive(I32),
             ty::ty_int(ast::TyI64) => Primitive(I64),
-            ty::ty_uint(ast::TyUs(_)) => Primitive(Usize),
+            ty::ty_uint(ast::TyUs) => Primitive(Usize),
             ty::ty_uint(ast::TyU8) => Primitive(U8),
             ty::ty_uint(ast::TyU16) => Primitive(U16),
             ty::ty_uint(ast::TyU32) => Primitive(U32),
@@ -1833,10 +1833,10 @@ fn clean(&self, cx: &DocContext) -> VariantKind {
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct Span {
     pub filename: String,
-    pub loline: uint,
-    pub locol: uint,
-    pub hiline: uint,
-    pub hicol: uint,
+    pub loline: usize,
+    pub locol: usize,
+    pub hiline: usize,
+    pub hicol: usize,
 }
 
 impl Span {
@@ -2399,12 +2399,12 @@ fn resolve_type(cx: &DocContext,
             ast::TyStr => return Primitive(Str),
             ast::TyBool => return Primitive(Bool),
             ast::TyChar => return Primitive(Char),
-            ast::TyInt(ast::TyIs(_)) => return Primitive(Isize),
+            ast::TyInt(ast::TyIs) => return Primitive(Isize),
             ast::TyInt(ast::TyI8) => return Primitive(I8),
             ast::TyInt(ast::TyI16) => return Primitive(I16),
             ast::TyInt(ast::TyI32) => return Primitive(I32),
             ast::TyInt(ast::TyI64) => return Primitive(I64),
-            ast::TyUint(ast::TyUs(_)) => return Primitive(Usize),
+            ast::TyUint(ast::TyUs) => return Primitive(Usize),
             ast::TyUint(ast::TyU8) => return Primitive(U8),
             ast::TyUint(ast::TyU16) => return Primitive(U16),
             ast::TyUint(ast::TyU32) => return Primitive(U32),
index cfa84de5ca7c9f37577877f1bc6f38ea347300ca..afc434eb2dfdaf62dd6afc7281b669fd73d11972 100644 (file)
@@ -185,7 +185,7 @@ fn stripped_filtered_line<'a>(s: &'a str) -> Option<&'a str> {
     }
 }
 
-thread_local!(static USED_HEADER_MAP: RefCell<HashMap<String, uint>> = {
+thread_local!(static USED_HEADER_MAP: RefCell<HashMap<String, usize>> = {
     RefCell::new(HashMap::new())
 });
 
@@ -356,7 +356,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
             });
             let text = lines.collect::<Vec<&str>>().connect("\n");
             tests.add_test(text.to_string(),
-                           block_info.should_fail, block_info.no_run,
+                           block_info.should_panic, block_info.no_run,
                            block_info.ignore, block_info.test_harness);
         }
     }
@@ -397,7 +397,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
 
 #[derive(Eq, PartialEq, Clone, Debug)]
 struct LangString {
-    should_fail: bool,
+    should_panic: bool,
     no_run: bool,
     ignore: bool,
     rust: bool,
@@ -407,7 +407,7 @@ struct LangString {
 impl LangString {
     fn all_false() -> LangString {
         LangString {
-            should_fail: false,
+            should_panic: false,
             no_run: false,
             ignore: false,
             rust: true,  // NB This used to be `notrust = false`
@@ -427,7 +427,7 @@ fn parse(string: &str) -> LangString {
         for token in tokens {
             match token {
                 "" => {},
-                "should_fail" => { data.should_fail = true; seen_rust_tags = true; },
+                "should_panic" => { data.should_panic = true; seen_rust_tags = true; },
                 "no_run" => { data.no_run = true; seen_rust_tags = true; },
                 "ignore" => { data.ignore = true; seen_rust_tags = true; },
                 "rust" => { data.rust = true; seen_rust_tags = true; },
@@ -528,9 +528,9 @@ mod tests {
     #[test]
     fn test_lang_string_parse() {
         fn t(s: &str,
-            should_fail: bool, no_run: bool, ignore: bool, rust: bool, test_harness: bool) {
+            should_panic: bool, no_run: bool, ignore: bool, rust: bool, test_harness: bool) {
             assert_eq!(LangString::parse(s), LangString {
-                should_fail: should_fail,
+                should_panic: should_panic,
                 no_run: no_run,
                 ignore: ignore,
                 rust: rust,
@@ -538,16 +538,16 @@ fn t(s: &str,
             })
         }
 
-        // marker                | should_fail | no_run | ignore | rust | test_harness
+        // marker                | should_panic| no_run | ignore | rust | test_harness
         t("",                      false,        false,   false,   true,  false);
         t("rust",                  false,        false,   false,   true,  false);
         t("sh",                    false,        false,   false,   false, false);
         t("ignore",                false,        false,   true,    true,  false);
-        t("should_fail",           true,         false,   false,   true,  false);
+        t("should_panic",          true,         false,   false,   true,  false);
         t("no_run",                false,        true,    false,   true,  false);
         t("test_harness",          false,        false,   false,   true,  true);
         t("{.no_run .example}",    false,        true,    false,   true,  false);
-        t("{.sh .should_fail}",    true,         false,   false,   true,  false);
+        t("{.sh .should_panic}",   true,         false,   false,   true,  false);
         t("{.example .rust}",      false,        false,   false,   true,  false);
         t("{.test_harness .rust}", false,        false,   false,   true,  true);
     }
index d36124247945bf936f473641e49f704e82a0c7e7..179418174d950ede4ade22a8c2c0af29d29773e1 100644 (file)
@@ -125,6 +125,7 @@ pub struct Implementor {
     pub trait_: clean::Type,
     pub for_: clean::Type,
     pub stability: Option<clean::Stability>,
+    pub polarity: Option<clean::ImplPolarity>,
 }
 
 /// Metadata about implementations for a type.
@@ -498,7 +499,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::Result<String> {
             try!(write!(&mut w, ","));
         }
         try!(write!(&mut w, r#"[{},"{}","{}",{}"#,
-                    item.ty as uint, item.name, path,
+                    item.ty as usize, item.name, path,
                     item.desc.to_json().to_string()));
         match item.parent {
             Some(nodeid) => {
@@ -522,7 +523,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::Result<String> {
             try!(write!(&mut w, ","));
         }
         try!(write!(&mut w, r#"[{},"{}"]"#,
-                    short as uint, *fqp.last().unwrap()));
+                    short as usize, *fqp.last().unwrap()));
     }
 
     try!(write!(&mut w, "]}};"));
@@ -635,9 +636,11 @@ fn collect(path: &Path, krate: &str,
             // going on). If they're in different crates then the crate defining
             // the trait will be interested in our implementation.
             if imp.def_id.krate == did.krate { continue }
-            try!(write!(&mut f, r#""{}impl{} {} for {}","#,
+            try!(write!(&mut f, r#""{}impl{} {}{} for {}","#,
                         ConciseStability(&imp.stability),
-                        imp.generics, imp.trait_, imp.for_));
+                        imp.generics,
+                        if imp.polarity == Some(clean::ImplPolarity::Negative) { "!" } else { "" },
+                        imp.trait_, imp.for_));
         }
         try!(writeln!(&mut f, r"];"));
         try!(writeln!(&mut f, "{}", r"
@@ -882,6 +885,7 @@ fn fold_item(&mut self, item: clean::Item) -> Option<clean::Item> {
                         trait_: i.trait_.as_ref().unwrap().clone(),
                         for_: i.for_.clone(),
                         stability: item.stability.clone(),
+                        polarity: i.polarity.clone(),
                     });
                 }
                 Some(..) | None => {}
@@ -1567,7 +1571,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
 
     let mut indices = (0..items.len()).filter(|i| {
         !cx.ignore_private_item(&items[*i])
-    }).collect::<Vec<uint>>();
+    }).collect::<Vec<usize>>();
 
     // the order of item types in the listing
     fn reorder(ty: ItemType) -> u8 {
@@ -1588,7 +1592,7 @@ fn reorder(ty: ItemType) -> u8 {
         }
     }
 
-    fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> Ordering {
+    fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: usize, idx2: usize) -> Ordering {
         let ty1 = shortty(i1);
         let ty2 = shortty(i2);
         if ty1 == ty2 {
index 1f075566ad5a280aca775e27fd5398e076b7bf11..2af20ce59da57d718ad9fd5821adf5851f00ea21 100644 (file)
@@ -493,6 +493,10 @@ h1 .stability {
 .stability.Locked { border-color: #0084B6; color: #00668c; }
 .stability.Unmarked { border-color: #BBBBBB; }
 
+td.summary-column {
+    width: 100%;
+}
+
 .summary {
     padding-right: 0px;
 }
index ecef4c9bf7226c182aa08dee218074609a6387d1..78feb6c77c45451f8f2df38420c850651825923c 100644 (file)
@@ -33,7 +33,7 @@ pub struct Toc {
 }
 
 impl Toc {
-    fn count_entries_with_level(&self, level: u32) -> uint {
+    fn count_entries_with_level(&self, level: u32) -> usize {
         self.entries.iter().filter(|e| e.level == level).count()
     }
 }
index a85f770f63ca49fceaea83886ab68397ee181985..431cb4a28989e1902866b7d5674b38c3dd17839b 100644 (file)
 #![crate_type = "dylib"]
 #![crate_type = "rlib"]
 #![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/",
-       html_playground_url = "http://play.rust-lang.org/")]
+   html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+   html_root_url = "http://doc.rust-lang.org/nightly/",
+   html_playground_url = "http://play.rust-lang.org/")]
 
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![feature(collections)]
 #![feature(core)]
 #![feature(exit_status)]
-#![feature(int_uint)]
 #![feature(set_stdio)]
 #![feature(libc)]
-#![feature(old_path)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
 #![feature(std_misc)]
@@ -39,6 +37,7 @@
 #![feature(path_ext)]
 #![feature(path_relative_from)]
 #![feature(convert)]
+#![feature(slice_patterns)]
 
 extern crate arena;
 extern crate getopts;
 extern crate rustc_back;
 extern crate serialize;
 extern crate syntax;
-extern crate "test" as testing;
+extern crate test as testing;
 extern crate unicode;
 #[macro_use] extern crate log;
 
-extern crate "serialize" as rustc_serialize; // used by deriving
+extern crate serialize as rustc_serialize; // used by deriving
 
 use std::cell::RefCell;
 use std::collections::HashMap;
@@ -66,8 +65,6 @@
 use std::rc::Rc;
 use std::sync::mpsc::channel;
 
-#[allow(deprecated)] use std::old_path::Path;
-
 use externalfiles::ExternalHtml;
 use serialize::Decodable;
 use serialize::json::{self, Json};
@@ -195,7 +192,7 @@ pub fn usage(argv0: &str) {
                             &opts()));
 }
 
-pub fn main_args(args: &[String]) -> int {
+pub fn main_args(args: &[String]) -> isize {
     let matches = match getopts::getopts(args.tail(), &opts()) {
         Ok(m) => m,
         Err(err) => {
@@ -435,7 +432,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
     // Load all plugins/passes into a PluginManager
     let path = matches.opt_str("plugin-path")
                       .unwrap_or("/tmp/rustdoc/plugins".to_string());
-    let mut pm = plugins::PluginManager::new(Path::new(path));
+    let mut pm = plugins::PluginManager::new(PathBuf::from(path));
     for pass in &passes {
         let plugin = match PASSES.iter()
                                  .position(|&(p, _, _)| {
index f3d7ae19f4d3c1f978000636c5bf765381698e6e..a84da60b01831da1b6e7733ef105539a7d0dec0c 100644 (file)
@@ -44,7 +44,7 @@ fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) {
 /// Render `input` (e.g. "foo.md") into an HTML file in `output`
 /// (e.g. output = "bar" => "bar/foo.html").
 pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
-              external_html: &ExternalHtml, include_toc: bool) -> int {
+              external_html: &ExternalHtml, include_toc: bool) -> isize {
     let input_p = Path::new(input);
     output.push(input_p.file_stem().unwrap());
     output.set_extension("html");
@@ -140,7 +140,7 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
 
 /// Run any tests/code examples in the markdown file `input`.
 pub fn test(input: &str, libs: SearchPaths, externs: core::Externs,
-            mut test_args: Vec<String>) -> int {
+            mut test_args: Vec<String>) -> isize {
     let input_str = load_or_return!(input, 1, 2);
 
     let mut collector = Collector::new(input.to_string(), libs, externs, true, false);
index fac8f2e2a9cc2cef926786095fa4466075c2b85d..d4d214f449d5921733ca9c2c9c9140e23b02fd9b 100644 (file)
@@ -16,7 +16,7 @@
 use serialize::json;
 use std::mem;
 use std::string::String;
-use std::old_path::{Path, GenericPath};
+use std::path::PathBuf;
 
 pub type PluginJson = Option<(String, json::Json)>;
 pub type PluginResult = (clean::Crate, PluginJson);
@@ -27,12 +27,12 @@ pub struct PluginManager {
     dylibs: Vec<dl::DynamicLibrary> ,
     callbacks: Vec<PluginCallback> ,
     /// The directory plugins will be loaded from
-    pub prefix: Path,
+    pub prefix: PathBuf,
 }
 
 impl PluginManager {
     /// Create a new plugin manager
-    pub fn new(prefix: Path) -> PluginManager {
+    pub fn new(prefix: PathBuf) -> PluginManager {
         PluginManager {
             dylibs: Vec::new(),
             callbacks: Vec::new(),
index 0726a822b59b7a469d11092e6ba9f13e3cf23b0e..f75fced3bc26d0e04faf4f95ed3d4df95bf81eca 100644 (file)
@@ -86,7 +86,7 @@ fn cmp(&self, other: &ModuleSummary) -> Ordering {
     }
 }
 
-// is the item considered publically visible?
+// is the item considered publicly visible?
 fn visible(item: &Item) -> bool {
     match item.inner {
         ImplItem(_) => true,
index 7b37a5a9d1c8167e6fd19f3f60aa1222b291cc47..babbe15b17df51ad1beeaa06f6540f6c2c951e74 100644 (file)
@@ -45,7 +45,7 @@ pub fn run(input: &str,
            externs: core::Externs,
            mut test_args: Vec<String>,
            crate_name: Option<String>)
-           -> int {
+           -> isize {
     let input_path = PathBuf::from(input);
     let input = config::Input::File(input_path.clone());
 
@@ -224,7 +224,7 @@ fn drop(&mut self) {
     // environment to ensure that the target loads the right libraries at
     // runtime. It would be a sad day if the *host* libraries were loaded as a
     // mistake.
-    let mut cmd = Command::new(&outdir.path().join("rust-out"));
+    let mut cmd = Command::new(&outdir.path().join("rust_out"));
     let var = DynamicLibrary::envvar();
     let newpath = {
         let path = env::var_os(var).unwrap_or(OsString::new());
@@ -243,8 +243,9 @@ fn drop(&mut self) {
             if should_panic && out.status.success() {
                 panic!("test executable succeeded when it should have failed");
             } else if !should_panic && !out.status.success() {
-                panic!("test executable failed:\n{:?}",
-                      str::from_utf8(&out.stdout));
+                panic!("test executable failed:\n{}\n{}",
+                       str::from_utf8(&out.stdout).unwrap_or(""),
+                       str::from_utf8(&out.stderr).unwrap_or(""));
             }
         }
     }
@@ -321,7 +322,7 @@ pub struct Collector {
     names: Vec<String>,
     libs: SearchPaths,
     externs: core::Externs,
-    cnt: uint,
+    cnt: usize,
     use_headers: bool,
     current_header: Option<String>,
     cratename: String,
index e42aa1835dc4466e46e6429eaa292b801267bd54..dc44536d60cea0403a619e3a27f814926111a6b3 100644 (file)
@@ -44,8 +44,8 @@ impl ToHex for [u8] {
     fn to_hex(&self) -> String {
         let mut v = Vec::with_capacity(self.len() * 2);
         for &byte in self {
-            v.push(CHARS[(byte >> 4) as uint]);
-            v.push(CHARS[(byte & 0xf) as uint]);
+            v.push(CHARS[(byte >> 4) as usize]);
+            v.push(CHARS[(byte & 0xf) as usize]);
         }
 
         unsafe {
@@ -65,7 +65,7 @@ pub trait FromHex {
 #[derive(Copy, Debug)]
 pub enum FromHexError {
     /// The input contained a character not part of the hex format
-    InvalidHexCharacter(char, uint),
+    InvalidHexCharacter(char, usize),
     /// The input had an invalid length
     InvalidHexLength,
 }
@@ -188,7 +188,7 @@ pub fn test_from_hex_ignores_whitespace() {
     #[test]
     pub fn test_to_hex_all_bytes() {
         for i in 0..256 {
-            assert_eq!([i as u8].to_hex(), format!("{:02x}", i as uint));
+            assert_eq!([i as u8].to_hex(), format!("{:02x}", i as usize));
         }
     }
 
@@ -196,10 +196,10 @@ pub fn test_to_hex_all_bytes() {
     pub fn test_from_hex_all_bytes() {
         for i in 0..256 {
             let ii: &[u8] = &[i as u8];
-            assert_eq!(format!("{:02x}", i as uint).from_hex()
+            assert_eq!(format!("{:02x}", i as usize).from_hex()
                                                    .unwrap(),
                        ii);
-            assert_eq!(format!("{:02X}", i as uint).from_hex()
+            assert_eq!(format!("{:02X}", i as usize).from_hex()
                                                    .unwrap(),
                        ii);
         }
index 0d6ed91d5298139b1cdf5800d3e6ac20c08aaab4..2d5d8cd501a46100e1fc493b03d382b6139ca784 100644 (file)
 use std::collections::{HashMap, BTreeMap};
 use std::io::prelude::*;
 use std::io;
-use std::mem::{swap};
+use std::mem::swap;
 use std::num::FpCategory as Fp;
+#[allow(deprecated)]
+use std::num::wrapping::WrappingOps;
 use std::ops::Index;
 use std::str::FromStr;
 use std::string;
@@ -233,7 +235,7 @@ pub enum Json {
 pub struct PrettyJson<'a> { inner: &'a Json }
 
 pub struct AsJson<'a, T: 'a> { inner: &'a T }
-pub struct AsPrettyJson<'a, T: 'a> { inner: &'a T, indent: Option<uint> }
+pub struct AsPrettyJson<'a, T: 'a> { inner: &'a T, indent: Option<usize> }
 
 /// The errors that can arise while parsing a JSON stream.
 #[derive(Clone, Copy, PartialEq, Debug)]
@@ -260,7 +262,7 @@ pub enum ErrorCode {
 #[derive(Clone, PartialEq, Debug)]
 pub enum ParserError {
     /// msg, line, col
-    SyntaxError(ErrorCode, uint, uint),
+    SyntaxError(ErrorCode, usize, usize),
     IoError(io::ErrorKind, String),
 }
 
@@ -441,7 +443,7 @@ fn escape_char(writer: &mut fmt::Write, v: char) -> EncodeResult {
     escape_str(writer, buf)
 }
 
-fn spaces(wr: &mut fmt::Write, mut n: uint) -> EncodeResult {
+fn spaces(wr: &mut fmt::Write, mut n: usize) -> EncodeResult {
     const BUF: &'static str = "                ";
 
     while n >= BUF.len() {
@@ -498,13 +500,13 @@ fn emit_nil(&mut self) -> EncodeResult {
         Ok(())
     }
 
-    fn emit_uint(&mut self, v: uint) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
+    fn emit_uint(&mut self, v: usize) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_u64(&mut self, v: u64) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_u32(&mut self, v: u32) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_u16(&mut self, v: u16) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_u8(&mut self, v: u8) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
 
-    fn emit_int(&mut self, v: int) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
+    fn emit_int(&mut self, v: isize) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_i64(&mut self, v: i64) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_i32(&mut self, v: i32) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_i16(&mut self, v: i16) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
@@ -542,8 +544,8 @@ fn emit_enum<F>(&mut self, _name: &str, f: F) -> EncodeResult where
 
     fn emit_enum_variant<F>(&mut self,
                             name: &str,
-                            _id: uint,
-                            cnt: uint,
+                            _id: usize,
+                            cnt: usize,
                             f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
@@ -563,7 +565,7 @@ fn emit_enum_variant<F>(&mut self,
         }
     }
 
-    fn emit_enum_variant_arg<F>(&mut self, idx: uint, f: F) -> EncodeResult where
+    fn emit_enum_variant_arg<F>(&mut self, idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -575,8 +577,8 @@ fn emit_enum_variant_arg<F>(&mut self, idx: uint, f: F) -> EncodeResult where
 
     fn emit_enum_struct_variant<F>(&mut self,
                                    name: &str,
-                                   id: uint,
-                                   cnt: uint,
+                                   id: usize,
+                                   cnt: usize,
                                    f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
@@ -586,7 +588,7 @@ fn emit_enum_struct_variant<F>(&mut self,
 
     fn emit_enum_struct_variant_field<F>(&mut self,
                                          _: &str,
-                                         idx: uint,
+                                         idx: usize,
                                          f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
@@ -594,7 +596,7 @@ fn emit_enum_struct_variant_field<F>(&mut self,
         self.emit_enum_variant_arg(idx, f)
     }
 
-    fn emit_struct<F>(&mut self, _: &str, _: uint, f: F) -> EncodeResult where
+    fn emit_struct<F>(&mut self, _: &str, _: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -604,7 +606,7 @@ fn emit_struct<F>(&mut self, _: &str, _: uint, f: F) -> EncodeResult where
         Ok(())
     }
 
-    fn emit_struct_field<F>(&mut self, name: &str, idx: uint, f: F) -> EncodeResult where
+    fn emit_struct_field<F>(&mut self, name: &str, idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -614,26 +616,26 @@ fn emit_struct_field<F>(&mut self, name: &str, idx: uint, f: F) -> EncodeResult
         f(self)
     }
 
-    fn emit_tuple<F>(&mut self, len: uint, f: F) -> EncodeResult where
+    fn emit_tuple<F>(&mut self, len: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
         self.emit_seq(len, f)
     }
-    fn emit_tuple_arg<F>(&mut self, idx: uint, f: F) -> EncodeResult where
+    fn emit_tuple_arg<F>(&mut self, idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
         self.emit_seq_elt(idx, f)
     }
 
-    fn emit_tuple_struct<F>(&mut self, _name: &str, len: uint, f: F) -> EncodeResult where
+    fn emit_tuple_struct<F>(&mut self, _name: &str, len: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
         self.emit_seq(len, f)
     }
-    fn emit_tuple_struct_arg<F>(&mut self, idx: uint, f: F) -> EncodeResult where
+    fn emit_tuple_struct_arg<F>(&mut self, idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -657,7 +659,7 @@ fn emit_option_some<F>(&mut self, f: F) -> EncodeResult where
         f(self)
     }
 
-    fn emit_seq<F>(&mut self, _len: uint, f: F) -> EncodeResult where
+    fn emit_seq<F>(&mut self, _len: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -667,7 +669,7 @@ fn emit_seq<F>(&mut self, _len: uint, f: F) -> EncodeResult where
         Ok(())
     }
 
-    fn emit_seq_elt<F>(&mut self, idx: uint, f: F) -> EncodeResult where
+    fn emit_seq_elt<F>(&mut self, idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -677,7 +679,7 @@ fn emit_seq_elt<F>(&mut self, idx: uint, f: F) -> EncodeResult where
         f(self)
     }
 
-    fn emit_map<F>(&mut self, _len: uint, f: F) -> EncodeResult where
+    fn emit_map<F>(&mut self, _len: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -687,7 +689,7 @@ fn emit_map<F>(&mut self, _len: uint, f: F) -> EncodeResult where
         Ok(())
     }
 
-    fn emit_map_elt_key<F>(&mut self, idx: uint, f: F) -> EncodeResult where
+    fn emit_map_elt_key<F>(&mut self, idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -698,7 +700,7 @@ fn emit_map_elt_key<F>(&mut self, idx: uint, f: F) -> EncodeResult where
         Ok(())
     }
 
-    fn emit_map_elt_val<F>(&mut self, _idx: uint, f: F) -> EncodeResult where
+    fn emit_map_elt_val<F>(&mut self, _idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -711,8 +713,8 @@ fn emit_map_elt_val<F>(&mut self, _idx: uint, f: F) -> EncodeResult where
 /// compact data
 pub struct PrettyEncoder<'a> {
     writer: &'a mut (fmt::Write+'a),
-    curr_indent: uint,
-    indent: uint,
+    curr_indent: usize,
+    indent: usize,
     is_emitting_map_key: bool,
 }
 
@@ -729,7 +731,7 @@ pub fn new(writer: &'a mut fmt::Write) -> PrettyEncoder<'a> {
 
     /// Set the number of spaces to indent for each level.
     /// This is safe to set during encoding.
-    pub fn set_indent(&mut self, indent: uint) {
+    pub fn set_indent(&mut self, indent: usize) {
         // self.indent very well could be 0 so we need to use checked division.
         let level = self.curr_indent.checked_div(self.indent).unwrap_or(0);
         self.indent = indent;
@@ -746,13 +748,13 @@ fn emit_nil(&mut self) -> EncodeResult {
         Ok(())
     }
 
-    fn emit_uint(&mut self, v: uint) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
+    fn emit_uint(&mut self, v: usize) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_u64(&mut self, v: u64) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_u32(&mut self, v: u32) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_u16(&mut self, v: u16) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_u8(&mut self, v: u8) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
 
-    fn emit_int(&mut self, v: int) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
+    fn emit_int(&mut self, v: isize) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_i64(&mut self, v: i64) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_i32(&mut self, v: i32) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
     fn emit_i16(&mut self, v: i16) -> EncodeResult { emit_enquoted_if_mapkey!(self, v) }
@@ -790,8 +792,8 @@ fn emit_enum<F>(&mut self, _name: &str, f: F) -> EncodeResult where
 
     fn emit_enum_variant<F>(&mut self,
                             name: &str,
-                            _id: uint,
-                            cnt: uint,
+                            _id: usize,
+                            cnt: usize,
                             f: F)
                             -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
@@ -821,7 +823,7 @@ fn emit_enum_variant<F>(&mut self,
         }
     }
 
-    fn emit_enum_variant_arg<F>(&mut self, idx: uint, f: F) -> EncodeResult where
+    fn emit_enum_variant_arg<F>(&mut self, idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -834,8 +836,8 @@ fn emit_enum_variant_arg<F>(&mut self, idx: uint, f: F) -> EncodeResult where
 
     fn emit_enum_struct_variant<F>(&mut self,
                                    name: &str,
-                                   id: uint,
-                                   cnt: uint,
+                                   id: usize,
+                                   cnt: usize,
                                    f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
@@ -845,7 +847,7 @@ fn emit_enum_struct_variant<F>(&mut self,
 
     fn emit_enum_struct_variant_field<F>(&mut self,
                                          _: &str,
-                                         idx: uint,
+                                         idx: usize,
                                          f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
@@ -854,7 +856,7 @@ fn emit_enum_struct_variant_field<F>(&mut self,
     }
 
 
-    fn emit_struct<F>(&mut self, _: &str, len: uint, f: F) -> EncodeResult where
+    fn emit_struct<F>(&mut self, _: &str, len: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -872,7 +874,7 @@ fn emit_struct<F>(&mut self, _: &str, len: uint, f: F) -> EncodeResult where
         Ok(())
     }
 
-    fn emit_struct_field<F>(&mut self, name: &str, idx: uint, f: F) -> EncodeResult where
+    fn emit_struct_field<F>(&mut self, name: &str, idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -887,26 +889,26 @@ fn emit_struct_field<F>(&mut self, name: &str, idx: uint, f: F) -> EncodeResult
         f(self)
     }
 
-    fn emit_tuple<F>(&mut self, len: uint, f: F) -> EncodeResult where
+    fn emit_tuple<F>(&mut self, len: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
         self.emit_seq(len, f)
     }
-    fn emit_tuple_arg<F>(&mut self, idx: uint, f: F) -> EncodeResult where
+    fn emit_tuple_arg<F>(&mut self, idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
         self.emit_seq_elt(idx, f)
     }
 
-    fn emit_tuple_struct<F>(&mut self, _: &str, len: uint, f: F) -> EncodeResult where
+    fn emit_tuple_struct<F>(&mut self, _: &str, len: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
         self.emit_seq(len, f)
     }
-    fn emit_tuple_struct_arg<F>(&mut self, idx: uint, f: F) -> EncodeResult where
+    fn emit_tuple_struct_arg<F>(&mut self, idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -930,7 +932,7 @@ fn emit_option_some<F>(&mut self, f: F) -> EncodeResult where
         f(self)
     }
 
-    fn emit_seq<F>(&mut self, len: uint, f: F) -> EncodeResult where
+    fn emit_seq<F>(&mut self, len: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -948,7 +950,7 @@ fn emit_seq<F>(&mut self, len: uint, f: F) -> EncodeResult where
         Ok(())
     }
 
-    fn emit_seq_elt<F>(&mut self, idx: uint, f: F) -> EncodeResult where
+    fn emit_seq_elt<F>(&mut self, idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -961,7 +963,7 @@ fn emit_seq_elt<F>(&mut self, idx: uint, f: F) -> EncodeResult where
         f(self)
     }
 
-    fn emit_map<F>(&mut self, len: uint, f: F) -> EncodeResult where
+    fn emit_map<F>(&mut self, len: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -979,7 +981,7 @@ fn emit_map<F>(&mut self, len: uint, f: F) -> EncodeResult where
         Ok(())
     }
 
-    fn emit_map_elt_key<F>(&mut self, idx: uint, f: F) -> EncodeResult where
+    fn emit_map_elt_key<F>(&mut self, idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -995,7 +997,7 @@ fn emit_map_elt_key<F>(&mut self, idx: uint, f: F) -> EncodeResult where
         Ok(())
     }
 
-    fn emit_map_elt_val<F>(&mut self, _idx: uint, f: F) -> EncodeResult where
+    fn emit_map_elt_val<F>(&mut self, _idx: usize, f: F) -> EncodeResult where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
     {
         if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
@@ -1218,16 +1220,6 @@ pub fn as_null(&self) -> Option<()> {
     }
 }
 
-#[cfg(stage0)]
-impl<'a> Index<&'a str>  for Json {
-    type Output = Json;
-
-    fn index(&self, idx: & &str) -> &Json {
-        self.find(*idx).unwrap()
-    }
-}
-
-#[cfg(not(stage0))]
 impl<'a> Index<&'a str>  for Json {
     type Output = Json;
 
@@ -1236,26 +1228,13 @@ fn index(&self, idx: &'a str) -> &Json {
     }
 }
 
-#[cfg(stage0)]
-impl Index<uint> for Json {
-    type Output = Json;
-
-    fn index<'a>(&'a self, idx: &uint) -> &'a Json {
-        match self {
-            &Json::Array(ref v) => &v[*idx],
-            _ => panic!("can only index Json with uint if it is an array")
-        }
-    }
-}
-
-#[cfg(not(stage0))]
-impl Index<uint> for Json {
+impl Index<usize> for Json {
     type Output = Json;
 
-    fn index<'a>(&'a self, idx: uint) -> &'a Json {
+    fn index<'a>(&'a self, idx: usize) -> &'a Json {
         match self {
             &Json::Array(ref v) => &v[idx],
-            _ => panic!("can only index Json with uint if it is an array")
+            _ => panic!("can only index Json with usize if it is an array")
         }
     }
 }
@@ -1326,7 +1305,7 @@ pub fn new() -> Stack {
     }
 
     /// Returns The number of elements in the Stack.
-    pub fn len(&self) -> uint { self.stack.len() }
+    pub fn len(&self) -> usize { self.stack.len() }
 
     /// Returns true if the stack is empty.
     pub fn is_empty(&self) -> bool { self.stack.is_empty() }
@@ -1334,12 +1313,12 @@ pub fn is_empty(&self) -> bool { self.stack.is_empty() }
     /// Provides access to the StackElement at a given index.
     /// lower indices are at the bottom of the stack while higher indices are
     /// at the top.
-    pub fn get<'l>(&'l self, idx: uint) -> StackElement<'l> {
+    pub fn get<'l>(&'l self, idx: usize) -> StackElement<'l> {
         match self.stack[idx] {
             InternalIndex(i) => StackElement::Index(i),
             InternalKey(start, size) => {
                 StackElement::Key(str::from_utf8(
-                    &self.str_buffer[start as uint .. start as uint + size as uint])
+                    &self.str_buffer[start as usize .. start as usize + size as usize])
                         .unwrap())
             }
         }
@@ -1382,7 +1361,7 @@ pub fn top<'l>(&'l self) -> Option<StackElement<'l>> {
             Some(&InternalIndex(i)) => Some(StackElement::Index(i)),
             Some(&InternalKey(start, size)) => {
                 Some(StackElement::Key(str::from_utf8(
-                    &self.str_buffer[start as uint .. (start+size) as uint]
+                    &self.str_buffer[start as usize .. (start+size) as usize]
                 ).unwrap()))
             }
         }
@@ -1406,7 +1385,7 @@ fn pop(&mut self) {
         assert!(!self.is_empty());
         match *self.stack.last().unwrap() {
             InternalKey(_, sz) => {
-                let new_size = self.str_buffer.len() - sz as uint;
+                let new_size = self.str_buffer.len() - sz as usize;
                 self.str_buffer.truncate(new_size);
             }
             InternalIndex(_) => {}
@@ -1439,8 +1418,8 @@ fn bump_index(&mut self) {
 pub struct Parser<T> {
     rdr: T,
     ch: Option<char>,
-    line: uint,
-    col: uint,
+    line: usize,
+    col: usize,
     // We maintain a stack representing where we are in the logical structure
     // of the JSON stream.
     stack: Stack,
@@ -1575,6 +1554,7 @@ fn parse_number(&mut self) -> JsonEvent {
         }
     }
 
+    #[allow(deprecated)] // possible resolve bug is mapping these to traits
     fn parse_u64(&mut self) -> Result<u64, ParserError> {
         let mut accum = 0;
         let last_accum = 0; // necessary to detect overflow.
@@ -1625,7 +1605,7 @@ fn parse_decimal(&mut self, mut res: f64) -> Result<f64, ParserError> {
             match self.ch_or_null() {
                 c @ '0' ... '9' => {
                     dec /= 10.0;
-                    res += (((c as int) - ('0' as int)) as f64) * dec;
+                    res += (((c as isize) - ('0' as isize)) as f64) * dec;
                     self.bump();
                 }
                 _ => break,
@@ -1657,7 +1637,7 @@ fn parse_exponent(&mut self, mut res: f64) -> Result<f64, ParserError> {
             match self.ch_or_null() {
                 c @ '0' ... '9' => {
                     exp *= 10;
-                    exp += (c as uint) - ('0' as uint);
+                    exp += (c as usize) - ('0' as usize);
 
                     self.bump();
                 }
@@ -1769,7 +1749,7 @@ fn parse_str(&mut self) -> Result<string::String, ParserError> {
     // information to return a JsonEvent.
     // Manages an internal state so that parsing can be interrupted and resumed.
     // Also keeps track of the position in the logical structure of the json
-    // stream int the form of a stack that can be queried by the user using the
+    // stream isize the form of a stack that can be queried by the user using the
     // stack() method.
     fn parse(&mut self) -> JsonEvent {
         loop {
@@ -2150,7 +2130,7 @@ fn $name(&mut self) -> DecodeResult<$ty> {
                     None => Err(ExpectedError("Number".to_string(), format!("{}", f))),
                 },
                 Json::F64(f) => Err(ExpectedError("Integer".to_string(), format!("{}", f))),
-                // re: #12967.. a type w/ numeric keys (ie HashMap<uint, V> etc)
+                // re: #12967.. a type w/ numeric keys (ie HashMap<usize, V> etc)
                 // is going to have a string here, as per JSON spec.
                 Json::String(s) => match s.parse().ok() {
                     Some(f) => Ok(f),
@@ -2169,12 +2149,12 @@ fn read_nil(&mut self) -> DecodeResult<()> {
         expect!(self.pop(), Null)
     }
 
-    read_primitive! { read_uint, uint }
+    read_primitive! { read_uint, usize }
     read_primitive! { read_u8, u8 }
     read_primitive! { read_u16, u16 }
     read_primitive! { read_u32, u32 }
     read_primitive! { read_u64, u64 }
-    read_primitive! { read_int, int }
+    read_primitive! { read_int, isize }
     read_primitive! { read_i8, i8 }
     read_primitive! { read_i16, i16 }
     read_primitive! { read_i32, i32 }
@@ -2188,7 +2168,7 @@ fn read_f64(&mut self) -> DecodeResult<f64> {
             Json::U64(f) => Ok(f as f64),
             Json::F64(f) => Ok(f),
             Json::String(s) => {
-                // re: #12967.. a type w/ numeric keys (ie HashMap<uint, V> etc)
+                // re: #12967.. a type w/ numeric keys (ie HashMap<usize, V> etc)
                 // is going to have a string here, as per JSON spec.
                 match s.parse().ok() {
                     Some(f) => Ok(f),
@@ -2229,7 +2209,7 @@ fn read_enum<T, F>(&mut self, _name: &str, f: F) -> DecodeResult<T> where
 
     fn read_enum_variant<T, F>(&mut self, names: &[&str],
                                mut f: F) -> DecodeResult<T>
-        where F: FnMut(&mut Decoder, uint) -> DecodeResult<T>,
+        where F: FnMut(&mut Decoder, usize) -> DecodeResult<T>,
     {
         let name = match self.pop() {
             Json::String(s) => s,
@@ -2269,14 +2249,14 @@ fn read_enum_variant<T, F>(&mut self, names: &[&str],
         f(self, idx)
     }
 
-    fn read_enum_variant_arg<T, F>(&mut self, _idx: uint, f: F) -> DecodeResult<T> where
+    fn read_enum_variant_arg<T, F>(&mut self, _idx: usize, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
         f(self)
     }
 
     fn read_enum_struct_variant<T, F>(&mut self, names: &[&str], f: F) -> DecodeResult<T> where
-        F: FnMut(&mut Decoder, uint) -> DecodeResult<T>,
+        F: FnMut(&mut Decoder, usize) -> DecodeResult<T>,
     {
         self.read_enum_variant(names, f)
     }
@@ -2284,7 +2264,7 @@ fn read_enum_struct_variant<T, F>(&mut self, names: &[&str], f: F) -> DecodeResu
 
     fn read_enum_struct_variant_field<T, F>(&mut self,
                                          _name: &str,
-                                         idx: uint,
+                                         idx: usize,
                                          f: F)
                                          -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
@@ -2292,7 +2272,7 @@ fn read_enum_struct_variant_field<T, F>(&mut self,
         self.read_enum_variant_arg(idx, f)
     }
 
-    fn read_struct<T, F>(&mut self, _name: &str, _len: uint, f: F) -> DecodeResult<T> where
+    fn read_struct<T, F>(&mut self, _name: &str, _len: usize, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
         let value = try!(f(self));
@@ -2302,7 +2282,7 @@ fn read_struct<T, F>(&mut self, _name: &str, _len: uint, f: F) -> DecodeResult<T
 
     fn read_struct_field<T, F>(&mut self,
                                name: &str,
-                               _idx: uint,
+                               _idx: usize,
                                f: F)
                                -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
@@ -2328,7 +2308,7 @@ fn read_struct_field<T, F>(&mut self,
         Ok(value)
     }
 
-    fn read_tuple<T, F>(&mut self, tuple_len: uint, f: F) -> DecodeResult<T> where
+    fn read_tuple<T, F>(&mut self, tuple_len: usize, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
         self.read_seq(move |d, len| {
@@ -2340,7 +2320,7 @@ fn read_tuple<T, F>(&mut self, tuple_len: uint, f: F) -> DecodeResult<T> where
         })
     }
 
-    fn read_tuple_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
+    fn read_tuple_arg<T, F>(&mut self, idx: usize, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
         self.read_seq_elt(idx, f)
@@ -2348,7 +2328,7 @@ fn read_tuple_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
 
     fn read_tuple_struct<T, F>(&mut self,
                                _name: &str,
-                               len: uint,
+                               len: usize,
                                f: F)
                                -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
@@ -2357,7 +2337,7 @@ fn read_tuple_struct<T, F>(&mut self,
     }
 
     fn read_tuple_struct_arg<T, F>(&mut self,
-                                   idx: uint,
+                                   idx: usize,
                                    f: F)
                                    -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
@@ -2375,7 +2355,7 @@ fn read_option<T, F>(&mut self, mut f: F) -> DecodeResult<T> where
     }
 
     fn read_seq<T, F>(&mut self, f: F) -> DecodeResult<T> where
-        F: FnOnce(&mut Decoder, uint) -> DecodeResult<T>,
+        F: FnOnce(&mut Decoder, usize) -> DecodeResult<T>,
     {
         let array = try!(expect!(self.pop(), Array));
         let len = array.len();
@@ -2385,14 +2365,14 @@ fn read_seq<T, F>(&mut self, f: F) -> DecodeResult<T> where
         f(self, len)
     }
 
-    fn read_seq_elt<T, F>(&mut self, _idx: uint, f: F) -> DecodeResult<T> where
+    fn read_seq_elt<T, F>(&mut self, _idx: usize, f: F) -> DecodeResult<T> where
         F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
         f(self)
     }
 
     fn read_map<T, F>(&mut self, f: F) -> DecodeResult<T> where
-        F: FnOnce(&mut Decoder, uint) -> DecodeResult<T>,
+        F: FnOnce(&mut Decoder, usize) -> DecodeResult<T>,
     {
         let obj = try!(expect!(self.pop(), Object));
         let len = obj.len();
@@ -2403,13 +2383,13 @@ fn read_map<T, F>(&mut self, f: F) -> DecodeResult<T> where
         f(self, len)
     }
 
-    fn read_map_elt_key<T, F>(&mut self, _idx: uint, f: F) -> DecodeResult<T> where
+    fn read_map_elt_key<T, F>(&mut self, _idx: usize, f: F) -> DecodeResult<T> where
        F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
         f(self)
     }
 
-    fn read_map_elt_val<T, F>(&mut self, _idx: uint, f: F) -> DecodeResult<T> where
+    fn read_map_elt_val<T, F>(&mut self, _idx: usize, f: F) -> DecodeResult<T> where
        F: FnOnce(&mut Decoder) -> DecodeResult<T>,
     {
         f(self)
@@ -2430,27 +2410,25 @@ macro_rules! to_json_impl_i64 {
     ($($t:ty), +) => (
         $(impl ToJson for $t {
             fn to_json(&self) -> Json {
-                #![allow(trivial_numeric_casts)]
                 Json::I64(*self as i64)
             }
         })+
     )
 }
 
-to_json_impl_i64! { int, i8, i16, i32, i64 }
+to_json_impl_i64! { isize, i8, i16, i32, i64 }
 
 macro_rules! to_json_impl_u64 {
     ($($t:ty), +) => (
         $(impl ToJson for $t {
             fn to_json(&self) -> Json {
-                #![allow(trivial_numeric_casts)]
                 Json::U64(*self as u64)
             }
         })+
     )
 }
 
-to_json_impl_u64! { uint, u8, u16, u32, u64 }
+to_json_impl_u64! { usize, u8, u16, u32, u64 }
 
 impl ToJson for Json {
     fn to_json(&self) -> Json { self.clone() }
@@ -2605,7 +2583,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 impl<'a, T> AsPrettyJson<'a, T> {
     /// Set the indentation level for the emitted JSON
-    pub fn indent(mut self, indent: uint) -> AsPrettyJson<'a, T> {
+    pub fn indent(mut self, indent: usize) -> AsPrettyJson<'a, T> {
         self.indent = Some(indent);
         self
     }
@@ -2655,7 +2633,7 @@ mod tests {
 
     #[derive(RustcDecodable, Eq, PartialEq, Debug)]
     struct OptionData {
-        opt: Option<uint>,
+        opt: Option<usize>,
     }
 
     #[test]
@@ -2683,13 +2661,13 @@ fn test_decode_option_malformed() {
     #[derive(PartialEq, RustcEncodable, RustcDecodable, Debug)]
     enum Animal {
         Dog,
-        Frog(string::String, int)
+        Frog(string::String, isize)
     }
 
     #[derive(PartialEq, RustcEncodable, RustcDecodable, Debug)]
     struct Inner {
         a: (),
-        b: uint,
+        b: usize,
         c: Vec<string::String>,
     }
 
@@ -3113,30 +3091,30 @@ fn test_decode_array() {
         let v: Vec<bool> = super::decode("[true]").unwrap();
         assert_eq!(v, [true]);
 
-        let v: Vec<int> = super::decode("[3, 1]").unwrap();
+        let v: Vec<isize> = super::decode("[3, 1]").unwrap();
         assert_eq!(v, [3, 1]);
 
-        let v: Vec<Vec<uint>> = super::decode("[[3], [1, 2]]").unwrap();
+        let v: Vec<Vec<usize>> = super::decode("[[3], [1, 2]]").unwrap();
         assert_eq!(v, [vec![3], vec![1, 2]]);
     }
 
     #[test]
     fn test_decode_tuple() {
-        let t: (uint, uint, uint) = super::decode("[1, 2, 3]").unwrap();
+        let t: (usize, usize, usize) = super::decode("[1, 2, 3]").unwrap();
         assert_eq!(t, (1, 2, 3));
 
-        let t: (uint, string::String) = super::decode("[1, \"two\"]").unwrap();
+        let t: (usize, string::String) = super::decode("[1, \"two\"]").unwrap();
         assert_eq!(t, (1, "two".to_string()));
     }
 
     #[test]
     fn test_decode_tuple_malformed_types() {
-        assert!(super::decode::<(uint, string::String)>("[1, 2]").is_err());
+        assert!(super::decode::<(usize, string::String)>("[1, 2]").is_err());
     }
 
     #[test]
     fn test_decode_tuple_malformed_length() {
-        assert!(super::decode::<(uint, uint)>("[1, 2, 3]").is_err());
+        assert!(super::decode::<(usize, usize)>("[1, 2, 3]").is_err());
     }
 
     #[test]
@@ -3488,7 +3466,7 @@ fn test_encode_hashmap_with_numeric_key() {
         use std::str::from_utf8;
         use std::old_io::Writer;
         use std::collections::HashMap;
-        let mut hm: HashMap<uint, bool> = HashMap::new();
+        let mut hm: HashMap<usize, bool> = HashMap::new();
         hm.insert(1, true);
         let mut mem_buf = Vec::new();
         write!(&mut mem_buf, "{}", super::as_pretty_json(&hm)).unwrap();
@@ -3504,7 +3482,7 @@ fn test_prettyencode_hashmap_with_numeric_key() {
         use std::str::from_utf8;
         use std::old_io::Writer;
         use std::collections::HashMap;
-        let mut hm: HashMap<uint, bool> = HashMap::new();
+        let mut hm: HashMap<usize, bool> = HashMap::new();
         hm.insert(1, true);
         let mut mem_buf = Vec::new();
         write!(&mut mem_buf, "{}", super::as_pretty_json(&hm)).unwrap();
@@ -3537,7 +3515,7 @@ fn test_prettyencoder_indent_level_param() {
         );
 
         // Helper function for counting indents
-        fn indents(source: &str) -> uint {
+        fn indents(source: &str) -> usize {
             let trimmed = source.trim_left_matches(' ');
             source.len() - trimmed.len()
         }
@@ -3595,7 +3573,7 @@ fn test_hashmap_with_numeric_key_can_handle_double_quote_delimited_key() {
             Ok(o) => o
         };
         let mut decoder = Decoder::new(json_obj);
-        let _hm: HashMap<uint, bool> = Decodable::decode(&mut decoder).unwrap();
+        let _hm: HashMap<usize, bool> = Decodable::decode(&mut decoder).unwrap();
     }
 
     #[test]
@@ -3608,7 +3586,7 @@ fn test_hashmap_with_numeric_key_will_error_with_string_keys() {
             Ok(o) => o
         };
         let mut decoder = Decoder::new(json_obj);
-        let result: Result<HashMap<uint, bool>, DecoderError> = Decodable::decode(&mut decoder);
+        let result: Result<HashMap<usize, bool>, DecoderError> = Decodable::decode(&mut decoder);
         assert_eq!(result, Err(ExpectedError("Number".to_string(), "a".to_string())));
     }
 
@@ -3971,14 +3949,14 @@ fn test_to_json() {
         assert_eq!(hash_map.to_json(), object);
         assert_eq!(Some(15).to_json(), I64(15));
         assert_eq!(Some(15 as usize).to_json(), U64(15));
-        assert_eq!(None::<int>.to_json(), Null);
+        assert_eq!(None::<isize>.to_json(), Null);
     }
 
     #[test]
     fn test_encode_hashmap_with_arbitrary_key() {
         use std::collections::HashMap;
         #[derive(PartialEq, Eq, Hash, RustcEncodable)]
-        struct ArbitraryType(uint);
+        struct ArbitraryType(usize);
         let mut hm: HashMap<ArbitraryType, bool> = HashMap::new();
         hm.insert(ArbitraryType(1), true);
         let mut mem_buf = string::String::new();
index 482e0d1d0eed3739d1bedc6d018d6bd102e9673f..b79323b3f962de18e5241780813d3fba3c188831 100644 (file)
@@ -30,7 +30,6 @@
 #![feature(box_syntax)]
 #![feature(collections)]
 #![feature(core)]
-#![feature(int_uint)]
 #![feature(old_path)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
index 5e9baa9b9e903557236e407db817a01b0790fe3b..81b5d4c5818b659d48b216d703f78c09fa3b4e56 100644 (file)
@@ -26,12 +26,12 @@ pub trait Encoder {
 
     // Primitive types:
     fn emit_nil(&mut self) -> Result<(), Self::Error>;
-    fn emit_uint(&mut self, v: uint) -> Result<(), Self::Error>;
+    fn emit_uint(&mut self, v: usize) -> Result<(), Self::Error>;
     fn emit_u64(&mut self, v: u64) -> Result<(), Self::Error>;
     fn emit_u32(&mut self, v: u32) -> Result<(), Self::Error>;
     fn emit_u16(&mut self, v: u16) -> Result<(), Self::Error>;
     fn emit_u8(&mut self, v: u8) -> Result<(), Self::Error>;
-    fn emit_int(&mut self, v: int) -> Result<(), Self::Error>;
+    fn emit_int(&mut self, v: isize) -> Result<(), Self::Error>;
     fn emit_i64(&mut self, v: i64) -> Result<(), Self::Error>;
     fn emit_i32(&mut self, v: i32) -> Result<(), Self::Error>;
     fn emit_i16(&mut self, v: i16) -> Result<(), Self::Error>;
@@ -47,41 +47,41 @@ fn emit_enum<F>(&mut self, name: &str, f: F) -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
 
     fn emit_enum_variant<F>(&mut self, v_name: &str,
-                            v_id: uint,
-                            len: uint,
+                            v_id: usize,
+                            len: usize,
                             f: F) -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
-    fn emit_enum_variant_arg<F>(&mut self, a_idx: uint, f: F)
+    fn emit_enum_variant_arg<F>(&mut self, a_idx: usize, f: F)
                                 -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
 
     fn emit_enum_struct_variant<F>(&mut self, v_name: &str,
-                                   v_id: uint,
-                                   len: uint,
+                                   v_id: usize,
+                                   len: usize,
                                    f: F) -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
     fn emit_enum_struct_variant_field<F>(&mut self,
                                          f_name: &str,
-                                         f_idx: uint,
+                                         f_idx: usize,
                                          f: F) -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
 
-    fn emit_struct<F>(&mut self, name: &str, len: uint, f: F)
+    fn emit_struct<F>(&mut self, name: &str, len: usize, f: F)
                       -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
-    fn emit_struct_field<F>(&mut self, f_name: &str, f_idx: uint, f: F)
+    fn emit_struct_field<F>(&mut self, f_name: &str, f_idx: usize, f: F)
                             -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
 
-    fn emit_tuple<F>(&mut self, len: uint, f: F) -> Result<(), Self::Error>
+    fn emit_tuple<F>(&mut self, len: usize, f: F) -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
-    fn emit_tuple_arg<F>(&mut self, idx: uint, f: F) -> Result<(), Self::Error>
+    fn emit_tuple_arg<F>(&mut self, idx: usize, f: F) -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
 
-    fn emit_tuple_struct<F>(&mut self, name: &str, len: uint, f: F)
+    fn emit_tuple_struct<F>(&mut self, name: &str, len: usize, f: F)
                             -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
-    fn emit_tuple_struct_arg<F>(&mut self, f_idx: uint, f: F)
+    fn emit_tuple_struct_arg<F>(&mut self, f_idx: usize, f: F)
                                 -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
 
@@ -92,16 +92,16 @@ fn emit_option<F>(&mut self, f: F) -> Result<(), Self::Error>
     fn emit_option_some<F>(&mut self, f: F) -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
 
-    fn emit_seq<F>(&mut self, len: uint, f: F) -> Result<(), Self::Error>
+    fn emit_seq<F>(&mut self, len: usize, f: F) -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
-    fn emit_seq_elt<F>(&mut self, idx: uint, f: F) -> Result<(), Self::Error>
+    fn emit_seq_elt<F>(&mut self, idx: usize, f: F) -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
 
-    fn emit_map<F>(&mut self, len: uint, f: F) -> Result<(), Self::Error>
+    fn emit_map<F>(&mut self, len: usize, f: F) -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
-    fn emit_map_elt_key<F>(&mut self, idx: uint, f: F) -> Result<(), Self::Error>
+    fn emit_map_elt_key<F>(&mut self, idx: usize, f: F) -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
-    fn emit_map_elt_val<F>(&mut self, idx: uint, f: F) -> Result<(), Self::Error>
+    fn emit_map_elt_val<F>(&mut self, idx: usize, f: F) -> Result<(), Self::Error>
         where F: FnOnce(&mut Self) -> Result<(), Self::Error>;
 }
 
@@ -110,12 +110,12 @@ pub trait Decoder {
 
     // Primitive types:
     fn read_nil(&mut self) -> Result<(), Self::Error>;
-    fn read_uint(&mut self) -> Result<uint, Self::Error>;
+    fn read_uint(&mut self) -> Result<usize, Self::Error>;
     fn read_u64(&mut self) -> Result<u64, Self::Error>;
     fn read_u32(&mut self) -> Result<u32, Self::Error>;
     fn read_u16(&mut self) -> Result<u16, Self::Error>;
     fn read_u8(&mut self) -> Result<u8, Self::Error>;
-    fn read_int(&mut self) -> Result<int, Self::Error>;
+    fn read_int(&mut self) -> Result<isize, Self::Error>;
     fn read_i64(&mut self) -> Result<i64, Self::Error>;
     fn read_i32(&mut self) -> Result<i32, Self::Error>;
     fn read_i16(&mut self) -> Result<i16, Self::Error>;
@@ -132,41 +132,41 @@ fn read_enum<T, F>(&mut self, name: &str, f: F) -> Result<T, Self::Error>
 
     fn read_enum_variant<T, F>(&mut self, names: &[&str], f: F)
                                -> Result<T, Self::Error>
-        where F: FnMut(&mut Self, uint) -> Result<T, Self::Error>;
-    fn read_enum_variant_arg<T, F>(&mut self, a_idx: uint, f: F)
+        where F: FnMut(&mut Self, usize) -> Result<T, Self::Error>;
+    fn read_enum_variant_arg<T, F>(&mut self, a_idx: usize, f: F)
                                    -> Result<T, Self::Error>
         where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
 
     fn read_enum_struct_variant<T, F>(&mut self, names: &[&str], f: F)
                                       -> Result<T, Self::Error>
-        where F: FnMut(&mut Self, uint) -> Result<T, Self::Error>;
+        where F: FnMut(&mut Self, usize) -> Result<T, Self::Error>;
     fn read_enum_struct_variant_field<T, F>(&mut self,
                                             &f_name: &str,
-                                            f_idx: uint,
+                                            f_idx: usize,
                                             f: F)
                                             -> Result<T, Self::Error>
         where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
 
-    fn read_struct<T, F>(&mut self, s_name: &str, len: uint, f: F)
+    fn read_struct<T, F>(&mut self, s_name: &str, len: usize, f: F)
                          -> Result<T, Self::Error>
         where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
     fn read_struct_field<T, F>(&mut self,
                                f_name: &str,
-                               f_idx: uint,
+                               f_idx: usize,
                                f: F)
                                -> Result<T, Self::Error>
         where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
 
-    fn read_tuple<T, F>(&mut self, len: uint, f: F) -> Result<T, Self::Error>
+    fn read_tuple<T, F>(&mut self, len: usize, f: F) -> Result<T, Self::Error>
         where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
-    fn read_tuple_arg<T, F>(&mut self, a_idx: uint, f: F)
+    fn read_tuple_arg<T, F>(&mut self, a_idx: usize, f: F)
                             -> Result<T, Self::Error>
         where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
 
-    fn read_tuple_struct<T, F>(&mut self, s_name: &str, len: uint, f: F)
+    fn read_tuple_struct<T, F>(&mut self, s_name: &str, len: usize, f: F)
                                -> Result<T, Self::Error>
         where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
-    fn read_tuple_struct_arg<T, F>(&mut self, a_idx: uint, f: F)
+    fn read_tuple_struct_arg<T, F>(&mut self, a_idx: usize, f: F)
                                    -> Result<T, Self::Error>
         where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
 
@@ -175,16 +175,16 @@ fn read_option<T, F>(&mut self, f: F) -> Result<T, Self::Error>
         where F: FnMut(&mut Self, bool) -> Result<T, Self::Error>;
 
     fn read_seq<T, F>(&mut self, f: F) -> Result<T, Self::Error>
-        where F: FnOnce(&mut Self, uint) -> Result<T, Self::Error>;
-    fn read_seq_elt<T, F>(&mut self, idx: uint, f: F) -> Result<T, Self::Error>
+        where F: FnOnce(&mut Self, usize) -> Result<T, Self::Error>;
+    fn read_seq_elt<T, F>(&mut self, idx: usize, f: F) -> Result<T, Self::Error>
         where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
 
     fn read_map<T, F>(&mut self, f: F) -> Result<T, Self::Error>
-        where F: FnOnce(&mut Self, uint) -> Result<T, Self::Error>;
-    fn read_map_elt_key<T, F>(&mut self, idx: uint, f: F)
+        where F: FnOnce(&mut Self, usize) -> Result<T, Self::Error>;
+    fn read_map_elt_key<T, F>(&mut self, idx: usize, f: F)
                               -> Result<T, Self::Error>
         where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
-    fn read_map_elt_val<T, F>(&mut self, idx: uint, f: F)
+    fn read_map_elt_val<T, F>(&mut self, idx: usize, f: F)
                               -> Result<T, Self::Error>
         where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
 
@@ -200,14 +200,14 @@ pub trait Decodable {
     fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error>;
 }
 
-impl Encodable for uint {
+impl Encodable for usize {
     fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
         s.emit_uint(*self)
     }
 }
 
-impl Decodable for uint {
-    fn decode<D: Decoder>(d: &mut D) -> Result<uint, D::Error> {
+impl Decodable for usize {
+    fn decode<D: Decoder>(d: &mut D) -> Result<usize, D::Error> {
         d.read_uint()
     }
 }
@@ -260,14 +260,14 @@ fn decode<D: Decoder>(d: &mut D) -> Result<u64, D::Error> {
     }
 }
 
-impl Encodable for int {
+impl Encodable for isize {
     fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
         s.emit_int(*self)
     }
 }
 
-impl Decodable for int {
-    fn decode<D: Decoder>(d: &mut D) -> Result<int, D::Error> {
+impl Decodable for isize {
+    fn decode<D: Decoder>(d: &mut D) -> Result<isize, D::Error> {
         d.read_int()
     }
 }
@@ -510,7 +510,7 @@ macro_rules! tuple {
         impl<$($name:Decodable),*> Decodable for ($($name,)*) {
             #[allow(non_snake_case)]
             fn decode<D: Decoder>(d: &mut D) -> Result<($($name,)*), D::Error> {
-                let len: uint = count_idents!($($name,)*);
+                let len: usize = count_idents!($($name,)*);
                 d.read_tuple(len, |d| {
                     let mut i = 0;
                     let ret = ($(try!(d.read_tuple_arg({ i+=1; i-1 },
index 93215090d9562bfa54dc689fe500666e32eabd84..20ad71a4bf8c854ef1144a9ba91356d131d12c60 100644 (file)
@@ -34,7 +34,7 @@ pub trait OwnedAsciiExt {
     fn into_ascii_lowercase(self) -> Self;
 }
 
-/// Extension methods for ASCII-subset only operations on string slices
+/// Extension methods for ASCII-subset only operations on string slices.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait AsciiExt {
     /// Container type for copied ASCII characters.
@@ -42,36 +42,116 @@ pub trait AsciiExt {
     type Owned;
 
     /// Check if within the ASCII range.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::ascii::AsciiExt;
+    ///
+    /// let ascii = 'a';
+    /// let utf8 = '❤';
+    ///
+    /// assert_eq!(true, ascii.is_ascii());
+    /// assert_eq!(false, utf8.is_ascii())
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn is_ascii(&self) -> bool;
 
-    /// Makes a copy of the string in ASCII upper case:
+    /// Makes a copy of the string in ASCII upper case.
+    ///
     /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
     /// but non-ASCII letters are unchanged.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::ascii::AsciiExt;
+    ///
+    /// let ascii = 'a';
+    /// let utf8 = '❤';
+    ///
+    /// assert_eq!('A', ascii.to_ascii_uppercase());
+    /// assert_eq!('❤', utf8.to_ascii_uppercase());
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn to_ascii_uppercase(&self) -> Self::Owned;
 
-    /// Makes a copy of the string in ASCII lower case:
+    /// Makes a copy of the string in ASCII lower case.
+    ///
     /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
     /// but non-ASCII letters are unchanged.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::ascii::AsciiExt;
+    ///
+    /// let ascii = 'A';
+    /// let utf8 = '❤';
+    ///
+    /// assert_eq!('a', ascii.to_ascii_lowercase());
+    /// assert_eq!('❤', utf8.to_ascii_lowercase());
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn to_ascii_lowercase(&self) -> Self::Owned;
 
     /// Check that two strings are an ASCII case-insensitive match.
+    ///
     /// Same as `to_ascii_lowercase(a) == to_ascii_lowercase(b)`,
     /// but without allocating and copying temporary strings.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::ascii::AsciiExt;
+    ///
+    /// let ascii1 = 'A';
+    /// let ascii2 = 'a';
+    /// let ascii3 = 'A';
+    /// let ascii4 = 'z';
+    ///
+    /// assert_eq!(true, ascii1.eq_ignore_ascii_case(&ascii2));
+    /// assert_eq!(true, ascii1.eq_ignore_ascii_case(&ascii3));
+    /// assert_eq!(false, ascii1.eq_ignore_ascii_case(&ascii4));
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn eq_ignore_ascii_case(&self, other: &Self) -> bool;
 
     /// Convert this type to its ASCII upper case equivalent in-place.
     ///
     /// See `to_ascii_uppercase` for more information.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// # #![feature(ascii)]
+    /// use std::ascii::AsciiExt;
+    ///
+    /// let mut ascii = 'a';
+    ///
+    /// ascii.make_ascii_uppercase();
+    ///
+    /// assert_eq!('A', ascii);
+    /// ```
     #[unstable(feature = "ascii")]
     fn make_ascii_uppercase(&mut self);
 
     /// Convert this type to its ASCII lower case equivalent in-place.
     ///
     /// See `to_ascii_lowercase` for more information.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// # #![feature(ascii)]
+    /// use std::ascii::AsciiExt;
+    ///
+    /// let mut ascii = 'A';
+    ///
+    /// ascii.make_ascii_lowercase();
+    ///
+    /// assert_eq!('a', ascii);
+    /// ```
     #[unstable(feature = "ascii")]
     fn make_ascii_lowercase(&mut self);
 }
@@ -246,7 +326,7 @@ pub struct EscapeDefault {
     data: [u8; 4],
 }
 
-/// Returns a 'default' ASCII and C++11-like literal escape of a `u8`
+/// Returns an iterator that produces an escaped version of a `u8`.
 ///
 /// The default is chosen with a bias toward producing literals that are
 /// legal in a variety of languages, including C++11 and similar C-family
@@ -257,6 +337,20 @@ pub struct EscapeDefault {
 /// - Any other chars in the range [0x20,0x7e] are not escaped.
 /// - Any other chars are given hex escapes of the form '\xNN'.
 /// - Unicode escapes are never generated by this function.
+///
+/// # Examples
+///
+/// ```
+/// use std::ascii;
+///
+/// let escaped = ascii::escape_default(b'0').next().unwrap();
+/// assert_eq!(b'0', escaped);
+///
+/// let mut escaped = ascii::escape_default(b'\t');
+///
+/// assert_eq!(b'\\', escaped.next().unwrap());
+/// assert_eq!(b't', escaped.next().unwrap());
+/// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn escape_default(c: u8) -> EscapeDefault {
     let (data, len) = match c {
index ca506e8c36f50a7111063c15c152eacd226f25e1..ac21ae0f0aa146ca98e2e15a084b160281cfcb1c 100644 (file)
@@ -14,7 +14,7 @@
 use prelude::v1::*;
 
 use self::test::Bencher;
-use iter::{range_inclusive};
+use iter::range_inclusive;
 
 #[bench]
 fn new_drop(b : &mut Bencher) {
index 91225891338a58a42dc19542377103de57ff457f..bc0f109de15b649ee94a34bd3989d7931c5f4ef2 100644 (file)
@@ -20,7 +20,7 @@
 use default::Default;
 use fmt::{self, Debug};
 use hash::{Hash, SipHasher};
-use iter::{self, Iterator, ExactSizeIterator, IntoIterator, IteratorExt, FromIterator, Extend, Map};
+use iter::{self, Iterator, ExactSizeIterator, IntoIterator, FromIterator, Extend, Map};
 use marker::Sized;
 use mem::{self, replace};
 use ops::{Deref, FnMut, FnOnce, Index};
@@ -214,7 +214,14 @@ fn test_resize_policy() {
 /// overridden with one of the constructors.
 ///
 /// It is required that the keys implement the `Eq` and `Hash` traits, although
-/// this can frequently be achieved by using `#[derive(Eq, Hash)]`.
+/// this can frequently be achieved by using `#[derive(Eq, Hash)]`. If you
+/// implement these yourself, it is important that the following property holds:
+///
+/// ```text
+/// k1 == k2 -> hash(k1) == hash(k2)
+/// ```
+///
+/// In other words, if two keys are equal, their hashes must be equal.
 ///
 /// It is a logic error for a key to be modified in such a way that the key's
 /// hash, as determined by the `Hash` trait, or its equality, as determined by
@@ -505,7 +512,7 @@ impl<K: Hash + Eq, V> HashMap<K, V, RandomState> {
     ///
     /// ```
     /// use std::collections::HashMap;
-    /// let mut map: HashMap<&str, int> = HashMap::new();
+    /// let mut map: HashMap<&str, isize> = HashMap::new();
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -519,7 +526,7 @@ pub fn new() -> HashMap<K, V, RandomState> {
     ///
     /// ```
     /// use std::collections::HashMap;
-    /// let mut map: HashMap<&str, int> = HashMap::with_capacity(10);
+    /// let mut map: HashMap<&str, isize> = HashMap::with_capacity(10);
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -596,7 +603,7 @@ pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S)
     ///
     /// ```
     /// use std::collections::HashMap;
-    /// let map: HashMap<int, int> = HashMap::with_capacity(100);
+    /// let map: HashMap<isize, isize> = HashMap::with_capacity(100);
     /// assert!(map.capacity() >= 100);
     /// ```
     #[inline]
@@ -617,7 +624,7 @@ pub fn capacity(&self) -> usize {
     ///
     /// ```
     /// use std::collections::HashMap;
-    /// let mut map: HashMap<&str, int> = HashMap::new();
+    /// let mut map: HashMap<&str, isize> = HashMap::new();
     /// map.reserve(10);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -725,7 +732,7 @@ fn resize(&mut self, new_capacity: usize) {
     /// ```
     /// use std::collections::HashMap;
     ///
-    /// let mut map: HashMap<int, int> = HashMap::with_capacity(100);
+    /// let mut map: HashMap<isize, isize> = HashMap::with_capacity(100);
     /// map.insert(1, 2);
     /// map.insert(3, 4);
     /// assert!(map.capacity() >= 100);
@@ -797,9 +804,9 @@ fn insert_or_replace_with<'a, F>(&'a mut self,
                 }
             }
 
-            let robin_ib = bucket.index() as int - bucket.distance() as int;
+            let robin_ib = bucket.index() as isize - bucket.distance() as isize;
 
-            if (ib as int) < robin_ib {
+            if (ib as isize) < robin_ib {
                 // Found a luckier bucket than me. Better steal his spot.
                 return robin_hood(bucket, robin_ib as usize, hash, k, v);
             }
@@ -924,7 +931,7 @@ pub fn iter_mut(&mut self) -> IterMut<K, V> {
     /// map.insert("c", 3);
     ///
     /// // Not possible with .iter()
-    /// let vec: Vec<(&str, int)> = map.into_iter().collect();
+    /// let vec: Vec<(&str, isize)> = map.into_iter().collect();
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn into_iter(self) -> IntoIter<K, V> {
@@ -1188,9 +1195,9 @@ fn search_entry_hashed<'a, K: Eq, V>(table: &'a mut RawTable<K,V>, hash: SafeHas
             }
         }
 
-        let robin_ib = bucket.index() as int - bucket.distance() as int;
+        let robin_ib = bucket.index() as isize - bucket.distance() as isize;
 
-        if (ib as int) < robin_ib {
+        if (ib as isize) < robin_ib {
             // Found a luckier bucket than me. Better steal his spot.
             return Vacant(VacantEntry {
                 hash: hash,
@@ -1226,14 +1233,7 @@ impl<K, V, S> Debug for HashMap<K, V, S>
     where K: Eq + Hash + Debug, V: Debug, S: HashState
 {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f, "{{"));
-
-        for (i, (k, v)) in self.iter().enumerate() {
-            if i != 0 { try!(write!(f, ", ")); }
-            try!(write!(f, "{:?}: {:?}", *k, *v));
-        }
-
-        write!(f, "}}")
+        self.iter().fold(f.debug_map(), |b, (k, v)| b.entry(k, v)).finish()
     }
 }
 
@@ -1247,22 +1247,6 @@ fn default() -> HashMap<K, V, S> {
     }
 }
 
-#[cfg(stage0)]
-#[stable(feature = "rust1", since = "1.0.0")]
-impl<K, Q: ?Sized, V, S> Index<Q> for HashMap<K, V, S>
-    where K: Eq + Hash + Borrow<Q>,
-          Q: Eq + Hash,
-          S: HashState,
-{
-    type Output = V;
-
-    #[inline]
-    fn index<'a>(&'a self, index: &Q) -> &'a V {
-        self.get(index).expect("no entry found for key")
-    }
-}
-
-#[cfg(not(stage0))]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S>
     where K: Eq + Hash + Borrow<Q>,
@@ -1673,7 +1657,7 @@ fn test_insert() {
         assert_eq!(*m.get(&2).unwrap(), 4);
     }
 
-    thread_local! { static DROP_VECTOR: RefCell<Vec<int>> = RefCell::new(Vec::new()) }
+    thread_local! { static DROP_VECTOR: RefCell<Vec<isize>> = RefCell::new(Vec::new()) }
 
     #[derive(Hash, PartialEq, Eq)]
     struct Dropable {
@@ -1830,7 +1814,7 @@ fn test_move_iter_drops() {
 
     #[test]
     fn test_empty_pop() {
-        let mut m: HashMap<int, bool> = HashMap::new();
+        let mut m: HashMap<isize, bool> = HashMap::new();
         assert_eq!(m.remove(&0), None);
     }
 
index 0933b4f662a9d744fbec130c491ea1d842e3d944..87380471c8001e88e5fa65e2fe1fe746dc82cf8f 100644 (file)
@@ -18,9 +18,7 @@
 use fmt::Debug;
 use fmt;
 use hash::Hash;
-use iter::{
-    Iterator, IntoIterator, ExactSizeIterator, IteratorExt, FromIterator, Map, Chain, Extend,
-};
+use iter::{Iterator, IntoIterator, ExactSizeIterator, FromIterator, Map, Chain, Extend};
 use ops::{BitOr, BitAnd, BitXor, Sub};
 use option::Option::{Some, None, self};
 
 
 /// An implementation of a hash set using the underlying representation of a
 /// HashMap where the value is (). As with the `HashMap` type, a `HashSet`
-/// requires that the elements implement the `Eq` and `Hash` traits.
+/// requires that the elements implement the `Eq` and `Hash` traits. This can
+/// frequently be achieved by using `#[derive(Eq, Hash)]`. If you implement
+/// these yourself, it is important that the following property holds:
+///
+/// ```text
+/// k1 == k2 -> hash(k1) == hash(k2)
+/// ```
+///
+/// In other words, if two keys are equal, their hashes must be equal.
+///
 ///
 /// It is a logic error for an item to be modified in such a way that the
 /// item's hash, as determined by the `Hash` trait, or its equality, as
@@ -614,14 +621,7 @@ impl<T, S> fmt::Debug for HashSet<T, S>
           S: HashState
 {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        try!(write!(f, "{{"));
-
-        for (i, x) in self.iter().enumerate() {
-            if i != 0 { try!(write!(f, ", ")); }
-            try!(write!(f, "{:?}", *x));
-        }
-
-        write!(f, "}}")
+        self.iter().fold(f.debug_set(), |b, e| b.entry(e)).finish()
     }
 }
 
index 052bcfd7e164951ac15fd7d576e8643b386225d1..aa3195cbf018b2e43178fc19968d4da6db1641c1 100644 (file)
@@ -15,7 +15,7 @@
 use clone::Clone;
 use cmp;
 use hash::{Hash, Hasher};
-use iter::{Iterator, IteratorExt, ExactSizeIterator, count};
+use iter::{Iterator, ExactSizeIterator, count};
 use marker::{Copy, Send, Sync, Sized, self};
 use mem::{min_align_of, size_of};
 use mem;
@@ -480,8 +480,8 @@ pub fn full(&self) -> &FullBucket<K, V, M> {
     pub fn shift(mut self) -> Option<GapThenFull<K, V, M>> {
         unsafe {
             *self.gap.raw.hash = mem::replace(&mut *self.full.raw.hash, EMPTY_BUCKET);
-            ptr::copy_nonoverlapping(self.gap.raw.key, self.full.raw.key, 1);
-            ptr::copy_nonoverlapping(self.gap.raw.val, self.full.raw.val, 1);
+            ptr::copy_nonoverlapping(self.full.raw.key, self.gap.raw.key, 1);
+            ptr::copy_nonoverlapping(self.full.raw.val, self.gap.raw.val, 1);
         }
 
         let FullBucket { raw: prev_raw, idx: prev_idx, .. } = self.full;
@@ -985,7 +985,7 @@ fn clone(&self) -> RawTable<K, V> {
 #[unsafe_destructor]
 impl<K, V> Drop for RawTable<K, V> {
     fn drop(&mut self) {
-        if self.capacity == 0 {
+        if self.capacity == 0 || self.capacity == mem::POST_DROP_USIZE {
             return;
         }
 
index 085bf01612d30519172fe94f26775d63fff2a881..d8a95133d94144dc6d062ca552a9c08314177dfa 100644 (file)
 
 #![unstable(feature = "std_misc")]
 #![allow(missing_docs)]
-#![allow(deprecated)] // will be addressed by #23197
 
 use prelude::v1::*;
 
 use env;
-use ffi::CString;
+use ffi::{AsOsStr, CString, OsString};
 use mem;
-use old_path::{Path, GenericPath};
-use os;
-use str;
+use path::{Path, PathBuf};
 
 pub struct DynamicLibrary {
     handle: *mut u8
@@ -54,7 +51,7 @@ impl DynamicLibrary {
     /// Lazily open a dynamic library. When passed None it gives a
     /// handle to the calling process
     pub fn open(filename: Option<&Path>) -> Result<DynamicLibrary, String> {
-        let maybe_library = dl::open(filename.map(|path| path.as_vec()));
+        let maybe_library = dl::open(filename.map(|path| path.as_os_str()));
 
         // The dynamic library must not be constructed if there is
         // an error opening the library so the destructor does not
@@ -68,19 +65,17 @@ pub fn open(filename: Option<&Path>) -> Result<DynamicLibrary, String> {
     /// Prepends a path to this process's search path for dynamic libraries
     pub fn prepend_search_path(path: &Path) {
         let mut search_path = DynamicLibrary::search_path();
-        search_path.insert(0, path.clone());
-        let newval = DynamicLibrary::create_path(&search_path);
-        env::set_var(DynamicLibrary::envvar(),
-                     str::from_utf8(&newval).unwrap());
+        search_path.insert(0, path.to_path_buf());
+        env::set_var(DynamicLibrary::envvar(), &DynamicLibrary::create_path(&search_path));
     }
 
     /// From a slice of paths, create a new vector which is suitable to be an
     /// environment variable for this platforms dylib search path.
-    pub fn create_path(path: &[Path]) -> Vec<u8> {
-        let mut newvar = Vec::new();
+    pub fn create_path(path: &[PathBuf]) -> OsString {
+        let mut newvar = OsString::new();
         for (i, path) in path.iter().enumerate() {
             if i > 0 { newvar.push(DynamicLibrary::separator()); }
-            newvar.push_all(path.as_vec());
+            newvar.push(path);
         }
         return newvar;
     }
@@ -97,15 +92,15 @@ pub fn envvar() -> &'static str {
         }
     }
 
-    fn separator() -> u8 {
-        if cfg!(windows) {b';'} else {b':'}
+    fn separator() -> &'static str {
+        if cfg!(windows) { ";" } else { ":" }
     }
 
     /// Returns the current search path for dynamic libraries being used by this
     /// process
-    pub fn search_path() -> Vec<Path> {
+    pub fn search_path() -> Vec<PathBuf> {
         match env::var_os(DynamicLibrary::envvar()) {
-            Some(var) => os::split_paths(var.to_str().unwrap()),
+            Some(var) => env::split_paths(&var).collect(),
             None => Vec::new(),
         }
     }
@@ -134,8 +129,8 @@ mod test {
     use super::*;
     use prelude::v1::*;
     use libc;
-    use old_path::Path;
     use mem;
+    use path::Path;
 
     #[test]
     #[cfg_attr(any(windows, target_os = "android"), ignore)] // FIXME #8818, #10379
@@ -192,12 +187,13 @@ fn test_errors_do_not_crash() {
 mod dl {
     use prelude::v1::*;
 
-    use ffi::{CString, CStr};
+    use ffi::{CStr, OsStr};
     use str;
     use libc;
+    use os::unix::prelude::*;
     use ptr;
 
-    pub fn open(filename: Option<&[u8]>) -> Result<*mut u8, String> {
+    pub fn open(filename: Option<&OsStr>) -> Result<*mut u8, String> {
         check_for_errors_in(|| {
             unsafe {
                 match filename {
@@ -210,8 +206,8 @@ pub fn open(filename: Option<&[u8]>) -> Result<*mut u8, String> {
 
     const LAZY: libc::c_int = 1;
 
-    unsafe fn open_external(filename: &[u8]) -> *mut u8 {
-        let s = CString::new(filename).unwrap();
+    unsafe fn open_external(filename: &OsStr) -> *mut u8 {
+        let s = filename.to_cstring().unwrap();
         dlopen(s.as_ptr(), LAZY) as *mut u8
     }
 
@@ -264,21 +260,22 @@ fn dlsym(handle: *mut libc::c_void,
 
 #[cfg(target_os = "windows")]
 mod dl {
-    use iter::IteratorExt;
+    use ffi::OsStr;
+    use iter::Iterator;
     use libc;
     use libc::consts::os::extra::ERROR_CALL_NOT_IMPLEMENTED;
     use ops::FnOnce;
-    use os;
+    use sys::os;
+    use os::windows::prelude::*;
     use option::Option::{self, Some, None};
     use ptr;
     use result::Result;
     use result::Result::{Ok, Err};
-    use str;
     use string::String;
     use vec::Vec;
     use sys::c::compat::kernel32::SetThreadErrorMode;
 
-    pub fn open(filename: Option<&[u8]>) -> Result<*mut u8, String> {
+    pub fn open(filename: Option<&OsStr>) -> Result<*mut u8, String> {
         // disable "dll load failed" error dialog.
         let mut use_thread_mode = true;
         let prev_error_mode = unsafe {
@@ -308,9 +305,8 @@ pub fn open(filename: Option<&[u8]>) -> Result<*mut u8, String> {
 
         let result = match filename {
             Some(filename) => {
-                let filename_str = str::from_utf8(filename).unwrap();
-                let mut filename_str: Vec<u16> = filename_str.utf16_units().collect();
-                filename_str.push(0);
+                let filename_str: Vec<_> =
+                    filename.encode_wide().chain(Some(0).into_iter()).collect();
                 let result = unsafe {
                     LoadLibraryW(filename_str.as_ptr() as *const libc::c_void)
                 };
index 8b19d16017280ccce55b6458778101f02c5a81c2..a00f77080252c70292950b2ac17202478674be99 100644 (file)
@@ -15,7 +15,7 @@
 use error::{Error, FromError};
 use fmt;
 use io;
-use iter::IteratorExt;
+use iter::Iterator;
 use libc;
 use mem;
 #[allow(deprecated)]
index 5851c6e2998095923c744da0d01fceeb6556355b..49dbac4585bc31edb20ec5ae49e0ab59eed42013 100644 (file)
@@ -113,38 +113,12 @@ fn from(s: String) -> OsString {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> From<&'a String> for OsString {
-    fn from(s: &'a String) -> OsString {
-        OsString { inner: Buf::from_str(s) }
+impl<'a, T: ?Sized + AsRef<OsStr>> From<&'a T> for OsString {
+    fn from(s: &'a T) -> OsString {
+        s.as_ref().to_os_string()
     }
 }
 
-#[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> From<&'a str> for OsString {
-    fn from(s: &'a str) -> OsString {
-        OsString { inner: Buf::from_str(s) }
-    }
-}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> From<&'a OsStr> for OsString {
-    fn from(s: &'a OsStr) -> OsString {
-        OsString { inner: s.inner.to_owned() }
-    }
-}
-
-#[cfg(stage0)]
-#[stable(feature = "rust1", since = "1.0.0")]
-impl ops::Index<ops::RangeFull> for OsString {
-    type Output = OsStr;
-
-    #[inline]
-    fn index(&self, _index: &ops::RangeFull) -> &OsStr {
-        unsafe { mem::transmute(self.inner.as_slice()) }
-    }
-}
-
-#[cfg(not(stage0))]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl ops::Index<ops::RangeFull> for OsString {
     type Output = OsStr;
index c1253706832df6e87667aeafbc1901b17962e5aa..a3128ef0f8d9543ed5f98c6441aeb03c743e039d 100644 (file)
@@ -1511,7 +1511,7 @@ fn truncate_works() {
         assert_eq!(v, b"foobar\0\0\0\0".to_vec());
 
         // Truncate to a smaller length, don't seek, and then write something.
-        // Ensure that the intermediate zeroes are all filled in (we're seeked
+        // Ensure that the intermediate zeroes are all filled in (we have `seek`ed
         // past the end of the file).
         check!(file.set_len(2));
         assert_eq!(check!(file.metadata()).len(), 2);
index a9717e36323392a74e55325916a306f9b52bd503..8cc1dde98a0b8bd25178874dfda8da92742d7d46 100644 (file)
@@ -34,7 +34,7 @@ pub struct TempDir {
 // 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;
+const NUM_RAND_CHARS: usize = 12;
 
 impl TempDir {
     /// Attempts to make a temporary directory inside of `tmpdir` whose name
index 2a1294f23b20e9a33384abf6d83f14b5ab548a12..8eea06bf6b0c729f672d0bff9ebbc4843bf277b4 100644 (file)
@@ -18,8 +18,9 @@
 use cmp;
 use error::{self, FromError};
 use fmt;
-use io::{self, Cursor, DEFAULT_BUF_SIZE, Error, ErrorKind};
+use io::{self, DEFAULT_BUF_SIZE, Error, ErrorKind};
 use ptr;
+use iter;
 
 /// Wraps a `Read` and buffers input from it
 ///
@@ -30,7 +31,9 @@
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct BufReader<R> {
     inner: R,
-    buf: Cursor<Vec<u8>>,
+    buf: Vec<u8>,
+    pos: usize,
+    cap: usize,
 }
 
 impl<R: Read> BufReader<R> {
@@ -43,9 +46,13 @@ pub fn new(inner: R) -> BufReader<R> {
     /// Creates a new `BufReader` with the specified buffer capacity
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn with_capacity(cap: usize, inner: R) -> BufReader<R> {
+        let mut buf = Vec::with_capacity(cap);
+        buf.extend(iter::repeat(0).take(cap));
         BufReader {
             inner: inner,
-            buf: Cursor::new(Vec::with_capacity(cap)),
+            buf: buf,
+            pos: 0,
+            cap: 0,
         }
     }
 
@@ -74,12 +81,15 @@ fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
         // If we don't have any buffered data and we're doing a massive read
         // (larger than our internal buffer), bypass our internal buffer
         // entirely.
-        if self.buf.get_ref().len() == self.buf.position() as usize &&
-            buf.len() >= self.buf.get_ref().capacity() {
+        if self.pos == self.cap && buf.len() >= self.buf.len() {
             return self.inner.read(buf);
         }
-        try!(self.fill_buf());
-        self.buf.read(buf)
+        let nread = {
+            let mut rem = try!(self.fill_buf());
+            try!(rem.read(buf))
+        };
+        self.consume(nread);
+        Ok(nread)
     }
 }
 
@@ -88,26 +98,25 @@ impl<R: Read> BufRead for BufReader<R> {
     fn fill_buf(&mut self) -> io::Result<&[u8]> {
         // If we've reached the end of our internal buffer then we need to fetch
         // some more data from the underlying reader.
-        if self.buf.position() as usize == self.buf.get_ref().len() {
-            self.buf.set_position(0);
-            let v = self.buf.get_mut();
-            v.truncate(0);
-            let inner = &mut self.inner;
-            try!(super::with_end_to_cap(v, |b| inner.read(b)));
+        if self.pos == self.cap {
+            self.cap = try!(self.inner.read(&mut self.buf));
+            self.pos = 0;
         }
-        self.buf.fill_buf()
+        Ok(&self.buf[self.pos..self.cap])
     }
 
-    fn consume(&mut self, amt: uint) {
-        self.buf.consume(amt)
+    fn consume(&mut self, amt: usize) {
+        self.pos = cmp::min(self.pos + amt, self.cap);
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<R> fmt::Debug for BufReader<R> where R: fmt::Debug {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-        write!(fmt, "BufReader {{ reader: {:?}, buffer: {}/{} }}",
-               self.inner, self.buf.position(), self.buf.get_ref().len())
+        fmt.debug_struct("BufReader")
+            .field("reader", &self.inner)
+            .field("buffer", &format_args!("{}/{}", self.cap - self.pos, self.buf.len()))
+            .finish()
     }
 }
 
@@ -168,8 +177,8 @@ fn flush_buf(&mut self) -> io::Result<()> {
         if written > 0 {
             // NB: would be better expressed as .remove(0..n) if it existed
             unsafe {
-                ptr::copy(self.buf.as_mut_ptr(),
-                          self.buf.as_ptr().offset(written as isize),
+                ptr::copy(self.buf.as_ptr().offset(written as isize),
+                          self.buf.as_mut_ptr(),
                           len - written);
             }
         }
@@ -222,8 +231,10 @@ fn flush(&mut self) -> io::Result<()> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<W: Write> fmt::Debug for BufWriter<W> where W: fmt::Debug {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-        write!(fmt, "BufWriter {{ writer: {:?}, buffer: {}/{} }}",
-               self.inner.as_ref().unwrap(), self.buf.len(), self.buf.capacity())
+        fmt.debug_struct("BufWriter")
+            .field("writer", &self.inner.as_ref().unwrap())
+            .field("buffer", &format_args!("{}/{}", self.buf.len(), self.buf.capacity()))
+            .finish()
     }
 }
 
@@ -337,9 +348,11 @@ fn flush(&mut self) -> io::Result<()> { self.inner.flush() }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<W: Write> fmt::Debug for LineWriter<W> where W: fmt::Debug {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-        write!(fmt, "LineWriter {{ writer: {:?}, buffer: {}/{} }}",
-               self.inner.inner, self.inner.buf.len(),
-               self.inner.buf.capacity())
+        fmt.debug_struct("LineWriter")
+            .field("writer", &self.inner.inner)
+            .field("buffer",
+                   &format_args!("{}/{}", self.inner.buf.len(), self.inner.buf.capacity()))
+            .finish()
     }
 }
 
@@ -415,10 +428,10 @@ pub fn get_mut(&mut self) -> &mut S {
     /// Any leftover data in the read buffer is lost.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn into_inner(self) -> Result<S, IntoInnerError<BufStream<S>>> {
-        let BufReader { inner: InternalBufWriter(w), buf } = self.inner;
+        let BufReader { inner: InternalBufWriter(w), buf, pos, cap } = self.inner;
         w.into_inner().map_err(|IntoInnerError(w, e)| {
             IntoInnerError(BufStream {
-                inner: BufReader { inner: InternalBufWriter(w), buf: buf },
+                inner: BufReader { inner: InternalBufWriter(w), buf: buf, pos: pos, cap: cap },
             }, e)
         })
     }
@@ -427,7 +440,7 @@ pub fn into_inner(self) -> Result<S, IntoInnerError<BufStream<S>>> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<S: Read + Write> BufRead for BufStream<S> {
     fn fill_buf(&mut self) -> io::Result<&[u8]> { self.inner.fill_buf() }
-    fn consume(&mut self, amt: uint) { self.inner.consume(amt) }
+    fn consume(&mut self, amt: usize) { self.inner.consume(amt) }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -452,10 +465,12 @@ impl<S: Write> fmt::Debug for BufStream<S> where S: fmt::Debug {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         let reader = &self.inner;
         let writer = &self.inner.inner.0;
-        write!(fmt, "BufStream {{ stream: {:?}, write_buffer: {}/{}, read_buffer: {}/{} }}",
-               writer.inner,
-               writer.buf.len(), writer.buf.capacity(),
-               reader.buf.position(), reader.buf.get_ref().len())
+        fmt.debug_struct("BufStream")
+            .field("stream", &writer.inner)
+            .field("write_buffer", &format_args!("{}/{}", writer.buf.len(), writer.buf.capacity()))
+            .field("read_buffer",
+                   &format_args!("{}/{}", reader.cap - reader.pos, reader.buf.len()))
+            .finish()
     }
 }
 
@@ -681,7 +696,7 @@ fn test_chars() {
     }
 
     #[test]
-    #[should_fail]
+    #[should_panic]
     fn dont_panic_in_drop_on_panicked_flush() {
         struct FailFlushWriter;
 
index 79f0af670b44624ea031136bf95654877ed3bcdb..d8e403376bdc734a6d7a4db7988cf785c675d6ea 100644 (file)
@@ -14,7 +14,6 @@
 use cmp;
 use io::{self, SeekFrom, Error, ErrorKind};
 use iter::repeat;
-use num::Int;
 use slice;
 
 /// A `Cursor` is a type which wraps a non-I/O object to provide a `Seek`
@@ -151,7 +150,7 @@ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
         // there (left), and what will be appended on the end (right)
         let space = self.inner.len() - pos as usize;
         let (left, right) = buf.split_at(cmp::min(space, buf.len()));
-        slice::bytes::copy_memory(&mut self.inner[(pos as usize)..], left);
+        slice::bytes::copy_memory(left, &mut self.inner[(pos as usize)..]);
         self.inner.push_all(right);
 
         // Bump us forward
index ce03e26866b7dd1376393290fc2f29ef078ce09a..52daba362131eda7392c0d0c71e49faa5350ff49 100644 (file)
@@ -149,7 +149,7 @@ impl<'a> Read for &'a [u8] {
     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
         let amt = cmp::min(buf.len(), self.len());
         let (a, b) = self.split_at(amt);
-        slice::bytes::copy_memory(buf, a);
+        slice::bytes::copy_memory(a, buf);
         *self = b;
         Ok(amt)
     }
@@ -170,7 +170,7 @@ impl<'a> Write for &'a mut [u8] {
     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
         let amt = cmp::min(data.len(), self.len());
         let (a, b) = mem::replace(self, &mut []).split_at_mut(amt);
-        slice::bytes::copy_memory(a, &data[..amt]);
+        slice::bytes::copy_memory(&data[..amt], a);
         *self = b;
         Ok(amt)
     }
index 0ed6d07bf79185331c6fb8a383cd99a44b96541b..830a88bb6c95b1fe75d54d797233cbc1a3f6fd5d 100644 (file)
@@ -16,7 +16,7 @@
 use unicode::str as core_str;
 use error as std_error;
 use fmt;
-use iter::{self, Iterator, IteratorExt, Extend};
+use iter::{self, Iterator, Extend};
 use marker::Sized;
 use ops::{Drop, FnOnce};
 use option::Option::{self, Some, None};
 
 const DEFAULT_BUF_SIZE: usize = 64 * 1024;
 
-// Acquires a slice of the vector `v` from its length to its capacity
-// (after initializing the data), reads into it, and then updates the length.
-//
-// This function is leveraged to efficiently read some bytes into a destination
-// vector without extra copying and taking advantage of the space that's already
-// in `v`.
-fn with_end_to_cap<F>(v: &mut Vec<u8>, f: F) -> Result<usize>
-    where F: FnOnce(&mut [u8]) -> Result<usize>
-{
-    let len = v.len();
-    let new_area = v.capacity() - len;
-    v.extend(iter::repeat(0).take(new_area));
-    match f(&mut v[len..]) {
-        Ok(n) => {
-            v.truncate(len + n);
-            Ok(n)
-        }
-        Err(e) => {
-            v.truncate(len);
-            Err(e)
-        }
-    }
-}
-
 // A few methods below (read_to_string, read_line) will append data into a
 // `String` buffer, but we need to be pretty careful when doing this. The
 // implementation will just call `.as_mut_vec()` and then delegate to a
@@ -116,19 +92,45 @@ fn drop(&mut self) {
     }
 }
 
+// This uses an adaptive system to extend the vector when it fills. We want to
+// avoid paying to allocate and zero a huge chunk of memory if the reader only
+// has 4 bytes while still making large reads if the reader does have a ton
+// of data to return. Simply tacking on an extra DEFAULT_BUF_SIZE space every
+// time is 4,500 times (!) slower than this if the reader has a very small
+// amount of data to return.
 fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize> {
-    let mut read = 0;
+    let start_len = buf.len();
+    let mut len = start_len;
+    let mut cap_bump = 16;
+    let ret;
     loop {
-        if buf.capacity() == buf.len() {
-            buf.reserve(DEFAULT_BUF_SIZE);
+        if len == buf.len() {
+            if buf.capacity() == buf.len() {
+                if cap_bump < DEFAULT_BUF_SIZE {
+                    cap_bump *= 2;
+                }
+                buf.reserve(cap_bump);
+            }
+            let new_area = buf.capacity() - buf.len();
+            buf.extend(iter::repeat(0).take(new_area));
         }
-        match with_end_to_cap(buf, |b| r.read(b)) {
-            Ok(0) => return Ok(read),
-            Ok(n) => read += n,
+
+        match r.read(&mut buf[len..]) {
+            Ok(0) => {
+                ret = Ok(len - start_len);
+                break;
+            }
+            Ok(n) => len += n,
             Err(ref e) if e.kind() == ErrorKind::Interrupted => {}
-            Err(e) => return Err(e),
+            Err(e) => {
+                ret = Err(e);
+                break;
+            }
         }
     }
+
+    buf.truncate(len);
+    ret
 }
 
 /// A trait for objects which are byte-oriented sources.
@@ -609,8 +611,7 @@ fn read_line(&mut self, buf: &mut String) -> Result<usize> {
     ///
     /// 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")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     fn split(self, byte: u8) -> Split<Self> where Self: Sized {
         Split { buf: self, delim: byte }
     }
@@ -854,13 +855,13 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 /// particular byte.
 ///
 /// See `BufReadExt::split` for more information.
-#[unstable(feature = "io", reason = "awaiting stability of BufReadExt::split")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct Split<B> {
     buf: B,
     delim: u8,
 }
 
-#[unstable(feature = "io", reason = "awaiting stability of BufReadExt::split")]
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<B: BufRead> Iterator for Split<B> {
     type Item = Result<Vec<u8>>;
 
index 53f67766ea676f5b446fa07a55a71c1a4873782f..d361f17cbe41bc87bfafba0ee601edac29b9c2cf 100644 (file)
@@ -11,7 +11,7 @@
 use prelude::v1::*;
 use io::prelude::*;
 
-use cell::RefCell;
+use cell::{RefCell, BorrowState};
 use cmp;
 use fmt;
 use io::lazy::Lazy;
@@ -264,9 +264,8 @@ fn flush(&mut self) -> io::Result<()> {
     fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
         self.lock().write_all(buf)
     }
-    fn write_fmt(&mut self, fmt: fmt::Arguments) -> io::Result<()> {
-        self.lock().write_fmt(fmt)
-    }
+    // Don't override write_fmt as it's possible to run arbitrary code during a
+    // write_fmt, allowing the possibility of a recursive lock (aka deadlock)
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Write for StdoutLock<'a> {
@@ -334,9 +333,7 @@ fn flush(&mut self) -> io::Result<()> {
     fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
         self.lock().write_all(buf)
     }
-    fn write_fmt(&mut self, fmt: fmt::Arguments) -> io::Result<()> {
-        self.lock().write_fmt(fmt)
-    }
+    // Don't override write_fmt for the same reasons as Stdout
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Write for StderrLock<'a> {
@@ -395,10 +392,15 @@ pub fn set_print(sink: Box<Write + Send>) -> Option<Box<Write + Send>> {
            reason = "implementation detail which may disappear or be replaced at any time")]
 #[doc(hidden)]
 pub fn _print(args: fmt::Arguments) {
-    if let Err(e) = LOCAL_STDOUT.with(|s| match s.borrow_mut().as_mut() {
-        Some(w) => w.write_fmt(args),
-        None => stdout().write_fmt(args)
-    }) {
+    let result = LOCAL_STDOUT.with(|s| {
+        if s.borrow_state() == BorrowState::Unused {
+            if let Some(w) = s.borrow_mut().as_mut() {
+                return w.write_fmt(args);
+            }
+        }
+        stdout().write_fmt(args)
+    });
+    if let Err(e) = result {
         panic!("failed printing to stdout: {}", e);
     }
 }
index cca6bb747d43c5f2e66f0f43dcd2883fbc18345b..b7cb8f9ed50fdcbec680f17db933b23fca299ae4 100644 (file)
@@ -67,9 +67,8 @@
 //! module encapsulates the platform-specific rules for dealing
 //! with file paths.
 //!
-//! `std` also includes modules for interoperating with the
-//! C language: [`c_str`](c_str/index.html) and
-//! [`c_vec`](c_vec/index.html).
+//! `std` also includes the [`ffi`](ffi/index.html) module for interoperating
+//! with the C language.
 //!
 //! ## Concurrency, I/O, and the runtime
 //!
 #![feature(lang_items)]
 #![feature(libc)]
 #![feature(linkage, thread_local, asm)]
-#![feature(old_impl_check)]
 #![feature(optin_builtin_traits)]
 #![feature(rand)]
 #![feature(staged_api)]
 #![feature(unboxed_closures)]
 #![feature(unicode)]
 #![feature(unsafe_destructor)]
-#![feature(unsafe_no_drop_flag)]
+#![feature(unsafe_no_drop_flag, filling_drop)]
 #![feature(macro_reexport)]
-#![feature(int_uint)]
 #![feature(unique)]
 #![feature(convert)]
 #![feature(allow_internal_unstable)]
 #![feature(str_char)]
 #![feature(into_cow)]
+#![feature(slice_patterns)]
+#![feature(std_misc)]
+#![feature(debug_builders)]
 #![cfg_attr(test, feature(test, rustc_private, std_misc))]
 
 // Don't link to std. We are std.
 #![no_std]
 
 #![allow(trivial_casts)]
-#![allow(trivial_numeric_casts)]
 #![deny(missing_docs)]
 
 #[cfg(test)] extern crate test;
 
 #[macro_use]
 #[macro_reexport(vec, format)]
-extern crate "collections" as core_collections;
+extern crate collections as core_collections;
 
-#[allow(deprecated)] extern crate "rand" as core_rand;
+#[allow(deprecated)] extern crate rand as core_rand;
 extern crate alloc;
 extern crate unicode;
 extern crate libc;
 #[macro_use] #[no_link] extern crate rustc_bitflags;
 
 // Make std testable by not duplicating lang items. See #2912
-#[cfg(test)] extern crate "std" as realstd;
+#[cfg(test)] extern crate std as realstd;
 #[cfg(test)] pub use realstd::marker;
 #[cfg(test)] pub use realstd::ops;
 #[cfg(test)] pub use realstd::cmp;
index 1681ed4282f48c9e2fa767e1868ab82674084aea..645bc5db753d0a1067c5d3beb2c15301a0c3242d 100644 (file)
@@ -28,7 +28,7 @@
 ///
 /// # Examples
 ///
-/// ```should_fail
+/// ```should_panic
 /// # #![allow(unreachable_code)]
 /// panic!();
 /// panic!("this is a terrible mistake!");
@@ -64,6 +64,10 @@ macro_rules! panic {
 ///
 /// Equivalent to the `println!` macro except that a newline is not printed at
 /// the end of the message.
+///
+/// Note that stdout is frequently line-buffered by default so it may be
+/// necessary to use `io::stdout().flush()` to ensure the output is emitted
+/// immediately.
 #[macro_export]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[allow_internal_unstable]
index 68f3098d993c0510af6d2687bcb9d26a95c5841e..ee57300765e8ef3fb19a8ceeef83642cd5743f00 100644 (file)
@@ -18,6 +18,7 @@
 use prelude::v1::*;
 
 use io::{self, Error, ErrorKind};
+#[allow(deprecated)] // Int
 use num::Int;
 use sys_common::net2 as net_imp;
 
@@ -54,7 +55,9 @@ pub enum Shutdown {
     Both,
 }
 
+#[allow(deprecated)] // Int
 fn hton<I: Int>(i: I) -> I { i.to_be() }
+#[allow(deprecated)] // Int
 fn ntoh<I: Int>(i: I) -> I { Int::from_be(i) }
 
 fn each_addr<A: ToSocketAddrs, F, T>(addr: A, mut f: F) -> io::Result<T>
index e7509834c7b7866a83b2f52f564c40816c76781a..7c1667a603f65f7e8bcaf2cf3891f79320a32b0c 100644 (file)
@@ -16,7 +16,7 @@
 use prelude::v1::*;
 
 use str::FromStr;
-use net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
+use net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
 
 struct Parser<'a> {
     // parsing as ASCII, so can use byte array
@@ -24,11 +24,6 @@ struct Parser<'a> {
     pos: usize,
 }
 
-enum IpAddr {
-    V4(Ipv4Addr),
-    V6(Ipv6Addr),
-}
-
 impl<'a> Parser<'a> {
     fn new(s: &'a str) -> Parser<'a> {
         Parser {
@@ -296,6 +291,17 @@ fn read_socket_addr(&mut self) -> Option<SocketAddr> {
     }
 }
 
+#[unstable(feature = "ip_addr", reason = "recent addition")]
+impl FromStr for IpAddr {
+    type Err = AddrParseError;
+    fn from_str(s: &str) -> Result<IpAddr, AddrParseError> {
+        match Parser::new(s).read_till_eof(|p| p.read_ip_addr()) {
+            Some(s) => Ok(s),
+            None => Err(AddrParseError(()))
+        }
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl FromStr for Ipv4Addr {
     type Err = AddrParseError;
index a4f06f14d49df4d77a0a5de8f190d2d5928281c9..0ae4d3c5bd66b13f269729986f6d510911187bed 100644 (file)
@@ -75,6 +75,7 @@ mod cmath {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 impl Float for f32 {
     #[inline]
     fn nan() -> f32 { num::Float::nan() }
@@ -91,27 +92,27 @@ fn one() -> f32 { num::Float::one() }
 
     #[allow(deprecated)]
     #[inline]
-    fn mantissa_digits(unused_self: Option<f32>) -> uint {
+    fn mantissa_digits(unused_self: Option<f32>) -> usize {
         num::Float::mantissa_digits(unused_self)
     }
     #[allow(deprecated)]
     #[inline]
-    fn digits(unused_self: Option<f32>) -> uint { num::Float::digits(unused_self) }
+    fn digits(unused_self: Option<f32>) -> usize { num::Float::digits(unused_self) }
     #[allow(deprecated)]
     #[inline]
     fn epsilon() -> f32 { num::Float::epsilon() }
     #[allow(deprecated)]
     #[inline]
-    fn min_exp(unused_self: Option<f32>) -> int { num::Float::min_exp(unused_self) }
+    fn min_exp(unused_self: Option<f32>) -> isize { num::Float::min_exp(unused_self) }
     #[allow(deprecated)]
     #[inline]
-    fn max_exp(unused_self: Option<f32>) -> int { num::Float::max_exp(unused_self) }
+    fn max_exp(unused_self: Option<f32>) -> isize { num::Float::max_exp(unused_self) }
     #[allow(deprecated)]
     #[inline]
-    fn min_10_exp(unused_self: Option<f32>) -> int { num::Float::min_10_exp(unused_self) }
+    fn min_10_exp(unused_self: Option<f32>) -> isize { num::Float::min_10_exp(unused_self) }
     #[allow(deprecated)]
     #[inline]
-    fn max_10_exp(unused_self: Option<f32>) -> int { num::Float::max_10_exp(unused_self) }
+    fn max_10_exp(unused_self: Option<f32>) -> isize { num::Float::max_10_exp(unused_self) }
     #[allow(deprecated)]
     #[inline]
     fn min_value() -> f32 { num::Float::min_value() }
@@ -201,11 +202,11 @@ fn ldexp(self, exp: isize) -> f32 {
     /// - `self = x * pow(2, exp)`
     /// - `0.5 <= abs(x) < 1.0`
     #[inline]
-    fn frexp(self) -> (f32, int) {
+    fn frexp(self) -> (f32, isize) {
         unsafe {
             let mut exp = 0;
             let x = cmath::frexpf(self, &mut exp);
-            (x, exp as int)
+            (x, exp as isize)
         }
     }
 
@@ -361,227 +362,18 @@ fn atanh(self) -> f32 {
 #[lang = "f32"]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl f32 {
-    // inlined methods from `num::Float`
-    /// Returns the `NaN` value.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let nan: f32 = Float::nan();
-    ///
-    /// assert!(nan.is_nan());
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    pub fn nan() -> f32 { num::Float::nan() }
-
-    /// Returns the infinite value.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    /// use std::f32;
-    ///
-    /// let infinity: f32 = Float::infinity();
-    ///
-    /// assert!(infinity.is_infinite());
-    /// assert!(!infinity.is_finite());
-    /// assert!(infinity > f32::MAX);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    pub fn infinity() -> f32 { num::Float::infinity() }
-
-    /// Returns the negative infinite value.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    /// use std::f32;
-    ///
-    /// let neg_infinity: f32 = Float::neg_infinity();
-    ///
-    /// assert!(neg_infinity.is_infinite());
-    /// assert!(!neg_infinity.is_finite());
-    /// assert!(neg_infinity < f32::MIN);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    pub fn neg_infinity() -> f32 { num::Float::neg_infinity() }
-
-    /// Returns `0.0`.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let inf: f32 = Float::infinity();
-    /// let zero: f32 = Float::zero();
-    /// let neg_zero: f32 = Float::neg_zero();
-    ///
-    /// assert_eq!(zero, neg_zero);
-    /// assert_eq!(7.0f32/inf, zero);
-    /// assert_eq!(zero * 10.0, zero);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    pub fn zero() -> f32 { num::Float::zero() }
-
-    /// Returns `-0.0`.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let inf: f32 = Float::infinity();
-    /// let zero: f32 = Float::zero();
-    /// let neg_zero: f32 = Float::neg_zero();
-    ///
-    /// assert_eq!(zero, neg_zero);
-    /// assert_eq!(7.0f32/inf, zero);
-    /// assert_eq!(zero * 10.0, zero);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    pub fn neg_zero() -> f32 { num::Float::neg_zero() }
-
-    /// Returns `1.0`.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let one: f32 = Float::one();
-    ///
-    /// assert_eq!(one, 1.0f32);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    pub fn one() -> f32 { num::Float::one() }
-
-    // FIXME (#5527): These should be associated constants
-
-    /// Deprecated: use `std::f32::MANTISSA_DIGITS` or `std::f64::MANTISSA_DIGITS`
-    /// instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MANTISSA_DIGITS` or \
-                           `std::f64::MANTISSA_DIGITS` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn mantissa_digits(unused_self: Option<f32>) -> uint {
-        num::Float::mantissa_digits(unused_self)
-    }
-
-    /// Deprecated: use `std::f32::DIGITS` or `std::f64::DIGITS` instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::DIGITS` or `std::f64::DIGITS` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn digits(unused_self: Option<f32>) -> uint { num::Float::digits(unused_self) }
-
-    /// Deprecated: use `std::f32::EPSILON` or `std::f64::EPSILON` instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::EPSILON` or `std::f64::EPSILON` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn epsilon() -> f32 { num::Float::epsilon() }
-
-    /// Deprecated: use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn min_exp(unused_self: Option<f32>) -> int { num::Float::min_exp(unused_self) }
-
-    /// Deprecated: use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn max_exp(unused_self: Option<f32>) -> int { num::Float::max_exp(unused_self) }
-
-    /// Deprecated: use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn min_10_exp(unused_self: Option<f32>) -> int { num::Float::min_10_exp(unused_self) }
-
-    /// Deprecated: use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn max_10_exp(unused_self: Option<f32>) -> int { num::Float::max_10_exp(unused_self) }
-
-    /// Returns the smallest finite value that this type can represent.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    /// use std::f64;
-    ///
-    /// let x: f64 = Float::min_value();
-    ///
-    /// assert_eq!(x, f64::MIN);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    #[allow(deprecated)]
-    pub fn min_value() -> f32 { num::Float::min_value() }
-
-    /// Returns the smallest normalized positive number that this type can represent.
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    #[allow(deprecated)]
-    pub fn min_pos_value(unused_self: Option<f32>) -> f32 { num::Float::min_pos_value(unused_self) }
-
-    /// Returns the largest finite value that this type can represent.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    /// use std::f64;
-    ///
-    /// let x: f64 = Float::max_value();
-    /// assert_eq!(x, f64::MAX);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    #[allow(deprecated)]
-    pub fn max_value() -> f32 { num::Float::max_value() }
-
     /// Returns `true` if this value is `NaN` and false otherwise.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let nan = f64::NAN;
-    /// let f = 7.0;
+    /// let nan = f32::NAN;
+    /// let f = 7.0_f32;
     ///
     /// assert!(nan.is_nan());
     /// assert!(!f.is_nan());
     /// ```
-    #[unstable(feature = "std_misc", reason = "position is undecided")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn is_nan(self) -> bool { num::Float::is_nan(self) }
 
@@ -589,14 +381,12 @@ pub fn is_nan(self) -> bool { num::Float::is_nan(self) }
     /// false otherwise.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
     /// use std::f32;
     ///
     /// let f = 7.0f32;
-    /// let inf: f32 = Float::infinity();
-    /// let neg_inf: f32 = Float::neg_infinity();
-    /// let nan: f32 = f32::NAN;
+    /// let inf = f32::INFINITY;
+    /// let neg_inf = f32::NEG_INFINITY;
+    /// let nan = f32::NAN;
     ///
     /// assert!(!f.is_infinite());
     /// assert!(!nan.is_infinite());
@@ -604,21 +394,19 @@ pub fn is_nan(self) -> bool { num::Float::is_nan(self) }
     /// assert!(inf.is_infinite());
     /// assert!(neg_inf.is_infinite());
     /// ```
-    #[unstable(feature = "std_misc", reason = "position is undecided")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn is_infinite(self) -> bool { num::Float::is_infinite(self) }
 
     /// Returns `true` if this number is neither infinite nor `NaN`.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
     /// use std::f32;
     ///
     /// let f = 7.0f32;
-    /// let inf: f32 = Float::infinity();
-    /// let neg_inf: f32 = Float::neg_infinity();
-    /// let nan: f32 = f32::NAN;
+    /// let inf = f32::INFINITY;
+    /// let neg_inf = f32::NEG_INFINITY;
+    /// let nan = f32::NAN;
     ///
     /// assert!(f.is_finite());
     ///
@@ -626,7 +414,7 @@ pub fn is_infinite(self) -> bool { num::Float::is_infinite(self) }
     /// assert!(!inf.is_finite());
     /// assert!(!neg_inf.is_finite());
     /// ```
-    #[unstable(feature = "std_misc", reason = "position is undecided")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn is_finite(self) -> bool { num::Float::is_finite(self) }
 
@@ -635,13 +423,12 @@ pub fn is_finite(self) -> bool { num::Float::is_finite(self) }
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
     /// use std::f32;
     ///
     /// let min = f32::MIN_POSITIVE; // 1.17549435e-38f32
     /// let max = f32::MAX;
     /// let lower_than_min = 1.0e-40_f32;
-    /// let zero = 0.0f32;
+    /// let zero = 0.0_f32;
     ///
     /// assert!(min.is_normal());
     /// assert!(max.is_normal());
@@ -653,7 +440,7 @@ pub fn is_finite(self) -> bool { num::Float::is_finite(self) }
     /// assert!(!lower_than_min.is_normal());
     /// ```
     /// [subnormal]: http://en.wikipedia.org/wiki/Denormal_number
-    #[unstable(feature = "std_misc", reason = "position is undecided")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn is_normal(self) -> bool { num::Float::is_normal(self) }
 
@@ -662,11 +449,10 @@ pub fn is_normal(self) -> bool { num::Float::is_normal(self) }
     /// predicate instead.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::{Float, FpCategory};
+    /// use std::num::FpCategory;
     /// use std::f32;
     ///
-    /// let num = 12.4f32;
+    /// let num = 12.4_f32;
     /// let inf = f32::INFINITY;
     ///
     /// assert_eq!(num.classify(), FpCategory::Normal);
@@ -682,7 +468,7 @@ pub fn classify(self) -> FpCategory { num::Float::classify(self) }
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
+    /// use std::f32;
     ///
     /// let num = 2.0f32;
     ///
@@ -695,7 +481,7 @@ pub fn classify(self) -> FpCategory { num::Float::classify(self) }
     /// // 1 * 8388608 * 2^(-22) == 2
     /// let abs_difference = (sign_f * mantissa_f * exponent_f - num).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     /// [floating-point]: ../../../../../reference.html#machine-types
     #[unstable(feature = "std_misc", reason = "signature is undecided")]
@@ -705,10 +491,8 @@ pub fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self)
     /// Returns the largest integer less than or equal to a number.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let f = 3.99;
-    /// let g = 3.0;
+    /// let f = 3.99_f32;
+    /// let g = 3.0_f32;
     ///
     /// assert_eq!(f.floor(), 3.0);
     /// assert_eq!(g.floor(), 3.0);
@@ -720,10 +504,8 @@ pub fn floor(self) -> f32 { num::Float::floor(self) }
     /// Returns the smallest integer greater than or equal to a number.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let f = 3.01;
-    /// let g = 4.0;
+    /// let f = 3.01_f32;
+    /// let g = 4.0_f32;
     ///
     /// assert_eq!(f.ceil(), 4.0);
     /// assert_eq!(g.ceil(), 4.0);
@@ -736,10 +518,8 @@ pub fn ceil(self) -> f32 { num::Float::ceil(self) }
     /// `0.0`.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let f = 3.3;
-    /// let g = -3.3;
+    /// let f = 3.3_f32;
+    /// let g = -3.3_f32;
     ///
     /// assert_eq!(f.round(), 3.0);
     /// assert_eq!(g.round(), -3.0);
@@ -751,10 +531,8 @@ pub fn round(self) -> f32 { num::Float::round(self) }
     /// Return the integer part of a number.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let f = 3.3;
-    /// let g = -3.7;
+    /// let f = 3.3_f32;
+    /// let g = -3.7_f32;
     ///
     /// assert_eq!(f.trunc(), 3.0);
     /// assert_eq!(g.trunc(), -3.0);
@@ -766,38 +544,36 @@ pub fn trunc(self) -> f32 { num::Float::trunc(self) }
     /// Returns the fractional part of a number.
     ///
     /// ```
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let x = 3.5;
-    /// let y = -3.5;
+    /// let x = 3.5_f32;
+    /// let y = -3.5_f32;
     /// let abs_difference_x = (x.fract() - 0.5).abs();
     /// let abs_difference_y = (y.fract() - (-0.5)).abs();
     ///
-    /// assert!(abs_difference_x < 1e-10);
-    /// assert!(abs_difference_y < 1e-10);
+    /// assert!(abs_difference_x <= f32::EPSILON);
+    /// assert!(abs_difference_y <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn fract(self) -> f32 { num::Float::fract(self) }
 
-    /// Computes the absolute value of `self`. Returns `Float::nan()` if the
-    /// number is `Float::nan()`.
+    /// Computes the absolute value of `self`. Returns `NAN` if the
+    /// number is `NAN`.
     ///
     /// ```
-    /// # #![feature(core, std_misc)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let x = 3.5;
-    /// let y = -3.5;
+    /// let x = 3.5_f32;
+    /// let y = -3.5_f32;
     ///
     /// let abs_difference_x = (x.abs() - x).abs();
     /// let abs_difference_y = (y.abs() - (-y)).abs();
     ///
-    /// assert!(abs_difference_x < 1e-10);
-    /// assert!(abs_difference_y < 1e-10);
+    /// assert!(abs_difference_x <= f32::EPSILON);
+    /// assert!(abs_difference_y <= f32::EPSILON);
     ///
-    /// assert!(f64::NAN.abs().is_nan());
+    /// assert!(f32::NAN.abs().is_nan());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -805,66 +581,70 @@ pub fn abs(self) -> f32 { num::Float::abs(self) }
 
     /// Returns a number that represents the sign of `self`.
     ///
-    /// - `1.0` if the number is positive, `+0.0` or `Float::infinity()`
-    /// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()`
-    /// - `Float::nan()` if the number is `Float::nan()`
+    /// - `1.0` if the number is positive, `+0.0` or `INFINITY`
+    /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
+    /// - `NAN` if the number is `NAN`
     ///
     /// ```
-    /// # #![feature(core, std_misc)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let f = 3.5;
+    /// let f = 3.5_f32;
     ///
     /// assert_eq!(f.signum(), 1.0);
-    /// assert_eq!(f64::NEG_INFINITY.signum(), -1.0);
+    /// assert_eq!(f32::NEG_INFINITY.signum(), -1.0);
     ///
-    /// assert!(f64::NAN.signum().is_nan());
+    /// assert!(f32::NAN.signum().is_nan());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn signum(self) -> f32 { num::Float::signum(self) }
 
-    /// Returns `true` if `self` is positive, including `+0.0` and
-    /// `Float::infinity()`.
+    /// Returns `true` if `self`'s sign bit is positive, including
+    /// `+0.0` and `INFINITY`.
     ///
     /// ```
-    /// use std::num::Float;
-    /// use std::f64;
-    ///
-    /// let nan: f64 = f64::NAN;
+    /// use std::f32;
     ///
-    /// let f = 7.0;
-    /// let g = -7.0;
+    /// let nan = f32::NAN;
+    /// let f = 7.0_f32;
+    /// let g = -7.0_f32;
     ///
-    /// assert!(f.is_positive());
-    /// assert!(!g.is_positive());
+    /// assert!(f.is_sign_positive());
+    /// assert!(!g.is_sign_positive());
     /// // Requires both tests to determine if is `NaN`
-    /// assert!(!nan.is_positive() && !nan.is_negative());
+    /// assert!(!nan.is_sign_positive() && !nan.is_sign_negative());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
+    pub fn is_sign_positive(self) -> bool { num::Float::is_positive(self) }
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[deprecated(since = "1.0.0", reason = "renamed to is_sign_positive")]
+    #[inline]
     pub fn is_positive(self) -> bool { num::Float::is_positive(self) }
 
-    /// Returns `true` if `self` is negative, including `-0.0` and
-    /// `Float::neg_infinity()`.
+    /// Returns `true` if `self`'s sign is negative, including `-0.0`
+    /// and `NEG_INFINITY`.
     ///
     /// ```
-    /// use std::num::Float;
-    /// use std::f64;
-    ///
-    /// let nan = f64::NAN;
+    /// use std::f32;
     ///
-    /// let f = 7.0;
-    /// let g = -7.0;
+    /// let nan = f32::NAN;
+    /// let f = 7.0f32;
+    /// let g = -7.0f32;
     ///
-    /// assert!(!f.is_negative());
-    /// assert!(g.is_negative());
+    /// assert!(!f.is_sign_negative());
+    /// assert!(g.is_sign_negative());
     /// // Requires both tests to determine if is `NaN`.
-    /// assert!(!nan.is_positive() && !nan.is_negative());
+    /// assert!(!nan.is_sign_positive() && !nan.is_sign_negative());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
+    pub fn is_sign_negative(self) -> bool { num::Float::is_negative(self) }
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[deprecated(since = "1.0.0", reason = "renamed to is_sign_negative")]
+    #[inline]
     pub fn is_negative(self) -> bool { num::Float::is_negative(self) }
 
     /// Fused multiply-add. Computes `(self * a) + b` with only one rounding
@@ -872,36 +652,32 @@ pub fn is_negative(self) -> bool { num::Float::is_negative(self) }
     /// a separate multiplication operation followed by an add.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let m = 10.0;
-    /// let x = 4.0;
-    /// let b = 60.0;
+    /// let m = 10.0_f32;
+    /// let x = 4.0_f32;
+    /// let b = 60.0_f32;
     ///
     /// // 100.0
     /// let abs_difference = (m.mul_add(x, b) - (m*x + b)).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn mul_add(self, a: f32, b: f32) -> f32 { num::Float::mul_add(self, a, b) }
 
     /// Take the reciprocal (inverse) of a number, `1/x`.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let x = 2.0;
+    /// let x = 2.0_f32;
     /// let abs_difference = (x.recip() - (1.0/x)).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn recip(self) -> f32 { num::Float::recip(self) }
 
@@ -910,12 +686,12 @@ pub fn recip(self) -> f32 { num::Float::recip(self) }
     /// Using this function is generally faster than using `powf`
     ///
     /// ```
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let x = 2.0;
+    /// let x = 2.0_f32;
     /// let abs_difference = (x.powi(2) - x*x).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -924,12 +700,12 @@ pub fn powi(self, n: i32) -> f32 { num::Float::powi(self, n) }
     /// Raise a number to a floating point power.
     ///
     /// ```
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let x = 2.0;
+    /// let x = 2.0_f32;
     /// let abs_difference = (x.powf(2.0) - x*x).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -940,52 +716,51 @@ pub fn powf(self, n: f32) -> f32 { num::Float::powf(self, n) }
     /// Returns NaN if `self` is a negative number.
     ///
     /// ```
-    /// # #![feature(core, std_misc)]
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let positive = 4.0;
-    /// let negative = -4.0;
+    /// let positive = 4.0_f32;
+    /// let negative = -4.0_f32;
     ///
     /// let abs_difference = (positive.sqrt() - 2.0).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// assert!(negative.sqrt().is_nan());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn sqrt(self) -> f32 { num::Float::sqrt(self) }
 
-
     /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let f = 4.0;
+    /// let f = 4.0f32;
     ///
     /// let abs_difference = (f.rsqrt() - 0.5).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[unstable(feature = "std_misc",
                reason = "unsure about its place in the world")]
+    #[deprecated(since = "1.0.0", reason = "use self.sqrt().recip() instead")]
     #[inline]
     pub fn rsqrt(self) -> f32 { num::Float::rsqrt(self) }
 
     /// Returns `e^(self)`, (the exponential function).
     ///
     /// ```
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let one = 1.0;
+    /// let one = 1.0f32;
     /// // e^1
     /// let e = one.exp();
     ///
     /// // ln(e) - 1 == 0
     /// let abs_difference = (e.ln() - 1.0).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -994,14 +769,14 @@ pub fn exp(self) -> f32 { num::Float::exp(self) }
     /// Returns `2^(self)`.
     ///
     /// ```
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let f = 2.0;
+    /// let f = 2.0f32;
     ///
     /// // 2^2 - 4 == 0
     /// let abs_difference = (f.exp2() - 4.0).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1010,16 +785,16 @@ pub fn exp2(self) -> f32 { num::Float::exp2(self) }
     /// Returns the natural logarithm of the number.
     ///
     /// ```
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let one = 1.0;
+    /// let one = 1.0f32;
     /// // e^1
     /// let e = one.exp();
     ///
     /// // ln(e) - 1 == 0
     /// let abs_difference = (e.ln() - 1.0).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1028,10 +803,10 @@ pub fn ln(self) -> f32 { num::Float::ln(self) }
     /// Returns the logarithm of the number with respect to an arbitrary base.
     ///
     /// ```
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let ten = 10.0;
-    /// let two = 2.0;
+    /// let ten = 10.0f32;
+    /// let two = 2.0f32;
     ///
     /// // log10(10) - 1 == 0
     /// let abs_difference_10 = (ten.log(10.0) - 1.0).abs();
@@ -1039,8 +814,8 @@ pub fn ln(self) -> f32 { num::Float::ln(self) }
     /// // log2(2) - 1 == 0
     /// let abs_difference_2 = (two.log(2.0) - 1.0).abs();
     ///
-    /// assert!(abs_difference_10 < 1e-10);
-    /// assert!(abs_difference_2 < 1e-10);
+    /// assert!(abs_difference_10 <= f32::EPSILON);
+    /// assert!(abs_difference_2 <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1049,14 +824,14 @@ pub fn log(self, base: f32) -> f32 { num::Float::log(self, base) }
     /// Returns the base 2 logarithm of the number.
     ///
     /// ```
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let two = 2.0;
+    /// let two = 2.0f32;
     ///
     /// // log2(2) - 1 == 0
     /// let abs_difference = (two.log2() - 1.0).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1065,14 +840,14 @@ pub fn log2(self) -> f32 { num::Float::log2(self) }
     /// Returns the base 10 logarithm of the number.
     ///
     /// ```
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let ten = 10.0;
+    /// let ten = 10.0f32;
     ///
     /// // log10(10) - 1 == 0
     /// let abs_difference = (ten.log10() - 1.0).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1082,14 +857,13 @@ pub fn log10(self) -> f32 { num::Float::log10(self) }
     ///
     /// ```
     /// # #![feature(std_misc, core)]
-    /// use std::num::Float;
-    /// use std::f64::consts;
+    /// use std::f32::{self, consts};
     ///
     /// let angle = consts::PI;
     ///
     /// let abs_difference = (angle.to_degrees() - 180.0).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[unstable(feature = "std_misc", reason = "desirability is unclear")]
     #[inline]
@@ -1098,15 +872,14 @@ pub fn to_degrees(self) -> f32 { num::Float::to_degrees(self) }
     /// Convert degrees to radians.
     ///
     /// ```
-    /// # #![feature(std_misc, core)]
-    /// use std::num::Float;
-    /// use std::f64::consts;
+    /// # #![feature(std_misc)]
+    /// use std::f32::{self, consts};
     ///
-    /// let angle = 180.0;
+    /// let angle = 180.0f32;
     ///
     /// let abs_difference = (angle.to_radians() - consts::PI).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[unstable(feature = "std_misc", reason = "desirability is unclear")]
     #[inline]
@@ -1116,17 +889,16 @@ pub fn to_radians(self) -> f32 { num::Float::to_radians(self) }
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
+    /// use std::f32;
     /// // 3*2^2 - 12 == 0
-    /// let abs_difference = (Float::ldexp(3.0, 2) - 12.0).abs();
+    /// let abs_difference = (f32::ldexp(3.0, 2) - 12.0).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[unstable(feature = "std_misc",
                reason = "pending integer conventions")]
     #[inline]
-    pub fn ldexp(x: f32, exp: int) -> f32 {
+    pub fn ldexp(x: f32, exp: isize) -> f32 {
         unsafe { cmath::ldexpf(x, exp as c_int) }
     }
 
@@ -1138,26 +910,26 @@ pub fn ldexp(x: f32, exp: int) -> f32 {
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let x = 4.0;
+    /// let x = 4.0f32;
     ///
     /// // (1/2)*2^3 -> 1 * 8/2 -> 4.0
     /// let f = x.frexp();
     /// let abs_difference_0 = (f.0 - 0.5).abs();
-    /// let abs_difference_1 = (f.1 as f64 - 3.0).abs();
+    /// let abs_difference_1 = (f.1 as f32 - 3.0).abs();
     ///
-    /// assert!(abs_difference_0 < 1e-10);
-    /// assert!(abs_difference_1 < 1e-10);
+    /// assert!(abs_difference_0 <= f32::EPSILON);
+    /// assert!(abs_difference_1 <= f32::EPSILON);
     /// ```
     #[unstable(feature = "std_misc",
                reason = "pending integer conventions")]
     #[inline]
-    pub fn frexp(self) -> (f32, int) {
+    pub fn frexp(self) -> (f32, isize) {
         unsafe {
             let mut exp = 0;
             let x = cmath::frexpf(self, &mut exp);
-            (x, exp as int)
+            (x, exp as isize)
         }
     }
 
@@ -1166,13 +938,13 @@ pub fn frexp(self) -> (f32, int) {
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
+    /// use std::f32;
     ///
     /// let x = 1.0f32;
     ///
     /// let abs_diff = (x.next_after(2.0) - 1.00000011920928955078125_f32).abs();
     ///
-    /// assert!(abs_diff < 1e-10);
+    /// assert!(abs_diff <= f32::EPSILON);
     /// ```
     #[unstable(feature = "std_misc",
                reason = "unsure about its place in the world")]
@@ -1184,10 +956,8 @@ pub fn next_after(self, other: f32) -> f32 {
     /// Returns the maximum of the two numbers.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let x = 1.0;
-    /// let y = 2.0;
+    /// let x = 1.0f32;
+    /// let y = 2.0f32;
     ///
     /// assert_eq!(x.max(y), y);
     /// ```
@@ -1200,10 +970,8 @@ pub fn max(self, other: f32) -> f32 {
     /// Returns the minimum of the two numbers.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let x = 1.0;
-    /// let y = 2.0;
+    /// let x = 1.0f32;
+    /// let y = 2.0f32;
     ///
     /// assert_eq!(x.min(y), x);
     /// ```
@@ -1220,18 +988,18 @@ pub fn min(self, other: f32) -> f32 {
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let x = 3.0;
-    /// let y = -3.0;
+    /// let x = 3.0f32;
+    /// let y = -3.0f32;
     ///
     /// let abs_difference_x = (x.abs_sub(1.0) - 2.0).abs();
     /// let abs_difference_y = (y.abs_sub(1.0) - 0.0).abs();
     ///
-    /// assert!(abs_difference_x < 1e-10);
-    /// assert!(abs_difference_y < 1e-10);
+    /// assert!(abs_difference_x <= f32::EPSILON);
+    /// assert!(abs_difference_y <= f32::EPSILON);
     /// ```
-    #[unstable(feature = "std_misc", reason = "may be renamed")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn abs_sub(self, other: f32) -> f32 {
         unsafe { cmath::fdimf(self, other) }
@@ -1241,16 +1009,16 @@ pub fn abs_sub(self, other: f32) -> f32 {
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let x = 8.0;
+    /// let x = 8.0f32;
     ///
     /// // x^(1/3) - 2 == 0
     /// let abs_difference = (x.cbrt() - 2.0).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
-    #[unstable(feature = "std_misc", reason = "may be renamed")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn cbrt(self) -> f32 {
         unsafe { cmath::cbrtf(self) }
@@ -1260,19 +1028,17 @@ pub fn cbrt(self) -> f32 {
     /// legs of length `x` and `y`.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let x = 2.0;
-    /// let y = 3.0;
+    /// let x = 2.0f32;
+    /// let y = 3.0f32;
     ///
     /// // sqrt(x^2 + y^2)
     /// let abs_difference = (x.hypot(y) - (x.powi(2) + y.powi(2)).sqrt()).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn hypot(self, other: f32) -> f32 {
         unsafe { cmath::hypotf(self, other) }
@@ -1281,15 +1047,13 @@ pub fn hypot(self, other: f32) -> f32 {
     /// Computes the sine of a number (in radians).
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let x = f64::consts::PI/2.0;
+    /// let x = f32::consts::PI/2.0;
     ///
     /// let abs_difference = (x.sin() - 1.0).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1300,15 +1064,13 @@ pub fn sin(self) -> f32 {
     /// Computes the cosine of a number (in radians).
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let x = 2.0*f64::consts::PI;
+    /// let x = 2.0*f32::consts::PI;
     ///
     /// let abs_difference = (x.cos() - 1.0).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1319,14 +1081,12 @@ pub fn cos(self) -> f32 {
     /// Computes the tangent of a number (in radians).
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let x = f64::consts::PI/4.0;
     /// let abs_difference = (x.tan() - 1.0).abs();
     ///
-    /// assert!(abs_difference < 1e-14);
+    /// assert!(abs_difference < 1e-10);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1339,16 +1099,14 @@ pub fn tan(self) -> f32 {
     /// [-1, 1].
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let f = f64::consts::PI / 2.0;
+    /// let f = f32::consts::PI / 2.0;
     ///
     /// // asin(sin(pi/2))
-    /// let abs_difference = (f.sin().asin() - f64::consts::PI / 2.0).abs();
+    /// let abs_difference = f.sin().asin().abs_sub(f32::consts::PI / 2.0);
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1361,16 +1119,14 @@ pub fn asin(self) -> f32 {
     /// [-1, 1].
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let f = f64::consts::PI / 4.0;
+    /// let f = f32::consts::PI / 4.0;
     ///
     /// // acos(cos(pi/4))
-    /// let abs_difference = (f.cos().acos() - f64::consts::PI / 4.0).abs();
+    /// let abs_difference = f.cos().acos().abs_sub(f32::consts::PI / 4.0);
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1382,14 +1138,14 @@ pub fn acos(self) -> f32 {
     /// range [-pi/2, pi/2];
     ///
     /// ```
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let f = 1.0;
+    /// let f = 1.0f32;
     ///
     /// // atan(tan(1))
-    /// let abs_difference = (f.tan().atan() - 1.0).abs();
+    /// let abs_difference = f.tan().atan().abs_sub(1.0);
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1405,25 +1161,23 @@ pub fn atan(self) -> f32 {
     /// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)`
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let pi = f64::consts::PI;
+    /// let pi = f32::consts::PI;
     /// // All angles from horizontal right (+x)
     /// // 45 deg counter-clockwise
-    /// let x1 = 3.0;
-    /// let y1 = -3.0;
+    /// let x1 = 3.0f32;
+    /// let y1 = -3.0f32;
     ///
     /// // 135 deg clockwise
-    /// let x2 = -3.0;
-    /// let y2 = 3.0;
+    /// let x2 = -3.0f32;
+    /// let y2 = 3.0f32;
     ///
     /// let abs_difference_1 = (y1.atan2(x1) - (-pi/4.0)).abs();
     /// let abs_difference_2 = (y2.atan2(x2) - 3.0*pi/4.0).abs();
     ///
-    /// assert!(abs_difference_1 < 1e-10);
-    /// assert!(abs_difference_2 < 1e-10);
+    /// assert!(abs_difference_1 <= f32::EPSILON);
+    /// assert!(abs_difference_2 <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1435,18 +1189,16 @@ pub fn atan2(self, other: f32) -> f32 {
     /// `(sin(x), cos(x))`.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let x = f64::consts::PI/4.0;
+    /// let x = f32::consts::PI/4.0;
     /// let f = x.sin_cos();
     ///
     /// let abs_difference_0 = (f.0 - x.sin()).abs();
     /// let abs_difference_1 = (f.1 - x.cos()).abs();
     ///
-    /// assert!(abs_difference_0 < 1e-10);
-    /// assert!(abs_difference_0 < 1e-10);
+    /// assert!(abs_difference_0 <= f32::EPSILON);
+    /// assert!(abs_difference_0 <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1458,17 +1210,16 @@ pub fn sin_cos(self) -> (f32, f32) {
     /// number is close to zero.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
+    /// use std::f64;
     ///
-    /// let x = 7.0;
+    /// let x = 7.0f64;
     ///
     /// // e^(ln(7)) - 1
-    /// let abs_difference = (x.ln().exp_m1() - 6.0).abs();
+    /// let abs_difference = x.ln().exp_m1().abs_sub(6.0);
     ///
     /// assert!(abs_difference < 1e-10);
     /// ```
-    #[unstable(feature = "std_misc", reason = "may be renamed")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn exp_m1(self) -> f32 {
         unsafe { cmath::expm1f(self) }
@@ -1478,18 +1229,16 @@ pub fn exp_m1(self) -> f32 {
     /// the operations were performed separately.
     ///
     /// ```
-    /// # #![feature(std_misc, core)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let x = f64::consts::E - 1.0;
+    /// let x = f32::consts::E - 1.0;
     ///
     /// // ln(1 + (e - 1)) == ln(e) == 1
     /// let abs_difference = (x.ln_1p() - 1.0).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
-    #[unstable(feature = "std_misc", reason = "may be renamed")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn ln_1p(self) -> f32 {
         unsafe { cmath::log1pf(self) }
@@ -1498,19 +1247,17 @@ pub fn ln_1p(self) -> f32 {
     /// Hyperbolic sine function.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let e = f64::consts::E;
-    /// let x = 1.0;
+    /// let e = f32::consts::E;
+    /// let x = 1.0f32;
     ///
     /// let f = x.sinh();
     /// // Solving sinh() at 1 gives `(e^2-1)/(2e)`
     /// let g = (e*e - 1.0)/(2.0*e);
     /// let abs_difference = (f - g).abs();
     ///
-    /// assert!(abs_difference < 1e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1521,19 +1268,17 @@ pub fn sinh(self) -> f32 {
     /// Hyperbolic cosine function.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let e = f64::consts::E;
-    /// let x = 1.0;
+    /// let e = f32::consts::E;
+    /// let x = 1.0f32;
     /// let f = x.cosh();
     /// // Solving cosh() at 1 gives this result
     /// let g = (e*e + 1.0)/(2.0*e);
-    /// let abs_difference = (f - g).abs();
+    /// let abs_difference = f.abs_sub(g);
     ///
     /// // Same result
-    /// assert!(abs_difference < 1.0e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1544,19 +1289,17 @@ pub fn cosh(self) -> f32 {
     /// Hyperbolic tangent function.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let e = f64::consts::E;
-    /// let x = 1.0;
+    /// let e = f32::consts::E;
+    /// let x = 1.0f32;
     ///
     /// let f = x.tanh();
     /// // Solving tanh() at 1 gives `(1 - e^(-2))/(1 + e^(-2))`
     /// let g = (1.0 - e.powi(-2))/(1.0 + e.powi(-2));
     /// let abs_difference = (f - g).abs();
     ///
-    /// assert!(abs_difference < 1.0e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1567,15 +1310,14 @@ pub fn tanh(self) -> f32 {
     /// Inverse hyperbolic sine function.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let x = 1.0;
+    /// let x = 1.0f32;
     /// let f = x.sinh().asinh();
     ///
     /// let abs_difference = (f - x).abs();
     ///
-    /// assert!(abs_difference < 1.0e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1589,15 +1331,14 @@ pub fn asinh(self) -> f32 {
     /// Inverse hyperbolic cosine function.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
+    /// use std::f32;
     ///
-    /// let x = 1.0;
+    /// let x = 1.0f32;
     /// let f = x.cosh().acosh();
     ///
     /// let abs_difference = (f - x).abs();
     ///
-    /// assert!(abs_difference < 1.0e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1611,16 +1352,14 @@ pub fn acosh(self) -> f32 {
     /// Inverse hyperbolic tangent function.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
-    /// use std::f64;
+    /// use std::f32;
     ///
-    /// let e = f64::consts::E;
+    /// let e = f32::consts::E;
     /// let f = e.tanh().atanh();
     ///
-    /// let abs_difference = (f - e).abs();
+    /// let abs_difference = f.abs_sub(e);
     ///
-    /// assert!(abs_difference < 1.0e-10);
+    /// assert!(abs_difference <= f32::EPSILON);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
@@ -1640,6 +1379,7 @@ pub fn atanh(self) -> f32 {
 /// * num - The float value
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
+#[deprecated(since = "1.0.0", reason = "use the ToString trait instead")]
 pub fn to_string(num: f32) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 10, true, SignNeg, DigAll, ExpNone, false);
@@ -1653,6 +1393,7 @@ pub fn to_string(num: f32) -> String {
 /// * num - The float value
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
+#[deprecated(since = "1.0.0", reason = "use format! instead")]
 pub fn to_str_hex(num: f32) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 16, true, SignNeg, DigAll, ExpNone, false);
@@ -1668,6 +1409,7 @@ pub fn to_str_hex(num: f32) -> String {
 /// * radix - The base to use
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
+#[deprecated(since = "1.0.0", reason = "use format! instead")]
 pub fn to_str_radix_special(num: f32, rdx: u32) -> (String, bool) {
     strconv::float_to_str_common(num, rdx, true, SignNeg, DigAll, ExpNone, false)
 }
@@ -1681,7 +1423,7 @@ pub fn to_str_radix_special(num: f32, rdx: u32) -> (String, bool) {
 /// * digits - The number of significant digits
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
-pub fn to_str_exact(num: f32, dig: uint) -> String {
+pub fn to_str_exact(num: f32, dig: usize) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 10, true, SignNeg, DigExact(dig), ExpNone, false);
     r
@@ -1696,7 +1438,7 @@ pub fn to_str_exact(num: f32, dig: uint) -> String {
 /// * digits - The number of significant digits
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
-pub fn to_str_digits(num: f32, dig: uint) -> String {
+pub fn to_str_digits(num: f32, dig: usize) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 10, true, SignNeg, DigMax(dig), ExpNone, false);
     r
@@ -1712,7 +1454,7 @@ pub fn to_str_digits(num: f32, dig: uint) -> String {
 /// * upper - Use `E` instead of `e` for the exponent sign
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
-pub fn to_str_exp_exact(num: f32, dig: uint, upper: bool) -> String {
+pub fn to_str_exp_exact(num: f32, dig: usize, upper: bool) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 10, true, SignNeg, DigExact(dig), ExpDec, upper);
     r
@@ -1728,7 +1470,7 @@ pub fn to_str_exp_exact(num: f32, dig: uint, upper: bool) -> String {
 /// * upper - Use `E` instead of `e` for the exponent sign
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
-pub fn to_str_exp_digits(num: f32, dig: uint, upper: bool) -> String {
+pub fn to_str_exp_digits(num: f32, dig: usize, upper: bool) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 10, true, SignNeg, DigMax(dig), ExpDec, upper);
     r
@@ -1764,8 +1506,8 @@ fn test_nan() {
         assert!(!nan.is_infinite());
         assert!(!nan.is_finite());
         assert!(!nan.is_normal());
-        assert!(!nan.is_positive());
-        assert!(!nan.is_negative());
+        assert!(!nan.is_sign_positive());
+        assert!(!nan.is_sign_negative());
         assert_eq!(Fp::Nan, nan.classify());
     }
 
@@ -1774,8 +1516,8 @@ fn test_infinity() {
         let inf: f32 = Float::infinity();
         assert!(inf.is_infinite());
         assert!(!inf.is_finite());
-        assert!(inf.is_positive());
-        assert!(!inf.is_negative());
+        assert!(inf.is_sign_positive());
+        assert!(!inf.is_sign_negative());
         assert!(!inf.is_nan());
         assert!(!inf.is_normal());
         assert_eq!(Fp::Infinite, inf.classify());
@@ -1786,8 +1528,8 @@ fn test_neg_infinity() {
         let neg_inf: f32 = Float::neg_infinity();
         assert!(neg_inf.is_infinite());
         assert!(!neg_inf.is_finite());
-        assert!(!neg_inf.is_positive());
-        assert!(neg_inf.is_negative());
+        assert!(!neg_inf.is_sign_positive());
+        assert!(neg_inf.is_sign_negative());
         assert!(!neg_inf.is_nan());
         assert!(!neg_inf.is_normal());
         assert_eq!(Fp::Infinite, neg_inf.classify());
@@ -1799,8 +1541,8 @@ fn test_zero() {
         assert_eq!(0.0, zero);
         assert!(!zero.is_infinite());
         assert!(zero.is_finite());
-        assert!(zero.is_positive());
-        assert!(!zero.is_negative());
+        assert!(zero.is_sign_positive());
+        assert!(!zero.is_sign_negative());
         assert!(!zero.is_nan());
         assert!(!zero.is_normal());
         assert_eq!(Fp::Zero, zero.classify());
@@ -1812,8 +1554,8 @@ fn test_neg_zero() {
         assert_eq!(0.0, neg_zero);
         assert!(!neg_zero.is_infinite());
         assert!(neg_zero.is_finite());
-        assert!(!neg_zero.is_positive());
-        assert!(neg_zero.is_negative());
+        assert!(!neg_zero.is_sign_positive());
+        assert!(neg_zero.is_sign_negative());
         assert!(!neg_zero.is_nan());
         assert!(!neg_zero.is_normal());
         assert_eq!(Fp::Zero, neg_zero.classify());
@@ -1825,8 +1567,8 @@ fn test_one() {
         assert_eq!(1.0, one);
         assert!(!one.is_infinite());
         assert!(one.is_finite());
-        assert!(one.is_positive());
-        assert!(!one.is_negative());
+        assert!(one.is_sign_positive());
+        assert!(!one.is_sign_negative());
         assert!(!one.is_nan());
         assert!(one.is_normal());
         assert_eq!(Fp::Normal, one.classify());
@@ -2012,27 +1754,27 @@ fn test_signum() {
     }
 
     #[test]
-    fn test_is_positive() {
-        assert!(INFINITY.is_positive());
-        assert!(1f32.is_positive());
-        assert!(0f32.is_positive());
-        assert!(!(-0f32).is_positive());
-        assert!(!(-1f32).is_positive());
-        assert!(!NEG_INFINITY.is_positive());
-        assert!(!(1f32/NEG_INFINITY).is_positive());
-        assert!(!NAN.is_positive());
+    fn test_is_sign_positive() {
+        assert!(INFINITY.is_sign_positive());
+        assert!(1f32.is_sign_positive());
+        assert!(0f32.is_sign_positive());
+        assert!(!(-0f32).is_sign_positive());
+        assert!(!(-1f32).is_sign_positive());
+        assert!(!NEG_INFINITY.is_sign_positive());
+        assert!(!(1f32/NEG_INFINITY).is_sign_positive());
+        assert!(!NAN.is_sign_positive());
     }
 
     #[test]
-    fn test_is_negative() {
-        assert!(!INFINITY.is_negative());
-        assert!(!1f32.is_negative());
-        assert!(!0f32.is_negative());
-        assert!((-0f32).is_negative());
-        assert!((-1f32).is_negative());
-        assert!(NEG_INFINITY.is_negative());
-        assert!((1f32/NEG_INFINITY).is_negative());
-        assert!(!NAN.is_negative());
+    fn test_is_sign_negative() {
+        assert!(!INFINITY.is_sign_negative());
+        assert!(!1f32.is_sign_negative());
+        assert!(!0f32.is_sign_negative());
+        assert!((-0f32).is_sign_negative());
+        assert!((-1f32).is_sign_negative());
+        assert!(NEG_INFINITY.is_sign_negative());
+        assert!((1f32/NEG_INFINITY).is_sign_negative());
+        assert!(!NAN.is_sign_negative());
     }
 
     #[test]
index 9306804d1f787aa34f8345fd5595ffa4da96bf7f..794853f6f709863f4237391e0bd6f22211ec2212 100644 (file)
@@ -83,6 +83,7 @@ mod cmath {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 impl Float for f64 {
     // inlined methods from `num::Float`
     #[inline]
@@ -101,27 +102,27 @@ fn one() -> f64 { num::Float::one() }
 
     #[allow(deprecated)]
     #[inline]
-    fn mantissa_digits(unused_self: Option<f64>) -> uint {
+    fn mantissa_digits(unused_self: Option<f64>) -> usize {
         num::Float::mantissa_digits(unused_self)
     }
     #[allow(deprecated)]
     #[inline]
-    fn digits(unused_self: Option<f64>) -> uint { num::Float::digits(unused_self) }
+    fn digits(unused_self: Option<f64>) -> usize { num::Float::digits(unused_self) }
     #[allow(deprecated)]
     #[inline]
     fn epsilon() -> f64 { num::Float::epsilon() }
     #[allow(deprecated)]
     #[inline]
-    fn min_exp(unused_self: Option<f64>) -> int { num::Float::min_exp(unused_self) }
+    fn min_exp(unused_self: Option<f64>) -> isize { num::Float::min_exp(unused_self) }
     #[allow(deprecated)]
     #[inline]
-    fn max_exp(unused_self: Option<f64>) -> int { num::Float::max_exp(unused_self) }
+    fn max_exp(unused_self: Option<f64>) -> isize { num::Float::max_exp(unused_self) }
     #[allow(deprecated)]
     #[inline]
-    fn min_10_exp(unused_self: Option<f64>) -> int { num::Float::min_10_exp(unused_self) }
+    fn min_10_exp(unused_self: Option<f64>) -> isize { num::Float::min_10_exp(unused_self) }
     #[allow(deprecated)]
     #[inline]
-    fn max_10_exp(unused_self: Option<f64>) -> int { num::Float::max_10_exp(unused_self) }
+    fn max_10_exp(unused_self: Option<f64>) -> isize { num::Float::max_10_exp(unused_self) }
     #[allow(deprecated)]
     #[inline]
     fn min_value() -> f64 { num::Float::min_value() }
@@ -210,11 +211,11 @@ fn ldexp(self, exp: isize) -> f64 {
     /// - `self = x * pow(2, exp)`
     /// - `0.5 <= abs(x) < 1.0`
     #[inline]
-    fn frexp(self) -> (f64, int) {
+    fn frexp(self) -> (f64, isize) {
         unsafe {
             let mut exp = 0;
             let x = cmath::frexp(self, &mut exp);
-            (x, exp as int)
+            (x, exp as isize)
         }
     }
 
@@ -370,227 +371,18 @@ fn atanh(self) -> f64 {
 #[lang = "f64"]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl f64 {
-    // inlined methods from `num::Float`
-    /// Returns the `NaN` value.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let nan: f32 = Float::nan();
-    ///
-    /// assert!(nan.is_nan());
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    pub fn nan() -> f64 { num::Float::nan() }
-
-    /// Returns the infinite value.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    /// use std::f32;
-    ///
-    /// let infinity: f32 = Float::infinity();
-    ///
-    /// assert!(infinity.is_infinite());
-    /// assert!(!infinity.is_finite());
-    /// assert!(infinity > f32::MAX);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    pub fn infinity() -> f64 { num::Float::infinity() }
-
-    /// Returns the negative infinite value.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    /// use std::f32;
-    ///
-    /// let neg_infinity: f32 = Float::neg_infinity();
-    ///
-    /// assert!(neg_infinity.is_infinite());
-    /// assert!(!neg_infinity.is_finite());
-    /// assert!(neg_infinity < f32::MIN);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    pub fn neg_infinity() -> f64 { num::Float::neg_infinity() }
-
-    /// Returns `0.0`.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let inf: f32 = Float::infinity();
-    /// let zero: f32 = Float::zero();
-    /// let neg_zero: f32 = Float::neg_zero();
-    ///
-    /// assert_eq!(zero, neg_zero);
-    /// assert_eq!(7.0f32/inf, zero);
-    /// assert_eq!(zero * 10.0, zero);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    pub fn zero() -> f64 { num::Float::zero() }
-
-    /// Returns `-0.0`.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let inf: f32 = Float::infinity();
-    /// let zero: f32 = Float::zero();
-    /// let neg_zero: f32 = Float::neg_zero();
-    ///
-    /// assert_eq!(zero, neg_zero);
-    /// assert_eq!(7.0f32/inf, zero);
-    /// assert_eq!(zero * 10.0, zero);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    pub fn neg_zero() -> f64 { num::Float::neg_zero() }
-
-    /// Returns `1.0`.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let one: f32 = Float::one();
-    ///
-    /// assert_eq!(one, 1.0f32);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    pub fn one() -> f64 { num::Float::one() }
-
-    // FIXME (#5527): These should be associated constants
-
-    /// Deprecated: use `std::f32::MANTISSA_DIGITS` or `std::f64::MANTISSA_DIGITS`
-    /// instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MANTISSA_DIGITS` or \
-                           `std::f64::MANTISSA_DIGITS` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn mantissa_digits(unused_self: Option<f64>) -> uint {
-        num::Float::mantissa_digits(unused_self)
-    }
-
-    /// Deprecated: use `std::f32::DIGITS` or `std::f64::DIGITS` instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::DIGITS` or `std::f64::DIGITS` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn digits(unused_self: Option<f64>) -> uint { num::Float::digits(unused_self) }
-
-    /// Deprecated: use `std::f32::EPSILON` or `std::f64::EPSILON` instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::EPSILON` or `std::f64::EPSILON` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn epsilon() -> f64 { num::Float::epsilon() }
-
-    /// Deprecated: use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn min_exp(unused_self: Option<f64>) -> int { num::Float::min_exp(unused_self) }
-
-    /// Deprecated: use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn max_exp(unused_self: Option<f64>) -> int { num::Float::max_exp(unused_self) }
-
-    /// Deprecated: use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn min_10_exp(unused_self: Option<f64>) -> int { num::Float::min_10_exp(unused_self) }
-
-    /// Deprecated: use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` instead.
-    #[unstable(feature = "std_misc")]
-    #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate")]
-    #[allow(deprecated)]
-    #[inline]
-    pub fn max_10_exp(unused_self: Option<f64>) -> int { num::Float::max_10_exp(unused_self) }
-
-    /// Returns the smallest finite value that this type can represent.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    /// use std::f64;
-    ///
-    /// let x: f64 = Float::min_value();
-    ///
-    /// assert_eq!(x, f64::MIN);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    #[allow(deprecated)]
-    pub fn min_value() -> f64 { num::Float::min_value() }
-
-    /// Returns the smallest normalized positive number that this type can represent.
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    #[allow(deprecated)]
-    pub fn min_pos_value(unused_self: Option<f64>) -> f64 { num::Float::min_pos_value(unused_self) }
-
-    /// Returns the largest finite value that this type can represent.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    /// use std::f64;
-    ///
-    /// let x: f64 = Float::max_value();
-    /// assert_eq!(x, f64::MAX);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[inline]
-    #[allow(deprecated)]
-    pub fn max_value() -> f64 { num::Float::max_value() }
-
     /// Returns `true` if this value is `NaN` and false otherwise.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let nan = f64::NAN;
-    /// let f = 7.0;
+    /// let f = 7.0_f64;
     ///
     /// assert!(nan.is_nan());
     /// assert!(!f.is_nan());
     /// ```
-    #[unstable(feature = "std_misc", reason = "position is undecided")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn is_nan(self) -> bool { num::Float::is_nan(self) }
 
@@ -598,14 +390,12 @@ pub fn is_nan(self) -> bool { num::Float::is_nan(self) }
     /// false otherwise.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    /// use std::f32;
+    /// use std::f64;
     ///
-    /// let f = 7.0f32;
-    /// let inf: f32 = Float::infinity();
-    /// let neg_inf: f32 = Float::neg_infinity();
-    /// let nan: f32 = f32::NAN;
+    /// let f = 7.0f64;
+    /// let inf = f64::INFINITY;
+    /// let neg_inf = f64::NEG_INFINITY;
+    /// let nan = f64::NAN;
     ///
     /// assert!(!f.is_infinite());
     /// assert!(!nan.is_infinite());
@@ -613,21 +403,19 @@ pub fn is_nan(self) -> bool { num::Float::is_nan(self) }
     /// assert!(inf.is_infinite());
     /// assert!(neg_inf.is_infinite());
     /// ```
-    #[unstable(feature = "std_misc", reason = "position is undecided")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn is_infinite(self) -> bool { num::Float::is_infinite(self) }
 
     /// Returns `true` if this number is neither infinite nor `NaN`.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    /// use std::f32;
+    /// use std::f64;
     ///
-    /// let f = 7.0f32;
-    /// let inf: f32 = Float::infinity();
-    /// let neg_inf: f32 = Float::neg_infinity();
-    /// let nan: f32 = f32::NAN;
+    /// let f = 7.0f64;
+    /// let inf: f64 = f64::INFINITY;
+    /// let neg_inf: f64 = f64::NEG_INFINITY;
+    /// let nan: f64 = f64::NAN;
     ///
     /// assert!(f.is_finite());
     ///
@@ -635,7 +423,7 @@ pub fn is_infinite(self) -> bool { num::Float::is_infinite(self) }
     /// assert!(!inf.is_finite());
     /// assert!(!neg_inf.is_finite());
     /// ```
-    #[unstable(feature = "std_misc", reason = "position is undecided")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn is_finite(self) -> bool { num::Float::is_finite(self) }
 
@@ -643,11 +431,9 @@ pub fn is_finite(self) -> bool { num::Float::is_finite(self) }
     /// [subnormal][subnormal], or `NaN`.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
     /// use std::f32;
     ///
-    /// let min = f32::MIN_POSITIVE; // 1.17549435e-38f32
+    /// let min = f32::MIN_POSITIVE; // 1.17549435e-38f64
     /// let max = f32::MAX;
     /// let lower_than_min = 1.0e-40_f32;
     /// let zero = 0.0f32;
@@ -662,7 +448,7 @@ pub fn is_finite(self) -> bool { num::Float::is_finite(self) }
     /// assert!(!lower_than_min.is_normal());
     /// ```
     /// [subnormal]: http://en.wikipedia.org/wiki/Denormal_number
-    #[unstable(feature = "std_misc", reason = "position is undecided")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn is_normal(self) -> bool { num::Float::is_normal(self) }
 
@@ -671,12 +457,11 @@ pub fn is_normal(self) -> bool { num::Float::is_normal(self) }
     /// predicate instead.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::{Float, FpCategory};
-    /// use std::f32;
+    /// use std::num::FpCategory;
+    /// use std::f64;
     ///
-    /// let num = 12.4f32;
-    /// let inf = f32::INFINITY;
+    /// let num = 12.4_f64;
+    /// let inf = f64::INFINITY;
     ///
     /// assert_eq!(num.classify(), FpCategory::Normal);
     /// assert_eq!(inf.classify(), FpCategory::Infinite);
@@ -691,15 +476,13 @@ pub fn classify(self) -> FpCategory { num::Float::classify(self) }
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let num = 2.0f32;
+    /// let num = 2.0f64;
     ///
     /// // (8388608, -22, 1)
     /// let (mantissa, exponent, sign) = num.integer_decode();
-    /// let sign_f = sign as f32;
-    /// let mantissa_f = mantissa as f32;
-    /// let exponent_f = num.powf(exponent as f32);
+    /// let sign_f = sign as f64;
+    /// let mantissa_f = mantissa as f64;
+    /// let exponent_f = num.powf(exponent as f64);
     ///
     /// // 1 * 8388608 * 2^(-22) == 2
     /// let abs_difference = (sign_f * mantissa_f * exponent_f - num).abs();
@@ -714,10 +497,8 @@ pub fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self)
     /// Returns the largest integer less than or equal to a number.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let f = 3.99;
-    /// let g = 3.0;
+    /// let f = 3.99_f64;
+    /// let g = 3.0_f64;
     ///
     /// assert_eq!(f.floor(), 3.0);
     /// assert_eq!(g.floor(), 3.0);
@@ -729,10 +510,8 @@ pub fn floor(self) -> f64 { num::Float::floor(self) }
     /// Returns the smallest integer greater than or equal to a number.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let f = 3.01;
-    /// let g = 4.0;
+    /// let f = 3.01_f64;
+    /// let g = 4.0_f64;
     ///
     /// assert_eq!(f.ceil(), 4.0);
     /// assert_eq!(g.ceil(), 4.0);
@@ -745,10 +524,8 @@ pub fn ceil(self) -> f64 { num::Float::ceil(self) }
     /// `0.0`.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let f = 3.3;
-    /// let g = -3.3;
+    /// let f = 3.3_f64;
+    /// let g = -3.3_f64;
     ///
     /// assert_eq!(f.round(), 3.0);
     /// assert_eq!(g.round(), -3.0);
@@ -760,10 +537,8 @@ pub fn round(self) -> f64 { num::Float::round(self) }
     /// Return the integer part of a number.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let f = 3.3;
-    /// let g = -3.7;
+    /// let f = 3.3_f64;
+    /// let g = -3.7_f64;
     ///
     /// assert_eq!(f.trunc(), 3.0);
     /// assert_eq!(g.trunc(), -3.0);
@@ -775,10 +550,8 @@ pub fn trunc(self) -> f64 { num::Float::trunc(self) }
     /// Returns the fractional part of a number.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let x = 3.5;
-    /// let y = -3.5;
+    /// let x = 3.5_f64;
+    /// let y = -3.5_f64;
     /// let abs_difference_x = (x.fract() - 0.5).abs();
     /// let abs_difference_y = (y.fract() - (-0.5)).abs();
     ///
@@ -789,16 +562,14 @@ pub fn trunc(self) -> f64 { num::Float::trunc(self) }
     #[inline]
     pub fn fract(self) -> f64 { num::Float::fract(self) }
 
-    /// Computes the absolute value of `self`. Returns `Float::nan()` if the
-    /// number is `Float::nan()`.
+    /// Computes the absolute value of `self`. Returns `NAN` if the
+    /// number is `NAN`.
     ///
     /// ```
-    /// # #![feature(core, std_misc)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
-    /// let x = 3.5;
-    /// let y = -3.5;
+    /// let x = 3.5_f64;
+    /// let y = -3.5_f64;
     ///
     /// let abs_difference_x = (x.abs() - x).abs();
     /// let abs_difference_y = (y.abs() - (-y)).abs();
@@ -814,16 +585,14 @@ pub fn abs(self) -> f64 { num::Float::abs(self) }
 
     /// Returns a number that represents the sign of `self`.
     ///
-    /// - `1.0` if the number is positive, `+0.0` or `Float::infinity()`
-    /// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()`
-    /// - `Float::nan()` if the number is `Float::nan()`
+    /// - `1.0` if the number is positive, `+0.0` or `INFINITY`
+    /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
+    /// - `NAN` if the number is `NAN`
     ///
     /// ```
-    /// # #![feature(core, std_misc)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
-    /// let f = 3.5;
+    /// let f = 3.5_f64;
     ///
     /// assert_eq!(f.signum(), 1.0);
     /// assert_eq!(f64::NEG_INFINITY.signum(), -1.0);
@@ -834,46 +603,54 @@ pub fn abs(self) -> f64 { num::Float::abs(self) }
     #[inline]
     pub fn signum(self) -> f64 { num::Float::signum(self) }
 
-    /// Returns `true` if `self` is positive, including `+0.0` and
-    /// `Float::infinity()`.
+    /// Returns `true` if `self`'s sign bit is positive, including
+    /// `+0.0` and `INFINITY`.
     ///
     /// ```
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let nan: f64 = f64::NAN;
     ///
-    /// let f = 7.0;
-    /// let g = -7.0;
+    /// let f = 7.0_f64;
+    /// let g = -7.0_f64;
     ///
-    /// assert!(f.is_positive());
-    /// assert!(!g.is_positive());
+    /// assert!(f.is_sign_positive());
+    /// assert!(!g.is_sign_positive());
     /// // Requires both tests to determine if is `NaN`
-    /// assert!(!nan.is_positive() && !nan.is_negative());
+    /// assert!(!nan.is_sign_positive() && !nan.is_sign_negative());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
+    pub fn is_sign_positive(self) -> bool { num::Float::is_positive(self) }
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[deprecated(since = "1.0.0", reason = "renamed to is_sign_positive")]
+    #[inline]
     pub fn is_positive(self) -> bool { num::Float::is_positive(self) }
 
-    /// Returns `true` if `self` is negative, including `-0.0` and
-    /// `Float::neg_infinity()`.
+    /// Returns `true` if `self`'s sign is negative, including `-0.0`
+    /// and `NEG_INFINITY`.
     ///
     /// ```
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let nan = f64::NAN;
     ///
-    /// let f = 7.0;
-    /// let g = -7.0;
+    /// let f = 7.0_f64;
+    /// let g = -7.0_f64;
     ///
-    /// assert!(!f.is_negative());
-    /// assert!(g.is_negative());
+    /// assert!(!f.is_sign_negative());
+    /// assert!(g.is_sign_negative());
     /// // Requires both tests to determine if is `NaN`.
-    /// assert!(!nan.is_positive() && !nan.is_negative());
+    /// assert!(!nan.is_sign_positive() && !nan.is_sign_negative());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
+    pub fn is_sign_negative(self) -> bool { num::Float::is_negative(self) }
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[deprecated(since = "1.0.0", reason = "renamed to is_sign_negative")]
+    #[inline]
     pub fn is_negative(self) -> bool { num::Float::is_negative(self) }
 
     /// Fused multiply-add. Computes `(self * a) + b` with only one rounding
@@ -881,36 +658,28 @@ pub fn is_negative(self) -> bool { num::Float::is_negative(self) }
     /// a separate multiplication operation followed by an add.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let m = 10.0;
-    /// let x = 4.0;
-    /// let b = 60.0;
+    /// let m = 10.0_f64;
+    /// let x = 4.0_f64;
+    /// let b = 60.0_f64;
     ///
     /// // 100.0
     /// let abs_difference = (m.mul_add(x, b) - (m*x + b)).abs();
     ///
     /// assert!(abs_difference < 1e-10);
     /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn mul_add(self, a: f64, b: f64) -> f64 { num::Float::mul_add(self, a, b) }
 
     /// Take the reciprocal (inverse) of a number, `1/x`.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let x = 2.0;
+    /// let x = 2.0_f64;
     /// let abs_difference = (x.recip() - (1.0/x)).abs();
     ///
     /// assert!(abs_difference < 1e-10);
     /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn recip(self) -> f64 { num::Float::recip(self) }
 
@@ -919,9 +688,7 @@ pub fn recip(self) -> f64 { num::Float::recip(self) }
     /// Using this function is generally faster than using `powf`
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let x = 2.0;
+    /// let x = 2.0_f64;
     /// let abs_difference = (x.powi(2) - x*x).abs();
     ///
     /// assert!(abs_difference < 1e-10);
@@ -933,9 +700,7 @@ pub fn powi(self, n: i32) -> f64 { num::Float::powi(self, n) }
     /// Raise a number to a floating point power.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let x = 2.0;
+    /// let x = 2.0_f64;
     /// let abs_difference = (x.powf(2.0) - x*x).abs();
     ///
     /// assert!(abs_difference < 1e-10);
@@ -949,11 +714,8 @@ pub fn powf(self, n: f64) -> f64 { num::Float::powf(self, n) }
     /// Returns NaN if `self` is a negative number.
     ///
     /// ```
-    /// # #![feature(core, std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let positive = 4.0;
-    /// let negative = -4.0;
+    /// let positive = 4.0_f64;
+    /// let negative = -4.0_f64;
     ///
     /// let abs_difference = (positive.sqrt() - 2.0).abs();
     ///
@@ -968,9 +730,7 @@ pub fn sqrt(self) -> f64 { num::Float::sqrt(self) }
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let f = 4.0;
+    /// let f = 4.0_f64;
     ///
     /// let abs_difference = (f.rsqrt() - 0.5).abs();
     ///
@@ -978,15 +738,14 @@ pub fn sqrt(self) -> f64 { num::Float::sqrt(self) }
     /// ```
     #[unstable(feature = "std_misc",
                reason = "unsure about its place in the world")]
+    #[deprecated(since = "1.0.0", reason = "use self.sqrt().recip() instead")]
     #[inline]
     pub fn rsqrt(self) -> f64 { num::Float::rsqrt(self) }
 
     /// Returns `e^(self)`, (the exponential function).
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let one = 1.0;
+    /// let one = 1.0_f64;
     /// // e^1
     /// let e = one.exp();
     ///
@@ -1002,9 +761,7 @@ pub fn exp(self) -> f64 { num::Float::exp(self) }
     /// Returns `2^(self)`.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let f = 2.0;
+    /// let f = 2.0_f64;
     ///
     /// // 2^2 - 4 == 0
     /// let abs_difference = (f.exp2() - 4.0).abs();
@@ -1018,9 +775,7 @@ pub fn exp2(self) -> f64 { num::Float::exp2(self) }
     /// Returns the natural logarithm of the number.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let one = 1.0;
+    /// let one = 1.0_f64;
     /// // e^1
     /// let e = one.exp();
     ///
@@ -1036,10 +791,8 @@ pub fn ln(self) -> f64 { num::Float::ln(self) }
     /// Returns the logarithm of the number with respect to an arbitrary base.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let ten = 10.0;
-    /// let two = 2.0;
+    /// let ten = 10.0_f64;
+    /// let two = 2.0_f64;
     ///
     /// // log10(10) - 1 == 0
     /// let abs_difference_10 = (ten.log(10.0) - 1.0).abs();
@@ -1057,9 +810,7 @@ pub fn log(self, base: f64) -> f64 { num::Float::log(self, base) }
     /// Returns the base 2 logarithm of the number.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let two = 2.0;
+    /// let two = 2.0_f64;
     ///
     /// // log2(2) - 1 == 0
     /// let abs_difference = (two.log2() - 1.0).abs();
@@ -1073,9 +824,7 @@ pub fn log2(self) -> f64 { num::Float::log2(self) }
     /// Returns the base 10 logarithm of the number.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let ten = 10.0;
+    /// let ten = 10.0_f64;
     ///
     /// // log10(10) - 1 == 0
     /// let abs_difference = (ten.log10() - 1.0).abs();
@@ -1089,8 +838,6 @@ pub fn log10(self) -> f64 { num::Float::log10(self) }
     /// Convert radians to degrees.
     ///
     /// ```
-    /// # #![feature(std_misc, core)]
-    /// use std::num::Float;
     /// use std::f64::consts;
     ///
     /// let angle = consts::PI;
@@ -1099,24 +846,22 @@ pub fn log10(self) -> f64 { num::Float::log10(self) }
     ///
     /// assert!(abs_difference < 1e-10);
     /// ```
-    #[unstable(feature = "std_misc", reason = "desirability is unclear")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn to_degrees(self) -> f64 { num::Float::to_degrees(self) }
 
     /// Convert degrees to radians.
     ///
     /// ```
-    /// # #![feature(std_misc, core)]
-    /// use std::num::Float;
     /// use std::f64::consts;
     ///
-    /// let angle = 180.0;
+    /// let angle = 180.0_f64;
     ///
     /// let abs_difference = (angle.to_radians() - consts::PI).abs();
     ///
     /// assert!(abs_difference < 1e-10);
     /// ```
-    #[unstable(feature = "std_misc", reason = "desirability is unclear")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn to_radians(self) -> f64 { num::Float::to_radians(self) }
 
@@ -1124,17 +869,15 @@ pub fn to_radians(self) -> f64 { num::Float::to_radians(self) }
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
     /// // 3*2^2 - 12 == 0
-    /// let abs_difference = (Float::ldexp(3.0, 2) - 12.0).abs();
+    /// let abs_difference = (f64::ldexp(3.0, 2) - 12.0).abs();
     ///
     /// assert!(abs_difference < 1e-10);
     /// ```
     #[unstable(feature = "std_misc",
                reason = "pending integer conventions")]
     #[inline]
-    pub fn ldexp(x: f64, exp: int) -> f64 {
+    pub fn ldexp(x: f64, exp: isize) -> f64 {
         unsafe { cmath::ldexp(x, exp as c_int) }
     }
 
@@ -1146,9 +889,7 @@ pub fn ldexp(x: f64, exp: int) -> f64 {
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let x = 4.0;
+    /// let x = 4.0_f64;
     ///
     /// // (1/2)*2^3 -> 1 * 8/2 -> 4.0
     /// let f = x.frexp();
@@ -1161,11 +902,11 @@ pub fn ldexp(x: f64, exp: int) -> f64 {
     #[unstable(feature = "std_misc",
                reason = "pending integer conventions")]
     #[inline]
-    pub fn frexp(self) -> (f64, int) {
+    pub fn frexp(self) -> (f64, isize) {
         unsafe {
             let mut exp = 0;
             let x = cmath::frexp(self, &mut exp);
-            (x, exp as int)
+            (x, exp as isize)
         }
     }
 
@@ -1174,7 +915,6 @@ pub fn frexp(self) -> (f64, int) {
     ///
     /// ```
     /// # #![feature(std_misc)]
-    /// use std::num::Float;
     ///
     /// let x = 1.0f32;
     ///
@@ -1192,10 +932,8 @@ pub fn next_after(self, other: f64) -> f64 {
     /// Returns the maximum of the two numbers.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let x = 1.0;
-    /// let y = 2.0;
+    /// let x = 1.0_f64;
+    /// let y = 2.0_f64;
     ///
     /// assert_eq!(x.max(y), y);
     /// ```
@@ -1208,10 +946,8 @@ pub fn max(self, other: f64) -> f64 {
     /// Returns the minimum of the two numbers.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let x = 1.0;
-    /// let y = 2.0;
+    /// let x = 1.0_f64;
+    /// let y = 2.0_f64;
     ///
     /// assert_eq!(x.min(y), x);
     /// ```
@@ -1227,11 +963,8 @@ pub fn min(self, other: f64) -> f64 {
     /// * Else: `self - other`
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let x = 3.0;
-    /// let y = -3.0;
+    /// let x = 3.0_f64;
+    /// let y = -3.0_f64;
     ///
     /// let abs_difference_x = (x.abs_sub(1.0) - 2.0).abs();
     /// let abs_difference_y = (y.abs_sub(1.0) - 0.0).abs();
@@ -1239,7 +972,7 @@ pub fn min(self, other: f64) -> f64 {
     /// assert!(abs_difference_x < 1e-10);
     /// assert!(abs_difference_y < 1e-10);
     /// ```
-    #[unstable(feature = "std_misc", reason = "may be renamed")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn abs_sub(self, other: f64) -> f64 {
         unsafe { cmath::fdim(self, other) }
@@ -1248,17 +981,14 @@ pub fn abs_sub(self, other: f64) -> f64 {
     /// Take the cubic root of a number.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let x = 8.0;
+    /// let x = 8.0_f64;
     ///
     /// // x^(1/3) - 2 == 0
     /// let abs_difference = (x.cbrt() - 2.0).abs();
     ///
     /// assert!(abs_difference < 1e-10);
     /// ```
-    #[unstable(feature = "std_misc", reason = "may be renamed")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn cbrt(self) -> f64 {
         unsafe { cmath::cbrt(self) }
@@ -1268,19 +998,15 @@ pub fn cbrt(self) -> f64 {
     /// legs of length `x` and `y`.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let x = 2.0;
-    /// let y = 3.0;
+    /// let x = 2.0_f64;
+    /// let y = 3.0_f64;
     ///
     /// // sqrt(x^2 + y^2)
     /// let abs_difference = (x.hypot(y) - (x.powi(2) + y.powi(2)).sqrt()).abs();
     ///
     /// assert!(abs_difference < 1e-10);
     /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn hypot(self, other: f64) -> f64 {
         unsafe { cmath::hypot(self, other) }
@@ -1289,8 +1015,6 @@ pub fn hypot(self, other: f64) -> f64 {
     /// Computes the sine of a number (in radians).
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let x = f64::consts::PI/2.0;
@@ -1308,8 +1032,6 @@ pub fn sin(self) -> f64 {
     /// Computes the cosine of a number (in radians).
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let x = 2.0*f64::consts::PI;
@@ -1327,8 +1049,6 @@ pub fn cos(self) -> f64 {
     /// Computes the tangent of a number (in radians).
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let x = f64::consts::PI/4.0;
@@ -1347,8 +1067,6 @@ pub fn tan(self) -> f64 {
     /// [-1, 1].
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let f = f64::consts::PI / 2.0;
@@ -1369,8 +1087,6 @@ pub fn asin(self) -> f64 {
     /// [-1, 1].
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let f = f64::consts::PI / 4.0;
@@ -1390,9 +1106,7 @@ pub fn acos(self) -> f64 {
     /// range [-pi/2, pi/2];
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let f = 1.0;
+    /// let f = 1.0_f64;
     ///
     /// // atan(tan(1))
     /// let abs_difference = (f.tan().atan() - 1.0).abs();
@@ -1413,19 +1127,17 @@ pub fn atan(self) -> f64 {
     /// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)`
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let pi = f64::consts::PI;
     /// // All angles from horizontal right (+x)
     /// // 45 deg counter-clockwise
-    /// let x1 = 3.0;
-    /// let y1 = -3.0;
+    /// let x1 = 3.0_f64;
+    /// let y1 = -3.0_f64;
     ///
     /// // 135 deg clockwise
-    /// let x2 = -3.0;
-    /// let y2 = 3.0;
+    /// let x2 = -3.0_f64;
+    /// let y2 = 3.0_f64;
     ///
     /// let abs_difference_1 = (y1.atan2(x1) - (-pi/4.0)).abs();
     /// let abs_difference_2 = (y2.atan2(x2) - 3.0*pi/4.0).abs();
@@ -1443,8 +1155,6 @@ pub fn atan2(self, other: f64) -> f64 {
     /// `(sin(x), cos(x))`.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let x = f64::consts::PI/4.0;
@@ -1466,17 +1176,14 @@ pub fn sin_cos(self) -> (f64, f64) {
     /// number is close to zero.
     ///
     /// ```
-    /// # #![feature(std_misc)]
-    /// use std::num::Float;
-    ///
-    /// let x = 7.0;
+    /// let x = 7.0_f64;
     ///
     /// // e^(ln(7)) - 1
     /// let abs_difference = (x.ln().exp_m1() - 6.0).abs();
     ///
     /// assert!(abs_difference < 1e-10);
     /// ```
-    #[unstable(feature = "std_misc", reason = "may be renamed")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn exp_m1(self) -> f64 {
         unsafe { cmath::expm1(self) }
@@ -1486,8 +1193,6 @@ pub fn exp_m1(self) -> f64 {
     /// the operations were performed separately.
     ///
     /// ```
-    /// # #![feature(std_misc, core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let x = f64::consts::E - 1.0;
@@ -1497,7 +1202,7 @@ pub fn exp_m1(self) -> f64 {
     ///
     /// assert!(abs_difference < 1e-10);
     /// ```
-    #[unstable(feature = "std_misc", reason = "may be renamed")]
+    #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn ln_1p(self) -> f64 {
         unsafe { cmath::log1p(self) }
@@ -1506,12 +1211,10 @@ pub fn ln_1p(self) -> f64 {
     /// Hyperbolic sine function.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let e = f64::consts::E;
-    /// let x = 1.0;
+    /// let x = 1.0_f64;
     ///
     /// let f = x.sinh();
     /// // Solving sinh() at 1 gives `(e^2-1)/(2e)`
@@ -1529,12 +1232,10 @@ pub fn sinh(self) -> f64 {
     /// Hyperbolic cosine function.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let e = f64::consts::E;
-    /// let x = 1.0;
+    /// let x = 1.0_f64;
     /// let f = x.cosh();
     /// // Solving cosh() at 1 gives this result
     /// let g = (e*e + 1.0)/(2.0*e);
@@ -1552,12 +1253,10 @@ pub fn cosh(self) -> f64 {
     /// Hyperbolic tangent function.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let e = f64::consts::E;
-    /// let x = 1.0;
+    /// let x = 1.0_f64;
     ///
     /// let f = x.tanh();
     /// // Solving tanh() at 1 gives `(1 - e^(-2))/(1 + e^(-2))`
@@ -1575,9 +1274,7 @@ pub fn tanh(self) -> f64 {
     /// Inverse hyperbolic sine function.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let x = 1.0;
+    /// let x = 1.0_f64;
     /// let f = x.sinh().asinh();
     ///
     /// let abs_difference = (f - x).abs();
@@ -1596,9 +1293,7 @@ pub fn asinh(self) -> f64 {
     /// Inverse hyperbolic cosine function.
     ///
     /// ```
-    /// use std::num::Float;
-    ///
-    /// let x = 1.0;
+    /// let x = 1.0_f64;
     /// let f = x.cosh().acosh();
     ///
     /// let abs_difference = (f - x).abs();
@@ -1617,8 +1312,6 @@ pub fn acosh(self) -> f64 {
     /// Inverse hyperbolic tangent function.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
     /// use std::f64;
     ///
     /// let e = f64::consts::E;
@@ -1646,6 +1339,7 @@ pub fn atanh(self) -> f64 {
 /// * num - The float value
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
+#[deprecated(since = "1.0.0", reason = "use the ToString trait instead")]
 pub fn to_string(num: f64) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 10, true, SignNeg, DigAll, ExpNone, false);
@@ -1659,6 +1353,7 @@ pub fn to_string(num: f64) -> String {
 /// * num - The float value
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
+#[deprecated(since = "1.0.0", reason = "use format! instead")]
 pub fn to_str_hex(num: f64) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 16, true, SignNeg, DigAll, ExpNone, false);
@@ -1674,6 +1369,7 @@ pub fn to_str_hex(num: f64) -> String {
 /// * radix - The base to use
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
+#[deprecated(since = "1.0.0", reason = "use format! instead")]
 pub fn to_str_radix_special(num: f64, rdx: u32) -> (String, bool) {
     strconv::float_to_str_common(num, rdx, true, SignNeg, DigAll, ExpNone, false)
 }
@@ -1687,7 +1383,7 @@ pub fn to_str_radix_special(num: f64, rdx: u32) -> (String, bool) {
 /// * digits - The number of significant digits
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
-pub fn to_str_exact(num: f64, dig: uint) -> String {
+pub fn to_str_exact(num: f64, dig: usize) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 10, true, SignNeg, DigExact(dig), ExpNone, false);
     r
@@ -1702,7 +1398,7 @@ pub fn to_str_exact(num: f64, dig: uint) -> String {
 /// * digits - The number of significant digits
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
-pub fn to_str_digits(num: f64, dig: uint) -> String {
+pub fn to_str_digits(num: f64, dig: usize) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 10, true, SignNeg, DigMax(dig), ExpNone, false);
     r
@@ -1718,7 +1414,7 @@ pub fn to_str_digits(num: f64, dig: uint) -> String {
 /// * upper - Use `E` instead of `e` for the exponent sign
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
-pub fn to_str_exp_exact(num: f64, dig: uint, upper: bool) -> String {
+pub fn to_str_exp_exact(num: f64, dig: usize, upper: bool) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 10, true, SignNeg, DigExact(dig), ExpDec, upper);
     r
@@ -1734,7 +1430,7 @@ pub fn to_str_exp_exact(num: f64, dig: uint, upper: bool) -> String {
 /// * upper - Use `E` instead of `e` for the exponent sign
 #[inline]
 #[unstable(feature = "std_misc", reason = "may be removed or relocated")]
-pub fn to_str_exp_digits(num: f64, dig: uint, upper: bool) -> String {
+pub fn to_str_exp_digits(num: f64, dig: usize, upper: bool) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 10, true, SignNeg, DigMax(dig), ExpDec, upper);
     r
@@ -1770,8 +1466,8 @@ fn test_nan() {
         assert!(!nan.is_infinite());
         assert!(!nan.is_finite());
         assert!(!nan.is_normal());
-        assert!(!nan.is_positive());
-        assert!(!nan.is_negative());
+        assert!(!nan.is_sign_positive());
+        assert!(!nan.is_sign_negative());
         assert_eq!(Fp::Nan, nan.classify());
     }
 
@@ -1780,8 +1476,8 @@ fn test_infinity() {
         let inf: f64 = Float::infinity();
         assert!(inf.is_infinite());
         assert!(!inf.is_finite());
-        assert!(inf.is_positive());
-        assert!(!inf.is_negative());
+        assert!(inf.is_sign_positive());
+        assert!(!inf.is_sign_negative());
         assert!(!inf.is_nan());
         assert!(!inf.is_normal());
         assert_eq!(Fp::Infinite, inf.classify());
@@ -1792,8 +1488,8 @@ fn test_neg_infinity() {
         let neg_inf: f64 = Float::neg_infinity();
         assert!(neg_inf.is_infinite());
         assert!(!neg_inf.is_finite());
-        assert!(!neg_inf.is_positive());
-        assert!(neg_inf.is_negative());
+        assert!(!neg_inf.is_sign_positive());
+        assert!(neg_inf.is_sign_negative());
         assert!(!neg_inf.is_nan());
         assert!(!neg_inf.is_normal());
         assert_eq!(Fp::Infinite, neg_inf.classify());
@@ -1805,8 +1501,8 @@ fn test_zero() {
         assert_eq!(0.0, zero);
         assert!(!zero.is_infinite());
         assert!(zero.is_finite());
-        assert!(zero.is_positive());
-        assert!(!zero.is_negative());
+        assert!(zero.is_sign_positive());
+        assert!(!zero.is_sign_negative());
         assert!(!zero.is_nan());
         assert!(!zero.is_normal());
         assert_eq!(Fp::Zero, zero.classify());
@@ -1818,8 +1514,8 @@ fn test_neg_zero() {
         assert_eq!(0.0, neg_zero);
         assert!(!neg_zero.is_infinite());
         assert!(neg_zero.is_finite());
-        assert!(!neg_zero.is_positive());
-        assert!(neg_zero.is_negative());
+        assert!(!neg_zero.is_sign_positive());
+        assert!(neg_zero.is_sign_negative());
         assert!(!neg_zero.is_nan());
         assert!(!neg_zero.is_normal());
         assert_eq!(Fp::Zero, neg_zero.classify());
@@ -1831,8 +1527,8 @@ fn test_one() {
         assert_eq!(1.0, one);
         assert!(!one.is_infinite());
         assert!(one.is_finite());
-        assert!(one.is_positive());
-        assert!(!one.is_negative());
+        assert!(one.is_sign_positive());
+        assert!(!one.is_sign_negative());
         assert!(!one.is_nan());
         assert!(one.is_normal());
         assert_eq!(Fp::Normal, one.classify());
@@ -2017,27 +1713,27 @@ fn test_signum() {
     }
 
     #[test]
-    fn test_is_positive() {
-        assert!(INFINITY.is_positive());
-        assert!(1f64.is_positive());
-        assert!(0f64.is_positive());
-        assert!(!(-0f64).is_positive());
-        assert!(!(-1f64).is_positive());
-        assert!(!NEG_INFINITY.is_positive());
-        assert!(!(1f64/NEG_INFINITY).is_positive());
-        assert!(!NAN.is_positive());
+    fn test_is_sign_positive() {
+        assert!(INFINITY.is_sign_positive());
+        assert!(1f64.is_sign_positive());
+        assert!(0f64.is_sign_positive());
+        assert!(!(-0f64).is_sign_positive());
+        assert!(!(-1f64).is_sign_positive());
+        assert!(!NEG_INFINITY.is_sign_positive());
+        assert!(!(1f64/NEG_INFINITY).is_sign_positive());
+        assert!(!NAN.is_sign_positive());
     }
 
     #[test]
-    fn test_is_negative() {
-        assert!(!INFINITY.is_negative());
-        assert!(!1f64.is_negative());
-        assert!(!0f64.is_negative());
-        assert!((-0f64).is_negative());
-        assert!((-1f64).is_negative());
-        assert!(NEG_INFINITY.is_negative());
-        assert!((1f64/NEG_INFINITY).is_negative());
-        assert!(!NAN.is_negative());
+    fn test_is_sign_negative() {
+        assert!(!INFINITY.is_sign_negative());
+        assert!(!1f64.is_sign_negative());
+        assert!(!0f64.is_sign_negative());
+        assert!((-0f64).is_sign_negative());
+        assert!((-1f64).is_sign_negative());
+        assert!(NEG_INFINITY.is_sign_negative());
+        assert!((1f64/NEG_INFINITY).is_sign_negative());
+        assert!(!NAN.is_sign_negative());
     }
 
     #[test]
index b9e9433e3ee5addbd0ae3765286e817eb1bc7ba9..2de03e2e72d664c41b3bde2324c33f9659a7b00e 100644 (file)
@@ -15,6 +15,7 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![allow(missing_docs)]
+#![allow(deprecated)]
 
 #[cfg(test)] use fmt::Debug;
 use ops::{Add, Sub, Mul, Div, Rem, Neg};
 use clone::Clone;
 use cmp::{PartialOrd, PartialEq};
 
-pub use core::num::{Int, SignedInt};
+pub use core::num::{Int, SignedInt, Zero, One};
 pub use core::num::{cast, FromPrimitive, NumCast, ToPrimitive};
 pub use core::num::{from_int, from_i8, from_i16, from_i32, from_i64};
 pub use core::num::{from_uint, from_u8, from_u16, from_u32, from_u64};
 pub use core::num::{from_f32, from_f64};
 pub use core::num::{FromStrRadix, from_str_radix};
 pub use core::num::{FpCategory, ParseIntError, ParseFloatError};
-pub use core::num::wrapping;
+pub use core::num::{wrapping, Wrapping};
 
 use option::Option;
 
-#[unstable(feature = "std_misc", reason = "may be removed or relocated")]
+#[unstable(feature = "std_misc", reason = "likely to be removed")]
 pub mod strconv;
 
 /// Mathematical operations on primitive floating point numbers.
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0",
+             reason = "replaced by inherent methods; use rust-lang/num for generics")]
 pub trait Float
     : Copy + Clone
     + NumCast
@@ -272,6 +275,7 @@ pub trait Float
     /// ```
     #[unstable(feature = "std_misc", reason = "position is undecided")]
     fn is_finite(self) -> bool;
+
     /// Returns `true` if the number is neither zero, infinite,
     /// [subnormal][subnormal], or `NaN`.
     ///
@@ -1148,7 +1152,7 @@ pub fn test_num<T>(ten: T, two: T) where
 
 #[cfg(test)]
 mod tests {
-    use prelude::v1::*;
+    use core::prelude::*;
     use super::*;
     use i8;
     use i16;
@@ -1160,6 +1164,7 @@ mod tests {
     use u32;
     use u64;
     use usize;
+    use string::ToString;
 
     macro_rules! test_cast_20 {
         ($_20:expr) => ({
index 66826b359e63054f9fa06fdc1afc18ff4a4a5ba7..fe55f40390e1754a07a2b3da1bfffbc985527e28 100644 (file)
@@ -11,6 +11,7 @@
 // ignore-lexer-test FIXME #15679
 
 #![allow(missing_docs)]
+#![allow(deprecated)]
 
 use self::ExponentFormat::*;
 use self::SignificantDigits::*;
@@ -49,10 +50,10 @@ pub enum SignificantDigits {
 
     /// At most the given number of digits will be printed, truncating any
     /// trailing zeroes.
-    DigMax(uint),
+    DigMax(usize),
 
     /// Precisely the given number of digits will be printed.
-    DigExact(uint)
+    DigExact(usize)
 }
 
 /// How to emit the sign of a number.
@@ -87,7 +88,7 @@ pub enum SignFormat {
 /// # Panics
 ///
 /// - Panics if `radix` < 2 or `radix` > 36.
-fn int_to_str_bytes_common<T, F>(num: T, radix: uint, sign: SignFormat, mut f: F) where
+fn int_to_str_bytes_common<T, F>(num: T, radix: usize, sign: SignFormat, mut f: F) where
     T: Int,
     F: FnMut(u8),
 {
@@ -216,7 +217,7 @@ pub fn float_to_str_bytes_common<T: Float>(
 
     let neg = num < _0 || (negative_zero && _1 / num == Float::neg_infinity());
     let mut buf = Vec::new();
-    let radix_gen: T = num::cast(radix as int).unwrap();
+    let radix_gen: T = num::cast(radix as isize).unwrap();
 
     let (num, exp) = match exp_format {
         ExpNone => (num, 0),
@@ -328,28 +329,28 @@ pub fn float_to_str_bytes_common<T: Float>(
 
             let extra_digit = ascii2value(buf.pop().unwrap());
             if extra_digit >= radix / 2 { // -> need to round
-                let mut i: int = buf.len() as int - 1;
+                let mut i: isize = buf.len() as isize - 1;
                 loop {
                     // If reached left end of number, have to
                     // insert additional digit:
                     if i < 0
-                    || buf[i as uint] == b'-'
-                    || buf[i as uint] == b'+' {
-                        buf.insert((i + 1) as uint, value2ascii(1));
+                    || buf[i as usize] == b'-'
+                    || buf[i as usize] == b'+' {
+                        buf.insert((i + 1) as usize, value2ascii(1));
                         break;
                     }
 
                     // Skip the '.'
-                    if buf[i as uint] == b'.' { i -= 1; continue; }
+                    if buf[i as usize] == b'.' { i -= 1; continue; }
 
                     // Either increment the digit,
                     // or set to 0 if max and carry the 1.
-                    let current_digit = ascii2value(buf[i as uint]);
+                    let current_digit = ascii2value(buf[i as usize]);
                     if current_digit < (radix - 1) {
-                        buf[i as uint] = value2ascii(current_digit+1);
+                        buf[i as usize] = value2ascii(current_digit+1);
                         break;
                     } else {
-                        buf[i as uint] = value2ascii(0);
+                        buf[i as usize] = value2ascii(0);
                         i -= 1;
                     }
                 }
@@ -461,85 +462,85 @@ mod bench {
     #![allow(deprecated)] // rand
     extern crate test;
 
-    mod uint {
+    mod usize {
         use super::test::Bencher;
         use rand::{weak_rng, Rng};
         use std::fmt;
 
         #[inline]
-        fn to_string(x: uint, base: u8) {
+        fn to_string(x: usize, base: u8) {
             format!("{}", fmt::radix(x, base));
         }
 
         #[bench]
         fn to_str_bin(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { to_string(rng.gen::<uint>(), 2); })
+            b.iter(|| { to_string(rng.gen::<usize>(), 2); })
         }
 
         #[bench]
         fn to_str_oct(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { to_string(rng.gen::<uint>(), 8); })
+            b.iter(|| { to_string(rng.gen::<usize>(), 8); })
         }
 
         #[bench]
         fn to_str_dec(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { to_string(rng.gen::<uint>(), 10); })
+            b.iter(|| { to_string(rng.gen::<usize>(), 10); })
         }
 
         #[bench]
         fn to_str_hex(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { to_string(rng.gen::<uint>(), 16); })
+            b.iter(|| { to_string(rng.gen::<usize>(), 16); })
         }
 
         #[bench]
         fn to_str_base_36(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { to_string(rng.gen::<uint>(), 36); })
+            b.iter(|| { to_string(rng.gen::<usize>(), 36); })
         }
     }
 
-    mod int {
+    mod isize {
         use super::test::Bencher;
         use rand::{weak_rng, Rng};
         use std::fmt;
 
         #[inline]
-        fn to_string(x: int, base: u8) {
+        fn to_string(x: isize, base: u8) {
             format!("{}", fmt::radix(x, base));
         }
 
         #[bench]
         fn to_str_bin(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { to_string(rng.gen::<int>(), 2); })
+            b.iter(|| { to_string(rng.gen::<isize>(), 2); })
         }
 
         #[bench]
         fn to_str_oct(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { to_string(rng.gen::<int>(), 8); })
+            b.iter(|| { to_string(rng.gen::<isize>(), 8); })
         }
 
         #[bench]
         fn to_str_dec(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { to_string(rng.gen::<int>(), 10); })
+            b.iter(|| { to_string(rng.gen::<isize>(), 10); })
         }
 
         #[bench]
         fn to_str_hex(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { to_string(rng.gen::<int>(), 16); })
+            b.iter(|| { to_string(rng.gen::<isize>(), 16); })
         }
 
         #[bench]
         fn to_str_base_36(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { to_string(rng.gen::<int>(), 36); })
+            b.iter(|| { to_string(rng.gen::<isize>(), 36); })
         }
     }
 
index 9a9d421dfe1f02700d12a855837c7d1370e19699..ad6cac621733b815472affd508d80c5210ddf09f 100644 (file)
@@ -15,7 +15,7 @@
 use cmp;
 use fmt;
 use old_io::{Reader, Writer, Stream, Buffer, DEFAULT_BUF_SIZE, IoResult};
-use iter::{IteratorExt, ExactSizeIterator, repeat};
+use iter::{Iterator, ExactSizeIterator, repeat};
 use ops::Drop;
 use option::Option;
 use option::Option::{Some, None};
@@ -49,8 +49,8 @@
 pub struct BufferedReader<R> {
     inner: R,
     buf: Vec<u8>,
-    pos: uint,
-    cap: uint,
+    pos: usize,
+    cap: usize,
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -63,7 +63,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
 
 impl<R: Reader> BufferedReader<R> {
     /// Creates a new `BufferedReader` with the specified buffer capacity
-    pub fn with_capacity(cap: uint, inner: R) -> BufferedReader<R> {
+    pub fn with_capacity(cap: usize, inner: R) -> BufferedReader<R> {
         BufferedReader {
             inner: inner,
             // We can't use the same trick here as we do for BufferedWriter,
@@ -104,21 +104,21 @@ fn fill_buf<'a>(&'a mut self) -> IoResult<&'a [u8]> {
         Ok(&self.buf[self.pos..self.cap])
     }
 
-    fn consume(&mut self, amt: uint) {
+    fn consume(&mut self, amt: usize) {
         self.pos += amt;
         assert!(self.pos <= self.cap);
     }
 }
 
 impl<R: Reader> Reader for BufferedReader<R> {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         if self.pos == self.cap && buf.len() >= self.buf.len() {
             return self.inner.read(buf);
         }
         let nread = {
             let available = try!(self.fill_buf());
             let nread = cmp::min(available.len(), buf.len());
-            slice::bytes::copy_memory(buf, &available[..nread]);
+            slice::bytes::copy_memory(&available[..nread], buf);
             nread
         };
         self.pos += nread;
@@ -151,7 +151,7 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
 pub struct BufferedWriter<W: Writer> {
     inner: Option<W>,
     buf: Vec<u8>,
-    pos: uint
+    pos: usize
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -164,7 +164,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
 
 impl<W: Writer> BufferedWriter<W> {
     /// Creates a new `BufferedWriter` with the specified buffer capacity
-    pub fn with_capacity(cap: uint, inner: W) -> BufferedWriter<W> {
+    pub fn with_capacity(cap: usize, inner: W) -> BufferedWriter<W> {
         // It's *much* faster to create an uninitialized buffer than it is to
         // fill everything in with 0. This buffer is entirely an implementation
         // detail and is never exposed, so we're safe to not initialize
@@ -225,7 +225,7 @@ fn write_all(&mut self, buf: &[u8]) -> IoResult<()> {
             self.inner.as_mut().unwrap().write_all(buf)
         } else {
             let dst = &mut self.buf[self.pos..];
-            slice::bytes::copy_memory(dst, buf);
+            slice::bytes::copy_memory(buf, dst);
             self.pos += buf.len();
             Ok(())
         }
@@ -309,7 +309,7 @@ fn get_mut<'a>(&'a mut self) -> &'a mut BufferedWriter<W> {
 }
 
 impl<W: Reader + Writer> Reader for InternalBufferedWriter<W> {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         self.get_mut().inner.as_mut().unwrap().read(buf)
     }
 }
@@ -362,7 +362,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
 impl<S: Stream> BufferedStream<S> {
     /// Creates a new buffered stream with explicitly listed capacities for the
     /// reader/writer buffer.
-    pub fn with_capacities(reader_cap: uint, writer_cap: uint, inner: S)
+    pub fn with_capacities(reader_cap: usize, writer_cap: usize, inner: S)
                            -> BufferedStream<S> {
         let writer = BufferedWriter::with_capacity(writer_cap, inner);
         let internal_writer = InternalBufferedWriter(writer);
@@ -407,11 +407,11 @@ pub fn into_inner(self) -> S {
 
 impl<S: Stream> Buffer for BufferedStream<S> {
     fn fill_buf<'a>(&'a mut self) -> IoResult<&'a [u8]> { self.inner.fill_buf() }
-    fn consume(&mut self, amt: uint) { self.inner.consume(amt) }
+    fn consume(&mut self, amt: usize) { self.inner.consume(amt) }
 }
 
 impl<S: Stream> Reader for BufferedStream<S> {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         self.inner.read(buf)
     }
 }
@@ -442,7 +442,7 @@ mod test {
     pub struct NullStream;
 
     impl Reader for NullStream {
-        fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<uint> {
+        fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<usize> {
             Err(old_io::standard_error(old_io::EndOfFile))
         }
     }
@@ -453,11 +453,11 @@ fn write_all(&mut self, _: &[u8]) -> old_io::IoResult<()> { Ok(()) }
 
     /// A dummy reader intended at testing short-reads propagation.
     pub struct ShortReader {
-        lengths: Vec<uint>,
+        lengths: Vec<usize>,
     }
 
     impl Reader for ShortReader {
-        fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<uint> {
+        fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<usize> {
             if self.lengths.is_empty() {
                 Err(old_io::standard_error(old_io::EndOfFile))
             } else {
@@ -510,37 +510,37 @@ fn test_buffered_writer() {
 
         writer.write_all(&[0, 1]).unwrap();
         let b: &[_] = &[];
-        assert_eq!(&writer.get_ref()[], b);
+        assert_eq!(&writer.get_ref()[..], b);
 
         writer.write_all(&[2]).unwrap();
         let b: &[_] = &[0, 1];
-        assert_eq!(&writer.get_ref()[], b);
+        assert_eq!(&writer.get_ref()[..], b);
 
         writer.write_all(&[3]).unwrap();
-        assert_eq!(&writer.get_ref()[], b);
+        assert_eq!(&writer.get_ref()[..], b);
 
         writer.flush().unwrap();
         let a: &[_] = &[0, 1, 2, 3];
-        assert_eq!(a, &writer.get_ref()[]);
+        assert_eq!(a, &writer.get_ref()[..]);
 
         writer.write_all(&[4]).unwrap();
         writer.write_all(&[5]).unwrap();
-        assert_eq!(a, &writer.get_ref()[]);
+        assert_eq!(a, &writer.get_ref()[..]);
 
         writer.write_all(&[6]).unwrap();
         let a: &[_] = &[0, 1, 2, 3, 4, 5];
-        assert_eq!(a, &writer.get_ref()[]);
+        assert_eq!(a, &writer.get_ref()[..]);
 
         writer.write_all(&[7, 8]).unwrap();
         let a: &[_] = &[0, 1, 2, 3, 4, 5, 6];
-        assert_eq!(a, &writer.get_ref()[]);
+        assert_eq!(a, &writer.get_ref()[..]);
 
         writer.write_all(&[9, 10, 11]).unwrap();
         let a: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
-        assert_eq!(a, &writer.get_ref()[]);
+        assert_eq!(a, &writer.get_ref()[..]);
 
         writer.flush().unwrap();
-        assert_eq!(a, &writer.get_ref()[]);
+        assert_eq!(a, &writer.get_ref()[..]);
     }
 
     #[test]
@@ -548,7 +548,7 @@ fn test_buffered_writer_inner_flushes() {
         let mut w = BufferedWriter::with_capacity(3, Vec::new());
         w.write_all(&[0, 1]).unwrap();
         let a: &[_] = &[];
-        assert_eq!(a, &w.get_ref()[]);
+        assert_eq!(a, &w.get_ref()[..]);
         let w = w.into_inner();
         let a: &[_] = &[0, 1];
         assert_eq!(a, &w[..]);
@@ -565,7 +565,7 @@ fn write_all(&mut self, _: &[u8]) -> old_io::IoResult<()> { Ok(()) }
         }
 
         impl old_io::Reader for S {
-            fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<uint> {
+            fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<usize> {
                 Err(old_io::standard_error(old_io::EndOfFile))
             }
         }
@@ -593,21 +593,21 @@ fn test_line_buffer() {
         let mut writer = LineBufferedWriter::new(Vec::new());
         writer.write_all(&[0]).unwrap();
         let b: &[_] = &[];
-        assert_eq!(&writer.get_ref()[], b);
+        assert_eq!(&writer.get_ref()[..], b);
         writer.write_all(&[1]).unwrap();
-        assert_eq!(&writer.get_ref()[], b);
+        assert_eq!(&writer.get_ref()[..], b);
         writer.flush().unwrap();
         let b: &[_] = &[0, 1];
-        assert_eq!(&writer.get_ref()[], b);
+        assert_eq!(&writer.get_ref()[..], b);
         writer.write_all(&[0, b'\n', 1, b'\n', 2]).unwrap();
         let b: &[_] = &[0, 1, 0, b'\n', 1, b'\n'];
-        assert_eq!(&writer.get_ref()[], b);
+        assert_eq!(&writer.get_ref()[..], b);
         writer.flush().unwrap();
         let b: &[_] = &[0, 1, 0, b'\n', 1, b'\n', 2];
-        assert_eq!(&writer.get_ref()[], b);
+        assert_eq!(&writer.get_ref()[..], b);
         writer.write_all(&[3, b'\n']).unwrap();
         let b: &[_] = &[0, 1, 0, b'\n', 1, b'\n', 2, 3, b'\n'];
-        assert_eq!(&writer.get_ref()[], b);
+        assert_eq!(&writer.get_ref()[..], b);
     }
 
     #[test]
index cd8252540dacce9eaa1ccc4445856479e4e27b45..5ebf931e95c375f60f2358faae6b3112b756c3a8 100644 (file)
@@ -39,7 +39,7 @@
 /// ```
 pub struct ChanReader {
     buf: Vec<u8>,          // A buffer of bytes received but not consumed.
-    pos: uint,             // How many of the buffered bytes have already be consumed.
+    pos: usize,             // How many of the buffered bytes have already be consumed.
     rx: Receiver<Vec<u8>>, // The Receiver to pull data from.
     closed: bool,          // Whether the channel this Receiver connects to has been closed.
 }
@@ -77,21 +77,21 @@ fn fill_buf<'a>(&'a mut self) -> IoResult<&'a [u8]> {
         }
     }
 
-    fn consume(&mut self, amt: uint) {
+    fn consume(&mut self, amt: usize) {
         self.pos += amt;
         assert!(self.pos <= self.buf.len());
     }
 }
 
 impl Reader for ChanReader {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         let mut num_read = 0;
         loop {
             let count = match self.fill_buf().ok() {
                 Some(src) => {
                     let dst = &mut buf[num_read..];
                     let count = cmp::min(src.len(), dst.len());
-                    bytes::copy_memory(dst, &src[..count]);
+                    bytes::copy_memory(&src[..count], dst);
                     count
                 },
                 None => 0,
index 5b1b9471b075c5247e9a8a5338a8970684ff31e8..0e5dd3aa4aac2862fca5478d305b3d7dc2304de1 100644 (file)
@@ -81,7 +81,7 @@ fn next(&mut self) -> Option<IoResult<u8>> {
 /// * `f`: A callback that receives the value.
 ///
 /// This function returns the value returned by the callback, for convenience.
-pub fn u64_to_le_bytes<T, F>(n: u64, size: uint, f: F) -> T where
+pub fn u64_to_le_bytes<T, F>(n: u64, size: usize, f: F) -> T where
     F: FnOnce(&[u8]) -> T,
 {
     use mem::transmute;
@@ -122,7 +122,7 @@ pub fn u64_to_le_bytes<T, F>(n: u64, size: uint, f: F) -> T where
 /// * `f`: A callback that receives the value.
 ///
 /// This function returns the value returned by the callback, for convenience.
-pub fn u64_to_be_bytes<T, F>(n: u64, size: uint, f: F) -> T where
+pub fn u64_to_be_bytes<T, F>(n: u64, size: usize, f: F) -> T where
     F: FnOnce(&[u8]) -> T,
 {
     use mem::transmute;
@@ -158,7 +158,7 @@ pub fn u64_to_be_bytes<T, F>(n: u64, size: uint, f: F) -> T where
 ///           less, or task panic occurs. If this is less than 8, then only
 ///           that many bytes are parsed. For example, if `size` is 4, then a
 ///           32-bit value is parsed.
-pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
+pub fn u64_from_be_bytes(data: &[u8], start: usize, size: usize) -> u64 {
     use ptr::{copy_nonoverlapping};
 
     assert!(size <= 8);
@@ -169,9 +169,9 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
 
     let mut buf = [0; 8];
     unsafe {
-        let ptr = data.as_ptr().offset(start as int);
+        let ptr = data.as_ptr().offset(start as isize);
         let out = buf.as_mut_ptr();
-        copy_nonoverlapping(out.offset((8 - size) as int), ptr, size);
+        copy_nonoverlapping(ptr, out.offset((8 - size) as isize), size);
         (*(out as *const u64)).to_be()
     }
 }
@@ -183,11 +183,11 @@ mod test {
     use old_io::{MemReader, BytesReader};
 
     struct InitialZeroByteReader {
-        count: int,
+        count: isize,
     }
 
     impl Reader for InitialZeroByteReader {
-        fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
+        fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> {
             if self.count == 0 {
                 self.count = 1;
                 Ok(0)
@@ -201,7 +201,7 @@ fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
     struct EofReader;
 
     impl Reader for EofReader {
-        fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<uint> {
+        fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<usize> {
             Err(old_io::standard_error(old_io::EndOfFile))
         }
     }
@@ -209,17 +209,17 @@ fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<uint> {
     struct ErroringReader;
 
     impl Reader for ErroringReader {
-        fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<uint> {
+        fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<usize> {
             Err(old_io::standard_error(old_io::InvalidInput))
         }
     }
 
     struct PartialReader {
-        count: int,
+        count: isize,
     }
 
     impl Reader for PartialReader {
-        fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
+        fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> {
             if self.count == 0 {
                 self.count = 1;
                 buf[0] = 10;
@@ -234,11 +234,11 @@ fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
     }
 
     struct ErroringLaterReader {
-        count: int,
+        count: isize,
     }
 
     impl Reader for ErroringLaterReader {
-        fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
+        fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> {
             if self.count == 0 {
                 self.count = 1;
                 buf[0] = 10;
@@ -250,11 +250,11 @@ fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
     }
 
     struct ThreeChunkReader {
-        count: int,
+        count: isize,
     }
 
     impl Reader for ThreeChunkReader {
-        fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
+        fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> {
             if self.count == 0 {
                 self.count = 1;
                 buf[0] = 10;
index 40a7cce81dd01ebb8b85c7e481f30d0848612084..6aa63c395c62501efb5620a33d9d34996f5a8728 100644 (file)
@@ -88,7 +88,7 @@
 pub struct File {
     fd: fs_imp::FileDesc,
     path: Path,
-    last_nread: int,
+    last_nread: isize,
 }
 
 impl sys_common::AsInner<fs_imp::FileDesc> for File {
@@ -105,7 +105,7 @@ impl File {
     ///
     /// # Examples
     ///
-    /// ```rust,should_fail
+    /// ```rust,should_panic
     /// # #![feature(old_io, old_path)]
     /// use std::old_io::*;
     /// use std::old_path::Path;
@@ -472,14 +472,14 @@ fn update_err<T>(result: IoResult<T>, from: &Path, to: &Path) -> IoResult<T> {
 #[deprecated(since = "1.0.0", reason = "replaced with std::fs::set_permissions")]
 #[unstable(feature = "old_io")]
 pub fn chmod(path: &Path, mode: old_io::FilePermission) -> IoResult<()> {
-    fs_imp::chmod(path, mode.bits() as uint)
+    fs_imp::chmod(path, mode.bits() as usize)
            .update_err("couldn't chmod path", |e|
                format!("{}; path={}; mode={:?}", e, path.display(), mode))
 }
 
 /// Change the user and group owners of a file at the specified path.
 #[unstable(feature = "old_fs")]
-pub fn chown(path: &Path, uid: int, gid: int) -> IoResult<()> {
+pub fn chown(path: &Path, uid: isize, gid: isize) -> IoResult<()> {
     fs_imp::chown(path, uid, gid)
            .update_err("couldn't chown path", |e|
                format!("{}; path={}; uid={}; gid={}", e, path.display(), uid, gid))
@@ -541,7 +541,7 @@ pub fn readlink(path: &Path) -> IoResult<Path> {
 /// new directory at the provided `path`, or if the directory already exists.
 #[unstable(feature = "old_fs")]
 pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> {
-    fs_imp::mkdir(path, mode.bits() as uint)
+    fs_imp::mkdir(path, mode.bits() as usize)
            .update_err("couldn't create directory", |e|
                format!("{}; path={}; mode={}", e, path.display(), mode))
 }
@@ -773,7 +773,7 @@ pub fn change_file_times(path: &Path, atime: u64, mtime: u64) -> IoResult<()> {
 }
 
 impl Reader for File {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         fn update_err<T>(result: IoResult<T>, file: &File) -> IoResult<T> {
             result.update_err("couldn't read file",
                               |e| format!("{}; path={}",
@@ -784,10 +784,10 @@ fn update_err<T>(result: IoResult<T>, file: &File) -> IoResult<T> {
 
         match result {
             Ok(read) => {
-                self.last_nread = read as int;
+                self.last_nread = read as isize;
                 match read {
                     0 => update_err(Err(standard_error(old_io::EndOfFile)), self),
-                    _ => Ok(read as uint)
+                    _ => Ok(read as usize)
                 }
             },
             Err(e) => Err(e)
@@ -1227,8 +1227,8 @@ fn file_test_walk_dir() {
             let stem = f.filestem_str().unwrap();
             let root = stem.as_bytes()[0] - b'0';
             let name = stem.as_bytes()[1] - b'0';
-            assert!(cur[root as uint] < name);
-            cur[root as uint] = name;
+            assert!(cur[root as usize] < name);
+            cur[root as usize] = name;
         }
 
         check!(rmdir_recursive(dir));
@@ -1532,7 +1532,7 @@ fn truncate_works() {
                    b"foobar\0\0\0\0".to_vec());
 
         // Truncate to a smaller length, don't seek, and then write something.
-        // Ensure that the intermediate zeroes are all filled in (we're seeked
+        // Ensure that the intermediate zeroes are all filled in (we have `seek`ed
         // past the end of the file).
         check!(file.truncate(2));
         assert_eq!(check!(file.stat()).size, 2);
index d877a60b079d7f6c8b8e1f2986c6055ea1d22f67..64803191d4f14e7a51235d62c2de629665240385 100644 (file)
@@ -20,9 +20,9 @@
 use slice;
 use vec::Vec;
 
-const BUF_CAPACITY: uint = 128;
+const BUF_CAPACITY: usize = 128;
 
-fn combine(seek: SeekStyle, cur: uint, end: uint, offset: i64) -> IoResult<u64> {
+fn combine(seek: SeekStyle, cur: usize, end: usize, offset: i64) -> IoResult<u64> {
     // compute offset as signed and clamp to prevent overflow
     let pos = match seek {
         old_io::SeekSet => 0,
@@ -82,7 +82,7 @@ pub fn new() -> MemWriter {
     /// Create a new `MemWriter`, allocating at least `n` bytes for
     /// the internal buffer.
     #[inline]
-    pub fn with_capacity(n: uint) -> MemWriter {
+    pub fn with_capacity(n: usize) -> MemWriter {
         MemWriter::from_vec(Vec::with_capacity(n))
     }
     /// Create a new `MemWriter` that will append to an existing `Vec`.
@@ -125,7 +125,7 @@ fn write_all(&mut self, buf: &[u8]) -> IoResult<()> {
 /// ```
 pub struct MemReader {
     buf: Vec<u8>,
-    pos: uint
+    pos: usize
 }
 
 impl MemReader {
@@ -160,7 +160,7 @@ pub fn into_inner(self) -> Vec<u8> { self.buf }
 
 impl Reader for MemReader {
     #[inline]
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         if self.eof() { return Err(old_io::standard_error(old_io::EndOfFile)) }
 
         let write_len = min(buf.len(), self.buf.len() - self.pos);
@@ -168,7 +168,7 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
             let input = &self.buf[self.pos.. self.pos + write_len];
             let output = &mut buf[..write_len];
             assert_eq!(input.len(), output.len());
-            slice::bytes::copy_memory(output, input);
+            slice::bytes::copy_memory(input, output);
         }
         self.pos += write_len;
         assert!(self.pos <= self.buf.len());
@@ -184,7 +184,7 @@ fn tell(&self) -> IoResult<u64> { Ok(self.pos as u64) }
     #[inline]
     fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()> {
         let new = try!(combine(style, self.pos, self.buf.len(), pos));
-        self.pos = new as uint;
+        self.pos = new as usize;
         Ok(())
     }
 }
@@ -200,19 +200,19 @@ fn fill_buf<'a>(&'a mut self) -> IoResult<&'a [u8]> {
     }
 
     #[inline]
-    fn consume(&mut self, amt: uint) { self.pos += amt; }
+    fn consume(&mut self, amt: usize) { self.pos += amt; }
 }
 
 impl<'a> Reader for &'a [u8] {
     #[inline]
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         if self.is_empty() { return Err(old_io::standard_error(old_io::EndOfFile)); }
 
         let write_len = min(buf.len(), self.len());
         {
             let input = &self[..write_len];
             let output = &mut buf[.. write_len];
-            slice::bytes::copy_memory(output, input);
+            slice::bytes::copy_memory(input, output);
         }
 
         *self = &self[write_len..];
@@ -232,7 +232,7 @@ fn fill_buf(&mut self) -> IoResult<&[u8]> {
     }
 
     #[inline]
-    fn consume(&mut self, amt: uint) {
+    fn consume(&mut self, amt: usize) {
         *self = &self[amt..];
     }
 }
@@ -259,7 +259,7 @@ fn consume(&mut self, amt: uint) {
 /// ```
 pub struct BufWriter<'a> {
     buf: &'a mut [u8],
-    pos: uint
+    pos: usize
 }
 
 impl<'a> BufWriter<'a> {
@@ -287,13 +287,13 @@ fn write_all(&mut self, src: &[u8]) -> IoResult<()> {
         let src_len = src.len();
 
         if dst_len >= src_len {
-            slice::bytes::copy_memory(dst, src);
+            slice::bytes::copy_memory(src, dst);
 
             self.pos += src_len;
 
             Ok(())
         } else {
-            slice::bytes::copy_memory(dst, &src[..dst_len]);
+            slice::bytes::copy_memory(&src[..dst_len], dst);
 
             self.pos += dst_len;
 
@@ -309,7 +309,7 @@ fn tell(&self) -> IoResult<u64> { Ok(self.pos as u64) }
     #[inline]
     fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()> {
         let new = try!(combine(style, self.pos, self.buf.len(), pos));
-        self.pos = min(new as uint, self.buf.len());
+        self.pos = min(new as usize, self.buf.len());
         Ok(())
     }
 }
@@ -330,7 +330,7 @@ fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()> {
 /// ```
 pub struct BufReader<'a> {
     buf: &'a [u8],
-    pos: uint
+    pos: usize
 }
 
 impl<'a> BufReader<'a> {
@@ -352,7 +352,7 @@ pub fn eof(&self) -> bool { self.pos >= self.buf.len() }
 
 impl<'a> Reader for BufReader<'a> {
     #[inline]
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         if self.eof() { return Err(old_io::standard_error(old_io::EndOfFile)) }
 
         let write_len = min(buf.len(), self.buf.len() - self.pos);
@@ -360,7 +360,7 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
             let input = &self.buf[self.pos.. self.pos + write_len];
             let output = &mut buf[..write_len];
             assert_eq!(input.len(), output.len());
-            slice::bytes::copy_memory(output, input);
+            slice::bytes::copy_memory(input, output);
         }
         self.pos += write_len;
         assert!(self.pos <= self.buf.len());
@@ -376,7 +376,7 @@ fn tell(&self) -> IoResult<u64> { Ok(self.pos as u64) }
     #[inline]
     fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()> {
         let new = try!(combine(style, self.pos, self.buf.len(), pos));
-        self.pos = new as uint;
+        self.pos = new as usize;
         Ok(())
     }
 }
@@ -392,15 +392,15 @@ fn fill_buf(&mut self) -> IoResult<&[u8]> {
     }
 
     #[inline]
-    fn consume(&mut self, amt: uint) { self.pos += amt; }
+    fn consume(&mut self, amt: usize) { self.pos += amt; }
 }
 
 #[cfg(test)]
 mod test {
-    extern crate "test" as test_crate;
+    extern crate test as test_crate;
     use old_io::{SeekSet, SeekCur, SeekEnd, Reader, Writer, Seek, Buffer};
     use prelude::v1::{Ok, Err, Vec,  AsSlice};
-    use prelude::v1::IteratorExt;
+    use prelude::v1::Iterator;
     use old_io;
     use iter::repeat;
     use self::test_crate::Bencher;
@@ -663,7 +663,7 @@ fn io_read_at_least() {
         assert_eq!(buf, b);
     }
 
-    fn do_bench_mem_writer(b: &mut Bencher, times: uint, len: uint) {
+    fn do_bench_mem_writer(b: &mut Bencher, times: usize, len: usize) {
         let src: Vec<u8> = repeat(5).take(len).collect();
 
         b.bytes = (times * len) as u64;
index ac908c529dca661b0a6c2b70e59932919ff663ba..df8ac78f7e581c107d85d9c32f3a895788af72bb 100644 (file)
 use error::Error;
 use fmt;
 use isize;
-use iter::{Iterator, IteratorExt};
+use iter::Iterator;
 use marker::{PhantomFn, Sized};
 use mem::transmute;
 use ops::FnOnce;
 /// The default buffer size for various I/O operations
 // libuv recommends 64k buffers to maximize throughput
 // https://groups.google.com/forum/#!topic/libuv/oQO1HJAIDdA
-const DEFAULT_BUF_SIZE: uint = 1024 * 64;
+const DEFAULT_BUF_SIZE: usize = 1024 * 64;
 
 /// A convenient typedef of the return value of any I/O action.
 pub type IoResult<T> = Result<T, IoError>;
@@ -441,7 +441,7 @@ pub enum IoErrorKind {
     ///
     /// The payload contained as part of this variant is the number of bytes
     /// which are known to have been successfully written.
-    ShortWrite(uint),
+    ShortWrite(usize),
     /// The Reader returned 0 bytes from `read()` too many times.
     NoProgress,
 }
@@ -483,7 +483,7 @@ fn update_desc(self, desc: &'static str) -> IoResult<T> {
     }
 }
 
-static NO_PROGRESS_LIMIT: uint = 1000;
+static NO_PROGRESS_LIMIT: usize = 1000;
 
 /// A trait for objects which are byte-oriented streams. Readers are defined by
 /// one method, `read`. This function will block until data is available,
@@ -511,7 +511,7 @@ pub trait Reader {
     ///
     /// When implementing this method on a new Reader, you are strongly encouraged
     /// not to return 0 if you can avoid it.
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>;
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize>;
 
     // Convenient helper methods based on the above methods
 
@@ -526,7 +526,7 @@ pub trait Reader {
     ///
     /// If an error occurs at any point, that error is returned, and no further
     /// bytes are read.
-    fn read_at_least(&mut self, min: uint, buf: &mut [u8]) -> IoResult<uint> {
+    fn read_at_least(&mut self, min: usize, buf: &mut [u8]) -> IoResult<usize> {
         if min > buf.len() {
             return Err(IoError {
                 detail: Some(String::from_str("the buffer is too short")),
@@ -570,7 +570,7 @@ fn read_byte(&mut self) -> IoResult<u8> {
     ///
     /// If an error occurs during this I/O operation, then it is returned
     /// as `Err(IoError)`. See `read()` for more details.
-    fn push(&mut self, len: uint, buf: &mut Vec<u8>) -> IoResult<uint> {
+    fn push(&mut self, len: usize, buf: &mut Vec<u8>) -> IoResult<usize> {
         let start_len = buf.len();
         buf.reserve(len);
 
@@ -594,7 +594,7 @@ fn push(&mut self, len: uint, buf: &mut Vec<u8>) -> IoResult<uint> {
     ///
     /// If an error occurs at any point, that error is returned, and no further
     /// bytes are read.
-    fn push_at_least(&mut self, min: uint, len: uint, buf: &mut Vec<u8>) -> IoResult<uint> {
+    fn push_at_least(&mut self, min: usize, len: usize, buf: &mut Vec<u8>) -> IoResult<usize> {
         if min > len {
             return Err(IoError {
                 detail: Some(String::from_str("the buffer is too short")),
@@ -629,7 +629,7 @@ fn push_at_least(&mut self, min: uint, len: uint, buf: &mut Vec<u8>) -> IoResult
     /// have already been consumed from the underlying reader, and they are lost
     /// (not returned as part of the error). If this is unacceptable, then it is
     /// recommended to use the `push_at_least` or `read` methods.
-    fn read_exact(&mut self, len: uint) -> IoResult<Vec<u8>> {
+    fn read_exact(&mut self, len: usize) -> IoResult<Vec<u8>> {
         let mut buf = Vec::with_capacity(len);
         match self.push_at_least(len, len, &mut buf) {
             Ok(_) => Ok(buf),
@@ -679,7 +679,7 @@ fn read_to_string(&mut self) -> IoResult<String> {
     /// Reads `n` little-endian unsigned integer bytes.
     ///
     /// `n` must be between 1 and 8, inclusive.
-    fn read_le_uint_n(&mut self, nbytes: uint) -> IoResult<u64> {
+    fn read_le_uint_n(&mut self, nbytes: usize) -> IoResult<u64> {
         assert!(nbytes > 0 && nbytes <= 8);
 
         let mut val = 0;
@@ -696,14 +696,14 @@ fn read_le_uint_n(&mut self, nbytes: uint) -> IoResult<u64> {
     /// Reads `n` little-endian signed integer bytes.
     ///
     /// `n` must be between 1 and 8, inclusive.
-    fn read_le_int_n(&mut self, nbytes: uint) -> IoResult<i64> {
+    fn read_le_int_n(&mut self, nbytes: usize) -> IoResult<i64> {
         self.read_le_uint_n(nbytes).map(|i| extend_sign(i, nbytes))
     }
 
     /// Reads `n` big-endian unsigned integer bytes.
     ///
     /// `n` must be between 1 and 8, inclusive.
-    fn read_be_uint_n(&mut self, nbytes: uint) -> IoResult<u64> {
+    fn read_be_uint_n(&mut self, nbytes: usize) -> IoResult<u64> {
         assert!(nbytes > 0 && nbytes <= 8);
 
         let mut val = 0;
@@ -718,36 +718,36 @@ fn read_be_uint_n(&mut self, nbytes: uint) -> IoResult<u64> {
     /// Reads `n` big-endian signed integer bytes.
     ///
     /// `n` must be between 1 and 8, inclusive.
-    fn read_be_int_n(&mut self, nbytes: uint) -> IoResult<i64> {
+    fn read_be_int_n(&mut self, nbytes: usize) -> IoResult<i64> {
         self.read_be_uint_n(nbytes).map(|i| extend_sign(i, nbytes))
     }
 
     /// Reads a little-endian unsigned integer.
     ///
     /// The number of bytes returned is system-dependent.
-    fn read_le_uint(&mut self) -> IoResult<uint> {
-        self.read_le_uint_n(usize::BYTES as usize).map(|i| i as uint)
+    fn read_le_uint(&mut self) -> IoResult<usize> {
+        self.read_le_uint_n(usize::BYTES as usize).map(|i| i as usize)
     }
 
     /// Reads a little-endian integer.
     ///
     /// The number of bytes returned is system-dependent.
-    fn read_le_int(&mut self) -> IoResult<int> {
-        self.read_le_int_n(isize::BYTES as usize).map(|i| i as int)
+    fn read_le_int(&mut self) -> IoResult<isize> {
+        self.read_le_int_n(isize::BYTES as usize).map(|i| i as isize)
     }
 
     /// Reads a big-endian unsigned integer.
     ///
     /// The number of bytes returned is system-dependent.
-    fn read_be_uint(&mut self) -> IoResult<uint> {
-        self.read_be_uint_n(usize::BYTES as usize).map(|i| i as uint)
+    fn read_be_uint(&mut self) -> IoResult<usize> {
+        self.read_be_uint_n(usize::BYTES as usize).map(|i| i as usize)
     }
 
     /// Reads a big-endian integer.
     ///
     /// The number of bytes returned is system-dependent.
-    fn read_be_int(&mut self) -> IoResult<int> {
-        self.read_be_int_n(isize::BYTES as usize).map(|i| i as int)
+    fn read_be_int(&mut self) -> IoResult<isize> {
+        self.read_be_int_n(isize::BYTES as usize).map(|i| i as isize)
     }
 
     /// Reads a big-endian `u64`.
@@ -919,14 +919,14 @@ fn bytes<'r>(&'r mut self) -> extensions::Bytes<'r, T> {
 }
 
 impl<'a> Reader for Box<Reader+'a> {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         let reader: &mut Reader = &mut **self;
         reader.read(buf)
     }
 }
 
 impl<'a> Reader for &'a mut (Reader+'a) {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { (*self).read(buf) }
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { (*self).read(buf) }
 }
 
 /// Returns a slice of `v` between `start` and `end`.
@@ -940,13 +940,13 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { (*self).read(buf) }
 /// `start` > `end`.
 // Private function here because we aren't sure if we want to expose this as
 // API yet. If so, it should be a method on Vec.
-unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec<T>, start: uint, end: uint) -> &'a mut [T] {
+unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec<T>, start: usize, end: usize) -> &'a mut [T] {
     use slice;
 
     assert!(start <= end);
     assert!(end <= v.capacity());
     slice::from_raw_parts_mut(
-        v.as_mut_ptr().offset(start as int),
+        v.as_mut_ptr().offset(start as isize),
         end - start
     )
 }
@@ -980,15 +980,15 @@ pub struct RefReader<'a, R:'a> {
 }
 
 impl<'a, R: Reader> Reader for RefReader<'a, R> {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { self.inner.read(buf) }
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { self.inner.read(buf) }
 }
 
 impl<'a, R: Buffer> Buffer for RefReader<'a, R> {
     fn fill_buf(&mut self) -> IoResult<&[u8]> { self.inner.fill_buf() }
-    fn consume(&mut self, amt: uint) { self.inner.consume(amt) }
+    fn consume(&mut self, amt: usize) { self.inner.consume(amt) }
 }
 
-fn extend_sign(val: u64, nbytes: uint) -> i64 {
+fn extend_sign(val: u64, nbytes: usize) -> i64 {
     let shift = (8 - nbytes) * 8;
     (val << shift) as i64 >> shift
 }
@@ -1095,39 +1095,39 @@ fn write_char(&mut self, c: char) -> IoResult<()> {
         self.write_all(&buf[..n])
     }
 
-    /// Write the result of passing n through `int::to_str_bytes`.
+    /// Write the result of passing n through `isize::to_str_bytes`.
     #[inline]
-    fn write_int(&mut self, n: int) -> IoResult<()> {
+    fn write_int(&mut self, n: isize) -> IoResult<()> {
         write!(self, "{}", n)
     }
 
-    /// Write the result of passing n through `uint::to_str_bytes`.
+    /// Write the result of passing n through `usize::to_str_bytes`.
     #[inline]
-    fn write_uint(&mut self, n: uint) -> IoResult<()> {
+    fn write_uint(&mut self, n: usize) -> IoResult<()> {
         write!(self, "{}", n)
     }
 
-    /// Write a little-endian uint (number of bytes depends on system).
+    /// Write a little-endian usize (number of bytes depends on system).
     #[inline]
-    fn write_le_uint(&mut self, n: uint) -> IoResult<()> {
+    fn write_le_uint(&mut self, n: usize) -> IoResult<()> {
         extensions::u64_to_le_bytes(n as u64, usize::BYTES as usize, |v| self.write_all(v))
     }
 
-    /// Write a little-endian int (number of bytes depends on system).
+    /// Write a little-endian isize (number of bytes depends on system).
     #[inline]
-    fn write_le_int(&mut self, n: int) -> IoResult<()> {
+    fn write_le_int(&mut self, n: isize) -> IoResult<()> {
         extensions::u64_to_le_bytes(n as u64, isize::BYTES as usize, |v| self.write_all(v))
     }
 
-    /// Write a big-endian uint (number of bytes depends on system).
+    /// Write a big-endian usize (number of bytes depends on system).
     #[inline]
-    fn write_be_uint(&mut self, n: uint) -> IoResult<()> {
+    fn write_be_uint(&mut self, n: usize) -> IoResult<()> {
         extensions::u64_to_be_bytes(n as u64, usize::BYTES as usize, |v| self.write_all(v))
     }
 
-    /// Write a big-endian int (number of bytes depends on system).
+    /// Write a big-endian isize (number of bytes depends on system).
     #[inline]
-    fn write_be_int(&mut self, n: int) -> IoResult<()> {
+    fn write_be_int(&mut self, n: isize) -> IoResult<()> {
         extensions::u64_to_be_bytes(n as u64, isize::BYTES as usize, |v| self.write_all(v))
     }
 
@@ -1409,7 +1409,7 @@ pub trait Buffer: Reader {
 
     /// Tells this buffer that `amt` bytes have been consumed from the buffer,
     /// so they should no longer be returned in calls to `read`.
-    fn consume(&mut self, amt: uint);
+    fn consume(&mut self, amt: usize);
 
     /// Reads the next line of input, interpreted as a sequence of UTF-8
     /// encoded Unicode codepoints. If a newline is encountered, then the
@@ -1588,9 +1588,7 @@ pub trait Seek {
 /// connections.
 ///
 /// Doing so produces some sort of Acceptor.
-pub trait Listener<T, A: Acceptor<T>>
-    : PhantomFn<T,T> // FIXME should be an assoc type anyhow
-{
+pub trait Listener<A: Acceptor> {
     /// Spin up the listener and start queuing incoming connections
     ///
     /// # Error
@@ -1601,13 +1599,16 @@ pub trait Listener<T, A: Acceptor<T>>
 }
 
 /// An acceptor is a value that presents incoming connections
-pub trait Acceptor<T> {
+pub trait Acceptor {
+    /// Type of connection that is accepted by this acceptor.
+    type Connection;
+
     /// Wait for and accept an incoming connection
     ///
     /// # Error
     ///
     /// Returns `Err` if an I/O error is encountered.
-    fn accept(&mut self) -> IoResult<T>;
+    fn accept(&mut self) -> IoResult<Self::Connection>;
 
     /// Create an iterator over incoming connection attempts.
     ///
@@ -1628,11 +1629,10 @@ pub struct IncomingConnections<'a, A: ?Sized +'a> {
     inc: &'a mut A,
 }
 
-#[old_impl_check]
-impl<'a, T, A: ?Sized + Acceptor<T>> Iterator for IncomingConnections<'a, A> {
-    type Item = IoResult<T>;
+impl<'a, A: ?Sized + Acceptor> Iterator for IncomingConnections<'a, A> {
+    type Item = IoResult<A::Connection>;
 
-    fn next(&mut self) -> Option<IoResult<T>> {
+    fn next(&mut self) -> Option<IoResult<A::Connection>> {
         Some(self.inc.accept())
     }
 }
@@ -1870,8 +1870,8 @@ mod tests {
 
     #[derive(Clone, PartialEq, Debug)]
     enum BadReaderBehavior {
-        GoodBehavior(uint),
-        BadBehavior(uint)
+        GoodBehavior(usize),
+        BadBehavior(usize)
     }
 
     struct BadReader<T> {
@@ -1886,7 +1886,7 @@ fn new(r: T, behavior: Vec<BadReaderBehavior>) -> BadReader<T> {
     }
 
     impl<T: Reader> Reader for BadReader<T> {
-        fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+        fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
             let BadReader { ref mut behavior, ref mut r } = *self;
             loop {
                 if behavior.is_empty() {
index 2b7506b5c34a3f6edef804b3d0cf4abf30d29c0a..739439ebd151ba50b5ff401a75c1fe183829022b 100644 (file)
@@ -19,8 +19,8 @@
 pub use self::Flag::*;
 pub use self::Protocol::*;
 
-use iter::IteratorExt;
-use old_io::{IoResult};
+use iter::Iterator;
+use old_io::IoResult;
 use old_io::net::ip::{SocketAddr, IpAddr};
 use option::Option;
 use option::Option::{Some, None};
@@ -63,19 +63,19 @@ pub enum Protocol {
 /// `man -s 3 getaddrinfo`
 #[derive(Copy, Debug)]
 pub struct Hint {
-    pub family: uint,
+    pub family: usize,
     pub socktype: Option<SocketType>,
     pub protocol: Option<Protocol>,
-    pub flags: uint,
+    pub flags: usize,
 }
 
 #[derive(Copy, Debug)]
 pub struct Info {
     pub address: SocketAddr,
-    pub family: uint,
+    pub family: usize,
     pub socktype: Option<SocketType>,
     pub protocol: Option<Protocol>,
-    pub flags: uint,
+    pub flags: usize,
 }
 
 /// Easy name resolution. Given a hostname, returns the list of IP addresses for
index f7953ac51b8e63e74146211226cb64399b8e7477..26e1bb6550b7a152887e05d26a246f2dd1cb8b8f 100644 (file)
@@ -21,7 +21,7 @@
 use fmt;
 use old_io::{self, IoResult, IoError};
 use old_io::net;
-use iter::{Iterator, IteratorExt};
+use iter::Iterator;
 use ops::{FnOnce, FnMut};
 use option::Option;
 use option::Option::{None, Some};
@@ -82,7 +82,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 struct Parser<'a> {
     // parsing as ASCII, so can use byte array
     s: &'a [u8],
-    pos: uint,
+    pos: usize,
 }
 
 impl<'a> Parser<'a> {
@@ -256,7 +256,7 @@ fn ipv6_addr_from_head_tail(head: &[u16], tail: &[u16]) -> IpAddr {
             Ipv6Addr(gs[0], gs[1], gs[2], gs[3], gs[4], gs[5], gs[6], gs[7])
         }
 
-        fn read_groups(p: &mut Parser, groups: &mut [u16; 8], limit: uint) -> (uint, bool) {
+        fn read_groups(p: &mut Parser, groups: &mut [u16; 8], limit: usize) -> (usize, bool) {
             let mut i = 0;
             while i < limit {
                 if i < limit - 1 {
index f9e5ae71e12e5b737e7d92a62b3c17ba70e7077d..3a071e832af64baa01133cc934eb18ae775becd2 100644 (file)
@@ -150,7 +150,7 @@ fn clone(&self) -> UnixStream {
 }
 
 impl Reader for UnixStream {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         self.inner.read(buf)
     }
 }
@@ -202,7 +202,7 @@ pub fn bind<P: BytesContainer>(path: P) -> IoResult<UnixListener> {
     }
 }
 
-impl Listener<UnixStream, UnixAcceptor> for UnixListener {
+impl Listener<UnixAcceptor> for UnixListener {
     fn listen(self) -> IoResult<UnixAcceptor> {
         self.inner.listen()
             .map(|inner| UnixAcceptor { inner: inner })
@@ -250,7 +250,8 @@ pub fn close_accept(&mut self) -> IoResult<()> {
     }
 }
 
-impl Acceptor<UnixStream> for UnixAcceptor {
+impl Acceptor for UnixAcceptor {
+    type Connection = UnixStream;
     fn accept(&mut self) -> IoResult<UnixStream> {
         self.inner.accept().map(|s| {
             UnixStream { inner: s }
index 75f786f0bb1e4d7271f4d5d312adabbecb116f58..7fc460c16efca2454a61b7e48bb5d606c62741cf 100644 (file)
@@ -122,7 +122,7 @@ pub fn set_nodelay(&mut self, nodelay: bool) -> IoResult<()> {
     /// this connection. Otherwise, the keepalive timeout will be set to the
     /// specified time, in seconds.
     #[unstable(feature = "io")]
-    pub fn set_keepalive(&mut self, delay_in_seconds: Option<uint>) -> IoResult<()> {
+    pub fn set_keepalive(&mut self, delay_in_seconds: Option<usize>) -> IoResult<()> {
         self.inner.set_keepalive(delay_in_seconds)
     }
 
@@ -257,7 +257,7 @@ fn clone(&self) -> TcpStream {
 }
 
 impl Reader for TcpStream {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         self.inner.read(buf)
     }
 }
@@ -338,7 +338,7 @@ pub fn socket_name(&mut self) -> IoResult<SocketAddr> {
     }
 }
 
-impl Listener<TcpStream, TcpAcceptor> for TcpListener {
+impl Listener<TcpAcceptor> for TcpListener {
     fn listen(self) -> IoResult<TcpAcceptor> {
         self.inner.listen(128).map(|a| TcpAcceptor { inner: a })
     }
@@ -453,7 +453,8 @@ pub fn close_accept(&mut self) -> IoResult<()> {
     }
 }
 
-impl Acceptor<TcpStream> for TcpAcceptor {
+impl Acceptor for TcpAcceptor {
+    type Connection = TcpStream;
     fn accept(&mut self) -> IoResult<TcpStream> {
         self.inner.accept().map(TcpStream::new)
     }
@@ -789,12 +790,12 @@ fn multiple_connect_serial_ip6() {
     #[test]
     fn multiple_connect_interleaved_greedy_schedule_ip4() {
         let addr = next_test_ip4();
-        static MAX: int = 10;
+        static MAX: isize = 10;
         let acceptor = TcpListener::bind(addr).listen();
 
         let _t = thread::spawn(move|| {
             let mut acceptor = acceptor;
-            for (i, stream) in acceptor.incoming().enumerate().take(MAX as uint) {
+            for (i, stream) in acceptor.incoming().enumerate().take(MAX as usize) {
                 // Start another task to handle the connection
                 let _t = thread::spawn(move|| {
                     let mut stream = stream;
@@ -808,7 +809,7 @@ fn multiple_connect_interleaved_greedy_schedule_ip4() {
 
         connect(0, addr);
 
-        fn connect(i: int, addr: SocketAddr) {
+        fn connect(i: isize, addr: SocketAddr) {
             if i == MAX { return }
 
             let _t = thread::spawn(move|| {
@@ -825,12 +826,12 @@ fn connect(i: int, addr: SocketAddr) {
     #[test]
     fn multiple_connect_interleaved_greedy_schedule_ip6() {
         let addr = next_test_ip6();
-        static MAX: int = 10;
+        static MAX: isize = 10;
         let acceptor = TcpListener::bind(addr).listen();
 
         let _t = thread::spawn(move|| {
             let mut acceptor = acceptor;
-            for (i, stream) in acceptor.incoming().enumerate().take(MAX as uint) {
+            for (i, stream) in acceptor.incoming().enumerate().take(MAX as usize) {
                 // Start another task to handle the connection
                 let _t = thread::spawn(move|| {
                     let mut stream = stream;
@@ -844,7 +845,7 @@ fn multiple_connect_interleaved_greedy_schedule_ip6() {
 
         connect(0, addr);
 
-        fn connect(i: int, addr: SocketAddr) {
+        fn connect(i: isize, addr: SocketAddr) {
             if i == MAX { return }
 
             let _t = thread::spawn(move|| {
@@ -860,13 +861,13 @@ fn connect(i: int, addr: SocketAddr) {
 
     #[test]
     fn multiple_connect_interleaved_lazy_schedule_ip4() {
-        static MAX: int = 10;
+        static MAX: isize = 10;
         let addr = next_test_ip4();
         let acceptor = TcpListener::bind(addr).listen();
 
         let _t = thread::spawn(move|| {
             let mut acceptor = acceptor;
-            for stream in acceptor.incoming().take(MAX as uint) {
+            for stream in acceptor.incoming().take(MAX as usize) {
                 // Start another task to handle the connection
                 let _t = thread::spawn(move|| {
                     let mut stream = stream;
@@ -880,7 +881,7 @@ fn multiple_connect_interleaved_lazy_schedule_ip4() {
 
         connect(0, addr);
 
-        fn connect(i: int, addr: SocketAddr) {
+        fn connect(i: isize, addr: SocketAddr) {
             if i == MAX { return }
 
             let _t = thread::spawn(move|| {
@@ -896,13 +897,13 @@ fn connect(i: int, addr: SocketAddr) {
 
     #[test]
     fn multiple_connect_interleaved_lazy_schedule_ip6() {
-        static MAX: int = 10;
+        static MAX: isize = 10;
         let addr = next_test_ip6();
         let acceptor = TcpListener::bind(addr).listen();
 
         let _t = thread::spawn(move|| {
             let mut acceptor = acceptor;
-            for stream in acceptor.incoming().take(MAX as uint) {
+            for stream in acceptor.incoming().take(MAX as usize) {
                 // Start another task to handle the connection
                 let _t = thread::spawn(move|| {
                     let mut stream = stream;
@@ -916,7 +917,7 @@ fn multiple_connect_interleaved_lazy_schedule_ip6() {
 
         connect(0, addr);
 
-        fn connect(i: int, addr: SocketAddr) {
+        fn connect(i: isize, addr: SocketAddr) {
             if i == MAX { return }
 
             let _t = thread::spawn(move|| {
index 3aa811974b3aa965364da836c355e9a5694a9516..196447d71efbf8ff598cf6fa4bb564365aa790b1 100644 (file)
@@ -73,7 +73,7 @@ pub fn bind<A: ToSocketAddr>(addr: A) -> IoResult<UdpSocket> {
 
     /// Receives data from the socket. On success, returns the number of bytes
     /// read and the address from whence the data came.
-    pub fn recv_from(&mut self, buf: &mut [u8]) -> IoResult<(uint, SocketAddr)> {
+    pub fn recv_from(&mut self, buf: &mut [u8]) -> IoResult<(usize, SocketAddr)> {
         self.inner.recv_from(buf)
     }
 
@@ -113,13 +113,13 @@ pub fn set_multicast_loop(&mut self, on: bool) -> IoResult<()> {
 
     /// Sets the multicast TTL
     #[unstable(feature = "io")]
-    pub fn set_multicast_ttl(&mut self, ttl: int) -> IoResult<()> {
+    pub fn set_multicast_ttl(&mut self, ttl: isize) -> IoResult<()> {
         self.inner.multicast_time_to_live(ttl)
     }
 
     /// Sets this socket's TTL
     #[unstable(feature = "io")]
-    pub fn set_ttl(&mut self, ttl: int) -> IoResult<()> {
+    pub fn set_ttl(&mut self, ttl: isize) -> IoResult<()> {
         self.inner.time_to_live(ttl)
     }
 
index 0b555e2f0ff7e9c5eed72f11e3f135cc6c71070e..26f2460047982eb3223604cfc173e40eb1e522e8 100644 (file)
@@ -100,7 +100,7 @@ fn clone(&self) -> PipeStream {
 }
 
 impl Reader for PipeStream {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         self.inner.read(buf)
     }
 }
index d7ede451fb8b79460b3916374ac59b4de9aad267..06940bf6860a409e8ebe3cf6a8ef865faa46eab7 100644 (file)
 
 /// Signal a process to exit, without forcibly killing it. Corresponds to
 /// SIGTERM on unix platforms.
-#[cfg(windows)] pub const PleaseExitSignal: int = 15;
+#[cfg(windows)] pub const PleaseExitSignal: isize = 15;
 /// Signal a process to exit immediately, forcibly killing it. Corresponds to
 /// SIGKILL on unix platforms.
-#[cfg(windows)] pub const MustDieSignal: int = 9;
+#[cfg(windows)] pub const MustDieSignal: isize = 9;
 /// Signal a process to exit, without forcibly killing it. Corresponds to
 /// SIGTERM on unix platforms.
-#[cfg(not(windows))] pub const PleaseExitSignal: int = libc::SIGTERM as int;
+#[cfg(not(windows))] pub const PleaseExitSignal: isize = libc::SIGTERM as isize;
 /// Signal a process to exit immediately, forcibly killing it. Corresponds to
 /// SIGKILL on unix platforms.
-#[cfg(not(windows))] pub const MustDieSignal: int = libc::SIGKILL as int;
+#[cfg(not(windows))] pub const MustDieSignal: isize = libc::SIGKILL as isize;
 
 /// Representation of a running or exited child process.
 ///
@@ -60,7 +60,7 @@
 ///
 /// # Examples
 ///
-/// ```should_fail
+/// ```should_panic
 /// # #![feature(old_io)]
 /// use std::old_io::*;
 ///
@@ -80,7 +80,7 @@ pub struct Process {
     exit_code: Option<ProcessExit>,
 
     /// Manually delivered signal
-    exit_signal: Option<int>,
+    exit_signal: Option<isize>,
 
     /// Deadline after which wait() will return
     deadline: u64,
@@ -186,8 +186,8 @@ pub struct Command {
     stdin: StdioContainer,
     stdout: StdioContainer,
     stderr: StdioContainer,
-    uid: Option<uint>,
-    gid: Option<uint>,
+    uid: Option<usize>,
+    gid: Option<usize>,
     detach: bool,
 }
 
@@ -321,14 +321,14 @@ pub fn stderr<'a>(&'a mut self, cfg: StdioContainer) -> &'a mut Command {
     /// the child process. Setting this value on windows will cause the spawn to
     /// fail. Failure in the `setuid` call on unix will also cause the spawn to
     /// fail.
-    pub fn uid<'a>(&'a mut self, id: uint) -> &'a mut Command {
+    pub fn uid<'a>(&'a mut self, id: usize) -> &'a mut Command {
         self.uid = Some(id);
         self
     }
 
     /// Similar to `uid`, but sets the group id of the child process. This has
     /// the same semantics as the `uid` field.
-    pub fn gid<'a>(&'a mut self, id: uint) -> &'a mut Command {
+    pub fn gid<'a>(&'a mut self, id: usize) -> &'a mut Command {
         self.gid = Some(id);
         self
     }
@@ -458,10 +458,10 @@ fn env(&self) -> Option<&EnvMap> {
     fn cwd(&self) -> Option<&CString> {
         self.cwd.as_ref()
     }
-    fn uid(&self) -> Option<uint> {
+    fn uid(&self) -> Option<usize> {
         self.uid.clone()
     }
-    fn gid(&self) -> Option<uint> {
+    fn gid(&self) -> Option<usize> {
         self.gid.clone()
     }
     fn detach(&self) -> bool {
@@ -507,10 +507,10 @@ pub enum StdioContainer {
 #[derive(PartialEq, Eq, Clone, Copy, Debug)]
 pub enum ProcessExit {
     /// Normal termination with an exit status.
-    ExitStatus(int),
+    ExitStatus(isize),
 
     /// Termination by signal, with the signal number.
-    ExitSignal(int),
+    ExitSignal(isize),
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -533,7 +533,7 @@ pub fn success(&self) -> bool {
 
     /// Checks whether this ProcessExit matches the given exit status.
     /// Termination by signal will never match an exit code.
-    pub fn matches_exit_status(&self, wanted: int) -> bool {
+    pub fn matches_exit_status(&self, wanted: isize) -> bool {
         *self == ExitStatus(wanted)
     }
 }
@@ -549,7 +549,7 @@ impl Process {
     /// process. Note, though, that on some platforms signals will continue to
     /// be successfully delivered if the child has exited, but not yet been
     /// reaped.
-    pub fn kill(id: libc::pid_t, signal: int) -> IoResult<()> {
+    pub fn kill(id: libc::pid_t, signal: isize) -> IoResult<()> {
         unsafe { ProcessImp::killpid(id, signal) }
     }
 
@@ -571,7 +571,7 @@ pub fn id(&self) -> libc::pid_t { self.handle.id() }
     /// # Errors
     ///
     /// If the signal delivery fails, the corresponding error is returned.
-    pub fn signal(&mut self, signal: int) -> IoResult<()> {
+    pub fn signal(&mut self, signal: isize) -> IoResult<()> {
         #[cfg(unix)] fn collect_status(p: &mut Process) {
             // On Linux (and possibly other unices), a process that has exited will
             // continue to accept signals because it is "defunct". The delivery of
@@ -888,8 +888,8 @@ fn uid_works() {
         use libc;
         let mut p = Command::new("/bin/sh")
                             .arg("-c").arg("true")
-                            .uid(unsafe { libc::getuid() as uint })
-                            .gid(unsafe { libc::getgid() as uint })
+                            .uid(unsafe { libc::getuid() as usize })
+                            .gid(unsafe { libc::getgid() as usize })
                             .spawn().unwrap();
         assert!(p.wait().unwrap().success());
     }
index 9dcb487cdb0df0ff78ac9c4948beffb2ad863249..e1037f26b7fcf575bf61f50a0905745125ceb6da 100644 (file)
@@ -35,7 +35,7 @@ fn flush(&mut self) -> IoResult<()> {
 }
 
 impl<R: Reader> Reader for IoResult<R> {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         match *self {
             Ok(ref mut reader) => reader.read(buf),
             Err(ref e) => Err(e.clone()),
@@ -58,7 +58,7 @@ fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()> {
     }
 }
 
-impl<T, A: Acceptor<T>, L: Listener<T, A>> Listener<T, A> for IoResult<L> {
+impl<A: Acceptor, L: Listener<A>> Listener<A> for IoResult<L> {
     fn listen(self) -> IoResult<A> {
         match self {
             Ok(listener) => listener.listen(),
@@ -67,8 +67,9 @@ fn listen(self) -> IoResult<A> {
     }
 }
 
-impl<T, A: Acceptor<T>> Acceptor<T> for IoResult<A> {
-    fn accept(&mut self) -> IoResult<T> {
+impl<A: Acceptor> Acceptor for IoResult<A> {
+    type Connection = A::Connection;
+    fn accept(&mut self) -> IoResult<A::Connection> {
         match *self {
             Ok(ref mut acceptor) => acceptor.accept(),
             Err(ref e) => Err(e.clone()),
index 90d270849114186f57d96fed9290e4c50b124feb..b4924c7b78b753112d6e58ff59b9b8872fe4c28c 100644 (file)
@@ -182,7 +182,7 @@ pub fn read_char(&mut self) -> IoResult<char> {
 }
 
 impl Reader for StdinReader {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         self.inner.lock().unwrap().0.read(buf)
     }
 
@@ -190,11 +190,11 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
     // read more than once and we don't want those calls to interleave (or
     // incur the costs of repeated locking).
 
-    fn read_at_least(&mut self, min: uint, buf: &mut [u8]) -> IoResult<uint> {
+    fn read_at_least(&mut self, min: usize, buf: &mut [u8]) -> IoResult<usize> {
         self.inner.lock().unwrap().0.read_at_least(min, buf)
     }
 
-    fn push_at_least(&mut self, min: uint, len: uint, buf: &mut Vec<u8>) -> IoResult<uint> {
+    fn push_at_least(&mut self, min: usize, len: usize, buf: &mut Vec<u8>) -> IoResult<usize> {
         self.inner.lock().unwrap().0.push_at_least(min, len, buf)
     }
 
@@ -202,11 +202,11 @@ fn read_to_end(&mut self) -> IoResult<Vec<u8>> {
         self.inner.lock().unwrap().0.read_to_end()
     }
 
-    fn read_le_uint_n(&mut self, nbytes: uint) -> IoResult<u64> {
+    fn read_le_uint_n(&mut self, nbytes: usize) -> IoResult<u64> {
         self.inner.lock().unwrap().0.read_le_uint_n(nbytes)
     }
 
-    fn read_be_uint_n(&mut self, nbytes: uint) -> IoResult<u64> {
+    fn read_be_uint_n(&mut self, nbytes: usize) -> IoResult<u64> {
         self.inner.lock().unwrap().0.read_be_uint_n(nbytes)
     }
 }
@@ -410,16 +410,16 @@ pub fn isatty(&self) -> bool {
 }
 
 impl Reader for StdReader {
-    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         let ret = match self.inner {
             TTY(ref mut tty) => {
                 // Flush the task-local stdout so that weird issues like a
                 // print!'d prompt not being shown until after the user hits
                 // enter.
                 flush();
-                tty.read(buf).map(|i| i as uint)
+                tty.read(buf).map(|i| i as usize)
             },
-            File(ref mut file) => file.read(buf).map(|i| i as uint),
+            File(ref mut file) => file.read(buf).map(|i| i as usize),
         };
         match ret {
             // When reading a piped stdin, libuv will return 0-length reads when
@@ -452,7 +452,7 @@ impl StdWriter {
     ///
     /// This function will return an error if the output stream is not actually
     /// connected to a TTY instance, or if querying the TTY instance fails.
-    pub fn winsize(&mut self) -> IoResult<(int, int)> {
+    pub fn winsize(&mut self) -> IoResult<(isize, isize)> {
         match self.inner {
             TTY(ref mut tty) => {
                 tty.get_winsize()
index c0f6ddaaef7cc3e7264ea3a465e6c34fcc72bff4..0a2cc517a0631096ed58ddc0b3a2e70fc0971b73 100644 (file)
@@ -12,7 +12,7 @@
 #![allow(deprecated)] // rand
 
 use env;
-use iter::{IteratorExt};
+use iter::Iterator;
 use old_io::{fs, IoError, IoErrorKind, IoResult};
 use old_io;
 use ops::Drop;
@@ -89,7 +89,7 @@ pub struct TempDir {
 // 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;
+const NUM_RAND_CHARS: usize = 12;
 
 impl TempDir {
     /// Attempts to make a temporary directory inside of `tmpdir` whose name
index 1f782b6f221802308f20d06f18086835396a9a76..604099f117884a5126a821af919607d57e2269e3 100644 (file)
@@ -22,7 +22,7 @@
 #[deprecated(since = "1.0.0", reason = "use std::io::Take")]
 #[unstable(feature = "old_io")]
 pub struct LimitReader<R> {
-    limit: uint,
+    limit: usize,
     inner: R
 }
 
@@ -32,7 +32,7 @@ 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> {
+    pub fn new(r: R, limit: usize) -> LimitReader<R> {
         LimitReader { limit: limit, inner: r }
     }
 
@@ -46,13 +46,13 @@ pub fn into_inner(self) -> R { self.inner }
     ///
     /// The reader may reach EOF after reading fewer bytes than indicated by
     /// this method if the underlying reader reaches EOF.
-    pub fn limit(&self) -> uint { self.limit }
+    pub fn limit(&self) -> usize { 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> {
+    fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> {
         if self.limit == 0 {
             return Err(old_io::standard_error(old_io::EndOfFile));
         }
@@ -80,7 +80,7 @@ fn fill_buf<'a>(&'a mut self) -> old_io::IoResult<&'a [u8]> {
         }
     }
 
-    fn consume(&mut self, amt: uint) {
+    fn consume(&mut self, amt: usize) {
         // Don't let callers reset the limit by passing an overlarge value
         let amt = cmp::min(amt, self.limit);
         self.limit -= amt;
@@ -112,7 +112,7 @@ fn write_all(&mut self, _buf: &[u8]) -> old_io::IoResult<()> { Ok(()) }
 #[unstable(feature = "old_io")]
 impl Reader for ZeroReader {
     #[inline]
-    fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> {
         buf.set_memory(0);
         Ok(buf.len())
     }
@@ -126,7 +126,7 @@ fn fill_buf<'a>(&'a mut self) -> old_io::IoResult<&'a [u8]> {
         Ok(&DATA)
     }
 
-    fn consume(&mut self, _amt: uint) {}
+    fn consume(&mut self, _amt: usize) {}
 }
 
 /// A `Reader` which is always at EOF, like /dev/null.
@@ -139,7 +139,7 @@ fn consume(&mut self, _amt: uint) {}
 #[unstable(feature = "old_io")]
 impl Reader for NullReader {
     #[inline]
-    fn read(&mut self, _buf: &mut [u8]) -> old_io::IoResult<uint> {
+    fn read(&mut self, _buf: &mut [u8]) -> old_io::IoResult<usize> {
         Err(old_io::standard_error(old_io::EndOfFile))
     }
 }
@@ -150,7 +150,7 @@ impl Buffer for NullReader {
     fn fill_buf<'a>(&'a mut self) -> old_io::IoResult<&'a [u8]> {
         Err(old_io::standard_error(old_io::EndOfFile))
     }
-    fn consume(&mut self, _amt: uint) {}
+    fn consume(&mut self, _amt: usize) {}
 }
 
 /// A `Writer` which multiplexes writes to a set of `Writer`s.
@@ -216,7 +216,7 @@ pub fn new(mut readers: I) -> ChainedReader<I, 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> {
+    fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> {
         loop {
             let err = match self.cur_reader {
                 Some(ref mut r) => {
@@ -269,7 +269,7 @@ 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> {
+    fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> {
         self.reader.read(buf).and_then(|len| {
             self.writer.write_all(&mut buf[..len]).map(|()| len)
         })
@@ -307,7 +307,7 @@ pub fn new(iter: T) -> IterReader<T> {
 
 impl<T: Iterator<Item=u8>> Reader for IterReader<T> {
     #[inline]
-    fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> {
+    fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> {
         let mut len = 0;
         for (slot, elt) in buf.iter_mut().zip(self.iter.by_ref()) {
             *slot = elt;
@@ -392,8 +392,8 @@ fn test_null_reader() {
 
     #[test]
     fn test_multi_writer() {
-        static mut writes: uint = 0;
-        static mut flushes: uint = 0;
+        static mut writes: usize = 0;
+        static mut flushes: usize = 0;
 
         struct TestWriter;
         impl Writer for TestWriter {
index 50bda04b5d0745c33ce30b2baab8b886e472923e..c405df2824e818bc4736c3d8b4e264d923f048d3 100644 (file)
@@ -70,7 +70,7 @@
 use ffi::CString;
 use clone::Clone;
 use fmt;
-use iter::IteratorExt;
+use iter::Iterator;
 use option::Option;
 use option::Option::{None, Some};
 use str;
index 0ab8612a7cb52eacc8ca7a5f65340876b94dfaec..bbc1756bee6321004625b2bd4c14a0d3ede76859 100644 (file)
@@ -16,7 +16,7 @@
 use hash;
 use old_io::Writer;
 use iter::{AdditiveIterator, Extend};
-use iter::{Iterator, IteratorExt, Map};
+use iter::{Iterator, Map};
 use marker::Sized;
 use option::Option::{self, Some, None};
 use result::Result::{self, Ok, Err};
@@ -37,7 +37,7 @@
 #[derive(Clone)]
 pub struct Path {
     repr: Vec<u8>, // assumed to never be empty or contain NULs
-    sepidx: Option<uint> // index of the final separator in repr
+    sepidx: Option<usize> // index of the final separator in repr
 }
 
 /// The standard path separator character
@@ -444,13 +444,13 @@ mod tests {
     use super::*;
 
     use clone::Clone;
-    use iter::IteratorExt;
     use option::Option::{self, Some, None};
     use old_path::GenericPath;
     use slice::AsSlice;
     use str::{self, Str};
     use string::ToString;
     use vec::Vec;
+    use iter::Iterator;
 
     macro_rules! t {
         (s: $path:expr, $exp:expr) => (
index 4f367e3052673eb839b7f32ff656588a2d627b01..bd67855bf1b8c45fbbe4d4a6932844c4d8f072c1 100644 (file)
@@ -21,7 +21,7 @@
 use hash;
 use old_io::Writer;
 use iter::{AdditiveIterator, Extend};
-use iter::{Iterator, IteratorExt, Map, repeat};
+use iter::{Iterator, Map, repeat};
 use mem;
 use option::Option::{self, Some, None};
 use result::Result::{self, Ok, Err};
@@ -81,7 +81,7 @@
 pub struct Path {
     repr: String, // assumed to never be empty
     prefix: Option<PathPrefix>,
-    sepidx: Option<uint> // index of the final separator in the non-prefix portion of repr
+    sepidx: Option<usize> // index of the final separator in the non-prefix portion of repr
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -749,7 +749,7 @@ fn normalize__(s: &str, prefix: Option<PathPrefix>) -> Option<String> {
                     if prefix.is_some() && comps.is_empty() {
                         match prefix.unwrap() {
                             DiskPrefix => {
-                                let len = prefix_len(prefix) + is_abs as uint;
+                                let len = prefix_len(prefix) + is_abs as usize;
                                 let mut s = String::from_str(&s[..len]);
                                 unsafe {
                                     let v = s.as_mut_vec();
@@ -764,7 +764,7 @@ fn normalize__(s: &str, prefix: Option<PathPrefix>) -> Option<String> {
                                 Some(s)
                             }
                             VerbatimDiskPrefix => {
-                                let len = prefix_len(prefix) + is_abs as uint;
+                                let len = prefix_len(prefix) + is_abs as usize;
                                 let mut s = String::from_str(&s[..len]);
                                 unsafe {
                                     let v = s.as_mut_vec();
@@ -838,7 +838,7 @@ fn update_sepidx(&mut self) {
         self.sepidx = idx.and_then(|x| if x < prefixlen { None } else { Some(x) });
     }
 
-    fn prefix_len(&self) -> uint {
+    fn prefix_len(&self) -> usize {
         prefix_len(self.prefix)
     }
 
@@ -847,7 +847,7 @@ fn prefix_len(&self) -> uint {
     // end is the length of the string, normally, or the index of the final character if it is
     // a non-semantic trailing separator in a verbatim string.
     // If the prefix is considered the separator, before and after are the same.
-    fn sepidx_or_prefix_len(&self) -> Option<(uint,uint,uint)> {
+    fn sepidx_or_prefix_len(&self) -> Option<(usize,usize,usize)> {
         match self.sepidx {
             None => match self.prefix_len() { 0 => None, x => Some((x,x,self.repr.len())) },
             Some(x) => {
@@ -973,16 +973,16 @@ pub fn is_sep_byte_verbatim(u: &u8) -> bool {
 /// Prefix types for Path
 #[derive(Copy, PartialEq, Clone, Debug)]
 pub enum PathPrefix {
-    /// Prefix `\\?\`, uint is the length of the following component
-    VerbatimPrefix(uint),
+    /// Prefix `\\?\`, usize is the length of the following component
+    VerbatimPrefix(usize),
     /// Prefix `\\?\UNC\`, uints are the lengths of the UNC components
-    VerbatimUNCPrefix(uint, uint),
+    VerbatimUNCPrefix(usize, usize),
     /// Prefix `\\?\C:\` (for any alphabetic character)
     VerbatimDiskPrefix,
-    /// Prefix `\\.\`, uint is the length of the following component
-    DeviceNSPrefix(uint),
+    /// Prefix `\\.\`, usize is the length of the following component
+    DeviceNSPrefix(usize),
     /// UNC prefix `\\server\share`, uints are the lengths of the server/share
-    UNCPrefix(uint, uint),
+    UNCPrefix(usize, usize),
     /// Prefix `C:` for any alphabetic character
     DiskPrefix
 }
@@ -1037,7 +1037,7 @@ fn parse_prefix<'a>(mut path: &'a str) -> Option<PathPrefix> {
     }
     return None;
 
-    fn parse_two_comps(mut path: &str, f: fn(char) -> bool) -> Option<(uint, uint)> {
+    fn parse_two_comps(mut path: &str, f: fn(char) -> bool) -> Option<(usize, usize)> {
         let idx_a = match path.find(f) {
             None => return None,
             Some(x) => x
@@ -1107,7 +1107,7 @@ fn prefix_is_verbatim(p: Option<PathPrefix>) -> bool {
     }
 }
 
-fn prefix_len(p: Option<PathPrefix>) -> uint {
+fn prefix_len(p: Option<PathPrefix>) -> usize {
     match p {
         None => 0,
         Some(VerbatimPrefix(x)) => 4 + x,
@@ -1126,7 +1126,7 @@ mod tests {
     use super::*;
 
     use clone::Clone;
-    use iter::IteratorExt;
+    use iter::Iterator;
     use option::Option::{self, Some, None};
     use old_path::GenericPath;
     use slice::AsSlice;
index 40aaea7aca0b796b98504c164bc8c35e373e393b..e19c734b8a3acc3646a8712c4ff83558d16389ea 100644 (file)
@@ -43,7 +43,7 @@
 use error::{FromError, Error};
 use ffi::{OsString, OsStr};
 use fmt;
-use iter::{Iterator, IteratorExt};
+use iter::Iterator;
 use libc::{c_void, c_int, c_char};
 use libc;
 use marker::{Copy, Send};
@@ -100,9 +100,9 @@ fn path2old(path: &path::Path) -> Path {
 }
 
 /// Get the number of cores available
-pub fn num_cpus() -> uint {
+pub fn num_cpus() -> usize {
     unsafe {
-        return rust_get_num_cpus() as uint;
+        return rust_get_num_cpus() as usize;
     }
 
     extern {
@@ -110,7 +110,7 @@ pub fn num_cpus() -> uint {
     }
 }
 
-pub const TMPBUF_SZ : uint = 1000;
+pub const TMPBUF_SZ : usize = 1000;
 
 /// Returns the current working directory as a `Path`.
 ///
@@ -592,7 +592,7 @@ pub fn last_os_error() -> String {
 /// Note that this is not synchronized against modifications of other threads.
 #[deprecated(since = "1.0.0", reason = "renamed to env::set_exit_status")]
 #[unstable(feature = "os")]
-pub fn set_exit_status(code: int) {
+pub fn set_exit_status(code: isize) {
     env::set_exit_status(code as i32)
 }
 
@@ -600,12 +600,12 @@ pub fn set_exit_status(code: int) {
 /// by calling `set_exit_status`.
 #[deprecated(since = "1.0.0", reason = "renamed to env::get_exit_status")]
 #[unstable(feature = "os")]
-pub fn get_exit_status() -> int {
+pub fn get_exit_status() -> isize {
     env::get_exit_status() as isize
 }
 
 #[cfg(target_os = "macos")]
-unsafe fn load_argc_and_argv(argc: int,
+unsafe fn load_argc_and_argv(argc: isize,
                              argv: *const *const c_char) -> Vec<Vec<u8>> {
     use ffi::CStr;
 
@@ -620,7 +620,7 @@ unsafe fn load_argc_and_argv(argc: int,
 #[cfg(target_os = "macos")]
 fn real_args_as_bytes() -> Vec<Vec<u8>> {
     unsafe {
-        let (argc, argv) = (*_NSGetArgc() as int,
+        let (argc, argv) = (*_NSGetArgc() as isize,
                             *_NSGetArgv() as *const *const c_char);
         load_argc_and_argv(argc, argv)
     }
@@ -670,7 +670,7 @@ fn real_args_as_bytes() -> Vec<Vec<u8>> {
         let info = objc_msgSend(klass, processInfoSel);
         let args = objc_msgSend(info, argumentsSel);
 
-        let cnt: int = mem::transmute(objc_msgSend(args, countSel));
+        let cnt: isize = mem::transmute(objc_msgSend(args, countSel));
         for i in 0..cnt {
             let tmp = objc_msgSend(args, objectAtSel, i);
             let utf_c_str: *const libc::c_char =
@@ -711,11 +711,11 @@ fn real_args() -> Vec<String> {
     let lpCmdLine = unsafe { GetCommandLineW() };
     let szArgList = unsafe { CommandLineToArgvW(lpCmdLine, lpArgCount) };
 
-    let args: Vec<_> = (0..nArgs as uint).map(|i| unsafe {
+    let args: Vec<_> = (0..nArgs as usize).map(|i| unsafe {
         // Determine the length of this argument.
-        let ptr = *szArgList.offset(i as int);
+        let ptr = *szArgList.offset(i as isize);
         let mut len = 0;
-        while *ptr.offset(len as int) != 0 { len += 1; }
+        while *ptr.offset(len as isize) != 0 { len += 1; }
 
         // Push it onto the list.
         let ptr = ptr as *const u16;
@@ -796,7 +796,7 @@ pub fn args_as_bytes() -> Vec<Vec<u8>> {
 /// Returns the page size of the current architecture in bytes.
 #[deprecated(since = "1.0.0", reason = "renamed to env::page_size")]
 #[unstable(feature = "os")]
-pub fn page_size() -> uint {
+pub fn page_size() -> usize {
     sys::os::page_size()
 }
 
@@ -810,7 +810,7 @@ pub fn page_size() -> uint {
 /// let it leave scope by accident if you want it to stick around.
 pub struct MemoryMap {
     data: *mut u8,
-    len: uint,
+    len: usize,
     kind: MemoryMapKind,
 }
 
@@ -846,9 +846,9 @@ pub enum MapOption {
     /// Create a memory mapping for a file with a given fd.
     #[cfg(not(windows))]
     MapFd(c_int),
-    /// When using `MapFd`, the start of the map is `uint` bytes from the start
+    /// When using `MapFd`, the start of the map is `usize` bytes from the start
     /// of the file.
-    MapOffset(uint),
+    MapOffset(usize),
     /// On POSIX, this can be used to specify the default flags passed to
     /// `mmap`. By default it uses `MAP_PRIVATE` and, if not using `MapFd`,
     /// `MAP_ANON`. This will override both of those. This is platform-specific
@@ -880,7 +880,7 @@ pub enum MapError {
     /// Not all platforms obey this, but this wrapper does.
     ErrZeroLength,
     /// Unrecognized error. The inner value is the unrecognized errno.
-    ErrUnknown(int),
+    ErrUnknown(isize),
     /// # The following are Windows-specific
     ///
     /// Unsupported combination of protection flags
@@ -940,7 +940,7 @@ fn description(&self) -> &str { "memory map error" }
 }
 
 // Round up `from` to be divisible by `to`
-fn round_up(from: uint, to: uint) -> uint {
+fn round_up(from: usize, to: usize) -> usize {
     let r = if from % to == 0 {
         from
     } else {
@@ -958,7 +958,7 @@ impl MemoryMap {
     /// Create a new mapping with the given `options`, at least `min_len` bytes
     /// long. `min_len` must be greater than zero; see the note on
     /// `ErrZeroLength`.
-    pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError> {
+    pub fn new(min_len: usize, options: &[MapOption]) -> Result<MemoryMap, MapError> {
         use libc::off_t;
 
         if min_len == 0 {
@@ -1002,7 +1002,7 @@ pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError>
                 libc::EINVAL => ErrUnaligned,
                 libc::ENODEV => ErrNoMapSupport,
                 libc::ENOMEM => ErrNoMem,
-                code => ErrUnknown(code as int)
+                code => ErrUnknown(code as isize)
             })
         } else {
             Ok(MemoryMap {
@@ -1019,7 +1019,7 @@ pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError>
 
     /// Granularity that the offset or address must be for `MapOffset` and
     /// `MapAddr` respectively.
-    pub fn granularity() -> uint {
+    pub fn granularity() -> usize {
         env::page_size()
     }
 }
@@ -1040,7 +1040,7 @@ fn drop(&mut self) {
 #[cfg(windows)]
 impl MemoryMap {
     /// Create a new mapping with the given `options`, at least `min_len` bytes long.
-    pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError> {
+    pub fn new(min_len: usize, options: &[MapOption]) -> Result<MemoryMap, MapError> {
         use libc::types::os::arch::extra::{LPVOID, DWORD, SIZE_T, HANDLE};
 
         let mut lpAddress: LPVOID = ptr::null_mut();
@@ -1048,7 +1048,7 @@ pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError>
         let mut writable = false;
         let mut executable = false;
         let mut handle: HANDLE = libc::INVALID_HANDLE_VALUE;
-        let mut offset: uint = 0;
+        let mut offset: usize = 0;
         let len = round_up(min_len, env::page_size());
 
         for &o in options {
@@ -1083,7 +1083,7 @@ pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError>
                                    libc::MEM_COMMIT | libc::MEM_RESERVE,
                                    flProtect)
             };
-            match r as uint {
+            match r as usize {
                 0 => Err(ErrVirtualAlloc(errno())),
                 _ => Ok(MemoryMap {
                    data: r as *mut u8,
@@ -1119,7 +1119,7 @@ pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError>
                                             ((len as u64) >> 32) as DWORD,
                                             (offset & 0xffff_ffff) as DWORD,
                                             0);
-                match r as uint {
+                match r as usize {
                     0 => Err(ErrMapViewOfFile(errno())),
                     _ => Ok(MemoryMap {
                        data: r as *mut u8,
@@ -1133,13 +1133,13 @@ pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError>
 
     /// Granularity of MapAddr() and MapOffset() parameter values.
     /// This may be greater than the value returned by page_size().
-    pub fn granularity() -> uint {
+    pub fn granularity() -> usize {
         use mem;
         unsafe {
             let mut info = mem::zeroed();
             libc::GetSystemInfo(&mut info);
 
-            return info.dwAllocationGranularity as uint;
+            return info.dwAllocationGranularity as usize;
         }
     }
 }
@@ -1178,7 +1178,7 @@ impl MemoryMap {
     /// Returns the pointer to the memory created or modified by this map.
     pub fn data(&self) -> *mut u8 { self.data }
     /// Returns the number of bytes this map applies to.
-    pub fn len(&self) -> uint { self.len }
+    pub fn len(&self) -> usize { self.len }
     /// Returns the type of mapping this represents.
     pub fn kind(&self) -> MemoryMapKind { self.kind }
 }
index 50f79967f555ef86a707fcd4f96d798f9eb2daa9..58d3ae9f7cfabcff1c975fa162ac2cb6303e88da 100644 (file)
@@ -1038,23 +1038,16 @@ pub fn into_os_string(self) -> OsString {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> From<&'a Path> for PathBuf {
-    fn from(s: &'a Path) -> PathBuf {
-        s.to_path_buf()
+impl<'a, T: ?Sized + AsRef<OsStr>> From<&'a T> for PathBuf {
+    fn from(s: &'a T) -> PathBuf {
+        PathBuf::from(s.as_ref().to_os_string())
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> From<&'a str> for PathBuf {
-    fn from(s: &'a str) -> PathBuf {
-        PathBuf::from(OsString::from(s))
-    }
-}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> From<&'a String> for PathBuf {
-    fn from(s: &'a String) -> PathBuf {
-        PathBuf::from(OsString::from(s))
+impl From<OsString> for PathBuf {
+    fn from(s: OsString) -> PathBuf {
+        PathBuf { inner: s }
     }
 }
 
@@ -1065,27 +1058,6 @@ fn from(s: String) -> PathBuf {
     }
 }
 
-#[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> From<&'a OsStr> for PathBuf {
-    fn from(s: &'a OsStr) -> PathBuf {
-        PathBuf::from(OsString::from(s))
-    }
-}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> From<&'a OsString> for PathBuf {
-    fn from(s: &'a OsString) -> PathBuf {
-        PathBuf::from(s.to_os_string())
-    }
-}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-impl From<OsString> for PathBuf {
-    fn from(s: OsString) -> PathBuf {
-        PathBuf { inner: s }
-    }
-}
-
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<P: AsRef<Path>> iter::FromIterator<P> for PathBuf {
     fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> PathBuf {
index 6e12ac1a226592b864354231aed50703fd0f8e4f..297eccb9f769831da5a804e564c328b932f63cec 100644 (file)
@@ -36,7 +36,7 @@
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(no_inline)] pub use iter::ExactSizeIterator;
 #[stable(feature = "rust1", since = "1.0.0")]
-#[doc(no_inline)] pub use iter::{Iterator, IteratorExt, Extend};
+#[doc(no_inline)] pub use iter::{Iterator, Extend};
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(no_inline)] pub use option::Option::{self, Some, None};
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -51,6 +51,3 @@
 #[doc(no_inline)] pub use string::{String, ToString};
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(no_inline)] pub use vec::Vec;
-
-// FIXME(#23454) should these be here?
-#[doc(no_inline)] pub use num::wrapping::{Wrapping, WrappingOps};
index 6a36ecefcf4466ef1bf033f7d651f2e46e8b6e59..b4bd513e8f027ce7c7514ce3ce0c3e613970fbb2 100644 (file)
@@ -37,7 +37,7 @@
 ///
 /// # Examples
 ///
-/// ```should_fail
+/// ```should_panic
 /// # #![feature(process)]
 ///
 /// use std::process::Command;
index 656ca980624dcdcf9302693bbbbb11ed3e4cbae0..fad57323d34baf6e443addf71ea9688067214bbf 100644 (file)
@@ -64,7 +64,7 @@
 //!
 //! let mut rng = rand::thread_rng();
 //! if rng.gen() { // random bool
-//!     println!("int: {}, uint: {}", rng.gen::<int>(), rng.gen::<uint>())
+//!     println!("isize: {}, usize: {}", rng.gen::<isize>(), rng.gen::<usize>())
 //! }
 //! ```
 //!
 //! }
 //!
 //! // Run a single simulation of the Monty Hall problem.
-//! fn simulate<R: Rng>(random_door: &Range<uint>, rng: &mut R) -> SimulationResult {
+//! fn simulate<R: Rng>(random_door: &Range<usize>, rng: &mut R) -> SimulationResult {
 //!     let car = random_door.ind_sample(rng);
 //!
 //!     // This is our initial choice
 //!
 //! // Returns the door the game host opens given our choice and knowledge of
 //! // where the car is. The game host will never open the door with the car.
-//! fn game_host_open<R: Rng>(car: uint, choice: uint, rng: &mut R) -> uint {
+//! fn game_host_open<R: Rng>(car: usize, choice: usize, rng: &mut R) -> usize {
 //!     let choices = free_doors(&[car, choice]);
 //!     rand::sample(rng, choices.into_iter(), 1)[0]
 //! }
 //!
 //! // Returns the door we switch to, given our current choice and
 //! // the open door. There will only be one valid door.
-//! fn switch_door(choice: uint, open: uint) -> uint {
+//! fn switch_door(choice: usize, open: usize) -> usize {
 //!     free_doors(&[choice, open])[0]
 //! }
 //!
-//! fn free_doors(blocked: &[uint]) -> Vec<uint> {
+//! fn free_doors(blocked: &[usize]) -> Vec<usize> {
 //!     (0..3).filter(|x| !blocked.contains(x)).collect()
 //! }
 //!
 use cell::RefCell;
 use clone::Clone;
 use old_io::IoResult;
-use iter::{Iterator, IteratorExt};
+use iter::Iterator;
 use mem;
 use rc::Rc;
 use result::Result::{Ok, Err};
@@ -336,7 +336,7 @@ pub struct ThreadRng {
 
 /// Retrieve the lazily-initialized thread-local random number
 /// generator, seeded by the system. Intended to be used in method
-/// chaining style, e.g. `thread_rng().gen::<int>()`.
+/// chaining style, e.g. `thread_rng().gen::<isize>()`.
 ///
 /// The RNG provided will reseed itself from the operating system
 /// after generating a certain amount of randomness.
@@ -556,14 +556,14 @@ fn test_choose() {
         let mut r = thread_rng();
         assert_eq!(r.choose(&[1, 1, 1]).cloned(), Some(1));
 
-        let v: &[int] = &[];
+        let v: &[isize] = &[];
         assert_eq!(r.choose(v), None);
     }
 
     #[test]
     fn test_shuffle() {
         let mut r = thread_rng();
-        let empty: &mut [int] = &mut [];
+        let empty: &mut [isize] = &mut [];
         r.shuffle(empty);
         let mut one = [1];
         r.shuffle(&mut one);
@@ -583,7 +583,7 @@ fn test_shuffle() {
     #[test]
     fn test_thread_rng() {
         let mut r = thread_rng();
-        r.gen::<int>();
+        r.gen::<isize>();
         let mut v = [1, 1, 1];
         r.shuffle(&mut v);
         let b: &[_] = &[1, 1, 1];
@@ -594,12 +594,12 @@ fn test_thread_rng() {
     #[test]
     fn test_random() {
         // not sure how to test this aside from just getting some values
-        let _n : uint = random();
+        let _n : usize = random();
         let _f : f32 = random();
         let _o : Option<Option<i8>> = random();
         let _many : ((),
-                     (uint,
-                      int,
+                     (usize,
+                      isize,
                       Option<(u32, (bool,))>),
                      (u8, i8, u16, i16, u32, i32, u64, i64),
                      (f32, (f64, (f64,)))) = random();
@@ -611,7 +611,7 @@ fn test_sample() {
         let max_val = 100;
 
         let mut r = thread_rng();
-        let vals = (min_val..max_val).collect::<Vec<int>>();
+        let vals = (min_val..max_val).collect::<Vec<isize>>();
         let small_sample = sample(&mut r, vals.iter(), 5);
         let large_sample = sample(&mut r, vals.iter(), vals.len() + 5);
 
@@ -625,7 +625,7 @@ fn test_sample() {
 
     #[test]
     fn test_std_rng_seeded() {
-        let s = thread_rng().gen_iter::<uint>().take(256).collect::<Vec<uint>>();
+        let s = thread_rng().gen_iter::<usize>().take(256).collect::<Vec<usize>>();
         let mut ra: StdRng = SeedableRng::from_seed(&*s);
         let mut rb: StdRng = SeedableRng::from_seed(&*s);
         assert!(order::equals(ra.gen_ascii_chars().take(100),
@@ -634,7 +634,7 @@ fn test_std_rng_seeded() {
 
     #[test]
     fn test_std_rng_reseed() {
-        let s = thread_rng().gen_iter::<uint>().take(256).collect::<Vec<uint>>();
+        let s = thread_rng().gen_iter::<usize>().take(256).collect::<Vec<usize>>();
         let mut r: StdRng = SeedableRng::from_seed(&*s);
         let string1 = r.gen_ascii_chars().take(100).collect::<String>();
 
@@ -662,10 +662,10 @@ fn rand_xorshift(b: &mut Bencher) {
         let mut rng: XorShiftRng = OsRng::new().unwrap().gen();
         b.iter(|| {
             for _ in 0..RAND_BENCH_N {
-                rng.gen::<uint>();
+                rng.gen::<usize>();
             }
         });
-        b.bytes = size_of::<uint>() as u64 * RAND_BENCH_N;
+        b.bytes = size_of::<usize>() as u64 * RAND_BENCH_N;
     }
 
     #[bench]
@@ -673,10 +673,10 @@ fn rand_isaac(b: &mut Bencher) {
         let mut rng: IsaacRng = OsRng::new().unwrap().gen();
         b.iter(|| {
             for _ in 0..RAND_BENCH_N {
-                rng.gen::<uint>();
+                rng.gen::<usize>();
             }
         });
-        b.bytes = size_of::<uint>() as u64 * RAND_BENCH_N;
+        b.bytes = size_of::<usize>() as u64 * RAND_BENCH_N;
     }
 
     #[bench]
@@ -684,10 +684,10 @@ fn rand_isaac64(b: &mut Bencher) {
         let mut rng: Isaac64Rng = OsRng::new().unwrap().gen();
         b.iter(|| {
             for _ in 0..RAND_BENCH_N {
-                rng.gen::<uint>();
+                rng.gen::<usize>();
             }
         });
-        b.bytes = size_of::<uint>() as u64 * RAND_BENCH_N;
+        b.bytes = size_of::<usize>() as u64 * RAND_BENCH_N;
     }
 
     #[bench]
@@ -695,16 +695,16 @@ fn rand_std(b: &mut Bencher) {
         let mut rng = StdRng::new().unwrap();
         b.iter(|| {
             for _ in 0..RAND_BENCH_N {
-                rng.gen::<uint>();
+                rng.gen::<usize>();
             }
         });
-        b.bytes = size_of::<uint>() as u64 * RAND_BENCH_N;
+        b.bytes = size_of::<usize>() as u64 * RAND_BENCH_N;
     }
 
     #[bench]
     fn rand_shuffle_100(b: &mut Bencher) {
         let mut rng = weak_rng();
-        let x : &mut[uint] = &mut [1; 100];
+        let x : &mut[usize] = &mut [1; 100];
         b.iter(|| {
             rng.shuffle(x);
         })
index d3a8fa864fce39a0594f26cba18ffaba1dcb1cbb..ece6867ddcaa1e33f3d8639868cb992eecfc1be6 100644 (file)
@@ -29,7 +29,7 @@
 /// use std::old_io::MemReader;
 ///
 /// let mut rng = reader::ReaderRng::new(MemReader::new(vec!(1,2,3,4,5,6,7,8)));
-/// println!("{:x}", rng.gen::<uint>());
+/// println!("{:x}", rng.gen::<usize>());
 /// ```
 pub struct ReaderRng<R> {
     reader: R
index 9da63405346e8470af85431ab163989ae475c499..428bcaa49f7d918d2c0f8f25c763a5e11b866fe5 100644 (file)
@@ -23,7 +23,7 @@
 use vec::Vec;
 
 /// One-time global initialization.
-pub unsafe fn init(argc: int, argv: *const *const u8) { imp::init(argc, argv) }
+pub unsafe fn init(argc: isize, argv: *const *const u8) { imp::init(argc, argv) }
 
 /// One-time global cleanup.
 pub unsafe fn cleanup() { imp::cleanup() }
@@ -54,10 +54,10 @@ mod imp {
 
     use sync::{StaticMutex, MUTEX_INIT};
 
-    static mut GLOBAL_ARGS_PTR: uint = 0;
+    static mut GLOBAL_ARGS_PTR: usize = 0;
     static LOCK: StaticMutex = MUTEX_INIT;
 
-    pub unsafe fn init(argc: int, argv: *const *const u8) {
+    pub unsafe fn init(argc: isize, argv: *const *const u8) {
         let args = load_argc_and_argv(argc, argv);
         put(args);
     }
@@ -146,7 +146,7 @@ mod imp {
     use core::prelude::*;
     use vec::Vec;
 
-    pub unsafe fn init(_argc: int, _argv: *const *const u8) {
+    pub unsafe fn init(_argc: isize, _argv: *const *const u8) {
     }
 
     pub fn cleanup() {
index 3063d9d942a28c3c3a8edd3b23ec2f1c431dadf4..b77699105646d3c009c451122f0fa4d87f5b7224 100644 (file)
@@ -64,25 +64,25 @@ pub enum _Unwind_Reason_Code {
 pub type _Unwind_Word = libc::uintptr_t;
 
 #[cfg(target_arch = "x86")]
-pub const unwinder_private_data_size: uint = 5;
+pub const unwinder_private_data_size: usize = 5;
 
 #[cfg(target_arch = "x86_64")]
-pub const unwinder_private_data_size: uint = 6;
+pub const unwinder_private_data_size: usize = 6;
 
 #[cfg(all(target_arch = "arm", not(target_os = "ios")))]
-pub const unwinder_private_data_size: uint = 20;
+pub const unwinder_private_data_size: usize = 20;
 
 #[cfg(all(target_arch = "arm", target_os = "ios"))]
-pub const unwinder_private_data_size: uint = 5;
+pub const unwinder_private_data_size: usize = 5;
 
 #[cfg(target_arch = "aarch64")]
-pub const unwinder_private_data_size: uint = 2;
+pub const unwinder_private_data_size: usize = 2;
 
 #[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
-pub const unwinder_private_data_size: uint = 2;
+pub const unwinder_private_data_size: usize = 2;
 
 #[cfg(target_arch = "powerpc")]
-pub const unwinder_private_data_size: uint = 2;
+pub const unwinder_private_data_size: usize = 2;
 
 #[repr(C)]
 pub struct _Unwind_Exception {
index 497076cc6ac34795e763897cdee911c6f9fba400..696c7960c3e6f4e11b71aa268c932c47ceabf6c2 100644 (file)
 
 /// The default error code of the rust runtime if the main thread panics instead
 /// of exiting cleanly.
-pub const DEFAULT_ERROR_CODE: int = 101;
+pub const DEFAULT_ERROR_CODE: isize = 101;
 
 #[cfg(any(windows, android))]
-const OS_DEFAULT_STACK_ESTIMATE: uint = 1 << 20;
+const OS_DEFAULT_STACK_ESTIMATE: usize = 1 << 20;
 #[cfg(all(unix, not(android)))]
-const OS_DEFAULT_STACK_ESTIMATE: uint = 2 * (1 << 20);
+const OS_DEFAULT_STACK_ESTIMATE: usize = 2 * (1 << 20);
 
 #[cfg(not(test))]
 #[lang = "start"]
-fn lang_start(main: *const u8, argc: int, argv: *const *const u8) -> int {
+fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize {
     use prelude::v1::*;
 
     use mem;
@@ -68,13 +68,13 @@ fn lang_start(main: *const u8, argc: int, argv: *const *const u8) -> int {
     use thread::Thread;
 
     let something_around_the_top_of_the_stack = 1;
-    let addr = &something_around_the_top_of_the_stack as *const _ as *const int;
-    let my_stack_top = addr as uint;
+    let addr = &something_around_the_top_of_the_stack as *const _ as *const isize;
+    let my_stack_top = addr as usize;
 
     // FIXME #11359 we just assume that this thread has a stack of a
     // certain size, and estimate that there's at most 20KB of stack
     // frames above our current position.
-    const TWENTY_KB: uint = 20000;
+    const TWENTY_KB: usize = 20000;
 
     // saturating-add to sidestep overflow
     let top_plus_spill = if usize::MAX - TWENTY_KB < my_stack_top {
index 3ee3954ed64343c477afa61cb2963d691be9ebea..e4927bbd3d274c5436b4bbeee00457e092f94a3e 100644 (file)
@@ -78,12 +78,12 @@ struct Exception {
     cause: Option<Box<Any + Send + 'static>>,
 }
 
-pub type Callback = fn(msg: &(Any + Send), file: &'static str, line: uint);
+pub type Callback = fn(msg: &(Any + Send), file: &'static str, line: usize);
 
 // Variables used for invoking callbacks when a thread starts to unwind.
 //
 // For more information, see below.
-const MAX_CALLBACKS: uint = 16;
+const MAX_CALLBACKS: usize = 16;
 static CALLBACKS: [atomic::AtomicUsize; MAX_CALLBACKS] =
         [atomic::ATOMIC_USIZE_INIT, atomic::ATOMIC_USIZE_INIT,
          atomic::ATOMIC_USIZE_INIT, atomic::ATOMIC_USIZE_INIT,
@@ -176,7 +176,7 @@ fn rust_panic(cause: Box<Any + Send + 'static>) -> ! {
         };
         let exception_param = boxed::into_raw(exception) as *mut uw::_Unwind_Exception;
         let error = uw::_Unwind_RaiseException(exception_param);
-        rtabort!("Could not unwind stack, error = {}", error as int)
+        rtabort!("Could not unwind stack, error = {}", error as isize)
     }
 
     extern fn exception_cleanup(_unwind_code: uw::_Unwind_Reason_Code,
@@ -484,7 +484,7 @@ extern "C" fn inner(
 /// Entry point of panic from the libcore crate.
 #[lang = "panic_fmt"]
 pub extern fn rust_begin_unwind(msg: fmt::Arguments,
-                                file: &'static str, line: uint) -> ! {
+                                file: &'static str, line: usize) -> ! {
     begin_unwind_fmt(msg, &(file, line))
 }
 
@@ -496,7 +496,7 @@ extern "C" fn inner(
 /// the actual formatting into this shared place.
 #[inline(never)] #[cold]
 #[stable(since = "1.0.0", feature = "rust1")]
-pub fn begin_unwind_fmt(msg: fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
+pub fn begin_unwind_fmt(msg: fmt::Arguments, file_line: &(&'static str, usize)) -> ! {
     use fmt::Write;
 
     // We do two allocations here, unfortunately. But (a) they're
@@ -512,7 +512,7 @@ pub fn begin_unwind_fmt(msg: fmt::Arguments, file_line: &(&'static str, uint)) -
 /// This is the entry point of unwinding for panic!() and assert!().
 #[inline(never)] #[cold] // avoid code bloat at the call sites as much as possible
 #[stable(since = "1.0.0", feature = "rust1")]
-pub fn begin_unwind<M: Any + Send>(msg: M, file_line: &(&'static str, uint)) -> ! {
+pub fn begin_unwind<M: Any + Send>(msg: M, file_line: &(&'static str, usize)) -> ! {
     // Note that this should be the only allocation performed in this code path.
     // Currently this means that panic!() on OOM will invoke this code path,
     // but then again we're not really ready for panic on OOM anyway. If
@@ -535,7 +535,7 @@ pub fn begin_unwind<M: Any + Send>(msg: M, file_line: &(&'static str, uint)) ->
 /// }` from ~1900/3700 (-O/no opts) to 180/590.
 #[inline(never)] #[cold] // this is the slow path, please never inline this
 fn begin_unwind_inner(msg: Box<Any + Send>,
-                      file_line: &(&'static str, uint)) -> ! {
+                      file_line: &(&'static str, usize)) -> ! {
     // Make sure the default failure handler is registered before we look at the
     // callbacks. We also use a raw sys-based mutex here instead of a
     // `std::sync` one as accessing TLS can cause weird recursive problems (and
index cf627ca254809c95cedafc730dba3d5ef942640a..5a482fbb50fec1d85f37cb50d13bedabd07f0ac9 100644 (file)
@@ -43,7 +43,7 @@ pub fn limit_thread_creation_due_to_osx_and_valgrind() -> bool {
     (cfg!(target_os="macos")) && running_on_valgrind()
 }
 
-pub fn min_stack() -> uint {
+pub fn min_stack() -> usize {
     static MIN: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT;
     match MIN.load(Ordering::SeqCst) {
         0 => {}
index 3c7fecb75153a9913473ff92f45cb835181a9497..b2afe28fed46d5d30352caedbf7a00611490d365 100644 (file)
@@ -38,7 +38,7 @@
 
 use self::FutureState::*;
 use sync::mpsc::{Receiver, channel};
-use thunk::{Thunk};
+use thunk::Thunk;
 use thread;
 
 /// A type encapsulating the result of a computation which may not be complete
index eb421fe55a4d093ad80337808a5b61333232bd11..b2b87bb6c44a757bcbd2014da07a40d7921e3b44 100644 (file)
@@ -1109,13 +1109,13 @@ fn smoke() {
 
     #[test]
     fn drop_full() {
-        let (tx, _rx) = channel::<Box<int>>();
+        let (tx, _rx) = channel::<Box<isize>>();
         tx.send(box 1).unwrap();
     }
 
     #[test]
     fn drop_full_shared() {
-        let (tx, _rx) = channel::<Box<int>>();
+        let (tx, _rx) = channel::<Box<isize>>();
         drop(tx.clone());
         drop(tx.clone());
         tx.send(box 1).unwrap();
@@ -1454,7 +1454,7 @@ fn oneshot_multi_thread_recv_close_stress() {
     #[test]
     fn oneshot_multi_thread_send_recv_stress() {
         for _ in 0..stress_factor() {
-            let (tx, rx) = channel::<Box<int>>();
+            let (tx, rx) = channel::<Box<isize>>();
             let _t = thread::spawn(move|| {
                 tx.send(box 10).unwrap();
             });
@@ -1631,7 +1631,7 @@ fn smoke() {
 
     #[test]
     fn drop_full() {
-        let (tx, _rx) = sync_channel::<Box<int>>(1);
+        let (tx, _rx) = sync_channel::<Box<isize>>(1);
         tx.send(box 1).unwrap();
     }
 
index f3930a8a5d632756f52f93d61a1e7b91a47a1939..80cbd0761638ff398bc2f4c79a69e7822161b7f7 100644 (file)
@@ -398,7 +398,7 @@ pub fn can_recv(&mut self) -> bool {
     }
 
     // increment the count on the channel (used for selection)
-    fn bump(&mut self, amt: int) -> int {
+    fn bump(&mut self, amt: isize) -> isize {
         match self.cnt.fetch_add(amt, Ordering::SeqCst) {
             DISCONNECTED => {
                 self.cnt.store(DISCONNECTED, Ordering::SeqCst);
index 6e94db6d7530c027a569bacbee71a9bb0b9c9401..a79ffaa0860e3673f349396ff880394358d8740b 100644 (file)
@@ -551,7 +551,7 @@ fn test_rw_arc_access_in_unwind() {
         let arc2 = arc.clone();
         let _ = thread::spawn(move|| -> () {
             struct Unwinder {
-                i: Arc<RwLock<int>>,
+                i: Arc<RwLock<isize>>,
             }
             impl Drop for Unwinder {
                 fn drop(&mut self) {
index 059cce572459e61767cf4ae7235f96d6b7c77923..be521095aa95f9fa1aeaaa46d457eb1dd2c7d584 100644 (file)
@@ -44,7 +44,7 @@
 /// sem.release();
 /// ```
 pub struct Semaphore {
-    lock: Mutex<int>,
+    lock: Mutex<isize>,
     cvar: Condvar,
 }
 
@@ -60,7 +60,7 @@ impl Semaphore {
     /// The count specified can be thought of as a number of resources, and a
     /// call to `acquire` or `access` will block until at least one resource is
     /// available. It is valid to initialize a semaphore with a negative count.
-    pub fn new(count: int) -> Semaphore {
+    pub fn new(count: isize) -> Semaphore {
         Semaphore {
             lock: Mutex::new(count),
             cvar: Condvar::new(),
index c42a755b444d8605e3f8dc79a34e5199befc7f77..cd118b3c9eefe609394f3d71c902691aaa2ade98 100644 (file)
 use io;
 
 #[cfg(target_pointer_width = "64")]
-pub const HEX_WIDTH: uint = 18;
+pub const HEX_WIDTH: usize = 18;
 
 #[cfg(target_pointer_width = "32")]
-pub const HEX_WIDTH: uint = 10;
+pub const HEX_WIDTH: usize = 10;
 
 // All rust symbols are in theory lists of "::"-separated identifiers. Some
 // assemblers, however, can't handle these characters in symbol names. To get
@@ -57,7 +57,7 @@ pub fn demangle(writer: &mut Write, s: &str) -> io::Result<()> {
             let mut i = 0;
             for c in chars.by_ref() {
                 if c.is_numeric() {
-                    i = i * 10 + c as uint - '0' as uint;
+                    i = i * 10 + c as usize - '0' as usize;
                 } else {
                     break
                 }
@@ -86,7 +86,7 @@ pub fn demangle(writer: &mut Write, s: &str) -> io::Result<()> {
             while rest.char_at(0).is_numeric() {
                 rest = &rest[1..];
             }
-            let i: uint = inner[.. (inner.len() - rest.len())].parse().unwrap();
+            let i: usize = inner[.. (inner.len() - rest.len())].parse().unwrap();
             inner = &rest[i..];
             rest = &rest[..i];
             while rest.len() > 0 {
index 10077dfd1b86517f5bcf64ddb37c5bf6eef73178..34a58f6c83aa73002f781376b81c0bc049f211a5 100644 (file)
@@ -51,7 +51,7 @@ pub struct Helper<M:Send> {
     pub chan: UnsafeCell<*mut Sender<M>>,
 
     /// OS handle used to wake up a blocked helper thread
-    pub signal: UnsafeCell<uint>,
+    pub signal: UnsafeCell<usize>,
 
     /// Flag if this helper thread has booted and been initialized yet.
     pub initialized: UnsafeCell<bool>,
@@ -96,11 +96,11 @@ pub fn boot<T, F>(&'static self, f: F, helper: fn(helper_signal::signal, Receive
     {
         unsafe {
             let _guard = self.lock.lock().unwrap();
-            if *self.chan.get() as uint == 0 {
+            if *self.chan.get() as usize == 0 {
                 let (tx, rx) = channel();
                 *self.chan.get() = boxed::into_raw(box tx);
                 let (receive, send) = helper_signal::new();
-                *self.signal.get() = send as uint;
+                *self.signal.get() = send as usize;
 
                 let receive = RaceBox(receive);
 
@@ -114,7 +114,7 @@ pub fn boot<T, F>(&'static self, f: F, helper: fn(helper_signal::signal, Receive
 
                 let _ = rt::at_exit(move || { self.shutdown() });
                 *self.initialized.get() = true;
-            } else if *self.chan.get() as uint == 1 {
+            } else if *self.chan.get() as usize == 1 {
                 panic!("cannot continue usage after shutdown");
             }
         }
@@ -130,8 +130,8 @@ pub fn send(&'static self, msg: M) {
             // Must send and *then* signal to ensure that the child receives the
             // message. Otherwise it could wake up and go to sleep before we
             // send the message.
-            assert!(*self.chan.get() as uint != 0);
-            assert!(*self.chan.get() as uint != 1,
+            assert!(*self.chan.get() as usize != 0);
+            assert!(*self.chan.get() as usize != 1,
                     "cannot continue usage after shutdown");
             (**self.chan.get()).send(msg).unwrap();
             helper_signal::signal(*self.signal.get() as helper_signal::signal);
@@ -146,7 +146,7 @@ fn shutdown(&'static self) {
             let mut guard = self.lock.lock().unwrap();
 
             let ptr = *self.chan.get();
-            if ptr as uint == 1 {
+            if ptr as usize == 1 {
                 panic!("cannot continue usage after shutdown");
             }
             // Close the channel by destroying it
index 29c05b1e0d883c50be44e7db9c2830f3bb9b2d0f..d2e2f1044d612aef23ce8d7c5a7d0a78ee952680 100644 (file)
@@ -14,6 +14,7 @@
 use prelude::v1::*;
 use sys::{last_error, retry};
 use ffi::CString;
+#[allow(deprecated)] // Int
 use num::Int;
 
 #[allow(deprecated)]
@@ -56,7 +57,7 @@ pub fn timeout(desc: &'static str) -> IoError {
 }
 
 #[allow(deprecated)]
-pub fn short_write(n: uint, desc: &'static str) -> IoError {
+pub fn short_write(n: usize, desc: &'static str) -> IoError {
     IoError {
         kind: if n == 0 { old_io::TimedOut } else { old_io::ShortWrite(n) },
         desc: desc,
@@ -84,7 +85,7 @@ pub fn mkerr_libc<T: Int>(ret: T) -> IoResult<()> {
 }
 
 pub fn keep_going<F>(data: &[u8], mut f: F) -> i64 where
-    F: FnMut(*const u8, uint) -> i64,
+    F: FnMut(*const u8, usize) -> i64,
 {
     let origamt = data.len();
     let mut data = data.as_ptr();
@@ -94,8 +95,8 @@ pub fn keep_going<F>(data: &[u8], mut f: F) -> i64 where
         if ret == 0 {
             break
         } else if ret != -1 {
-            amt -= ret as uint;
-            data = unsafe { data.offset(ret as int) };
+            amt -= ret as usize;
+            data = unsafe { data.offset(ret as isize) };
         } else {
             return ret;
         }
@@ -134,7 +135,7 @@ pub trait ProcessConfig<K: BytesContainer, V: BytesContainer> {
     fn args(&self) -> &[CString];
     fn env(&self) -> Option<&collections::HashMap<K, V>>;
     fn cwd(&self) -> Option<&CString>;
-    fn uid(&self) -> Option<uint>;
-    fn gid(&self) -> Option<uint>;
+    fn uid(&self) -> Option<usize>;
+    fn gid(&self) -> Option<usize>;
     fn detach(&self) -> bool;
 }
index 96b72b42e5400bb20af2c494a0f3cec93c0e04ed..1a0ee17904a243afa274b3b6347b2e43145feb22 100644 (file)
@@ -148,7 +148,7 @@ pub fn getsockopt<T: Copy>(fd: sock_t, opt: libc::c_int,
         if ret != 0 {
             Err(last_net_error())
         } else {
-            assert!(len as uint == mem::size_of::<T>());
+            assert!(len as usize == mem::size_of::<T>());
             Ok(slot)
         }
     }
@@ -170,14 +170,14 @@ pub fn sockname(fd: sock_t,
             return Err(last_net_error())
         }
     }
-    return sockaddr_to_addr(&storage, len as uint);
+    return sockaddr_to_addr(&storage, len as usize);
 }
 
 pub fn sockaddr_to_addr(storage: &libc::sockaddr_storage,
-                        len: uint) -> IoResult<SocketAddr> {
+                        len: usize) -> IoResult<SocketAddr> {
     match storage.ss_family as libc::c_int {
         libc::AF_INET => {
-            assert!(len as uint >= mem::size_of::<libc::sockaddr_in>());
+            assert!(len as usize >= mem::size_of::<libc::sockaddr_in>());
             let storage: &libc::sockaddr_in = unsafe {
                 mem::transmute(storage)
             };
@@ -192,7 +192,7 @@ pub fn sockaddr_to_addr(storage: &libc::sockaddr_storage,
             })
         }
         libc::AF_INET6 => {
-            assert!(len as uint >= mem::size_of::<libc::sockaddr_in6>());
+            assert!(len as usize >= mem::size_of::<libc::sockaddr_in6>());
             let storage: &libc::sockaddr_in6 = unsafe {
                 mem::transmute(storage)
             };
@@ -283,13 +283,13 @@ pub fn get_host_addresses(host: Option<&str>, servname: Option<&str>,
     while !rp.is_null() {
         unsafe {
             let addr = try!(sockaddr_to_addr(mem::transmute((*rp).ai_addr),
-                                             (*rp).ai_addrlen as uint));
+                                             (*rp).ai_addrlen as usize));
             addrs.push(addrinfo::Info {
                 address: addr,
-                family: (*rp).ai_family as uint,
+                family: (*rp).ai_family as usize,
                 socktype: None,
                 protocol: None,
-                flags: (*rp).ai_flags as uint
+                flags: (*rp).ai_flags as usize
             });
 
             rp = (*rp).ai_next as *mut libc::addrinfo;
@@ -312,7 +312,7 @@ fn getnameinfo(sa: *const libc::sockaddr, salen: libc::socklen_t,
         flags: c_int) -> c_int;
 }
 
-const NI_MAXHOST: uint = 1025;
+const NI_MAXHOST: usize = 1025;
 
 pub fn get_address_name(addr: IpAddr) -> Result<String, IoError> {
     let addr = SocketAddr{ip: addr, port: 0};
@@ -393,7 +393,7 @@ pub fn get_address_name(addr: IpAddr) -> Result<String, IoError> {
 // [1] http://twistedmatrix.com/pipermail/twisted-commits/2012-April/034692.html
 // [2] http://stackoverflow.com/questions/19819198/does-send-msg-dontwait
 
-pub fn read<T, L, R>(fd: sock_t, deadline: u64, mut lock: L, mut read: R) -> IoResult<uint> where
+pub fn read<T, L, R>(fd: sock_t, deadline: u64, mut lock: L, mut read: R) -> IoResult<usize> where
     L: FnMut() -> T,
     R: FnMut(bool) -> libc::c_int,
 {
@@ -431,7 +431,7 @@ pub fn read<T, L, R>(fd: sock_t, deadline: u64, mut lock: L, mut read: R) -> IoR
     match ret {
         0 => Err(sys_common::eof()),
         n if n < 0 => Err(last_net_error()),
-        n => Ok(n as uint)
+        n => Ok(n as usize)
     }
 }
 
@@ -440,9 +440,9 @@ pub fn write<T, L, W>(fd: sock_t,
                       buf: &[u8],
                       write_everything: bool,
                       mut lock: L,
-                      mut write: W) -> IoResult<uint> where
+                      mut write: W) -> IoResult<usize> where
     L: FnMut() -> T,
-    W: FnMut(bool, *const u8, uint) -> i64,
+    W: FnMut(bool, *const u8, usize) -> i64,
 {
     let mut ret = -1;
     let mut written = 0;
@@ -454,7 +454,7 @@ pub fn write<T, L, W>(fd: sock_t,
             });
         } else {
             ret = retry(|| { write(false, buf.as_ptr(), buf.len()) });
-            if ret > 0 { written = ret as uint; }
+            if ret > 0 { written = ret as usize; }
         }
     }
 
@@ -483,7 +483,7 @@ pub fn write<T, L, W>(fd: sock_t,
             match retry(|| write(deadline.is_some(), ptr, len)) {
                 -1 if wouldblock() => {}
                 -1 => return Err(last_net_error()),
-                n => { written += n as uint; }
+                n => { written += n as usize; }
             }
         }
         ret = 0;
@@ -513,8 +513,8 @@ pub fn connect_timeout(fd: sock_t,
         // If the connection is in progress, then we need to wait for it to
         // finish (with a timeout). The current strategy for doing this is
         // to use select() with a timeout.
-        -1 if os::errno() as int == INPROGRESS as int ||
-              os::errno() as int == WOULDBLOCK as int => {
+        -1 if os::errno() as isize == INPROGRESS as isize ||
+              os::errno() as isize == WOULDBLOCK as isize => {
             let mut set: c::fd_set = unsafe { mem::zeroed() };
             c::fd_set(&mut set, fd);
             match await(fd, &mut set, timeout_ms) {
@@ -686,7 +686,7 @@ pub fn set_nodelay(&mut self, nodelay: bool) -> IoResult<()> {
                    nodelay as libc::c_int)
     }
 
-    pub fn set_keepalive(&mut self, seconds: Option<uint>) -> IoResult<()> {
+    pub fn set_keepalive(&mut self, seconds: Option<usize>) -> IoResult<()> {
         let ret = setsockopt(self.fd(), libc::SOL_SOCKET, libc::SO_KEEPALIVE,
                              seconds.is_some() as libc::c_int);
         match seconds {
@@ -696,18 +696,18 @@ pub fn set_keepalive(&mut self, seconds: Option<uint>) -> IoResult<()> {
     }
 
     #[cfg(any(target_os = "macos", target_os = "ios"))]
-    fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> {
+    fn set_tcp_keepalive(&mut self, seconds: usize) -> IoResult<()> {
         setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPALIVE,
                    seconds as libc::c_int)
     }
     #[cfg(any(target_os = "freebsd",
               target_os = "dragonfly"))]
-    fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> {
+    fn set_tcp_keepalive(&mut self, seconds: usize) -> IoResult<()> {
         setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPIDLE,
                    seconds as libc::c_int)
     }
     #[cfg(target_os = "openbsd")]
-    fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> {
+    fn set_tcp_keepalive(&mut self, seconds: usize) -> IoResult<()> {
         setsockopt(self.fd(), libc::IPPROTO_TCP, libc::SO_KEEPALIVE,
                    seconds as libc::c_int)
     }
@@ -716,7 +716,7 @@ fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> {
                   target_os = "freebsd",
                   target_os = "dragonfly",
                   target_os = "openbsd")))]
-    fn set_tcp_keepalive(&mut self, _seconds: uint) -> IoResult<()> {
+    fn set_tcp_keepalive(&mut self, _seconds: usize) -> IoResult<()> {
         Ok(())
     }
 
@@ -733,7 +733,7 @@ fn lock_nonblocking<'a>(&'a self) -> Guard<'a> {
         ret
     }
 
-    pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    pub fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         let fd = self.fd();
         let dolock = || self.lock_nonblocking();
         let doread = |nb| unsafe {
@@ -749,7 +749,7 @@ pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
     pub fn write(&mut self, buf: &[u8]) -> IoResult<()> {
         let fd = self.fd();
         let dolock = || self.lock_nonblocking();
-        let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
+        let dowrite = |nb: bool, buf: *const u8, len: usize| unsafe {
             let flags = if nb {c::MSG_DONTWAIT} else {0};
             libc::send(fd,
                        buf as *const _,
@@ -876,7 +876,7 @@ pub fn socket_name(&mut self) -> IoResult<SocketAddr> {
         sockname(self.fd(), libc::getsockname)
     }
 
-    pub fn recv_from(&mut self, buf: &mut [u8]) -> IoResult<(uint, SocketAddr)> {
+    pub fn recv_from(&mut self, buf: &mut [u8]) -> IoResult<(usize, SocketAddr)> {
         let fd = self.fd();
         let mut storage: libc::sockaddr_storage = unsafe { mem::zeroed() };
         let storagep = &mut storage as *mut _ as *mut libc::sockaddr;
@@ -893,7 +893,7 @@ pub fn recv_from(&mut self, buf: &mut [u8]) -> IoResult<(uint, SocketAddr)> {
                            storagep,
                            &mut addrlen) as libc::c_int
         }));
-        Ok((n as uint, sockaddr_to_addr(&storage, addrlen as uint).unwrap()))
+        Ok((n as usize, sockaddr_to_addr(&storage, addrlen as usize).unwrap()))
     }
 
     pub fn send_to(&mut self, buf: &[u8], dst: SocketAddr) -> IoResult<()> {
@@ -903,7 +903,7 @@ pub fn send_to(&mut self, buf: &[u8], dst: SocketAddr) -> IoResult<()> {
 
         let fd = self.fd();
         let dolock = || self.lock_nonblocking();
-        let dowrite = |nb, buf: *const u8, len: uint| unsafe {
+        let dowrite = |nb, buf: *const u8, len: usize| unsafe {
             let flags = if nb {c::MSG_DONTWAIT} else {0};
             libc::sendto(fd,
                          buf as *const libc::c_void,
@@ -939,11 +939,11 @@ pub fn leave_multicast(&mut self, multi: IpAddr) -> IoResult<()> {
         }
     }
 
-    pub fn multicast_time_to_live(&mut self, ttl: int) -> IoResult<()> {
+    pub fn multicast_time_to_live(&mut self, ttl: isize) -> IoResult<()> {
         setsockopt(self.fd(), libc::IPPROTO_IP, libc::IP_MULTICAST_TTL,
                    ttl as libc::c_int)
     }
-    pub fn time_to_live(&mut self, ttl: int) -> IoResult<()> {
+    pub fn time_to_live(&mut self, ttl: isize) -> IoResult<()> {
         setsockopt(self.fd(), libc::IPPROTO_IP, libc::IP_TTL, ttl as libc::c_int)
     }
 
index 8c428275ccf6d782c9a4314eaf75814beb45481a..8dc3407db77a20f27b51818ddd6dec3c0d40c7b4 100644 (file)
@@ -46,7 +46,7 @@
 // corresponding prolog, decision was taken to disable segmented
 // stack support on iOS.
 
-pub const RED_ZONE: uint = 20 * 1024;
+pub const RED_ZONE: usize = 20 * 1024;
 
 /// This function is invoked from rust's current __morestack function. Segmented
 /// stacks are currently not enabled as segmented stacks, but rather one giant
 // On all other platforms both variants behave identically.
 
 #[inline(always)]
-pub unsafe fn record_os_managed_stack_bounds(stack_lo: uint, _stack_hi: uint) {
+pub unsafe fn record_os_managed_stack_bounds(stack_lo: usize, _stack_hi: usize) {
     record_sp_limit(stack_lo + RED_ZONE);
 }
 
@@ -136,31 +136,31 @@ pub unsafe fn record_os_managed_stack_bounds(stack_lo: uint, _stack_hi: uint) {
 /// would be unfortunate for the functions themselves to trigger a morestack
 /// invocation (if they were an actual function call).
 #[inline(always)]
-pub unsafe fn record_sp_limit(limit: uint) {
+pub unsafe fn record_sp_limit(limit: usize) {
     return target_record_sp_limit(limit);
 
     // x86-64
     #[cfg(all(target_arch = "x86_64",
               any(target_os = "macos", target_os = "ios")))]
     #[inline(always)]
-    unsafe fn target_record_sp_limit(limit: uint) {
+    unsafe fn target_record_sp_limit(limit: usize) {
         asm!("movq $$0x60+90*8, %rsi
               movq $0, %gs:(%rsi)" :: "r"(limit) : "rsi" : "volatile")
     }
     #[cfg(all(target_arch = "x86_64", target_os = "linux"))] #[inline(always)]
-    unsafe fn target_record_sp_limit(limit: uint) {
+    unsafe fn target_record_sp_limit(limit: usize) {
         asm!("movq $0, %fs:112" :: "r"(limit) :: "volatile")
     }
     #[cfg(all(target_arch = "x86_64", target_os = "windows"))] #[inline(always)]
-    unsafe fn target_record_sp_limit(_: uint) {
+    unsafe fn target_record_sp_limit(_: usize) {
     }
     #[cfg(all(target_arch = "x86_64", target_os = "freebsd"))] #[inline(always)]
-    unsafe fn target_record_sp_limit(limit: uint) {
+    unsafe fn target_record_sp_limit(limit: usize) {
         asm!("movq $0, %fs:24" :: "r"(limit) :: "volatile")
     }
     #[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))]
     #[inline(always)]
-    unsafe fn target_record_sp_limit(limit: uint) {
+    unsafe fn target_record_sp_limit(limit: usize) {
         asm!("movq $0, %fs:32" :: "r"(limit) :: "volatile")
     }
 
@@ -168,18 +168,18 @@ unsafe fn target_record_sp_limit(limit: uint) {
     #[cfg(all(target_arch = "x86",
               any(target_os = "macos", target_os = "ios")))]
     #[inline(always)]
-    unsafe fn target_record_sp_limit(limit: uint) {
+    unsafe fn target_record_sp_limit(limit: usize) {
         asm!("movl $$0x48+90*4, %eax
               movl $0, %gs:(%eax)" :: "r"(limit) : "eax" : "volatile")
     }
     #[cfg(all(target_arch = "x86",
               any(target_os = "linux", target_os = "freebsd")))]
     #[inline(always)]
-    unsafe fn target_record_sp_limit(limit: uint) {
+    unsafe fn target_record_sp_limit(limit: usize) {
         asm!("movl $0, %gs:48" :: "r"(limit) :: "volatile")
     }
     #[cfg(all(target_arch = "x86", target_os = "windows"))] #[inline(always)]
-    unsafe fn target_record_sp_limit(_: uint) {
+    unsafe fn target_record_sp_limit(_: usize) {
     }
 
     // mips, arm - Some brave soul can port these to inline asm, but it's over
@@ -188,7 +188,7 @@ unsafe fn target_record_sp_limit(_: uint) {
               target_arch = "mipsel",
               all(target_arch = "arm", not(target_os = "ios"))))]
     #[inline(always)]
-    unsafe fn target_record_sp_limit(limit: uint) {
+    unsafe fn target_record_sp_limit(limit: usize) {
         use libc::c_void;
         return record_sp_limit(limit as *const c_void);
         extern {
@@ -205,7 +205,7 @@ unsafe fn target_record_sp_limit(limit: uint) {
               all(target_arch = "arm", target_os = "ios"),
               target_os = "bitrig",
               target_os = "openbsd"))]
-    unsafe fn target_record_sp_limit(_: uint) {
+    unsafe fn target_record_sp_limit(_: usize) {
     }
 }
 
@@ -218,38 +218,38 @@ unsafe fn target_record_sp_limit(_: uint) {
 /// As with the setter, this function does not have a __morestack header and can
 /// therefore be called in a "we're out of stack" situation.
 #[inline(always)]
-pub unsafe fn get_sp_limit() -> uint {
+pub unsafe fn get_sp_limit() -> usize {
     return target_get_sp_limit();
 
     // x86-64
     #[cfg(all(target_arch = "x86_64",
               any(target_os = "macos", target_os = "ios")))]
     #[inline(always)]
-    unsafe fn target_get_sp_limit() -> uint {
+    unsafe fn target_get_sp_limit() -> usize {
         let limit;
         asm!("movq $$0x60+90*8, %rsi
               movq %gs:(%rsi), $0" : "=r"(limit) :: "rsi" : "volatile");
         return limit;
     }
     #[cfg(all(target_arch = "x86_64", target_os = "linux"))] #[inline(always)]
-    unsafe fn target_get_sp_limit() -> uint {
+    unsafe fn target_get_sp_limit() -> usize {
         let limit;
         asm!("movq %fs:112, $0" : "=r"(limit) ::: "volatile");
         return limit;
     }
     #[cfg(all(target_arch = "x86_64", target_os = "windows"))] #[inline(always)]
-    unsafe fn target_get_sp_limit() -> uint {
+    unsafe fn target_get_sp_limit() -> usize {
         return 1024;
     }
     #[cfg(all(target_arch = "x86_64", target_os = "freebsd"))] #[inline(always)]
-    unsafe fn target_get_sp_limit() -> uint {
+    unsafe fn target_get_sp_limit() -> usize {
         let limit;
         asm!("movq %fs:24, $0" : "=r"(limit) ::: "volatile");
         return limit;
     }
     #[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))]
     #[inline(always)]
-    unsafe fn target_get_sp_limit() -> uint {
+    unsafe fn target_get_sp_limit() -> usize {
         let limit;
         asm!("movq %fs:32, $0" : "=r"(limit) ::: "volatile");
         return limit;
@@ -259,7 +259,7 @@ unsafe fn target_get_sp_limit() -> uint {
     #[cfg(all(target_arch = "x86",
               any(target_os = "macos", target_os = "ios")))]
     #[inline(always)]
-    unsafe fn target_get_sp_limit() -> uint {
+    unsafe fn target_get_sp_limit() -> usize {
         let limit;
         asm!("movl $$0x48+90*4, %eax
               movl %gs:(%eax), $0" : "=r"(limit) :: "eax" : "volatile");
@@ -268,13 +268,13 @@ unsafe fn target_get_sp_limit() -> uint {
     #[cfg(all(target_arch = "x86",
               any(target_os = "linux", target_os = "freebsd")))]
     #[inline(always)]
-    unsafe fn target_get_sp_limit() -> uint {
+    unsafe fn target_get_sp_limit() -> usize {
         let limit;
         asm!("movl %gs:48, $0" : "=r"(limit) ::: "volatile");
         return limit;
     }
     #[cfg(all(target_arch = "x86", target_os = "windows"))] #[inline(always)]
-    unsafe fn target_get_sp_limit() -> uint {
+    unsafe fn target_get_sp_limit() -> usize {
         return 1024;
     }
 
@@ -284,9 +284,9 @@ unsafe fn target_get_sp_limit() -> uint {
               target_arch = "mipsel",
               all(target_arch = "arm", not(target_os = "ios"))))]
     #[inline(always)]
-    unsafe fn target_get_sp_limit() -> uint {
+    unsafe fn target_get_sp_limit() -> usize {
         use libc::c_void;
-        return get_sp_limit() as uint;
+        return get_sp_limit() as usize;
         extern {
             fn get_sp_limit() -> *const c_void;
         }
@@ -305,7 +305,7 @@ unsafe fn target_get_sp_limit() -> uint {
               target_os = "bitrig",
               target_os = "openbsd"))]
     #[inline(always)]
-    unsafe fn target_get_sp_limit() -> uint {
+    unsafe fn target_get_sp_limit() -> usize {
         1024
     }
 }
index 90526b8f4f318faa941d26c8cdd9be788e2be001..22cb59433713043dbaf2a3409072e147e13901c5 100644 (file)
@@ -18,7 +18,7 @@
 use thread::LocalKeyState;
 
 struct ThreadInfo {
-    stack_guard: uint,
+    stack_guard: usize,
     thread: Thread,
 }
 
@@ -47,11 +47,11 @@ pub fn current_thread() -> Thread {
     ThreadInfo::with(|info| info.thread.clone())
 }
 
-pub fn stack_guard() -> uint {
+pub fn stack_guard() -> usize {
     ThreadInfo::with(|info| info.stack_guard)
 }
 
-pub fn set(stack_guard: uint, thread: Thread) {
+pub fn set(stack_guard: usize, thread: Thread) {
     THREAD_INFO.with(|c| assert!(c.borrow().is_none()));
     THREAD_INFO.with(move |c| *c.borrow_mut() = Some(ThreadInfo{
         stack_guard: stack_guard,
index 5e2a138fa63bacb208d23d83b9e6cba0159c84b2..5995d7ac10f73d7b3270c9ab22f3303d20905c37 100644 (file)
@@ -178,7 +178,7 @@ unsafe fn key(&self) -> imp::Key {
         }
     }
 
-    unsafe fn lazy_init(&self) -> uint {
+    unsafe fn lazy_init(&self) -> usize {
         // POSIX allows the key created here to be 0, but the compare_and_swap
         // below relies on using 0 as a sentinel value to check who won the
         // race to set the shared TLS key. As far as I know, there is no
@@ -197,9 +197,9 @@ unsafe fn lazy_init(&self) -> uint {
             key2
         };
         assert!(key != 0);
-        match self.inner.key.compare_and_swap(0, key as uint, Ordering::SeqCst) {
+        match self.inner.key.compare_and_swap(0, key as usize, Ordering::SeqCst) {
             // The CAS succeeded, so we've created the actual key
-            0 => key as uint,
+            0 => key as usize,
             // If someone beat us to the punch, use their key instead
             n => { imp::destroy(key); n }
         }
@@ -261,8 +261,8 @@ fn smoke() {
         assert!(k2.get().is_null());
         k1.set(1 as *mut _);
         k2.set(2 as *mut _);
-        assert_eq!(k1.get() as uint, 1);
-        assert_eq!(k2.get() as uint, 2);
+        assert_eq!(k1.get() as usize, 1);
+        assert_eq!(k2.get() as usize, 2);
     }
 
     #[test]
@@ -275,8 +275,8 @@ fn statik() {
             assert!(K2.get().is_null());
             K1.set(1 as *mut _);
             K2.set(2 as *mut _);
-            assert_eq!(K1.get() as uint, 1);
-            assert_eq!(K2.get() as uint, 2);
+            assert_eq!(K1.get() as usize, 1);
+            assert_eq!(K2.get() as usize, 2);
         }
     }
 }
index 9f3dae34c7a4bff3a127111110fa955d335748e3..987a12293da50c0a465cb43c9d3037b76117301f 100644 (file)
@@ -37,6 +37,7 @@
 use hash::{Hash, Hasher};
 use iter::{FromIterator, IntoIterator};
 use mem;
+#[allow(deprecated)] // Int
 use num::Int;
 use ops;
 use slice;
@@ -158,7 +159,7 @@ pub fn new() -> Wtf8Buf {
 
     /// Create an new, empty WTF-8 string with pre-allocated capacity for `n` bytes.
     #[inline]
-    pub fn with_capacity(n: uint) -> Wtf8Buf {
+    pub fn with_capacity(n: usize) -> Wtf8Buf {
         Wtf8Buf { bytes: Vec::with_capacity(n) }
     }
 
@@ -214,7 +215,7 @@ fn push_code_point_unchecked(&mut self, code_point: CodePoint) {
             // Attempt to not use an intermediate buffer by just pushing bytes
             // directly onto this string.
             let slice = slice::from_raw_parts_mut(
-                self.bytes.as_mut_ptr().offset(cur_len as int),
+                self.bytes.as_mut_ptr().offset(cur_len as isize),
                 4
             );
             let used = encode_utf8_raw(code_point.value, mem::transmute(slice))
@@ -234,15 +235,15 @@ pub fn as_slice(&self) -> &Wtf8 {
     ///
     /// # Panics
     ///
-    /// Panics if the new capacity overflows `uint`.
+    /// Panics if the new capacity overflows `usize`.
     #[inline]
-    pub fn reserve(&mut self, additional: uint) {
+    pub fn reserve(&mut self, additional: usize) {
         self.bytes.reserve(additional)
     }
 
     /// Returns the number of bytes that this string buffer can hold without reallocating.
     #[inline]
-    pub fn capacity(&self) -> uint {
+    pub fn capacity(&self) -> usize {
         self.bytes.capacity()
     }
 
@@ -313,7 +314,7 @@ pub fn push(&mut self, code_point: CodePoint) {
     /// Panics if `new_len` > current length,
     /// or if `new_len` is not a code point boundary.
     #[inline]
-    pub fn truncate(&mut self, new_len: uint) {
+    pub fn truncate(&mut self, new_len: usize) {
         assert!(is_code_point_boundary(self, new_len));
         self.bytes.truncate(new_len)
     }
@@ -344,8 +345,8 @@ pub fn into_string_lossy(mut self) -> String {
                 Some((surrogate_pos, _)) => {
                     pos = surrogate_pos + 3;
                     slice::bytes::copy_memory(
+                        UTF8_REPLACEMENT_CHARACTER,
                         &mut self.bytes[surrogate_pos .. pos],
-                        UTF8_REPLACEMENT_CHARACTER
                     );
                 },
                 None => return unsafe { String::from_utf8_unchecked(self.bytes) }
@@ -463,7 +464,7 @@ pub fn from_str(value: &str) -> &Wtf8 {
 
     /// Return the length, in WTF-8 bytes.
     #[inline]
-    pub fn len(&self) -> uint {
+    pub fn len(&self) -> usize {
         self.bytes.len()
     }
 
@@ -474,7 +475,7 @@ pub fn len(&self) -> uint {
     ///
     /// Panics if `position` is beyond the end of the string.
     #[inline]
-    pub fn ascii_byte_at(&self, position: uint) -> u8 {
+    pub fn ascii_byte_at(&self, position: usize) -> u8 {
         match self.bytes[position] {
             ascii_byte @ 0x00 ... 0x7F => ascii_byte,
             _ => 0xFF
@@ -488,7 +489,7 @@ pub fn ascii_byte_at(&self, position: uint) -> u8 {
     /// Panics if `position` is not at a code point boundary,
     /// or is beyond the end of the string.
     #[inline]
-    pub fn code_point_at(&self, position: uint) -> CodePoint {
+    pub fn code_point_at(&self, position: usize) -> CodePoint {
         let (code_point, _) = self.code_point_range_at(position);
         code_point
     }
@@ -501,7 +502,7 @@ pub fn code_point_at(&self, position: uint) -> CodePoint {
     /// Panics if `position` is not at a code point boundary,
     /// or is beyond the end of the string.
     #[inline]
-    pub fn code_point_range_at(&self, position: uint) -> (CodePoint, uint) {
+    pub fn code_point_range_at(&self, position: usize) -> (CodePoint, usize) {
         let (c, n) = char_range_at_raw(&self.bytes, position);
         (CodePoint { value: c }, n)
     }
@@ -570,7 +571,7 @@ pub fn encode_wide(&self) -> EncodeWide {
     }
 
     #[inline]
-    fn next_surrogate(&self, mut pos: uint) -> Option<(uint, u16)> {
+    fn next_surrogate(&self, mut pos: usize) -> Option<(usize, u16)> {
         let mut iter = self.bytes[pos..].iter();
         loop {
             let b = match iter.next() {
@@ -634,30 +635,6 @@ fn initial_trail_surrogate(&self) -> Option<u16> {
 ///
 /// Panics when `begin` and `end` do not point to code point boundaries,
 /// or point beyond the end of the string.
-#[cfg(stage0)]
-impl ops::Index<ops::Range<usize>> for Wtf8 {
-    type Output = Wtf8;
-
-    #[inline]
-    fn index(&self, range: &ops::Range<usize>) -> &Wtf8 {
-        // is_code_point_boundary checks that the index is in [0, .len()]
-        if range.start <= range.end &&
-           is_code_point_boundary(self, range.start) &&
-           is_code_point_boundary(self, range.end) {
-            unsafe { slice_unchecked(self, range.start, range.end) }
-        } else {
-            slice_error_fail(self, range.start, range.end)
-        }
-    }
-}
-
-/// Return a slice of the given string for the byte range [`begin`..`end`).
-///
-/// # Panics
-///
-/// Panics when `begin` and `end` do not point to code point boundaries,
-/// or point beyond the end of the string.
-#[cfg(not(stage0))]
 impl ops::Index<ops::Range<usize>> for Wtf8 {
     type Output = Wtf8;
 
@@ -680,28 +657,6 @@ fn index(&self, range: ops::Range<usize>) -> &Wtf8 {
 ///
 /// Panics when `begin` is not at a code point boundary,
 /// or is beyond the end of the string.
-#[cfg(stage0)]
-impl ops::Index<ops::RangeFrom<usize>> for Wtf8 {
-    type Output = Wtf8;
-
-    #[inline]
-    fn index(&self, range: &ops::RangeFrom<usize>) -> &Wtf8 {
-        // is_code_point_boundary checks that the index is in [0, .len()]
-        if is_code_point_boundary(self, range.start) {
-            unsafe { slice_unchecked(self, range.start, self.len()) }
-        } else {
-            slice_error_fail(self, range.start, self.len())
-        }
-    }
-}
-
-/// Return a slice of the given string from byte `begin` to its end.
-///
-/// # Panics
-///
-/// Panics when `begin` is not at a code point boundary,
-/// or is beyond the end of the string.
-#[cfg(not(stage0))]
 impl ops::Index<ops::RangeFrom<usize>> for Wtf8 {
     type Output = Wtf8;
 
@@ -722,28 +677,6 @@ fn index(&self, range: ops::RangeFrom<usize>) -> &Wtf8 {
 ///
 /// Panics when `end` is not at a code point boundary,
 /// or is beyond the end of the string.
-#[cfg(stage0)]
-impl ops::Index<ops::RangeTo<usize>> for Wtf8 {
-    type Output = Wtf8;
-
-    #[inline]
-    fn index(&self, range: &ops::RangeTo<usize>) -> &Wtf8 {
-        // is_code_point_boundary checks that the index is in [0, .len()]
-        if is_code_point_boundary(self, range.end) {
-            unsafe { slice_unchecked(self, 0, range.end) }
-        } else {
-            slice_error_fail(self, 0, range.end)
-        }
-    }
-}
-
-/// Return a slice of the given string from its beginning to byte `end`.
-///
-/// # Panics
-///
-/// Panics when `end` is not at a code point boundary,
-/// or is beyond the end of the string.
-#[cfg(not(stage0))]
 impl ops::Index<ops::RangeTo<usize>> for Wtf8 {
     type Output = Wtf8;
 
@@ -758,17 +691,6 @@ fn index(&self, range: ops::RangeTo<usize>) -> &Wtf8 {
     }
 }
 
-#[cfg(stage0)]
-impl ops::Index<ops::RangeFull> for Wtf8 {
-    type Output = Wtf8;
-
-    #[inline]
-    fn index(&self, _range: &ops::RangeFull) -> &Wtf8 {
-        self
-    }
-}
-
-#[cfg(not(stage0))]
 impl ops::Index<ops::RangeFull> for Wtf8 {
     type Output = Wtf8;
 
@@ -792,7 +714,7 @@ fn decode_surrogate_pair(lead: u16, trail: u16) -> char {
 
 /// Copied from core::str::StrPrelude::is_char_boundary
 #[inline]
-pub fn is_code_point_boundary(slice: &Wtf8, index: uint) -> bool {
+pub fn is_code_point_boundary(slice: &Wtf8, index: usize) -> bool {
     if index == slice.len() { return true; }
     match slice.bytes.get(index) {
         None => false,
@@ -802,17 +724,17 @@ pub fn is_code_point_boundary(slice: &Wtf8, index: uint) -> bool {
 
 /// Copied from core::str::raw::slice_unchecked
 #[inline]
-pub unsafe fn slice_unchecked(s: &Wtf8, begin: uint, end: uint) -> &Wtf8 {
+pub unsafe fn slice_unchecked(s: &Wtf8, begin: usize, end: usize) -> &Wtf8 {
     // memory layout of an &[u8] and &Wtf8 are the same
     mem::transmute(slice::from_raw_parts(
-        s.bytes.as_ptr().offset(begin as int),
+        s.bytes.as_ptr().offset(begin as isize),
         end - begin
     ))
 }
 
 /// Copied from core::str::raw::slice_error_fail
 #[inline(never)]
-pub fn slice_error_fail(s: &Wtf8, begin: uint, end: uint) -> ! {
+pub fn slice_error_fail(s: &Wtf8, begin: usize, end: usize) -> ! {
     assert!(begin <= end);
     panic!("index {} and/or {} in `{:?}` do not lie on character boundary",
           begin, end, s);
@@ -835,7 +757,7 @@ fn next(&mut self) -> Option<CodePoint> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         let (len, _) = self.bytes.size_hint();
         (len.saturating_add(3) / 4, Some(len))
     }
@@ -869,7 +791,7 @@ fn next(&mut self) -> Option<u16> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         let (low, high) = self.code_points.size_hint();
         // every code point gets either one u16 or two u16,
         // so this iterator is between 1 or 2 times as
index 7db64cfb936b5199813f1e9bf8ed84dbc23b6a00..99a554a835f9fbc6cc7179d3757bae03892646c6 100644 (file)
@@ -122,13 +122,13 @@ fn backtrace(buf: *mut *mut libc::c_void,
 
     try!(writeln!(w, "stack backtrace:"));
     // 100 lines should be enough
-    const SIZE: uint = 100;
+    const SIZE: usize = 100;
     let mut buf: [*mut libc::c_void; SIZE] = unsafe {mem::zeroed()};
-    let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE as libc::c_int) as uint};
+    let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE as libc::c_int) as usize};
 
     // skipping the first one as it is write itself
     let iter = (1..cnt).map(|i| {
-        print(w, i as int, buf[i], buf[i])
+        print(w, i as isize, buf[i], buf[i])
     });
     result::fold(iter, (), |_, _| ())
 }
@@ -138,7 +138,7 @@ fn backtrace(buf: *mut *mut libc::c_void,
                  // tracing
 pub fn write(w: &mut Write) -> io::Result<()> {
     struct Context<'a> {
-        idx: int,
+        idx: isize,
         writer: &'a mut (Write+'a),
         last_error: Option<io::Error>,
     }
@@ -222,7 +222,7 @@ struct Context<'a> {
 }
 
 #[cfg(any(target_os = "macos", target_os = "ios"))]
-fn print(w: &mut Write, idx: int, addr: *mut libc::c_void,
+fn print(w: &mut Write, idx: isize, addr: *mut libc::c_void,
          _symaddr: *mut libc::c_void) -> io::Result<()> {
     use intrinsics;
     #[repr(C)]
@@ -248,7 +248,7 @@ fn dladdr(addr: *const libc::c_void,
 }
 
 #[cfg(not(any(target_os = "macos", target_os = "ios")))]
-fn print(w: &mut Write, idx: int, addr: *mut libc::c_void,
+fn print(w: &mut Write, idx: isize, addr: *mut libc::c_void,
          symaddr: *mut libc::c_void) -> io::Result<()> {
     use env;
     use ffi::AsOsStr;
@@ -441,7 +441,7 @@ unsafe fn init_state() -> *mut backtrace_state {
 }
 
 // Finally, after all that work above, we can emit a symbol.
-fn output(w: &mut Write, idx: int, addr: *mut libc::c_void,
+fn output(w: &mut Write, idx: isize, addr: *mut libc::c_void,
           s: Option<&[u8]>) -> io::Result<()> {
     try!(write!(w, "  {:2}: {:2$?} - ", idx, addr, HEX_WIDTH));
     match s.and_then(|s| str::from_utf8(s).ok()) {
index 4e9f9c80a1821c9996dba6a4c6fe6fac8309b3fc..2514d4bf4a39605b0c7b76a4ae30d51be503ae87 100644 (file)
@@ -167,7 +167,7 @@ pub fn utimes(filename: *const libc::c_char,
 
 #[cfg(any(target_os = "macos", target_os = "ios"))]
 mod select {
-    pub const FD_SETSIZE: uint = 1024;
+    pub const FD_SETSIZE: usize = 1024;
 
     #[repr(C)]
     pub struct fd_set {
@@ -175,7 +175,7 @@ pub struct fd_set {
     }
 
     pub fn fd_set(set: &mut fd_set, fd: i32) {
-        set.fds_bits[(fd / 32) as uint] |= 1 << ((fd % 32) as uint);
+        set.fds_bits[(fd / 32) as usize] |= 1 << ((fd % 32) as usize);
     }
 }
 
@@ -198,7 +198,7 @@ pub struct fd_set {
     }
 
     pub fn fd_set(set: &mut fd_set, fd: i32) {
-        let fd = fd as uint;
+        let fd = fd as usize;
         set.fds_bits[fd / usize::BITS as usize] |= 1 << (fd % usize::BITS as usize);
     }
 }
index 327ff3953aa32be92a87bb3dba126f177c4d75da..2569653811f11e2892900a3ca710551becb07b22 100644 (file)
@@ -42,7 +42,7 @@ pub fn new(fd: fd_t, close_on_drop: bool) -> FileDesc {
         FileDesc { fd: fd, close_on_drop: close_on_drop }
     }
 
-    pub fn read(&self, buf: &mut [u8]) -> IoResult<uint> {
+    pub fn read(&self, buf: &mut [u8]) -> IoResult<usize> {
         let ret = retry(|| unsafe {
             libc::read(self.fd(),
                        buf.as_mut_ptr() as *mut libc::c_void,
@@ -53,7 +53,7 @@ pub fn read(&self, buf: &mut [u8]) -> IoResult<uint> {
         } else if ret < 0 {
             Err(super::last_error())
         } else {
-            Ok(ret as uint)
+            Ok(ret as usize)
         }
     }
     pub fn write(&self, buf: &[u8]) -> IoResult<()> {
@@ -181,7 +181,7 @@ pub fn open(path: &Path, fm: FileMode, fa: FileAccess) -> IoResult<FileDesc> {
     }
 }
 
-pub fn mkdir(p: &Path, mode: uint) -> IoResult<()> {
+pub fn mkdir(p: &Path, mode: usize) -> IoResult<()> {
     let p = try!(cstr(p));
     mkerr_libc(unsafe { libc::mkdir(p.as_ptr(), mode as libc::mode_t) })
 }
@@ -204,13 +204,13 @@ fn prune(root: &CString, dirs: Vec<Path>) -> Vec<Path> {
     }
 
     let size = unsafe { rust_dirent_t_size() };
-    let mut buf = Vec::<u8>::with_capacity(size as uint);
+    let mut buf = Vec::<u8>::with_capacity(size as usize);
     let ptr = buf.as_mut_ptr() as *mut dirent_t;
 
     let p = try!(CString::new(p.as_vec()));
     let dir_ptr = unsafe {opendir(p.as_ptr())};
 
-    if dir_ptr as uint != 0 {
+    if dir_ptr as usize != 0 {
         let mut paths = vec!();
         let mut entry_ptr = ptr::null_mut();
         while unsafe { readdir_r(dir_ptr, ptr, &mut entry_ptr) == 0 } {
@@ -239,7 +239,7 @@ pub fn rename(old: &Path, new: &Path) -> IoResult<()> {
     })
 }
 
-pub fn chmod(p: &Path, mode: uint) -> IoResult<()> {
+pub fn chmod(p: &Path, mode: usize) -> IoResult<()> {
     let p = try!(cstr(p));
     mkerr_libc(retry(|| unsafe {
         libc::chmod(p.as_ptr(), mode as libc::mode_t)
@@ -251,7 +251,7 @@ pub fn rmdir(p: &Path) -> IoResult<()> {
     mkerr_libc(unsafe { libc::rmdir(p.as_ptr()) })
 }
 
-pub fn chown(p: &Path, uid: int, gid: int) -> IoResult<()> {
+pub fn chown(p: &Path, uid: isize, gid: isize) -> IoResult<()> {
     let p = try!(cstr(p));
     mkerr_libc(retry(|| unsafe {
         libc::chown(p.as_ptr(), uid as libc::uid_t, gid as libc::gid_t)
@@ -265,7 +265,7 @@ pub fn readlink(p: &Path) -> IoResult<Path> {
     if len == -1 {
         len = 1024; // FIXME: read PATH_MAX from C ffi?
     }
-    let mut buf: Vec<u8> = Vec::with_capacity(len as uint);
+    let mut buf: Vec<u8> = Vec::with_capacity(len as usize);
     match unsafe {
         libc::readlink(p, buf.as_ptr() as *mut libc::c_char,
                        len as libc::size_t) as libc::c_int
@@ -273,7 +273,7 @@ pub fn readlink(p: &Path) -> IoResult<Path> {
         -1 => Err(super::last_error()),
         n => {
             assert!(n > 0);
-            unsafe { buf.set_len(n as uint); }
+            unsafe { buf.set_len(n as usize); }
             Ok(Path::new(buf))
         }
     }
index 5555eec4f391876ad7227ba501540bec7dd198df..e8409bb4fd42c3ae61d322ed070b19257b547d19 100644 (file)
@@ -171,6 +171,7 @@ pub fn retry<T, F> (mut f: F) -> T where
     }
 }
 
+#[allow(deprecated)]
 pub fn cvt<T: SignedInt>(t: T) -> io::Result<T> {
     let one: T = Int::one();
     if t == -one {
@@ -180,6 +181,7 @@ pub fn cvt<T: SignedInt>(t: T) -> io::Result<T> {
     }
 }
 
+#[allow(deprecated)]
 pub fn cvt_r<T, F>(mut f: F) -> io::Result<T>
     where T: SignedInt, F: FnMut() -> T
 {
index c73d30d543ac5ebb93419d0d2e9ef1b6d9520fef..fab443feebd0bd08f1c5fe8bd7ab963e6d2f80da 100644 (file)
@@ -199,13 +199,13 @@ pub fn current_exe() -> io::Result<PathBuf> {
                          0 as libc::size_t);
         if err != 0 { return Err(io::Error::last_os_error()); }
         if sz == 0 { return Err(io::Error::last_os_error()); }
-        let mut v: Vec<u8> = Vec::with_capacity(sz as uint);
+        let mut v: Vec<u8> = Vec::with_capacity(sz as usize);
         let err = sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint,
                          v.as_mut_ptr() as *mut libc::c_void, &mut sz,
                          ptr::null_mut(), 0 as libc::size_t);
         if err != 0 { return Err(io::Error::last_os_error()); }
         if sz == 0 { return Err(io::Error::last_os_error()); }
-        v.set_len(sz as uint - 1); // chop off trailing NUL
+        v.set_len(sz as usize - 1); // chop off trailing NUL
         Ok(PathBuf::from(OsString::from_vec(v)))
     }
 }
@@ -249,10 +249,10 @@ pub fn current_exe() -> io::Result<PathBuf> {
         let mut sz: u32 = 0;
         _NSGetExecutablePath(ptr::null_mut(), &mut sz);
         if sz == 0 { return Err(io::Error::last_os_error()); }
-        let mut v: Vec<u8> = Vec::with_capacity(sz as uint);
+        let mut v: Vec<u8> = Vec::with_capacity(sz as usize);
         let err = _NSGetExecutablePath(v.as_mut_ptr() as *mut i8, &mut sz);
         if err != 0 { return Err(io::Error::last_os_error()); }
-        v.set_len(sz as uint - 1); // chop off trailing NUL
+        v.set_len(sz as usize - 1); // chop off trailing NUL
         Ok(PathBuf::from(OsString::from_vec(v)))
     }
 }
@@ -339,7 +339,7 @@ pub fn args() -> Args {
         let info = objc_msgSend(klass, process_info_sel);
         let args = objc_msgSend(info, arguments_sel);
 
-        let cnt: int = mem::transmute(objc_msgSend(args, count_sel));
+        let cnt: usize = mem::transmute(objc_msgSend(args, count_sel));
         for i in (0..cnt) {
             let tmp = objc_msgSend(args, object_at_sel, i);
             let utf_c_str: *const libc::c_char =
index 3b8d18d87a0cafbe3f8d7c44237a4bf5fa17d27b..69d876a48a4b22b3421aa8e293c074dc1497c7af 100644 (file)
@@ -46,10 +46,6 @@ pub fn from_string(s: String) -> Buf {
         Buf { inner: s.into_bytes() }
     }
 
-    pub fn from_str(s: &str) -> Buf {
-        Buf { inner: s.as_bytes().to_vec() }
-    }
-
     pub fn as_slice(&self) -> &Slice {
         unsafe { mem::transmute(&*self.inner) }
     }
index daa981720f6da45faf6913446e253909c6af49b5..f0071295bf237316afdc4bed80434ea40e267d7f 100644 (file)
@@ -151,7 +151,7 @@ fn lock_nonblocking<'a>(&'a self) -> Guard<'a> {
         ret
     }
 
-    pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    pub fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         let fd = self.fd();
         let dolock = || self.lock_nonblocking();
         let doread = |nb| unsafe {
@@ -167,7 +167,7 @@ pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
     pub fn write(&mut self, buf: &[u8]) -> IoResult<()> {
         let fd = self.fd();
         let dolock = || self.lock_nonblocking();
-        let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
+        let dowrite = |nb: bool, buf: *const u8, len: usize| unsafe {
             let flags = if nb {c::MSG_DONTWAIT} else {0};
             libc::send(fd,
                        buf as *const _,
index df0e8de3ff1dab39113e84442ab9623beed00bb7..0d35ace185d844b86bf874ee5a1420ffa8338a17 100644 (file)
@@ -49,11 +49,11 @@ pub fn id(&self) -> pid_t {
         self.pid
     }
 
-    pub unsafe fn kill(&self, signal: int) -> IoResult<()> {
+    pub unsafe fn kill(&self, signal: isize) -> IoResult<()> {
         Process::killpid(self.pid, signal)
     }
 
-    pub unsafe fn killpid(pid: pid_t, signal: int) -> IoResult<()> {
+    pub unsafe fn killpid(pid: pid_t, signal: isize) -> IoResult<()> {
         let r = libc::funcs::posix88::signal::kill(pid, signal as c_int);
         mkerr_libc(r)
     }
@@ -454,7 +454,7 @@ fn waitpid_helper(input: libc::c_int,
                 // with process timeouts, but libgreen should get there first
                 // (currently libuv doesn't handle old signal handlers).
                 if drain(read_fd) {
-                    let i: uint = unsafe { mem::transmute(old.sa_handler) };
+                    let i: usize = unsafe { mem::transmute(old.sa_handler) };
                     if i != 0 {
                         assert!(old.sa_flags & c::SA_SIGINFO == 0);
                         (old.sa_handler)(c::SIGCHLD);
@@ -618,8 +618,8 @@ pub fn WTERMSIG(status: i32) -> i32 { status & 0o177 }
     }
 
     if imp::WIFEXITED(status) {
-        ExitStatus(imp::WEXITSTATUS(status) as int)
+        ExitStatus(imp::WEXITSTATUS(status) as isize)
     } else {
-        ExitSignal(imp::WTERMSIG(status) as int)
+        ExitSignal(imp::WTERMSIG(status) as isize)
     }
 }
index 35706682047a46b55338dbce4de1d966fa0cefac..6887095c53a7d1cdc24a5a7cf7d1acfe5b9a8baf 100644 (file)
@@ -60,7 +60,7 @@ mod imp {
 
 
     // This is initialized in init() and only read from after
-    static mut PAGE_SIZE: uint = 0;
+    static mut PAGE_SIZE: usize = 0;
 
     #[no_stack_check]
     unsafe extern fn signal_handler(signum: libc::c_int,
@@ -82,7 +82,7 @@ unsafe fn term(signum: libc::c_int) -> ! {
         stack::record_sp_limit(0);
 
         let guard = thread_info::stack_guard();
-        let addr = (*info).si_addr as uint;
+        let addr = (*info).si_addr as usize;
 
         if guard == 0 || addr < guard - PAGE_SIZE || addr >= guard {
             term(signum);
@@ -101,7 +101,7 @@ pub unsafe fn init() {
             panic!("failed to get page size");
         }
 
-        PAGE_SIZE = psize as uint;
+        PAGE_SIZE = psize as usize;
 
         let mut action: sigaction = mem::zeroed();
         action.sa_flags = SA_SIGINFO | SA_ONSTACK;
index c7d704922cb7fbdb0ac8e5c5267683e635d1b23b..3c05fd602be8530d5d23251d12930d58bff4e900 100644 (file)
@@ -66,24 +66,24 @@ mod os {
 
     #[cfg(any(target_arch = "x86_64",
               target_arch = "aarch64"))]
-    const __PTHREAD_MUTEX_SIZE__: uint = 56;
+    const __PTHREAD_MUTEX_SIZE__: usize = 56;
     #[cfg(any(target_arch = "x86",
               target_arch = "arm"))]
-    const __PTHREAD_MUTEX_SIZE__: uint = 40;
+    const __PTHREAD_MUTEX_SIZE__: usize = 40;
 
     #[cfg(any(target_arch = "x86_64",
               target_arch = "aarch64"))]
-    const __PTHREAD_COND_SIZE__: uint = 40;
+    const __PTHREAD_COND_SIZE__: usize = 40;
     #[cfg(any(target_arch = "x86",
               target_arch = "arm"))]
-    const __PTHREAD_COND_SIZE__: uint = 24;
+    const __PTHREAD_COND_SIZE__: usize = 24;
 
     #[cfg(any(target_arch = "x86_64",
               target_arch = "aarch64"))]
-    const __PTHREAD_RWLOCK_SIZE__: uint = 192;
+    const __PTHREAD_RWLOCK_SIZE__: usize = 192;
     #[cfg(any(target_arch = "x86",
               target_arch = "arm"))]
-    const __PTHREAD_RWLOCK_SIZE__: uint = 124;
+    const __PTHREAD_RWLOCK_SIZE__: usize = 124;
 
     const _PTHREAD_MUTEX_SIG_INIT: libc::c_long = 0x32AAABA7;
     const _PTHREAD_COND_SIG_INIT: libc::c_long = 0x3CB0B1BB;
@@ -125,15 +125,15 @@ mod os {
 
     // minus 8 because we have an 'align' field
     #[cfg(target_arch = "x86_64")]
-    const __SIZEOF_PTHREAD_MUTEX_T: uint = 40 - 8;
+    const __SIZEOF_PTHREAD_MUTEX_T: usize = 40 - 8;
     #[cfg(any(target_arch = "x86",
               target_arch = "arm",
               target_arch = "mips",
               target_arch = "mipsel",
               target_arch = "powerpc"))]
-    const __SIZEOF_PTHREAD_MUTEX_T: uint = 24 - 8;
+    const __SIZEOF_PTHREAD_MUTEX_T: usize = 24 - 8;
     #[cfg(target_arch = "aarch64")]
-    const __SIZEOF_PTHREAD_MUTEX_T: uint = 48 - 8;
+    const __SIZEOF_PTHREAD_MUTEX_T: usize = 48 - 8;
 
     #[cfg(any(target_arch = "x86_64",
               target_arch = "x86",
@@ -142,18 +142,18 @@ mod os {
               target_arch = "mips",
               target_arch = "mipsel",
               target_arch = "powerpc"))]
-    const __SIZEOF_PTHREAD_COND_T: uint = 48 - 8;
+    const __SIZEOF_PTHREAD_COND_T: usize = 48 - 8;
 
     #[cfg(any(target_arch = "x86_64",
               target_arch = "aarch64"))]
-    const __SIZEOF_PTHREAD_RWLOCK_T: uint = 56 - 8;
+    const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56 - 8;
 
     #[cfg(any(target_arch = "x86",
               target_arch = "arm",
               target_arch = "mips",
               target_arch = "mipsel",
               target_arch = "powerpc"))]
-    const __SIZEOF_PTHREAD_RWLOCK_T: uint = 32 - 8;
+    const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32 - 8;
 
     #[repr(C)]
     pub struct pthread_mutex_t {
index 2a6994824c7eb7c0f44d2fef0b211ddfc7783575..a9f2198208bc31cbd825ce36302f2c9c4fa0619f 100644 (file)
@@ -64,7 +64,7 @@ pub fn bind(addr: ip::SocketAddr) -> IoResult<TcpListener> {
 
     pub fn fd(&self) -> sock_t { self.inner.fd() }
 
-    pub fn listen(self, backlog: int) -> IoResult<TcpAcceptor> {
+    pub fn listen(self, backlog: isize) -> IoResult<TcpAcceptor> {
         match unsafe { libc::listen(self.fd(), backlog as libc::c_int) } {
             -1 => Err(last_net_error()),
             _ => {
index b6d2aca9a52365a4eed5a3d66bea8e920f06ad7e..d9a162302fc1cc28c1bd0c0756c0c4a20c76b02d 100644 (file)
@@ -69,7 +69,7 @@ pub trait Callback {
 }
 
 pub struct Timer {
-    id: uint,
+    id: usize,
     inner: Option<Box<Inner>>,
 }
 
@@ -78,7 +78,7 @@ pub struct Inner {
     interval: u64,
     repeat: bool,
     target: u64,
-    id: uint,
+    id: usize,
 }
 
 pub enum Req {
@@ -87,7 +87,7 @@ pub enum Req {
 
     // Remove a timer based on its id and then send it back on the channel
     // provided
-    RemoveTimer(uint, Sender<Box<Inner>>),
+    RemoveTimer(usize, Sender<Box<Inner>>),
 }
 
 // returns the current time (in milliseconds)
@@ -121,7 +121,7 @@ fn insert(t: Box<Inner>, active: &mut Vec<Box<Inner>>) {
 
     // signals the first requests in the queue, possible re-enqueueing it.
     fn signal(active: &mut Vec<Box<Inner>>,
-              dead: &mut Vec<(uint, Box<Inner>)>) {
+              dead: &mut Vec<(usize, Box<Inner>)>) {
         if active.is_empty() { return }
 
         let mut timer = active.remove(0);
@@ -216,7 +216,7 @@ fn signal(active: &mut Vec<Box<Inner>>,
 
 impl Timer {
     pub fn new() -> IoResult<Timer> {
-        // See notes above regarding using int return value
+        // See notes above regarding using isize return value
         // instead of ()
         HELPER.boot(|| {}, helper);
 
@@ -244,7 +244,7 @@ pub fn sleep(&mut self, ms: u64) {
             tv_nsec: ((ms % 1000) * 1000000) as libc::c_long,
         };
         while unsafe { libc::nanosleep(&to_sleep, &mut to_sleep) } != 0 {
-            if os::errno() as int != libc::EINTR as int {
+            if os::errno() as isize != libc::EINTR as isize {
                 panic!("failed to sleep, but not because of EINTR?");
             }
         }
index e4973a8f9f383bc694ff9629f51dc55da0b880fc..2f6fd713bfba50c01d7049e83e84ab5a48d873fd 100644 (file)
@@ -46,7 +46,7 @@ pub fn new(fd: c_int) -> IoResult<TTY> {
         }
     }
 
-    pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    pub fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         self.fd.read(buf)
     }
     pub fn write(&mut self, buf: &[u8]) -> IoResult<()> {
@@ -56,7 +56,7 @@ pub fn set_raw(&mut self, _raw: bool) -> IoResult<()> {
         Err(sys_common::unimpl())
     }
 
-    pub fn get_winsize(&mut self) -> IoResult<(int, int)> {
+    pub fn get_winsize(&mut self) -> IoResult<(isize, isize)> {
         unsafe {
             #[repr(C)]
             struct winsize {
@@ -74,7 +74,7 @@ struct winsize {
                     detail: None,
                 })
             } else {
-                Ok((size.ws_col as int, size.ws_row as int))
+                Ok((size.ws_col as isize, size.ws_row as isize))
             }
         }
     }
index ffa4b37b48794c4a32f31a0a512cd69b241f3999..385834a6226e05ec82d77b760fa897484b2d56d9 100644 (file)
@@ -23,7 +23,6 @@
 //! this takes the route of using StackWalk64 in order to walk the stack.
 
 #![allow(dead_code)]
-#![allow(deprecated)] // for old path for dynamic lib
 
 use prelude::v1::*;
 use io::prelude::*;
@@ -34,7 +33,7 @@
 use io;
 use libc;
 use mem;
-use old_path::Path;
+use path::Path;
 use ptr;
 use str;
 use sync::{StaticMutex, MUTEX_INIT};
@@ -63,7 +62,7 @@
                        *mut libc::c_void, *mut libc::c_void,
                        *mut libc::c_void, *mut libc::c_void) -> libc::BOOL;
 
-const MAX_SYM_NAME: uint = 2000;
+const MAX_SYM_NAME: usize = 2000;
 const IMAGE_FILE_MACHINE_I386: libc::DWORD = 0x014c;
 const IMAGE_FILE_MACHINE_IA64: libc::DWORD = 0x0200;
 const IMAGE_FILE_MACHINE_AMD64: libc::DWORD = 0x8664;
@@ -138,7 +137,7 @@ struct KDHELP64 {
 mod arch {
     use libc;
 
-    const MAXIMUM_SUPPORTED_EXTENSION: uint = 512;
+    const MAXIMUM_SUPPORTED_EXTENSION: usize = 512;
 
     #[repr(C)]
     pub struct CONTEXT {
index e7a01478908bcafa22ec5db15e360489f4ad286f..3330130c7700207fab3279f53768b9d311af9fdd 100644 (file)
@@ -42,7 +42,7 @@ pub fn new(fd: fd_t, close_on_drop: bool) -> FileDesc {
         FileDesc { fd: fd, close_on_drop: close_on_drop }
     }
 
-    pub fn read(&self, buf: &mut [u8]) -> IoResult<uint> {
+    pub fn read(&self, buf: &mut [u8]) -> IoResult<usize> {
         let mut read = 0;
         let ret = unsafe {
             libc::ReadFile(self.handle(), buf.as_ptr() as libc::LPVOID,
@@ -50,7 +50,7 @@ pub fn read(&self, buf: &mut [u8]) -> IoResult<uint> {
                            ptr::null_mut())
         };
         if ret != 0 {
-            Ok(read as uint)
+            Ok(read as usize)
         } else {
             Err(super::last_error())
         }
@@ -67,8 +67,8 @@ pub fn write(&self, buf: &[u8]) -> IoResult<()> {
                                 ptr::null_mut())
             };
             if ret != 0 {
-                remaining -= amt as uint;
-                cur = unsafe { cur.offset(amt as int) };
+                remaining -= amt as usize;
+                cur = unsafe { cur.offset(amt as isize) };
             } else {
                 return Err(super::last_error())
             }
@@ -234,7 +234,7 @@ pub fn open(path: &Path, fm: FileMode, fa: FileAccess) -> IoResult<FileDesc> {
     }
 }
 
-pub fn mkdir(p: &Path, _mode: uint) -> IoResult<()> {
+pub fn mkdir(p: &Path, _mode: usize) -> IoResult<()> {
     let p = try!(to_utf16(p));
     super::mkerr_winbool(unsafe {
         // FIXME: turn mode into something useful? #2623
@@ -308,11 +308,11 @@ fn do_unlink(p_utf16: &Vec<u16>) -> IoResult<()> {
                 };
                 if stat.perm.intersects(old_io::USER_WRITE) { return Err(e) }
 
-                match chmod(p, (stat.perm | old_io::USER_WRITE).bits() as uint) {
+                match chmod(p, (stat.perm | old_io::USER_WRITE).bits() as usize) {
                     Ok(()) => do_unlink(&p_utf16),
                     Err(..) => {
                         // Try to put it back as we found it
-                        let _ = chmod(p, stat.perm.bits() as uint);
+                        let _ = chmod(p, stat.perm.bits() as usize);
                         Err(e)
                     }
                 }
@@ -331,7 +331,7 @@ pub fn rename(old: &Path, new: &Path) -> IoResult<()> {
     })
 }
 
-pub fn chmod(p: &Path, mode: uint) -> IoResult<()> {
+pub fn chmod(p: &Path, mode: usize) -> IoResult<()> {
     let p = try!(to_utf16(p));
     mkerr_libc(unsafe {
         libc::wchmod(p.as_ptr(), mode as libc::c_int)
@@ -343,7 +343,7 @@ pub fn rmdir(p: &Path) -> IoResult<()> {
     super::mkerr_winbool(unsafe { libc::RemoveDirectoryW(p.as_ptr()) })
 }
 
-pub fn chown(_p: &Path, _uid: int, _gid: int) -> IoResult<()> {
+pub fn chown(_p: &Path, _uid: isize, _gid: isize) -> IoResult<()> {
     // libuv has this as a no-op, so seems like this should as well?
     Ok(())
 }
index b1ceac9b9025684429ad28bc8d37c90a3afeb97a..e9d5fca531fdb8b7ecd5fd3f8360b2d5059879c4 100644 (file)
@@ -18,6 +18,7 @@
 use io::{self, ErrorKind};
 use libc;
 use mem;
+#[allow(deprecated)]
 use num::Int;
 use old_io::{self, IoResult, IoError};
 use os::windows::ffi::{OsStrExt, OsStringExt};
@@ -315,6 +316,7 @@ pub fn truncate_utf16_at_nul<'a>(v: &'a [u16]) -> &'a [u16] {
     }
 }
 
+#[allow(deprecated)]
 fn cvt<I: Int>(i: I) -> io::Result<I> {
     if i == Int::zero() {
         Err(io::Error::last_os_error())
index 734268c70ac9ccd1c0e906d77df44aee4708d370..88d043de479bbe68ce50b27e4ff02ff3d6c6f821 100644 (file)
@@ -15,6 +15,7 @@
 use libc::{self, c_int, c_void};
 use mem;
 use net::SocketAddr;
+#[allow(deprecated)]
 use num::{SignedInt, Int};
 use rt;
 use sync::{Once, ONCE_INIT};
@@ -50,6 +51,7 @@ fn last_error() -> io::Error {
 /// function must be called before another call to the socket API is made.
 ///
 /// FIXME: generics needed?
+#[allow(deprecated)]
 pub fn cvt<T: SignedInt>(t: T) -> io::Result<T> {
     let one: T = Int::one();
     if t == -one {
@@ -67,6 +69,7 @@ pub fn cvt_gai(err: c_int) -> io::Result<()> {
 }
 
 /// Provides the functionality of `cvt` for a closure.
+#[allow(deprecated)]
 pub fn cvt_r<T: SignedInt, F>(mut f: F) -> io::Result<T> where F: FnMut() -> T {
     cvt(f())
 }
index ad1e6c4b0e727eeb0f0776f3ae4bf8c6f2e802a4..91905ae7489d528b100b874e19183cedaeca9e4c 100644 (file)
@@ -45,10 +45,6 @@ pub fn from_string(s: String) -> Buf {
         Buf { inner: Wtf8Buf::from_string(s) }
     }
 
-    pub fn from_str(s: &str) -> Buf {
-        Buf { inner: Wtf8Buf::from_str(s) }
-    }
-
     pub fn as_slice(&self) -> &Slice {
         unsafe { mem::transmute(self.inner.as_slice()) }
     }
index 17fdd6755c6d951bc08c34b8fc41a6196f72b8ec..064c003bd15a909b90392f5ce531e5330a6085d7 100644 (file)
@@ -115,7 +115,7 @@ fn new(manual_reset: bool, initial_state: bool) -> IoResult<Event> {
                                initial_state as libc::BOOL,
                                ptr::null())
         };
-        if event as uint == 0 {
+        if event as usize == 0 {
             Err(super::last_error())
         } else {
             Ok(Event(event))
@@ -181,7 +181,7 @@ unsafe fn pipe(name: *const u16, init: bool) -> libc::HANDLE {
 }
 
 pub fn await(handle: libc::HANDLE, deadline: u64,
-             events: &[libc::HANDLE]) -> IoResult<uint> {
+             events: &[libc::HANDLE]) -> IoResult<usize> {
     use libc::consts::os::extra::{WAIT_FAILED, WAIT_TIMEOUT, WAIT_OBJECT_0};
 
     // If we've got a timeout, use WaitForSingleObject in tandem with CancelIo
@@ -204,7 +204,7 @@ pub fn await(handle: libc::HANDLE, deadline: u64,
             let _ = c::CancelIo(handle);
             Err(sys_common::timeout("operation timed out"))
         },
-        n => Ok((n - WAIT_OBJECT_0) as uint)
+        n => Ok((n - WAIT_OBJECT_0) as usize)
     }
 }
 
@@ -314,7 +314,7 @@ pub fn connect(addr: &CString, timeout: Option<u64>) -> IoResult<UnixStream> {
             // `WaitNamedPipe` function, and this is indicated with an error
             // code of ERROR_PIPE_BUSY.
             let code = unsafe { libc::GetLastError() };
-            if code as int != libc::ERROR_PIPE_BUSY as int {
+            if code as isize != libc::ERROR_PIPE_BUSY as isize {
                 return Err(super::last_error())
             }
 
@@ -362,7 +362,7 @@ fn cancel_io(&self) -> IoResult<()> {
         }
     }
 
-    pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    pub fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         if self.read.is_none() {
             self.read = Some(try!(Event::new(true, false)));
         }
@@ -390,7 +390,7 @@ pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
                            &mut bytes_read,
                            &mut overlapped)
         };
-        if ret != 0 { return Ok(bytes_read as uint) }
+        if ret != 0 { return Ok(bytes_read as usize) }
 
         // If our errno doesn't say that the I/O is pending, then we hit some
         // legitimate error and return immediately.
@@ -418,7 +418,7 @@ pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
             };
             // If we succeeded, or we failed for some reason other than
             // CancelIoEx, return immediately
-            if ret != 0 { return Ok(bytes_read as uint) }
+            if ret != 0 { return Ok(bytes_read as usize) }
             if os::errno() != libc::ERROR_OPERATION_ABORTED as i32 {
                 return Err(super::last_error())
             }
@@ -487,7 +487,7 @@ pub fn write(&mut self, buf: &[u8]) -> IoResult<()> {
                         return Err(super::last_error())
                     }
                     if !wait_succeeded.is_ok() {
-                        let amt = offset + bytes_written as uint;
+                        let amt = offset + bytes_written as usize;
                         return if amt > 0 {
                             Err(IoError {
                                 kind: old_io::ShortWrite(amt),
@@ -504,7 +504,7 @@ pub fn write(&mut self, buf: &[u8]) -> IoResult<()> {
                     continue // retry
                 }
             }
-            offset += bytes_written as uint;
+            offset += bytes_written as usize;
         }
         Ok(())
     }
index e08a6e6b3cd7bfed95efd98fb9d314e275d6a16d..297f6e173abdc9f48d3b6872ab2c712f54fe4e2d 100644 (file)
@@ -63,11 +63,11 @@ pub fn id(&self) -> pid_t {
         self.pid
     }
 
-    pub unsafe fn kill(&self, signal: int) -> IoResult<()> {
+    pub unsafe fn kill(&self, signal: isize) -> IoResult<()> {
         Process::killpid(self.pid, signal)
     }
 
-    pub unsafe fn killpid(pid: pid_t, signal: int) -> IoResult<()> {
+    pub unsafe fn killpid(pid: pid_t, signal: isize) -> IoResult<()> {
         let handle = libc::OpenProcess(libc::PROCESS_TERMINATE |
                                        libc::PROCESS_QUERY_INFORMATION,
                                        libc::FALSE, pid as libc::DWORD);
@@ -309,7 +309,7 @@ pub fn wait(&self, deadline: u64) -> IoResult<ProcessExit> {
                 }
                 if status != STILL_ACTIVE {
                     assert!(CloseHandle(process) != 0);
-                    return Ok(ExitStatus(status as int));
+                    return Ok(ExitStatus(status as isize));
                 }
                 let interval = if deadline == 0 {
                     INFINITE
@@ -394,7 +394,7 @@ fn append_arg(cmd: &mut String, arg: &str) {
         }
     }
 
-    fn append_char_at(cmd: &mut String, arg: &[char], i: uint) {
+    fn append_char_at(cmd: &mut String, arg: &[char], i: usize) {
         match arg[i] {
             '"' => {
                 // Escape quotes.
@@ -415,7 +415,7 @@ fn append_char_at(cmd: &mut String, arg: &[char], i: uint) {
         }
     }
 
-    fn backslash_run_ends_in_quote(s: &[char], mut i: uint) -> bool {
+    fn backslash_run_ends_in_quote(s: &[char], mut i: usize) -> bool {
         while i < s.len() && s[i] == '\\' {
             i += 1;
         }
index 4c2777459dd5d1810c789b46e556e336b975504f..9e9bb86446e7c11b1f395ed598c888a89764ea4e 100644 (file)
@@ -127,7 +127,7 @@ pub fn spawn(cfg: &Command,
 
         use env::split_paths;
         use mem;
-        use iter::IteratorExt;
+        use iter::Iterator;
 
         // To have the spawning semantics of unix/windows stay the same, we need to
         // read the *child's* PATH if one is provided. See #15149 for more details.
index b0410701ee1012817ece41b7fb16eda28c47cd08..79b7de4f341ac07280d7d69a5c28faa44266f75d 100644 (file)
@@ -31,7 +31,7 @@ fn drop(&mut self) {}
 }
 
 // This is initialized in init() and only read from after
-static mut PAGE_SIZE: uint = 0;
+static mut PAGE_SIZE: usize = 0;
 
 #[no_stack_check]
 extern "system" fn vectored_handler(ExceptionInfo: *mut EXCEPTION_POINTERS) -> LONG {
@@ -56,7 +56,7 @@ extern "system" fn vectored_handler(ExceptionInfo: *mut EXCEPTION_POINTERS) -> L
 pub unsafe fn init() {
     let mut info = mem::zeroed();
     libc::GetSystemInfo(&mut info);
-    PAGE_SIZE = info.dwPageSize as uint;
+    PAGE_SIZE = info.dwPageSize as usize;
 
     if AddVectoredExceptionHandler(0, vectored_handler) == ptr::null_mut() {
         panic!("failed to install exception handler");
@@ -96,7 +96,7 @@ pub struct EXCEPTION_POINTERS {
 pub type ULONG = libc::c_ulong;
 
 const EXCEPTION_CONTINUE_SEARCH: LONG = 0;
-const EXCEPTION_MAXIMUM_PARAMETERS: uint = 15;
+const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15;
 const EXCEPTION_STACK_OVERFLOW: DWORD = 0xc00000fd;
 
 extern "system" {
index 6e46bf97d1bac9cbca646e100655b2bcd5aa74dc..2ac8ac10aa9ae7a3b09f58ae03524aae581978eb 100644 (file)
@@ -77,7 +77,7 @@ pub fn bind(addr: ip::SocketAddr) -> IoResult<TcpListener> {
 
     pub fn socket(&self) -> sock_t { self.sock }
 
-    pub fn listen(self, backlog: int) -> IoResult<TcpAcceptor> {
+    pub fn listen(self, backlog: isize) -> IoResult<TcpAcceptor> {
         match unsafe { libc::listen(self.socket(), backlog as libc::c_int) } {
             -1 => Err(last_net_error()),
 
index d1d4ad90081bf536ddc3b8ca40351b126ad1b6f3..98e4a737c7b178a8fcf0a02d7746752e5351ac23 100644 (file)
@@ -25,8 +25,8 @@
 pub type rust_thread = HANDLE;
 
 pub mod guard {
-    pub unsafe fn main() -> uint { 0 }
-    pub unsafe fn current() -> uint { 0 }
+    pub unsafe fn main() -> usize { 0 }
+    pub unsafe fn current() -> usize { 0 }
     pub unsafe fn init() {}
 }
 
index c908c791247d1b3bc47b8379778b380926078fb7..cbabab8acb78060b1959de4c29fcd307489ccd70 100644 (file)
@@ -139,7 +139,7 @@ unsafe fn init_dtors() {
         let dtors = DTORS;
         DTORS = 1 as *mut _;
         Box::from_raw(dtors);
-        assert!(DTORS as uint == 1); // can't re-init after destructing
+        assert!(DTORS as usize == 1); // can't re-init after destructing
         DTOR_LOCK.unlock();
     });
     if res.is_ok() {
@@ -152,8 +152,8 @@ unsafe fn init_dtors() {
 unsafe fn register_dtor(key: Key, dtor: Dtor) {
     DTOR_LOCK.lock();
     init_dtors();
-    assert!(DTORS as uint != 0);
-    assert!(DTORS as uint != 1,
+    assert!(DTORS as usize != 0);
+    assert!(DTORS as usize != 1,
             "cannot create new TLS keys after the main thread has exited");
     (*DTORS).push((key, dtor));
     DTOR_LOCK.unlock();
@@ -162,8 +162,8 @@ unsafe fn register_dtor(key: Key, dtor: Dtor) {
 unsafe fn unregister_dtor(key: Key) -> bool {
     DTOR_LOCK.lock();
     init_dtors();
-    assert!(DTORS as uint != 0);
-    assert!(DTORS as uint != 1,
+    assert!(DTORS as usize != 0);
+    assert!(DTORS as usize != 1,
             "cannot unregister destructors after the main thread has exited");
     let ret = {
         let dtors = &mut *DTORS;
index 9bcae926eeabfca420ad56eb343ddabea3bf1973..8856cc26b2e9060b8eaa3dbff863e5e70a6bba5f 100644 (file)
@@ -91,13 +91,13 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>, _: ()) {
             }
         } else {
             let remove = {
-                match &mut chans[idx as uint - 1] {
+                match &mut chans[idx as usize - 1] {
                     &mut (ref mut c, oneshot) => { c.call(); oneshot }
                 }
             };
             if remove {
-                drop(objs.remove(idx as uint));
-                drop(chans.remove(idx as uint - 1));
+                drop(objs.remove(idx as usize));
+                drop(chans.remove(idx as usize - 1));
             }
         }
     }
index 52f4cce4aa3bdff763e4d3fb0117589a5257467f..791c7532bd007148b282967fb797a45828b29c34 100644 (file)
@@ -42,7 +42,7 @@
 use super::c::{ENABLE_PROCESSED_INPUT, ENABLE_QUICK_EDIT_MODE};
 use super::c::CONSOLE_SCREEN_BUFFER_INFO;
 use super::c::{ReadConsoleW, WriteConsoleW, GetConsoleMode, SetConsoleMode};
-use super::c::{GetConsoleScreenBufferInfo};
+use super::c::GetConsoleScreenBufferInfo;
 
 fn invalid_encoding() -> IoError {
     IoError {
@@ -92,7 +92,7 @@ pub fn new(fd: c_int) -> IoResult<TTY> {
         }
     }
 
-    pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
+    pub fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
         // Read more if the buffer is empty
         if self.utf8.eof() {
             let mut utf16: Vec<u16> = repeat(0u16).take(0x1000).collect();
@@ -105,7 +105,7 @@ pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
                 0 => return Err(super::last_error()),
                 _ => (),
             };
-            utf16.truncate(num as uint);
+            utf16.truncate(num as usize);
             let utf8 = match String::from_utf16(&utf16) {
                 Ok(utf8) => utf8.into_bytes(),
                 Err(..) => return Err(invalid_encoding()),
@@ -149,12 +149,12 @@ pub fn set_raw(&mut self, raw: bool) -> IoResult<()> {
         }
     }
 
-    pub fn get_winsize(&mut self) -> IoResult<(int, int)> {
+    pub fn get_winsize(&mut self) -> IoResult<(isize, isize)> {
         let mut info: CONSOLE_SCREEN_BUFFER_INFO = unsafe { mem::zeroed() };
         match unsafe { GetConsoleScreenBufferInfo(self.handle, &mut info as *mut _) } {
             0 => Err(super::last_error()),
-            _ => Ok(((info.srWindow.Right + 1 - info.srWindow.Left) as int,
-                     (info.srWindow.Bottom + 1 - info.srWindow.Top) as int)),
+            _ => Ok(((info.srWindow.Right + 1 - info.srWindow.Left) as isize,
+                     (info.srWindow.Bottom + 1 - info.srWindow.Top) as isize)),
         }
     }
 }
index 27b50fc9aaa60ca0312245161eb46c48b8a8f61e..074030bd07bdb7853f1f9e4d70a61836d3044043 100644 (file)
@@ -434,6 +434,55 @@ pub fn panicking() -> bool {
     unwind::panicking()
 }
 
+/// Invoke a closure, capturing the cause of panic if one occurs.
+///
+/// This function will return `Ok(())` if the closure does not panic, and will
+/// return `Err(cause)` if the closure panics. The `cause` returned is the
+/// object with which panic was originally invoked.
+///
+/// It is currently undefined behavior to unwind from Rust code into foreign
+/// code, so this function is particularly useful when Rust is called from
+/// another language (normally C). This can run arbitrary Rust code, capturing a
+/// panic and allowing a graceful handling of the error.
+///
+/// It is **not** recommended to use this function for a general try/catch
+/// mechanism. The `Result` type is more appropriate to use for functions that
+/// can fail on a regular basis.
+///
+/// The closure provided is required to adhere to the `'static` bound to ensure
+/// that it cannot reference data in the parent stack frame, mitigating problems
+/// with exception safety. Furthermore, a `Send` bound is also required,
+/// providing the same safety guarantees as `thread::spawn` (ensuring the
+/// closure is properly isolated from the parent).
+///
+/// # Examples
+///
+/// ```
+/// # #![feature(catch_panic)]
+/// use std::thread;
+///
+/// let result = thread::catch_panic(|| {
+///     println!("hello!");
+/// });
+/// assert!(result.is_ok());
+///
+/// let result = thread::catch_panic(|| {
+///     panic!("oh no!");
+/// });
+/// assert!(result.is_err());
+/// ```
+#[unstable(feature = "catch_panic", reason = "recent API addition")]
+pub fn catch_panic<F, R>(f: F) -> Result<R>
+    where F: FnOnce() -> R + Send + 'static
+{
+    let mut result = None;
+    unsafe {
+        let result = &mut result;
+        try!(::rt::unwind::try(move || *result = Some(f())))
+    }
+    Ok(result.unwrap())
+}
+
 /// Put the current thread to sleep for the specified amount of time.
 ///
 /// The thread may sleep longer than the duration specified due to scheduling
@@ -821,13 +870,13 @@ fn test_scoped_success() {
     }
 
     #[test]
-    #[should_fail]
+    #[should_panic]
     fn test_scoped_panic() {
         thread::scoped(|| panic!()).join();
     }
 
     #[test]
-    #[should_fail]
+    #[should_panic]
     fn test_scoped_implicit_panic() {
         let _ = thread::scoped(|| panic!());
     }
index 958417d864c1fa7b477975d0f287d9ba2bb0b088..9b79b483b28cfbc77b27c21ee4ac2f9395ca1ebf 100644 (file)
@@ -16,6 +16,7 @@
 use ops::{Add, Sub, Mul, Div, Neg, FnOnce};
 use option::Option;
 use option::Option::{Some, None};
+#[allow(deprecated)] // Int
 use num::Int;
 use result::Result::Ok;
 
index fec67c7aef48f56213af98901842687da63e0c6d..ce1539c62f80bc673edba482ca1fa2c35ee3f435 100644 (file)
@@ -66,6 +66,7 @@
 use ptr::P;
 
 use std::fmt;
+#[allow(deprecated)]
 use std::num::Int;
 use std::rc::Rc;
 use serialize::{Encodable, Decodable, Encoder, Decoder};
@@ -1141,6 +1142,7 @@ pub enum Sign {
 }
 
 impl Sign {
+    #[allow(deprecated)] // Int
     pub fn new<T:Int>(n: T) -> Sign {
         if n < Int::zero() {
             Minus
@@ -1249,29 +1251,15 @@ pub enum ImplItem_ {
     MacImplItem(Mac),
 }
 
-#[derive(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
 pub enum IntTy {
-    TyIs(bool /* is this deprecated `int`? */),
+    TyIs,
     TyI8,
     TyI16,
     TyI32,
     TyI64,
 }
 
-impl PartialEq for IntTy {
-    fn eq(&self, other: &IntTy) -> bool {
-        match (*self, *other) {
-            // true/false need to compare the same, so this can't be derived
-            (TyIs(_), TyIs(_)) |
-            (TyI8, TyI8) |
-            (TyI16, TyI16) |
-            (TyI32, TyI32) |
-            (TyI64, TyI64) => true,
-            _ => false
-        }
-    }
-}
-
 impl fmt::Debug for IntTy {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         fmt::Display::fmt(self, f)
@@ -1287,41 +1275,25 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 impl IntTy {
     pub fn suffix_len(&self) -> usize {
         match *self {
-            TyIs(true) /* i */ => 1,
-            TyIs(false) /* is */ | TyI8 => 2,
+            TyIs | TyI8 => 2,
             TyI16 | TyI32 | TyI64  => 3,
         }
     }
 }
 
-#[derive(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
 pub enum UintTy {
-    TyUs(bool /* is this deprecated uint? */),
+    TyUs,
     TyU8,
     TyU16,
     TyU32,
     TyU64,
 }
 
-impl PartialEq for UintTy {
-    fn eq(&self, other: &UintTy) -> bool {
-        match (*self, *other) {
-            // true/false need to compare the same, so this can't be derived
-            (TyUs(_), TyUs(_)) |
-            (TyU8, TyU8) |
-            (TyU16, TyU16) |
-            (TyU32, TyU32) |
-            (TyU64, TyU64) => true,
-            _ => false
-        }
-    }
-}
-
 impl UintTy {
     pub fn suffix_len(&self) -> usize {
         match *self {
-            TyUs(true) /* u */ => 1,
-            TyUs(false) /* us */ | TyU8 => 2,
+            TyUs | TyU8 => 2,
             TyU16 | TyU32 | TyU64  => 3,
         }
     }
index 16a339cdcb530b22e99d455cc76ab740f06ae4f8..1994ca70bbbb4096783fb513c4300930b5454ce6 100644 (file)
@@ -26,7 +26,7 @@
 use abi;
 use ast::{Block, FnDecl, NodeId};
 use ast;
-use ast_map::{Node};
+use ast_map::Node;
 use ast_map;
 use codemap::Span;
 use visit;
index cec824e79ff5a5afc3d55f7a3ccb9674f6e99394..b83b42c73e70899895dcd2e8f7ed367ef1859176 100644 (file)
@@ -86,33 +86,17 @@ pub fn is_shift_binop(b: BinOp_) -> bool {
 
 pub fn is_comparison_binop(b: BinOp_) -> bool {
     match b {
-        BiEq | BiLt | BiLe | BiNe | BiGt | BiGe => true,
-        _ => false
+        BiEq | BiLt | BiLe | BiNe | BiGt | BiGe =>
+            true,
+        BiAnd | BiOr | BiAdd | BiSub | BiMul | BiDiv | BiRem |
+        BiBitXor | BiBitAnd | BiBitOr | BiShl | BiShr =>
+            false,
     }
 }
 
 /// Returns `true` if the binary operator takes its arguments by value
 pub fn is_by_value_binop(b: BinOp_) -> bool {
-    match b {
-        BiAdd | BiSub | BiMul | BiDiv | BiRem | BiBitXor | BiBitAnd | BiBitOr | BiShl | BiShr => {
-            true
-        }
-        _ => false
-    }
-}
-
-/// Returns `true` if the binary operator is symmetric in the sense that LHS
-/// and RHS must have the same type. So the type of LHS can serve as an hint
-/// for the type of RHS and vice versa.
-pub fn is_symmetric_binop(b: BinOp_) -> bool {
-    match b {
-        BiAdd | BiSub | BiMul | BiDiv | BiRem |
-        BiBitXor | BiBitAnd | BiBitOr |
-        BiEq | BiLt | BiLe | BiNe | BiGt | BiGe => {
-            true
-        }
-        _ => false
-    }
+    !is_comparison_binop(b)
 }
 
 /// Returns `true` if the unary operator takes its argument by value
@@ -140,7 +124,7 @@ pub fn is_path(e: P<Expr>) -> bool {
 /// We want to avoid "45int" and "-3int" in favor of "45" and "-3"
 pub fn int_ty_to_string(t: IntTy, val: Option<i64>) -> String {
     let s = match t {
-        TyIs(_) => "isize",
+        TyIs => "isize",
         TyI8 => "i8",
         TyI16 => "i16",
         TyI32 => "i32",
@@ -160,7 +144,7 @@ pub fn int_ty_max(t: IntTy) -> u64 {
     match t {
         TyI8 => 0x80,
         TyI16 => 0x8000,
-        TyIs(_) | TyI32 => 0x80000000, // actually ni about TyIs
+        TyIs | TyI32 => 0x80000000, // actually ni about TyIs
         TyI64 => 0x8000000000000000
     }
 }
@@ -169,7 +153,7 @@ pub fn int_ty_max(t: IntTy) -> u64 {
 /// We want to avoid "42u" in favor of "42us". "42uint" is right out.
 pub fn uint_ty_to_string(t: UintTy, val: Option<u64>) -> String {
     let s = match t {
-        TyUs(_) => "usize",
+        TyUs => "usize",
         TyU8 => "u8",
         TyU16 => "u16",
         TyU32 => "u32",
@@ -186,7 +170,7 @@ pub fn uint_ty_max(t: UintTy) -> u64 {
     match t {
         TyU8 => 0xff,
         TyU16 => 0xffff,
-        TyUs(_) | TyU32 => 0xffffffff, // actually ni about TyUs
+        TyUs | TyU32 => 0xffffffff, // actually ni about TyUs
         TyU64 => 0xffffffffffffffff
     }
 }
index 1c7930b9bc99288279fe1d91ed8d59a629afe915..2d8484e95bbc93bbae1c9763843e3bd6986385d1 100644 (file)
@@ -565,10 +565,8 @@ fn int_type_of_word(s: &str) -> Option<IntType> {
         "u32" => Some(UnsignedInt(ast::TyU32)),
         "i64" => Some(SignedInt(ast::TyI64)),
         "u64" => Some(UnsignedInt(ast::TyU64)),
-        "int" => Some(SignedInt(ast::TyIs(true))),
-        "uint" => Some(UnsignedInt(ast::TyUs(true))),
-        "isize" => Some(SignedInt(ast::TyIs(false))),
-        "usize" => Some(UnsignedInt(ast::TyUs(false))),
+        "isize" => Some(SignedInt(ast::TyIs)),
+        "usize" => Some(UnsignedInt(ast::TyUs)),
         _ => None
     }
 }
@@ -612,7 +610,7 @@ fn is_ffi_safe(self) -> bool {
             SignedInt(ast::TyI16) | UnsignedInt(ast::TyU16) |
             SignedInt(ast::TyI32) | UnsignedInt(ast::TyU32) |
             SignedInt(ast::TyI64) | UnsignedInt(ast::TyU64) => true,
-            SignedInt(ast::TyIs(_)) | UnsignedInt(ast::TyUs(_)) => false
+            SignedInt(ast::TyIs) | UnsignedInt(ast::TyUs) => false
         }
     }
 }
index d916651b05617d25cedd8bd6f06867eba885f712..5d0853761eec8321741d3dcc461559324a66e806 100644 (file)
@@ -696,10 +696,10 @@ fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> P<ast::Expr> {
         self.expr(sp, ast::ExprLit(P(respan(sp, lit))))
     }
     fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr> {
-        self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyUs(false))))
+        self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyUs)))
     }
     fn expr_int(&self, sp: Span, i: isize) -> P<ast::Expr> {
-        self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs(false),
+        self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs,
                                                                   ast::Sign::new(i))))
     }
     fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr> {
index e350ce6101737ac3ca2bdd0e8c32ecfdd206f2bf..5d07c36c929468394d6c8915a0d11a34fbcf2127 100644 (file)
@@ -14,7 +14,7 @@
 use ext::base;
 use feature_gate;
 use parse::token;
-use parse::token::{str_to_ident};
+use parse::token::str_to_ident;
 use ptr::P;
 
 pub fn expand_syntax_ext<'cx>(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
index 0c5e4d67642acc08a82fdbd838ef4dbf21de7dec..397775fdbfec384870677af77fd4d06d7b40e98e 100644 (file)
@@ -1163,7 +1163,7 @@ fn build_enum_match_tuple(
             let arms: Vec<ast::Arm> = variants.iter().enumerate()
                 .map(|(index, variant)| {
                     let pat = variant_to_pat(cx, sp, type_ident, &**variant);
-                    let lit = ast::LitInt(index as u64, ast::UnsignedIntLit(ast::TyUs(false)));
+                    let lit = ast::LitInt(index as u64, ast::UnsignedIntLit(ast::TyUs));
                     cx.arm(sp, vec![pat], cx.expr_lit(sp, lit))
                 }).collect();
 
index 8a764fded6fd9d3cf3aca73028cffb07146ae51f..631e5f979d9ee7a38a1cf426dbc141828fa0f6a3 100644 (file)
@@ -12,7 +12,7 @@
 use ast::{MetaItem, Item, Expr};
 use codemap::Span;
 use ext::base::ExtCtxt;
-use ext::build::{AstBuilder};
+use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 use ext::deriving::generic::ty::*;
 use ptr::P;
index 5bbcdea879dff3d90d64303daa33c0fdb71ff40a..87299721fb3caf65de000a6fb616239e3cf65c32 100644 (file)
@@ -264,7 +264,6 @@ fn to_source_with_hygiene(&self) -> String {
         (unsigned, $t:ty, $tag:expr) => (
             impl ToSource for $t {
                 fn to_source(&self) -> String {
-                    #![allow(trivial_numeric_casts)]
                     let lit = ast::LitInt(*self as u64, ast::UnsignedIntLit($tag));
                     pprust::lit_to_string(&dummy_spanned(lit))
                 }
@@ -277,13 +276,13 @@ fn to_source_with_hygiene(&self) -> String {
         );
     }
 
-    impl_to_source_int! { signed, int, ast::TyIs(false) }
+    impl_to_source_int! { signed, isize, ast::TyIs }
     impl_to_source_int! { signed, i8,  ast::TyI8 }
     impl_to_source_int! { signed, i16, ast::TyI16 }
     impl_to_source_int! { signed, i32, ast::TyI32 }
     impl_to_source_int! { signed, i64, ast::TyI64 }
 
-    impl_to_source_int! { unsigned, uint, ast::TyUs(false) }
+    impl_to_source_int! { unsigned, usize, ast::TyUs }
     impl_to_source_int! { unsigned, u8,   ast::TyU8 }
     impl_to_source_int! { unsigned, u16,  ast::TyU16 }
     impl_to_source_int! { unsigned, u32,  ast::TyU32 }
@@ -332,12 +331,12 @@ fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> {
     impl_to_tokens! { () }
     impl_to_tokens! { char }
     impl_to_tokens! { bool }
-    impl_to_tokens! { int }
+    impl_to_tokens! { isize }
     impl_to_tokens! { i8 }
     impl_to_tokens! { i16 }
     impl_to_tokens! { i32 }
     impl_to_tokens! { i64 }
-    impl_to_tokens! { uint }
+    impl_to_tokens! { usize }
     impl_to_tokens! { u8 }
     impl_to_tokens! { u16 }
     impl_to_tokens! { u32 }
index 60f81dac1e9abaf09fc2e1c7cba5c113b9030fdc..1b03a18072011a2c1f5acf0bbcf306369af6fe28 100644 (file)
     ("non_ascii_idents", "1.0.0", Active),
     ("thread_local", "1.0.0", Active),
     ("link_args", "1.0.0", Active),
-    ("phase", "1.0.0", Removed),
     ("plugin_registrar", "1.0.0", Active),
     ("log_syntax", "1.0.0", Active),
     ("trace_macros", "1.0.0", Active),
     ("concat_idents", "1.0.0", Active),
-    ("unsafe_destructor", "1.0.0", Active),
     ("intrinsics", "1.0.0", Active),
     ("lang_items", "1.0.0", Active),
 
@@ -74,6 +72,7 @@
 
     ("rustc_diagnostic_macros", "1.0.0", Active),
     ("unboxed_closures", "1.0.0", Active),
+    ("reflect", "1.0.0", Active),
     ("import_shadowing", "1.0.0", Removed),
     ("advanced_slice_patterns", "1.0.0", Active),
     ("tuple_indexing", "1.0.0", Accepted),
     ("start", "1.0.0", Active),
     ("main", "1.0.0", Active),
 
+    // Deprecate after snapshot
+    // SNAP a923278
+    ("unsafe_destructor", "1.0.0", Active),
+
     // A temporary feature gate used to enable parser extensions needed
     // to bootstrap fix for #5723.
     ("issue_5723_bootstrap", "1.0.0", Accepted),
     // A way to temporarily opt out of the new orphan rules. This will *never* be accepted.
     ("old_orphan_check", "1.0.0", Deprecated),
 
-    // A way to temporarily opt out of the new impl rules. This will *never* be accepted.
-    ("old_impl_check", "1.0.0", Deprecated),
-
     // OIBIT specific features
     ("optin_builtin_traits", "1.0.0", Active),
 
-    // int and uint are now deprecated
-    ("int_uint", "1.0.0", Active),
-
     // macro reexport needs more discussion and stabilization
     ("macro_reexport", "1.0.0", Active),
 
     // below (it has to be checked before expansion possibly makes
     // macros disappear).
     ("allow_internal_unstable", "1.0.0", Active),
+
+    // #23121. Array patterns have some hazards yet.
+    ("slice_patterns", "1.0.0", Active),
 ];
 // (changing above list without updating src/doc/reference.md makes @cmr sad)
 
@@ -196,12 +196,10 @@ enum Status {
     ("repr", Normal),
     ("path", Normal),
     ("abi", Normal),
-    ("unsafe_destructor", Normal),
     ("automatically_derived", Normal),
     ("no_mangle", Normal),
     ("no_link", Normal),
     ("derive", Normal),
-    ("should_fail", Normal),
     ("should_panic", Normal),
     ("ignore", Normal),
     ("no_implicit_prelude", Normal),
@@ -209,7 +207,8 @@ enum Status {
     ("link_args", Normal),
     ("macro_escape", Normal),
 
-
+    ("unsafe_destructor", Gated("unsafe_destructor",
+                                "`#[unsafe_destructor]` does nothing anymore")),
     ("staged_api", Gated("staged_api",
                          "staged_api is for use by rustc only")),
     ("plugin", Gated("plugin",
@@ -280,8 +279,11 @@ enum Status {
 
     // FIXME: #19470 this shouldn't be needed forever
     ("old_orphan_check", Whitelisted),
-    ("old_impl_check", Whitelisted),
-    ("rustc_paren_sugar", Whitelisted), // FIXME: #18101 temporary unboxed closure hack
+
+    ("rustc_paren_sugar", Gated("unboxed_closures",
+                                "unboxed_closures are still evolving")),
+    ("rustc_reflect_like", Gated("reflect",
+                                 "defining reflective traits is still evolving")),
 
     // Crate level attributes
     ("crate_name", CrateLevel),
@@ -360,7 +362,6 @@ struct Context<'a> {
     features: Vec<&'static str>,
     span_handler: &'a SpanHandler,
     cm: &'a CodeMap,
-    do_warnings: bool,
 }
 
 impl<'a> Context<'a> {
@@ -371,12 +372,6 @@ fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
             emit_feature_err(self.span_handler, feature, span, explain);
         }
     }
-
-    fn warn_feature(&self, feature: &str, span: Span, explain: &str) {
-        if !self.has_feature(feature) && self.do_warnings {
-            emit_feature_warn(self.span_handler, feature, span, explain);
-        }
-    }
     fn has_feature(&self, feature: &str) -> bool {
         self.features.iter().any(|&n| n == feature)
     }
@@ -579,15 +574,6 @@ fn visit_item(&mut self, i: &ast::Item) {
                     _ => {}
                 }
 
-                if attr::contains_name(&i.attrs,
-                                       "unsafe_destructor") {
-                    self.gate_feature("unsafe_destructor",
-                                      i.span,
-                                      "`#[unsafe_destructor]` allows too \
-                                       many unsafe patterns and may be \
-                                       removed in the future");
-                }
-
                 if attr::contains_name(&i.attrs[..],
                                        "old_orphan_check") {
                     self.gate_feature(
@@ -595,13 +581,6 @@ fn visit_item(&mut self, i: &ast::Item) {
                         i.span,
                         "the new orphan check rules will eventually be strictly enforced");
                 }
-
-                if attr::contains_name(&i.attrs[..],
-                                       "old_impl_check") {
-                    self.gate_feature("old_impl_check",
-                                      i.span,
-                                      "`#[old_impl_check]` will be removed in the future");
-                }
             }
 
             _ => {}
@@ -624,35 +603,6 @@ fn visit_foreign_item(&mut self, i: &ast::ForeignItem) {
         visit::walk_foreign_item(self, i)
     }
 
-    fn visit_ty(&mut self, t: &ast::Ty) {
-        match t.node {
-            ast::TyPath(None, ref p) => {
-                match &*p.segments {
-
-                    [ast::PathSegment { identifier, .. }] => {
-                        let name = token::get_ident(identifier);
-                        let msg = if name == "int" {
-                            Some("the `int` type is deprecated; \
-                                  use `isize` or a fixed-sized integer")
-                        } else if name == "uint" {
-                            Some("the `uint` type is deprecated; \
-                                  use `usize` or a fixed-sized integer")
-                        } else {
-                            None
-                        };
-
-                        if let Some(msg) = msg {
-                            self.context.warn_feature("int_uint", t.span, msg)
-                        }
-                    }
-                    _ => {}
-                }
-            }
-            _ => {}
-        }
-        visit::walk_ty(self, t);
-    }
-
     fn visit_expr(&mut self, e: &ast::Expr) {
         match e.node {
             ast::ExprBox(..) | ast::ExprUnary(ast::UnOp::UnUniq, _) => {
@@ -661,25 +611,6 @@ fn visit_expr(&mut self, e: &ast::Expr) {
                                   "box expression syntax is experimental; \
                                    you can call `Box::new` instead.");
             }
-            ast::ExprLit(ref lit) => {
-                match lit.node {
-                    ast::LitInt(_, ty) => {
-                        let msg = if let ast::SignedIntLit(ast::TyIs(true), _) = ty {
-                            Some("the `i` and `is` suffixes on integers are deprecated; \
-                                  use `isize` or one of the fixed-sized suffixes")
-                        } else if let ast::UnsignedIntLit(ast::TyUs(true)) = ty {
-                            Some("the `u` and `us` suffixes on integers are deprecated; \
-                                  use `usize` or one of the fixed-sized suffixes")
-                        } else {
-                            None
-                        };
-                        if let Some(msg) = msg {
-                            self.context.warn_feature("int_uint", e.span, msg);
-                        }
-                    }
-                    _ => {}
-                }
-            }
             _ => {}
         }
         visit::walk_expr(self, e);
@@ -694,6 +625,11 @@ fn visit_pat(&mut self, pattern: &ast::Pat) {
                                    but at the end of a slice (e.g. \
                                    `[0, ..xs, 0]` are experimental")
             }
+            ast::PatVec(..) => {
+                self.gate_feature("slice_patterns",
+                                  pattern.span,
+                                  "slice pattern syntax is experimental");
+            }
             ast::PatBox(..) => {
                 self.gate_feature("box_patterns",
                                   pattern.span,
@@ -722,8 +658,8 @@ fn visit_fn(&mut self,
     }
 }
 
-fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::Crate,
-                        do_warnings: bool,
+fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler,
+                        krate: &ast::Crate,
                         check: F)
                        -> Features
     where F: FnOnce(&mut Context, &ast::Crate)
@@ -731,7 +667,6 @@ 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,
     };
 
@@ -812,14 +747,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, true,
+    check_crate_inner(cm, span_handler, krate,
                       |ctx, krate| visit::walk_crate(&mut MacroVisitor { context: ctx }, krate))
 }
 
-pub fn check_crate(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::Crate,
-                   do_warnings: bool) -> Features
+pub fn check_crate(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::Crate)
+                   -> Features
 {
-    check_crate_inner(cm, span_handler, krate, do_warnings,
+    check_crate_inner(cm, span_handler, krate,
                       |ctx, krate| visit::walk_crate(&mut PostExpansionVisitor { context: ctx },
                                                      krate))
 }
index 105a61d085725e8c004f1f8200d3c5d50b877167..d4451cc7b71243ea87a0b847d2e6941412a7d1f1 100644 (file)
@@ -40,7 +40,7 @@ fn move_map<F>(mut self, mut f: F) -> Vec<T> where F: FnMut(T) -> T {
         for p in &mut self {
             unsafe {
                 // FIXME(#5016) this shouldn't need to zero to be safe.
-                ptr::write(p, f(ptr::read_and_zero(p)));
+                ptr::write(p, f(ptr::read_and_drop(p)));
             }
         }
         self
index 72498afa3201e7c9383c46edd05ca78ded6d5bb3..c471d9e31792212cbcdf3b9dcd7ead5324d1d260 100644 (file)
@@ -29,7 +29,6 @@
 #![feature(box_syntax)]
 #![feature(collections)]
 #![feature(core)]
-#![feature(int_uint)]
 #![feature(libc)]
 #![feature(old_path)]
 #![feature(quote, unsafe_destructor)]
@@ -40,6 +39,7 @@
 #![feature(str_char)]
 #![feature(convert)]
 #![feature(into_cow)]
+#![feature(slice_patterns)]
 
 extern crate arena;
 extern crate fmt_macros;
@@ -49,7 +49,7 @@
 #[macro_use] extern crate log;
 #[macro_use] #[no_link] extern crate rustc_bitflags;
 
-extern crate "serialize" as rustc_serialize; // used by deriving
+extern crate serialize as rustc_serialize; // used by deriving
 
 pub mod util {
     pub mod interner;
index 0843713681bbdaad8b27502a7b8c34956ba151de..bcb265af9265527d85a78e209683456d1d156601 100644 (file)
 use diagnostic::SpanHandler;
 use ext::tt::transcribe::tt_next_token;
 use parse::token;
-use parse::token::{str_to_ident};
+use parse::token::str_to_ident;
 
 use std::borrow::{IntoCow, Cow};
 use std::char;
 use std::fmt;
 use std::mem::replace;
-use std::num;
 use std::rc::Rc;
 
 pub use ext::tt::transcribe::{TtReader, new_tt_reader, new_tt_reader_with_doc_flag};
@@ -622,8 +621,8 @@ fn bump_expecting_char<'a,D:fmt::Debug>(r: &mut StringReader<'a>,
 
         // find the integer representing the name
         self.scan_digits(base);
-        let encoded_name : u32 = self.with_str_from(start_bpos, |s| {
-            num::from_str_radix(s, 10).unwrap_or_else(|_| {
+        let encoded_name: u32 = self.with_str_from(start_bpos, |s| {
+            u32::from_str_radix(s, 10).unwrap_or_else(|_| {
                 panic!("expected digits representing a name, got {:?}, {}, range [{:?},{:?}]",
                       s, whence, start_bpos, self.last_pos);
             })
@@ -641,7 +640,7 @@ fn bump_expecting_char<'a,D:fmt::Debug>(r: &mut StringReader<'a>,
         let start_bpos = self.last_pos;
         self.scan_digits(base);
         let encoded_ctxt : ast::SyntaxContext = self.with_str_from(start_bpos, |s| {
-            num::from_str_radix(s, 10).unwrap_or_else(|_| {
+            u32::from_str_radix(s, 10).unwrap_or_else(|_| {
                 panic!("expected digits representing a ctxt, got {:?}, {}", s, whence);
             })
         });
@@ -742,6 +741,7 @@ fn scan_hex_digits(&mut self,
         let start_bpos = self.last_pos;
         let mut accum_int = 0;
 
+        let mut valid = true;
         for _ in 0..n_digits {
             if self.is_eof() {
                 let last_bpos = self.last_pos;
@@ -750,6 +750,7 @@ fn scan_hex_digits(&mut self,
             if self.curr_is(delim) {
                 let last_bpos = self.last_pos;
                 self.err_span_(start_bpos, last_bpos, "numeric character escape is too short");
+                valid = false;
                 break;
             }
             let c = self.curr.unwrap_or('\x00');
@@ -757,6 +758,8 @@ fn scan_hex_digits(&mut self,
             accum_int += c.to_digit(16).unwrap_or_else(|| {
                 self.err_span_char(self.last_pos, self.pos,
                               "illegal character in numeric character escape", c);
+
+                valid = false;
                 0
             });
             self.bump();
@@ -767,10 +770,11 @@ fn scan_hex_digits(&mut self,
                            self.last_pos,
                            "this form of character escape may only be used \
                             with characters in the range [\\x00-\\x7f]");
+            valid = false;
         }
 
         match char::from_u32(accum_int) {
-            Some(_) => true,
+            Some(_) => valid,
             None => {
                 let last_bpos = self.last_pos;
                 self.err_span_(start_bpos, last_bpos, "illegal numeric character escape");
@@ -799,7 +803,18 @@ fn scan_char_or_byte(&mut self, start: BytePos, first_source_char: char,
                             'n' | 'r' | 't' | '\\' | '\'' | '"' | '0' => true,
                             'x' => self.scan_byte_escape(delim, !ascii_only),
                             'u' if self.curr_is('{') => {
-                                self.scan_unicode_escape(delim)
+                            let valid = self.scan_unicode_escape(delim);
+                            if valid && ascii_only {
+                                self.err_span_(
+                                    escaped_pos,
+                                    self.last_pos,
+                                    "unicode escape sequences cannot be used as a byte or in \
+                                    a byte string"
+                                );
+                                false
+                            } else {
+                               valid
+                            }
                             }
                             '\n' if delim == '"' => {
                                 self.consume_whitespace();
@@ -869,6 +884,7 @@ fn scan_unicode_escape(&mut self, delim: char) -> bool {
         let start_bpos = self.last_pos;
         let mut count = 0;
         let mut accum_int = 0;
+        let mut valid = true;
 
         while !self.curr_is('}') && count <= 6 {
             let c = match self.curr {
@@ -884,29 +900,30 @@ fn scan_unicode_escape(&mut self, delim: char) -> bool {
                     self.fatal_span_(self.last_pos, self.pos,
                                      "unterminated unicode escape (needed a `}`)");
                 } else {
-                    self.fatal_span_char(self.last_pos, self.pos,
+                    self.err_span_char(self.last_pos, self.pos,
                                    "illegal character in unicode escape", c);
                 }
+                valid = false;
+                0
             });
             self.bump();
             count += 1;
         }
 
         if count > 6 {
-            self.fatal_span_(start_bpos, self.last_pos,
+            self.err_span_(start_bpos, self.last_pos,
                           "overlong unicode escape (can have at most 6 hex digits)");
+            valid = false;
         }
 
         self.bump(); // past the ending }
 
-        let mut valid = count >= 1 && count <= 6;
-        if char::from_u32(accum_int).is_none() {
-            valid = false;
+        if valid && (char::from_u32(accum_int).is_none() || count == 0) {
+            self.err_span_(start_bpos, self.last_pos, "illegal unicode character escape");
+            valid= false;
         }
 
-        if !valid {
-            self.fatal_span_(start_bpos, self.last_pos, "illegal unicode character escape");
-        }
+
         valid
     }
 
@@ -1330,7 +1347,7 @@ fn scan_byte(&mut self) -> token::Lit {
                 "unterminated byte constant".to_string());
         }
 
-        let id = if valid { self.name_from(start) } else { token::intern("??") };
+        let id = if valid { self.name_from(start) } else { token::intern("?") };
         self.bump(); // advance curr past token
         return token::Byte(id);
     }
index 4e85176121221debe0a40f2ffa89fe8fd5daaa91..544862a374a4e9e9ff52e6d59711f141f2278477 100644 (file)
@@ -21,6 +21,7 @@
 use std::fs::File;
 use std::io::Read;
 use std::iter;
+#[allow(deprecated)] // Int
 use std::num::Int;
 use std::path::{Path, PathBuf};
 use std::rc::Rc;
@@ -372,7 +373,7 @@ pub fn maybe_aborted<T>(result: T, p: Parser) -> T {
 /// well. Can take any slice prefixed by a character escape. Returns the
 /// character and the number of characters consumed.
 pub fn char_lit(lit: &str) -> (char, isize) {
-    use std::{num, char};
+    use std::char;
 
     let mut chars = lit.chars();
     let c = match (chars.next(), chars.next()) {
@@ -399,7 +400,7 @@ pub fn char_lit(lit: &str) -> (char, isize) {
     let msg2 = &msg[..];
 
     fn esc(len: usize, lit: &str) -> Option<(char, isize)> {
-        num::from_str_radix(&lit[2..len], 16).ok()
+        u32::from_str_radix(&lit[2..len], 16).ok()
         .and_then(char::from_u32)
         .map(|x| (x, len as isize))
     }
@@ -408,7 +409,7 @@ fn esc(len: usize, lit: &str) -> Option<(char, isize)> {
         if lit.as_bytes()[2] == b'{' {
             let idx = lit.find('}').expect(msg2);
             let subslice = &lit[3..idx];
-            num::from_str_radix(subslice, 16).ok()
+            u32::from_str_radix(subslice, 16).ok()
                 .and_then(char::from_u32)
                 .map(|x| (x, subslice.chars().count() as isize + 4))
         } else {
@@ -582,7 +583,7 @@ pub fn byte_lit(lit: &str) -> (u8, usize) {
             b'\'' => b'\'',
             b'0' => b'\0',
             _ => {
-                match ::std::num::from_str_radix::<u64>(&lit[2..4], 16).ok() {
+                match u64::from_str_radix(&lit[2..4], 16).ok() {
                     Some(c) =>
                         if c > 0xFF {
                             panic!(err(2))
@@ -700,18 +701,18 @@ pub fn integer_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) ->
     if let Some(suf) = suffix {
         if suf.is_empty() { sd.span_bug(sp, "found empty literal suffix in Some")}
         ty = match suf {
-            "isize" => ast::SignedIntLit(ast::TyIs(false), ast::Plus),
+            "isize" => ast::SignedIntLit(ast::TyIs, ast::Plus),
             "i8"  => ast::SignedIntLit(ast::TyI8, ast::Plus),
             "i16" => ast::SignedIntLit(ast::TyI16, ast::Plus),
             "i32" => ast::SignedIntLit(ast::TyI32, ast::Plus),
             "i64" => ast::SignedIntLit(ast::TyI64, ast::Plus),
-            "usize" => ast::UnsignedIntLit(ast::TyUs(false)),
+            "usize" => ast::UnsignedIntLit(ast::TyUs),
             "u8"  => ast::UnsignedIntLit(ast::TyU8),
             "u16" => ast::UnsignedIntLit(ast::TyU16),
             "u32" => ast::UnsignedIntLit(ast::TyU32),
             "u64" => ast::UnsignedIntLit(ast::TyU64),
-            "i" | "is" => ast::SignedIntLit(ast::TyIs(true), ast::Plus),
-            "u" | "us" => ast::UnsignedIntLit(ast::TyUs(true)),
+            "is" => ast::SignedIntLit(ast::TyIs, ast::Plus),
+            "us" => ast::UnsignedIntLit(ast::TyUs),
             _ => {
                 // i<digits> and u<digits> look like widths, so lets
                 // give an error message along those lines
@@ -733,7 +734,7 @@ pub fn integer_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) ->
     debug!("integer_lit: the type is {:?}, base {:?}, the new string is {:?}, the original \
            string was {:?}, the original suffix was {:?}", ty, base, s, orig, suffix);
 
-    let res: u64 = match ::std::num::from_str_radix(s, base).ok() {
+    let res = match u64::from_str_radix(s, base).ok() {
         Some(r) => r,
         None => { sd.span_err(sp, "int literal is too large"); 0 }
     };
index 276be73823a421dec63d6a22791bfd239f634d43..bb9b586bb3f3d1914320b1d452ba0678905cfc77 100644 (file)
@@ -23,7 +23,6 @@
 #[derive(Copy, PartialEq, Eq, Hash)]
 pub enum ObsoleteSyntax {
     ClosureKind,
-    EmptyIndex,
     ExternCrateString,
 }
 
@@ -52,11 +51,6 @@ fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax) {
                 "rely on inference instead",
                 true,
             ),
-            ObsoleteSyntax::EmptyIndex => (
-                "[]",
-                "write `[..]` instead",
-                false, // warning for now
-            ),
             ObsoleteSyntax::ExternCrateString => (
                 "\"crate-name\"",
                 "use an identifier not in quotes instead",
index 786970ce252965f652cedb01d6c2c5e419e159ac..6f1f73aa2a9c5d6027e844f2d30c31a618b36491 100644 (file)
@@ -11,7 +11,7 @@
 pub use self::PathParsingMode::*;
 
 use abi;
-use ast::{BareFnTy};
+use ast::BareFnTy;
 use ast::{RegionTyParamBound, TraitTyParamBound, TraitBoundModifier};
 use ast::{Public, Unsafety};
 use ast::{Mod, BiAdd, Arg, Arm, Attribute, BindByRef, BindByValue};
@@ -2312,46 +2312,13 @@ pub fn parse_dot_or_call_expr_with(&mut self, e0: P<Expr>) -> P<Expr> {
               // expr[...]
               // Could be either an index expression or a slicing expression.
               token::OpenDelim(token::Bracket) => {
-                let bracket_pos = self.span.lo;
                 self.bump();
 
-                if self.eat(&token::CloseDelim(token::Bracket)) {
-                    // No expression, expand to a RangeFull
-                    // FIXME(#20516) It would be better to use a lang item or
-                    // something for RangeFull.
-                    hi = self.last_span.hi;
-
-                    let idents = vec![token::str_to_ident("std"),
-                                      token::str_to_ident("ops"),
-                                      token::str_to_ident("RangeFull")];
-                    let segments = idents.into_iter().map(|ident| {
-                        ast::PathSegment {
-                            identifier: ident,
-                            parameters: ast::PathParameters::none(),
-                        }
-                    }).collect();
-                    let span = mk_sp(lo, hi);
-                    let path = ast::Path {
-                        span: span,
-                        global: true,
-                        segments: segments,
-                    };
-
-                    let range = ExprStruct(path, vec![], None);
-                    let ix = self.mk_expr(bracket_pos, hi, range);
-                    let index = self.mk_index(e, ix);
-                    e = self.mk_expr(lo, hi, index);
-
-                    let obsolete_span = mk_sp(bracket_pos, hi);
-                    self.obsolete(obsolete_span, ObsoleteSyntax::EmptyIndex);
-                } else {
-                    let ix = self.parse_expr();
-                    hi = self.span.hi;
-                    self.commit_expr_expecting(&*ix, token::CloseDelim(token::Bracket));
-                    let index = self.mk_index(e, ix);
-                    e = self.mk_expr(lo, hi, index)
-                }
-
+                let ix = self.parse_expr();
+                hi = self.span.hi;
+                self.commit_expr_expecting(&*ix, token::CloseDelim(token::Bracket));
+                let index = self.mk_index(e, ix);
+                e = self.mk_expr(lo, hi, index)
               }
               _ => return e
             }
@@ -4984,46 +4951,19 @@ fn parse_item_foreign_static(&mut self, vis: ast::Visibility,
     ///
     /// # Examples
     ///
-    /// extern crate url;
-    /// extern crate foo = "bar"; //deprecated
-    /// extern crate "bar" as foo;
+    /// extern crate foo;
+    /// extern crate bar as foo;
     fn parse_item_extern_crate(&mut self,
-                                lo: BytePos,
-                                visibility: Visibility,
-                                attrs: Vec<Attribute>)
+                               lo: BytePos,
+                               visibility: Visibility,
+                               attrs: Vec<Attribute>)
                                 -> P<Item> {
 
-        let (maybe_path, ident) = match self.token {
-            token::Ident(..) => {
-                let crate_name = self.parse_ident();
-                if self.eat_keyword(keywords::As) {
-                    (Some(crate_name.name), self.parse_ident())
-                } else {
-                    (None, crate_name)
-                }
-            },
-            token::Literal(token::Str_(..), suf) |
-            token::Literal(token::StrRaw(..), suf) => {
-                let sp = self.span;
-                self.expect_no_suffix(sp, "extern crate name", suf);
-                // forgo the internal suffix check of `parse_str` to
-                // avoid repeats (this unwrap will always succeed due
-                // to the restriction of the `match`)
-                let (s, _, _) = self.parse_optional_str().unwrap();
-                self.expect_keyword(keywords::As);
-                let the_ident = self.parse_ident();
-                self.obsolete(sp, ObsoleteSyntax::ExternCrateString);
-                let s = token::intern(&s);
-                (Some(s), the_ident)
-            },
-            _ => {
-                let span = self.span;
-                let token_str = self.this_token_to_string();
-                self.span_fatal(span,
-                                &format!("expected extern crate name but \
-                                         found `{}`",
-                                        token_str));
-            }
+        let crate_name = self.parse_ident();
+        let (maybe_path, ident) = if self.eat_keyword(keywords::As) {
+            (Some(crate_name.name), self.parse_ident())
+        } else {
+            (None, crate_name)
         };
         self.expect(&token::Semi);
 
index ca3a1848c3a6161313590be914a2b5d1a2756302..7e0bcd3e1dc3f8a2229823209c8d47a9cb722bdc 100644 (file)
@@ -71,8 +71,8 @@ pub fn map<F>(mut self, f: F) -> P<T> where
     {
         unsafe {
             let p = &mut *self.ptr;
-            // FIXME(#5016) this shouldn't need to zero to be safe.
-            ptr::write(p, f(ptr::read_and_zero(p)));
+            // FIXME(#5016) this shouldn't need to drop-fill to be safe.
+            ptr::write(p, f(ptr::read_and_drop(p)));
         }
         self
     }
index 0fa7e4f902c6c63dad243bd548c04e0d902212f8..021ec4738ed94416797fd687d1178be21eaaad34 100644 (file)
@@ -52,7 +52,7 @@ struct StandardLibraryInjector {
 impl fold::Folder for StandardLibraryInjector {
     fn fold_crate(&mut self, mut krate: ast::Crate) -> ast::Crate {
 
-        // The name to use in `extern crate "name" as std;`
+        // The name to use in `extern crate name as std;`
         let actual_crate_name = match self.alt_std_name {
             Some(ref s) => token::intern(&s),
             None => token::intern("std"),
index 2a47a696b1cf2ad8745b1c92d9667973a5ed96f7..fbee11ee657c3411740dc29305edf7296c42acd7 100644 (file)
@@ -134,7 +134,7 @@ fn fold_item(&mut self, i: P<ast::Item>) -> SmallVector<P<ast::Item>> {
                         path: self.cx.path.clone(),
                         bench: is_bench_fn(&self.cx, &*i),
                         ignore: is_ignored(&*i),
-                        should_panic: should_panic(&*i, self.cx.span_diagnostic)
+                        should_panic: should_panic(&*i)
                     };
                     self.cx.testfns.push(test);
                     self.tests.push(i.ident);
@@ -386,16 +386,8 @@ fn is_ignored(i: &ast::Item) -> bool {
     i.attrs.iter().any(|attr| attr.check_name("ignore"))
 }
 
-fn should_panic(i: &ast::Item, diag: &diagnostic::SpanHandler) -> ShouldPanic {
-    match i.attrs.iter().find(|attr| {
-        if attr.check_name("should_panic") { return true; }
-        if attr.check_name("should_fail") {
-            diag.span_warn(attr.span, "`#[should_fail]` is deprecated. Use `#[should_panic]` \
-                                       instead");
-            return true;
-        }
-        false
-    }) {
+fn should_panic(i: &ast::Item) -> ShouldPanic {
+    match i.attrs.iter().find(|attr| attr.check_name("should_panic")) {
         Some(attr) => {
             let msg = attr.meta_item_list()
                 .and_then(|list| list.iter().find(|mi| mi.check_name("expected")))
index 9b570c2b1fe2993643f7d9173efe36a590ef1553..ec608646327be4fea2f833a6415fc2a598ebbbab 100644 (file)
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 use ast;
-use parse::{new_parse_sess};
+use parse::new_parse_sess;
 use parse::{ParseSess,string_to_filemap,filemap_to_tts};
-use parse::{new_parser_from_source_str};
+use parse::new_parser_from_source_str;
 use parse::parser::Parser;
 use parse::token;
 use ptr::P;
index 41e066cc94a92b2aab65ea336f0c2b16639bffe6..ed2d00d6ad788ad00008e3a6fb868745f4a1df84 100644 (file)
@@ -57,7 +57,6 @@
 
 #![feature(box_syntax)]
 #![feature(collections)]
-#![feature(int_uint)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
 #![feature(std_misc)]
index 1d6657d5932c0d5a410282254e8a7056571dc148..4840cd1fddadfe2ecd142e67b6ea2354e96f2d56 100644 (file)
@@ -82,7 +82,7 @@ fn fg(&mut self, color: color::Color) -> io::Result<bool> {
                                .get("setaf")
                                .unwrap()
                                ,
-                           &[Number(color as int)], &mut Variables::new());
+                           &[Number(color as isize)], &mut Variables::new());
             if s.is_ok() {
                 try!(self.out.write_all(&s.unwrap()));
                 return Ok(true)
@@ -99,7 +99,7 @@ fn bg(&mut self, color: color::Color) -> io::Result<bool> {
                                .get("setab")
                                .unwrap()
                                ,
-                           &[Number(color as int)], &mut Variables::new());
+                           &[Number(color as isize)], &mut Variables::new());
             if s.is_ok() {
                 try!(self.out.write_all(&s.unwrap()));
                 return Ok(true)
index 30b732781db1cdead56be19d692d607036eaf62b..d6a4659c45a893275093250a7d1b14f8407452f5 100644 (file)
@@ -27,12 +27,12 @@ enum States {
     PushParam,
     CharConstant,
     CharClose,
-    IntConstant(int),
+    IntConstant(isize),
     FormatPattern(Flags, FormatState),
-    SeekIfElse(int),
-    SeekIfElsePercent(int),
-    SeekIfEnd(int),
-    SeekIfEndPercent(int)
+    SeekIfElse(isize),
+    SeekIfElsePercent(isize),
+    SeekIfEnd(isize),
+    SeekIfEndPercent(isize)
 }
 
 #[derive(Copy, PartialEq)]
@@ -47,7 +47,7 @@ enum FormatState {
 #[derive(Clone)]
 pub enum Param {
     Words(String),
-    Number(int)
+    Number(isize)
 }
 
 /// Container for static and dynamic variable arrays
@@ -143,7 +143,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
                     '{' => state = IntConstant(0),
                     'l' => if stack.len() > 0 {
                         match stack.pop().unwrap() {
-                            Words(s) => stack.push(Number(s.len() as int)),
+                            Words(s) => stack.push(Number(s.len() as isize)),
                             _        => return Err("a non-str was used with %l".to_string())
                         }
                     } else { return Err("stack is empty".to_string()) },
@@ -268,7 +268,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
                             ' ' => flags.space = true,
                             '.' => fstate = FormatStatePrecision,
                             '0'...'9' => {
-                                flags.width = cur as uint - '0' as uint;
+                                flags.width = cur as usize - '0' as usize;
                                 fstate = FormatStateWidth;
                             }
                             _ => unreachable!()
@@ -305,12 +305,12 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
                 if cur >= 'A' && cur <= 'Z' {
                     if stack.len() > 0 {
                         let idx = (cur as u8) - b'A';
-                        vars.sta[idx as uint] = stack.pop().unwrap();
+                        vars.sta[idx as usize] = stack.pop().unwrap();
                     } else { return Err("stack is empty".to_string()) }
                 } else if cur >= 'a' && cur <= 'z' {
                     if stack.len() > 0 {
                         let idx = (cur as u8) - b'a';
-                        vars.dyn[idx as uint] = stack.pop().unwrap();
+                        vars.dyn[idx as usize] = stack.pop().unwrap();
                     } else { return Err("stack is empty".to_string()) }
                 } else {
                     return Err("bad variable name in %P".to_string());
@@ -319,16 +319,16 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
             GetVar => {
                 if cur >= 'A' && cur <= 'Z' {
                     let idx = (cur as u8) - b'A';
-                    stack.push(vars.sta[idx as uint].clone());
+                    stack.push(vars.sta[idx as usize].clone());
                 } else if cur >= 'a' && cur <= 'z' {
                     let idx = (cur as u8) - b'a';
-                    stack.push(vars.dyn[idx as uint].clone());
+                    stack.push(vars.dyn[idx as usize].clone());
                 } else {
                     return Err("bad variable name in %g".to_string());
                 }
             },
             CharConstant => {
-                stack.push(Number(c as int));
+                stack.push(Number(c as isize));
                 state = CharClose;
             },
             CharClose => {
@@ -343,10 +343,10 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
                         state = Nothing;
                     }
                     '0'...'9' => {
-                        state = IntConstant(i*10 + (cur as int - '0' as int));
+                        state = IntConstant(i*10 + (cur as isize - '0' as isize));
                         old_state = Nothing;
                     }
-                    _ => return Err("bad int constant".to_string())
+                    _ => return Err("bad isize constant".to_string())
                 }
             }
             FormatPattern(ref mut flags, ref mut fstate) => {
@@ -372,7 +372,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
                         flags.space = true;
                     }
                     (FormatStateFlags,'0'...'9') => {
-                        flags.width = cur as uint - '0' as uint;
+                        flags.width = cur as usize - '0' as usize;
                         *fstate = FormatStateWidth;
                     }
                     (FormatStateFlags,'.') => {
@@ -380,7 +380,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
                     }
                     (FormatStateWidth,'0'...'9') => {
                         let old = flags.width;
-                        flags.width = flags.width * 10 + (cur as uint - '0' as uint);
+                        flags.width = flags.width * 10 + (cur as usize - '0' as usize);
                         if flags.width < old { return Err("format width overflow".to_string()) }
                     }
                     (FormatStateWidth,'.') => {
@@ -388,7 +388,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
                     }
                     (FormatStatePrecision,'0'...'9') => {
                         let old = flags.precision;
-                        flags.precision = flags.precision * 10 + (cur as uint - '0' as uint);
+                        flags.precision = flags.precision * 10 + (cur as usize - '0' as usize);
                         if flags.precision < old {
                             return Err("format precision overflow".to_string())
                         }
@@ -446,8 +446,8 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
 
 #[derive(Copy, PartialEq)]
 struct Flags {
-    width: uint,
-    precision: uint,
+    width: usize,
+    precision: usize,
     alternate: bool,
     left: bool,
     sign: bool,
index 8d0a9e6e9717d502d2e7b17fa1dd34dceddc90e4..01d191f30147b23450942f367135dac8b16d583f 100644 (file)
@@ -189,31 +189,31 @@ macro_rules! try { ($e:expr) => (
                            0x011A_usize, magic as usize));
     }
 
-    let names_bytes          = try!(read_le_u16(file)) as int;
-    let bools_bytes          = try!(read_le_u16(file)) as int;
-    let numbers_count        = try!(read_le_u16(file)) as int;
-    let string_offsets_count = try!(read_le_u16(file)) as int;
-    let string_table_bytes   = try!(read_le_u16(file)) as int;
+    let names_bytes          = try!(read_le_u16(file)) as isize;
+    let bools_bytes          = try!(read_le_u16(file)) as isize;
+    let numbers_count        = try!(read_le_u16(file)) as isize;
+    let string_offsets_count = try!(read_le_u16(file)) as isize;
+    let string_table_bytes   = try!(read_le_u16(file)) as isize;
 
     assert!(names_bytes          > 0);
 
-    if (bools_bytes as uint) > boolnames.len() {
+    if (bools_bytes as usize) > boolnames.len() {
         return Err("incompatible file: more booleans than \
                     expected".to_string());
     }
 
-    if (numbers_count as uint) > numnames.len() {
+    if (numbers_count as usize) > numnames.len() {
         return Err("incompatible file: more numbers than \
                     expected".to_string());
     }
 
-    if (string_offsets_count as uint) > stringnames.len() {
+    if (string_offsets_count as usize) > stringnames.len() {
         return Err("incompatible file: more string offsets than \
                     expected".to_string());
     }
 
     // don't read NUL
-    let bytes = try!(read_exact(file, names_bytes as uint - 1));
+    let bytes = try!(read_exact(file, names_bytes as usize - 1));
     let names_str = match String::from_utf8(bytes) {
         Ok(s)  => s,
         Err(_) => return Err("input not utf-8".to_string()),
@@ -230,7 +230,7 @@ macro_rules! try { ($e:expr) => (
         for i in 0..bools_bytes {
             let b = try!(read_byte(file));
             if b == 1 {
-                bools_map.insert(bnames[i as uint].to_string(), true);
+                bools_map.insert(bnames[i as usize].to_string(), true);
             }
         }
     }
@@ -244,7 +244,7 @@ macro_rules! try { ($e:expr) => (
         for i in 0..numbers_count {
             let n = try!(read_le_u16(file));
             if n != 0xFFFF {
-                numbers_map.insert(nnames[i as uint].to_string(), n);
+                numbers_map.insert(nnames[i as usize].to_string(), n);
             }
         }
     }
@@ -259,7 +259,7 @@ macro_rules! try { ($e:expr) => (
 
         let string_table = try!(read_exact(file, string_table_bytes as usize));
 
-        if string_table.len() != string_table_bytes as uint {
+        if string_table.len() != string_table_bytes as usize {
             return Err("error: hit EOF before end of string \
                         table".to_string());
         }
@@ -285,13 +285,13 @@ macro_rules! try { ($e:expr) => (
 
 
             // Find the offset of the NUL we want to go to
-            let nulpos = string_table[offset as uint .. string_table_bytes as uint]
+            let nulpos = string_table[offset as usize .. string_table_bytes as usize]
                 .iter().position(|&b| b == 0);
             match nulpos {
                 Some(len) => {
                     string_map.insert(name.to_string(),
-                                      string_table[offset as uint ..
-                                                   (offset as uint + len)].to_vec())
+                                      string_table[offset as usize ..
+                                                   (offset as usize + len)].to_vec())
                 },
                 None => {
                     return Err("invalid file: missing NUL in \
index 66ee2b1ba87cbee6337302ff195d21093564ae41..3083f8e89298904526351d0b0bf2df4064df68c9 100644 (file)
@@ -67,7 +67,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<Box<PathBuf>> {
                 return Some(box newp);
             }
             // on some installations the dir is named after the hex of the char (e.g. OS X)
-            let f = format!("{:x}", first_char as uint);
+            let f = format!("{:x}", first_char as usize);
             let newp = p.join(&f).join(term);
             if newp.exists() {
                 return Some(box newp);
index c48c7e413d03baa961ec62c60a07b19e82da678c..ee0d190d729eb30f9ab1445368a64ea596733a48 100644 (file)
@@ -38,7 +38,6 @@
 #![feature(box_syntax)]
 #![feature(collections)]
 #![feature(core)]
-#![feature(int_uint)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
 #![feature(std_misc)]
@@ -50,7 +49,7 @@
 
 extern crate getopts;
 extern crate serialize;
-extern crate "serialize" as rustc_serialize;
+extern crate serialize as rustc_serialize;
 extern crate term;
 extern crate libc;
 
@@ -78,7 +77,7 @@
 use std::io;
 use std::iter::repeat;
 use std::num::{Float, Int};
-use std::path::{PathBuf};
+use std::path::PathBuf;
 use std::sync::mpsc::{channel, Sender};
 use std::sync::{Arc, Mutex};
 use std::thread;
@@ -129,7 +128,7 @@ enum NamePadding {
 }
 
 impl TestDesc {
-    fn padded_name(&self, column_count: uint, align: NamePadding) -> String {
+    fn padded_name(&self, column_count: usize, align: NamePadding) -> String {
         let mut name = String::from_str(self.name.as_slice());
         let fill = column_count.saturating_sub(name.len());
         let mut pad = repeat(" ").take(fill).collect::<String>();
@@ -341,7 +340,7 @@ fn usage(binary: &str) {
 only those tests that match are run.
 
 By default, all tests are run in parallel. This can be altered with the
-RUST_TEST_THRADS environment variable when running tests (set it to 1).
+RUST_TEST_THREADS environment variable when running tests (set it to 1).
 
 All tests have their standard output and standard error captured by default.
 This can be overridden with the --nocapture flag or the RUST_TEST_NOCAPTURE=1
@@ -421,7 +420,7 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
 #[derive(Clone, PartialEq)]
 pub struct BenchSamples {
     ns_iter_summ: stats::Summary<f64>,
-    mb_s: uint,
+    mb_s: usize,
 }
 
 #[derive(Clone, PartialEq)]
@@ -444,14 +443,14 @@ struct ConsoleTestState<T> {
     log_out: Option<File>,
     out: OutputLocation<T>,
     use_color: bool,
-    total: uint,
-    passed: uint,
-    failed: uint,
-    ignored: uint,
-    measured: uint,
+    total: usize,
+    passed: usize,
+    failed: usize,
+    ignored: usize,
+    measured: usize,
     metrics: MetricMap,
     failures: Vec<(TestDesc, Vec<u8> )> ,
-    max_name_len: uint, // number of columns to fill when aligning names
+    max_name_len: usize, // number of columns to fill when aligning names
 }
 
 impl<T: Write> ConsoleTestState<T> {
@@ -535,7 +534,7 @@ pub fn write_plain(&mut self, s: &str) -> io::Result<()> {
         }
     }
 
-    pub fn write_run_start(&mut self, len: uint) -> io::Result<()> {
+    pub fn write_run_start(&mut self, len: usize) -> io::Result<()> {
         self.total = len;
         let noun = if len != 1 { "tests" } else { "test" };
         self.write_plain(&format!("\nrunning {} {}\n", len, noun))
@@ -635,13 +634,13 @@ pub fn write_run_finish(&mut self) -> io::Result<bool> {
 pub fn fmt_bench_samples(bs: &BenchSamples) -> String {
     if bs.mb_s != 0 {
         format!("{:>9} ns/iter (+/- {}) = {} MB/s",
-             bs.ns_iter_summ.median as uint,
-             (bs.ns_iter_summ.max - bs.ns_iter_summ.min) as uint,
+             bs.ns_iter_summ.median as usize,
+             (bs.ns_iter_summ.max - bs.ns_iter_summ.min) as usize,
              bs.mb_s)
     } else {
         format!("{:>9} ns/iter (+/- {})",
-             bs.ns_iter_summ.median as uint,
-             (bs.ns_iter_summ.max - bs.ns_iter_summ.min) as uint)
+             bs.ns_iter_summ.median as usize,
+             (bs.ns_iter_summ.max - bs.ns_iter_summ.min) as usize)
     }
 }
 
@@ -689,7 +688,7 @@ fn callback<T: Write>(event: &TestEvent,
     }
 
     let mut st = try!(ConsoleTestState::new(opts, None::<io::Stdout>));
-    fn len_if_padded(t: &TestDescAndFn) -> uint {
+    fn len_if_padded(t: &TestDescAndFn) -> usize {
         match t.testfn.padding() {
             PadNone => 0,
             PadOnLeft | PadOnRight => t.desc.name.as_slice().len(),
@@ -845,10 +844,10 @@ fn run_tests<F>(opts: &TestOpts,
 }
 
 #[allow(deprecated)]
-fn get_concurrency() -> uint {
+fn get_concurrency() -> usize {
     match env::var("RUST_TEST_THREADS") {
         Ok(s) => {
-            let opt_n: Option<uint> = s.parse().ok();
+            let opt_n: Option<usize> = s.parse().ok();
             match opt_n {
                 Some(n) if n > 0 => n,
                 _ => panic!("RUST_TEST_THREADS is `{}`, should be a positive integer.", s)
@@ -1164,7 +1163,7 @@ pub fn benchmark<F>(f: F) -> BenchSamples where F: FnMut(&mut Bencher) {
 
         BenchSamples {
             ns_iter_summ: ns_iter_summ,
-            mb_s: mb_s as uint
+            mb_s: mb_s as usize
         }
     }
 }
@@ -1333,8 +1332,8 @@ pub fn sort_tests() {
 
         let names =
             vec!("sha1::test".to_string(),
-                 "int::test_to_str".to_string(),
-                 "int::test_pow".to_string(),
+                 "isize::test_to_str".to_string(),
+                 "isize::test_pow".to_string(),
                  "test::do_not_run_ignored_tests".to_string(),
                  "test::ignored_tests_result_in_ignored".to_string(),
                  "test::first_free_arg_should_be_a_filter".to_string(),
@@ -1361,8 +1360,8 @@ fn testfn() { }
         let filtered = filter_tests(&opts, tests);
 
         let expected =
-            vec!("int::test_pow".to_string(),
-                 "int::test_to_str".to_string(),
+            vec!("isize::test_pow".to_string(),
+                 "isize::test_to_str".to_string(),
                  "sha1::test".to_string(),
                  "test::do_not_run_ignored_tests".to_string(),
                  "test::filter_for_ignored_option".to_string(),
index e20e6d4f29bfab982cfcd71846711eee6f78cae8..94dee5ccc36b7a65dc39bf4e7e7463d839f3650d 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![allow(missing_docs)]
+#![allow(deprecated)] // Float
 
 use std::cmp::Ordering::{self, Less, Greater, Equal};
 use std::mem;
index db5a25b9bedcaf9e2352a9284566ba2626e99c14..2aeade5066fde0630cc7cfa2b0500dc0a74228ee 100644 (file)
 pub use tables::normalization::canonical_combining_class;
 pub use tables::UNICODE_VERSION;
 
-#[cfg(stage0)]
-/// Functionality for manipulating `char`.
-#[stable(feature = "rust1", since = "1.0.0")]
-pub trait CharExt {
-    /// Checks if a `char` parses as a numeric digit in the given radix.
-    ///
-    /// Compared to `is_numeric()`, this function only recognizes the characters
-    /// `0-9`, `a-z` and `A-Z`.
-    ///
-    /// # Return value
-    ///
-    /// Returns `true` if `c` is a valid digit under `radix`, and `false`
-    /// otherwise.
-    ///
-    /// # Panics
-    ///
-    /// Panics if given a radix > 36.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// let c = '1';
-    ///
-    /// assert!(c.is_digit(10));
-    ///
-    /// assert!('f'.is_digit(16));
-    /// ```
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn is_digit(self, radix: u32) -> bool;
-
-    /// Converts a character to the corresponding digit.
-    ///
-    /// # Return value
-    ///
-    /// If `c` is between '0' and '9', the corresponding value between 0 and
-    /// 9. If `c` is 'a' or 'A', 10. If `c` is 'b' or 'B', 11, etc. Returns
-    /// none if the character does not refer to a digit in the given radix.
-    ///
-    /// # Panics
-    ///
-    /// Panics if given a radix outside the range [0..36].
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// let c = '1';
-    ///
-    /// assert_eq!(c.to_digit(10), Some(1));
-    ///
-    /// assert_eq!('f'.to_digit(16), Some(15));
-    /// ```
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn to_digit(self, radix: u32) -> Option<u32>;
-
-    /// Returns an iterator that yields the hexadecimal Unicode escape of a
-    /// character, as `char`s.
-    ///
-    /// All characters are escaped with Rust syntax of the form `\\u{NNNN}`
-    /// where `NNNN` is the shortest hexadecimal representation of the code
-    /// point.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// for i in '❤'.escape_unicode() {
-    ///     println!("{}", i);
-    /// }
-    /// ```
-    ///
-    /// This prints:
-    ///
-    /// ```text
-    /// \
-    /// u
-    /// {
-    /// 2
-    /// 7
-    /// 6
-    /// 4
-    /// }
-    /// ```
-    ///
-    /// Collecting into a `String`:
-    ///
-    /// ```
-    /// let heart: String = '❤'.escape_unicode().collect();
-    ///
-    /// assert_eq!(heart, r"\u{2764}");
-    /// ```
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn escape_unicode(self) -> EscapeUnicode;
-
-    /// Returns an iterator that yields the 'default' ASCII and
-    /// C++11-like literal escape of a character, as `char`s.
-    ///
-    /// The default is chosen with a bias toward producing literals that are
-    /// legal in a variety of languages, including C++11 and similar C-family
-    /// languages. The exact rules are:
-    ///
-    /// * Tab, CR and LF are escaped as '\t', '\r' and '\n' respectively.
-    /// * Single-quote, double-quote and backslash chars are backslash-
-    ///   escaped.
-    /// * Any other chars in the range [0x20,0x7e] are not escaped.
-    /// * Any other chars are given hex Unicode escapes; see `escape_unicode`.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// for i in '"'.escape_default() {
-    ///     println!("{}", i);
-    /// }
-    /// ```
-    ///
-    /// This prints:
-    ///
-    /// ```text
-    /// \
-    /// "
-    /// ```
-    ///
-    /// Collecting into a `String`:
-    ///
-    /// ```
-    /// let quote: String = '"'.escape_default().collect();
-    ///
-    /// assert_eq!(quote, "\\\"");
-    /// ```
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn escape_default(self) -> EscapeDefault;
-
-    /// Returns the number of bytes this character would need if encoded in
-    /// UTF-8.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// let n = 'ß'.len_utf8();
-    ///
-    /// assert_eq!(n, 2);
-    /// ```
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn len_utf8(self) -> usize;
-
-    /// Returns the number of 16-bit code units this character would need if
-    /// encoded in UTF-16.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// let n = 'ß'.len_utf16();
-    ///
-    /// assert_eq!(n, 1);
-    /// ```
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn len_utf16(self) -> usize;
-
-    /// Encodes this character as UTF-8 into the provided byte buffer, and then
-    /// returns the number of bytes written.
-    ///
-    /// If the buffer is not large enough, nothing will be written into it and a
-    /// `None` will be returned. A buffer of length four is large enough to
-    /// encode any `char`.
-    ///
-    /// # Examples
-    ///
-    /// In both of these examples, 'ß' takes two bytes to encode.
-    ///
-    /// ```
-    /// # #![feature(unicode)]
-    /// let mut b = [0; 2];
-    ///
-    /// let result = 'ß'.encode_utf8(&mut b);
-    ///
-    /// assert_eq!(result, Some(2));
-    /// ```
-    ///
-    /// A buffer that's too small:
-    ///
-    /// ```
-    /// # #![feature(unicode)]
-    /// let mut b = [0; 1];
-    ///
-    /// let result = 'ß'.encode_utf8(&mut b);
-    ///
-    /// assert_eq!(result, None);
-    /// ```
-    #[unstable(feature = "unicode",
-               reason = "pending decision about Iterator/Writer/Reader")]
-    fn encode_utf8(self, dst: &mut [u8]) -> Option<usize>;
-
-    /// Encodes this character as UTF-16 into the provided `u16` buffer, and
-    /// then returns the number of `u16`s written.
-    ///
-    /// If the buffer is not large enough, nothing will be written into it and a
-    /// `None` will be returned. A buffer of length 2 is large enough to encode
-    /// any `char`.
-    ///
-    /// # Examples
-    ///
-    /// In both of these examples, 'ß' takes one `u16` to encode.
-    ///
-    /// ```
-    /// # #![feature(unicode)]
-    /// let mut b = [0; 1];
-    ///
-    /// let result = 'ß'.encode_utf16(&mut b);
-    ///
-    /// assert_eq!(result, Some(1));
-    /// ```
-    ///
-    /// A buffer that's too small:
-    ///
-    /// ```
-    /// # #![feature(unicode)]
-    /// let mut b = [0; 0];
-    ///
-    /// let result = 'ß'.encode_utf8(&mut b);
-    ///
-    /// assert_eq!(result, None);
-    /// ```
-    #[unstable(feature = "unicode",
-               reason = "pending decision about Iterator/Writer/Reader")]
-    fn encode_utf16(self, dst: &mut [u16]) -> Option<usize>;
-
-    /// Returns whether the specified character is considered a Unicode
-    /// alphabetic code point.
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn is_alphabetic(self) -> bool;
-
-    /// Returns whether the specified character satisfies the 'XID_Start'
-    /// Unicode property.
-    ///
-    /// 'XID_Start' is a Unicode Derived Property specified in
-    /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
-    /// mostly similar to ID_Start but modified for closure under NFKx.
-    #[unstable(feature = "unicode",
-               reason = "mainly needed for compiler internals")]
-    fn is_xid_start(self) -> bool;
-
-    /// Returns whether the specified `char` satisfies the 'XID_Continue'
-    /// Unicode property.
-    ///
-    /// 'XID_Continue' is a Unicode Derived Property specified in
-    /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
-    /// mostly similar to 'ID_Continue' but modified for closure under NFKx.
-    #[unstable(feature = "unicode",
-               reason = "mainly needed for compiler internals")]
-    fn is_xid_continue(self) -> bool;
-
-    /// Indicates whether a character is in lowercase.
-    ///
-    /// This is defined according to the terms of the Unicode Derived Core
-    /// Property `Lowercase`.
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn is_lowercase(self) -> bool;
-
-    /// Indicates whether a character is in uppercase.
-    ///
-    /// This is defined according to the terms of the Unicode Derived Core
-    /// Property `Uppercase`.
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn is_uppercase(self) -> bool;
-
-    /// Indicates whether a character is whitespace.
-    ///
-    /// Whitespace is defined in terms of the Unicode Property `White_Space`.
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn is_whitespace(self) -> bool;
-
-    /// Indicates whether a character is alphanumeric.
-    ///
-    /// Alphanumericness is defined in terms of the Unicode General Categories
-    /// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'.
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn is_alphanumeric(self) -> bool;
-
-    /// Indicates whether a character is a control code point.
-    ///
-    /// Control code points are defined in terms of the Unicode General
-    /// Category `Cc`.
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn is_control(self) -> bool;
-
-    /// Indicates whether the character is numeric (Nd, Nl, or No).
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn is_numeric(self) -> bool;
-
-    /// Converts a character to its lowercase equivalent.
-    ///
-    /// The case-folding performed is the common or simple mapping. See
-    /// `to_uppercase()` for references and more information.
-    ///
-    /// # Return value
-    ///
-    /// Returns an iterator which yields the characters corresponding to the
-    /// lowercase equivalent of the character. If no conversion is possible then
-    /// the input character is returned.
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn to_lowercase(self) -> ToLowercase;
-
-    /// Converts a character to its uppercase equivalent.
-    ///
-    /// The case-folding performed is the common or simple mapping: it maps
-    /// one Unicode codepoint to its uppercase equivalent according to the
-    /// Unicode database [1]. The additional [`SpecialCasing.txt`] is not yet
-    /// considered here, but the iterator returned will soon support this form
-    /// of case folding.
-    ///
-    /// A full reference can be found here [2].
-    ///
-    /// # Return value
-    ///
-    /// Returns an iterator which yields the characters corresponding to the
-    /// uppercase equivalent of the character. If no conversion is possible then
-    /// the input character is returned.
-    ///
-    /// [1]: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
-    ///
-    /// [`SpecialCasing`.txt`]: ftp://ftp.unicode.org/Public/UNIDATA/SpecialCasing.txt
-    ///
-    /// [2]: http://www.unicode.org/versions/Unicode4.0.0/ch03.pdf#G33992
-    #[stable(feature = "rust1", since = "1.0.0")]
-    fn to_uppercase(self) -> ToUppercase;
-
-    /// Returns this character's displayed width in columns, or `None` if it is a
-    /// control character other than `'\x00'`.
-    ///
-    /// `is_cjk` determines behavior for characters in the Ambiguous category:
-    /// if `is_cjk` is `true`, these are 2 columns wide; otherwise, they are 1.
-    /// In CJK contexts, `is_cjk` should be `true`, else it should be `false`.
-    /// [Unicode Standard Annex #11](http://www.unicode.org/reports/tr11/)
-    /// recommends that these characters be treated as 1 column (i.e.,
-    /// `is_cjk` = `false`) if the context cannot be reliably determined.
-    #[unstable(feature = "unicode",
-               reason = "needs expert opinion. is_cjk flag stands out as ugly")]
-    fn width(self, is_cjk: bool) -> Option<usize>;
-}
-
-#[cfg(stage0)]
-#[stable(feature = "rust1", since = "1.0.0")]
-impl CharExt for char {
-    #[inline]
-    fn is_digit(self, radix: u32) -> bool { C::is_digit(self, radix) }
-    fn to_digit(self, radix: u32) -> Option<u32> { C::to_digit(self, radix) }
-    fn escape_unicode(self) -> EscapeUnicode { C::escape_unicode(self) }
-    fn escape_default(self) -> EscapeDefault { C::escape_default(self) }
-    fn len_utf8(self) -> usize { C::len_utf8(self) }
-    fn len_utf16(self) -> usize { C::len_utf16(self) }
-    fn encode_utf8(self, dst: &mut [u8]) -> Option<usize> { C::encode_utf8(self, dst) }
-    fn encode_utf16(self, dst: &mut [u16]) -> Option<usize> { C::encode_utf16(self, dst) }
-
-    #[inline]
-    fn is_alphabetic(self) -> bool {
-        match self {
-            'a' ... 'z' | 'A' ... 'Z' => true,
-            c if c > '\x7f' => derived_property::Alphabetic(c),
-            _ => false
-        }
-    }
-
-    #[inline]
-    fn is_xid_start(self) -> bool { derived_property::XID_Start(self) }
-
-    #[inline]
-    fn is_xid_continue(self) -> bool { derived_property::XID_Continue(self) }
-
-    #[inline]
-    fn is_lowercase(self) -> bool {
-        match self {
-            'a' ... 'z' => true,
-            c if c > '\x7f' => derived_property::Lowercase(c),
-            _ => false
-        }
-    }
-
-    #[inline]
-    fn is_uppercase(self) -> bool {
-        match self {
-            'A' ... 'Z' => true,
-            c if c > '\x7f' => derived_property::Uppercase(c),
-            _ => false
-        }
-    }
-
-    #[inline]
-    fn is_whitespace(self) -> bool {
-        match self {
-            ' ' | '\x09' ... '\x0d' => true,
-            c if c > '\x7f' => property::White_Space(c),
-            _ => false
-        }
-    }
-
-    #[inline]
-    fn is_alphanumeric(self) -> bool {
-        self.is_alphabetic() || self.is_numeric()
-    }
-
-    #[inline]
-    fn is_control(self) -> bool { general_category::Cc(self) }
-
-    #[inline]
-    fn is_numeric(self) -> bool {
-        match self {
-            '0' ... '9' => true,
-            c if c > '\x7f' => general_category::N(c),
-            _ => false
-        }
-    }
-
-    #[inline]
-    fn to_lowercase(self) -> ToLowercase {
-        ToLowercase(Some(conversions::to_lower(self)))
-    }
-
-    #[inline]
-    fn to_uppercase(self) -> ToUppercase {
-        ToUppercase(Some(conversions::to_upper(self)))
-    }
-
-    #[inline]
-    fn width(self, is_cjk: bool) -> Option<usize> { charwidth::width(self, is_cjk) }
-}
-
 /// An iterator over the lowercase mapping of a given character, returned from
 /// the [`to_lowercase` method](../primitive.char.html#method.to_lowercase) on
 /// characters.
index de3a593143e79191852a1d682cea733af46c5d63..3f9dd8ab635c3bd64bf973f06354e0cd4eb59a3e 100644 (file)
@@ -22,7 +22,6 @@
 use core::cmp;
 use core::iter::{Filter, AdditiveIterator};
 use core::mem;
-use core::num::Int;
 use core::slice;
 use core::str::Split;
 
index 60fd8abfcae50629a3fc664bd809238fed039617..49cc7f6fef12bdd77a0f8b182d9a64c371cb17c8 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 60fd8abfcae50629a3fc664bd809238fed039617
+Subproject commit 49cc7f6fef12bdd77a0f8b182d9a64c371cb17c8
index 141ddba7db620dd02d763e4b73bbad6b1b7bea10..8b05f7c895527887e68a2a8169c6d44e14110214 100644 (file)
@@ -1,3 +1,13 @@
+S 2015-03-25 a923278
+  bitrig-x86_64 41de2c7a69a1ac648d3fa3b65e96a29bdc122163
+  freebsd-x86_64 cd02c86a9218da73b2a45aff293787010d33bf3e
+  linux-i386 da50141558eed6dabab97b79b2c6a7de4f2d2c5e
+  linux-x86_64 bca03458d28d07506bad4b80e5770b2117286244
+  macos-i386 522d59b23dd885a45e2c5b33e80e76240bb2d9af
+  macos-x86_64 82df09d51d73d119a2f4e4d8041879615cb22081
+  winnt-i386 5056e8def5ab4f4283b8f3aab160cc10231bb28d
+  winnt-x86_64 3f6b35ac12625b4b4b42dfd5eee5f6cbf122794e
+
 S 2015-03-17 c64d671
   bitrig-x86_64 41de2c7a69a1ac648d3fa3b65e96a29bdc122163
   freebsd-x86_64 14ced24e1339a4dd8baa9db69995daa52a948d54
index e56df439bc2a5c96bc1d3ad33e5a3d4769283448..bd23fb88217080d03513fa505f448a2d7148e402 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 trait me {
-    fn me(&self) -> uint;
+    fn me(&self) -> usize;
 }
-impl me for uint { fn me(&self) -> uint { *self } }
+impl me for usize { fn me(&self) -> usize { *self } }
index 666d2569c42b41275f3f7596ef77af22bfec6557..9d93d9689e737c94cd369ff800b2b06d51ba6687 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 pub struct Foo {
-    pub x: int
+    pub x: isize
 }
 
 impl Foo {
index 44fbcf2150a4bf9050ad727622351f4806cd10d4..b3960c2707b4b81c71a928c867837e64396e6518 100644 (file)
@@ -19,8 +19,8 @@ pub trait Bar {
     fn get(x: Option<Self>) -> <Self as Bar>::T;
 }
 
-impl Bar for int {
-    type T = uint;
+impl Bar for isize {
+    type T = usize;
 
-    fn get(_: Option<int>) -> uint { 22 }
+    fn get(_: Option<isize>) -> usize { 22 }
 }
index 96af3203066c7e6c79ae55d9ef7d155d74488886..9c90510a8573e7bb5dab27678bc5c84d2a537b16 100644 (file)
@@ -8,6 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub fn foo(x: &uint) -> uint {
+pub fn foo(x: &usize) -> usize {
     *x
 }
index 50116b397372f6319e97e31000d3c6d1a9b7a9ad..08a13fd8bcc9ab47cedd21cb844ad22c56b85da7 100644 (file)
 
 pub mod kitties {
     pub struct cat {
-      meows : uint,
+      meows : usize,
 
-      pub how_hungry : int,
+      pub how_hungry : isize,
     }
 
-    pub fn cat(in_x : uint, in_y : int) -> cat  {
+    pub fn cat(in_x : usize, in_y : isize) -> cat  {
         cat {
             meows: in_x,
             how_hungry: in_y
index 55fb424205eb82de2a389bfdd178375391592438..7d147832f09437f40d12ec428220de0884462ab6 100644 (file)
@@ -10,9 +10,9 @@
 
 pub mod kitties {
     pub struct cat {
-      meows : uint,
+      meows : usize,
 
-      pub how_hungry : int,
+      pub how_hungry : isize,
 
     }
 
@@ -20,7 +20,7 @@ impl cat {
         pub fn speak(&self) {}
     }
 
-    pub fn cat(in_x : uint, in_y : int) -> cat {
+    pub fn cat(in_x : usize, in_y : isize) -> cat {
         cat {
             meows: in_x,
             how_hungry: in_y
index 44d3a69fde48ffea2eb6d1a9e2bb1982ebd20af4..ec1bf108dcb007145909d00f1fdac1ab3c652967 100644 (file)
 
 pub mod kitties {
     pub struct cat {
-        meows : uint,
+        meows : usize,
 
-        pub how_hungry : int,
+        pub how_hungry : isize,
     }
 
     impl cat {
         pub fn speak(&mut self) { self.meows += 1; }
-        pub fn meow_count(&mut self) -> uint { self.meows }
+        pub fn meow_count(&mut self) -> usize { self.meows }
     }
 
-    pub fn cat(in_x : uint, in_y : int) -> cat {
+    pub fn cat(in_x : usize, in_y : isize) -> cat {
         cat {
             meows: in_x,
             how_hungry: in_y
index c10ef805a65de941aafdf7029ca799a496c01dd6..300cc31632e40e7375004841fd67d642746dd285 100644 (file)
@@ -10,9 +10,9 @@
 
 pub mod kitties {
     pub struct cat {
-        meows : uint,
+        meows : usize,
 
-        pub how_hungry : int,
+        pub how_hungry : isize,
         pub name : String,
     }
 
@@ -41,7 +41,7 @@ pub fn meow(&mut self) {
         }
     }
 
-    pub fn cat(in_x : uint, in_y : int, in_name: String) -> cat {
+    pub fn cat(in_x : usize, in_y : isize, in_name: String) -> cat {
         cat {
             meows: in_x,
             how_hungry: in_y,
index d113859a6bdc773100df08f3e9e477c38fa9c0d4..7fe608f1634c2d91574d2aa66ece0d0ded301f93 100644 (file)
 
 pub mod kitties {
     pub struct cat {
-        meows : uint,
-        pub how_hungry : int,
+        meows : usize,
+        pub how_hungry : isize,
     }
 
     impl cat {
         fn nap(&self) {}
     }
 
-    pub fn cat(in_x : uint, in_y : int) -> cat {
+    pub fn cat(in_x : usize, in_y : isize) -> cat {
         cat {
             meows: in_x,
             how_hungry: in_y
index 71552f4c97efce71317c439c77c218467c395cf2..c902a6c7dca89dbbe8fe8f79427c1c35d1ecee78 100644 (file)
@@ -12,9 +12,9 @@ pub mod kitties {
 
     pub struct cat<U> {
         info : Vec<U> ,
-        meows : uint,
+        meows : usize,
 
-        pub how_hungry : int,
+        pub how_hungry : isize,
     }
 
     impl<U> cat<U> {
@@ -22,10 +22,10 @@ pub fn speak<T>(&mut self, stuff: Vec<T> ) {
             self.meows += stuff.len();
         }
 
-        pub fn meow_count(&mut self) -> uint { self.meows }
+        pub fn meow_count(&mut self) -> usize { self.meows }
     }
 
-    pub fn cat<U>(in_x : uint, in_y : int, in_info: Vec<U> ) -> cat<U> {
+    pub fn cat<U>(in_x : usize, in_y : isize, in_info: Vec<U> ) -> cat<U> {
         cat {
             meows: in_x,
             how_hungry: in_y,
index 28fa354fef34ceda4b8a0a66998aa6f35b8e80b0..f54a39d61ef3ed0dd53bdfc2efb389e2f3e8ea54 100644 (file)
@@ -12,8 +12,8 @@ pub mod kitty {
     use std::fmt;
 
     pub struct cat {
-      meows : uint,
-      pub how_hungry : int,
+      meows : usize,
+      pub how_hungry : isize,
       pub name : String,
     }
 
@@ -50,7 +50,7 @@ pub fn eat(&mut self) -> bool {
         }
     }
 
-    pub fn cat(in_x : uint, in_y : int, in_name: String) -> cat {
+    pub fn cat(in_x : usize, in_y : isize, in_name: String) -> cat {
         cat {
             meows: in_x,
             how_hungry: in_y,
index 945004ede6de84518702b6e889d6027d3f2258a6..ee8290050f91babafb87664c20cd087fa1262b58 100644 (file)
@@ -12,5 +12,5 @@
 }
 
 pub const foopy: &'static str = "hi there";
-pub const uint_val: uint = 12;
-pub const uint_expr: uint = (1 << uint_val) - 1;
+pub const uint_val: usize = 12;
+pub const uint_expr: usize = (1 << uint_val) - 1;
index a3bcbd201e199ef2f130f1bfdacdabdf300d055e..76fe9fe5aa40a6a73b8c8f7dd8a90c12b75fead0 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub static BLOCK_FN_DEF: fn(uint) -> uint = {
-    fn foo(a: uint) -> uint {
+pub static BLOCK_FN_DEF: fn(usize) -> usize = {
+    fn foo(a: usize) -> usize {
         a + 10
     }
     foo
index a650b30e593f9d9f4c7c6c76acd9518c16fc4745..d8921f4e09a8a0bd2fb79cea5f2e547a482cb537 100644 (file)
 #![crate_name="cci_impl_lib"]
 
 pub trait uint_helpers {
-    fn to<F>(&self, v: uint, f: F) where F: FnMut(uint);
+    fn to<F>(&self, v: usize, f: F) where F: FnMut(usize);
 }
 
-impl uint_helpers for uint {
+impl uint_helpers for usize {
     #[inline]
-    fn to<F>(&self, v: uint, mut f: F) where F: FnMut(uint) {
+    fn to<F>(&self, v: usize, mut f: F) where F: FnMut(usize) {
         let mut i = *self;
         while i < v {
             f(i);
index a3a3dbac2b5515ca0b5d4eb3aff5f659c7bb615f..b6e69d29f70cd48dc45a44ea0542361c69890183 100644 (file)
@@ -17,7 +17,7 @@ pub mod rusti {
 }
 
 #[inline(always)]
-pub fn atomic_xchg(dst: *mut int, src: int) -> int {
+pub fn atomic_xchg(dst: *mut isize, src: isize) -> isize {
     unsafe {
         rusti::atomic_xchg(dst, src)
     }
index 587af956c77caad3d4c4c81adf830af7a23cba7d..8c1a283a72d77b98e3909af7c7e858e104c9b262 100644 (file)
@@ -44,8 +44,8 @@ pub fn alist_get<A:Clone + 'static,
 }
 
 #[inline]
-pub fn new_int_alist<B:'static>() -> alist<int, B> {
-    fn eq_int(a: int, b: int) -> bool { a == b }
+pub fn new_int_alist<B:'static>() -> alist<isize, B> {
+    fn eq_int(a: isize, b: isize) -> bool { a == b }
     return alist {
         eq_fn: eq_int,
         data: box RefCell::new(Vec::new()),
@@ -53,9 +53,9 @@ fn eq_int(a: int, b: int) -> bool { a == b }
 }
 
 #[inline]
-pub fn new_int_alist_2<B:'static>() -> alist<int, B> {
+pub fn new_int_alist_2<B:'static>() -> alist<isize, B> {
     #[inline]
-    fn eq_int(a: int, b: int) -> bool { a == b }
+    fn eq_int(a: isize, b: isize) -> bool { a == b }
     return alist {
         eq_fn: eq_int,
         data: box RefCell::new(Vec::new()),
index f3ad2a3aeb963c2208924e41d0a360c88e40d258..4c6f808c6192040a0fcc3e84ab4d9ecee1b47d5f 100644 (file)
@@ -12,7 +12,7 @@
 
 
 // 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) {
+pub fn iter<F>(v: Vec<usize> , mut f: F) where F: FnMut(usize) {
     let mut i = 0;
     let n = v.len();
     while i < n {
index 4331a1da2a26b62af83e6fc372a618609b08f045..b5b4390657b4f18d648421a75cf7286dbd28dd72 100644 (file)
@@ -11,7 +11,7 @@
 // this used to just ICE on compiling
 pub fn foo() {
     if cfg!(foo) {
-        static a: int = 3;
+        static a: isize = 3;
         a
     } else { 3 };
 }
index 81f924e29daa73f29bece01f2100224249b69714..7b1190fc085802ce00142236eec74bbbb979b127 100644 (file)
@@ -12,4 +12,4 @@
 
 extern crate a;
 
-pub fn foo() { a::foo::<int>(); }
+pub fn foo() { a::foo::<isize>(); }
index e26ea7c4fa6d0b73b79e49c83722512ccd5549fa..050f2fe732935e84799dc479f30d95e7b664b2b7 100644 (file)
@@ -12,4 +12,4 @@
 #![crate_name = "crateresolve1"]
 #![crate_type = "lib"]
 
-pub fn f() -> int { 10 }
+pub fn f() -> isize { 10 }
index 715171b143a4a46686e59ad3ab168f2a52a6a272..d19b3bafba5075a49fe327811b8f93fd78b15746 100644 (file)
@@ -12,4 +12,4 @@
 #![crate_name = "crateresolve1"]
 #![crate_type = "lib"]
 
-pub fn f() -> int { 20 }
+pub fn f() -> isize { 20 }
index f733b5b908ab49aff407753905edf2a33317e185..c5096ac49a885189b29c3f793096d2d46644848a 100644 (file)
@@ -12,4 +12,4 @@
 #![crate_name = "crateresolve1"]
 #![crate_type = "lib"]
 
-pub fn f() -> int { 30 }
+pub fn f() -> isize { 30 }
index 473528c681e7fb9eda5cc1530c130c56ece3cef1..0e02a8d96a3b2bc52eca85aa3a63f4617ef91032 100644 (file)
@@ -12,4 +12,4 @@
 
 #![crate_type = "lib"]
 
-pub fn f() -> int { 10 }
+pub fn f() -> isize { 10 }
index 1e95fa6b63903fcdcb7390d61670a468f303ce7d..6a11465b27ca077b67f55619e4f981847040dfcf 100644 (file)
@@ -12,4 +12,4 @@
 
 #![crate_type = "lib"]
 
-pub fn g() -> int { 20 }
+pub fn g() -> isize { 20 }
index 68a69f6dc9073c90c397b65be42581faa0bfa000..579e93aa059c68654baeff2131ef12f7f7c8fd53 100644 (file)
@@ -11,4 +11,4 @@
 #![crate_name="crateresolve4a#0.1"]
 #![crate_type = "lib"]
 
-pub fn f() -> int { 10 }
+pub fn f() -> isize { 10 }
index 6e23fddbce7dffbe10a209840647f234ced818f0..7da96e07b3f05628ded6c9f395e218e1cb3922dc 100644 (file)
@@ -11,4 +11,4 @@
 #![crate_name="crateresolve4a#0.2"]
 #![crate_type = "lib"]
 
-pub fn g() -> int { 20 }
+pub fn g() -> isize { 20 }
index 843fd57ee40d745641e39eed9b50173e63e37d57..9e4b0d158ecb90ae5a5dc92e29b9095bd5fd28d9 100644 (file)
@@ -15,4 +15,4 @@
 
 extern crate "crateresolve4a#0.2" as crateresolve4a;
 
-pub fn f() -> int { crateresolve4a::g() }
+pub fn f() -> isize { crateresolve4a::g() }
index 28c89c79316e2a31f395c6703ed27a3cd0f0c92a..a50b8dbf957eae57679298b070be0c508be4f29e 100644 (file)
@@ -15,4 +15,4 @@
 
 extern crate "crateresolve4a#0.1" as crateresolve4a;
 
-pub fn g() -> int { crateresolve4a::f() }
+pub fn g() -> isize { crateresolve4a::f() }
index 223e4f50ae8acb03ccc8ad15df9d37d5e88d3bd3..eaec37ed417d06afe8bcfee37d338d28a170515e 100644 (file)
@@ -12,7 +12,7 @@
 
 #![crate_type = "lib"]
 
-pub struct NameVal { pub name: String, pub val: int }
+pub struct NameVal { pub name: String, pub val: isize }
 
 pub fn struct_nameval() -> NameVal {
     NameVal { name: "crateresolve5".to_string(), val: 10 }
@@ -31,4 +31,4 @@ fn eq(&self, other: &e) -> bool { nominal_eq(*self, *other) }
     fn ne(&self, other: &e) -> bool { !nominal_eq(*self, *other) }
 }
 
-pub fn f() -> int { 10 }
+pub fn f() -> isize { 10 }
index 38740886b37ea18edb985fb03bc1eca85787be67..14d28c709cdb56f8a08ed738b2aaf9485285ef74 100644 (file)
@@ -12,7 +12,7 @@
 
 #![crate_type = "lib"]
 
-pub struct NameVal { pub name: String, pub val: int }
+pub struct NameVal { pub name: String, pub val: isize }
 pub fn struct_nameval() -> NameVal {
     NameVal { name: "crateresolve5".to_string(), val: 10 }
 }
@@ -30,4 +30,4 @@ pub fn nominal() -> e { e_val }
 
 pub fn nominal_neq(_e1: e, _e2: e) -> bool { false }
 
-pub fn f() -> int { 20 }
+pub fn f() -> isize { 20 }
index 801ace7d80492c1a2af85e2b2f91cf51edec837d..c05d292eaea47a395c115d08b5b1e6290da89061 100644 (file)
 // These both have the same version but differ in other metadata
 pub mod a {
     extern crate cr_1 (name = "crateresolve_calories", vers = "0.1", calories="100");
-    pub fn f() -> int { cr_1::f() }
+    pub fn f() -> isize { cr_1::f() }
 }
 
 pub mod b {
     extern crate cr_2 (name = "crateresolve_calories", vers = "0.1", calories="200");
-    pub fn f() -> int { cr_2::f() }
+    pub fn f() -> isize { cr_2::f() }
 }
index 5262d662971a43c82f573d45a57cd97e5ecfe9ba..bc2a2d83bfec120db02d76c7d53bff421bdab85d 100644 (file)
@@ -13,4 +13,4 @@
 
 #![crate_type = "lib"]
 
-pub fn f() -> int { 20 }
+pub fn f() -> isize { 20 }
index 4dba722971e3cd7e4cee8964147e841ab7c112ed..c1705d687abb00bf6fbdad445cc6151b77b0c23c 100644 (file)
@@ -11,4 +11,4 @@
 #![crate_name="crateresolve_calories#0.1"]
 #![crate_type = "lib"]
 
-pub fn f() -> int { 100 }
+pub fn f() -> isize { 100 }
index c7e26c8f506d43f1ef5c466176266cefb727c474..2ae87daab4e29b63f4498b9c0ac40678a752564e 100644 (file)
@@ -11,4 +11,4 @@
 #![crate_name="crateresolve_calories#0.1"]
 #![crate_type = "lib"]
 
-pub fn f() -> int { 200 }
+pub fn f() -> isize { 200 }
index d7e84a474e849e433fdb9fb7d662c8d782a8dda9..91a404bbba3935c4c9e2c802a303f69641aaa7b2 100644 (file)
@@ -13,7 +13,7 @@
 
 #[inline(never)]
 #[cfg(target_arch = "x86_64")]
-pub extern "win64" fn foo(a: int, b: int, c: int, d: int) {
+pub extern "win64" fn foo(a: isize, b: isize, c: isize, d: isize) {
     assert!(a == 1);
     assert!(b == 2);
     assert!(c == 3);
@@ -25,7 +25,7 @@ pub extern "win64" fn foo(a: int, b: int, c: int, d: int) {
 
 #[inline(never)]
 #[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "aarch64"))]
-pub extern fn foo(a: int, b: int, c: int, d: int) {
+pub extern fn foo(a: isize, b: isize, c: isize, d: isize) {
     assert!(a == 1);
     assert!(b == 2);
     assert!(c == 3);
index 4902766534a139d620203e6cc065ef9f08fa365f..0a921c8f5b3a0b1eb8fe6110786cf19a49977ba5 100644 (file)
 // Common code used for tests that model the Fn/FnMut/FnOnce hierarchy.
 
 pub trait Go {
-    fn go(&self, arg: int);
+    fn go(&self, arg: isize);
 }
 
-pub fn go<G:Go>(this: &G, arg: int) {
+pub fn go<G:Go>(this: &G, arg: isize) {
     this.go(arg)
 }
 
 pub trait GoMut {
-    fn go_mut(&mut self, arg: int);
+    fn go_mut(&mut self, arg: isize);
 }
 
-pub fn go_mut<G:GoMut>(this: &mut G, arg: int) {
+pub fn go_mut<G:GoMut>(this: &mut G, arg: isize) {
     this.go_mut(arg)
 }
 
 pub trait GoOnce {
-    fn go_once(self, arg: int);
+    fn go_once(self, arg: isize);
 }
 
-pub fn go_once<G:GoOnce>(this: G, arg: int) {
+pub fn go_once<G:GoOnce>(this: G, arg: isize) {
     this.go_once(arg)
 }
 
 impl<G> GoMut for G
     where G : Go
 {
-    fn go_mut(&mut self, arg: int) {
+    fn go_mut(&mut self, arg: isize) {
         go(&*self, arg)
     }
 }
@@ -45,7 +45,7 @@ fn go_mut(&mut self, arg: int) {
 impl<G> GoOnce for G
     where G : GoMut
 {
-    fn go_once(mut self, arg: int) {
+    fn go_once(mut self, arg: isize) {
         go_mut(&mut self, arg)
     }
 }
index df4e0658cb83ac4786cabf7ae600d87d78b56fd5..ad3cdedf7eafebca8c7234ccdc29ea606708d3d1 100644 (file)
@@ -11,7 +11,7 @@
 #![crate_type = "lib"]
 
 pub struct Fish {
-    pub x: int
+    pub x: isize
 }
 
 impl Fish {
index 4d4b1bcc4cbf036ee5178dacc8e3dbdcec4820f7..c3212b0fc6d22da10f0e422af95a3c793f6389ad 100644 (file)
@@ -11,7 +11,7 @@
 #![crate_type = "lib"]
 
 pub struct Fish {
-    pub x: int
+    pub x: isize
 }
 
 mod unexported {
index fd049a25a0cff8bea6700dcd39ac543d2d7e873b..6f5ddfd37a5c221e6585c1b13562e9374177bd8a 100644 (file)
 #![feature(struct_inherit)]
 
 pub virtual struct S1 {
-    pub f1: int,
+    pub f1: isize,
 }
 
 pub struct S2 : S1 {
-    pub f2: int,
+    pub f2: isize,
 }
 
 pub fn test_s2(s2: S2) {
index 77eb82f80228649965299a2e1be76ffe26a84a03..c09cc53466dc1f84c6d1d45edf3f86e7a86cd35f 100644 (file)
@@ -43,7 +43,7 @@ pub trait Stable {
     fn stable(&self);
 }
 
-impl Stable for uint {
+impl Stable for usize {
     fn unstable(&self) {}
     fn stable(&self) {}
 }
index ca5c6072cb371b98bd9ea096807f65abbb570944..0d15c13a4ef1e936322f9c64d9f947db9e2d348c 100644 (file)
@@ -15,43 +15,43 @@ pub mod test {
     pub struct A<T> { pub v: T }
 
     impl<T> A<T> {
-        pub fn foo(&self) -> int {
-            static a: int = 5;
+        pub fn foo(&self) -> isize {
+            static a: isize = 5;
             return a
         }
 
-        pub fn bar(&self) -> int {
-            static a: int = 6;
+        pub fn bar(&self) -> isize {
+            static a: isize = 6;
             return a;
         }
     }
 }
 
 impl<T> A<T> {
-    pub fn foo(&self) -> int {
-        static a: int = 1;
+    pub fn foo(&self) -> isize {
+        static a: isize = 1;
         return a
     }
 
-    pub fn bar(&self) -> int {
-        static a: int = 2;
+    pub fn bar(&self) -> isize {
+        static a: isize = 2;
         return a;
     }
 }
 
 impl<T> B<T> {
-    pub fn foo(&self) -> int {
-        static a: int = 3;
+    pub fn foo(&self) -> isize {
+        static a: isize = 3;
         return a
     }
 
-    pub fn bar(&self) -> int {
-        static a: int = 4;
+    pub fn bar(&self) -> isize {
+        static a: isize = 4;
         return a;
     }
 }
 
-pub fn foo() -> int {
+pub fn foo() -> isize {
     let a = A { v: () };
     let b = B { v: () };
     let c = test::A { v: () };
index d66cfe9bf636b716867370a728bd5f52091142c6..21935b6b9ab07fbc514e488143ff8b197b298100 100644 (file)
@@ -15,12 +15,12 @@ pub trait Trait {
         fn f(&self) { f(); }
     }
 
-    impl Trait for int {}
+    impl Trait for isize {}
 
     fn f() {}
 }
 
 pub fn foo() {
-    let a = &1i as &inner::Trait;
+    let a = &1is as &inner::Trait;
     a.f();
 }
index 88277af4a5118667c24ca93d910f941ce0593574..37543ea1d3c5ef7028419ac7d1aa591cdf026bbd 100644 (file)
@@ -13,7 +13,7 @@ pub trait Trait {
         fn f(&self) { f(); }
     }
 
-    impl Trait for int {}
+    impl Trait for isize {}
 
     fn f() {}
 }
index 848574a61fe8f53a641a7bc05b2434e61c3aa30c..f12e4c9b6e7ea347361f0fa075aba59997e28bf9 100644 (file)
@@ -25,7 +25,7 @@ pub trait Outer {
     fn foo<T: Trait>(&self, t: T) { t.f(); }
 }
 
-impl Outer for int {}
+impl Outer for isize {}
 
 pub fn foo<T: Outer>(t: T) {
     t.foo(inner::Foo);
index a8a4c438e67343905d49322a963a57666cfdecf3..21ef99e3c3d95c7a562254d3c3e90cbc5894ef0a 100644 (file)
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub struct A<'a>(pub &'a int);
+pub struct A<'a>(pub &'a isize);
index cf1953005ba44c241cecd2af2db5dbc0f0480971..fa5722ae6a31ba51392d1f986b1dc866c6b06321 100644 (file)
@@ -12,5 +12,5 @@
 
 #![crate_type = "dylib"]
 
-extern crate "issue-12133-rlib" as a;
-extern crate "issue-12133-dylib" as b;
+extern crate issue_12133_rlib as a;
+extern crate issue_12133_dylib as b;
index f1f16af6f0e3f5adea1260ff025c0b696df66382..c0539aa1b6e20c2f41f1319d78eb37e5246df36e 100644 (file)
@@ -12,5 +12,5 @@
 
 #![crate_type = "rlib"]
 
-#[macro_use] #[no_link] extern crate "issue-13560-1" as t1;
-#[macro_use] extern crate "issue-13560-2" as t2;
+#[macro_use] #[no_link] extern crate issue_13560_1 as t1;
+#[macro_use] extern crate issue_13560_2 as t2;
index da47115e2b3f4e53a62c743669636c3ec05d06ed..554170bc130377b51268fdbc3ee2098ad36de73e 100644 (file)
@@ -8,6 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern crate "issue-13620-1" as crate1;
+extern crate issue_13620_1 as crate1;
 
 pub static FOO2: crate1::Foo = crate1::FOO;
index 8294d2b4594cfb00ebce192ca8d5513de99d01c1..bb51417528aef724fb5fcf913109218820046203 100644 (file)
@@ -8,6 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern crate "issue-13872-1" as foo;
+extern crate issue_13872_1 as foo;
 
 pub use foo::A::B;
index 827a9f18f4892a393002759dfa16ad2279e854b6..e20618f1ec076d2aab145666b1e30ef905990e48 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern crate "issue-13872-2" as bar;
+extern crate issue_13872_2 as bar;
 
 use bar::B;
 
index cbe56b00c13d59be061059d437efa6751a80c417..67474e7902170c91e96cc2a31474cb7e4a884894 100644 (file)
 
 use std::sync::atomic;
 
-pub const C1: uint = 1;
+pub const C1: usize = 1;
 pub const C2: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT;
 pub const C3: fn() = foo;
-pub const C4: uint = C1 * C1 + C1 / C1;
-pub const C5: &'static uint = &C4;
+pub const C4: usize = C1 * C1 + C1 / C1;
+pub const C5: &'static usize = &C4;
 
-pub static S1: uint = 3;
+pub static S1: usize = 3;
 pub static S2: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT;
 
 fn foo() {}
index fe1ef549d06acc107b6125e1a8e57ab31483f991..8c414193bd6281185efdc23fe0d02df9868aa693 100644 (file)
@@ -11,7 +11,7 @@
 #![crate_name="a"]
 #![crate_type = "lib"]
 
-type t1 = uint;
+type t1 = usize;
 
 trait foo {
     fn foo(&self);
index 832665abdc2d762ab48ac265c3a54e3a674eea43..e85a0a90aff0fce5d1e4abc3d348f78012e39010 100644 (file)
@@ -16,7 +16,7 @@
 use std::marker;
 
 struct arc_destruct<T: Sync> {
-    _data: int,
+    _data: isize,
     _marker: marker::PhantomData<T>
 }
 
@@ -25,7 +25,7 @@ impl<T: Sync> Drop for arc_destruct<T> {
     fn drop(&mut self) {}
 }
 
-fn arc_destruct<T: Sync>(data: int) -> arc_destruct<T> {
+fn arc_destruct<T: Sync>(data: isize) -> arc_destruct<T> {
     arc_destruct {
         _data: data,
         _marker: marker::PhantomData
@@ -41,7 +41,7 @@ fn init() -> arc_destruct<context_res> {
 }
 
 struct context_res {
-    ctx : int,
+    ctx : isize,
 }
 
 impl Drop for context_res {
index 2ffdddcc798ca8b28e94c686be7694a3e9986b43..82bd2b6420437f46357c755f7b47fd7a5da42802 100644 (file)
@@ -11,4 +11,4 @@
 
 use std::collections::HashMap;
 
-pub type map = Box<HashMap<uint, uint>>;
+pub type map = Box<HashMap<usize, usize>>;
index 7bfd2e79641d038ccc86f2f9ec81aa32bd6832b5..8f328699ae0aadb7aaefac767b1d24aaa6baf49e 100644 (file)
@@ -21,5 +21,5 @@ pub fn leaf<V>(value: V) -> TreeItem<V> {
 }
 
 fn main() {
-    BTree::<int> { node: leaf(1) };
+    BTree::<isize> { node: leaf(1) };
 }
index 1e746bf39db6196074bca1ea181bde9d73e9ab3c..0da0b9fa47d6c1c01918ae1bb4ce77e125fada9c 100644 (file)
@@ -14,9 +14,9 @@
 pub use other::foo;
 
 mod other {
-    pub struct FooBar{value: int}
+    pub struct FooBar{value: isize}
     impl FooBar{
-        pub fn new(val: int) -> FooBar {
+        pub fn new(val: isize) -> FooBar {
             FooBar{value: val}
         }
     }
index 4a8839abc7cb2083017e8030f302d466c04266ac..22ccb3dfacdf1285912e6bbab1083ca38e17d73d 100644 (file)
@@ -41,10 +41,10 @@ pub fn type_ids() -> Vec<TypeId> {
     pub type FooChar = char;
 
     // Tests ty_int (does not test all variants of IntTy)
-    pub type FooInt = int;
+    pub type FooInt = isize;
 
     // Tests ty_uint (does not test all variants of UintTy)
-    pub type FooUint = uint;
+    pub type FooUint = usize;
 
     // Tests ty_float (does not test all variants of FloatTy)
     pub type FooFloat = f64;
@@ -53,8 +53,8 @@ pub fn type_ids() -> Vec<TypeId> {
 
     // Tests ty_enum
     pub enum FooEnum {
-        VarA(uint),
-        VarB(uint, uint)
+        VarA(usize),
+        VarB(usize, usize)
     }
 
     // Tests ty_uniq (of u8)
@@ -71,14 +71,14 @@ pub enum FooEnum {
 
     // Tests ty_trait
     pub trait FooTrait {
-        fn foo_method(&self) -> uint;
-        fn foo_static_method() -> uint;
+        fn foo_method(&self) -> usize;
+        fn foo_static_method() -> usize;
     }
 
     // Tests ty_struct
     pub struct FooStruct {
-        pub pub_foo_field: uint,
-        foo_field: uint
+        pub pub_foo_field: usize,
+        foo_field: usize
     }
 
     // Tests ty_tup
index 249a1bab465e9b341fbd2c4fe422822b259c13c8..18f78750b15fc4df1b1050f8a6235d7021e7f82e 100644 (file)
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 enum Foo {
-    Bar(int)
+    Bar(isize)
 }
 
 pub mod test {
     enum Foo {
-        Bar(int)
+        Bar(isize)
     }
 }
index 3657d39ff77e4824aa4362ab9feebca02eec8945..3901d73382fcfa2df3c5fcf5e6367d0d29b5e678 100644 (file)
@@ -10,9 +10,9 @@
 
 pub use foo::FOO2;
 
-pub const FOO: uint = 3;
-const BAR: uint = 3;
+pub const FOO: usize = 3;
+const BAR: usize = 3;
 
 mod foo {
-    pub const FOO2: uint = 3;
+    pub const FOO2: usize = 3;
 }
index 40c8eb9b23ad7dbd57b8ede9d2fcef09daf99005..12894ad72e1a4cea4f5d4a4ce1a91d576f0f97e3 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub struct Foo (pub int);
+pub struct Foo (pub isize);
 pub enum MyEnum {
     Foo(Foo),
 }
index bd8857ceef7ea4f55f14b0fa3bb6b9f06edad684..44bea136a7c3b3468d2653199572f214fb78e191 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 
-pub unsafe fn f(xs: Vec<int> ) {
+pub unsafe fn f(xs: Vec<isize> ) {
     xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::<Vec<()>>();
 }
index 91faace7a3f4d6b93064c4e3ab539a3b64ef74a0..5c306be69c42935cb656df5484c5a94f7b18411f 100644 (file)
 #![crate_type = "lib"]
 
 pub trait Positioned {
-  fn SetX(&mut self, int);
-  fn X(&self) -> int;
+  fn SetX(&mut self, isize);
+  fn X(&self) -> isize;
 }
 
 pub trait Movable: Positioned {
-  fn translate(&mut self, dx: int) {
+  fn translate(&mut self, dx: isize) {
     let x = self.X() + dx;
     self.SetX(x);
   }
index d17e4afb5e8acb48e82ae930fd87afdd517fd81b..8ff85cc359d4f7bd3499daae67e7a831eef39a6d 100644 (file)
@@ -8,16 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub fn foo<T>() -> &'static int {
+pub fn foo<T>() -> &'static isize {
     if false {
-        static a: int = 4;
+        static a: isize = 4;
         return &a;
     } else {
-        static a: int = 5;
+        static a: isize = 5;
         return &a;
     }
 }
 
-pub fn bar() -> &'static int {
-    foo::<int>()
+pub fn bar() -> &'static isize {
+    foo::<isize>()
 }
index c5d4182eae6533d44a3f549b9274f384f044edd9..72dfc75f41b969747eba45465ab47b37a773825d 100644 (file)
@@ -20,7 +20,7 @@ impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
 pub trait Sized : PhantomFn<Self> {}
 
 #[lang="panic"]
-fn panic(_: &(&'static str, &'static str, uint)) -> ! { loop {} }
+fn panic(_: &(&'static str, &'static str, usize)) -> ! { loop {} }
 
 #[lang = "stack_exhausted"]
 extern fn stack_exhausted() {}
@@ -32,3 +32,22 @@ fn panic(_: &(&'static str, &'static str, uint)) -> ! { loop {} }
 pub trait Copy : PhantomFn<Self> {
     // Empty.
 }
+
+#[lang="rem"]
+pub trait Rem<RHS=Self> {
+    type Output = Self;
+    fn rem(self, rhs: RHS) -> Self::Output;
+}
+
+impl Rem for isize {
+    type Output = isize;
+
+    #[inline]
+    fn rem(self, other: isize) -> isize {
+        // if you use `self % other` here, as one would expect, you
+        // get back an error because of potential failure/overflow,
+        // which tries to invoke error fns that don't have the
+        // appropriate signatures anymore. So...just return 0.
+        0
+    }
+}
index fd3e9b9ac9dcea8ca1de970fcddb5c8b842b0654..d96dfd848f3f0e3b8968c6086abcba5628228477 100644 (file)
@@ -31,8 +31,8 @@ fn baz() { }
 pub fn test() {
     let lib = DynamicLibrary::open(None).unwrap();
     unsafe {
-        assert!(lib.symbol::<int>("foo").is_ok());
-        assert!(lib.symbol::<int>("baz").is_err());
-        assert!(lib.symbol::<int>("bar").is_err());
+        assert!(lib.symbol::<isize>("foo").is_ok());
+        assert!(lib.symbol::<isize>("baz").is_err());
+        assert!(lib.symbol::<isize>("bar").is_err());
     }
 }
index a74c8c47cd9b7c7388c10ae457e6fb2bdec08cda..ca4046d81636a2a1bc9e1749f99432ee28b9c2ce 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 #[no_mangle]
-pub static foo: int = 3;
+pub static foo: isize = 3;
 
 pub fn bar() {}
index 1977e2aad285e902350eb498f1c632fdd8748cf2..50a9202a87b5c224ff4280bc001e90c56bc99b04 100644 (file)
 
 #[stable(feature = "test_feature", since = "1.0.0")]
 #[deprecated(since = "1.0.0")]
-pub fn foo() -> uint {
+pub fn foo() -> usize {
     20
 }
 
 #[unstable(feature = "test_feature")]
-pub fn bar() -> uint {
+pub fn bar() -> usize {
     40
 }
 
 #[unstable(feature = "test_feature")]
-pub fn baz() -> uint {
+pub fn baz() -> usize {
     30
 }
index d47575403e171729b4dd4c579eaa85a9e0dcfbc9..bb3b71bc2441b3a5761c47d4362a8d25c6574c62 100644 (file)
@@ -101,20 +101,20 @@ pub trait UnstableTrait { fn dummy(&self) { } }
 #[stable(feature = "test_feature", since = "1.0.0")]
 #[deprecated(since = "1.0.0")]
 pub struct DeprecatedStruct {
-    #[stable(feature = "test_feature", since = "1.0.0")] pub i: int
+    #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
 }
 #[unstable(feature = "test_feature")]
 #[deprecated(since = "1.0.0")]
 pub struct DeprecatedUnstableStruct {
-    #[stable(feature = "test_feature", since = "1.0.0")] pub i: int
+    #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
 }
 #[unstable(feature = "test_feature")]
 pub struct UnstableStruct {
-    #[stable(feature = "test_feature", since = "1.0.0")] pub i: int
+    #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct StableStruct {
-    #[stable(feature = "test_feature", since = "1.0.0")] pub i: int
+    #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
 }
 
 #[stable(feature = "test_feature", since = "1.0.0")]
@@ -145,14 +145,14 @@ pub enum Enum {
 
 #[stable(feature = "test_feature", since = "1.0.0")]
 #[deprecated(since = "1.0.0")]
-pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub int);
+pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
 #[unstable(feature = "test_feature")]
 #[deprecated(since = "1.0.0")]
-pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub int);
+pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
 #[unstable(feature = "test_feature")]
-pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub int);
+pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
 #[stable(feature = "rust1", since = "1.0.0")]
-pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub int);
+pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
 
 #[macro_export]
 macro_rules! macro_test {
index 974db7c92463839a1a7b9bb973a30e7eddf5d225..db26b10fc67cbf24442d3ea5bb78871234c7a03a 100644 (file)
@@ -13,6 +13,6 @@
 #[macro_use] extern crate log;
 
 pub fn foo<T>() {
-    fn death() -> int { panic!() }
+    fn death() -> isize { panic!() }
     debug!("{}", (||{ death() })());
 }
index 922efc1aec38fa99f2a1928155a0c85c28d3f78e..4f75e2b5d75651e05095f0fa6d2b0046c297363d 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub fn increment(x: uint) -> uint {
+pub fn increment(x: usize) -> usize {
     x + 1
 }
 
index 6ff6da716a9e035aa8a2fba8e80fa0548f700168..f95be3f4a1d057def76337564ffd0e2f876c653f 100644 (file)
@@ -11,7 +11,7 @@
 #![crate_type="lib"]
 
 pub struct S {
-    x: int,
+    x: isize,
 }
 
 impl Drop for S {
index 7412c17fd45b28cf3b32854f39f94866ff241bcd..b7bde4a74a553b05c13e38788fdcf94a4db24e7c 100644 (file)
@@ -12,8 +12,8 @@
 
 pub enum Foo {
     A,
-    B(int),
-    C { a: int },
+    B(isize),
+    C { a: isize },
 }
 
 impl Foo {
@@ -25,8 +25,8 @@ pub mod nest {
 
     pub enum Bar {
         D,
-        E(int),
-        F { a: int },
+        E(isize),
+        F { a: isize },
     }
 
     impl Bar {
index 3c0138a7077178c724cde33340d6122cdf22c065..3bf39b788db6e1e2b6b8c3f9728c1485916cb5ad 100644 (file)
@@ -10,8 +10,8 @@
 
 pub enum Foo {
     A,
-    B(int),
-    C { a: int },
+    B(isize),
+    C { a: isize },
 }
 
 impl Foo {
index fc1bea5a9fd41128c88b9a1b2506ed398cdb9477..63639c4cdb3c921eafff3fde33a11bbc7aca58d1 100644 (file)
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 // original problem
-pub fn foo<T>() -> int {
+pub fn foo<T>() -> isize {
     {
-        static foo: int = 2;
+        static foo: isize = 2;
         foo
     }
 }
@@ -20,7 +20,7 @@ pub fn foo<T>() -> int {
 struct Foo;
 impl Foo {
     pub fn foo<T>(&self) {
-        static X: uint = 1;
+        static X: usize = 1;
     }
 }
 
@@ -35,6 +35,6 @@ fn in_doctype(&mut self) {
 struct Bar;
 impl Foo {
     pub fn bar<T>(&self) {
-        static X: uint = 1;
+        static X: usize = 1;
     }
 }
index acd5ef0953e6e1fe7957096af0a95b8c1bcd5874..be3414b7ad2c0ab39be4334b3634cc887dda9e89 100644 (file)
@@ -10,4 +10,4 @@
 
 #![crate_type="lib"]
 
-pub struct Au(pub int);
+pub struct Au(pub isize);
index 94b079b1dcfebd225e360c402a8e53e022b79f9f..5ae8e0d298e53b046fb7e0203c6e5f51cac3505e 100644 (file)
@@ -8,5 +8,5 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub type oint = Option<int>;
+pub type oint = Option<isize>;
 pub fn foo() -> oint { Some(3) }
index 6f5f50475483d4ca05a5e672047551ed382e6928..5d93c131cadb73cbae3136c4a87844177c7fc3ea 100644 (file)
@@ -20,7 +20,7 @@
 use rustc::plugin::Registry;
 
 struct Foo {
-    foo: int
+    foo: isize
 }
 
 impl Drop for Foo {
index 8c07dd5b785fd8268c1800bd00a0df747433e817..19cdede5518a4e620f162c7482694f6b45ab9a38 100644 (file)
@@ -12,7 +12,7 @@ pub trait A {
     fn frob(&self);
 }
 
-impl A for int { fn frob(&self) {} }
+impl A for isize { fn frob(&self) {} }
 
 pub fn frob<T:A>(t: T) {
     t.frob();
index 2fb9d9923cb76b6f50380b290485b0b5d1d77e69..141b6bdd604fe0aff9701ff9f32c7a31683af341 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 pub struct A(());
-pub struct B(int);
-pub struct C(pub int, int);
-pub struct D(pub int);
+pub struct B(isize);
+pub struct C(pub isize, isize);
+pub struct D(pub isize);
index 8e1e591d94fca8dcc227ac8ae087b8269c828661..41aafd64cb3f488fd8f9f514e83054420c86f3b9 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 pub struct Foo {
-    pub name: int
+    pub name: isize
 }
index 3bad76f0e703e62919f7ea9622bf32ffbe438fd8..cc4db1a9581698afb6790a3c631ca645b8421668 100644 (file)
@@ -17,8 +17,8 @@ pub trait Bar {
     fn bar() -> Self;
 }
 
-impl Bar for int {
-    fn bar() -> int { 84 }
+impl Bar for isize {
+    fn bar() -> isize { 84 }
 }
 
 pub mod sub_foo {
@@ -26,8 +26,8 @@ pub trait Foo {
         fn foo() -> Self;
     }
 
-    impl Foo for int {
-        fn foo() -> int { 42 }
+    impl Foo for isize {
+        fn foo() -> isize { 42 }
     }
 
     pub struct Boz {
@@ -35,7 +35,7 @@ pub struct Boz {
     }
 
     impl Boz {
-        pub fn boz(i: int) -> bool {
+        pub fn boz(i: isize) -> bool {
             i > 0
         }
     }
index 9c0716e2cc2a5e7e92786906e996817858d2d54b..f49ac4fc8e401557b30b2ab3d2d03ba8f97be038 100644 (file)
 // scenario work. This is the library portion of the test.
 
 pub enum MaybeOwned<'a> {
-    Owned(int),
-    Borrowed(&'a int)
+    Owned(isize),
+    Borrowed(&'a isize)
 }
 
 pub struct Inv<'a> { // invariant w/r/t 'a
-    x: &'a mut &'a int
+    x: &'a mut &'a isize
 }
 
 // I encountered a bug at some point with encoding the IntoMaybeOwned
index a105cb7ae6cfb6ce9db14d867c12b2e2703b4b6b..855708535f1e835bc8ac77a6769d045506e2f902 100644 (file)
@@ -12,6 +12,7 @@
 
 #![crate_type="dylib"]
 #![feature(plugin_registrar, rustc_private)]
+#![feature(slice_patterns)]
 
 extern crate syntax;
 extern crate rustc;
@@ -32,7 +33,7 @@
 fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
         -> Box<MacResult + 'static> {
 
-    static NUMERALS: &'static [(&'static str, uint)] = &[
+    static NUMERALS: &'static [(&'static str, usize)] = &[
         ("M", 1000), ("CM", 900), ("D", 500), ("CD", 400),
         ("C",  100), ("XC",  90), ("L",  50), ("XL",  40),
         ("X",   10), ("IX",   9), ("V",   5), ("IV",   4),
index 8f5d3b5768a1a1d6a56767fc0dc21447c59bb5dc..72f1f73a81b81b81fbcbaf4c09feb1670b8300d0 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 #[no_mangle]
-pub extern "C" fn foo() -> uint {
+pub extern "C" fn foo() -> usize {
     1234
 }
index 1cb7ead2cff05a85e64be99693cd9143318e68a6..d62b98714026bd5ce78a7afa5b506eecc7cbb067 100644 (file)
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 #[inline]
-pub fn cci_fn() -> uint {
+pub fn cci_fn() -> usize {
     1200
 }
 
 #[inline]
-pub static CCI_STATIC: uint = 34;
+pub static CCI_STATIC: usize = 34;
index d1d9e3b8ff3ac7b12890e765d2fc546faa6d6d71..9aa16fb2694574c9f373d61fed16ece770d409db 100644 (file)
 // compile-flags: -C codegen-units=3 --crate-type=rlib,dylib
 
 pub mod a {
-    pub fn one() -> uint {
+    pub fn one() -> usize {
         1
     }
 }
 
 pub mod b {
-    pub fn two() -> uint {
+    pub fn two() -> usize {
         2
     }
 }
@@ -25,7 +25,7 @@ pub fn two() -> uint {
 pub mod c {
     use a::one;
     use b::two;
-    pub fn three() -> uint {
+    pub fn three() -> usize {
         one() + two()
     }
 }
index 27befee6f07f5cea2b7efbf4722460668c1cc7eb..2ccdb4e086447f642b43c9f8debcece691047524 100644 (file)
@@ -8,9 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![crate_name="static-function-pointer-aux"]
 
-pub fn f(x: int) -> int { -x }
+pub fn f(x: isize) -> isize { -x }
 
-pub static F: fn(int) -> int = f;
-pub static mut MutF: fn(int) -> int = f;
+pub static F: fn(isize) -> isize = f;
+pub static mut MutF: fn(isize) -> isize = f;
index 0cbd4378490d935676323ae250dc91f22f4c8d07..2193e12bceb2816fd2073e1689abdb78430444da 100644 (file)
 
 pub mod num {
     pub trait Num2 {
-        fn from_int2(n: int) -> Self;
+        fn from_int2(n: isize) -> Self;
     }
 }
 
 pub mod f64 {
     impl ::num::Num2 for f64 {
         #[inline]
-        fn from_int2(n: int) -> f64 { return n as f64;  }
+        fn from_int2(n: isize) -> f64 { return n as f64;  }
     }
 }
index 8785a8085dc359ac7e75e6938b4b8d8cc5c17f09..44e875fbe3c0519a7fa0f42532a234db3f825842 100644 (file)
 
 pub mod num {
     pub trait Num2 {
-        fn from_int2(n: int) -> Self;
+        fn from_int2(n: isize) -> Self;
     }
 }
 
 pub mod f64 {
     impl ::num::Num2 for f64 {
-        fn from_int2(n: int) -> f64 { return n as f64;  }
+        fn from_int2(n: isize) -> f64 { return n as f64;  }
     }
 }
index 5660fd5b61f9db76ca044052d26e5cb208832339..9d677e3dc46071255caabb08793bfd8a6dc524df 100644 (file)
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub static mut a: int = 3;
+pub static mut a: isize = 3;
index 6951ed729b27bb162c50b6a83e106dad3db99c06..859f38e809f917c4c32eaea6ef7f6cdbc0c1f0be 100644 (file)
@@ -10,8 +10,8 @@
 
 #![crate_type = "lib"]
 
-static private: int = 0;
-pub static public: int = 0;
+static private: isize = 0;
+pub static public: isize = 0;
 
 pub struct A(());
 
@@ -20,11 +20,11 @@ fn foo() {}
 }
 
 mod foo {
-    pub static a: int = 0;
+    pub static a: isize = 0;
     pub fn b() {}
     pub struct c;
     pub enum d {}
-    pub type e = int;
+    pub type e = isize;
 
     pub struct A(());
 
@@ -33,11 +33,11 @@ fn foo() {}
     }
 
     // these are public so the parent can reexport them.
-    pub static reexported_a: int = 0;
+    pub static reexported_a: isize = 0;
     pub fn reexported_b() {}
     pub struct reexported_c;
     pub enum reexported_d {}
-    pub type reexported_e = int;
+    pub type reexported_e = isize;
 }
 
 pub mod bar {
@@ -48,14 +48,14 @@ pub mod bar {
     pub use foo::reexported_e as i;
 }
 
-pub static a: int = 0;
+pub static a: isize = 0;
 pub fn b() {}
 pub struct c;
 pub enum d {}
-pub type e = int;
+pub type e = isize;
 
-static j: int = 0;
+static j: isize = 0;
 fn k() {}
 struct l;
 enum m {}
-type n = int;
+type n = isize;
index 3f386ab55d585625a6aabdb0817f48d0f1b3dabd..26941b726d4c04425405ff299a0557cf8d8cd5c7 100644 (file)
@@ -11,6 +11,6 @@
 #![crate_type="lib"]
 
 pub struct S {
-    pub x: int,
-    pub y: int,
+    pub x: isize,
+    pub y: isize,
 }
index e2c16ae8b5c492c6e9bedaacc27ea5bd39cdd9fb..fe1dc9d1c8cae3e35ac31b9ed07eba91a78f3dc9 100644 (file)
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 struct A {
-    a: int,
-    pub b: int,
+    a: isize,
+    pub b: isize,
 }
 
 pub struct B {
-    pub a: int,
-    b: int,
+    pub a: isize,
+    b: isize,
 }
index 8d9b304aa51e0c783979b78fa57401688a4b1034..40868fa3f706e8fca58c5a1b42ca94f8be59a0ba 100644 (file)
@@ -9,5 +9,5 @@
 // except according to those terms.
 
 enum Bar {
-    Baz { a: int }
+    Baz { a: isize }
 }
index 6d4ea499b2bde8f623b41acaf24ddc46d911aee6..7e10d2158ede08bda3eeba69d6cc8729f5b8c8b5 100644 (file)
@@ -27,12 +27,12 @@ pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
-static A_CONSTANT : int = 2;
+static A_CONSTANT : isize = 2;
 
-pub fn foo<T:U>(_: int) -> int {
+pub fn foo<T:U>(_: isize) -> isize {
     3
 }
 
-pub fn an_unused_name() -> int {
+pub fn an_unused_name() -> isize {
     4
 }
index 61e4aaf32586e3d96e1ba00fcd3bee56a58f003a..c5f38805511650925110d59c68159481bf2d0028 100644 (file)
@@ -27,12 +27,12 @@ pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
-static A_CONSTANT : int = 2;
+static A_CONSTANT : isize = 2;
 
-pub fn foo<T:U>(_: int) -> int {
+pub fn foo<T:U>(_: isize) -> isize {
     0
 }
 
-pub fn an_unused_name() -> int {
+pub fn an_unused_name() -> isize {
     4
 }
index cfdb0902b5d365f6d42f091258a0d27ffaa704e5..3168e747eb6e694c6222848a08c389458f23ef14 100644 (file)
@@ -27,14 +27,14 @@ pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
-static A_CONSTANT : int = 2;
+static A_CONSTANT : isize = 2;
 
 #[cfg(some_flag)]
-pub fn foo<T:U>(_: int) -> int {
+pub fn foo<T:U>(_: isize) -> isize {
     3
 }
 
 #[cfg(not(some_flag))]
-pub fn an_unused_name() -> int {
+pub fn an_unused_name() -> isize {
     4
 }
index e79738c04103522746e4cd728267ff38f6fb7218..f86a43494f78e740718e55b9306b5d6758550f98 100644 (file)
@@ -27,12 +27,12 @@ pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
-static A_CONSTANT : int = 2;
+static A_CONSTANT : isize = 2;
 
-pub fn foo<T:V>(_: int) -> int {
+pub fn foo<T:V>(_: isize) -> isize {
     3
 }
 
-pub fn an_unused_name() -> int {
+pub fn an_unused_name() -> isize {
     4
 }
index b22d553c02b5afb951a4eea095747c980e3d0253..dc412b700447beade18887dd4b577e60b3a393c4 100644 (file)
@@ -27,12 +27,12 @@ pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
-static A_CONSTANT : int = 2;
+static A_CONSTANT : isize = 2;
 
-pub fn foo<T:U>(_: i32) -> int {
+pub fn foo<T:U>(_: i32) -> isize {
     3
 }
 
-pub fn an_unused_name() -> int {
+pub fn an_unused_name() -> isize {
     4
 }
index 78dbdc28b9f31f572a9dde4ada8260d8fc2e71d6..0cfcbbb0554e684f7304a64001ad78234195afec 100644 (file)
@@ -27,9 +27,9 @@ pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
-static A_CONSTANT : int = 2;
+static A_CONSTANT : isize = 2;
 
-pub fn foo<T:U>(_: int) -> i64 {
+pub fn foo<T:U>(_: isize) -> i64 {
     3
 }
 
index 30592827039746562b385df875af145ecb2f2a13..e1e32095b5cb40d4e4c9dc5582ae5679dec65234 100644 (file)
@@ -29,10 +29,10 @@ impl V for () {}
 
 static A_CONSTANT : i32 = 2;
 
-pub fn foo<T:U>(_: int) -> int {
+pub fn foo<T:U>(_: isize) -> isize {
     3
 }
 
-pub fn an_unused_name() -> int {
+pub fn an_unused_name() -> isize {
     4
 }
index 4c457b099a4b17e6590b21905d056a47683d6e85..9fd97376b6681232843fcea84aa0b42d06ec2ce9 100644 (file)
@@ -27,13 +27,13 @@ pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
-static A_CONSTANT : int = 2;
+static A_CONSTANT : isize = 2;
 
-pub fn foo<T:U>(_: int) -> int {
+pub fn foo<T:U>(_: isize) -> isize {
     // a comment does not affect the svh
     3
 }
 
-pub fn an_unused_name() -> int {
+pub fn an_unused_name() -> isize {
     4
 }
index cab25ac9e4f4fbe78827cb65b74700c12f11282b..e64bde096b0169b0a334ce420492f434f6a17e32 100644 (file)
@@ -27,15 +27,15 @@ pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
-static A_CONSTANT : int = 2;
+static A_CONSTANT : isize = 2;
 
 // Adding some documentation does not affect the svh.
 
 /// foo always returns three.
-pub fn foo<T:U>(_: int) -> int {
+pub fn foo<T:U>(_: isize) -> isize {
     3
 }
 
-pub fn an_unused_name() -> int {
+pub fn an_unused_name() -> isize {
     4
 }
index 01926dc8abc43938aef08b77287f8b9c88b7bfb4..b16338f1e128c87d0bb3d6b7b44e41f1fb38b8e3 100644 (file)
@@ -27,14 +27,14 @@ pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
-static A_CONSTANT : int = 2;
+static A_CONSTANT : isize = 2;
 
-pub fn foo<T:U>(_: int) -> int {
+pub fn foo<T:U>(_: isize) -> isize {
     // a macro invocation in a function body does not affect the svh,
     // as long as it yields the same code.
     three!()
 }
 
-pub fn an_unused_name() -> int {
+pub fn an_unused_name() -> isize {
     4
 }
index 6d4ea499b2bde8f623b41acaf24ddc46d911aee6..7e10d2158ede08bda3eeba69d6cc8729f5b8c8b5 100644 (file)
@@ -27,12 +27,12 @@ pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
-static A_CONSTANT : int = 2;
+static A_CONSTANT : isize = 2;
 
-pub fn foo<T:U>(_: int) -> int {
+pub fn foo<T:U>(_: isize) -> isize {
     3
 }
 
-pub fn an_unused_name() -> int {
+pub fn an_unused_name() -> isize {
     4
 }
index f3a31df94b3e4e42af2d1b05f607b82e442e32aa..8cadd7bdf4174e1faeca675ebde218ea6563c8e0 100644 (file)
@@ -27,14 +27,14 @@ pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
-static A_CONSTANT : int = 2;
+static A_CONSTANT : isize = 2;
 
 // cfg attribute does not affect the svh, as long as it yields the same code.
 #[cfg(not(an_unused_name))]
-pub fn foo<T:U>(_: int) -> int {
+pub fn foo<T:U>(_: isize) -> isize {
     3
 }
 
-pub fn an_unused_name() -> int {
+pub fn an_unused_name() -> isize {
     4
 }
index bec6b207c071e4c5bb7072e2adae9c2532026ddd..fcaf77909554dd8bad665175ef690055b2540a61 100644 (file)
@@ -27,14 +27,14 @@ pub trait V : MarkerTrait {}
 impl U for () {}
 impl V for () {}
 
-static A_CONSTANT : int = 2;
+static A_CONSTANT : isize = 2;
 
-pub fn foo<T:U>(_: int) -> int {
+pub fn foo<T:U>(_: isize) -> isize {
 
     3
 
 }
 
-pub fn an_unused_name() -> int {
+pub fn an_unused_name() -> isize {
     4
 }
index 67fdac5df0330d38259a81a7087be887ce943327..6bd3ddab06c72426877cec82686ff2a69112ef3b 100644 (file)
 #![crate_name = "uta"]
 
 mod traits {
-    pub trait TraitA { fn val(&self) -> int { 2 } }
-    pub trait TraitB { fn val(&self) -> int { 3 } }
+    pub trait TraitA { fn val(&self) -> isize { 2 } }
+    pub trait TraitB { fn val(&self) -> isize { 3 } }
 }
 
 impl traits::TraitA for () {}
 impl traits::TraitB for () {}
 
-pub fn foo<T>(_: int) -> int {
+pub fn foo<T>(_: isize) -> isize {
     use traits::TraitA;
     let v = ();
     v.val()
index dfcf02c0ff500ab4327fae00f279cc174d818d8e..e863416817735b1a0de7a2a089aca9aea064ccd0 100644 (file)
 #![crate_name = "uta"]
 
 mod traits {
-    pub trait TraitA { fn val(&self) -> int { 2 } }
-    pub trait TraitB { fn val(&self) -> int { 3 } }
+    pub trait TraitA { fn val(&self) -> isize { 2 } }
+    pub trait TraitB { fn val(&self) -> isize { 3 } }
 }
 
 impl traits::TraitA for () {}
 impl traits::TraitB for () {}
 
-pub fn foo<T>(_: int) -> int {
+pub fn foo<T>(_: isize) -> isize {
     use traits::TraitB;
     let v = ();
     v.val()
index 338e04fbb074646cb9d46c06654ea662c68490a6..fadeb02440533aa00a36138359526b307ddab95b 100644 (file)
@@ -12,6 +12,6 @@
 
 #![crate_type = "dylib"]
 
-pub fn the_answer() -> int {
+pub fn the_answer() -> isize {
     2
 }
index 54da1a1e451c848b4f0ed0b04b04d79ca359b7be..4980eb8b91386b681911f1d5174ab628179ed76f 100644 (file)
@@ -13,7 +13,7 @@
 #![crate_type = "dylib"]
 #![feature(plugin_registrar, quote, rustc_private)]
 
-extern crate "syntax_extension_with_dll_deps_1" as other;
+extern crate syntax_extension_with_dll_deps_1 as other;
 extern crate syntax;
 extern crate rustc;
 
index beee83f9f7cd5eaa445a33ffda6cb5cc7b209d20..29cb0bc176a257dd03d6d088368f0b73a6608e6a 100644 (file)
@@ -17,7 +17,7 @@ pub struct Foo<T:Trait> {
 }
 
 pub enum Bar<T:Trait> {
-    ABar(int),
+    ABar(isize),
     BBar(T),
-    CBar(uint),
+    CBar(usize),
 }
index 7424c21be3da0c6b05fd5f6b4091951002dc68c7..c1168a912dc6846d8085012f5873109143771318 100644 (file)
@@ -8,24 +8,22 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![crate_name="trait_default_method_xc_aux"]
-
-pub struct Something { pub x: int }
+pub struct Something { pub x: isize }
 
 pub trait A {
-    fn f(&self) -> int;
-    fn g(&self) -> int { 10 }
-    fn h(&self) -> int { 11 }
-    fn lurr(x: &Self, y: &Self) -> int { x.g() + y.h() }
+    fn f(&self) -> isize;
+    fn g(&self) -> isize { 10 }
+    fn h(&self) -> isize { 11 }
+    fn lurr(x: &Self, y: &Self) -> isize { x.g() + y.h() }
 }
 
 
-impl A for int {
-    fn f(&self) -> int { 10 }
+impl A for isize {
+    fn f(&self) -> isize { 10 }
 }
 
 impl A for Something {
-    fn f(&self) -> int { 10 }
+    fn f(&self) -> isize { 10 }
 }
 
 pub trait B<T> {
@@ -33,7 +31,7 @@ fn thing<U>(&self, x: T, y: U) -> (T, U) { (x, y) }
     fn staticthing<U>(_z: &Self, x: T, y: U) -> (T, U) { (x, y) }
 }
 
-impl<T> B<T> for int { }
+impl<T> B<T> for isize { }
 impl B<f64> for bool { }
 
 
@@ -45,8 +43,8 @@ fn test_neq(&self, rhs: &Self) -> bool {
     }
 }
 
-impl TestEquality for int {
-    fn test_eq(&self, rhs: &int) -> bool {
+impl TestEquality for isize {
+    fn test_eq(&self, rhs: &isize) -> bool {
         *self == *rhs
     }
 }
index 4239865d577ae9d188766766dbf712f3e2ec0aa4..7443ef9c0f35943967dce12cc2e374950e914851 100644 (file)
 
 // aux-build:trait_default_method_xc_aux.rs
 
-extern crate "trait_default_method_xc_aux" as aux;
+extern crate trait_default_method_xc_aux as aux;
 use aux::A;
 
-pub struct a_struct { pub x: int }
+pub struct a_struct { pub x: isize }
 
 impl A for a_struct {
-    fn f(&self) -> int { 10 }
+    fn f(&self) -> isize { 10 }
 }
 
 // This function will need to get inlined, and badness may result.
index 4a4de2455e36ea4bce9e376fa364f2a4280f1c87..0adedfd4eeb22c9f61c96b88c94b04fdc6d0f02b 100644 (file)
@@ -13,5 +13,5 @@
 pub trait Foo : ::std::marker::MarkerTrait {
 }
 
-impl Foo for int {
+impl Foo for isize {
 }
index 9ef53795a26b44534c1ff0dc65cff8ac9c98d4e9..af0128d9676226fe3ffc73e00244bd11574bac46 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub trait Foo { fn f(&self) -> int; }
-pub trait Bar { fn g(&self) -> int; }
-pub trait Baz { fn h(&self) -> int; }
+pub trait Foo { fn f(&self) -> isize; }
+pub trait Bar { fn g(&self) -> isize; }
+pub trait Baz { fn h(&self) -> isize; }
 
-pub struct A { pub x: int }
+pub struct A { pub x: isize }
 
-impl Foo for A { fn f(&self) -> int { 10 } }
-impl Bar for A { fn g(&self) -> int { 20 } }
-impl Baz for A { fn h(&self) -> int { 30 } }
+impl Foo for A { fn f(&self) -> isize { 10 } }
+impl Bar for A { fn g(&self) -> isize { 20 } }
+impl Baz for A { fn h(&self) -> isize { 30 } }
index 59fdaed744e3acb14c2d85dcf083de21868275f7..6be1f8c45f48db0b39612be0f782fa0240186971 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub trait Foo { fn f(&self) -> int; }
-pub trait Bar { fn g(&self) -> int; }
-pub trait Baz { fn h(&self) -> int; }
+pub trait Foo { fn f(&self) -> isize; }
+pub trait Bar { fn g(&self) -> isize; }
+pub trait Baz { fn h(&self) -> isize; }
 
 pub trait Quux: Foo + Bar + Baz { }
 
index 0a84595124a12d366664db795398cc048377fc8e..9eeb815c5de88a0088256dd66b1fb51d6100dd59 100644 (file)
 
 
 pub trait Foo {
-    fn f(&self) -> int;
+    fn f(&self) -> isize;
 }
 
 pub struct A {
-    pub x: int
+    pub x: isize
 }
 
 impl Foo for A {
-    fn f(&self) -> int { 10 }
+    fn f(&self) -> isize { 10 }
 }
index 36442ed6c193114ae722f1eb05db77845f0029e8..1bfada612ebf6f3f1fdc3adee35c634c42938494 100644 (file)
@@ -16,7 +16,7 @@ pub trait MyNum : Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + Parti
 
 #[derive(Clone, Debug)]
 pub struct MyInt {
-    pub val: int
+    pub val: isize
 }
 
 impl Add for MyInt {
@@ -45,4 +45,4 @@ fn ne(&self, other: &MyInt) -> bool { !self.eq(other) }
 
 impl MyNum for MyInt {}
 
-fn mi(v: int) -> MyInt { MyInt { val: v } }
+fn mi(v: isize) -> MyInt { MyInt { val: v } }
index d5437690acdc74705e1b6ea3831c035ca42462db..585a756fd0767a795d84f8969d50231f256819c4 100644 (file)
@@ -11,9 +11,9 @@
 // Simple smoke test that unsafe traits can be compiled etc.
 
 pub unsafe trait Foo {
-    fn foo(&self) -> int;
+    fn foo(&self) -> isize;
 }
 
-unsafe impl Foo for int {
-    fn foo(&self) -> int { *self }
+unsafe impl Foo for isize {
+    fn foo(&self) -> isize { *self }
 }
index 82d07a9df4e12662e428d1feb51cffb1ea716e81..388d3238d4248960c37b2a317d249fca570f5a69 100644 (file)
 
 #![feature(core)]
 
-use std::any::TypeId;
+use std::any::{Any, TypeId};
 
 pub struct A;
 pub struct B(Option<A>);
-pub struct C(Option<int>);
+pub struct C(Option<isize>);
 pub struct D(Option<&'static str>);
-pub struct E(Result<&'static str, int>);
+pub struct E(Result<&'static str, isize>);
 
-pub type F = Option<int>;
-pub type G = uint;
+pub type F = Option<isize>;
+pub type G = usize;
 pub type H = &'static str;
 
 pub unsafe fn id_A() -> TypeId { TypeId::of::<A>() }
@@ -31,4 +31,4 @@ pub unsafe fn id_F() -> TypeId { TypeId::of::<F>() }
 pub unsafe fn id_G() -> TypeId { TypeId::of::<G>() }
 pub unsafe fn id_H() -> TypeId { TypeId::of::<H>() }
 
-pub unsafe fn foo<T: 'static>() -> TypeId { TypeId::of::<T>() }
+pub unsafe fn foo<T: Any>() -> TypeId { TypeId::of::<T>() }
index 82d07a9df4e12662e428d1feb51cffb1ea716e81..3ad307fd3b507b6b3cf199b4abb946227c881beb 100644 (file)
 
 #![feature(core)]
 
-use std::any::TypeId;
+use std::any::{Any, TypeId};
 
 pub struct A;
 pub struct B(Option<A>);
-pub struct C(Option<int>);
+pub struct C(Option<isize>);
 pub struct D(Option<&'static str>);
-pub struct E(Result<&'static str, int>);
+pub struct E(Result<&'static str, isize>);
 
-pub type F = Option<int>;
-pub type G = uint;
+pub type F = Option<isize>;
+pub type G = usize;
 pub type H = &'static str;
 
 pub unsafe fn id_A() -> TypeId { TypeId::of::<A>() }
@@ -31,4 +31,4 @@ pub unsafe fn id_F() -> TypeId { TypeId::of::<F>() }
 pub unsafe fn id_G() -> TypeId { TypeId::of::<G>() }
 pub unsafe fn id_H() -> TypeId { TypeId::of::<H>() }
 
-pub unsafe fn foo<T: 'static>() -> TypeId { TypeId::of::<T>() }
+pub unsafe fn foo<T:Any>() -> TypeId { TypeId::of::<T>() }
index 26925a350676491d09bb2ceb64dbd0c8658bc064..dac20dd2f7a790130667ddd55da448e73f25fe50 100644 (file)
@@ -13,7 +13,7 @@
 use std::ops::Add;
 
 #[inline]
-pub fn has_closures() -> uint {
+pub fn has_closures() -> usize {
     let x = 1;
     let mut f = move || x;
     let y = 1;
index 07c99ecefb861cf0c612592209ca003d5dae0738..5e7bc61943be57efb922d751d3f0cefd1c39fb7d 100644 (file)
@@ -11,7 +11,7 @@
 #![crate_type="lib"]
 
 pub struct Struct {
-    pub x: int
+    pub x: isize
 }
 
 impl Struct {
@@ -19,14 +19,14 @@ fn static_meth_struct() -> Struct {
         Struct { x: 1 }
     }
 
-    fn meth_struct(&self) -> int {
+    fn meth_struct(&self) -> isize {
         self.x
     }
 }
 
 pub enum Enum {
-    Variant1(int),
-    Variant2(int)
+    Variant1(isize),
+    Variant2(isize)
 }
 
 impl Enum {
@@ -34,7 +34,7 @@ fn static_meth_enum() -> Enum {
         Enum::Variant2(10)
     }
 
-    fn meth_enum(&self) -> int {
+    fn meth_enum(&self) -> isize {
         match *self {
             Enum::Variant1(x) |
             Enum::Variant2(x) => x
index 9e62415a20b4e8d6b615980ecc188d6d5088099a..5195839c067f7c4ee1a1d97cf38148ac4bff9235 100644 (file)
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub fn foo<T>() -> int {
-    static a: int = 3;
+pub fn foo<T>() -> isize {
+    static a: isize = 3;
     a
 }
 
-pub fn bar() -> int {
-    foo::<int>()
+pub fn bar() -> isize {
+    foo::<isize>()
 }
index 8065533dd738269766733fe45ec908a17c1deefc..652f11a71ec6f6d82ed403e4c76932e80202753f 100644 (file)
@@ -9,22 +9,22 @@
 // except according to those terms.
 
 #[inline(never)]
-pub static global: int = 3;
+pub static global: isize = 3;
 
 #[inline(never)]
-static global0: int = 4;
+static global0: isize = 4;
 
 #[inline(never)]
-pub static global2: &'static int = &global0;
+pub static global2: &'static isize = &global0;
 
-pub fn verify_same(a: &'static int) {
-    let a = a as *const int as uint;
-    let b = &global as *const int as uint;
+pub fn verify_same(a: &'static isize) {
+    let a = a as *const isize as usize;
+    let b = &global as *const isize as usize;
     assert_eq!(a, b);
 }
 
-pub fn verify_same2(a: &'static int) {
-    let a = a as *const int as uint;
-    let b = global2 as *const int as uint;
+pub fn verify_same2(a: &'static isize) {
+    let a = a as *const isize as usize;
+    let b = global2 as *const isize as usize;
     assert_eq!(a, b);
 }
index 5556ee6971c4a6728de4f17998ade8e033ebf0ca..334f7829bd1923c409c6f1dbcc411971ef4d35e5 100644 (file)
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 pub struct S {
-    pub x: int,
-    pub y: int,
+    pub x: isize,
+    pub y: isize,
 }
 
 pub type S2 = S;
index 538abf00a67037a99c8db482d2924e7eeb377e3e..6799cbc6f335531f9a658eacd86698c6be172528 100644 (file)
@@ -22,17 +22,17 @@ pub enum Unit {
 }
 
 #[derive(Copy)]
-pub struct TupleStruct(pub uint, pub &'static str);
+pub struct TupleStruct(pub usize, pub &'static str);
 
 // used by the cfail test
 
 #[derive(Copy)]
 pub struct StructWithFields {
-    foo: int,
+    foo: isize,
 }
 
 #[derive(Copy)]
 pub enum EnumWithVariants {
     EnumVariant,
-    EnumVariantArg(int)
+    EnumVariantArg(isize)
 }
index fb95f92da77094239763d5ee9c59a890fb0b2fc2..c7748d59c6a0481f85b68a36510c90556ff2307d 100644 (file)
@@ -29,11 +29,11 @@ fn move_out<T>(_x: T) {}
 
 enum request {
     get_count,
-    bytes(uint),
+    bytes(usize),
     stop
 }
 
-fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
+fn server(requests: &Receiver<request>, responses: &Sender<usize>) {
     let mut count = 0;
     let mut done = false;
     while !done {
@@ -55,8 +55,8 @@ fn run(args: &[String]) {
     let (to_parent, from_child) = channel();
     let (to_child, from_parent) = channel();
 
-    let size = args[1].parse::<uint>().unwrap();
-    let workers = args[2].parse::<uint>().unwrap();
+    let size = args[1].parse::<usize>().unwrap();
+    let workers = args[2].parse::<usize>().unwrap();
     let num_bytes = 100;
     let mut result = None;
     let mut p = Some((to_child, to_parent, from_parent));
index 6d702242d765f2714ee84f327e05d779e0950de6..b6a6e06088a09dddf770ce5722183b35369b2f1b 100644 (file)
 
 enum request {
     get_count,
-    bytes(uint),
+    bytes(usize),
     stop
 }
 
-fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
-    let mut count: uint = 0;
+fn server(requests: &Receiver<request>, responses: &Sender<usize>) {
+    let mut count: usize = 0;
     let mut done = false;
     while !done {
         match requests.recv() {
@@ -48,8 +48,8 @@ fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
 fn run(args: &[String]) {
     let (to_parent, from_child) = channel();
 
-    let size = args[1].parse::<uint>().unwrap();
-    let workers = args[2].parse::<uint>().unwrap();
+    let size = args[1].parse::<usize>().unwrap();
+    let workers = args[2].parse::<usize>().unwrap();
     let num_bytes = 100;
     let mut result = None;
     let mut to_parent = Some(to_parent);
index 6fb2c954e020503450a4845fc49fe5bafce01f6a..c87cdb617a477732e093a26d53fefa3b622d6245 100644 (file)
 use std::time::Duration;
 
 // A poor man's pipe.
-type pipe = Arc<(Mutex<Vec<uint>>, Condvar)>;
+type pipe = Arc<(Mutex<Vec<usize>>, Condvar)>;
 
-fn send(p: &pipe, msg: uint) {
+fn send(p: &pipe, msg: usize) {
     let &(ref lock, ref cond) = &**p;
     let mut arr = lock.lock().unwrap();
     arr.push(msg);
     cond.notify_one();
 }
-fn recv(p: &pipe) -> uint {
+fn recv(p: &pipe) -> usize {
     let &(ref lock, ref cond) = &**p;
     let mut arr = lock.lock().unwrap();
     while arr.is_empty() {
@@ -48,7 +48,7 @@ fn init() -> (pipe,pipe) {
 }
 
 
-fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
+fn thread_ring(i: usize, count: usize, num_chan: pipe, num_port: pipe) {
     let mut num_chan = Some(num_chan);
     let mut num_port = Some(num_port);
     // Send/Receive lots of messages.
@@ -74,8 +74,8 @@ fn main() {
         args.collect()
     };
 
-    let num_tasks = args[1].parse::<uint>().unwrap();
-    let msg_per_task = args[2].parse::<uint>().unwrap();
+    let num_tasks = args[1].parse::<usize>().unwrap();
+    let msg_per_task = args[2].parse::<usize>().unwrap();
 
     let (num_chan, num_port) = init();
 
index 6cd758361870ee4e8ec84713f82b1884f4c2ab16..d6577036b8ebed47d03ac9802dc8ddc03eea3022 100644 (file)
@@ -29,7 +29,7 @@ fn lerp(a: f32, b: f32, v: f32) -> f32 { a * (1.0 - v) + b * v }
 fn smooth(v: f32) -> f32 { v * v * (3.0 - 2.0 * v) }
 
 fn random_gradient<R: Rng>(r: &mut R) -> Vec2 {
-    let v = PI * 2.0 * r.gen();
+    let v = PI * 2.0 * r.gen::<f32>();
     Vec2 { x: v.cos(), y: v.sin() }
 }
 
@@ -47,7 +47,7 @@ fn new() -> Noise2DContext {
         let mut rng = StdRng::new().unwrap();
 
         let mut rgradients = [Vec2 { x: 0.0, y: 0.0 }; 256];
-        for x in &mut rgradients[] {
+        for x in &mut rgradients[..] {
             *x = random_gradient(&mut rng);
         }
 
@@ -61,9 +61,9 @@ fn new() -> Noise2DContext {
     }
 
     fn get_gradient(&self, x: i32, y: i32) -> Vec2 {
-        let idx = self.permutations[(x & 255) as uint] +
-                    self.permutations[(y & 255) as uint];
-        self.rgradients[(idx & 255) as uint]
+        let idx = self.permutations[(x & 255) as usize] +
+                    self.permutations[(y & 255) as usize];
+        self.rgradients[(idx & 255) as usize]
     }
 
     fn get_gradients(&self, x: f32, y: f32) -> ([Vec2; 4], [Vec2; 4]) {
@@ -117,7 +117,7 @@ fn main() {
 
     for y in 0..256 {
         for x in 0..256 {
-            let idx = (pixels[y*256+x] / 0.2) as uint;
+            let idx = (pixels[y*256+x] / 0.2) as usize;
             print!("{}", symbols[idx]);
         }
         print!("\n");
index 4a8bb24270d7fe7b79d7de42234ef56b274f084c..891d8143dd8c0ba1fb3fd3701485685bce9b91b0 100644 (file)
@@ -74,7 +74,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 #[derive(Copy)]
 struct CreatureInfo {
-    name: uint,
+    name: usize,
     color: Color
 }
 
@@ -87,7 +87,7 @@ fn show_color_list(set: Vec<Color>) -> String {
     out
 }
 
-fn show_digit(nn: uint) -> &'static str {
+fn show_digit(nn: usize) -> &'static str {
     match nn {
         0 => {" zero"}
         1 => {" one"}
@@ -103,7 +103,7 @@ fn show_digit(nn: uint) -> &'static str {
     }
 }
 
-struct Number(uint);
+struct Number(usize);
 impl fmt::Debug for Number {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let mut out = vec![];
@@ -139,7 +139,7 @@ fn transform(aa: Color, bb: Color) -> Color {
 }
 
 fn creature(
-    name: uint,
+    name: usize,
     mut color: Color,
     from_rendezvous: Receiver<CreatureInfo>,
     to_rendezvous: Sender<CreatureInfo>,
@@ -172,7 +172,7 @@ fn creature(
     to_rendezvous_log.send(report).unwrap();
 }
 
-fn rendezvous(nn: uint, set: Vec<Color>) {
+fn rendezvous(nn: usize, set: Vec<Color>) {
     // these ports will allow us to hear from the creatures
     let (to_rendezvous, from_creatures) = channel::<CreatureInfo>();
 
index e23862f4286aa33ab4790830fd7898a8e6dd483a..3a1da4c32af4c1ce5d265a8ab98275a2ad0a83a1 100644 (file)
@@ -80,7 +80,7 @@ struct Perm {
 impl Perm {
     fn new(n: u32) -> Perm {
         let mut fact = [1; 16];
-        for i in 1..n as uint + 1 {
+        for i in 1..n as usize + 1 {
             fact[i] = fact[i - 1] * i as u32;
         }
         Perm {
@@ -99,7 +99,7 @@ fn get(&mut self, mut idx: i32) -> P {
             *place = i as i32 + 1;
         }
 
-        for i in (1..self.n as uint).rev() {
+        for i in (1..self.n as usize).rev() {
             let d = idx / self.fact[i] as i32;
             self.cnt[i] = d;
             idx %= self.fact[i] as i32;
@@ -107,7 +107,7 @@ fn get(&mut self, mut idx: i32) -> P {
                 *place = (*val) as u8
             }
 
-            let d = d as uint;
+            let d = d as usize;
             for j in 0..i + 1 {
                 self.perm.p[j] = if j + d <= i {pp[j + d]} else {pp[j+d-i-1]} as i32;
             }
@@ -117,7 +117,7 @@ fn get(&mut self, mut idx: i32) -> P {
     }
 
     fn count(&self) -> u32 { self.permcount }
-    fn max(&self) -> u32 { self.fact[self.n as uint] }
+    fn max(&self) -> u32 { self.fact[self.n as usize] }
 
     fn next(&mut self) -> P {
         next_permutation(&mut self.perm.p, &mut self.cnt);
@@ -128,11 +128,11 @@ fn next(&mut self) -> P {
 }
 
 
-fn reverse(tperm: &mut [i32], k: uint) {
+fn reverse(tperm: &mut [i32], k: usize) {
     tperm[..k].reverse()
 }
 
-fn work(mut perm: Perm, n: uint, max: uint) -> (i32, i32) {
+fn work(mut perm: Perm, n: usize, max: usize) -> (i32, i32) {
     let mut checksum = 0;
     let mut maxflips = 0;
 
@@ -142,7 +142,7 @@ fn work(mut perm: Perm, n: uint, max: uint) -> (i32, i32) {
         let mut flips = 0;
 
         while p.p[0] != 1 {
-            let k = p.p[0] as uint;
+            let k = p.p[0] as usize;
             reverse(&mut p.p, k);
             flips += 1;
         }
@@ -167,7 +167,7 @@ fn fannkuch(n: i32) -> (i32, i32) {
         let max = cmp::min(j+k, perm.max());
 
         futures.push(thread::scoped(move|| {
-            work(perm, j as uint, max as uint)
+            work(perm, j as usize, max as usize)
         }))
     }
 
index 709b23ef9dd039c07e4cf109ad83ea4582bc25b1..7c4cc0eaab7ce403267064511da85cb858aedba3 100644 (file)
@@ -126,10 +126,9 @@ fn make(&mut self, n: usize) -> IoResult<()> {
         let mut buf = repeat(0).take(alu_len + LINE_LEN).collect::<Vec<_>>();
         let alu: &[u8] = self.alu.as_bytes();
 
-        copy_memory(&mut buf, alu);
+        copy_memory(alu, &mut buf);
         let buf_len = buf.len();
-        copy_memory(&mut buf[alu_len..buf_len],
-                    &alu[..LINE_LEN]);
+        copy_memory(&alu[..LINE_LEN], &mut buf[alu_len..buf_len]);
 
         let mut pos = 0;
         let mut bytes;
index ebdc60cdd2b0f3628894e8c7ea8cac35e07433d8..de1d0103657e02485824039d78c741febf742072 100644 (file)
@@ -42,8 +42,8 @@ fn f64_cmp(x: f64, y: f64) -> Ordering {
 }
 
 // given a map, print a sorted version of it
-fn sort_and_fmt(mm: &HashMap<Vec<u8> , uint>, total: uint) -> String {
-   fn pct(xx: uint, yy: uint) -> f64 {
+fn sort_and_fmt(mm: &HashMap<Vec<u8> , usize>, total: usize) -> String {
+   fn pct(xx: usize, yy: usize) -> f64 {
       return (xx as f64) * 100.0 / (yy as f64);
    }
 
@@ -74,7 +74,7 @@ fn sortKV(mut orig: Vec<(Vec<u8> ,f64)> ) -> Vec<(Vec<u8> ,f64)> {
 }
 
 // given a map, search for the frequency of a pattern
-fn find(mm: &HashMap<Vec<u8> , uint>, key: String) -> uint {
+fn find(mm: &HashMap<Vec<u8> , usize>, key: String) -> usize {
    let key = key.into_ascii_lowercase();
    match mm.get(key.as_bytes()) {
       option::Option::None      => { return 0; }
@@ -83,7 +83,7 @@ fn find(mm: &HashMap<Vec<u8> , uint>, key: String) -> uint {
 }
 
 // given a map, increment the counter for a key
-fn update_freq(mm: &mut HashMap<Vec<u8> , uint>, key: &[u8]) {
+fn update_freq(mm: &mut HashMap<Vec<u8> , usize>, key: &[u8]) {
     let key = key.to_vec();
     let newval = match mm.remove(&key) {
         Some(v) => v + 1,
@@ -95,7 +95,7 @@ fn update_freq(mm: &mut HashMap<Vec<u8> , uint>, key: &[u8]) {
 // given a Vec<u8>, for each window call a function
 // i.e., for "hello" and windows of size four,
 // run it("hell") and it("ello"), then return "llo"
-fn windows_with_carry<F>(bb: &[u8], nn: uint, mut it: F) -> Vec<u8> where
+fn windows_with_carry<F>(bb: &[u8], nn: usize, mut it: F) -> Vec<u8> where
     F: FnMut(&[u8]),
 {
    let mut ii = 0;
@@ -109,12 +109,12 @@ fn windows_with_carry<F>(bb: &[u8], nn: uint, mut it: F) -> Vec<u8> where
    return bb[len - (nn - 1)..len].to_vec();
 }
 
-fn make_sequence_processor(sz: uint,
+fn make_sequence_processor(sz: usize,
                            from_parent: &Receiver<Vec<u8>>,
                            to_parent: &Sender<String>) {
-   let mut freqs: HashMap<Vec<u8>, uint> = HashMap::new();
+   let mut freqs: HashMap<Vec<u8>, usize> = HashMap::new();
    let mut carry = Vec::new();
-   let mut total: uint = 0;
+   let mut total: usize = 0;
 
    let mut line: Vec<u8>;
 
index 3748b65dacbb8bd581cd0352c6072e3c21b59931..13154e025d2cde61cfbf43e04919e1c00f19e9ed 100644 (file)
@@ -45,7 +45,7 @@
 const PI: f64 = 3.141592653589793;
 const SOLAR_MASS: f64 = 4.0 * PI * PI;
 const YEAR: f64 = 365.24;
-const N_BODIES: uint = 5;
+const N_BODIES: usize = 5;
 
 static BODIES: [Planet;N_BODIES] = [
     // Sun
@@ -103,7 +103,7 @@ struct Planet {
     mass: f64,
 }
 
-fn advance(bodies: &mut [Planet;N_BODIES], dt: f64, steps: int) {
+fn advance(bodies: &mut [Planet;N_BODIES], dt: f64, steps: isize) {
     for _ in 0..steps {
         let mut b_slice: &mut [_] = bodies;
         loop {
index 4d9bc951fa3061a460a4270e7e85484c481652a9..ed20f4b6362ce26a26c9220ba102fde2f9acd674 100644 (file)
@@ -77,7 +77,7 @@ fn stress_task(id: isize) {
     }
 }
 
-fn stress(num_tasks: int) {
+fn stress(num_tasks: isize) {
     let mut results = Vec::new();
     for i in 0..num_tasks {
         results.push(thread::spawn(move|| {
index 8235b013a81bad39deb9d0696a90f80a4d33ef81..cda90c08f23ad121df4e70b0565e7d83ebeae794 100644 (file)
@@ -92,12 +92,12 @@ fn computed_cpl8(c: u8) -> u8 {
 
     /// Retrieves the complement for `i`.
     fn cpl8(&self, i: u8) -> u8 {
-        self.table8[i as uint]
+        self.table8[i as usize]
     }
 
     /// Retrieves the complement for `i`.
     fn cpl16(&self, i: u16) -> u16 {
-        self.table16[i as uint]
+        self.table16[i as usize]
     }
 }
 
@@ -107,7 +107,7 @@ fn read_to_end<R: Reader>(r: &mut R) -> IoResult<Vec<u8>> {
     // Reader::read_to_end() with a fast growing policy to limit
     // recopies.  If MREMAP_RETAIN is implemented in the linux kernel
     // and jemalloc use it, this trick will become useless.
-    const CHUNK: uint = 64 * 1024;
+    const CHUNK: usize = 64 * 1024;
 
     let mut vec = Vec::with_capacity(CHUNK);
     loop {
@@ -132,7 +132,7 @@ fn read_to_end<R: Reader>(r: &mut R) -> IoResult<Vec<u8>> {
 }
 
 /// Finds the first position at which `b` occurs in `s`.
-fn memchr(h: &[u8], n: u8) -> Option<uint> {
+fn memchr(h: &[u8], n: u8) -> Option<usize> {
     use libc::{c_void, c_int, size_t};
     let res = unsafe {
         libc::memchr(h.as_ptr() as *const c_void, n as c_int, h.len() as size_t)
@@ -140,7 +140,7 @@ fn memchr(h: &[u8], n: u8) -> Option<uint> {
     if res.is_null() {
         None
     } else {
-        Some(res as uint - h.as_ptr() as uint)
+        Some(res as usize - h.as_ptr() as usize)
     }
 }
 
@@ -171,7 +171,7 @@ fn next(&mut self) -> Option<&'a mut [u8]> {
 }
 
 /// Length of a normal line without the terminating \n.
-const LINE_LEN: uint = 60;
+const LINE_LEN: usize = 60;
 
 /// Compute the reverse complement.
 fn reverse_complement(seq: &mut [u8], tables: &Tables) {
@@ -181,8 +181,8 @@ fn reverse_complement(seq: &mut [u8], tables: &Tables) {
     let mut i = LINE_LEN;
     while i < len {
         unsafe {
-            copy(seq.as_mut_ptr().offset((i - off + 1) as int),
-                 seq.as_ptr().offset((i - off) as int), off);
+            copy(seq.as_ptr().offset((i - off) as isize),
+                 seq.as_mut_ptr().offset((i - off + 1) as isize), off);
             *seq.get_unchecked_mut(i - off) = b'\n';
         }
         i += LINE_LEN + 1;
@@ -193,8 +193,8 @@ fn reverse_complement(seq: &mut [u8], tables: &Tables) {
     unsafe {
         let mut left = seq.as_mut_ptr() as *mut u16;
         // This is slow if len % 2 != 0 but still faster than bytewise operations.
-        let mut right = seq.as_mut_ptr().offset(len as int - 2) as *mut u16;
-        let end = left.offset(div as int);
+        let mut right = seq.as_mut_ptr().offset(len as isize - 2) as *mut u16;
+        let end = left.offset(div as isize);
         while left != end {
             let tmp = tables.cpl16(*left);
             *left = tables.cpl16(*right);
index 3889b404d8557c111b639c121791618847be1d75..cd89b822035c22180771bd378421fcee7abee341 100644 (file)
@@ -64,7 +64,7 @@ fn main() {
     println!("{:.9}", answer);
 }
 
-fn spectralnorm(n: uint) -> f64 {
+fn spectralnorm(n: usize) -> f64 {
     assert!(n % 2 == 0, "only even lengths are accepted");
     let mut u = repeat(1.0).take(n).collect::<Vec<_>>();
     let mut v = u.clone();
@@ -89,8 +89,8 @@ fn mult_Atv(v: &[f64], out: &mut [f64]) {
     parallel(out, |start, out| mult(v, out, start, |i, j| A(j, i)));
 }
 
-fn mult<F>(v: &[f64], out: &mut [f64], start: uint, a: F)
-           where F: Fn(uint, uint) -> f64 {
+fn mult<F>(v: &[f64], out: &mut [f64], start: usize, a: F)
+           where F: Fn(usize, usize) -> f64 {
     for (i, slot) in out.iter_mut().enumerate().map(|(i, s)| (i + start, s)) {
         let mut sum = f64x2(0.0, 0.0);
         for (j, chunk) in v.chunks(2).enumerate().map(|(j, s)| (2 * j, s)) {
@@ -103,7 +103,7 @@ fn mult<F>(v: &[f64], out: &mut [f64], start: uint, a: F)
     }
 }
 
-fn A(i: uint, j: uint) -> f64 {
+fn A(i: usize, j: usize) -> f64 {
     ((i + j) * (i + j + 1) / 2 + i + 1) as f64
 }
 
@@ -117,7 +117,7 @@ fn dot(v: &[f64], u: &[f64]) -> f64 {
 // sub-slice of `v`.
 fn parallel<'a,T, F>(v: &mut [T], ref f: F)
                   where T: Send + Sync + 'a,
-                        F: Fn(uint, &mut [T]) + Sync + 'a {
+                        F: Fn(usize, &mut [T]) + Sync + 'a {
     let size = v.len() / os::num_cpus() + 1;
     v.chunks_mut(size).enumerate().map(|(i, chunk)| {
         thread::scoped(move|| {
index d8f4603ab1af956990efb3a463aa41220cba823a..9eba2c3639039511fec82c445dd02ec900155e5b 100644 (file)
@@ -29,7 +29,7 @@ fn main() {
     run(repeat, depth);
 }
 
-fn run(repeat: int, depth: int) {
+fn run(repeat: isize, depth: isize) {
     for _ in 0..repeat {
         let dur = Duration::span(|| {
             let _ = thread::spawn(move|| {
@@ -65,7 +65,7 @@ fn r(l: Box<nillist>) -> r {
     }
 }
 
-fn recurse_or_panic(depth: int, st: Option<State>) {
+fn recurse_or_panic(depth: isize, st: Option<State>) {
     if depth == 0 {
         panic!();
     } else {
index e36d685d7c6ea9b73f85d29b147510ec1fc69030..4798e317ac840f1eb008ee89d08c15f0840269af 100644 (file)
@@ -21,7 +21,7 @@
 use std::env;
 use std::thread;
 
-fn child_generation(gens_left: uint, tx: Sender<()>) {
+fn child_generation(gens_left: usize, tx: Sender<()>) {
     // This used to be O(n^2) in the number of generations that ever existed.
     // With this code, only as many generations are alive at a time as tasks
     // alive at a time,
index b2cbd8821e4655c54e570893c76f8a4c439daf28..a5b449285ef1feaf4d7c12b7d556be6eb5bed43c 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #[no_mangle]
-pub fn test(x: &[int]) -> int {
+pub fn test(x: &[isize]) -> isize {
     let mut y = 0;
     let mut i = 0;
     while (i < x.len()) {
index b95d6b03288ea96ce476cafe7f6d1b27b270940a..fe93c864fadab8f7364595075f169513bab03b21 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn foo(x: int) -> int {
+fn foo(x: isize) -> isize {
     x * x
 }
 
index 948809a63267905bea5057dfdbc61a216d7f6560..5addba1724d33520b091f840f84b9faec58c2fc6 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 #[no_mangle]
-pub fn test() -> int {
+pub fn test() -> isize {
     5
 }
index d75bc5209fd25a3896339f0cc49f40daf7fe05d5..cf05a2e2f8e5fef861c3a29ce63ed1062e37d0f6 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #[no_mangle]
-pub fn test(x: int, y: int) -> int {
+pub fn test(x: isize, y: isize) -> isize {
     match x {
         1 => y,
         2 => y*2,
index 996d22038249bfba7170b27596d6a229d446a954..025f9b524c9a986c9717ebfeb6817c3ee0dbad40 100644 (file)
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 pub struct Struct {
-    field: int
+    field: isize
 }
 
 impl Struct {
-    fn method(&self, x: int) -> int {
+    fn method(&self, x: isize) -> isize {
         self.field + x
     }
 }
@@ -23,6 +23,6 @@ pub fn test(a: &Struct,
             b: &Struct,
             c: &Struct,
             d: &Struct,
-            e: &Struct) -> int {
+            e: &Struct) -> isize {
     a.method(b.method(c.method(d.method(e.method(1)))))
 }
index 9c5894fb97ac2576214c79719d7779977d0da01c..fca3784d9e002f3e6cb5c094267727dd51cba982 100644 (file)
@@ -9,16 +9,16 @@
 // except according to those terms.
 
 pub struct Struct {
-    field: int
+    field: isize
 }
 
 impl Struct {
-    fn method(&self) -> int {
+    fn method(&self) -> isize {
         self.field
     }
 }
 
 #[no_mangle]
-pub fn test(s: &Struct) -> int {
+pub fn test(s: &Struct) -> isize {
     s.method()
 }
index ff1a611c4efef802d1d50102b6c961f8e2d475e1..ae83409b45ff00e7d9ad3462b9082267f4c35c7d 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 pub struct Stuff {
-  a: int,
+  a: isize,
   b: f64
 }
 
@@ -18,6 +18,6 @@ pub trait Trait {
 }
 
 #[no_mangle]
-pub fn test(t: &Trait) -> int {
+pub fn test(t: &Trait) -> isize {
     t.method().a
 }
index 036c0957e99d926d21353a9eee43071a0f394754..9bfeef1f018a702716f0cf3dd7458016415d9958 100644 (file)
@@ -9,10 +9,10 @@
 // except according to those terms.
 
 pub trait Trait {
-    fn method(&self) -> int;
+    fn method(&self) -> isize;
 }
 
 #[no_mangle]
-pub fn test(t: &Trait) -> int {
+pub fn test(t: &Trait) -> isize {
     t.method()
 }
index 5b24c6bd79f96e75a4666054d35232886241a4a3..fef27af59571b186748d84cc7aed01b6d41b5d48 100644 (file)
@@ -13,5 +13,5 @@
 fn main() {
   let mut a = Foo;
   let ref b = Foo;
-  a += *b; //~ Error: binary assignment operation `+=` cannot be applied to type `Foo`
+  a += *b; //~ Error: binary assignment operation `+=` cannot be applied to types `Foo` and `Foo`
 }
index edd1b8255ccdc38e6a4b1f7459443f0f0bda90e9..04170779ed2f6b05ae583cbdd7019c1bfa8acd6a 100644 (file)
@@ -35,5 +35,6 @@ trait Add<RHS=Self> {
 fn ice<A>(a: A) {
     let r = loop {};
     r = r + a;
-    //~^ ERROR binary operation `+` cannot be applied to type `A`
+    //~^ ERROR not implemented
+    //~| ERROR not implemented
 }
diff --git a/src/test/compile-fail/bad-crate-id.rs b/src/test/compile-fail/bad-crate-id.rs
deleted file mode 100644 (file)
index 193666f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern crate "" as foo; //~ ERROR: crate name must not be empty
-//~^ WARNING: obsolete syntax
-
-fn main() {}
diff --git a/src/test/compile-fail/bad-crate-id2.rs b/src/test/compile-fail/bad-crate-id2.rs
deleted file mode 100644 (file)
index 29df0fa..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern crate "#a" as bar; //~ ERROR: invalid character `#` in crate name: `#a`
-//~^ WARNING: obsolete syntax
-
-fn main() {}
diff --git a/src/test/compile-fail/binop-fail-3.rs b/src/test/compile-fail/binop-fail-3.rs
deleted file mode 100644 (file)
index 097a52b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2013 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.
-
-fn foo() -> ! { panic!("quux"); }
-fn main() {
-    foo() //~ ERROR the type of this value must be known in this context
-    ==
-    foo();
-}
index 923d611cebeeaa01ca948632f09abae2385bb4ab..f3fb5a08c854189ecbd74d5e1302c33e1dae045e 100644 (file)
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:`||` cannot be applied to type `f32`
-
 fn main() { let x = 1.0_f32 || 2.0_f32; }
+//~^ ERROR mismatched types
+//~| ERROR mismatched types
+
index d5dd9e00902f9d40b53fc5cfe1776f254d1c93bf..f5e53f84c16e6472dc4b39c3aca8a084cba288e7 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 `_`
-
 fn main() { let x = 1 && 2; }
+//~^ ERROR mismatched types
+//~| ERROR mismatched types
index 8278b4fb971c300520ffde6534473ab6227b2a06..64033623fe2d13e86ca3349dd9d520de47346564 100644 (file)
 // except according to those terms.
 
 // This tests that we can't modify Box<&mut T> contents while they
-// are borrowed.
+// are borrowed (#14498).
+//
+// Also includes tests of the errors reported when the Box in question
+// is immutable (#14270).
 
 #![feature(box_syntax)]
 
 struct A { a: isize }
 struct B<'a> { a: Box<&'a mut isize> }
 
+fn indirect_write_to_imm_box() {
+    let mut x: isize = 1;
+    let y: Box<_> = box &mut x;
+    let p = &y;
+    ***p = 2; //~ ERROR cannot assign to data in an immutable container
+    drop(p);
+}
+
 fn borrow_in_var_from_var() {
+    let mut x: isize = 1;
+    let mut y: Box<_> = box &mut x;
+    let p = &y;
+    let q = &***p;
+    **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed
+    drop(p);
+    drop(q);
+}
+
+fn borrow_in_var_from_var_via_imm_box() {
     let mut x: isize = 1;
     let y: Box<_> = box &mut x;
     let p = &y;
     let q = &***p;
     **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed
+    //~^         ERROR cannot assign to data in an immutable container
     drop(p);
     drop(q);
 }
 
 fn borrow_in_var_from_field() {
+    let mut x = A { a: 1 };
+    let mut y: Box<_> = box &mut x.a;
+    let p = &y;
+    let q = &***p;
+    **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed
+    drop(p);
+    drop(q);
+}
+
+fn borrow_in_var_from_field_via_imm_box() {
     let mut x = A { a: 1 };
     let y: Box<_> = box &mut x.a;
     let p = &y;
     let q = &***p;
     **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed
+    //~^         ERROR cannot assign to data in an immutable container
     drop(p);
     drop(q);
 }
 
 fn borrow_in_field_from_var() {
+    let mut x: isize = 1;
+    let mut y = B { a: box &mut x };
+    let p = &y.a;
+    let q = &***p;
+    **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed
+    drop(p);
+    drop(q);
+}
+
+fn borrow_in_field_from_var_via_imm_box() {
     let mut x: isize = 1;
     let y = B { a: box &mut x };
     let p = &y.a;
     let q = &***p;
     **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed
+    //~^           ERROR cannot assign to data in an immutable container
     drop(p);
     drop(q);
 }
 
 fn borrow_in_field_from_field() {
+    let mut x = A { a: 1 };
+    let mut y = B { a: box &mut x.a };
+    let p = &y.a;
+    let q = &***p;
+    **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed
+    drop(p);
+    drop(q);
+}
+
+fn borrow_in_field_from_field_via_imm_box() {
     let mut x = A { a: 1 };
     let y = B { a: box &mut x.a };
     let p = &y.a;
     let q = &***p;
     **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed
+    //~^           ERROR cannot assign to data in an immutable container
     drop(p);
     drop(q);
 }
 
 fn main() {
+    indirect_write_to_imm_box();
     borrow_in_var_from_var();
+    borrow_in_var_from_var_via_imm_box();
     borrow_in_var_from_field();
+    borrow_in_var_from_field_via_imm_box();
     borrow_in_field_from_var();
+    borrow_in_field_from_var_via_imm_box();
     borrow_in_field_from_field();
+    borrow_in_field_from_field_via_imm_box();
 }
index 38593d31842eb2c5291fea494c0dd19c44f60e32..c219b7c5424e926e20ff5a12767352b56466e3f2 100644 (file)
@@ -10,6 +10,8 @@
 
 // Test that immutable pattern bindings cannot be reassigned.
 
+#![feature(slice_patterns)]
+
 enum E {
     Foo(isize)
 }
index f9d24130e47afdbe5f9c95588ac9a5bb62d054cf..d9a2f89a9e21ea56dc46aa936bc3f6fdfa1fb9c9 100644 (file)
@@ -10,6 +10,8 @@
 
 // Test that we do not permit moves from &[] matched by a vec pattern.
 
+#![feature(slice_patterns)]
+
 #[derive(Clone, Debug)]
 struct Foo {
     string: String
index 55a6e2ac7b8d6755f8bd2bcac6da1e07105a5d8e..b726c46d5d533c8681b8a4ad65bf94a9057f921a 100644 (file)
@@ -18,19 +18,6 @@ struct Foo {
     y: isize,
 }
 
-#[cfg(stage0)]
-impl Index<String> for Foo {
-    type Output = isize;
-
-    fn index<'a>(&'a self, z: &String) -> &'a isize {
-        if *z == "x" {
-            &self.x
-        } else {
-            &self.y
-        }
-    }
-}
-
 impl<'a> Index<&'a String> for Foo {
     type Output = isize;
 
index 2d6a4b7d2c9df023f55075450f18727d43bf27b3..98052ad31a7ef13b524fba8b559d493bd834aabd 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(advanced_slice_patterns)]
+#![feature(slice_patterns)]
 
 fn a<'a>() -> &'a [isize] {
     let vec = vec!(1, 2, 3, 4);
index c1906758a5ae89586c8531770d9bbbc56abc856a..db635893c81b9f5d4c03c61e1545dba44a5fba5f 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 fn a() {
     let mut v = vec!(1, 2, 3);
     let vb: &mut [isize] = &mut v;
index 242a38440034ccaca016addea210f249a000de09..97dcaeb0bf1a3d2c2eb8a9b90f821aa0c72c81f5 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 fn main() {
     let mut a = [1, 2, 3, 4];
     let t = match a {
index b471439f751ffdb3e1d5938eedb8dbac38c753c9..a69ce0cb365c765a07cf5d842edb9b5e4fda2455 100644 (file)
@@ -11,6 +11,7 @@
 #![feature(advanced_slice_patterns)]
 #![feature(box_patterns)]
 #![feature(box_syntax)]
+#![feature(slice_patterns)]
 
 fn a() {
     let mut vec = [box 1, box 2, box 3];
index df0fee437b94ab93ef87107bd71f5eca0fd06c19..82b3490d7d7e118c79a875ec91288b0cd2960ad9 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 fn a<'a>() -> &'a isize {
     let vec = vec!(1, 2, 3, 4);
     let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough
diff --git a/src/test/compile-fail/deprecated-phase.rs b/src/test/compile-fail/deprecated-phase.rs
deleted file mode 100644 (file)
index 22fc4a9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(custom_attribute)]
-
-#[phase(blah)]
-//~^ ERROR #[phase] is deprecated
-extern crate foo;
-
-fn main() {}
index a4524ccd9db08108f1e16dd397b5dac21fe34501..1daca371b3409c3eb9225936fe06408cb32cc264 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 fn main() {
     let x = [ 1, 2, 3, 4, 5 ];
     match x {
diff --git a/src/test/compile-fail/feature-gate-int-uint.rs b/src/test/compile-fail/feature-gate-int-uint.rs
deleted file mode 100644 (file)
index 948e485..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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(dead_code, unused_variables)]
-#![feature(rustc_attrs)]
-
-mod u {
-    type X = uint; //~ WARN the `uint` type is deprecated
-    struct Foo {
-        x: uint //~ WARN the `uint` type is deprecated
-    }
-    fn bar(x: uint) { //~ WARN the `uint` type is deprecated
-        1_u; //~ WARN the `u` and `us` suffixes on integers are deprecated
-        1_us; //~ WARN the `u` and `us` suffixes on integers are deprecated
-    }
-}
-mod i {
-    type X = int; //~ WARN the `int` type is deprecated
-    struct Foo {
-        x: int //~ WARN the `int` type is deprecated
-    }
-    fn bar(x: int) { //~ WARN the `int` type is deprecated
-        1_i; //~ WARN the `i` and `is` suffixes on integers are deprecated
-        1_is; //~ WARN the `i` and `is` suffixes on integers are deprecated
-    }
-}
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
-}
index 6178d37a5bd6c49bde6c12afb451d56db2ffceff..27be1ada445505dbd4c54d5aad0996cf178135ea 100644 (file)
@@ -13,4 +13,5 @@ fn f() { }
     fn g() { }
     let x = f == g;
     //~^ ERROR binary operation `==` cannot be applied
+    //~| ERROR mismatched types
 }
index 6024fef9fb81f043256f4f189995349a6943e8b4..2aebbf3d54b9cd08d6151d071685887cde875098 100644 (file)
 
 // Test that `#[unsafe_destructor]` attribute is gated by `unsafe_destructor`
 // feature gate.
+//
+// (This test can be removed entirely when we remove the
+// `unsafe_destructor` feature itself.)
 
 struct D<'a>(&'a u32);
 
 #[unsafe_destructor]
+//~^ ERROR `#[unsafe_destructor]` does nothing anymore
+//~| HELP: add #![feature(unsafe_destructor)] to the crate attributes to enable
+// (but of couse there is no point in doing so)
 impl<'a> Drop for D<'a> {
-    //~^ ERROR `#[unsafe_destructor]` allows too many unsafe patterns
     fn drop(&mut self) { }
 }
-//~^ HELP: add #![feature(unsafe_destructor)] to the crate attributes to enable
 
 pub fn main() { }
index 2de86e527ef594460289a4307d522cd75e6918a1..40fc6b1ed6aaacebf6a682e43b67d369b5dff5ab 100644 (file)
 fn main() {
     let x = ();
     1 +
-    x //~  ERROR mismatched types
-      //~| expected `_`
-      //~| found `()`
-      //~| expected integral variable
-      //~| found ()
+    x //~^ ERROR E0277
+      //~| ERROR E0277
     ;
 
     let x: () = ();
     1 +
-    x //~  ERROR mismatched types
-      //~| expected `_`
-      //~| found `()`
-      //~| expected integral variable
-      //~| found ()
+    x //~^ ERROR E0277
+      //~| ERROR E0277
     ;
 }
index 9a471a4341f5f1706bfc9a9458c264b1e9fbef44..1333bfac64ee86d1edc9f2d0b3c624ec70462a5a 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 fn main() {
     let sl = vec![1,2,3];
     let v: isize = match &*sl {
index d186a83676a804abf601b48d5372eaa6eacfe09b..1580ec00f94b068b3c59c0884975ed4a8885bad2 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) {
     match (l1, l2) {
         ([], []) => println!("both empty"),
diff --git a/src/test/compile-fail/issue-13352.rs b/src/test/compile-fail/issue-13352.rs
new file mode 100644 (file)
index 0000000..a8c8c8b
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// pretty-expanded FIXME #23616
+
+#![feature(std_misc, libc)]
+
+extern crate libc;
+
+use std::thunk::Thunk;
+
+fn foo(_: Thunk) {}
+
+fn main() {
+    foo(loop {
+        unsafe { libc::exit(0 as libc::c_int); }
+    });
+    2_usize + (loop {});
+    //~^ ERROR E0277
+    //~| ERROR E0277
+}
index 86a79416c77bc6807d16123c3d209a0170165608..f907be161fa0815a4fa5af331cf97386d1d1f347 100644 (file)
@@ -10,6 +10,8 @@
 
 // compile-flags:-Z verbose
 
+#![feature(slice_patterns)]
+
 fn main() {
     let x = [1,2];
     let y = match x {
index a345ce79612cc37ed80088b1b458b7ebc2820a47..2fbfd6cc84eadccb0a1a1e83cfc1ed0ad514e56d 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 fn main() {
   let x = [1,2];
   let y = match x {
diff --git a/src/test/compile-fail/issue-13853-3.rs b/src/test/compile-fail/issue-13853-3.rs
deleted file mode 100644 (file)
index 7ca158c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![crate_type = "lib"]
-
-use std::marker::PhantomData;
-
-enum NodeContents<'a> {
-    Children(Vec<Node<'a>>),
-}
-
-impl<'a> Drop for NodeContents<'a> {
-    //~^ ERROR cannot implement a destructor on a structure with type parameters
-    fn drop( &mut self ) {
-    }
-}
-
-struct Node<'a> {
-    contents: NodeContents<'a>,
-    marker: PhantomData<&'a ()>,
-}
-
-impl<'a> Node<'a> {
-    fn noName(contents: NodeContents<'a>) -> Node<'a> {
-        Node { contents: contents, marker: PhantomData }
-    }
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/issue-13853-4.rs b/src/test/compile-fail/issue-13853-4.rs
deleted file mode 100644 (file)
index b0db9e5..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct AutoBuilder<'a> {
-    context: &'a isize
-}
-
-impl<'a> Drop for AutoBuilder<'a> {
-    //~^ ERROR cannot implement a destructor on a structure with type parameters
-    fn drop(&mut self) {
-    }
-}
-
-fn main() {}
index 817e4ae165031cd2fc47096f5c8363df68817ab4..653ba165e74397c256bba6d36e690fa98f684926 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 fn main() {
     let values: Vec<u8> = vec![1,2,3,4,5,6,7,8];
 
diff --git a/src/test/compile-fail/issue-16465.rs b/src/test/compile-fail/issue-16465.rs
deleted file mode 100644 (file)
index 825b40c..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Used to cause an ICE
-
-struct Foo<T>{
-    x : T
-}
-
-type FooInt = Foo<isize>;
-
-impl Drop for FooInt {
-//~^ ERROR cannot implement a destructor on a structure with type parameters
-    fn drop(&mut self){}
-}
-
-fn main() {}
index 77aba7335bdf996cc9165263e73c13d2073254cf..4435ee0cb225dcf40360de9b05c1b5d3a4c68e30 100644 (file)
@@ -21,6 +21,6 @@ impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
 trait Sized : PhantomFn<Self> {}
 
 #[start]
-fn main(_: int, _: *const *const u8) -> int {
+fn main(_: isize, _: *const *const u8) -> isize {
     0
 }
index 37dbcaf39bd10ba17c99dfdc6c30f9a243a3a851..ea305c96af4a1efa39f788effa5df7a31b99aad8 100644 (file)
@@ -16,7 +16,8 @@ impl<A> vec_monad<A> for Vec<A> {
     fn bind<B, F>(&self, mut f: F) where F: FnMut(A) -> Vec<B> {
         let mut r = panic!();
         for elt in self { r = r + f(*elt); }
-        //~^ ERROR binary operation `+` cannot be applied to type `collections::vec::Vec<B>`
+        //~^ ERROR E0277
+        //~| ERROR E0277
    }
 }
 fn main() {
index 49a43ee37adca88d9ec5224a79b161945a0354f0..1ebef06008ffa4f3c6b345dee1cd6110d7d62132 100644 (file)
@@ -12,5 +12,5 @@
 
 fn main() {
     let x = |ref x: isize| -> isize { x += 1; };
-    //~^ ERROR binary assignment operation `+=` cannot be applied to type `&isize`
+    //~^ ERROR E0368
 }
index 08c5cae9f5f79b1ece1168829e748fa7ac4a551c..ffab194149e12c79ba1525339844aaf40e2739b4 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(rustc_attrs)]
+#![feature(slice_patterns)]
 #![allow(dead_code)]
 
 // Matching against NaN should result in a warning
index 8aefc5919d13313ddf71a67d5d0fa9730447bb78..226734b84d63840f491057540147030aa62922a5 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Verify that single-variant enums cant be de-referenced
+// Verify that single-variant enums can't be de-referenced
 // Regression test for issue #9814
 
 enum Foo { Bar(isize) }
diff --git a/src/test/compile-fail/kindck-destructor-owned.rs b/src/test/compile-fail/kindck-destructor-owned.rs
deleted file mode 100644 (file)
index 7f37041..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-struct Bar<'a> {
-    f: &'a isize,
-}
-
-impl<'a> Drop for Bar<'a> {
-//~^ ERROR E0141
-    fn drop(&mut self) {
-    }
-}
-
-struct Baz {
-    f: &'static isize,
-}
-
-impl Drop for Baz {
-    fn drop(&mut self) {
-    }
-}
-
-fn main() { }
index 8441fb3ade9a8ea9cc002d3e309338c0386b9803..3a9baecb9c60e7b595702c82debaf74a76475466 100644 (file)
@@ -16,8 +16,6 @@
 
 extern crate libc;
 
-use std::num::Int;
-
 struct Foo {
     x: usize,
     b: bool, //~ ERROR: struct field is never used
index c00bd2adaa2876c2c03837b880692f196a4d9a3f..f36c726c875089104546f5594992014b9ce44b9a 100644 (file)
@@ -50,12 +50,12 @@ fn qux() {
 }
 
 fn quy() {
-    let i = -23_usize; //~ WARNING negation of unsigned int literal may be unintentional
+    let i = -23_us; //~ WARNING negation of unsigned int literal may be unintentional
                   //~^ WARNING unused variable
 }
 
 fn quz() {
-    let i = 23_usize;
+    let i = 23_us;
     let j = -i;   //~ WARNING negation of unsigned int variable may be unintentional
                   //~^ WARNING unused variable
 }
index c251ce6a3c834960942f371f538b704cb7e6294b..fc4fa838a5693078afab08222be45fd89b727501 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-l :static
+// compile-flags:-l static=
 // error-pattern: empty library name given via `-l`
 
 fn main() {
index 5ab073c33bcb310e15588af7249852e143f069c8..e9cbdb099480c4aca9d80700cd6962819805bdc6 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-l foo:bar
+// compile-flags:-l bar=foo
 // error-pattern: unknown library kind `bar`, expected one of dylib, framework, or static
 
 fn main() {
index 96cc35049ee40e309fb4ea4e7a083b0dc1680142..97176a533d2bd0d5e48d2aaa945d082ce106af1a 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-macos
 // ignore-ios
-// compile-flags:-l foo:framework
+// compile-flags:-l framework=foo
 // error-pattern: native frameworks are only available on OSX targets
 
 fn main() {
index d0f7c7ca986b3fda3722b629f340b31b35a1ed58..042ec95f7e753787500869760c5faa44b016f980 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 // The arity of `ref x` is always 1. If the pattern is compared to some non-structural type whose
 // arity is always 0, an ICE occurs.
 //
index e778dd18e68d3e64ac24d34bacad4d4741371ab7..60d0c24bb3d3679002d03d3d4d5ffe9b590f56c7 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 fn a() {
     let v = [1, 2, 3];
     match v {
index a4abdf3ddfe94f14f7189ceeb11741be4b25874b..0bbba8861217da39ff341bfa6387414d07f8dd15 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 fn main() {
     match () {
         [()] => { }
index edbdc77f0306d3be89fa6295e93a20f5498bc825..ef75213d34b85109fa53a7e76d873d9b063f007d 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 fn main() {
     match "foo".to_string() {
         ['f', 'o', ..] => {} //~ ERROR mismatched types
index 2c63438cbf3af4ef6dceb833fc4f9105251441d5..48b70b4bda08efc31983e0bffaee437639cb5ae3 100644 (file)
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
 
 fn main() {
     let x: Vec<(isize, isize)> = Vec::new();
index 8f2cb61f95514cf44cef029fca3b0364ae6ffe2f..ad2b8c400e57608c0e2613223c846e1d3ae590f8 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 enum t { a(u), b }
 enum u { c, d }
 
index 1dec049aed5e66ce262aa78ecf0917492e08db42..b9749c2696e32adf505b7df91a53df19dba6bafd 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 enum t { a, b, }
 
 fn main() {
index 3ed91459ae94c70ae7e24b9da9a94a9e1706daee..146265bf0e1508bfaa7755642f04d3c43a5a12d6 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(advanced_slice_patterns)]
+#![feature(slice_patterns)]
 
 struct Foo {
     first: bool,
diff --git a/src/test/compile-fail/plugin-extern-crate-attr-deprecated.rs b/src/test/compile-fail/plugin-extern-crate-attr-deprecated.rs
deleted file mode 100644 (file)
index efa352e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// 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(plugin)]
-
-#[plugin]  //~ ERROR #[plugin] on `extern crate` is deprecated
-//~^ HELP use a crate attribute instead, i.e. #![plugin(std)]
-extern crate std;
-
-fn main() {}
index e7b34d6d1bc38609bbb11d562d6409046d19b5e7..3ae61722bcff3e9c7206b875f3d403b0361add99 100644 (file)
@@ -15,9 +15,10 @@ pub fn main() {
     let _ = 0u32..10i32;
     //~^ ERROR start and end of range have incompatible types
 
-    // Float => does not implement iterator.
-    for i in 0f32..42f32 {}
-    //~^ ERROR the trait `core::num::Int` is not implemented for the type `f32`
+    // Bool => does not implement iterator.
+    for i in false..true {}
+    //~^ ERROR the trait
+    //~^^ ERROR the trait
 
     // Unsized type.
     let arr: &[_] = &[1, 2, 3];
diff --git a/src/test/compile-fail/reflect-assoc.rs b/src/test/compile-fail/reflect-assoc.rs
new file mode 100644 (file)
index 0000000..9cf0d25
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 that types that appear in assoc bindings in an object
+// type are subject to the reflect check.
+
+use std::marker::Reflect;
+use std::io::Write;
+
+trait Get {
+    type Output;
+    fn get(self) -> Self::Output;
+}
+
+struct Struct<T>(T);
+
+fn is_reflect<T:Reflect>() { }
+
+fn a<T>() {
+    is_reflect::<Box<Get<Output=T>>>(); //~ ERROR not implemented
+}
+
+fn ok_a<T: Reflect>() {
+    is_reflect::<Box<Get<Output=T>>>(); // OK
+}
+
+fn main() {
+}
diff --git a/src/test/compile-fail/reflect-object-param.rs b/src/test/compile-fail/reflect-object-param.rs
new file mode 100644 (file)
index 0000000..9f07466
--- /dev/null
@@ -0,0 +1,47 @@
+// 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 that types that appear in input types in an object type are
+// subject to the reflect check.
+
+use std::marker::Reflect;
+use std::io::Write;
+
+trait Get<T> {
+    fn get(self) -> T;
+}
+
+struct Struct<T>(T);
+
+fn is_reflect<T:Reflect>() { }
+
+fn a<T>() {
+    is_reflect::<T>(); //~ ERROR not implemented
+}
+
+fn ok_a<T: Reflect>() {
+    is_reflect::<T>(); // OK
+}
+
+fn b<T>() {
+    is_reflect::<Box<Get<T>>>(); //~ ERROR not implemented
+}
+
+fn ok_b<T: Reflect>() {
+    is_reflect::<Box<Get<T>>>(); // OK
+}
+
+fn c<T>() {
+    is_reflect::<Box<Get<Struct<T>>>>(); //~ ERROR not implemented
+}
+
+fn main() {
+    is_reflect::<Box<Get<Struct<()>>>>(); // OK
+}
diff --git a/src/test/compile-fail/reflect.rs b/src/test/compile-fail/reflect.rs
new file mode 100644 (file)
index 0000000..701aa5b
--- /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 that there is no way to get a generic type `T` to be
+// considered as `Reflect` (or accessible via something that is
+// considered `Reflect`) without a reflect bound, but that any
+// concrete type works fine. Note that object types are tested
+// separately.
+
+use std::marker::Reflect;
+use std::io::Write;
+
+struct Struct<T>(T);
+
+fn is_reflect<T:Reflect>() { }
+
+fn c<T>() {
+    is_reflect::<Struct<T>>(); //~ ERROR not implemented
+}
+
+fn ok_c<T: Reflect>() {
+    is_reflect::<Struct<T>>(); // OK
+}
+
+fn d<T>() {
+    is_reflect::<(i32, T)>(); //~ ERROR not implemented
+}
+
+fn main() {
+    is_reflect::<&i32>(); // OK
+    is_reflect::<Box<Write>>(); // OK
+}
index 3401dd1becdd8b141dd5e8940e1af672ac7e68f2..8e83177090bb5223133a40c4b203fad65c2d1184 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 fn assert_static<T: 'static>(_t: T) {}
 
 fn main() {
index 901ae1d5e2ab1584e6d3053ee7d36942be4c019d..24b66213b39bd410cdffb9d011bd6b38caa63ab4 100644 (file)
@@ -17,19 +17,19 @@ struct Panolpy {
 
 fn foo(p: &Panolpy) {
     22 >> p.char;
-    //~^ ERROR right-hand-side of a shift operation must have integral type
+    //~^ ERROR E0277
+    //~| ERROR E0277
 
     22 >> p.str;
-    //~^ ERROR right-hand-side of a shift operation must have integral type
+    //~^ ERROR E0277
+    //~| ERROR E0277
 
     22 >> p;
-    //~^ ERROR right-hand-side of a shift operation must have integral type
+    //~^ ERROR E0277
+    //~| ERROR E0277
 
-    // We could be more accepting in the case of a type not yet inferred, but not
-    // known to be an integer, but meh.
     let x;
-    22 >> x;
-    //~^ ERROR the type of this value must be known in this context
+    22 >> x; // ambiguity error winds up being suppressed
 
     22 >> 1;
     // Integer literal types are OK
index f028c9af46235647a0fbe65c47fdbf8dd169fe63..feffe5c0b06c8e09fc10dcd75c68c9cec4ff21f6 100644 (file)
@@ -10,6 +10,7 @@
 
 // ignore-tidy-linelength
 
+#![feature(core)]
 
 use std::simd::f32x4;
 
diff --git a/src/test/compile-fail/slice-1.rs b/src/test/compile-fail/slice-1.rs
deleted file mode 100644 (file)
index 3b992e3..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test slicing &expr[] is deprecated and gives a helpful error message.
-
-struct Foo;
-
-fn main() {
-    let x = Foo;
-    &x[];
-    //~^ WARN obsolete syntax
-    //~| ERROR cannot index
-}
diff --git a/src/test/compile-fail/unsafe-destructor-check-crash.rs b/src/test/compile-fail/unsafe-destructor-check-crash.rs
deleted file mode 100644 (file)
index af67558..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-
-// Regression test for issue #15557
-
-#![allow(dead_code)]
-struct AReg1<'a>(&'a u32);
-
-impl<'a> Drop for AReg1<'a> {
-//~^ ERROR: cannot implement a destructor on a structure with type parameters
-  fn drop(&mut self) {}
-}
-
-fn main() {}
index 808deea226bfc170909570c51d7f825ba83e28e5..6b7b9c8914955ca52233e9779884e0f80a8beae5 100644 (file)
@@ -10,6 +10,6 @@
 
 // error-pattern:can't find crate for `extra`
 
-extern crate "fake-crate" as extra;
+extern crate fake_crate as extra;
 
 fn main() { }
diff --git a/src/test/compile-fail/variance-region-bounds.rs b/src/test/compile-fail/variance-region-bounds.rs
new file mode 100644 (file)
index 0000000..96ae201
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Check that `T:'a` is contravariant in T.
+
+#![feature(rustc_attrs)]
+
+#[rustc_variance]
+trait Foo: 'static { //~ ERROR types=[[];[-];[]]
+}
+
+#[rustc_variance]
+trait Bar<T> { //~ ERROR types=[[+];[-];[]]
+    fn do_it(&self)
+        where T: 'static;
+}
+
+fn main() { }
index 42df43934a89cd19499ccbea68bf528b32f3f4a8..708d56442fe82b8fa15327814eff464547a34544 100644 (file)
@@ -17,4 +17,4 @@
 #![no_std]
 
 extern crate core;
-extern crate "weak-lang-items" as other;
+extern crate weak_lang_items;
index 30a70fe0b374703633a9a4bd9c2cd25701b27a92..1aabd549ca59506d8330cd52d1a2be91a47df7ba 100644 (file)
 
 // compile-flags:-g
 // gdb-command:run
-// gdb-command:whatis 'basic-types-globals-metadata::B'
+// gdb-command:whatis 'basic_types_globals_metadata::B'
 // gdb-check:type = bool
-// gdb-command:whatis 'basic-types-globals-metadata::I'
+// gdb-command:whatis 'basic_types_globals_metadata::I'
 // gdb-check:type = isize
-// gdb-command:whatis 'basic-types-globals-metadata::C'
+// gdb-command:whatis 'basic_types_globals_metadata::C'
 // gdb-check:type = char
-// gdb-command:whatis 'basic-types-globals-metadata::I8'
+// gdb-command:whatis 'basic_types_globals_metadata::I8'
 // gdb-check:type = i8
-// gdb-command:whatis 'basic-types-globals-metadata::I16'
+// gdb-command:whatis 'basic_types_globals_metadata::I16'
 // gdb-check:type = i16
-// gdb-command:whatis 'basic-types-globals-metadata::I32'
+// gdb-command:whatis 'basic_types_globals_metadata::I32'
 // gdb-check:type = i32
-// gdb-command:whatis 'basic-types-globals-metadata::I64'
+// gdb-command:whatis 'basic_types_globals_metadata::I64'
 // gdb-check:type = i64
-// gdb-command:whatis 'basic-types-globals-metadata::U'
+// gdb-command:whatis 'basic_types_globals_metadata::U'
 // gdb-check:type = usize
-// gdb-command:whatis 'basic-types-globals-metadata::U8'
+// gdb-command:whatis 'basic_types_globals_metadata::U8'
 // gdb-check:type = u8
-// gdb-command:whatis 'basic-types-globals-metadata::U16'
+// gdb-command:whatis 'basic_types_globals_metadata::U16'
 // gdb-check:type = u16
-// gdb-command:whatis 'basic-types-globals-metadata::U32'
+// gdb-command:whatis 'basic_types_globals_metadata::U32'
 // gdb-check:type = u32
-// gdb-command:whatis 'basic-types-globals-metadata::U64'
+// gdb-command:whatis 'basic_types_globals_metadata::U64'
 // gdb-check:type = u64
-// gdb-command:whatis 'basic-types-globals-metadata::F32'
+// gdb-command:whatis 'basic_types_globals_metadata::F32'
 // gdb-check:type = f32
-// gdb-command:whatis 'basic-types-globals-metadata::F64'
+// gdb-command:whatis 'basic_types_globals_metadata::F64'
 // gdb-check:type = f64
 // gdb-command:continue
 
 
 // N.B. These are `mut` only so they don't constant fold away.
 static mut B: bool = false;
-static mut I: int = -1;
+static mut I: isize = -1;
 static mut C: char = 'a';
 static mut I8: i8 = 68;
 static mut I16: i16 = -16;
 static mut I32: i32 = -32;
 static mut I64: i64 = -64;
-static mut U: uint = 1;
+static mut U: usize = 1;
 static mut U8: u8 = 100;
 static mut U16: u16 = 16;
 static mut U32: u32 = 32;
index cb89879481bcdc4b5e844581d3aa15ce5148cce8..f0c187fd223781fa1e80f6d4ee4b731f9589c930 100644 (file)
 
 // compile-flags:-g
 // gdb-command:run
-// gdb-command:print 'basic-types-globals::B'
+// gdb-command:print 'basic_types_globals::B'
 // gdb-check:$1 = false
-// gdb-command:print 'basic-types-globals::I'
+// gdb-command:print 'basic_types_globals::I'
 // gdb-check:$2 = -1
-// gdb-command:print 'basic-types-globals::C'
+// gdb-command:print 'basic_types_globals::C'
 // gdb-check:$3 = 97
-// gdb-command:print/d 'basic-types-globals::I8'
+// gdb-command:print/d 'basic_types_globals::I8'
 // gdb-check:$4 = 68
-// gdb-command:print 'basic-types-globals::I16'
+// gdb-command:print 'basic_types_globals::I16'
 // gdb-check:$5 = -16
-// gdb-command:print 'basic-types-globals::I32'
+// gdb-command:print 'basic_types_globals::I32'
 // gdb-check:$6 = -32
-// gdb-command:print 'basic-types-globals::I64'
+// gdb-command:print 'basic_types_globals::I64'
 // gdb-check:$7 = -64
-// gdb-command:print 'basic-types-globals::U'
+// gdb-command:print 'basic_types_globals::U'
 // gdb-check:$8 = 1
-// gdb-command:print/d 'basic-types-globals::U8'
+// gdb-command:print/d 'basic_types_globals::U8'
 // gdb-check:$9 = 100
-// gdb-command:print 'basic-types-globals::U16'
+// gdb-command:print 'basic_types_globals::U16'
 // gdb-check:$10 = 16
-// gdb-command:print 'basic-types-globals::U32'
+// gdb-command:print 'basic_types_globals::U32'
 // gdb-check:$11 = 32
-// gdb-command:print 'basic-types-globals::U64'
+// gdb-command:print 'basic_types_globals::U64'
 // gdb-check:$12 = 64
-// gdb-command:print 'basic-types-globals::F32'
+// gdb-command:print 'basic_types_globals::F32'
 // gdb-check:$13 = 2.5
-// gdb-command:print 'basic-types-globals::F64'
+// gdb-command:print 'basic_types_globals::F64'
 // gdb-check:$14 = 3.5
 // gdb-command:continue
 
 
 // N.B. These are `mut` only so they don't constant fold away.
 static mut B: bool = false;
-static mut I: int = -1;
+static mut I: isize = -1;
 static mut C: char = 'a';
 static mut I8: i8 = 68;
 static mut I16: i16 = -16;
 static mut I32: i32 = -32;
 static mut I64: i64 = -64;
-static mut U: uint = 1;
+static mut U: usize = 1;
 static mut U8: u8 = 100;
 static mut U16: u16 = 16;
 static mut U32: u32 = 32;
index 7f82878e080ce1c6fe4d0faff181596d4f2e0eab..4094c2e9b133928ff14a770d8433adab863c0570 100644 (file)
 // gdb-command:run
 
 // Check initializers
-// gdb-command:print 'basic-types-mut-globals::B'
+// gdb-command:print 'basic_types_mut_globals::B'
 // gdb-check:$1 = false
-// gdb-command:print 'basic-types-mut-globals::I'
+// gdb-command:print 'basic_types_mut_globals::I'
 // gdb-check:$2 = -1
-// gdb-command:print 'basic-types-mut-globals::C'
+// gdb-command:print 'basic_types_mut_globals::C'
 // gdb-check:$3 = 97
-// gdb-command:print/d 'basic-types-mut-globals::I8'
+// gdb-command:print/d 'basic_types_mut_globals::I8'
 // gdb-check:$4 = 68
-// gdb-command:print 'basic-types-mut-globals::I16'
+// gdb-command:print 'basic_types_mut_globals::I16'
 // gdb-check:$5 = -16
-// gdb-command:print 'basic-types-mut-globals::I32'
+// gdb-command:print 'basic_types_mut_globals::I32'
 // gdb-check:$6 = -32
-// gdb-command:print 'basic-types-mut-globals::I64'
+// gdb-command:print 'basic_types_mut_globals::I64'
 // gdb-check:$7 = -64
-// gdb-command:print 'basic-types-mut-globals::U'
+// gdb-command:print 'basic_types_mut_globals::U'
 // gdb-check:$8 = 1
-// gdb-command:print/d 'basic-types-mut-globals::U8'
+// gdb-command:print/d 'basic_types_mut_globals::U8'
 // gdb-check:$9 = 100
-// gdb-command:print 'basic-types-mut-globals::U16'
+// gdb-command:print 'basic_types_mut_globals::U16'
 // gdb-check:$10 = 16
-// gdb-command:print 'basic-types-mut-globals::U32'
+// gdb-command:print 'basic_types_mut_globals::U32'
 // gdb-check:$11 = 32
-// gdb-command:print 'basic-types-mut-globals::U64'
+// gdb-command:print 'basic_types_mut_globals::U64'
 // gdb-check:$12 = 64
-// gdb-command:print 'basic-types-mut-globals::F32'
+// gdb-command:print 'basic_types_mut_globals::F32'
 // gdb-check:$13 = 2.5
-// gdb-command:print 'basic-types-mut-globals::F64'
+// gdb-command:print 'basic_types_mut_globals::F64'
 // gdb-check:$14 = 3.5
 // gdb-command:continue
 
 // Check new values
-// gdb-command:print 'basic-types-mut-globals'::B
+// gdb-command:print 'basic_types_mut_globals'::B
 // gdb-check:$15 = true
-// gdb-command:print 'basic-types-mut-globals'::I
+// gdb-command:print 'basic_types_mut_globals'::I
 // gdb-check:$16 = 2
-// gdb-command:print 'basic-types-mut-globals'::C
+// gdb-command:print 'basic_types_mut_globals'::C
 // gdb-check:$17 = 102
-// gdb-command:print/d 'basic-types-mut-globals'::I8
+// gdb-command:print/d 'basic_types_mut_globals'::I8
 // gdb-check:$18 = 78
-// gdb-command:print 'basic-types-mut-globals'::I16
+// gdb-command:print 'basic_types_mut_globals'::I16
 // gdb-check:$19 = -26
-// gdb-command:print 'basic-types-mut-globals'::I32
+// gdb-command:print 'basic_types_mut_globals'::I32
 // gdb-check:$20 = -12
-// gdb-command:print 'basic-types-mut-globals'::I64
+// gdb-command:print 'basic_types_mut_globals'::I64
 // gdb-check:$21 = -54
-// gdb-command:print 'basic-types-mut-globals'::U
+// gdb-command:print 'basic_types_mut_globals'::U
 // gdb-check:$22 = 5
-// gdb-command:print/d 'basic-types-mut-globals'::U8
+// gdb-command:print/d 'basic_types_mut_globals'::U8
 // gdb-check:$23 = 20
-// gdb-command:print 'basic-types-mut-globals'::U16
+// gdb-command:print 'basic_types_mut_globals'::U16
 // gdb-check:$24 = 32
-// gdb-command:print 'basic-types-mut-globals'::U32
+// gdb-command:print 'basic_types_mut_globals'::U32
 // gdb-check:$25 = 16
-// gdb-command:print 'basic-types-mut-globals'::U64
+// gdb-command:print 'basic_types_mut_globals'::U64
 // gdb-check:$26 = 128
-// gdb-command:print 'basic-types-mut-globals'::F32
+// gdb-command:print 'basic_types_mut_globals'::F32
 // gdb-check:$27 = 5.75
-// gdb-command:print 'basic-types-mut-globals'::F64
+// gdb-command:print 'basic_types_mut_globals'::F64
 // gdb-check:$28 = 9.25
 
 #![allow(unused_variables)]
 #![omit_gdb_pretty_printer_section]
 
 static mut B: bool = false;
-static mut I: int = -1;
+static mut I: isize = -1;
 static mut C: char = 'a';
 static mut I8: i8 = 68;
 static mut I16: i16 = -16;
 static mut I32: i32 = -32;
 static mut I64: i64 = -64;
-static mut U: uint = 1;
+static mut U: usize = 1;
 static mut U8: u8 = 100;
 static mut U16: u16 = 16;
 static mut U32: u32 = 32;
index 95483c16783cc8a97679662d4d98c6ac8d7fd831..c9144b18b2fe811827d1de86ad5f47aaf4b2a75f 100644 (file)
@@ -60,7 +60,7 @@
 // lldb-check:[...]$1 = -1
 
 // NOTE: LLDB does not support 32bit chars
-// d ebugger:print (uint)(c)
+// d ebugger:print (usize)(c)
 // c heck:$3 = 97
 
 // lldb-command:print i8
 
 fn main() {
     let b: bool = false;
-    let i: int = -1;
+    let i: isize = -1;
     let c: char = 'a';
     let i8: i8 = 68;
     let i16: i16 = -16;
     let i32: i32 = -32;
     let i64: i64 = -64;
-    let u: uint = 1;
+    let u: usize = 1;
     let u8: u8 = 100;
     let u16: u16 = 16;
     let u32: u32 = 32;
index 52e81b7e046a561723be6f5800eb29b9d2a2ee98..b0f06bb8a758c3ecabfd8502fd1d461c49a07aee 100644 (file)
@@ -114,8 +114,8 @@ fn main() {
     let bool_val: bool = true;
     let bool_ref: &bool = &bool_val;
 
-    let int_val: int = -1;
-    let int_ref: &int = &int_val;
+    let int_val: isize = -1;
+    let int_ref: &isize = &int_val;
 
     let char_val: char = 'a';
     let char_ref: &char = &char_val;
@@ -132,8 +132,8 @@ fn main() {
     let i64_val: i64 = -64;
     let i64_ref: &i64 = &i64_val;
 
-    let uint_val: uint = 1;
-    let uint_ref: &uint = &uint_val;
+    let uint_val: usize = 1;
+    let uint_ref: &usize = &uint_val;
 
     let u8_val: u8 = 100;
     let u8_ref: &u8 = &u8_val;
index 4430ea9380d43585a8c11ef49edbaf7febd4a074..70c24fc2ab07bf6a47acdfea1b0f2252ec29d8b5 100644 (file)
 #![omit_gdb_pretty_printer_section]
 
 struct SomeStruct {
-    x: int,
+    x: isize,
     y: f64
 }
 
 fn main() {
     let stack_val: SomeStruct = SomeStruct { x: 10, y: 23.5 };
     let stack_val_ref: &SomeStruct = &stack_val;
-    let stack_val_interior_ref_1: &int = &stack_val.x;
+    let stack_val_interior_ref_1: &isize = &stack_val.x;
     let stack_val_interior_ref_2: &f64 = &stack_val.y;
     let ref_to_unnamed: &SomeStruct = &SomeStruct { x: 11, y: 24.5 };
 
     let unique_val: Box<_> = box SomeStruct { x: 13, y: 26.5 };
     let unique_val_ref: &SomeStruct = &*unique_val;
-    let unique_val_interior_ref_1: &int = &unique_val.x;
+    let unique_val_interior_ref_1: &isize = &unique_val.x;
     let unique_val_interior_ref_2: &f64 = &unique_val.y;
 
     zzz(); // #break
index 14a3d008f420db9e090e8a1b5bd07c6d5d7a9139..d8ce3af478911a27c4a655936a57b19fbb44efca 100644 (file)
@@ -118,8 +118,8 @@ fn main() {
     let bool_box: Box<bool> = box true;
     let bool_ref: &bool = &*bool_box;
 
-    let int_box: Box<int> = box -1;
-    let int_ref: &int = &*int_box;
+    let int_box: Box<isize> = box -1;
+    let int_ref: &isize = &*int_box;
 
     let char_box: Box<char> = box 'a';
     let char_ref: &char = &*char_box;
@@ -136,8 +136,8 @@ fn main() {
     let i64_box: Box<i64> = box -64;
     let i64_ref: &i64 = &*i64_box;
 
-    let uint_box: Box<uint> = box 1;
-    let uint_ref: &uint = &*uint_box;
+    let uint_box: Box<usize> = box 1;
+    let uint_ref: &usize = &*uint_box;
 
     let u8_box: Box<u8> = box 100;
     let u8_ref: &u8 = &*u8_box;
index 3efda1e2f6aa84f0deb2862595b8074132dfc16d..bc1116b064177d3f65cc498209693fbac84c357e 100644 (file)
@@ -74,7 +74,7 @@
 
 #[derive(Clone)]
 struct Struct {
-    a: int,
+    a: isize,
     b: f64
 }
 
@@ -92,11 +92,11 @@ fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) {
     zzz(); // #break
 }
 
-fn tup(a: (int, uint, f64, f64)) {
+fn tup(a: (isize, usize, f64, f64)) {
     zzz(); // #break
 }
 
-struct Newtype(f64, f64, int, uint);
+struct Newtype(f64, f64, isize, usize);
 
 fn new_type(a: Newtype) {
     zzz(); // #break
index 2b2a9bf83f1428854a775a0e1178913890393a89..5bd872f9faf738e1029740bcab03ee2570c1899f 100644 (file)
@@ -51,16 +51,16 @@ trait Trait {
     fn method(self) -> Self;
 }
 
-impl Trait for int {
-    fn method(self) -> int {
+impl Trait for isize {
+    fn method(self) -> isize {
         zzz(); // #break
         self
     }
 }
 
 struct Struct {
-    x: uint,
-    y: uint,
+    x: usize,
+    y: usize,
 }
 
 impl Trait for Struct {
@@ -70,15 +70,15 @@ fn method(self) -> Struct {
     }
 }
 
-impl Trait for (f64, int, int, f64) {
-    fn method(self) -> (f64, int, int, f64) {
+impl Trait for (f64, isize, isize, f64) {
+    fn method(self) -> (f64, isize, isize, f64) {
         zzz(); // #break
         self
     }
 }
 
 fn main() {
-    let _ = (1111 as int).method();
+    let _ = (1111 as isize).method();
     let _ = Struct { x: 2222, y: 3333 }.method();
     let _ = (4444.5, 5555, 6666, 7777.5).method();
 }
index 766105881cedfca70391de16cf81e9011323f3a1..7a285d90b9d6a1d053d79ec3885ba30c4d73e800 100644 (file)
 
 // === GDB TESTS ===================================================================================
 
-// gdb-command:print 'c-style-enum::SINGLE_VARIANT'
+// gdb-command:print 'c_style_enum::SINGLE_VARIANT'
 // gdb-check:$1 = TheOnlyVariant
 
-// gdb-command:print 'c-style-enum::AUTO_ONE'
+// gdb-command:print 'c_style_enum::AUTO_ONE'
 // gdb-check:$2 = One
 
-// gdb-command:print 'c-style-enum::AUTO_TWO'
+// gdb-command:print 'c_style_enum::AUTO_TWO'
 // gdb-check:$3 = One
 
-// gdb-command:print 'c-style-enum::AUTO_THREE'
+// gdb-command:print 'c_style_enum::AUTO_THREE'
 // gdb-check:$4 = One
 
-// gdb-command:print 'c-style-enum::MANUAL_ONE'
+// gdb-command:print 'c_style_enum::MANUAL_ONE'
 // gdb-check:$5 = OneHundred
 
-// gdb-command:print 'c-style-enum::MANUAL_TWO'
+// gdb-command:print 'c_style_enum::MANUAL_TWO'
 // gdb-check:$6 = OneHundred
 
-// gdb-command:print 'c-style-enum::MANUAL_THREE'
+// gdb-command:print 'c_style_enum::MANUAL_THREE'
 // gdb-check:$7 = OneHundred
 
 // gdb-command:run
 // gdb-command:print single_variant
 // gdb-check:$14 = TheOnlyVariant
 
-// gdb-command:print 'c-style-enum::AUTO_TWO'
+// gdb-command:print 'c_style_enum::AUTO_TWO'
 // gdb-check:$15 = Two
 
-// gdb-command:print 'c-style-enum::AUTO_THREE'
+// gdb-command:print 'c_style_enum::AUTO_THREE'
 // gdb-check:$16 = Three
 
-// gdb-command:print 'c-style-enum::MANUAL_TWO'
+// gdb-command:print 'c_style_enum::MANUAL_TWO'
 // gdb-check:$17 = OneThousand
 
-// gdb-command:print 'c-style-enum::MANUAL_THREE'
+// gdb-command:print 'c_style_enum::MANUAL_THREE'
 // gdb-check:$18 = OneMillion
 
 
index 51cced204398f45ef99d996e31dd94cb55ffe014..d7ec5673258e1eb7bd65b2c37554de620c9aebbf 100644 (file)
@@ -325,18 +325,18 @@ enum Univariant {
     Unit(i32)
 }
 
-struct TupleStruct (f64, int);
+struct TupleStruct (f64, isize);
 
 
-fn simple_tuple((a, b): (int, bool)) {
+fn simple_tuple((a, b): (isize, bool)) {
     zzz(); // #break
 }
 
-fn nested_tuple((a, (b, c)): (int, (u16, u16))) {
+fn nested_tuple((a, (b, c)): (isize, (u16, u16))) {
     zzz(); // #break
 }
 
-fn destructure_only_first_level((a, b): (int, (u32, u32))) {
+fn destructure_only_first_level((a, b): (isize, (u32, u32))) {
     zzz(); // #break
 }
 
@@ -348,7 +348,7 @@ fn struct_pattern(Struct { a: k, b: l }: Struct) {
     zzz(); // #break
 }
 
-fn ignored_tuple_element((m, _, n): (int, u16, i32)) {
+fn ignored_tuple_element((m, _, n): (isize, u16, i32)) {
     zzz(); // #break
 }
 
@@ -370,27 +370,27 @@ fn complex_nesting(((u,   v  ), ((w,   (x,   Struct { a: y, b: z})), Struct { a:
     zzz(); // #break
 }
 
-fn managed_box(&aa: &(int, int)) {
+fn managed_box(&aa: &(isize, isize)) {
     zzz(); // #break
 }
 
-fn borrowed_pointer(&bb: &(int, int)) {
+fn borrowed_pointer(&bb: &(isize, isize)) {
     zzz(); // #break
 }
 
-fn contained_borrowed_pointer((&cc, _): (&int, int)) {
+fn contained_borrowed_pointer((&cc, _): (&isize, isize)) {
     zzz(); // #break
 }
 
-fn unique_pointer(box dd: Box<(int, int, int)>) {
+fn unique_pointer(box dd: Box<(isize, isize, isize)>) {
     zzz(); // #break
 }
 
-fn ref_binding(ref ee: (int, int, int)) {
+fn ref_binding(ref ee: (isize, isize, isize)) {
     zzz(); // #break
 }
 
-fn ref_binding_in_tuple((ref ff, gg): (int, (int, int))) {
+fn ref_binding_in_tuple((ref ff, gg): (isize, (isize, isize))) {
     zzz(); // #break
 }
 
@@ -414,7 +414,7 @@ fn tuple_struct_with_ref_binding(TupleStruct(mm, ref nn): TupleStruct) {
     zzz(); // #break
 }
 
-fn multiple_arguments((oo, pp): (int, int), qq : int) {
+fn multiple_arguments((oo, pp): (isize, isize), qq : isize) {
     zzz(); // #break
 }
 
@@ -442,7 +442,7 @@ fn main() {
     tuple_struct_with_ref_binding(TupleStruct(55.0, 56));
     multiple_arguments((57, 58), 59);
 
-    fn nested_function(rr: int, (ss, tt): (int, int)) {
+    fn nested_function(rr: isize, (ss, tt): (isize, isize)) {
         zzz(); // #break
     }
 
index cf0ca0b67a7b4db57364314f531531bb268a087e..4b1c57e0afb4a5532f4512aa82677285d84658fd 100644 (file)
@@ -258,18 +258,18 @@ enum Univariant {
     Unit(i32)
 }
 
-struct TupleStruct (f64, int);
+struct TupleStruct (f64, isize);
 
 
 fn main() {
     // simple tuple
-    let (a, b) : (int, bool) = (1, false);
+    let (a, b) : (isize, bool) = (1, false);
 
     // nested tuple
-    let (c, (d, e)) : (int, (u16, u16)) = (2, (3, 4));
+    let (c, (d, e)) : (isize, (u16, u16)) = (2, (3, 4));
 
     // bind tuple-typed value to one name (destructure only first level)
-    let (f, g) : (int, (u32, u32)) = (5, (6, 7));
+    let (f, g) : (isize, (u32, u32)) = (5, (6, 7));
 
     // struct as tuple element
     let (h, i, j) : (i16, Struct, i16) = (8, Struct { a: 9, b: 10 }, 11);
index c161600f2c3c9d24f99c2822eea03481273d04b5..d611e4a65a61385a395e361591ef69e29ffb713f 100644 (file)
 #![allow(unused_variables)]
 #![omit_gdb_pretty_printer_section]
 
-fn immediate_args(a: int, b: bool, c: f64) {
+fn immediate_args(a: isize, b: bool, c: f64) {
     ::std::old_io::print("") // #break
 }
 
index 2ab3668abb9dd5ec256024fd1350ac368fdc8cad..21c2cc09a9fd4f91019895676599b6d0bb7c4569 100644 (file)
@@ -58,7 +58,7 @@ fn nested(a: i32, b: i64) -> (i32, i64) {
     }
 }
 
-fn fun(x: int, y: bool) -> (int, bool) {
+fn fun(x: isize, y: bool) -> (isize, bool) {
     zzz(); // #break
 
     (x, y)
index 99e31ab23021442ca93788b9e08c282abce0f912..0608e49b28cf43b84a0463885a577291dafc7d6b 100644 (file)
 #![omit_gdb_pretty_printer_section]
 
 #[no_stack_check]
-fn immediate_args(a: int, b: bool, c: f64) {
+fn immediate_args(a: isize, b: bool, c: f64) {
     ::std::old_io::print("");
 }
 
index 8312d16bcac186136fc3d6714fb9de38e0ab8c53..e1a77b34e7f057bfdf9066eb2dcec75f23ee5767 100644 (file)
 #![feature(old_io)]
 #![omit_gdb_pretty_printer_section]
 
-fn immediate_args(a: int, b: bool, c: f64) {
+fn immediate_args(a: isize, b: bool, c: f64) {
     ()
 }
 
index aa902a9b2d4ade48db06cde5dbc70a7372a5373d..aa6051d79224585469ae51fd5207f59852fef156 100644 (file)
@@ -37,7 +37,7 @@
 // gdb-check:$5 = CStyleEnumVar3
 
 struct RegularStruct {
-    the_first_field: int,
+    the_first_field: isize,
     the_second_field: f64,
     the_third_field: bool,
 }
index d47dee14f55a3f331a1da3ddb56e0528393ef32c..81af9c213a34357cd2b28829ea88febfaa2a7e8b 100644 (file)
@@ -81,7 +81,7 @@
 use self::NestedEnum::{NestedVariant1, NestedVariant2};
 
 struct RegularStruct {
-    the_first_field: int,
+    the_first_field: isize,
     the_second_field: f64,
     the_third_field: bool,
     the_fourth_field: &'static str,
@@ -140,7 +140,7 @@ fn main() {
     let mixed_enum_struct_var = MixedEnumStructVar { field1: 108.5, field2: 109 };
 
     let some = Some(110_usize);
-    let none: Option<int> = None;
+    let none: Option<isize> = None;
     let some_fat = Some("abc");
     let none_fat: Option<&'static str> = None;
 
@@ -177,7 +177,7 @@ fn main() {
         }
     };
 
-    let none_check1: Option<(uint, Vec<uint>)> = None;
+    let none_check1: Option<(usize, Vec<usize>)> = None;
     let none_check2: Option<String> = None;
 
     zzz(); // #break
index 76b7a3e729d2e0035932e11f17e677e57d081818..1748083b2ba1f6c59e877838bbd0f5d81b589149 100644 (file)
@@ -73,7 +73,7 @@
 
 #[derive(Clone)]
 struct Struct {
-    a: int,
+    a: isize,
     b: f64
 }
 
index 07b6d745544bbe4c29b7f3e586b9c390c685758b..06053965ca7571d7a28475b51be67aee8c0f1489 100644 (file)
@@ -121,17 +121,17 @@ struct Struct<T> {
 
 impl<T1> Struct<T1> {
 
-    fn self_by_ref<T2>(&self, arg1: int, arg2: T2) -> int {
+    fn self_by_ref<T2>(&self, arg1: isize, arg2: T2) -> isize {
         zzz(); // #break
         arg1
     }
 
-    fn self_by_val<T2>(self, arg1: int, arg2: T2) -> int {
+    fn self_by_val<T2>(self, arg1: isize, arg2: T2) -> isize {
         zzz(); // #break
         arg1
     }
 
-    fn self_owned<T2>(self: Box<Struct<T1>>, arg1: int, arg2: T2) -> int {
+    fn self_owned<T2>(self: Box<Struct<T1>>, arg1: isize, arg2: T2) -> isize {
         zzz(); // #break
         arg1
     }
index eb1083f624faaca834221eb4fbf7b76f8cb1b171..f24b221ccec2c4caae433dfc8e54570bbcd29ff8 100644 (file)
 #![omit_gdb_pretty_printer_section]
 
 struct Struct {
-    x: int
+    x: isize
 }
 
 impl Struct {
 
-    fn static_method<T1, T2>(arg1: T1, arg2: T2) -> int {
+    fn static_method<T1, T2>(arg1: T1, arg2: T2) -> isize {
         zzz(); // #break
         return 0;
     }
 }
 
 enum Enum {
-    Variant1 { x: int },
+    Variant1 { x: isize },
     Variant2,
-    Variant3(f64, int, char),
+    Variant3(f64, isize, char),
 }
 
 impl Enum {
 
-    fn static_method<T1, T2, T3>(arg1: T1, arg2: T2, arg3: T3) -> int {
+    fn static_method<T1, T2, T3>(arg1: T1, arg2: T2, arg3: T3) -> isize {
         zzz(); // #break
         return 1;
     }
index 455861b1ea1eba65626afb29cd4449506677aaea..caed4bd181d64ab2d649052d75e74375cea89cae 100644 (file)
@@ -53,7 +53,7 @@ enum Univariant<T> {
 
 fn main() {
 
-    // In order to avoid endianess trouble all of the following test values consist of a single
+    // In order to avoid endianness trouble all of the following test values consist of a single
     // repeated byte. This way each interpretation of the union should look the same, no matter if
     // this is a big or little endian machine.
 
index 15982f309c6bbf9c96e93f93edeac81e4516ad6a..a459badfa8a3c2f1ebbeda73ad5226ffbe2a5ac6 100644 (file)
@@ -38,7 +38,7 @@
 // lldb-check:[...]$2 = AGenericStruct<f64, i32> { key: 4.5, value: 5 }
 
 // lldb-command:print float_int_float
-// lldb-check:[...]$3 = AGenericStruct<f64, generic-struct::AGenericStruct<i32, f64>> { key: 6.5, value: AGenericStruct<i32, f64> { key: 7, value: 8.5 } }
+// lldb-check:[...]$3 = AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>> { key: 6.5, value: AGenericStruct<i32, f64> { key: 7, value: 8.5 } }
 
 
 #![omit_gdb_pretty_printer_section]
index 4382861fd20991af0d3e2f248fc4978e5528449c..45da87a56740e32c71ebfddac157dd38b4eb1c50 100644 (file)
 #![omit_gdb_pretty_printer_section]
 
 struct Struct {
-    x: int
+    x: isize
 }
 
 trait Trait<T1> {
-    fn generic_static_default_method<T2>(arg1: int, arg2: &(T1, T2)) -> int {
+    fn generic_static_default_method<T2>(arg1: isize, arg2: &(T1, T2)) -> isize {
         zzz(); // #break
         arg1
     }
@@ -43,8 +43,9 @@ impl<T> Trait<T> for Struct {}
 fn main() {
 
     // Is this really how to use these?
-    Trait::generic_static_default_method::<int, Struct, float>(1000, &(1, 2.5));
-    Trait::generic_static_default_method::<float, Struct, (int, int, int)>(2000, &(3.5, (4, 5, 6)));
+    Trait::generic_static_default_method::<isize, Struct, float>(1000, &(1, 2.5));
+    Trait::generic_static_default_method::<float, Struct, (isize, isize, isize)>(2000,
+            &(3.5, (4, 5, 6)));
 
 }
 
index da62e335557a20093d0f50ecc4514da6f84916ff..b0f0852c69e46675cda27e18e54e43f72d65aa13 100644 (file)
@@ -71,7 +71,7 @@ enum Univariant<T64> {
 
 fn main() {
 
-    // In order to avoid endianess trouble all of the following test values consist of a single
+    // In order to avoid endianness trouble all of the following test values consist of a single
     // repeated byte. This way each interpretation of the union should look the same, no matter if
     // this is a big or little endian machine.
 
index 3c2e7f10d16116b1b9e8a51520ffc83a3ecb0deb..b259efc9caf804cac305122f01517fad8434c125 100644 (file)
@@ -29,7 +29,7 @@
 // contained in the output, after calling `next` just once, we can be sure that we did not stop in
 // unwrap(). (The testing framework doesn't allow for checking that some text is *not* contained in
 // the output, which is why we have to make the test in this kind of roundabout way)
-fn bar() -> int {
+fn bar() -> isize {
     let s = Some(5).unwrap(); // #break
     s
 }
index c2cddd25768598f67910ee7883feba7a70c6b1f3..228799848c64667371627443841557f7095def69 100644 (file)
 #![omit_gdb_pretty_printer_section]
 
 struct Struct {
-    x: int,
-    y: int
+    x: isize,
+    y: isize
 }
 
 fn main() {
index 6a909ced818ef53cb4be353c8d827eb11782d126..c0b65fbb22b53bc6dba2666e3d189b1efc2687da 100644 (file)
@@ -78,7 +78,7 @@ fn main() {
     zzz(); // #break
     sentinel();
 
-    let closure = |x: int| {
+    let closure = |x: isize| {
         zzz(); // #break
         sentinel();
 
index c0a5a31c9ce38e1237ff0b57c3e1bc329ae6d466..5bae2aa7ae2cc14dde3bd697347e713a5ce227e0 100644 (file)
@@ -79,7 +79,7 @@ fn main() {
     zzz(); // #break
     sentinel();
 
-    let unique_closure = |x:int| {
+    let unique_closure = |x:isize| {
         zzz(); // #break
         sentinel();
 
index c1ec837a4b8188383ee8d17189fcb77750abbbc8..1d406af10a21564a5193dfe6edbedcbacd64b46d 100644 (file)
@@ -16,7 +16,7 @@
 
 // gdb-command:run
 
-// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-command:print 'lexical_scopes_in_block_expression::MUT_INT'
 // gdb-check:$1 = 0
 
 // STRUCT EXPRESSION
@@ -28,7 +28,7 @@
 
 // gdb-command:print val
 // gdb-check:$4 = 11
-// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-command:print 'lexical_scopes_in_block_expression::MUT_INT'
 // gdb-check:$5 = 1
 // gdb-command:print ten
 // gdb-check:$6 = 10
@@ -49,7 +49,7 @@
 
 // gdb-command:print val
 // gdb-check:$11 = 12
-// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-command:print 'lexical_scopes_in_block_expression::MUT_INT'
 // gdb-check:$12 = 2
 // gdb-command:print ten
 // gdb-check:$13 = 10
@@ -70,7 +70,7 @@
 
 // gdb-command:print val
 // gdb-check:$18 = 13
-// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-command:print 'lexical_scopes_in_block_expression::MUT_INT'
 // gdb-check:$19 = 3
 // gdb-command:print ten
 // gdb-check:$20 = 10
@@ -91,7 +91,7 @@
 
 // gdb-command:print val
 // gdb-check:$25 = 14
-// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-command:print 'lexical_scopes_in_block_expression::MUT_INT'
 // gdb-check:$26 = 4
 // gdb-command:print ten
 // gdb-check:$27 = 10
 
 // gdb-command:print val
 // gdb-check:$32 = 15
-// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-command:print 'lexical_scopes_in_block_expression::MUT_INT'
 // gdb-check:$33 = 5
 // gdb-command:print ten
 // gdb-check:$34 = 10
 
 // gdb-command:print val
 // gdb-check:$39 = 16
-// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-command:print 'lexical_scopes_in_block_expression::MUT_INT'
 // gdb-check:$40 = 6
 // gdb-command:print ten
 // gdb-check:$41 = 10
 
 // gdb-command:print val
 // gdb-check:$46 = 17
-// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-command:print 'lexical_scopes_in_block_expression::MUT_INT'
 // gdb-check:$47 = 7
 // gdb-command:print ten
 // gdb-check:$48 = 10
 
 // gdb-command:print val
 // gdb-check:$53 = 18
-// gdb-command:print 'lexical-scopes-in-block-expression::MUT_INT'
+// gdb-command:print 'lexical_scopes_in_block_expression::MUT_INT'
 // gdb-check:$54 = 8
 // gdb-command:print ten
 // gdb-check:$55 = 10
 #![allow(unused_assignments)]
 #![omit_gdb_pretty_printer_section]
 
-static mut MUT_INT: int = 0;
+static mut MUT_INT: isize = 0;
 
 struct Point {
-    x: int,
-    y: int
+    x: isize,
+    y: isize
 }
 
-fn a_function(x: int) -> int {
+fn a_function(x: isize) -> isize {
     x + 1
 }
 
@@ -502,7 +502,7 @@ fn main() {
         zzz(); // #break
         sentinel();
 
-        val as uint
+        val as usize
     }];
 
     zzz(); // #break
index c140390604b94c3a0cda28faa47a0015b992b596..ea7d150164dfb6efc082e85a17e49dc6c6a5821e 100644 (file)
@@ -44,7 +44,7 @@ fn main() {
 
 fn zzz() {()}
 
-fn some_function(a: int, b: int) {
+fn some_function(a: isize, b: isize) {
     let some_variable = Struct { a: 11, b: 22 };
     let some_other_variable = 23;
 
@@ -53,4 +53,4 @@ fn some_function(a: int, b: int) {
     }
 }
 
-fn some_other_function(a: int, b: int) -> bool { true }
+fn some_other_function(a: isize, b: isize) -> bool { true }
index 7172a880f4c3d71e3356febbb0da4ee52de22504..314ec472b69419a5671e201f2e66aad08baf42e9 100644 (file)
@@ -123,17 +123,17 @@ enum Enum {
 
 impl Enum {
 
-    fn self_by_ref(&self, arg1: int, arg2: int) -> int {
+    fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
 
-    fn self_by_val(self, arg1: int, arg2: int) -> int {
+    fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
 
-    fn self_owned(self: Box<Enum>, arg1: int, arg2: int) -> int {
+    fn self_owned(self: Box<Enum>, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
index bf6635f833f6ec349b5cb0bb464ec34d7213ccc8..564c2d26493d2dd8dd6e6df1c26b2765c85374e9 100644 (file)
@@ -122,17 +122,17 @@ struct Struct<T> {
 
 impl<T> Struct<T> {
 
-    fn self_by_ref(&self, arg1: int, arg2: int) -> int {
+    fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
 
-    fn self_by_val(self, arg1: int, arg2: int) -> int {
+    fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
 
-    fn self_owned(self: Box<Struct<T>>, arg1: int, arg2: int) -> int {
+    fn self_owned(self: Box<Struct<T>>, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
index 54779e007088fbe1c91717da8bf6aafab9e10891..eba4370e698ed2ba4be685d79f169ff288e3b549 100644 (file)
 
 #[derive(Copy)]
 struct Struct {
-    x: int
+    x: isize
 }
 
 impl Struct {
 
-    fn self_by_ref(&self, arg1: int, arg2: int) -> int {
+    fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         self.x + arg1 + arg2
     }
 
-    fn self_by_val(self, arg1: int, arg2: int) -> int {
+    fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         self.x + arg1 + arg2
     }
 
-    fn self_owned(self: Box<Struct>, arg1: int, arg2: int) -> int {
+    fn self_owned(self: Box<Struct>, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         self.x + arg1 + arg2
     }
index 7954bcae1b231d1db009017abc2ceb8ce39b99a2..6df7cdfd47f1870901e46d750a550fdfa400312b 100644 (file)
 
 #[derive(Copy)]
 struct Struct {
-    x: int
+    x: isize
 }
 
 trait Trait {
-    fn self_by_ref(&self, arg1: int, arg2: int) -> int;
-    fn self_by_val(self, arg1: int, arg2: int) -> int;
-    fn self_owned(self: Box<Self>, arg1: int, arg2: int) -> int;
+    fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize;
+    fn self_by_val(self, arg1: isize, arg2: isize) -> isize;
+    fn self_owned(self: Box<Self>, arg1: isize, arg2: isize) -> isize;
 }
 
 impl Trait for Struct {
 
-    fn self_by_ref(&self, arg1: int, arg2: int) -> int {
+    fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         self.x + arg1 + arg2
     }
 
-    fn self_by_val(self, arg1: int, arg2: int) -> int {
+    fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         self.x + arg1 + arg2
     }
 
-    fn self_owned(self: Box<Struct>, arg1: int, arg2: int) -> int {
+    fn self_owned(self: Box<Struct>, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         self.x + arg1 + arg2
     }
index af1287066504e2746b4c9ebcd28bd86a4ffbbd0a..b638e210dd38aeb60a59d6dbfe081fa4b358c809 100644 (file)
 #![omit_gdb_pretty_printer_section]
 
 #[derive(Copy)]
-struct TupleStruct(int, f64);
+struct TupleStruct(isize, f64);
 
 impl TupleStruct {
 
-    fn self_by_ref(&self, arg1: int, arg2: int) -> int {
+    fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
 
-    fn self_by_val(self, arg1: int, arg2: int) -> int {
+    fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
 
-    fn self_owned(self: Box<TupleStruct>, arg1: int, arg2: int) -> int {
+    fn self_owned(self: Box<TupleStruct>, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
index fe262a7ea8da6da574fa9d2c7968de105b43130d..4772ee10ff7243c550374a5a09de06211af8f082 100644 (file)
@@ -105,7 +105,7 @@ struct LongCycle4<T> {
 
 struct LongCycleWithAnonymousTypes {
     next: Opt<Box<Box<Box<Box<Box<LongCycleWithAnonymousTypes>>>>>>,
-    value: uint,
+    value: usize,
 }
 
 // This test case makes sure that recursive structs are properly described. The Node structs are
index 008eeda92d055661572c12acb90fde04081d084b..f61b78d5449e7e012c5a24f5ecaed02d1bb42fae 100644 (file)
 
 #[derive(Copy)]
 struct Struct {
-    x: int
+    x: isize
 }
 
 trait Trait : Sized {
-    fn self_by_ref(&self, arg1: int, arg2: int) -> int {
+    fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
 
-    fn self_by_val(self, arg1: int, arg2: int) -> int {
+    fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
 
-    fn self_owned(self: Box<Self>, arg1: int, arg2: int) -> int {
+    fn self_owned(self: Box<Self>, arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
index 94e5f6f6c1052aaa435b37c6f89bedc84fc1b1b2..4ac436c9325bb0f3fa3d6f967076bfeaa6e73842 100644 (file)
 
 #[derive(Copy)]
 struct Struct {
-    x: int
+    x: isize
 }
 
 trait Trait : Sized {
 
-    fn self_by_ref<T>(&self, arg1: int, arg2: T) -> int {
+    fn self_by_ref<T>(&self, arg1: isize, arg2: T) -> isize {
         zzz(); // #break
         arg1
     }
 
-    fn self_by_val<T>(self, arg1: int, arg2: T) -> int {
+    fn self_by_val<T>(self, arg1: isize, arg2: T) -> isize {
         zzz(); // #break
         arg1
     }
 
-    fn self_owned<T>(self: Box<Self>, arg1: int, arg2: T) -> int {
+    fn self_owned<T>(self: Box<Self>, arg1: isize, arg2: T) -> isize {
         zzz(); // #break
         arg1
     }
index eee3cf55052a346a7e8b455bb21447e6503954e8..36007c1093297e14ba015b3eb5f3047cb8659ca0 100644 (file)
 
 // === GDB TESTS ===================================================================================
 
-// gdb-command:print 'simple-struct::NO_PADDING_16'
+// gdb-command:print 'simple_struct::NO_PADDING_16'
 // gdb-check:$1 = {x = 1000, y = -1001}
 
-// gdb-command:print 'simple-struct::NO_PADDING_32'
+// gdb-command:print 'simple_struct::NO_PADDING_32'
 // gdb-check:$2 = {x = 1, y = 2, z = 3}
 
-// gdb-command:print 'simple-struct::NO_PADDING_64'
+// gdb-command:print 'simple_struct::NO_PADDING_64'
 // gdb-check:$3 = {x = 4, y = 5, z = 6}
 
-// gdb-command:print 'simple-struct::NO_PADDING_163264'
+// gdb-command:print 'simple_struct::NO_PADDING_163264'
 // gdb-check:$4 = {a = 7, b = 8, c = 9, d = 10}
 
-// gdb-command:print 'simple-struct::INTERNAL_PADDING'
+// gdb-command:print 'simple_struct::INTERNAL_PADDING'
 // gdb-check:$5 = {x = 11, y = 12}
 
-// gdb-command:print 'simple-struct::PADDING_AT_END'
+// gdb-command:print 'simple_struct::PADDING_AT_END'
 // gdb-check:$6 = {x = 13, y = 14}
 
 // gdb-command:run
 // gdb-command:print padding_at_end
 // gdb-check:$12 = {x = -10014, y = 10015}
 
-// gdb-command:print 'simple-struct::NO_PADDING_16'
+// gdb-command:print 'simple_struct::NO_PADDING_16'
 // gdb-check:$13 = {x = 100, y = -101}
 
-// gdb-command:print 'simple-struct::NO_PADDING_32'
+// gdb-command:print 'simple_struct::NO_PADDING_32'
 // gdb-check:$14 = {x = -15, y = -16, z = 17}
 
-// gdb-command:print 'simple-struct::NO_PADDING_64'
+// gdb-command:print 'simple_struct::NO_PADDING_64'
 // gdb-check:$15 = {x = -18, y = 19, z = 20}
 
-// gdb-command:print 'simple-struct::NO_PADDING_163264'
+// gdb-command:print 'simple_struct::NO_PADDING_163264'
 // gdb-check:$16 = {a = -21, b = 22, c = 23, d = 24}
 
-// gdb-command:print 'simple-struct::INTERNAL_PADDING'
+// gdb-command:print 'simple_struct::INTERNAL_PADDING'
 // gdb-check:$17 = {x = 25, y = -26}
 
-// gdb-command:print 'simple-struct::PADDING_AT_END'
+// gdb-command:print 'simple_struct::PADDING_AT_END'
 // gdb-check:$18 = {x = -27, y = 28}
 
 // gdb-command:continue
index 75db47af2463fefca9a652929ab33f0fe61f06be..3c3a85a34c7cf29c2ab58692f2807764f48af297 100644 (file)
 
 // === GDB TESTS ===================================================================================
 
-// gdb-command:print/d 'simple-tuple::NO_PADDING_8'
+// gdb-command:print/d 'simple_tuple::NO_PADDING_8'
 // gdb-check:$1 = {-50, 50}
-// gdb-command:print 'simple-tuple::NO_PADDING_16'
+// gdb-command:print 'simple_tuple::NO_PADDING_16'
 // gdb-check:$2 = {-1, 2, 3}
-// gdb-command:print 'simple-tuple::NO_PADDING_32'
+// gdb-command:print 'simple_tuple::NO_PADDING_32'
 // gdb-check:$3 = {4, 5, 6}
-// gdb-command:print 'simple-tuple::NO_PADDING_64'
+// gdb-command:print 'simple_tuple::NO_PADDING_64'
 // gdb-check:$4 = {7, 8, 9}
 
-// gdb-command:print 'simple-tuple::INTERNAL_PADDING_1'
+// gdb-command:print 'simple_tuple::INTERNAL_PADDING_1'
 // gdb-check:$5 = {10, 11}
-// gdb-command:print 'simple-tuple::INTERNAL_PADDING_2'
+// gdb-command:print 'simple_tuple::INTERNAL_PADDING_2'
 // gdb-check:$6 = {12, 13, 14, 15}
 
-// gdb-command:print 'simple-tuple::PADDING_AT_END'
+// gdb-command:print 'simple_tuple::PADDING_AT_END'
 // gdb-check:$7 = {16, 17}
 
 // gdb-command:run
 // gdb-command:print paddingAtEnd
 // gdb-check:$14 = {15, 16}
 
-// gdb-command:print/d 'simple-tuple::NO_PADDING_8'
+// gdb-command:print/d 'simple_tuple::NO_PADDING_8'
 // gdb-check:$15 = {-127, 127}
-// gdb-command:print 'simple-tuple::NO_PADDING_16'
+// gdb-command:print 'simple_tuple::NO_PADDING_16'
 // gdb-check:$16 = {-10, 10, 9}
-// gdb-command:print 'simple-tuple::NO_PADDING_32'
+// gdb-command:print 'simple_tuple::NO_PADDING_32'
 // gdb-check:$17 = {14, 15, 16}
-// gdb-command:print 'simple-tuple::NO_PADDING_64'
+// gdb-command:print 'simple_tuple::NO_PADDING_64'
 // gdb-check:$18 = {17, 18, 19}
 
-// gdb-command:print 'simple-tuple::INTERNAL_PADDING_1'
+// gdb-command:print 'simple_tuple::INTERNAL_PADDING_1'
 // gdb-check:$19 = {110, 111}
-// gdb-command:print 'simple-tuple::INTERNAL_PADDING_2'
+// gdb-command:print 'simple_tuple::INTERNAL_PADDING_2'
 // gdb-check:$20 = {112, 113, 114, 115}
 
-// gdb-command:print 'simple-tuple::PADDING_AT_END'
+// gdb-command:print 'simple_tuple::PADDING_AT_END'
 // gdb-check:$21 = {116, 117}
 
 
index 48db69289c073678a438bf6f6b8be4f69fe85397..59fe96f99580e9d1d44fc4cefef3356cb077a9d6 100644 (file)
 #![omit_gdb_pretty_printer_section]
 
 struct Struct {
-    x: int
+    x: isize
 }
 
 impl Struct {
 
-    fn static_method(arg1: int, arg2: int) -> int {
+    fn static_method(arg1: isize, arg2: isize) -> isize {
         zzz(); // #break
         arg1 + arg2
     }
 }
 
 enum Enum {
-    Variant1 { x: int },
+    Variant1 { x: isize },
     Variant2,
-    Variant3(f64, int, char),
+    Variant3(f64, isize, char),
 }
 
 impl Enum {
 
-    fn static_method(arg1: int, arg2: f64, arg3: uint) -> int {
+    fn static_method(arg1: isize, arg2: f64, arg3: usize) -> isize {
         zzz(); // #break
         arg1
     }
index b2971329cc8fb50bfbbb45e2ad661446d89c9b3f..b7956c221224e5d000867b821b84a2dd0c01f9e9 100644 (file)
@@ -66,7 +66,7 @@ enum Univariant {
 
 fn main() {
 
-    // In order to avoid endianess trouble all of the following test values consist of a single
+    // In order to avoid endianness trouble all of the following test values consist of a single
     // repeated byte. This way each interpretation of the union should look the same, no matter if
     // this is a big or little endian machine.
 
index d522e9f89105689892a21ddd2f1f0b2e2d2da951..43cb48d16bf4b8cb6e8e11f554b9ed43aa42263c 100644 (file)
@@ -68,7 +68,7 @@ enum Univariant {
 
 fn main() {
 
-    // In order to avoid endianess trouble all of the following test values consist of a single
+    // In order to avoid endianness trouble all of the following test values consist of a single
     // repeated byte. This way each interpretation of the union should look the same, no matter if
     // this is a big or little endian machine.
 
index 2ecafb02ae52d4e8ac4f1d1355e98d962f1162de..d066af53e35348c9dcff0fa2749ae970d9129781 100644 (file)
 #![omit_gdb_pretty_printer_section]
 
 struct Struct {
-    x: int
+    x: isize
 }
 
 trait Trait {
-    fn generic_static_default_method<T>(arg1: int, arg2: T) -> int {
+    fn generic_static_default_method<T>(arg1: isize, arg2: T) -> isize {
         zzz(); // #break
         arg1
     }
@@ -64,7 +64,7 @@ fn main() {
 
     // Is this really how to use these?
     Trait::generic_static_default_method::<Struct, float>(1000, 0.5);
-    Trait::generic_static_default_method::<Struct, &(int, int, int)>(2000, &(1, 2, 3));
+    Trait::generic_static_default_method::<Struct, &(isize, isize, isize)>(2000, &(1, 2, 3));
 
 }
 
index f74c9953f7d6cfc83c98908833d9c49f7d7396e6..3054f646b91009d28bf646be5df2a1efe2f73a19 100644 (file)
 #![omit_gdb_pretty_printer_section]
 
 trait Trait {
-    fn method(&self) -> int { 0 }
+    fn method(&self) -> isize { 0 }
 }
 
 struct Struct {
-    a: int,
+    a: isize,
     b: f64
 }
 
index 7c9760c3a5353c1205aa32ac5bc2b19e36c62886..6ed231726b163b2c382d24aabb5d90a6d8257d00 100644 (file)
@@ -68,7 +68,7 @@ enum Univariant {
 
 fn main() {
 
-    // In order to avoid endianess trouble all of the following test values consist of a single
+    // In order to avoid endianness trouble all of the following test values consist of a single
     // repeated byte. This way each interpretation of the union should look the same, no matter if
     // this is a big or little endian machine.
 
index d4cbd255e34c2861bcc35fee75c15dc6134a9038..e7ee9e2ccf8188ca431ba29c029955cc6fb81351 100644 (file)
 // gdb-check:type = struct Struct1
 
 // gdb-command:whatis generic_struct1
-// gdb-check:type = struct GenericStruct<type-names::Mod1::Struct2, type-names::Mod1::Mod2::Struct3>
+// gdb-check:type = struct GenericStruct<type_names::Mod1::Struct2, type_names::Mod1::Mod2::Struct3>
 
 // gdb-command:whatis generic_struct2
-// gdb-check:type = struct GenericStruct<type-names::Struct1, extern "fastcall" fn(isize) -> usize>
+// gdb-check:type = struct GenericStruct<type_names::Struct1, extern "fastcall" fn(isize) -> usize>
 
 // gdb-command:whatis mod_struct
 // gdb-check:type = struct Struct2
 // gdb-check:type = union Enum2
 
 // gdb-command:whatis generic_enum_1
-// gdb-check:type = union Enum3<type-names::Mod1::Struct2>
+// gdb-check:type = union Enum3<type_names::Mod1::Struct2>
 
 // gdb-command:whatis generic_enum_2
-// gdb-check:type = union Enum3<type-names::Struct1>
+// gdb-check:type = union Enum3<type_names::Struct1>
 
 
 // TUPLES
 // gdb-command:whatis tuple1
-// gdb-check:type = struct (u32, type-names::Struct1, type-names::Mod1::Mod2::Enum3<type-names::Mod1::Struct2>)
+// gdb-check:type = struct (u32, type_names::Struct1, type_names::Mod1::Mod2::Enum3<type_names::Mod1::Struct2>)
 
 // gdb-command:whatis tuple2
-// gdb-check:type = struct ((type-names::Struct1, type-names::Mod1::Mod2::Struct3), type-names::Mod1::Enum2, char)
+// gdb-check:type = struct ((type_names::Struct1, type_names::Mod1::Mod2::Struct3), type_names::Mod1::Enum2, char)
 
 
 // BOX
 // gdb-check:type = struct (Box<f32>, i32)
 
 // gdb-command:whatis box2
-// gdb-check:type = struct (Box<type-names::Mod1::Mod2::Enum3<f32>>, i32)
+// gdb-check:type = struct (Box<type_names::Mod1::Mod2::Enum3<f32>>, i32)
 
 
 // REFERENCES
 // gdb-command:whatis ref1
-// gdb-check:type = struct (&type-names::Struct1, i32)
+// gdb-check:type = struct (&type_names::Struct1, i32)
 
 // gdb-command:whatis ref2
-// gdb-check:type = struct (&type-names::GenericStruct<char, type-names::Struct1>, i32)
+// gdb-check:type = struct (&type_names::GenericStruct<char, type_names::Struct1>, i32)
 
 // gdb-command:whatis mut_ref1
-// gdb-check:type = struct (&mut type-names::Struct1, i32)
+// gdb-check:type = struct (&mut type_names::Struct1, i32)
 
 // gdb-command:whatis mut_ref2
-// gdb-check:type = struct (&mut type-names::GenericStruct<type-names::Mod1::Enum2, f64>, i32)
+// gdb-check:type = struct (&mut type_names::GenericStruct<type_names::Mod1::Enum2, f64>, i32)
 
 
 // RAW POINTERS
 // gdb-command:whatis mut_ptr1
-// gdb-check:type = struct (*mut type-names::Struct1, isize)
+// gdb-check:type = struct (*mut type_names::Struct1, isize)
 
 // gdb-command:whatis mut_ptr2
 // gdb-check:type = struct (*mut isize, isize)
 
 // gdb-command:whatis mut_ptr3
-// gdb-check:type = struct (*mut type-names::Mod1::Mod2::Enum3<type-names::Struct1>, isize)
+// gdb-check:type = struct (*mut type_names::Mod1::Mod2::Enum3<type_names::Struct1>, isize)
 
 // gdb-command:whatis const_ptr1
-// gdb-check:type = struct (*const type-names::Struct1, isize)
+// gdb-check:type = struct (*const type_names::Struct1, isize)
 
 // gdb-command:whatis const_ptr2
 // gdb-check:type = struct (*const isize, isize)
 
 // gdb-command:whatis const_ptr3
-// gdb-check:type = struct (*const type-names::Mod1::Mod2::Enum3<type-names::Struct1>, isize)
+// gdb-check:type = struct (*const type_names::Mod1::Mod2::Enum3<type_names::Struct1>, isize)
 
 
 // VECTORS
 // gdb-command:whatis fixed_size_vec1
-// gdb-check:type = struct ([type-names::Struct1; 3], i16)
+// gdb-check:type = struct ([type_names::Struct1; 3], i16)
 
 // gdb-command:whatis fixed_size_vec2
 // gdb-check:type = struct ([usize; 3], i16)
 // gdb-check:type = struct &[usize]
 
 // gdb-command:whatis slice2
-// gdb-check:type = struct &[type-names::Mod1::Enum2]
+// gdb-check:type = struct &[type_names::Mod1::Enum2]
 
 
 // TRAITS
 // gdb-check:type = struct &mut Trait1
 
 // gdb-command:whatis generic_box_trait
-// gdb-check:type = struct Box<Trait2<i32, type-names::Mod1::Struct2>>
+// gdb-check:type = struct Box<Trait2<i32, type_names::Mod1::Struct2>>
 
 // gdb-command:whatis generic_ref_trait
-// gdb-check:type = struct &Trait2<type-names::Struct1, type-names::Struct1>
+// gdb-check:type = struct &Trait2<type_names::Struct1, type_names::Struct1>
 
 // gdb-command:whatis generic_mut_ref_trait
-// gdb-check:type = struct &mut Trait2<type-names::Mod1::Mod2::Struct3, type-names::GenericStruct<usize, isize>>
+// gdb-check:type = struct &mut Trait2<type_names::Mod1::Mod2::Struct3, type_names::GenericStruct<usize, isize>>
 
 
 // BARE FUNCTIONS
 // gdb-command:whatis rust_fn
-// gdb-check:type = struct (fn(core::option::Option<isize>, core::option::Option<&type-names::Mod1::Struct2>), usize)
+// gdb-check:type = struct (fn(core::option::Option<isize>, core::option::Option<&type_names::Mod1::Struct2>), usize)
 
 // gdb-command:whatis extern_c_fn
 // gdb-check:type = struct (extern "C" fn(isize), usize)
 // gdb-check:type = struct (fn(f64) -> usize, usize)
 
 // gdb-command:whatis extern_c_fn_with_return_value
-// gdb-check:type = struct (extern "C" fn() -> type-names::Struct1, usize)
+// gdb-check:type = struct (extern "C" fn() -> type_names::Struct1, usize)
 
 // gdb-command:whatis unsafe_fn_with_return_value
-// gdb-check:type = struct (unsafe fn(type-names::GenericStruct<u16, u8>) -> type-names::Mod1::Struct2, usize)
+// gdb-check:type = struct (unsafe fn(type_names::GenericStruct<u16, u8>) -> type_names::Mod1::Struct2, usize)
 
 // gdb-command:whatis extern_stdcall_fn_with_return_value
 // gdb-check:type = struct (extern "stdcall" fn(Box<isize>) -> usize, usize)
 // gdb-check:type = struct (fn(isize) -> isize, usize)
 
 // gdb-command:whatis generic_function_struct3
-// gdb-check:type = struct (fn(type-names::Mod1::Mod2::Struct3) -> type-names::Mod1::Mod2::Struct3, usize)
+// gdb-check:type = struct (fn(type_names::Mod1::Mod2::Struct3) -> type_names::Mod1::Mod2::Struct3, usize)
 
 // gdb-command:whatis variadic_function
 // gdb-check:type = struct (unsafe extern "C" fn(*const u8, ...) -> isize, usize)
index 607a237d22e41ee1b4624cb0e1710b253e13864c..e450ead009bb25bac4502559a8ade395a24d8274 100644 (file)
@@ -59,7 +59,7 @@ enum Univariant {
 
 fn main() {
 
-    // In order to avoid endianess trouble all of the following test values consist of a single
+    // In order to avoid endianness trouble all of the following test values consist of a single
     // repeated byte. This way each interpretation of the union should look the same, no matter if
     // this is a big or little endian machine.
 
index 05872e3fc36b2fb8072e01ab07fe29b931041864..d576aff8b1c08319b3bdbb1d1712f38439155c4f 100644 (file)
@@ -82,9 +82,9 @@
 #![omit_gdb_pretty_printer_section]
 
 struct Struct {
-    a: int,
+    a: isize,
     b: f64,
-    c: uint
+    c: usize
 }
 
 fn main() {
index 295d57f4cfa97fc22acc1926bbba4b5bf40d20d4..2b27f938b308f7a1b937d8e224d4870e11af88c2 100644 (file)
@@ -44,9 +44,9 @@
 #![omit_gdb_pretty_printer_section]
 
 struct Struct {
-    a: int,
+    a: isize,
     b: f64,
-    c: uint
+    c: usize
 }
 
 fn main() {
@@ -80,7 +80,7 @@ fn main() {
     immedate_env();
 }
 
-fn do_something(_: &int, _:&int, _:&int) {
+fn do_something(_: &isize, _:&isize, _:&isize) {
 
 }
 
index 57dcac409bab8ad6cd39e22d5081dfccd84708cc..54ef42b48f1b1d8c070c9b6c367075480534f117 100644 (file)
@@ -74,9 +74,9 @@
 #![omit_gdb_pretty_printer_section]
 
 struct Struct {
-    a: int,
+    a: isize,
     b: f64,
-    c: uint
+    c: usize
 }
 
 fn main() {
index 3ceb3946f3c0d3289af1ef99549b1e9ea231bbdb..3759082db2caabb0ca7b55325c80ccf0d0533a87 100644 (file)
@@ -49,9 +49,9 @@
 // gdb-command:print padded_struct.data_ptr[1]
 // gdb-check:$13 = {x = 13, y = 14, z = 15}
 
-// gdb-command:print 'vec-slices::MUT_VECT_SLICE'.length
+// gdb-command:print 'vec_slices::MUT_VECT_SLICE'.length
 // gdb-check:$14 = 2
-// gdb-command:print *((int64_t[2]*)('vec-slices::MUT_VECT_SLICE'.data_ptr))
+// gdb-command:print *((int64_t[2]*)('vec_slices::MUT_VECT_SLICE'.data_ptr))
 // gdb-check:$15 = {64, 65}
 
 
index 9e5fe4ab8a986e8b8b3068afb7192677ee6a6ee4..f1f18115825caf6b7d8130870f8c423acb5a0ffb 100644 (file)
@@ -9,11 +9,6 @@
 // except according to those terms.
 
 
-extern crate
-    "foo"suffix //~ ERROR extern crate name with a suffix is illegal
-                //~^ WARNING: obsolete syntax
-     as foo;
-
 extern
     "C"suffix //~ ERROR ABI spec with a suffix is illegal
     fn foo() {}
diff --git a/src/test/parse-fail/issue-23620-invalid-escapes.rs b/src/test/parse-fail/issue-23620-invalid-escapes.rs
new file mode 100644 (file)
index 0000000..7930ea7
--- /dev/null
@@ -0,0 +1,45 @@
+// 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.
+
+fn main() {
+    let _ = b"\u{a66e}";
+    //~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
+
+    let _ = b'\u{a66e}';
+    //~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
+
+    let _ = b'\u';
+    //~^ ERROR unknown byte escape: u
+
+    let _ = b'\x5';
+    //~^ ERROR numeric character escape is too short
+
+    let _ = b'\xxy';
+    //~^ ERROR illegal character in numeric character escape: x
+    //~^^ ERROR illegal character in numeric character escape: y
+
+    let _ = '\x5';
+    //~^ ERROR numeric character escape is too short
+
+    let _ = '\xxy';
+    //~^ ERROR illegal character in numeric character escape: x
+    //~^^ ERROR illegal character in numeric character escape: y
+
+    let _ = b"\u{a4a4} \xf \u";
+    //~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
+    //~^^ ERROR illegal character in numeric character escape:
+    //~^^^ ERROR unknown byte escape: u
+
+    let _ = "\u{ffffff} \xf \u";
+    //~^ ERROR illegal unicode character escape
+    //~^^ ERROR illegal character in numeric character escape:
+    //~^^^ ERROR form of character escape may only be used with characters in the range [\x00-\x7f]
+    //~^^^^ ERROR unknown character escape: u
+}
index ffc2b11e0c13caba1ff7f9e639349528f706ff23..96b86f1f5635f96cc2243076085258cf455ffea3 100644 (file)
@@ -9,5 +9,8 @@
 // except according to those terms.
 
 pub fn main() {
-    let s = "\u{lol}"; //~ ERROR illegal character in unicode escape
+    let s = "\u{lol}";
+     //~^ ERROR illegal character in unicode escape: l
+     //~^^ ERROR illegal character in unicode escape: o
+     //~^^^ ERROR illegal character in unicode escape: l
 }
index 1774edd3f76e2bc88bf0e71796d79bded267cdd6..4d135801dab7430a4dc2e91b1791dcb004a28856 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // pp-exact
-fn f() -> [int; 3] {
+fn f() -> [isize; 3] {
     let picard = 0;
 
     let data = 1;
index c9cb72d8af7193875fc37752a37c76a21cac2a60..6e75e0851384895b52ceed34f7e1457107eb3c41 100644 (file)
 
 fn test1() { let val = &0; { } *val; }
 
-fn test2() -> int { let val = &0; { } *val }
+fn test2() -> isize { let val = &0; { } *val }
 
 #[derive(Copy)]
-struct S { eax: int }
+struct S { eax: isize }
 
 fn test3() {
     let regs = &Cell::new(S {eax: 0});
@@ -30,17 +30,17 @@ fn test3() {
 
 fn test4() -> bool { let regs = &true; if true { } *regs || false }
 
-fn test5() -> (int, int) { { } (0, 1) }
+fn test5() -> (isize, isize) { { } (0, 1) }
 
 fn test6() -> bool { { } (true || false) && true }
 
-fn test7() -> uint {
+fn test7() -> usize {
     let regs = &0;
     match true { true => { } _ => { } }
-    (*regs < 2) as uint
+    (*regs < 2) as usize
 }
 
-fn test8() -> int {
+fn test8() -> isize {
     let val = &0;
     match true {
         true => { }
@@ -58,10 +58,10 @@ fn test9() {
     match true { true => { } _ => { } } regs.set(regs.get() + 1);
 }
 
-fn test10() -> int {
+fn test10() -> isize {
     let regs = vec!(0);
     match true { true => { } _ => { } }
     regs[0]
 }
 
-fn test11() -> Vec<int> { if true { } vec!(1, 2) }
+fn test11() -> Vec<isize> { if true { } vec!(1, 2) }
index 33a80f469469ce8017b9c43f23f239cc108774e0..63568dbcd5b184cf757542494b6e641efe55892b 100644 (file)
@@ -17,10 +17,10 @@ fn call_it(f: Box<FnMut(String) -> String>) { }
 
 fn call_this<F>(f: F) where F: Fn(&str) + Send { }
 
-fn call_that<F>(f: F) where F: for<'a>Fn(&'a int, &'a int) -> int { }
+fn call_that<F>(f: F) where F: for<'a>Fn(&'a isize, &'a isize) -> isize { }
 
-fn call_extern(f: fn() -> int) { }
+fn call_extern(f: fn() -> isize) { }
 
-fn call_abid_extern(f: extern "C" fn() -> int) { }
+fn call_abid_extern(f: extern "C" fn() -> isize) { }
 
 pub fn main() { }
index 0c4cd103b82ef73547ebf7c1e32da23d101d18ef..610d9a7782d2a1f445e52a0c865c01c912456f8e 100644 (file)
@@ -14,7 +14,7 @@
 // preserved.  They are needed to disambiguate `{return n+1}; - 0` from
 // `({return n+1}-0)`.
 
-fn id<F>(f: F) -> int where F: Fn() -> int { f() }
+fn id<F>(f: F) -> isize where F: Fn() -> isize { f() }
 
-fn wsucc(_n: int) -> int { id(|| { 1 }) - 0 }
+fn wsucc(_n: isize) -> isize { id(|| { 1 }) - 0 }
 fn main() { }
index e0066053f3c5baf5b9d2f0ad2c347055a7b5db10..a85f85a395c61cf2813ddecdbbaa27beb6d0d37f 100644 (file)
@@ -10,6 +10,6 @@
 
 // pp-exact
 
-fn f<F>(f: F) where F: Fn(int) { f(10) }
+fn f<F>(f: F) where F: Fn(isize) { f(10) }
 
 fn main() { f(|i| { assert!(i == 10) }) }
index f5205de5c1fcd3ee32661b60d821915bbd10efb7..b30f2264355e650e3a8283f8edccbb1795b54ccc 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 trait X { fn dummy(&self) { } }
-impl X for uint { }
+impl X for usize { }
 
 trait Y { fn dummy(&self) { } }
-impl Y for uint { }
+impl Y for usize { }
index 6a9cbef1015424231d94b3a61ec1056e18ee6a93..3104941fb465a893d36e924c36c1d440e1957c81 100644 (file)
@@ -11,7 +11,7 @@
 // Issue #759
 // Whitespace under block opening should not expand forever
 
-fn a() -> uint {
+fn a() -> usize {
 
     1
 }
index 0f2a667e11cb212cff5bbe66c3e2c9a4feb5a4c6..43c41deaaea01ce87d757ac232858812708c784c 100644 (file)
@@ -10,7 +10,7 @@
 
 // pp-exact
 
-fn f(v: &[int]) -> int {
+fn f(v: &[isize]) -> isize {
     let mut n = 0;
     for e in v {
         n = *e; // This comment once triggered pretty printer bug
diff --git a/src/test/pretty/issue-929.rs b/src/test/pretty/issue-929.rs
deleted file mode 100644 (file)
index 75a6b91..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn f() { if (1 == panic!()) { } else { } }
-
-fn main() { }
index 42b2fe806e95f605bbd91febc4a4737d8fa117e4..06d57b261e6864c3e4e78ea7b2a9077574f14c59 100644 (file)
@@ -14,7 +14,7 @@
 trait Tr {
     fn dummy(&self) { }
 }
-impl Tr for int { }
+impl Tr for isize { }
 
 fn foo<'a>(x: Box<Tr+ Sync + 'a>) -> Box<Tr+ Sync + 'a> { x }
 
index 1cdf2e6de4607b8b52b19f562de1f1a4a5072eb1..dd7fbf32dd31e583725d9c7c5da75ee04b02c71d 100644 (file)
@@ -11,8 +11,8 @@
 // ignore-test
 // pp-exact
 struct Thing {
-    x: int,
-    y: int,
+    x: isize,
+    y: isize,
 }
 
 fn main() {
index acd534ccbfa2c8125cd51d5ca06b11976b106013..82d430b2701360bdffea047023e5ac4ad7f96bcf 100644 (file)
 
 // pp-exact
 struct Foo;
-struct Bar(int, int);
+struct Bar(isize, isize);
 
 fn main() {
     struct Foo2;
-    struct Bar2(int, int, int);
+    struct Bar2(isize, isize, isize);
     let _a = Bar(5, 5);
     let _b = Foo;
 }
index b96dbbf3cc964159bb4dfef44461921ad571bb09..95dfc751ff5a0cb6890eae320a0dbde3fa68d26d 100644 (file)
@@ -14,7 +14,7 @@ unsafe trait UnsafeTrait {
     fn foo(&self);
 }
 
-unsafe impl UnsafeTrait for int {
+unsafe impl UnsafeTrait for isize {
     fn foo(&self) { }
 }
 
index 1592e010aaff770537a7f36ee76eb80867ccb86a..2a9066accd5ad027c2c288161de9907bf0165e75 100644 (file)
 
 fn f() { }
 
-fn block_semi() -> int { { f() }; -1 }
+fn block_semi() -> isize { { f() }; -1 }
 
-fn block_nosemi() -> int { ({ 0 }) - 1 }
+fn block_nosemi() -> isize { ({ 0 }) - 1 }
 
-fn if_semi() -> int { if true { f() } else { f() }; -1 }
+fn if_semi() -> isize { if true { f() } else { f() }; -1 }
 
-fn if_nosemi() -> int { (if true { 0 } else { 0 }) - 1 }
+fn if_nosemi() -> isize { (if true { 0 } else { 0 }) - 1 }
 
-fn alt_semi() -> int { match true { true => { f() } _ => { } }; -1 }
+fn alt_semi() -> isize { match true { true => { f() } _ => { } }; -1 }
 
-fn alt_no_semi() -> int { (match true { true => { 0 } _ => { 1 } }) - 1 }
+fn alt_no_semi() -> isize { (match true { true => { 0 } _ => { 1 } }) - 1 }
 
 fn stmt() { { f() }; -1; }
index ad582ac1b62bedbd4f8fba29d4f1cb3773d4489e..cca7707509f0c7f335d3581aa99345e5403df8d7 100644 (file)
@@ -10,6 +10,6 @@
 
 // pp-exact
 
-fn f<'a, 'b, T>(t: T) -> int where T: 'a, 'a:'b, T: Eq { 0 }
+fn f<'a, 'b, T>(t: T) -> isize where T: 'a, 'a:'b, T: Eq { 0 }
 
 fn main() { }
index eab7475bc866899d9ca4f0d28ba157a2e7363485..47831f1af737bb47f465d936ec1b94d805bdb6c2 100644 (file)
@@ -14,6 +14,6 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn f(_a: int, _b: int, _c: Box<int>) { panic!("moop"); }
+fn f(_a: isize, _b: isize, _c: Box<isize>) { panic!("moop"); }
 
 fn main() { f(1, panic!("meep"), box 42); }
diff --git a/src/test/run-fail/binop-fail-3.rs b/src/test/run-fail/binop-fail-3.rs
new file mode 100644 (file)
index 0000000..8cabd3b
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2013 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.
+
+// error-pattern:quux
+fn foo() -> ! { panic!("quux"); }
+fn main() {
+    foo() == foo(); // these types wind up being defaulted to ()
+}
index c15c4b83828a34bff88dde7f2c43eea5a36535b8..4d502cb2106b116eaa6eb28e8cedfcfcd72449be 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:index out of bounds: the len is 3 but the index is
+// error-pattern:assertion failed: index < self.len()
 
 use std::usize;
 use std::mem::size_of;
index 6dd329b729500802a0efa0a67f73ae02bbe8c1fe..07fac8e39c4a12045da034efe9ad835525b0b099 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-test
 // error-pattern:index out of bounds
 
-use std::uint;
+use std::usize;
 
 fn main() {
     let x = vec!(1_usize,2_usize,3_usize);
@@ -21,7 +21,7 @@ fn main() {
     // length (in bytes), because the scaling of the index will cause it to
     // wrap around to a small number.
 
-    let idx = uint::MAX & !(uint::MAX >> 1_usize);
+    let idx = usize::MAX & !(usize::MAX >> 1_usize);
     println!("ov2 idx = 0x%x", idx);
 
     // This should panic.
index ec7fde171013324c3fb2c09fe13fb3de2359862f..b7aff8d1be1e2373e69d8e0d782d02f22091dc3d 100644 (file)
@@ -25,8 +25,8 @@ fn main() {
 
     let idx = u64::MAX & !(u64::MAX >> 1_usize);
     println!("ov3 idx = 0x%8.8x%8.8x",
-           (idx >> 32) as uint,
-           idx as uint);
+           (idx >> 32) as usize,
+           idx as usize);
 
     // This should panic.
     println!("ov3 0x%x",  x[idx]);
index e48d749d9451ec1996845548a862f9be11fe1dab..5e3da8476af3fe8f5c74f982c4e8b8f28e620755 100644 (file)
@@ -22,13 +22,13 @@ fn main() {
 
     let x = vec!(1_usize,2_usize,3_usize);
 
-    let base = x.as_ptr() as uint;
-    let idx = base / mem::size_of::<uint>();
+    let base = x.as_ptr() as usize;
+    let idx = base / mem::size_of::<usize>();
     println!("ov1 base = 0x{:x}", base);
     println!("ov1 idx = 0x{:x}", idx);
-    println!("ov1 sizeof::<uint>() = 0x{:x}", mem::size_of::<uint>());
-    println!("ov1 idx * sizeof::<uint>() = 0x{:x}",
-           idx * mem::size_of::<uint>());
+    println!("ov1 sizeof::<usize>() = 0x{:x}", mem::size_of::<usize>());
+    println!("ov1 idx * sizeof::<usize>() = 0x{:x}",
+           idx * mem::size_of::<usize>());
 
     // This should panic.
     println!("ov1 0x{:x}", x[idx]);
index 4ad81197286bb992734e8d8f24ae04fa74ad50c7..fc64d7c1ba356768fecfbb81462d409dbe188a48 100644 (file)
 
 use std::marker::PhantomData;
 
-fn test00_start(ch: chan_t<int>, message: int) { send(ch, message); }
+fn test00_start(ch: chan_t<isize>, message: isize) { send(ch, message); }
 
-type task_id = int;
-type port_id = int;
+type task_id = isize;
+type port_id = isize;
 
 struct chan_t<T> {
     task: task_id,
index f2253b7342eb8d4d8b42c1041f999f28e805c001..16aa4d48d911ff9f59c3ab065df1796ce8407902 100644 (file)
@@ -11,5 +11,5 @@
 // error-pattern:test
 
 fn main() {
-    let __isize: int = panic!("test");
+    let __isize: isize = panic!("test");
 }
index 987bee55c606d617d30a0070f197628f7e0a66e4..e9f493c16f1716d2a4d26d0d873ada4c895e731e 100644 (file)
@@ -12,6 +12,6 @@
 
 fn f() -> ! { panic!() }
 
-fn g() -> int { let x = if true { f() } else { 10 }; return x; }
+fn g() -> isize { let x = if true { f() } else { 10 }; return x; }
 
 fn main() { g(); }
index 069c1d5ed35574fdd6c54c06318d5b0bfa661b91..0269eb0af9c34347f4c819263eede16318f130c1 100644 (file)
@@ -12,6 +12,6 @@
 
 fn f() -> ! { panic!() }
 
-fn g() -> int { let x = match true { true => { f() } false => { 10 } }; return x; }
+fn g() -> isize { let x = match true { true => { f() } false => { 10 } }; return x; }
 
 fn main() { g(); }
index bddab59e3e4c52eeeb03c12cead341923b7a8090..f4a3adba76eddae0a6365ea147b702e23cfccd8f 100644 (file)
@@ -34,7 +34,7 @@ pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
     }
 }
 
-fn count(n: uint) -> uint {
+fn count(n: usize) -> usize {
     unsafe {
         task::deschedule();
         rustrt::rust_dbg_call(cb, n)
index e3af5b2bbf57bc5889728b2b3ac9caeb9f6361ef..8c4caccdb65978e079afece2869d1ee363020876 100644 (file)
@@ -9,13 +9,13 @@
 // except according to those terms.
 
 // error-pattern:Number is odd
-fn even(x: uint) -> bool {
+fn even(x: usize) -> bool {
     if x < 2 {
         return false;
     } else if x == 2 { return true; } else { return even(x - 2); }
 }
 
-fn foo(x: uint) {
+fn foo(x: usize) {
     if even(x) {
         println!("{}", x);
     } else {
index 49449be52af8f5a13981b8aabd13e24bc1850f04..7213d3ef7c5f054a69baee479895bc5c2416d88b 100644 (file)
@@ -12,7 +12,7 @@
 // error-pattern: task '<main>' has overflowed its stack
 
 struct R {
-    b: int,
+    b: isize,
 }
 
 impl Drop for R {
index 2b20540501ec043554dc9eea5d6ab98851eaca42..ce91af95d96b042bbde270876f02c22182a5b478 100644 (file)
@@ -14,7 +14,7 @@
 
 enum e<T> { ee(Arc<T>) }
 
-fn foo() -> e<int> {panic!();}
+fn foo() -> e<isize> {panic!();}
 
 fn main() {
    let _f = foo();
index e51e8d93eb0ca0771485b3eb7fffd33463f03c32..272d85d7b508bbf2e0fa3c6985a6f4a311493ac6 100644 (file)
@@ -12,7 +12,7 @@
 
 #![allow(unused_variables)]
 
-struct Point { x: int, y: int }
+struct Point { x: isize, y: isize }
 
 fn main() {
     let origin = Point {x: 0, y: 0};
index 2b1672ad4e53763e73e76fae51c8fc2e1e54ad9c..c1f90bb8f2b3c81d22fa78b4daa89bcfc20f6e20 100644 (file)
@@ -17,6 +17,6 @@ fn foo(s: String) { }
 
 fn main() {
     let i =
-        match Some::<int>(3) { None::<int> => { panic!() } Some::<int>(_) => { panic!() } };
+        match Some::<isize>(3) { None::<isize> => { panic!() } Some::<isize>(_) => { panic!() } };
     foo(i);
 }
index da08f53fcde56d24573b5afdc8a6922ddf108acf..90b729a6dd271ee1ea5d4890db711e0a7a9122f5 100644 (file)
@@ -10,5 +10,5 @@
 
 // error-pattern:quux
 fn f() -> ! { panic!("quux") }
-fn g() -> int { match f() { true => { 1 } false => { 0 } } }
+fn g() -> isize { match f() { true => { 1 } false => { 0 } } }
 fn main() { g(); }
index 5c1a9e1a5e7125bee72556f53f1ac9cd4932508c..54e24de31653106614e92b960b08d277e70f05e9 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // error-pattern:squirrelcupcake
-fn cmp() -> int {
+fn cmp() -> isize {
     match (Some('a'), None::<char>) {
         (Some(_), _) => { panic!("squirrelcupcake"); }
         (_, Some(_)) => { panic!(); }
index 4d4f931751067929c8c2afe8a9a2e52c44de1dac..0e029b6ecbc85a71068fcd89862c016ad6b00328 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 // error-pattern:woe
-fn f(a: int) { println!("{}", a); }
+fn f(a: isize) { println!("{}", a); }
 
 fn main() { f(panic!("woe")); }
index df14efd6c3a97a1ea46e0260c2f7f221f2d2348f..dbded1075442c10240261e204b4ffd238d6e6c1c 100644 (file)
@@ -13,5 +13,5 @@
 use std::result::Result::Err;
 
 fn main() {
-    println!("{}", Err::<int,String>("kitty".to_string()).unwrap());
+    println!("{}", Err::<isize,String>("kitty".to_string()).unwrap());
 }
index 2498b7c2be4e7fa00450643109175dfcf5a3521c..a71ce9ebab59ba0025e6b520455af41234e73217 100644 (file)
@@ -17,7 +17,7 @@
 use std::thread;
 
 struct r {
-  x:int,
+  x:isize,
 }
 
 // Setting the exit status after the runtime has already
@@ -29,7 +29,7 @@ fn drop(&mut self) {
     }
 }
 
-fn r(x:int) -> r {
+fn r(x:isize) -> r {
     r {
         x: x
     }
index 1c72686b60287ace08d2905f00c68075da791f68..6df279b047f64889133acf8045f95bee33e8a639 100644 (file)
 // error-pattern:fail
 
 
-fn build() -> Vec<int> {
+fn build() -> Vec<isize> {
     panic!();
 }
 
-struct Blk { node: Vec<int> }
+struct Blk { node: Vec<isize> }
 
 fn main() {
     let _blk = Blk {
index 943b4cd76715c35e3490e8624af652137a685a00..d5d60d18924d542e28a62c6ccbaf764174bf2190 100644 (file)
 // error-pattern:fail
 
 
-fn build1() -> Vec<int> {
+fn build1() -> Vec<isize> {
     vec!(0,0,0,0,0,0,0)
 }
 
-fn build2() -> Vec<int> {
+fn build2() -> Vec<isize> {
     panic!();
 }
 
-struct Blk { node: Vec<int> , span: Vec<int> }
+struct Blk { node: Vec<isize> , span: Vec<isize> }
 
 fn main() {
     let _blk = Blk {
index c378e852f897e2dbe7524acedfa590f9033c4ea4..da52cd56a1a080d39044defa6051864cf4e8cc3d 100644 (file)
@@ -12,8 +12,8 @@
 
 
 fn main() {
-    let v: Vec<int> = vec!(10);
-    let x: uint = 0;
+    let v: Vec<isize> = vec!(10);
+    let x: usize = 0;
     assert_eq!(v[x], 10);
     // Bounds-check panic.
 
index 6a7d0a1d73e8fe7170d65a7b2c4446d52432190b..cfe499f8a4aeb9a28c85bc0fd61de0167581be88 100644 (file)
@@ -11,4 +11,4 @@
 #![allow(while_true)]
 
 // error-pattern:quux
-fn main() { let _x: int = { while true { panic!("quux"); } ; 8 } ; }
+fn main() { let _x: isize = { while true { panic!("quux"); } ; 8 } ; }
index 2e1fad5a044f6a5998f16efafab1cf119d0eef32..b93bdbaa16f2abe5414dadb0bc2399b5acf2d5b9 100644 (file)
 
 use std::dynamic_lib::DynamicLibrary;
 use std::os;
-use std::old_path::Path;
+use std::path::Path;
 
 pub fn main() {
     unsafe {
         let path = Path::new("libdylib.so");
         let a = DynamicLibrary::open(Some(&path)).unwrap();
-        assert!(a.symbol::<int>("fun1").is_ok());
-        assert!(a.symbol::<int>("fun2").is_err());
-        assert!(a.symbol::<int>("fun3").is_err());
-        assert!(a.symbol::<int>("fun4").is_ok());
-        assert!(a.symbol::<int>("fun5").is_ok());
+        assert!(a.symbol::<isize>("fun1").is_ok());
+        assert!(a.symbol::<isize>("fun2").is_err());
+        assert!(a.symbol::<isize>("fun3").is_err());
+        assert!(a.symbol::<isize>("fun4").is_ok());
+        assert!(a.symbol::<isize>("fun5").is_ok());
     }
 }
index 39f71d309fdf9363d55bba93be259e0c8a51878a..f36b8d0abc7e3a293e7acf00790403c4066abcbd 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 pub fn pat_vec_7() {
     match [7, 77, 777, 7777] {
         [x, y, ..] => x + y
index 02c03445ef4e6d804773e8c3fa300dd40353f15e..f5be5a055c3e0c99c10bfa965d570accd4ab6093 100644 (file)
@@ -11,7 +11,7 @@
 #![feature(asm)]
 #![crate_type="lib"]
 
-pub fn exit(n: uint) {
+pub fn exit(n: usize) {
     unsafe {
         // Pretend this asm is an exit() syscall.
         asm!("" :: "r"(n) :: "volatile");
index aec76fdf1b2c0b164164c1facc5638013091165e..81ed446595ab0c6474c7c9802621bcb41f0e6f2c 100644 (file)
@@ -13,7 +13,7 @@
 
 use std::intrinsics;
 
-pub fn exit(n: uint) -> ! {
+pub fn exit(n: usize) -> ! {
     unsafe {
         // Pretend this asm is an exit() syscall.
         asm!("" :: "r"(n) :: "volatile");
index 3a2ced80ef41ed86657c865aa349a0efc6642394..6c39b33be086e279f5580e39998707473fc2dfa5 100644 (file)
@@ -23,8 +23,8 @@ fn inner() -> u32 {
 }
 
 fn main() {
-    outer::<int>();
-    outer::<uint>();
-    outer_foreign::<int>();
-    outer_foreign::<uint>();
+    outer::<isize>();
+    outer::<usize>();
+    outer_foreign::<isize>();
+    outer_foreign::<usize>();
 }
index ed04eed8cf77e602f57358e674da214027fcc84e..baabdc9ad7bbe792339f9e6ab1acbe56542c76b8 100644 (file)
@@ -11,6 +11,6 @@
 #![crate_name = "foo"]
 #![crate_type = "rlib"]
 
-static FOO: uint = 3;
+static FOO: usize = 3;
 
-pub fn foo() -> &'static uint { &FOO }
+pub fn foo() -> &'static usize { &FOO }
index 7696c27ad71fcf53f3eac8aeaf677722fdcf268d..c44335e2bbc2abbe07dc370dcf18ee81fd6bf79f 100644 (file)
@@ -11,4 +11,4 @@
 #![crate_type = "rlib"]
 #![crate_type = "dylib"]
 
-pub static foo: int = 4;
+pub static foo: isize = 4;
index d60cc05cc9f9cbeca66d87eb58550a75ac635c56..78af525f386fac6244ffc5b15e58771f5ef89ba5 100644 (file)
@@ -13,4 +13,4 @@
 
 use std::mem;
 
-pub fn addr() -> uint { unsafe { mem::transmute(&both::foo) } }
+pub fn addr() -> usize { unsafe { mem::transmute(&both::foo) } }
index 8006987e9f349152d125f7aa4e651ce3ec74f659..c3d88016fdaa3a95130e0118903634e0b8b2492a 100644 (file)
@@ -14,6 +14,6 @@
 use std::mem;
 
 fn main() {
-    assert_eq!(unsafe { mem::transmute::<&int, uint>(&both::foo) },
+    assert_eq!(unsafe { mem::transmute::<&isize, usize>(&both::foo) },
                dylib::addr());
 }
diff --git a/src/test/run-make/output-with-hyphens/Makefile b/src/test/run-make/output-with-hyphens/Makefile
new file mode 100644 (file)
index 0000000..783d826
--- /dev/null
@@ -0,0 +1,6 @@
+-include ../tools.mk
+
+all:
+       $(RUSTC) foo-bar.rs
+       [ -f $(TMPDIR)/$(call BIN,foo-bar) ]
+       [ -f $(TMPDIR)/libfoo_bar.rlib ]
diff --git a/src/test/run-make/output-with-hyphens/foo-bar.rs b/src/test/run-make/output-with-hyphens/foo-bar.rs
new file mode 100644 (file)
index 0000000..2f93b2d
--- /dev/null
@@ -0,0 +1,14 @@
+// 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.
+
+#![crate_type = "lib"]
+#![crate_type = "bin"]
+
+fn main() {}
index b6137c3eba91bd9e701258ef210feb1bc67fbdf6..04bf17dc28aecaf630680fc82ff145c46fd91ad7 100644 (file)
@@ -15,8 +15,8 @@
 extern crate serialize;
 
 #[derive(Encodable)] pub struct A;
-#[derive(Encodable)] pub struct B(int);
-#[derive(Encodable)] pub struct C { x: int }
+#[derive(Encodable)] pub struct B(isize);
+#[derive(Encodable)] pub struct C { x: isize }
 #[derive(Encodable)] pub enum D {}
 #[derive(Encodable)] pub enum E { y }
-#[derive(Encodable)] pub enum F { z(int) }
+#[derive(Encodable)] pub enum F { z(isize) }
index acf3f90cb0e1f0dac2a798202f07f37ea1b41046..4879fbfe6d34346172d9c0d75a1111829a9cfeaf 100644 (file)
@@ -12,5 +12,5 @@
 
 
 
-fn foo_method(&self) -> &'static str { return "i am very similiar to foo."; }
+fn foo_method(&self) -> &'static str { return "i am very similar to foo."; }
 /* nest::S::foo_method */
index 4942540126b11fee3e4fae0c72c3a38042cf5703..8ea86a94f935e97d30742469f60e772b37229482 100644 (file)
@@ -22,7 +22,7 @@ pub fn foo() -> &'static str { "i am a foo." }
     struct S;
     impl S {
         fn foo_method(&self) -> &'static str {
-            return "i am very similiar to foo.";
+            return "i am very similar to foo.";
         }
     }
 }
index f6b73021bebdfb0ffc70941642062208c65a8a9b..494eb03d728034d0facb9689d0173dd1ec4ff70a 100644 (file)
@@ -29,8 +29,8 @@ pub fn baz() { }
     pub trait Doge { fn dummy(&self) { } }
 
     // @has foo/bar/struct.Foo.html
-    pub struct Foo { x: int, y: uint }
+    pub struct Foo { x: isize, y: usize }
 
     // @has foo/bar/fn.prawns.html
-    pub fn prawns((a, b): (int, uint), Foo { x, y }: Foo) { }
+    pub fn prawns((a, b): (isize, usize), Foo { x, y }: Foo) { }
 }
index 74251c3c63e91d25af64d30506c69824cd3d3936..5310ed25d3b1bd8be509683cb5b171bb37d8c95b 100644 (file)
@@ -15,7 +15,7 @@
 extern crate graphviz;
 // A simple rust project
 
-extern crate "flate" as myflate;
+extern crate flate as myflate;
 
 use std::collections::{HashMap,HashSet};
 use std::cell::RefCell;
@@ -53,9 +53,9 @@ fn foo(x: &Float) {}
     let y = x.1;
 }
 
-struct TupStruct(int, int, Box<str>);
+struct TupStruct(isize, isize, Box<str>);
 
-fn test_tup_struct(x: TupStruct) -> int {
+fn test_tup_struct(x: TupStruct) -> isize {
     x.1
 }
 
index a7cd85db4a2d116cec2883a41b954428bf50e5fd..62bc3294286902d7b4de458fcbe2ccdaa7281fc4 100644 (file)
@@ -11,6 +11,6 @@
 #![crate_type = "rlib"]
 
 #[inline]
-pub fn cci_fn() -> uint {
+pub fn cci_fn() -> usize {
     1234
 }
index b0642b64cdaac8983e7287d3f9b6ecd465d5d495..e00cab20f6b34a16a290c40402f07f2be41b9d88 100644 (file)
@@ -9,21 +9,21 @@
 // except according to those terms.
 
 extern crate cci_lib;
-use cci_lib::{cci_fn};
+use cci_lib::cci_fn;
 
-fn call1() -> uint {
+fn call1() -> usize {
     cci_fn()
 }
 
 mod a {
     use cci_lib::cci_fn;
-    pub fn call2() -> uint {
+    pub fn call2() -> usize {
         cci_fn()
     }
 }
 
 mod b {
-    pub fn call3() -> uint {
+    pub fn call3() -> usize {
         0
     }
 }
index fe6a7b5a18f27c0115f4ebaa7d5c69fd21a0af97..bfa2162e27dd211eb05a9b779c83ae5b10889df6 100644 (file)
@@ -8,18 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn magic_fn() -> uint {
+fn magic_fn() -> usize {
     1234
 }
 
 mod a {
-    pub fn magic_fn() -> uint {
+    pub fn magic_fn() -> usize {
         2345
     }
 }
 
 mod b {
-    pub fn magic_fn() -> uint {
+    pub fn magic_fn() -> usize {
         3456
     }
 }
index 474a6782b616b3af1ea845be56b948c662cda0b6..8ba705bfb61115837f74dada2f483ab335896c5e 100644 (file)
@@ -12,9 +12,9 @@
 pub static Y: &'static [u8] = include_bytes!("lib.rs");
 
 trait Foo { fn dummy(&self) { } }
-impl Foo for uint {}
+impl Foo for usize {}
 
 pub fn dummy() {
     // force the vtable to be created
-    let _x = &1u as &Foo;
+    let _x = &1us as &Foo;
 }
index acda8705b19e30e22ad6b2cb662f9e74bb59d34c..b13c41be5597174a012a4fbeaecfc965cff22626 100644 (file)
@@ -22,7 +22,7 @@ trait Copy : PhantomFn<Self> { }
 trait Sized : PhantomFn<Self>  { }
 
 #[lang="start"]
-fn start(_main: *const u8, _argc: int, _argv: *const *const u8) -> int { 0 }
+fn start(_main: *const u8, _argc: isize, _argv: *const *const u8) -> isize { 0 }
 
 extern {
     fn _foo() -> [u8; 16];
index bdd557b6cc27b4e604fb172875287d672104cbee..217dee4b881c7a92ac13ea61cc97c9c26b6d8908 100644 (file)
@@ -14,7 +14,7 @@
 
 pub fn main() {
     unsafe {
-        let mut i : int = 1;
+        let mut i : isize = 1;
         volatile_store(&mut i, 2);
         assert_eq!(volatile_load(&i), 2);
     }
index 2172ed888b1423c69ce20b32f0e8fff483660596..8b69c68279dca0a1f36a95e88562041036395ea0 100644 (file)
@@ -12,4 +12,4 @@ all:
                | grep "invalid character.*in crate name:"
        cp foo.rs $(TMPDIR)/-foo.rs
        $(RUSTC) $(TMPDIR)/-foo.rs 2>&1 \
-               | grep "soon cannot contain hyphens:"
+               | grep 'crate names cannot start with a `-`'
index cd79a95dace7afcef69ac94f66e180f2218617d6..1541e809b6178d24a77c953d764e784c1dfcf023 100644 (file)
@@ -16,7 +16,7 @@
 // Regression test for issue #13560, the test itself is all in the dependent
 // libraries. The fail which previously failed to compile is the one numbered 3.
 
-extern crate "issue-13560-2" as t2;
-extern crate "issue-13560-3" as t3;
+extern crate issue_13560_2 as t2;
+extern crate issue_13560_3 as t3;
 
 fn main() {}
index 6306627df0f8d05c27d82c5e87ec321c90e57bdc..172d3e31d45e8c73a4e3e80b5042357f61c26135 100644 (file)
 
 // aux-build:issue-16822.rs
 
-extern crate "issue-16822" as lib;
+extern crate issue_16822 as lib;
 
 use std::cell::RefCell;
 
 struct App {
-    i: int
+    i: isize
 }
 
 impl lib::Update for App {
index 91b24b3b2abac4dc39736842bd4a287d9aa840c3..8367fc110e137c734ddaa5ada7d75fe59614d719 100644 (file)
@@ -10,7 +10,7 @@
 
 // aux-build:issue-18502.rs
 
-extern crate "issue-18502" as fmt;
+extern crate issue_18502 as fmt;
 
 fn main() {
     ::fmt::baz();
index d4dc5627044dbd1be9dcff522e07581e4da45225..e1ef32b64d7152c4f8baecfd545cb393ae46a94f 100644 (file)
 fn syntax_extension(cx: &ExtCtxt) {
     let _toks_1 = vec![quote_tokens!(cx, /** comment */ fn foo() {})];
     let name = quote_tokens!(cx, bar);
-    let _toks_2 = vec![quote_item!(cx, static $name:int = 2;)];
+    let _toks_2 = vec![quote_item!(cx, static $name:isize = 2;)];
     let _toks_4 = quote_tokens!(cx, $name:static $name:sizeof);
     let _toks_3 = vec![quote_item!(cx,
         /// comment
-        fn foo() { let $name:int = 3; }
+        fn foo() { let $name:isize = 3; }
     )];
 }
 
index 92cb0d71e4570fe6f422f4549b6da83ff07d64b3..7e11b9d9f278956289aca857a8ba66e4e0a7adbb 100644 (file)
@@ -60,11 +60,11 @@ fn main() {
     check_pp(ext_cx, abc,  pprust::print_expr, "23".to_string());
 
 
-    let ty = quote_ty!(cx, int);
-    check_pp(ext_cx, ty, pprust::print_type, "int".to_string());
+    let ty = quote_ty!(cx, isize);
+    check_pp(ext_cx, ty, pprust::print_type, "isize".to_string());
 
-    let item = quote_item!(cx, static x : int = 10;).get();
-    check_pp(ext_cx, item, pprust::print_item, "static x: int = 10;".to_string());
+    let item = quote_item!(cx, static x : isize = 10;).get();
+    check_pp(ext_cx, item, pprust::print_item, "static x: isize = 10;".to_string());
 
     let stmt = quote_stmt!(cx, let x = 20;);
     check_pp(ext_cx, *stmt, pprust::print_stmt, "let x = 20;".to_string());
index 0e2e1f2dd86d6f1fe7b37f4327c7e14beefbb776..f6ae71f8b6f31533b40225112bcd3864f27fedfa 100644 (file)
@@ -23,7 +23,7 @@ fn syntax_extension(cx: &ExtCtxt) {
     let p_toks : Vec<syntax::ast::TokenTree> = quote_tokens!(cx, (x, 1 .. 4, *));
 
     let a: P<syntax::ast::Expr> = quote_expr!(cx, 1 + 2);
-    let _b: Option<P<syntax::ast::Item>> = quote_item!(cx, static foo : int = $e_toks; );
+    let _b: Option<P<syntax::ast::Item>> = quote_item!(cx, static foo : isize = $e_toks; );
     let _c: P<syntax::ast::Pat> = quote_pat!(cx, (x, 1 .. 4, *) );
     let _d: Option<P<syntax::ast::Stmt>> = quote_stmt!(cx, let x = $a; );
     let _d: syntax::ast::Arm = quote_arm!(cx, (ref x, ref y) = (x, y) );
@@ -36,7 +36,7 @@ fn syntax_extension(cx: &ExtCtxt) {
     let i: Option<P<syntax::ast::Item>> = quote_item!(cx, #[derive(Eq)] struct Foo; );
     assert!(i.is_some());
 
-    let _l: P<syntax::ast::Ty> = quote_ty!(cx, &int);
+    let _l: P<syntax::ast::Ty> = quote_ty!(cx, &isize);
 
     let _m: Vec<syntax::ast::TokenTree> = quote_matcher!(cx, $($foo:tt,)* bar);
     let _n: syntax::ast::Attribute = quote_attr!(cx, #![cfg(foo, bar = "baz")]);
index 2cb5f77fdc3f3b0e7385a08478c60d6d2def0862..59b593b1ab3f604d0d0ca08fd36fabd6de7ce21b 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-static mut DROP_RAN: int = 0;
+static mut DROP_RAN: isize = 0;
 
 struct Foo;
 impl Drop for Foo {
index f6ff0415259af06782de1001a72693bb095f9c70..77b9efb0012f067e199362325da3575ceeeefbaf 100644 (file)
@@ -16,7 +16,7 @@
 
 enum sty { ty_nil, }
 
-struct RawT {struct_: sty, cname: Option<String>, hash: uint}
+struct RawT {struct_: sty, cname: Option<String>, hash: usize}
 
 fn mk_raw_ty(st: sty, cname: Option<String>) -> RawT {
     return RawT {struct_: st, cname: cname, hash: 0};
index cd649310ae78406f12d0748f01693cf2e56e87d3..23a1e7998012c9394892667edffb5e6b9c4a38d6 100644 (file)
@@ -17,4 +17,4 @@ struct R<T> {v: Vec<option<T>> }
 
 fn f<T>() -> Vec<T> { return Vec::new(); }
 
-pub fn main() { let mut r: R<int> = R {v: Vec::new()}; r.v = f(); }
+pub fn main() { let mut r: R<isize> = R {v: Vec::new()}; r.v = f(); }
index 98975c7f021c3ffaefdfc31d1b364dd20136090b..5889bfce3c4783e72f0e9c09a00e77f8bc1caa5b 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 struct Foo {
-    x: int
+    x: isize
 }
 
 impl Foo {
index 2428d45256d518b4a0561e8ff7f55b619aab61b1..7101cfb55796714a85405eccdf67b5c90aeffebd 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct X {
-    x: int
+    x: isize
 }
 
-fn f1(a: &mut X, b: &mut int, c: int) -> int {
+fn f1(a: &mut X, b: &mut isize, c: isize) -> isize {
     let r = a.x + *b + c;
     a.x = 0;
     *b = 10;
     return r;
 }
 
-fn f2<F>(a: int, f: F) -> int where F: FnOnce(int) { f(1); return a; }
+fn f2<F>(a: isize, f: F) -> isize where F: FnOnce(isize) { f(1); return a; }
 
 pub fn main() {
     let mut a = X {x: 1};
index 24c63e5affc0dc36bcffd4398162900ac6d56792..a4365efbbbd0ebd3ea9409f8524379cebbe49f30 100644 (file)
@@ -11,7 +11,7 @@
 
 
 pub fn main() {
-    let a: int = 10;
+    let a: isize = 10;
     println!("{}", a);
     assert_eq!(a * (a - 1), 90);
 }
index 1e043d77fa811cea1c02646b926560293e920e99..fd281ea1173cfb9530f354cd70f72143eef3e43d 100644 (file)
@@ -11,7 +11,7 @@
 
 
 pub fn main() {
-    let i32_a: int = 10;
+    let i32_a: isize = 10;
     assert_eq!(i32_a, 10);
     assert_eq!(i32_a - 10, 0);
     assert_eq!(i32_a / 10, 1);
@@ -22,8 +22,8 @@ pub fn main() {
     assert_eq!(i32_a * i32_a * i32_a, 1000);
     assert_eq!(i32_a * i32_a * i32_a * i32_a, 10000);
     assert_eq!(i32_a * i32_a / i32_a * i32_a, 100);
-    assert_eq!(i32_a * (i32_a - 1) << (2 + i32_a as uint), 368640);
-    let i32_b: int = 0x10101010;
+    assert_eq!(i32_a * (i32_a - 1) << (2 + i32_a as usize), 368640);
+    let i32_b: isize = 0x10101010;
     assert_eq!(i32_b + 1 - 1, i32_b);
     assert_eq!(i32_b << 1, i32_b << 1);
     assert_eq!(i32_b >> 1, i32_b >> 1);
index 08412d1296cfc071b7440203b2ef50a2c6695d18..0f4523c6818849e5c40fb2dcf186e00fa872de30 100644 (file)
@@ -13,7 +13,7 @@
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    let i32_c: int = 0x10101010;
+    let i32_c: isize = 0x10101010;
     assert!(i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3) ==
                  i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3));
 }
index 422816079d62c6ac4eb6e540c87cdcc67902b930..3348a6754ee82886e24126e47e6ae2803c6c77d5 100644 (file)
@@ -10,6 +10,6 @@
 
 // pretty-expanded FIXME #23616
 
-fn f() -> int { { return 3; } }
+fn f() -> isize { { return 3; } }
 
 pub fn main() { assert!((f() == 3)); }
index ec89e2b3ee288437e5fb780a967e583a0785c5a6..8e38128975bb954e5601a5a15d8d3a914d468092 100644 (file)
@@ -11,9 +11,9 @@
 // pretty-expanded FIXME #23616
 
 fn main() {
-    assert_eq!(3 as uint * 3, 9);
-    assert_eq!(3 as (uint) * 3, 9);
-    assert_eq!(3 as (uint) / 3, 1);
-    assert_eq!(3 as uint + 3, 6);
-    assert_eq!(3 as (uint) + 3, 6);
+    assert_eq!(3 as usize * 3, 9);
+    assert_eq!(3 as (usize) * 3, 9);
+    assert_eq!(3 as (usize) / 3, 1);
+    assert_eq!(3 as usize + 3, 6);
+    assert_eq!(3 as (usize) + 3, 6);
 }
index 6aeadbe203e182f20414f4e8ed37b8401fb53b75..32924bcf74451d718f6ddfe7f76e6dc0dc816529 100644 (file)
@@ -36,8 +36,8 @@ pub fn main() {
         assert_eq!(2147483648, next_power_of_2(2147483647));
     }
 
-    let mut y: int = 5;
-    let x: int;
+    let mut y: isize = 5;
+    let x: isize;
     unsafe {
         // Treat the output as initialization.
         asm!(
index 7b1548a8d4f6118a7bddd93c08bb0ee59c43c67f..3cb7f6400daf468297b3336b9cd1387bf300e474 100644 (file)
@@ -14,7 +14,7 @@
 
 #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
 pub fn main() {
-    let x: int;
+    let x: isize;
     unsafe {
         // Treat the output as initialization.
         asm!("mov $1, $0" : "=r"(x) : "r"(5_usize));
index c52e04322e911b24ce1e881e0a119c3f3d968243..9662e1ff33d11238c4a3f6fde6ab312889a278c3 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #[derive(PartialEq, Debug)]
-struct Point { x : int }
+struct Point { x : isize }
 
 pub fn main() {
     assert_eq!(14,14);
index 5d93388f7f4fee8fd639ec1a1f41a24ca48a1166..110f4720ceb6841a1854d639c5eedd413cd8f7b2 100644 (file)
@@ -12,7 +12,7 @@
 // pretty-expanded FIXME #23616
 
 fn test_assign() {
-    let mut x: int;
+    let mut x: isize;
     let y: () = x = 10;
     assert_eq!(x, 10);
     assert_eq!(y, ());
@@ -25,7 +25,7 @@ fn test_assign() {
 }
 
 fn test_assign_op() {
-    let mut x: int = 0;
+    let mut x: isize = 0;
     let y: () = x += 10;
     assert_eq!(x, 10);
     assert_eq!(y, ());
index 4b22f84f78d12800b42f6b90eb639559772e3ff7..473f744a3ff61a56bc310256abbe27814ae1f07c 100644 (file)
@@ -32,7 +32,7 @@ fn iterate<F>(&self, f: F) -> bool where F: FnMut(&A) -> bool {
     }
 }
 
-fn length<A, T: iterable<A>>(x: T) -> uint {
+fn length<A, T: iterable<A>>(x: T) -> usize {
     let mut len = 0;
     x.iterate(|_y| {
         len += 1;
@@ -42,17 +42,17 @@ fn length<A, T: iterable<A>>(x: T) -> uint {
 }
 
 pub fn main() {
-    let x: Vec<int> = vec!(0,1,2,3);
+    let x: Vec<isize> = vec!(0,1,2,3);
     // Call a method
-    x.iterate(|y| { assert!(x[*y as uint] == *y); true });
+    x.iterate(|y| { assert!(x[*y as usize] == *y); true });
     // Call a parameterized function
     assert_eq!(length(x.clone()), x.len());
     // Call a parameterized function, with type arguments that require
     // a borrow
-    assert_eq!(length::<int, &[int]>(&*x), x.len());
+    assert_eq!(length::<isize, &[isize]>(&*x), x.len());
 
     // Now try it with a type that *needs* to be borrowed
     let z = [0,1,2,3];
     // Call a parameterized function
-    assert_eq!(length::<int, &[int]>(&z), z.len());
+    assert_eq!(length::<isize, &[isize]>(&z), z.len());
 }
index 853b56ffb0c2ea34a0fd916058c363e912f754b6..d4ed2ee2d6e55835b78bd611c669e11481afb052 100644 (file)
@@ -19,11 +19,11 @@ trait Foo : MarkerTrait {
 }
 
 impl Foo for i32 {
-    type T = int;
+    type T = isize;
 }
 
 fn main() {
     let x: <i32 as Foo>::T = 22;
-    let y: int = 44;
+    let y: isize = 44;
     assert_eq!(x * 2, y);
 }
index 87eeb23b7a3f37e0fcee111068af0dea7440072e..82ebac7e5dc7e0e8d78199431be713f14ce0a2b0 100644 (file)
@@ -20,9 +20,9 @@ pub trait Foo {
 #[derive(PartialEq)]
 pub struct Bar;
 
-impl Foo for int {
-    type A = uint;
-    fn boo(&self) -> uint { 42 }
+impl Foo for isize {
+    type A = usize;
+    fn boo(&self) -> usize { 42 }
 }
 
 impl Foo for char {
@@ -34,7 +34,7 @@ fn foo_bar<I: Foo<A=Bar>>(x: I) -> Bar {
     x.boo()
 }
 
-fn foo_uint<I: Foo<A=uint>>(x: I) -> uint {
+fn foo_uint<I: Foo<A=usize>>(x: I) -> usize {
     x.boo()
 }
 
index 948192f4fc0754180bbe8215a3d2098041af29c0..b2be87be4cb35397bf57e14443af8120f70537c4 100644 (file)
@@ -13,7 +13,7 @@
 // Test that we are able to reference cross-crate traits that employ
 // associated types.
 
-extern crate "associated-types-cc-lib" as bar;
+extern crate associated_types_cc_lib as bar;
 
 use bar::Bar;
 
index b53e69e8d9d16603b9956db33d65fd0b5de92aa5..5729fab475b7868c0d0949ace21b4a63184f87c0 100644 (file)
@@ -15,23 +15,23 @@ trait SignedUnsigned {
     fn convert(self) -> Self::Opposite;
 }
 
-impl SignedUnsigned for int {
-    type Opposite = uint;
+impl SignedUnsigned for isize {
+    type Opposite = usize;
 
-    fn convert(self) -> uint {
-        self as uint
+    fn convert(self) -> usize {
+        self as usize
     }
 }
 
-impl SignedUnsigned for uint {
-    type Opposite = int;
+impl SignedUnsigned for usize {
+    type Opposite = isize;
 
-    fn convert(self) -> int {
-        self as int
+    fn convert(self) -> isize {
+        self as isize
     }
 }
 
-fn get(x: int) -> <int as SignedUnsigned>::Opposite {
+fn get(x: isize) -> <isize as SignedUnsigned>::Opposite {
     x.convert()
 }
 
index 7354ae67addc4d32aee8441cf7d4c0321fbd71e3..5dc289194ff3b8d64bcfa9489cf1b603b8d8bfc7 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn pairwise_sub(mut t: Box<DoubleEndedIterator<Item=int>>) -> int {
+fn pairwise_sub(mut t: Box<DoubleEndedIterator<Item=isize>>) -> isize {
     let mut result = 0;
     loop {
         let front = t.next();
index 5bf10ae132cc52308ec622f91074c84f9575b970..2a1b9bdd2faf64b0eb9363d63df5293c57bd5684 100644 (file)
@@ -19,12 +19,12 @@ fn grab(&self) -> &<Self as Get>::Value {
 }
 
 struct Struct {
-    x: int,
+    x: isize,
 }
 
 impl Get for Struct {
-    type Value = int;
-    fn get(&self) -> &int {
+    type Value = isize;
+    fn get(&self) -> &isize {
         &self.x
     }
 }
index 4d286a4f9a48753c1597b07ac0ff017cad7f3047..40b10fbfcaca66b56d073cd2cb220c3c9b9e6dfc 100644 (file)
@@ -16,12 +16,12 @@ trait Get {
 }
 
 struct Struct {
-    x: int,
+    x: isize,
 }
 
 impl Get for Struct {
-    type Value = int;
-    fn get(&self) -> &int {
+    type Value = isize;
+    fn get(&self) -> &isize {
         &self.x
     }
 }
index 41c53a5ad641090a8b23755715fe0854ff55163c..99a9b7c23febdc2f53d3ecdb277fa9a9d66a0f8d 100644 (file)
@@ -16,12 +16,12 @@ trait Get {
 }
 
 struct Struct {
-    x: int,
+    x: isize,
 }
 
 impl Get for Struct {
-    type Value = int;
-    fn get(&self) -> &int {
+    type Value = isize;
+    fn get(&self) -> &isize {
         &self.x
     }
 }
index 7b8b041e7ef679ac5a85cff57662d94c22c66682..0012d9d75963271e4a082976d571ce4abc50a6bf 100644 (file)
@@ -16,12 +16,12 @@ trait Get {
 }
 
 struct Struct {
-    x: int,
+    x: isize,
 }
 
 impl Get for Struct {
-    type Value = int;
-    fn get(&self) -> &int {
+    type Value = isize;
+    fn get(&self) -> &isize {
         &self.x
     }
 }
index 562deba4d9301c8b759b058d714c71ab251b250b..a601dc0739a467715a400448c1fd4945a0f9c7bd 100644 (file)
@@ -17,6 +17,6 @@
 
 use std::marker::MarkerTrait;
 
-impl X for f64 { type Y = int; }
+impl X for f64 { type Y = isize; }
 trait X : MarkerTrait { type Y; }
 fn main() {}
index 56e39a4450221084291cae3356577ade8e0740e8..24c5a3e9a8375040c5a90287ca002f549be0d715 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn pairwise_sub<T:DoubleEndedIterator<Item=int>>(mut t: T) -> int {
+fn pairwise_sub<T:DoubleEndedIterator<Item=isize>>(mut t: T) -> isize {
     let mut result = 0;
     loop {
         let front = t.next();
index 24dae20b3e77e976a4b3d67b25e7753802afc901..e150d0158243711184ce23d73b9d635fe1f54ca4 100644 (file)
@@ -20,8 +20,8 @@ trait Not {
 }
 
 trait Int: Not<Result=Self> + Sized {
-    fn count_ones(self) -> uint;
-    fn count_zeros(self) -> uint {
+    fn count_ones(self) -> usize;
+    fn count_zeros(self) -> usize {
         // neither works
         let x: Self = self.not();
         0
index 30b3871522cb2317557e1d26a1d09aac0723bf7c..945340008d876bae616261027958d13147872c99 100644 (file)
@@ -18,8 +18,8 @@ pub trait Foo {
     fn dummy(&self) { }
 }
 
-impl Foo for int {
-    type Bar = int;
+impl Foo for isize {
+    type Bar = isize;
 }
 
 struct Thing<F: Foo> {
index 1ce4d6e341de2e581f85a688fc98fce20792378d..824291ea60782db5c02b50be052b49aff79f8077 100644 (file)
@@ -16,7 +16,7 @@ trait Get<T> {
 
 trait Trait<'a> {
     type T: 'static;
-    type U: Get<&'a int>;
+    type U: Get<&'a isize>;
 
     fn dummy(&'a self) { }
 }
index 87043b833fd8f177aaf910d97bdfe3c8f7b0351f..f190e81d8a6ad440d2e6a59d7d939af2db0723d1 100644 (file)
@@ -20,14 +20,14 @@ pub trait Foo {
 #[derive(PartialEq)]
 pub struct Bar;
 
-impl Foo for int {
-    type A = uint;
-    fn boo(&self) -> uint { 42 }
+impl Foo for isize {
+    type A = usize;
+    fn boo(&self) -> usize { 42 }
 }
 
 impl Foo for Bar {
-    type A = int;
-    fn boo(&self) -> int { 43 }
+    type A = isize;
+    fn boo(&self) -> isize { 43 }
 }
 
 impl Foo for char {
index 4c9deab45112606dfd8c0959dabe8b8c39f04699..5a2761365bf301c868320f271502c8a225226c73 100644 (file)
@@ -16,12 +16,12 @@ trait Get {
 }
 
 struct Struct {
-    x: int,
+    x: isize,
 }
 
 impl Get for Struct {
-    type Value = int;
-    fn get(&self) -> &int {
+    type Value = isize;
+    fn get(&self) -> &isize {
         &self.x
     }
 }
index f8eff2f22fe3c0cb31be3c19a697850dfedec16f..353b49b49cedfc7d0cb22a2274f922bcb11b0754 100644 (file)
@@ -17,9 +17,9 @@ pub trait Foo {
     fn boo(&self) -> Self::A;
 }
 
-impl Foo for int {
-    type A = uint;
-    fn boo(&self) -> uint {
+impl Foo for isize {
+    type A = usize;
+    fn boo(&self) -> usize {
         5
     }
 }
@@ -43,5 +43,5 @@ fn f() {
 }
 
 pub fn main() {
-    let z: uint = bar(2, 4);
+    let z: usize = bar(2, 4);
 }
index f135762d28327910ee7fb25cc304696f303853cd..af8e4b7d4a1a7e713cb627402697a5eba74f34fe 100644 (file)
@@ -26,5 +26,5 @@ fn drop(&mut self) { }
 }
 
 pub fn main() {
-    assert_eq!(size_of::<int>(), size_of::<Test<int>>());
+    assert_eq!(size_of::<isize>(), size_of::<Test<isize>>());
 }
index 08dce42c05b3ec757f7791519467cc02e1e46d32..bfafe04d6006c07eae7082f05f949c810faa7e93 100644 (file)
@@ -13,6 +13,6 @@
 #![feature(start)]
 
 #[start]
-fn start(_argc: int, _argv: *const *const u8) -> int {
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
     return 0;
 }
index 2b84adcb15ccbdaa111627fd12ff6bc304393776..2df0bb355979b1e92cd5a5f793512105cbcbd1c5 100644 (file)
@@ -43,7 +43,7 @@ fn test_rbml<'a, 'b, A:
 
 #[derive(Decodable, Encodable)]
 enum Expr {
-    Val(uint),
+    Val(usize),
     Plus(@Expr, @Expr),
     Minus(@Expr, @Expr)
 }
@@ -103,23 +103,23 @@ fn ne(&self, other: &Quark<T>) -> bool { !(*self).eq(other) }
 
 impl cmp::Eq for CLike {
     fn eq(&self, other: &CLike) -> bool {
-        (*self) as int == *other as int
+        (*self) as isize == *other as isize
     }
     fn ne(&self, other: &CLike) -> bool { !self.eq(other) }
 }
 
 #[derive(Decodable, Encodable, Eq)]
 struct Spanned<T> {
-    lo: uint,
-    hi: uint,
+    lo: usize,
+    hi: usize,
     node: T,
 }
 
 #[derive(Decodable, Encodable)]
-struct SomeStruct { v: Vec<uint> }
+struct SomeStruct { v: Vec<usize> }
 
 #[derive(Decodable, Encodable)]
-struct Point {x: uint, y: uint}
+struct Point {x: usize, y: usize}
 
 #[derive(Decodable, Encodable)]
 enum Quark<T> {
index cd4c66cb3218a65a3bb8acb89499b9fd9899dce7..4a1bfa3eb42668e5f2f30a33ab632d16cd5047c5 100644 (file)
@@ -10,7 +10,7 @@
 
 #[derive(Debug)]
 struct Pair<T, U> { a: T, b: U }
-struct Triple { x: int, y: int, z: int }
+struct Triple { x: isize, y: isize, z: isize }
 
 fn f<T,U>(x: T, y: U) -> Pair<T, U> { return Pair {a: x, b: y}; }
 
index ee3738518cd771f1f261277401b1cfb3659048e5..77ec0e1791f96e24a49e1486cc01415aba90b95b 100644 (file)
@@ -13,7 +13,7 @@ trait Foo {
 }
 
 struct Bar {
-    x: int
+    x: isize
 }
 
 trait Baz {
index 6dc679054275fbe47206761b2f861be9611466e5..0ad2303a7697bb67470cb5d66c3967257aff8e58 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 struct Foo {
-    x: int,
+    x: isize,
 }
 
 trait Stuff {
index cf3b7d41b3a65e71a0ef76950ac350eeddd89eb1..7d30b549ebea45076a61fa54f3bda3e29c27ebbc 100644 (file)
@@ -13,7 +13,7 @@
 
 fn f<T>(x: Vec<T>) -> T { return x.into_iter().next().unwrap(); }
 
-fn g<F>(act: F) -> int where F: FnOnce(Vec<int>) -> int { return act(vec!(1, 2, 3)); }
+fn g<F>(act: F) -> isize where F: FnOnce(Vec<isize>) -> isize { return act(vec!(1, 2, 3)); }
 
 pub fn main() {
     assert_eq!(g(f), 1);
index 6d7e150093e2cd9e7ca4d5dd0bf3d900bbfff54b..a4c6cdd544c87fea2ac627a772f31f4139fae2af 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 struct Foo {
-    x: int,
+    x: isize,
 }
 
 impl Foo {
index 0bec3af4273afad2819f79523f6bba194425dae8..d7eee85f50273b360ab2f05ae7b99bf542564ce3 100644 (file)
 #![feature(box_syntax)]
 
 trait double {
-    fn double(self: Box<Self>) -> uint;
+    fn double(self: Box<Self>) -> usize;
 }
 
-impl double for uint {
-    fn double(self: Box<uint>) -> uint { *self * 2 }
+impl double for usize {
+    fn double(self: Box<usize>) -> usize { *self * 2 }
 }
 
 pub fn main() {
-    let x: Box<_> = box() (box 3u as Box<double>);
+    let x: Box<_> = box() (box 3us as Box<double>);
     assert_eq!(x.double(), 6);
 }
index bab0403e79dc1079d2bb1340d85ba5bd9aa59fdb..6c52035b708de72fbe82628e8088e03ad46a4a56 100644 (file)
 #![feature(box_syntax)]
 
 trait double {
-    fn double(self) -> uint;
+    fn double(self) -> usize;
 }
 
-impl double for uint {
-    fn double(self) -> uint { self }
+impl double for usize {
+    fn double(self) -> usize { self }
 }
 
-impl double for Box<uint> {
-    fn double(self) -> uint { *self * 2 }
+impl double for Box<usize> {
+    fn double(self) -> usize { *self * 2 }
 }
 
 pub fn main() {
index e9f70346089a528e4aa93ecc950b77b8d32bacb1..809ab0a3521dd50209683d898a9c7d5f55a54e1b 100644 (file)
 #![feature(box_syntax)]
 
 trait double {
-    fn double(self: Box<Self>) -> uint;
+    fn double(self: Box<Self>) -> usize;
 }
 
-impl double for Box<uint> {
-    fn double(self: Box<Box<uint>>) -> uint { **self * 2 }
+impl double for Box<usize> {
+    fn double(self: Box<Box<usize>>) -> usize { **self * 2 }
 }
 
 pub fn main() {
index 7558733adf1d2f42dc6651608e463f06a4d26684..9c7828c893895602f108af6185fa1ec2d18da67c 100644 (file)
 #![feature(box_syntax)]
 
 trait double {
-    fn double(self: Box<Self>) -> uint;
+    fn double(self: Box<Self>) -> usize;
 }
 
-impl double for uint {
-    fn double(self: Box<uint>) -> uint { *self * 2 }
+impl double for usize {
+    fn double(self: Box<usize>) -> usize { *self * 2 }
 }
 
 pub fn main() {
index 1754a3707681598b8a4f1299ab1617e52d3f2d1c..e63dd07eb07523f49e02dcfff9cfd27615d9f10b 100644 (file)
 #![feature(box_syntax)]
 
 trait double {
-    fn double(self: Box<Self>) -> uint;
+    fn double(self: Box<Self>) -> usize;
 }
 
-impl double for uint {
-    fn double(self: Box<uint>) -> uint { *self * 2 }
+impl double for usize {
+    fn double(self: Box<usize>) -> usize { *self * 2 }
 }
 
 pub fn main() {
index 37ba355956c309e08d289fa42c90408bdfdf36a2..0f935776fc554b01513f8f6cde4be1e92c4a4d71 100644 (file)
@@ -24,7 +24,7 @@ fn foo(&self) -> String {
     }
 }
 
-impl Foo for uint {
+impl Foo for usize {
     fn foo(&self) -> String {
         format!("{}", *self)
     }
index c7b770d0a2b639f031ae2d4618bbec61a4496de2..e61ff61a2162284e251bc04f276640339a6247a2 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    struct Foo { x: int, y: int }
+    struct Foo { x: isize, y: isize }
     let mut f = Foo { x: 10, y: 0 };
     match f {
         Foo { ref mut x, .. } => *x = 11,
diff --git a/src/test/run-pass/binops-issue-22743.rs b/src/test/run-pass/binops-issue-22743.rs
new file mode 100644 (file)
index 0000000..01c8502
--- /dev/null
@@ -0,0 +1,32 @@
+// 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::ops::Mul;
+
+#[derive(Copy)]
+pub struct Foo {
+    x: f64,
+}
+
+impl Mul<Foo> for f64 {
+    type Output = Foo;
+
+    fn mul(self, rhs: Foo) -> Foo {
+        // intentionally do something that is not *
+        Foo { x: self + rhs.x }
+    }
+}
+
+pub fn main() {
+    let f: Foo = Foo { x: 5.0 };
+    let val: f64 = 3.0;
+    let f2: Foo = val * f;
+    assert_eq!(f2.x, 8.0);
+}
index b36eb4bf2f62e493caea483f280b0344d69cab3a..2b8fcd303b66ed7dbf843d0ef370f7dcd9a3e43f 100644 (file)
@@ -61,11 +61,11 @@ fn test_ptr() {
 
 #[derive(PartialEq, Debug)]
 struct p {
-  x: int,
-  y: int,
+  x: isize,
+  y: isize,
 }
 
-fn p(x: int, y: int) -> p {
+fn p(x: isize, y: isize) -> p {
     p {
         x: x,
         y: y
@@ -78,8 +78,8 @@ fn test_class() {
 
   unsafe {
   println!("q = {:x}, r = {:x}",
-         (::std::mem::transmute::<*const p, uint>(&q)),
-         (::std::mem::transmute::<*const p, uint>(&r)));
+         (::std::mem::transmute::<*const p, usize>(&q)),
+         (::std::mem::transmute::<*const p, usize>(&r)));
   }
   assert_eq!(q, r);
   r.y = 17;
index 8418681b6b1903a112a77e71ccd4632723d65f2c..d6117a04e35df1633294de60210581dc96881d85 100644 (file)
 
 #[cfg(any(target_arch = "x86", target_arch = "arm"))]
 fn target() {
-    assert_eq!(-1000 as uint >> 3_usize, 536870787_usize);
+    assert_eq!(-1000 as usize >> 3_usize, 536870787_usize);
 }
 
 #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
 fn target() {
-    assert_eq!(-1000 as uint >> 3_usize, 2305843009213693827_usize);
+    assert_eq!(-1000 as usize >> 3_usize, 2305843009213693827_usize);
 }
 
 fn general() {
-    let mut a: int = 1;
-    let mut b: int = 2;
+    let mut a: isize = 1;
+    let mut b: isize = 2;
     a ^= b;
     b ^= a;
     a = a ^ b;
index b1d6f96f0f6d45d5de8fb9fd4073a22423cf6872..3b6614c18faa8cf2855bdca36e8f85a38d1f5a3c 100644 (file)
@@ -21,14 +21,14 @@ pub fn g<T>(_: T, _: (), _: ()) { }
 const BAR: () = ();
 struct Data;
 use m::f;
-extern crate "blind-item-mixed-crate-use-item-foo" as foo;
+extern crate blind_item_mixed_crate_use_item_foo as foo;
 
 fn main() {
     const BAR2: () = ();
     struct Data2;
     use m::g;
 
-    extern crate "blind-item-mixed-crate-use-item-foo2" as foo2;
+    extern crate blind_item_mixed_crate_use_item_foo2 as foo2;
 
     f(Data, BAR, foo::X);
     g(Data2, BAR2, foo2::Y);
index a745e52efeb17a3ef32238cc4fe28403052fdba2..5944438e20d9a40ce7577e374c131a438dfb1a87 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn asBlock<F>(f: F) -> uint where F: FnOnce() -> uint {
+fn asBlock<F>(f: F) -> usize where F: FnOnce() -> usize {
    return f();
 }
 
index 059f4e3749407b0e650887fb08fb6ff88c9f5864..0addd33c1e4a3f5fd365c6d4f4f4584c23d1a463 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn force<F>(f: F) -> int where F: FnOnce() -> int { return f(); }
+fn force<F>(f: F) -> isize where F: FnOnce() -> isize { return f(); }
 
 pub fn main() {
-    fn f() -> int { return 7; }
+    fn f() -> isize { return 7; }
     assert_eq!(force(f), 7);
     let g = {||force(f)};
     assert_eq!(g(), 7);
index bcaf94953d61282e5bc1cf3fc47b78dd896ce8b0..7efda12192a78e6a5f6415de5e347cdf3fb1b9f2 100644 (file)
@@ -15,7 +15,7 @@ trait Foo {
     fn foo(self);
 }
 
-impl<'a> Foo for &'a [int] {
+impl<'a> Foo for &'a [isize] {
     fn foo(self) {}
 }
 
index 381afd94e3b64ab163f82b61d481c6a929046a99..7cf61bd569dfb9b48d496c6c9487d3bc71669051 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct Foo(int, int);
+struct Foo(isize, isize);
 
 fn main() {
     let x = (1, 2);
index f30a50e37d81d8d4ed48d9b1bda2d12b2524827b..ee74a0544084e68d0221796e1c780c305c02e5c6 100644 (file)
 
 pub fn main() {
     struct A {
-        a: int,
+        a: isize,
         w: B,
     }
     struct B {
-        a: int
+        a: isize
     }
     let mut p = A {
         a: 1,
index a0ad3cc6ca1af8e86886cd0daa2ece177501a3fd..10e9a1b51e2d1f8a6a79144de873483305cfca8a 100644 (file)
@@ -11,9 +11,9 @@
 
 // pretty-expanded FIXME #23616
 
-struct F { f: Vec<int> }
+struct F { f: Vec<isize> }
 
-fn impure(_v: &[int]) {
+fn impure(_v: &[isize]) {
 }
 
 pub fn main() {
index ff61036d2c3d68019cb304ddbe5980fe0fefcb69..24c7285b1fb6fa960ffe5da9c7c2a182a688146f 100644 (file)
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn borrow<F>(x: &int, f: F) where F: FnOnce(&int) {
+fn borrow<F>(x: &isize, f: F) where F: FnOnce(&isize) {
     f(x)
 }
 
-fn test1(x: &Box<int>) {
+fn test1(x: &Box<isize>) {
     borrow(&*(*x).clone(), |p| {
-        let x_a = &**x as *const int;
-        assert!((x_a as uint) != (p as *const int as uint));
+        let x_a = &**x as *const isize;
+        assert!((x_a as usize) != (p as *const isize as usize));
         assert_eq!(unsafe{*x_a}, *p);
     })
 }
index eb61c747aea267397e9ba875bb34e72f6b983cfa..b716a1a27a1955fe6786741df62bf4aafc07d86e 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn foo<'a>(mut t0: &'a mut int,
-           mut t1: &'a mut int) {
-    let p: &int = &*t0; // Freezes `*t0`
+fn foo<'a>(mut t0: &'a mut isize,
+           mut t1: &'a mut isize) {
+    let p: &isize = &*t0; // Freezes `*t0`
     let mut t2 = &t0;
-    let q: &int = &**t2; // Freezes `*t0`, but that's ok...
-    let r: &int = &*t0; // ...after all, could do same thing directly.
+    let q: &isize = &**t2; // Freezes `*t0`, but that's ok...
+    let r: &isize = &*t0; // ...after all, could do same thing directly.
 }
 
 pub fn main() {
index 10e4ad3eb974beb2d663f5623b1f9bc599f7097b..d97564a29144fed9851cbd4ff33a40b2e741ca85 100644 (file)
@@ -13,8 +13,8 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct A { a: int, b: Box<int> }
-struct B { a: Box<int>, b: Box<int> }
+struct A { a: isize, b: Box<isize> }
+struct B { a: Box<isize>, b: Box<isize> }
 
 fn move_after_copy() {
     let x = A { a: 1, b: box 2 };
index 8e8e012fdbf49d4849890769bbad8232e0438226..eaa78553d85c50b272b64f7e6b9707578d0fbbd5 100644 (file)
@@ -16,7 +16,7 @@ struct MutSlice<'a, T:'a> {
     data: &'a mut [T]
 }
 
-fn get<'a, T>(ms: &'a MutSlice<'a, T>, index: uint) -> &'a T {
+fn get<'a, T>(ms: &'a MutSlice<'a, T>, index: usize) -> &'a T {
     &ms.data[index]
 }
 
index b0cf5d81aa9655646da50ffc906fea8d6555d7ba..f1f0274c5cc4891d1d77cd6cc4e7317783d19132 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn borrow(_v: &int) {}
+fn borrow(_v: &isize) {}
 
-fn borrow_from_arg_imm_ref(v: Box<int>) {
+fn borrow_from_arg_imm_ref(v: Box<isize>) {
     borrow(&*v);
 }
 
-fn borrow_from_arg_mut_ref(v: &mut Box<int>) {
+fn borrow_from_arg_mut_ref(v: &mut Box<isize>) {
     borrow(&**v);
 }
 
-fn borrow_from_arg_copy(v: Box<int>) {
+fn borrow_from_arg_copy(v: Box<isize>) {
     borrow(&*v);
 }
 
index 1170c5be9b5ce06cb43867f3e463652ead1d2be9..b40504f37d4d93f2e50706727b89abc2aebd5ddc 100644 (file)
 #![feature(box_syntax)]
 
 struct Foo {
-  a: int
+  a: isize
 }
 
 pub enum Bar {
-  Bar1, Bar2(int, Box<Bar>),
+  Bar1, Bar2(isize, Box<Bar>),
 }
 
 impl Foo {
@@ -38,7 +38,7 @@ macro_rules! declare {
     }
   }
 
-  fn check_id(&mut self, s: int) { panic!() }
+  fn check_id(&mut self, s: isize) { panic!() }
 }
 
 pub fn main() { }
index 0ea18a6abe480b39a1ce55a636fa70a3f939cde0..7c03c6a9a489cf0c0c2dc6f8a5af3da478f44fb7 100644 (file)
@@ -16,6 +16,6 @@
 
 pub fn main() {
     let bar: Box<_> = box 3;
-    let h = || -> int { *bar };
+    let h = || -> isize { *bar };
     assert_eq!(h(), 3);
 }
index d35600ef22efd5d327bda94cf5dbc1407cd05baa..f535c5fcfc90463164adf28afbbc819dad149d9d 100644 (file)
@@ -14,9 +14,9 @@
 use std::mem::swap;
 
 #[derive(Debug)]
-struct Ints {sum: Box<int>, values: Vec<int> }
+struct Ints {sum: Box<isize>, values: Vec<isize> }
 
-fn add_int(x: &mut Ints, v: int) {
+fn add_int(x: &mut Ints, v: isize) {
     *x.sum += v;
     let mut values = Vec::new();
     swap(&mut values, &mut x.values);
@@ -24,7 +24,7 @@ fn add_int(x: &mut Ints, v: int) {
     swap(&mut values, &mut x.values);
 }
 
-fn iter_ints<F>(x: &Ints, mut f: F) -> bool where F: FnMut(&int) -> bool {
+fn iter_ints<F>(x: &Ints, mut f: F) -> bool where F: FnMut(&isize) -> bool {
     let l = x.values.len();
     (0..l).all(|i| f(&x.values[i]))
 }
@@ -35,7 +35,7 @@ pub fn main() {
     add_int(&mut *ints, 44);
 
     iter_ints(&*ints, |i| {
-        println!("int = {:?}", *i);
+        println!("isize = {:?}", *i);
         true
     });
 
index 313dab18a31cc81f2ed34eaeb3f3d0d3c2a520be..4d37bcb5a489652a7091d23d942fb7d8ddca792b 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn want_slice(v: &[int]) -> int {
+fn want_slice(v: &[isize]) -> isize {
     let mut sum = 0;
     for i in v { sum += *i; }
     sum
 }
 
-fn has_mut_vec(v: Vec<int> ) -> int {
+fn has_mut_vec(v: Vec<isize> ) -> isize {
     want_slice(&v)
 }
 
index 315f6c80d4e11cb36277ee10166394c68abaedcf..fa50eaa6a88c1d914dadaf48466a72e744765ff3 100644 (file)
 
 // Test that (safe) nested calls with `&mut` receivers are permitted.
 
-struct Foo {a: uint, b: uint}
+struct Foo {a: usize, b: usize}
 
 impl Foo {
-    pub fn inc_a(&mut self, v: uint) { self.a += v; }
+    pub fn inc_a(&mut self, v: usize) { self.a += v; }
 
-    pub fn next_b(&mut self) -> uint {
+    pub fn next_b(&mut self) -> usize {
         let b = self.b;
         self.b += 1;
         b
index 74ce8ef2e453162e18315081926b65adc525b25b..b29cb63f6fa3b3f42cf638570183aca77612f740 100644 (file)
@@ -10,7 +10,7 @@
 
 // ignore-pretty
 
-fn match_ref(v: Option<int>) -> int {
+fn match_ref(v: Option<isize>) -> isize {
     match v {
       Some(ref i) => {
         *i
@@ -19,24 +19,24 @@ fn match_ref(v: Option<int>) -> int {
     }
 }
 
-fn match_ref_unused(v: Option<int>) {
+fn match_ref_unused(v: Option<isize>) {
     match v {
       Some(_) => {}
       None => {}
     }
 }
 
-fn impure(_i: int) {
+fn impure(_i: isize) {
 }
 
-fn match_imm_reg(v: &Option<int>) {
+fn match_imm_reg(v: &Option<isize>) {
     match *v {
       Some(ref i) => {impure(*i)} // OK because immutable
       None => {}
     }
 }
 
-fn match_mut_reg(v: &mut Option<int>) {
+fn match_mut_reg(v: &mut Option<isize>) {
     match *v {
       Some(ref i) => {impure(*i)} // OK, frozen
       None => {}
index e7ff379b433a604621e8b0c286de754db003f4f6..1b20f6c706162a81f447011e475d736ee98b6b2f 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct Counter {
-    value: uint
+    value: usize
 }
 
 impl Counter {
-    fn new(v: uint) -> Counter {
+    fn new(v: usize) -> Counter {
         Counter {value: v}
     }
 
@@ -24,11 +24,11 @@ fn inc<'a>(&'a mut self) -> &'a mut Counter {
         self
     }
 
-    fn get(&self) -> uint {
+    fn get(&self) -> usize {
         self.value
     }
 
-    fn get_and_inc(&mut self) -> uint {
+    fn get_and_inc(&mut self) -> usize {
         let v = self.value;
         self.value += 1;
         v
index 488c014eac776269f1d132314b4c2ec5ffa84406..36a84a62d48fbebc251f83645bd2af75cd8affdb 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct Box {
-    x: uint
+    x: usize
 }
 
 impl Box {
-    fn get(&self) -> &uint {
+    fn get(&self) -> &usize {
         &self.x
     }
-    fn set(&mut self, x: uint) {
+    fn set(&mut self, x: usize) {
         self.x = x;
     }
 }
index c7199fccff6d6e8468e31883598520cead2f342a..0ec87599c6391eabef316244cfcdc8bbe77a6812 100644 (file)
@@ -12,7 +12,7 @@
 // pretty-expanded FIXME #23616
 
 struct Rec {
-    f: Box<int>,
+    f: Box<isize>,
 }
 
 struct Outer {
@@ -24,12 +24,12 @@ struct Inner {
 }
 
 struct Innermost {
-    h: Box<int>,
+    h: Box<isize>,
 }
 
-fn borrow(_v: &int) {}
+fn borrow(_v: &isize) {}
 
-fn box_mut(v: &mut Box<int>) {
+fn box_mut(v: &mut Box<isize>) {
     borrow(&**v); // OK: &mut -> &imm
 }
 
@@ -41,7 +41,7 @@ fn box_mut_recs(v: &mut Outer) {
     borrow(&*v.f.g.h); // OK: &mut -> &imm
 }
 
-fn box_imm(v: &Box<int>) {
+fn box_imm(v: &Box<isize>) {
     borrow(&**v); // OK
 }
 
index 0ce2709c02d6a9f6a52cb7e10b390de553ef3b8a..84efe1903671f587285a84f790ebd1a425c378b8 100644 (file)
@@ -15,7 +15,7 @@
 
 #[derive(Copy)]
 enum newtype {
-    newvar(int)
+    newvar(isize)
 }
 
 pub fn main() {
index b646c741e7d3c377f7f70091acd4554d9db3a519..7ad81b6be6ef54f44a6a44eb7831753ff4fb3ccf 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct A { a: int, b: Box<int> }
+struct A { a: isize, b: Box<isize> }
 
 fn field_copy_after_field_borrow() {
     let mut x = A { a: 1, b: box 2 };
index eaad5944e6801cec17d8205248f2c881f48fbaf0..c8cc29b9bdacb3b623d9b8b71674742044cd8164 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo<'r>(s: &'r uint) -> bool {
+fn foo<'r>(s: &'r usize) -> bool {
     match s {
         &3 => true,
         _ => false
index 9588663aa18b9c12b0ea1e6f269184bd7042c0a7..14b6c32a11e51a360d0c6d85339c0eab71b5ed03 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn select<'r>(x: &'r Option<int>, y: &'r Option<int>) -> &'r Option<int> {
+fn select<'r>(x: &'r Option<isize>, y: &'r Option<isize>) -> &'r Option<isize> {
     match (x, y) {
         (&None, &None) => x,
         (&Some(_), _) => x,
diff --git a/src/test/run-pass/box-of-array-of-drop-1.rs b/src/test/run-pass/box-of-array-of-drop-1.rs
new file mode 100644 (file)
index 0000000..a93a488
--- /dev/null
@@ -0,0 +1,52 @@
+// 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 that we cleanup a fixed size Box<[D; k]> properly when D has a
+// destructor.
+
+use std::thread;
+use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+
+static LOG: AtomicUsize = ATOMIC_USIZE_INIT;
+
+struct D(u8);
+
+impl Drop for D {
+    fn drop(&mut self) {
+        println!("Dropping {}", self.0);
+        let old = LOG.load(Ordering::SeqCst);
+        LOG.compare_and_swap(old, old << 4 | self.0 as usize, Ordering::SeqCst);
+    }
+}
+
+fn main() {
+    fn die() -> D { panic!("Oh no"); }
+    let g = thread::spawn(|| {
+        let _b1: Box<[D; 4]> = Box::new([D( 1), D( 2), D( 3), D( 4)]);
+        let _b2: Box<[D; 4]> = Box::new([D( 5), D( 6), D( 7), D( 8)]);
+        let _b3: Box<[D; 4]> = Box::new([D( 9), D(10), die(), D(12)]);
+        let _b4: Box<[D; 4]> = Box::new([D(13), D(14), D(15), D(16)]);
+    });
+    assert!(g.join().is_err());
+
+    // When the panic occurs, we will be in the midst of constructing
+    // the input to `_b3`.  Therefore, we drop the elements of the
+    // partially filled array first, before we get around to dropping
+    // the elements of `_b1` and _b2`.
+
+    // Issue 23222: The order in which the elements actually get
+    // dropped is a little funky. See similar notes in nested-vec-3;
+    // in essence, I would not be surprised if we change the ordering
+    // given in `expect` in the future.
+
+    let expect = 0x__A_9__5_6_7_8__1_2_3_4;
+    let actual = LOG.load(Ordering::SeqCst);
+    assert!(actual == expect, "expect: 0x{:x} actual: 0x{:x}", expect, actual);
+}
diff --git a/src/test/run-pass/box-of-array-of-drop-2.rs b/src/test/run-pass/box-of-array-of-drop-2.rs
new file mode 100644 (file)
index 0000000..7155713
--- /dev/null
@@ -0,0 +1,52 @@
+// 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 that we cleanup dynamic sized Box<[D]> properly when D has a
+// destructor.
+
+use std::thread;
+use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+
+static LOG: AtomicUsize = ATOMIC_USIZE_INIT;
+
+struct D(u8);
+
+impl Drop for D {
+    fn drop(&mut self) {
+        println!("Dropping {}", self.0);
+        let old = LOG.load(Ordering::SeqCst);
+        LOG.compare_and_swap(old, old << 4 | self.0 as usize, Ordering::SeqCst);
+    }
+}
+
+fn main() {
+    fn die() -> D { panic!("Oh no"); }
+    let g = thread::spawn(|| {
+        let _b1: Box<[D; 4]> = Box::new([D( 1), D( 2), D( 3), D( 4)]);
+        let _b2: Box<[D; 4]> = Box::new([D( 5), D( 6), D( 7), D( 8)]);
+        let _b3: Box<[D; 4]> = Box::new([D( 9), D(10), die(), D(12)]);
+        let _b4: Box<[D; 4]> = Box::new([D(13), D(14), D(15), D(16)]);
+    });
+    assert!(g.join().is_err());
+
+    // When the panic occurs, we will be in the midst of constructing
+    // the input to `_b3`.  Therefore, we drop the elements of the
+    // partially filled array first, before we get around to dropping
+    // the elements of `_b1` and _b2`.
+
+    // Issue 23222: The order in which the elements actually get
+    // dropped is a little funky. See similar notes in nested-vec-3;
+    // in essence, I would not be surprised if we change the ordering
+    // given in `expect` in the future.
+
+    let expect = 0x__A_9__5_6_7_8__1_2_3_4;
+    let actual = LOG.load(Ordering::SeqCst);
+    assert!(actual == expect, "expect: 0x{:x} actual: 0x{:x}", expect, actual);
+}
index 4c4600590ee262a43c23c1045ba471378e92073c..e5a035fb562b1054b911d47b62f7d0d18c9a5f6a 100644 (file)
@@ -10,6 +10,6 @@
 
 // pretty-expanded FIXME #23616
 
-fn int_id(x: int) -> int { return x; }
+fn int_id(x: isize) -> isize { return x; }
 
 pub fn main() { loop { int_id(break); } }
index 625cd98bdf80e69aebce26d2e93153d63b2e5ec5..5467ed10e98ea1ca310050d9592298354bdbd20c 100644 (file)
@@ -19,7 +19,7 @@ fn hello<S:Speak>(s:&S) -> String{
     s.say("hello")
 }
 
-impl Speak for int {
+impl Speak for isize {
     fn say(&self, s:&str) -> String {
         format!("{}: {}", s, *self)
     }
@@ -39,8 +39,8 @@ pub fn main() {
     assert_eq!(3.hi(), "hello: 3".to_string());
     assert_eq!(Some(Some(3)).hi(),
                "something!something!hello: 3".to_string());
-    assert_eq!(None::<int>.hi(), "hello - none".to_string());
+    assert_eq!(None::<isize>.hi(), "hello - none".to_string());
 
-    assert_eq!(Some(None::<int>).hi(), "something!hello - none".to_string());
+    assert_eq!(Some(None::<isize>).hi(), "something!hello - none".to_string());
     assert_eq!(Some(3).hi(), "something!hello: 3".to_string());
 }
index 0ff8c0c6ba08fbeb8fde40e1ca99b4970ce3487c..082f5944fd3da60c1cb90de46b960b9148509ec5 100644 (file)
@@ -32,7 +32,7 @@ fn foo<T: RequiresRequiresShareAndSend + 'static>(val: T, chan: Sender<T>) {
 }
 
 pub fn main() {
-    let (tx, rx): (Sender<X<int>>, Receiver<X<int>>) = channel();
+    let (tx, rx): (Sender<X<isize>>, Receiver<X<isize>>) = channel();
     foo(X(31337), tx);
     assert!(rx.recv().unwrap() == X(31337));
 }
index d016a92f465bda74f919e2e2f85559f2c79a1f89..594fb5ec7078035641d92dde36f6a02819a7934d 100644 (file)
@@ -25,7 +25,7 @@ fn foo<T: Foo + 'static>(val: T, chan: Sender<T>) {
 }
 
 pub fn main() {
-    let (tx, rx): (Sender<int>, Receiver<int>) = channel();
+    let (tx, rx): (Sender<isize>, Receiver<isize>) = channel();
     foo(31337, tx);
     assert!(rx.recv().unwrap() == 31337);
 }
index e38a7bac67a86f5f3370b2a6d8c1b88e23393171..717348652ed617c3548b12f7d2968e3f42b95c64 100644 (file)
@@ -17,7 +17,7 @@
 
 extern crate trait_superkinds_in_metadata;
 use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare};
-use trait_superkinds_in_metadata::{RequiresCopy};
+use trait_superkinds_in_metadata::RequiresCopy;
 use std::marker;
 
 #[derive(Copy)]
index e8d59b267feb7a8f2a384bc4c96df537a5ecb8ce..8a954de9d0a451e41f8fb351d14384ae39229f06 100644 (file)
@@ -14,6 +14,6 @@
 
 trait Foo : Send { }
 
-impl Foo for int { }
+impl Foo for isize { }
 
 pub fn main() { }
index baca7dc13f1b9c6c35a2c2d452abd882ffd3d104..464c24fc8b0326dd0671f3f939e7245dce15f18c 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 struct X {
-    a: int
+    a: isize
 }
 
 trait Changer {
index a9f80de86059c3c57e254741fef5c3a867385cae..dcf1b5540067e23d9cf8885a069d87b2770b49d9 100644 (file)
@@ -26,9 +26,9 @@ mod mlibc {
     }
 }
 
-fn atol(s: String) -> int {
+fn atol(s: String) -> isize {
     let c = CString::new(s).unwrap();
-    unsafe { mlibc::atol(c.as_ptr()) as int }
+    unsafe { mlibc::atol(c.as_ptr()) as isize }
 }
 
 fn atoll(s: String) -> i64 {
index cef48aadab50ae16bdbd051eca9a7a16344fbaae..e3ee282ec2a4ebc1dcdc2a9b67dd9f319d997b15 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn foo() -> int { 22 }
+fn foo() -> isize { 22 }
 
 pub fn main() {
-    let mut x: Vec<extern "Rust" fn() -> int> = Vec::new();
+    let mut x: Vec<extern "Rust" fn() -> isize> = Vec::new();
     x.push(foo);
     assert_eq!((x[0])(), 22);
 }
index c4f89bbcd328d16df671ea8982cdd6497ab4115d..448ed76fe96b984a278bc4168e0e6d3e976d83bb 100644 (file)
@@ -21,6 +21,6 @@ fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) {
 fn main() {
     let mut sum = 0;
     let elems = [ 1, 2, 3, 4, 5 ];
-    each(&elems, |val: &uint| sum += *val);
+    each(&elems, |val: &usize| sum += *val);
     assert_eq!(sum, 15);
 }
index e79bab1b7b0505825001dee61b1ee589d8a662b5..6f1fafba563ab5937104156bca382b2494059dce 100644 (file)
 // issues #10618 and #16382
 // pretty-expanded FIXME #23616
 
-const SIZE: int = 25;
+const SIZE: isize = 25;
 
 fn main() {
-    let _a: [bool; 1 as uint];
-    let _b: [int; SIZE as uint] = [1; SIZE as uint];
-    let _c: [bool; '\n' as uint] = [true; '\n' as uint];
-    let _d: [bool; true as uint] = [true; true as uint];
+    let _a: [bool; 1 as usize];
+    let _b: [isize; SIZE as usize] = [1; SIZE as usize];
+    let _c: [bool; '\n' as usize] = [true; '\n' as usize];
+    let _d: [bool; true as usize] = [true; true as usize];
 }
index deb0c0d0dc0df884c4c0c2ba01d3df22e309b47e..f5180ea260f8d84cee9495b91ed0b84b24b56322 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 pub fn main() {
-    let x: int = 3;
-    println!("&x={:x}", (&x as *const int as uint));
+    let x: isize = 3;
+    println!("&x={:x}", (&x as *const isize as usize));
 }
index 3eec130d5a91c3bb7560f5dcbff830e5099bc44c..03a73555f856a20cbd4e62174a38f22004c3ce7b 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    let i: int = 'Q' as int;
+    let i: isize = 'Q' as isize;
     assert_eq!(i, 0x51);
     let u: u32 = i as u32;
     assert_eq!(u, 0x51 as u32);
index d7a74adc02d5eaa3575f6d295dbfbdfb4bfd025f..c87a3e8bb93d607e1f26c31a4049e49e47f539bf 100644 (file)
@@ -14,7 +14,7 @@
 
 #[derive(Copy)]
 struct Foo {
-    x: int
+    x: isize
 }
 
 impl Clone for Foo {
index 7d25321fae1bc477c3813e985ab4b46943755ad1..5c22d5c869042a198ea844e734df31756f713f67 100644 (file)
 // pretty-expanded FIXME #23616
 
 #[cfg(all(fooA, not(bar)))]
-fn foo1() -> int { 1 }
+fn foo1() -> isize { 1 }
 
 // !fooA AND !bar
 #[cfg(all(not(fooA), not(bar)))]
-fn foo2() -> int { 2 }
+fn foo2() -> isize { 2 }
 
 // fooC OR (fooB AND !bar)
 #[cfg(any(fooC, all(fooB, not(bar))))]
-fn foo2() -> int { 3 }
+fn foo2() -> isize { 3 }
 
 // fooA AND bar
 #[cfg(all(fooA, bar))]
-fn foo3() -> int { 2 }
+fn foo3() -> isize { 2 }
 
 // !(fooA AND bar)
 #[cfg(not(all(fooA, bar)))]
-fn foo3() -> int { 3 }
+fn foo3() -> isize { 3 }
 
 pub fn main() {
     assert_eq!(1, foo1());
index adf041b04d6fbf3bf9765f6728114e1fab1294aa..19c3458ef7b28fc52088d60fab9e950edf3df7be 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-static mut TEST: &'static mut [int] = &mut [1];
+static mut TEST: &'static mut [isize] = &mut [1];
 
 pub fn main() {
     unsafe {
index 260668e48e96b9d3fb7da717bebffb470d138176..8a7ae1de9bc70f2b40984afcdc9a2620cb500e1e 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-const aa: [int; 3] = [1, 2, 3];
-const ab: &'static [int; 3] = &aa;
-const ac: &'static [int] = ab;
-const ad: &'static [int] = &aa;
-const ae: &'static [int; 3] = &[1, 2, 3];
-const af: &'static [int] = &[1, 2, 3];
+const aa: [isize; 3] = [1, 2, 3];
+const ab: &'static [isize; 3] = &aa;
+const ac: &'static [isize] = ab;
+const ad: &'static [isize] = &aa;
+const ae: &'static [isize; 3] = &[1, 2, 3];
+const af: &'static [isize] = &[1, 2, 3];
 
-static ca: int = aa[0];
-static cb: int = ab[1];
-static cc: int = ac[2];
-static cd: int = ad[0];
-static ce: int = ae[1];
-static cf: int = af[2];
+static ca: isize = aa[0];
+static cb: isize = ab[1];
+static cc: isize = ac[2];
+static cd: isize = ad[0];
+static ce: isize = ae[1];
+static cf: isize = af[2];
 
 fn main () {
-    let b: &[int] = &[1, 2, 3];
+    let b: &[isize] = &[1, 2, 3];
     assert!(ac == b);
     assert!(ad == b);
     assert!(af == b);
index 4f1654e60317a01a271091b952b10c49ab528074..e5acad3a3ad340847594f343960dbf32d07d2561 100644 (file)
 
 
 trait noisy {
-  fn speak(&mut self) -> int;
+  fn speak(&mut self) -> isize;
 }
 
 struct dog {
-  barks: uint,
+  barks: usize,
 
-  volume: int,
+  volume: isize,
 }
 
 impl dog {
-    fn bark(&mut self) -> int {
+    fn bark(&mut self) -> isize {
       println!("Woof {} {}", self.barks, self.volume);
       self.barks += 1_usize;
       if self.barks % 3_usize == 0_usize {
@@ -35,7 +35,7 @@ fn bark(&mut self) -> int {
 }
 
 impl noisy for dog {
-    fn speak(&mut self) -> int {
+    fn speak(&mut self) -> isize {
         self.bark()
     }
 }
@@ -49,26 +49,26 @@ fn dog() -> dog {
 
 #[derive(Clone)]
 struct cat {
-  meows: uint,
+  meows: usize,
 
-  how_hungry: int,
+  how_hungry: isize,
   name: String,
 }
 
 impl noisy for cat {
-    fn speak(&mut self) -> int {
-        self.meow() as int
+    fn speak(&mut self) -> isize {
+        self.meow() as isize
     }
 }
 
 impl cat {
-    pub fn meow_count(&self) -> uint {
+    pub fn meow_count(&self) -> usize {
         self.meows
     }
 }
 
 impl cat {
-    fn meow(&mut self) -> uint {
+    fn meow(&mut self) -> usize {
         println!("Meow");
         self.meows += 1_usize;
         if self.meows % 5_usize == 0_usize {
@@ -78,7 +78,7 @@ fn meow(&mut self) -> uint {
     }
 }
 
-fn cat(in_x: uint, in_y: int, in_name: String) -> cat {
+fn cat(in_x: usize, in_y: isize, in_name: String) -> cat {
     cat {
         meows: in_x,
         how_hungry: in_y,
index 01513ab6f47e6deba3d6c837ded4361310cdf740..adb0b6cd0a75f9b658faff605cf99954edf33186 100644 (file)
@@ -16,8 +16,8 @@ trait noisy {
 }
 
 struct cat {
-  meows: uint,
-  how_hungry: int,
+  meows: usize,
+  how_hungry: isize,
   name: String,
 }
 
@@ -49,7 +49,7 @@ fn meow(&mut self) {
     }
 }
 
-fn cat(in_x : uint, in_y : int, in_name: String) -> cat {
+fn cat(in_x : usize, in_y : isize, in_name: String) -> cat {
     cat {
         meows: in_x,
         how_hungry: in_y,
index 6884ac8c07579d7ac7f344f279976a223a027d36..05ec2bc0ac75d202c21c3f10ac29302713acede0 100644 (file)
@@ -11,8 +11,8 @@
 // pretty-expanded FIXME #23616
 
 struct cat {
-  done : extern fn(uint),
-  meows : uint,
+  done : extern fn(usize),
+  meows : usize,
 }
 
 impl Drop for cat {
@@ -21,7 +21,7 @@ fn drop(&mut self) {
     }
 }
 
-fn cat(done: extern fn(uint)) -> cat {
+fn cat(done: extern fn(usize)) -> cat {
     cat {
         meows: 0,
         done: done
index 05228b30c41d80d1dd9f2049b816fca4756608f5..675acf1dd62e09193b6a2a470ca0b4e4d047d006 100644 (file)
@@ -17,7 +17,7 @@
 
 mod kitty {
     pub struct cat {
-        meows: uint,
+        meows: usize,
         name: String,
     }
 
index c3ced512afae4c01beee22a193b1fae1d1ef43a2..57c1fd80bd5420b2cb96a1e3436868627d4c42de 100644 (file)
@@ -16,20 +16,20 @@ enum cat_type { tuxedo, tabby, tortoiseshell }
 
 impl cmp::PartialEq for cat_type {
     fn eq(&self, other: &cat_type) -> bool {
-        ((*self) as uint) == ((*other) as uint)
+        ((*self) as usize) == ((*other) as usize)
     }
     fn ne(&self, other: &cat_type) -> bool { !(*self).eq(other) }
 }
 
 // Very silly -- this just returns the value of the name field
-// for any int value that's less than the meows field
+// for any isize value that's less than the meows field
 
 // ok: T should be in scope when resolving the trait ref for map
 struct cat<T> {
     // Yes, you can have negative meows
-    meows : int,
+    meows : isize,
 
-    how_hungry : int,
+    how_hungry : isize,
     name : T,
 }
 
@@ -46,26 +46,26 @@ pub fn eat(&mut self) -> bool {
             return false;
         }
     }
-    fn len(&self) -> uint { self.meows as uint }
+    fn len(&self) -> usize { self.meows as usize }
     fn is_empty(&self) -> bool { self.meows == 0 }
     fn clear(&mut self) {}
-    fn contains_key(&self, k: &int) -> bool { *k <= self.meows }
+    fn contains_key(&self, k: &isize) -> bool { *k <= self.meows }
 
-    fn find(&self, k: &int) -> Option<&T> {
+    fn find(&self, k: &isize) -> Option<&T> {
         if *k <= self.meows {
             Some(&self.name)
         } else {
             None
         }
     }
-    fn insert(&mut self, k: int, _: T) -> bool {
+    fn insert(&mut self, k: isize, _: T) -> bool {
         self.meows += k;
         true
     }
 
-    fn find_mut(&mut self, _k: &int) -> Option<&mut T> { panic!() }
+    fn find_mut(&mut self, _k: &isize) -> Option<&mut T> { panic!() }
 
-    fn remove(&mut self, k: &int) -> bool {
+    fn remove(&mut self, k: &isize) -> bool {
         if self.find(k).is_some() {
             self.meows -= *k; true
         } else {
@@ -73,20 +73,20 @@ fn remove(&mut self, k: &int) -> bool {
         }
     }
 
-    fn pop(&mut self, _k: &int) -> Option<T> { panic!() }
+    fn pop(&mut self, _k: &isize) -> Option<T> { panic!() }
 
-    fn swap(&mut self, _k: int, _v: T) -> Option<T> { panic!() }
+    fn swap(&mut self, _k: isize, _v: T) -> Option<T> { panic!() }
 }
 
 impl<T> cat<T> {
-    pub fn get(&self, k: &int) -> &T {
+    pub fn get(&self, k: &isize) -> &T {
         match self.find(k) {
           Some(v) => { v }
           None    => { panic!("epic fail"); }
         }
     }
 
-    pub fn new(in_x: int, in_y: int, in_name: T) -> cat<T> {
+    pub fn new(in_x: isize, in_y: isize, in_name: T) -> cat<T> {
         cat{meows: in_x, how_hungry: in_y, name: in_name }
     }
 }
index bd05221b8c7534142b7abadb4765d5fa8d019b3c..5a1dc930efa541c71037032cfd0c2b770a9e41ff 100644 (file)
@@ -13,9 +13,9 @@
 use cci_class_trait::animals::noisy;
 
 struct cat {
-  meows: uint,
+  meows: usize,
 
-  how_hungry : int,
+  how_hungry : isize,
   name : String,
 }
 
@@ -47,7 +47,7 @@ fn meow(&mut self) {
     }
 }
 
-fn cat(in_x : uint, in_y : int, in_name: String) -> cat {
+fn cat(in_x : usize, in_y : isize, in_name: String) -> cat {
     cat {
         meows: in_x,
         how_hungry: in_y,
index 87e6e5f675e995332da759cfc4a24231eb32f9a3..394af6b9ecd51c972c1f4d6b513aef97375cf54f 100644 (file)
@@ -15,9 +15,9 @@ trait noisy {
 
 #[derive(Clone)]
 struct cat {
-    meows : uint,
+    meows : usize,
 
-    how_hungry : int,
+    how_hungry : isize,
     name : String,
 }
 
@@ -48,7 +48,7 @@ impl noisy for cat {
     fn speak(&mut self) { self.meow(); }
 }
 
-fn cat(in_x : uint, in_y : int, in_name: String) -> cat {
+fn cat(in_x : usize, in_y : isize, in_name: String) -> cat {
     cat {
         meows: in_x,
         how_hungry: in_y,
index 2959938e3736847b323e0b3e70568c485c65eea9..d454bdd73a1ac4b3aefcdc8402fbd3aa51d492f7 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct cat {
-  meows : uint,
+  meows : usize,
 
-  how_hungry : int,
+  how_hungry : isize,
 }
 
 impl cat {
     pub fn speak(&mut self) { self.meows += 1; }
-    pub fn meow_count(&mut self) -> uint { self.meows }
+    pub fn meow_count(&mut self) -> usize { self.meows }
 }
 
-fn cat(in_x: uint, in_y: int) -> cat {
+fn cat(in_x: usize, in_y: isize) -> cat {
     cat {
         meows: in_x,
         how_hungry: in_y
index 9e74a1002042d2332d11dc713aa15df272ce8162..27f872d532c7900a41e6dc9a2c8022c1f5ec40bf 100644 (file)
 
 struct cat<U> {
     info : Vec<U> ,
-    meows : uint,
+    meows : usize,
 
-    how_hungry : int,
+    how_hungry : isize,
 }
 
 impl<U> cat<U> {
     pub fn speak<T>(&mut self, stuff: Vec<T> ) {
         self.meows += stuff.len();
     }
-    pub fn meow_count(&mut self) -> uint { self.meows }
+    pub fn meow_count(&mut self) -> usize { self.meows }
 }
 
-fn cat<U>(in_x : uint, in_y : int, in_info: Vec<U> ) -> cat<U> {
+fn cat<U>(in_x : usize, in_y : isize, in_info: Vec<U> ) -> cat<U> {
     cat {
         meows: in_x,
         how_hungry: in_y,
@@ -34,7 +34,7 @@ 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, 99, vec!(9));
+  let mut nyan : cat<isize> = cat::<isize>(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);
index 2bdc053675fbef16b43064d36ffedaa9e1385b7f..52853658c825b2cd897d0d4e022150d6ed2beabe 100644 (file)
@@ -14,9 +14,9 @@
 use std::fmt;
 
 struct cat {
-    meows : uint,
+    meows : usize,
 
-    how_hungry : int,
+    how_hungry : isize,
     name : String,
 }
 
@@ -46,7 +46,7 @@ fn meow(&mut self) {
     }
 }
 
-fn cat(in_x : uint, in_y : int, in_name: String) -> cat {
+fn cat(in_x : usize, in_y : isize, in_name: String) -> cat {
     cat {
         meows: in_x,
         how_hungry: in_y,
index 6cd8f4c658cdeca1b19987af7721c7e45f26965a..cc9a118ba19d1e37a5e643d7771a3b99ccaa6692 100644 (file)
 use std::marker::PhantomData;
 
 struct cat<U> {
-    meows : uint,
-    how_hungry : int,
+    meows : usize,
+    how_hungry : isize,
     m: PhantomData<U>
 }
 
 impl<U> cat<U> {
     pub fn speak(&mut self) { self.meows += 1; }
-    pub fn meow_count(&mut self) -> uint { self.meows }
+    pub fn meow_count(&mut self) -> usize { self.meows }
 }
 
-fn cat<U>(in_x : uint, in_y : int) -> cat<U> {
+fn cat<U>(in_x : usize, in_y : isize) -> cat<U> {
     cat {
         meows: in_x,
         how_hungry: in_y,
@@ -33,6 +33,6 @@ fn cat<U>(in_x : uint, in_y : int) -> cat<U> {
 
 
 pub fn main() {
-  let _nyan : cat<int> = cat::<int>(52, 99);
+  let _nyan : cat<isize> = cat::<isize>(52, 99);
   //  let mut kitty = cat(1000, 2);
 }
index 8fc4f47dc027743a04ba34fd1bb14122b80a3806..0d9f859d2d14dfde4e1fdb1bba9587aab2e8713a 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct cat {
-    meows : uint,
+    meows : usize,
 
-    how_hungry : int,
+    how_hungry : isize,
 }
 
 impl cat {
     pub fn speak(&mut self) {}
 }
 
-fn cat(in_x : uint, in_y : int) -> cat {
+fn cat(in_x : usize, in_y : isize) -> cat {
     cat {
         meows: in_x,
         how_hungry: in_y
index ff5ef145bcddfe159d89e7099404aed86d447492..f520623a75ab572a6d1f666c857b14594ea50749 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct cat {
-    meows : uint,
+    meows : usize,
 
-    how_hungry : int,
+    how_hungry : isize,
 }
 
-fn cat(in_x : uint, in_y : int) -> cat {
+fn cat(in_x : usize, in_y : isize) -> cat {
     cat {
         meows: in_x,
         how_hungry: in_y
index 4fabca491be93f88eda6ef8005dad5934bd31280..fa0dda11233a80ad768877474882bdb7fd7bde4b 100644 (file)
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 struct cat {
-    meows : uint,
+    meows : usize,
 
-    how_hungry : int,
+    how_hungry : isize,
     name : String,
 }
 
@@ -40,7 +40,7 @@ fn meow(&mut self) {
     }
 }
 
-fn cat(in_x : uint, in_y : int, in_name: String) -> cat {
+fn cat(in_x : usize, in_y : isize, in_name: String) -> cat {
     cat {
         meows: in_x,
         how_hungry: in_y,
index 8dff34bdc1fcdbbab7ace4e69054f169c0560852..b62f2b2a8eb8fe5d0d6a8e22300f132079251f6b 100644 (file)
 
 use std::os;
 
-struct Test { x: int }
+struct Test { x: isize }
 
 impl Test {
-    fn get_x(&self) -> Option<Box<int>> {
+    fn get_x(&self) -> Option<Box<isize>> {
         Some(box self.x)
     }
 }
 
-fn do_something(t: &Test) -> int {
+fn do_something(t: &Test) -> isize {
 
     // The cleanup scope for the result of `t.get_x()` should be the
     // arm itself and not the match, otherwise we'll (potentially) get
index 7fd7ab90fc293427df1a738534ab0a5769561b60..1d0030fd3d362d4c7bead5141b055d4c804c71a3 100644 (file)
@@ -19,7 +19,7 @@
 
 struct Temporary;
 
-static mut DROPPED: int = 0;
+static mut DROPPED: isize = 0;
 
 impl Drop for Temporary {
     fn drop(&mut self) {
index 24c95bbb6dea7b5b6b115d292791b2790b7cca94..3b5421e5aff4c66c183b4bd591d9402808c4c15c 100644 (file)
@@ -35,13 +35,13 @@ enum Conzabble {
     Bickwick(Foo)
 }
 
-struct Foo { field: Box<uint> }
+struct Foo { field: Box<usize> }
 
-fn do_it(x: &[uint]) -> Foo {
+fn do_it(x: &[usize]) -> Foo {
     panic!()
 }
 
-fn get_bar(x: uint) -> Vec<uint> { vec!(x * 2) }
+fn get_bar(x: usize) -> Vec<usize> { vec!(x * 2) }
 
 pub fn fails() {
     let x = 2;
index d448934f781dbc97c73263730089f3ae52f4a6d2..0cfe739018c85adf5c2896e7537741ca4bc5f41d 100644 (file)
@@ -35,6 +35,6 @@ pub fn main() {
 
     if args.len() >= 2 && args[1] == "signal" {
         // Raise a segfault.
-        unsafe { *(0 as *mut int) = 0; }
+        unsafe { *(0 as *mut isize) = 0; }
     }
 }
index cfbcc52e602c465dded5c93dd4289fd0da395010..fa663105ccdaf0367d5c74d37a31be4c2380c485 100644 (file)
@@ -16,8 +16,8 @@
 use std::thread::Thread;
 
 struct Pair {
-    a: int,
-    b: int
+    a: isize,
+    b: isize
 }
 
 pub fn main() {
index fbe871a1bffce3908629c45bcffca38cdecab12d..2b7557c7bc563910760aecb85b47ca616baa58cf 100644 (file)
@@ -24,7 +24,7 @@ fn eq(&self, other: &Fool) -> bool {
     }
 }
 
-struct Int(int);
+struct Int(isize);
 
 impl PartialEq for Int {
     fn eq(&self, other: &Int) -> bool {
@@ -42,7 +42,7 @@ fn partial_cmp(&self, other: &Int) -> Option<Ordering> {
     }
 }
 
-struct RevInt(int);
+struct RevInt(isize);
 
 impl PartialEq for RevInt {
     fn eq(&self, other: &RevInt) -> bool {
index 1b12cbd33df8a314f34fdb0713d894854917dff5..6926879856cbc639c9b52e40815d4d7b645ede7a 100644 (file)
@@ -19,8 +19,8 @@
 // rvalue expressions to be unsized. See #20169 for more information.
 
 pub fn main() {
-    // FIXME #22405: We cannot infer the type `Box<[int; k]>` for
-    // the r-value expression from the context `Box<[int]>`, and
+    // FIXME #22405: We cannot infer the type `Box<[isize; k]>` for
+    // the r-value expression from the context `Box<[isize]>`, and
     // therefore the `box EXPR` desugaring breaks down.
     //
     // One could reasonably claim that the `box EXPR` desugaring is
@@ -28,24 +28,24 @@ pub fn main() {
     // eventually fix that, at which point the `Box::new` calls below
     // should be replaced wth uses of `box`.
 
-    let _: Box<[int]> = Box::new({ [1, 2, 3] });
-    let _: Box<[int]> = Box::new(if true { [1, 2, 3] } else { [1, 3, 4] });
-    let _: Box<[int]> = Box::new(match true { true => [1, 2, 3], false => [1, 3, 4] });
-    let _: Box<Fn(int) -> _> = Box::new({ |x| (x as u8) });
+    let _: Box<[isize]> = Box::new({ [1, 2, 3] });
+    let _: Box<[isize]> = Box::new(if true { [1, 2, 3] } else { [1, 3, 4] });
+    let _: Box<[isize]> = Box::new(match true { true => [1, 2, 3], false => [1, 3, 4] });
+    let _: Box<Fn(isize) -> _> = Box::new({ |x| (x as u8) });
     let _: Box<Debug> = Box::new(if true { false } else { true });
     let _: Box<Debug> = Box::new(match true { true => 'a', false => 'b' });
 
-    let _: &[int] = &{ [1, 2, 3] };
-    let _: &[int] = &if true { [1, 2, 3] } else { [1, 3, 4] };
-    let _: &[int] = &match true { true => [1, 2, 3], false => [1, 3, 4] };
-    let _: &Fn(int) -> _ = &{ |x| (x as u8) };
+    let _: &[isize] = &{ [1, 2, 3] };
+    let _: &[isize] = &if true { [1, 2, 3] } else { [1, 3, 4] };
+    let _: &[isize] = &match true { true => [1, 2, 3], false => [1, 3, 4] };
+    let _: &Fn(isize) -> _ = &{ |x| (x as u8) };
     let _: &Debug = &if true { false } else { true };
     let _: &Debug = &match true { true => 'a', false => 'b' };
 
-    let _: Box<[int]> = Box::new([1, 2, 3]);
-    let _: Box<Fn(int) -> _> = Box::new(|x| (x as u8));
+    let _: Box<[isize]> = Box::new([1, 2, 3]);
+    let _: Box<Fn(isize) -> _> = Box::new(|x| (x as u8));
 
-    let _: Vec<Box<Fn(int) -> _>> = vec![
+    let _: Vec<Box<Fn(isize) -> _>> = vec![
         Box::new(|x| (x as u8)),
         Box::new(|x| (x as i16 as u8)),
     ];
index b3eec9939c29e8f443dbe0565b5704f316b8db1f..c2f6b4c4ac446674347865327547a70cb503bbf7 100644 (file)
@@ -15,9 +15,9 @@
 use std::boxed::Box;
 
 pub fn main() {
-    let _: Box<[int]> = if true { Box::new([1, 2, 3]) } else { Box::new([1]) };
+    let _: Box<[isize]> = if true { Box::new([1, 2, 3]) } else { Box::new([1]) };
 
-    let _: Box<[int]> = match true { true => Box::new([1, 2, 3]), false => Box::new([1]) };
+    let _: Box<[isize]> = match true { true => Box::new([1, 2, 3]), false => Box::new([1]) };
 
     // Check we don't get over-keen at propagating coercions in the case of casts.
     let x = if true { 42 } else { 42u8 } as u16;
index 01627f1a837666de481f24335d29ddd7efd3ccad..6bf5c4d596f08ce1471d77696b574a22c3351ca0 100644 (file)
 #![feature(box_syntax)]
 
 pub fn main() {
-    let _: Box<[int]> =
+    let _: Box<[isize]> =
         if true { let b: Box<_> = box [1, 2, 3]; b } else { let b: Box<_> = box [1]; b };
 
-    let _: Box<[int]> = match true {
+    let _: Box<[isize]> = match true {
         true => { let b: Box<_> = box [1, 2, 3]; b }
         false => { let b: Box<_> = box [1]; b }
     };
index 7812f0088b146e56e309ab1484f793e7b7316fc9..581764d4a3b2f70309cace732c37278f2fbfddf7 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn negate(x: &int) -> int {
+fn negate(x: &isize) -> isize {
     -*x
 }
 
-fn negate_mut(y: &mut int) -> int {
+fn negate_mut(y: &mut isize) -> isize {
     negate(y)
 }
 
-fn negate_imm(y: &int) -> int {
+fn negate_imm(y: &isize) -> isize {
     negate(y)
 }
 
index 4638c51bbf7025c7becd0c355804bd63987df892..6000b358acf263a9f525f00d8deb0b5a90a5371c 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct SpeechMaker {
-    speeches: uint
+    speeches: usize
 }
 
 impl SpeechMaker {
-    pub fn how_many(&self) -> uint { self.speeches }
+    pub fn how_many(&self) -> usize { self.speeches }
 }
 
-fn foo(speaker: &SpeechMaker) -> uint {
+fn foo(speaker: &SpeechMaker) -> usize {
     speaker.how_many() + 33
 }
 
index edc8df64a2042ddfbf3c06976c8e767a103f2d1e..1786d5b54f3a2ad92f77b0c7ab8781db68a61e74 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn sum(x: &[int]) -> int {
+fn sum(x: &[isize]) -> isize {
     let mut sum = 0;
     for y in x { sum += *y; }
     return sum;
 }
 
-fn sum_mut(y: &mut [int]) -> int {
+fn sum_mut(y: &mut [isize]) -> isize {
     sum(y)
 }
 
-fn sum_imm(y: &[int]) -> int {
+fn sum_imm(y: &[isize]) -> isize {
     sum(y)
 }
 
index dcef198320056c080852446a8f0a1815c83e8028..2e41ff3a56041f6ada1ff2e13dc13428e9ae9471 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn bar(v: &mut [uint]) -> Vec<uint> {
+fn bar(v: &mut [usize]) -> Vec<usize> {
     v.to_vec()
 }
 
-fn bip(v: &[uint]) -> Vec<uint> {
+fn bip(v: &[usize]) -> Vec<usize> {
     v.to_vec()
 }
 
index 9f6444c43c737dfd715ec566da7954a26c28507a..b70146ea2d363c3bdfad3ad9725d971243a6cea3 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 struct SpeechMaker {
-    speeches: uint
+    speeches: usize
 }
 
 fn talk(x: &mut SpeechMaker) {
index 1751979db8c97f91a5e785ac1d05fe7a9d4d160f..5f4cc569ac4e775836126f9098ac2670a026b069 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 struct SpeechMaker {
-    speeches: uint
+    speeches: usize
 }
 
 impl SpeechMaker {
index ab8b6818f43731ace72b6ecc5f693be4503fe036..803f86e0fb1014f0178c73d57b3419b0a3a451e2 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn reverse(v: &mut [uint]) {
+fn reverse(v: &mut [usize]) {
     v.reverse();
 }
 
-fn bar(v: &mut [uint]) {
+fn bar(v: &mut [usize]) {
     reverse(v);
     reverse(v);
     reverse(v);
index 06ff3824cd20315e0ddbfcf55b34958e1712d9b7..a5fac127356c8f8f4e6456fde5dca2fe2c653aec 100644 (file)
@@ -11,7 +11,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn bar(v: &mut [uint]) {
+fn bar(v: &mut [usize]) {
     v.reverse();
     v.reverse();
     v.reverse();
index f91ccf6120a6e376e931acf20a5211de731a2686..134549d747a0a580857acfe732ea3b4b3fdf4b6a 100644 (file)
@@ -15,7 +15,7 @@ pub fn main() {
     enum x { foo }
     impl ::std::cmp::PartialEq for x {
         fn eq(&self, other: &x) -> bool {
-            (*self) as int == (*other) as int
+            (*self) as isize == (*other) as isize
         }
         fn ne(&self, other: &x) -> bool { !(*self).eq(other) }
     }
index 8ca79f1d4f100bf83817d86b0803503115d10783..07477f96c0d3de7bb643c3effa3b566eb5ce02b6 100644 (file)
 // heterogeneous pair.
 
 trait MyTrait {
-    fn get(&self) -> uint;
+    fn get(&self) -> usize;
 }
 
 impl<T> MyTrait for (T,T) {
-    fn get(&self) -> uint { 0 }
+    fn get(&self) -> usize { 0 }
 }
 
-impl MyTrait for (uint,int) {
-    fn get(&self) -> uint { 0 }
+impl MyTrait for (usize,isize) {
+    fn get(&self) -> usize { 0 }
 }
 
 fn main() {
index 9f980e161b0cfe0e631e527266db3853bfab566b..8ab340d1bff6515ad0931da857016b824466f8d7 100644 (file)
@@ -25,7 +25,7 @@ fn get(&self) -> T {
 
 #[derive(Clone, Copy, Debug, PartialEq)]
 struct MyType {
-    dummy: uint
+    dummy: usize
 }
 
 impl MyTrait for MyType {
index cf318c50cff6ab0566a8cc3e748d91549687edbd..43f10cfd060022b2485cc1c71eb740baeb4a0ead 100644 (file)
@@ -22,7 +22,7 @@ pub fn main() {
     assert_eq!(y, 10);
 }
 
-fn child(c: &Sender<int>) {
+fn child(c: &Sender<isize>) {
     println!("sending");
     c.send(10).unwrap();
     println!("value sent");
index 9b049ede859a66ce3ed4938c11ccf031eaa41e66..69945584876d08c51b61f84bf8149f11065e5182 100644 (file)
@@ -10,9 +10,9 @@
 
 // pretty-expanded FIXME #23616
 
-type an_int = int;
+type an_int = isize;
 
-fn cmp(x: Option<an_int>, y: Option<int>) -> bool {
+fn cmp(x: Option<an_int>, y: Option<isize>) -> bool {
     x == y
 }
 
index f8c8ac20d72af92370db00d36e143a9dd6442d3f..6bb9503c2b0e4c0600dc9858e61e7dc14796739b 100644 (file)
 
 
 
-type t = int;
+type t = isize;
 
 fn nothing() { }
 
 fn putstr(_s: String) { }
 
-fn putint(_i: int) {
-    let mut i: int = 33;
+fn putint(_i: isize) {
+    let mut i: isize = 33;
     while i < 36 { putstr("hi".to_string()); i = i + 1; }
 }
 
-fn zerg(i: int) -> int { return i; }
+fn zerg(i: isize) -> isize { return i; }
 
-fn foo(x: int) -> int {
+fn foo(x: isize) -> isize {
     let mut y: t = x + 2;
     putstr("hello".to_string());
     while y < 10 { putint(y); if y * 3 == 4 { y = y + 2; nothing(); } }
@@ -35,7 +35,7 @@ fn foo(x: int) -> int {
 }
 
 pub fn main() {
-    let x: int = 2 + 2;
+    let x: isize = 2 + 2;
     println!("{}", x);
     println!("hello, world");
     println!("{}", 10);
index 590912f6e91977c504ad0f7f15554fd0f8a221d0..e6660bb9ae8802541a3e1cdb1ba91821e1110e4d 100644 (file)
@@ -31,7 +31,7 @@ mod rustrt {
 }
 
 #[cfg(bogus)]
-type t = int;
+type t = isize;
 
 type t = bool;
 
@@ -42,21 +42,21 @@ enum tg { bar, }
 
 #[cfg(bogus)]
 struct r {
-  i: int,
+  i: isize,
 }
 
 #[cfg(bogus)]
-fn r(i:int) -> r {
+fn r(i:isize) -> r {
     r {
         i: i
     }
 }
 
 struct r {
-  i: int,
+  i: isize,
 }
 
-fn r(i:int) -> r {
+fn r(i:isize) -> r {
     r {
         i: i
     }
@@ -100,8 +100,8 @@ fn f() { }
     f();
 
     #[cfg(bogus)]
-    static i: int = 0;
-    static i: int = 1;
+    static i: isize = 0;
+    static i: isize = 1;
     assert_eq!(i, 1);
 }
 
@@ -122,7 +122,7 @@ mod test_use_statements {
 
 mod test_methods {
     struct Foo {
-        bar: uint
+        bar: usize
     }
 
     impl Fooable for Foo {
index 8b8fcfccc1c4dabd52c1ad1266934df367e4033a..1a95220cda59c4278250980f982e49556f08e412 100644 (file)
@@ -19,40 +19,40 @@ macro_rules! assert_approx_eq {
     })
 }
 
-static A: int = -4 + 3;
-static A2: uint = 3 + 3;
+static A: isize = -4 + 3;
+static A2: usize = 3 + 3;
 static B: f64 = 3.0 + 2.7;
 
-static C: int = 3 - 4;
-static D: uint = 3 - 3;
+static C: isize = 3 - 4;
+static D: usize = 3 - 3;
 static E: f64 = 3.0 - 2.7;
 
-static E2: int = -3 * 3;
-static F: uint = 3 * 3;
+static E2: isize = -3 * 3;
+static F: usize = 3 * 3;
 static G: f64 = 3.3 * 3.3;
 
-static H: int = 3 / -1;
-static I: uint = 3 / 3;
+static H: isize = 3 / -1;
+static I: usize = 3 / 3;
 static J: f64 = 3.3 / 3.3;
 
 static N: bool = true && false;
 
 static O: bool = true || false;
 
-static P: int = 3 & 1;
-static Q: uint = 1 & 3;
+static P: isize = 3 & 1;
+static Q: usize = 1 & 3;
 
-static R: int = 3 | 1;
-static S: uint = 1 | 3;
+static R: isize = 3 | 1;
+static S: usize = 1 | 3;
 
-static T: int = 3 ^ 1;
-static U: uint = 1 ^ 3;
+static T: isize = 3 ^ 1;
+static U: usize = 1 ^ 3;
 
-static V: int = 1 << 3;
+static V: isize = 1 << 3;
 
 // NOTE: better shr coverage
-static W: int = 1024 >> 4;
-static X: uint = 1024 >> 4;
+static W: isize = 1024 >> 4;
+static X: usize = 1024 >> 4;
 
 static Y: bool = 1 == 1;
 static Z: bool = 1.0f64 == 1.0;
index 06fbccdec06f365ac0b41980383c67adff4f3362..b9e8dbf41d77ffaaa88cba51d3d7fa55531997d1 100644 (file)
 
 struct MyType {
     desc: &'static str,
-    data: uint,
-    code: fn(uint, uint) -> uint
+    data: usize,
+    code: fn(usize, usize) -> usize
 }
 
 impl MyType {
-    fn eval(&self, a: uint) -> uint {
+    fn eval(&self, a: usize) -> usize {
         (self.code)(self.data, a)
     }
 }
@@ -28,7 +28,7 @@ fn eval(&self, a: uint) -> uint {
 macro_rules! codegen {
     ($e:expr, $v:expr) => {
         {
-            fn generated(a: uint, b: uint) -> uint {
+            fn generated(a: usize, b: usize) -> usize {
                 a - ($e * b)
             }
             MyType {
index 1f7e942ea5a35e0a165d858f5bdb4ac4ea54e3f0..897e53822614de6e9f18cb5bff2bd78385fd1e90 100644 (file)
 
 mod foo {
     pub trait Value {
-        fn value(&self) -> uint;
+        fn value(&self) -> usize;
     }
 }
 
-static BLOCK_USE: uint = {
+static BLOCK_USE: usize = {
     use foo::Value;
     100
 };
 
-static BLOCK_PUB_USE: uint = {
+static BLOCK_PUB_USE: usize = {
     pub use foo::Value;
     200
 };
 
-static BLOCK_STRUCT_DEF: uint = {
+static BLOCK_STRUCT_DEF: usize = {
     struct Foo {
-        a: uint
+        a: usize
     }
     Foo{ a: 300 }.a
 };
 
-static BLOCK_FN_DEF: fn(uint) -> uint = {
-    fn foo(a: uint) -> uint {
+static BLOCK_FN_DEF: fn(usize) -> usize = {
+    fn foo(a: usize) -> usize {
         a + 10
     }
     foo
 };
 
-static BLOCK_MACRO_RULES: uint = {
+static BLOCK_MACRO_RULES: usize = {
     macro_rules! baz {
         () => (412)
     }
index 37101303ed916a58a1371e2cdec68305783f2cc5..5c2985ffa777df9013da24bb5a7100399655d02f 100644 (file)
@@ -15,7 +15,7 @@
 
 fn foo<T: Sync>(x: T) -> T { x }
 
-struct F { field: int }
+struct F { field: isize }
 
 pub fn main() {
     /*foo(1);
index 16d71f52d98715f2b9eb34e44c70f739dc78faed..d75a5a7eb1c3bc399c464d391868d0be21a71354 100644 (file)
@@ -10,8 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
-const a: int = 1;
-const b: int = a + 2;
+const a: isize = 1;
+const b: isize = a + 2;
 
 pub fn main() {
     assert_eq!(b, 3);
index af6af776c3d805190f720d0843ff82bad9850ad1..2dfb88dee0bb839d9597743591a95b1f8fe389e8 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-static lsl : int = 1 << 2;
-static add : int = 1 + 2;
+static lsl : isize = 1 << 2;
+static add : isize = 1 + 2;
 static addf : f64 = 1.0 + 2.0;
-static not : int = !0;
+static not : isize = !0;
 static notb : bool = !true;
-static neg : int = -(1);
+static neg : isize = -(1);
 
 pub fn main() {
     assert_eq!(lsl, 4);
index a92c2aab31241f694831a4e59fbe59939b631581..e36a55361ec2836adec06397a563e5d1b6067ac9 100644 (file)
@@ -14,8 +14,8 @@
 
 extern crate cci_const;
 static foo: &'static str = cci_const::foopy;
-static a: uint = cci_const::uint_val;
-static b: uint = cci_const::uint_expr + 5;
+static a: usize = cci_const::uint_val;
+static b: usize = cci_const::uint_expr + 5;
 
 pub fn main() {
     assert_eq!(a, 12);
index 7b2bb0d31f9affe2e9e0d9c1cb2135e4d5bc3448..1648332fe2c392b15ffb343428f0093de9865bc8 100644 (file)
@@ -10,8 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
-const C: &'static int = &1000;
-static D: int = *C;
+const C: &'static isize = &1000;
+static D: isize = *C;
 
 pub fn main() {
     assert_eq!(D, 1000);
index 8dcd67c05782cd5b1d65748cf7e77914d99dd24a..e99e1aac8afdb7c4f795d4a3b843d7c6a203cf13 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-enum E { V, VV(int) }
+enum E { V, VV(isize) }
 static C: E = E::V;
 
 impl E {
index 7cf2dcfa8900b897b93fc2d427fefd5beb52ea38..4905eaace68203507606d877f9736f7c7c645a20 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-enum E { V, VV(int) }
+enum E { V, VV(isize) }
 static C: E = E::V;
 
 fn f(a: &E) {
index 11e02338f41af902ef7051b0cb4329f47f73d0c9..3d73933c6f638cfc15955eca4d151c7c23b08acd 100644 (file)
@@ -14,10 +14,10 @@ enum A { A1, A2 }
 enum B { B1=0, B2=2 }
 
 pub fn main () {
-    static c1: int = A::A2 as int;
-    static c2: int = B::B2 as int;
-    let a1 = A::A2 as int;
-    let a2 = B::B2 as int;
+    static c1: isize = A::A2 as isize;
+    static c2: isize = B::B2 as isize;
+    let a1 = A::A2 as isize;
+    let a2 = B::B2 as isize;
     assert_eq!(c1, 1);
     assert_eq!(c2, 2);
     assert_eq!(a1, 1);
index d7503ff8d7d31365c9d623eb9295984b0d711be2..d34b5381df9bf63c26d2b2577fbbe91a1c488220 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-enum E { V0, V1(int) }
+enum E { V0, V1(isize) }
 static C: &'static E = &E::V0;
 
 pub fn main() {
index 57cf2b619257bd1e2013015fd94e9547e1dbf19a..113f20e21e1df48618ff0c2013cdc81c3db50e9b 100644 (file)
@@ -12,7 +12,7 @@
 
 enum E {
     S0 { s: String },
-    S1 { u: uint }
+    S1 { u: usize }
 }
 
 static C: E = E::S1 { u: 23 };
index 98e236bfccb436e91a36510947fe337d1d066298..fcaf8b8844b079992dacfd8d68c01256ba852313 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-enum E { V1(int), V0 }
+enum E { V1(isize), V0 }
 const C: &'static [E] = &[E::V0, E::V1(0xDEADBEE)];
 static C0: E = C[0];
 static C1: E = C[1];
index 8eb9a425b86be6b9c8d2c5e3e8edb1d2c9621fa2..936d72ac65e2f6e13f6758decee6d643a0d75dca 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-enum E { V1(int), V0 }
+enum E { V1(isize), V0 }
 static C: &'static [E] = &[E::V0, E::V1(0xDEADBEE), E::V0];
 
 pub fn main() {
index 64940015802786fcec169c9648a61774aea78a12..6fdf0c3948fa0584452c04e540696529e59e7f69 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-enum E { V1(int), V0 }
+enum E { V1(isize), V0 }
 static C: [E; 3] = [E::V0, E::V1(0xDEADBEE), E::V0];
 
 pub fn main() {
index 82d9bb2b1e1149266add7e27ea304297ce477d61..6cf9239e2e4edb85b1b0e9ffb9caf31171c5cdf0 100644 (file)
@@ -15,7 +15,7 @@
 
 pub fn main() {
 
-    const FOO: uint = 2;
-    let _v: [int; FOO*3];
+    const FOO: usize = 2;
+    let _v: [isize; FOO*3];
 
 }
index 29eefd20502673af2f69ec92afec75c225d708b5..fc3e6749f6e3ff1a421b3e61fbba5b8f04c13960 100644 (file)
@@ -14,7 +14,7 @@
 
 pub fn main() {
 
-    const FOO: uint = 2;
+    const FOO: usize = 2;
     let _v = [0; FOO*3*2/2];
 
 }
index 0819e0becbf9564cb1ac9738cc04147a65167182..55d6b60c192859bba6f20b6ff00f28994df2c473 100644 (file)
@@ -8,21 +8,21 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-const x : [int; 4] = [1,2,3,4];
-static p : int = x[2];
-const y : &'static [int] = &[1,2,3,4];
-static q : int = y[2];
+const x : [isize; 4] = [1,2,3,4];
+static p : isize = x[2];
+const y : &'static [isize] = &[1,2,3,4];
+static q : isize = y[2];
 
-struct S {a: int, b: int}
+struct S {a: isize, b: isize}
 
 const s : S = S {a: 10, b: 20};
-static t : int = s.b;
+static t : isize = s.b;
 
-struct K {a: int, b: int, c: D}
-struct D { d: int, e: int }
+struct K {a: isize, b: isize, c: D}
+struct D { d: isize, e: isize }
 
 const k : K = K {a: 10, b: 20, c: D {d: 30, e: 40}};
-static m : int = k.c.e;
+static m : isize = k.c.e;
 
 pub fn main() {
     println!("{}", p);
index 972d4ca607b387ec0a1f6b909ad55cfb2a07227f..3e1058dc27d9937b9fd797dc55c7baf553a70e3e 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn foo() -> int {
+fn foo() -> isize {
     return 0xca7f000d;
 }
 
-struct Bar<F> where F: FnMut() -> int { f: F }
+struct Bar<F> where F: FnMut() -> isize { f: F }
 
-static mut b : Bar<fn() -> int> = Bar { f: foo as fn() -> int};
+static mut b : Bar<fn() -> isize> = Bar { f: foo as fn() -> isize};
 
 pub fn main() {
     unsafe { assert_eq!((b.f)(), 0xca7f000d); }
index 44222609e13fc3fa73548c5b4e1f50d2a2eb5af5..59b2c3e36aaf9bad4e57de11457ac6736466474c 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-static toplevel_mod: int = -1;
+static toplevel_mod: isize = -1;
 
 pub fn main() {
     assert_eq!(toplevel_mod, -1);
index 88be3c235881bc7ad292547823c01c143744ce06..d0e9e5d610606631c363d5d978967362dfd15ad5 100644 (file)
@@ -18,8 +18,8 @@ enum Foo {
 static X: Foo = Foo::Bar;
 
 pub fn main() {
-    assert_eq!((X as uint), 0xDEADBEE);
-    assert_eq!((Y as uint), 0xDEADBEE);
+    assert_eq!((X as usize), 0xDEADBEE);
+    assert_eq!((Y as usize), 0xDEADBEE);
 }
 
 static Y: Foo = Foo::Bar;
index 8af169dfce989669fcd00a959259e8e0020edbe2..8932853fbf485911362de2c6f95f6b69163adb40 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 type Big = [u64; 8];
-struct Pair<'a> { a: int, b: &'a Big }
+struct Pair<'a> { a: isize, b: &'a Big }
 const x: &'static Big = &([13, 14, 10, 13, 11, 14, 14, 15]);
 const y: &'static Pair<'static> = &Pair {a: 15, b: x};
 
index e5d3f0ece0cf5b94a254c8c88363a63ebe345a2f..c783d4b8184782e82aebf58139a49780aaeed56d 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct Pair<'a> { a: int, b: &'a int }
+struct Pair<'a> { a: isize, b: &'a isize }
 
-const x: &'static int = &10;
+const x: &'static isize = &10;
 
 const y: &'static Pair<'static> = &Pair {a: 15, b: x};
 
index 27c514160c069be271285c34875094ef5e751617..3cd58c6c52afbadf3e88f5850a08db044323ddd0 100644 (file)
@@ -11,7 +11,7 @@
 use std::cmp;
 
 #[derive(Debug)]
-struct foo { a: int, b: int, c: int }
+struct foo { a: isize, b: isize, c: isize }
 
 impl cmp::PartialEq for foo {
     fn eq(&self, other: &foo) -> bool {
index 55cbae6b1d2c2c73f9ba547e50bade38144eb809..ccf1b06bacb5fd3114f32f0a37b38da354d3f2fe 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct Bar(int, int);
+struct Bar(isize, isize);
 
 static X: Bar = Bar(1, 2);
 
index 3485e23dd0dd5c626559cdc3456cc38035977977..a577bbd82788690542ba7f5bcbef7596e0d8699e 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn f(_: &[int]) {}
+fn f(_: &[isize]) {}
 
 pub fn main() {
     let v = [ 1, 2, 3 ];
index 26874b9f9d52dfc1744b9db85931e1f30216241c..758812054cd9b2d30092c9390e29a73d9bb6d4a1 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-static x : [int; 4] = [1,2,3,4];
-static y : &'static [int] = &[1,2,3,4];
-static z : &'static [int; 4] = &[1,2,3,4];
-static zz : &'static [int] = &[1,2,3,4];
+static x : [isize; 4] = [1,2,3,4];
+static y : &'static [isize] = &[1,2,3,4];
+static z : &'static [isize; 4] = &[1,2,3,4];
+static zz : &'static [isize] = &[1,2,3,4];
 
 pub fn main() {
     println!("{}", x[1]);
index 8f78d54c7013714c202f879be5989afbe90bdbfe..95ae514636e5cc42957632ff02ecf4b7243bd6f7 100644 (file)
@@ -10,6 +10,6 @@
 
 
 
-static i: int = 10;
+static i: isize = 10;
 
 pub fn main() { println!("{}", i); }
index c66030c6045f401ccb03fbd84b37383f6f2b5c66..c2f7cf4d6256806fd9c502688a744d45cf3e8761 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-const FOO: int = 10;
-const BAR: int = 3;
+const FOO: isize = 10;
+const BAR: isize = 3;
 
 pub fn main() {
-    let x: int = 3;
+    let x: isize = 3;
     let y = match x {
         FOO => 1,
         BAR => 2,
index a4413fa85d24143de41bf4184e527b3ffe8c9603..a969f6911545fcf6ac5810a8a33013de1e8d7fa4 100644 (file)
@@ -52,7 +52,7 @@ pub fn sleeper() -> Process {
 
 fn test_destroy_twice() {
     let mut p = sleeper();
-    succeed!(p.signal_exit()); // this shouldnt crash...
+    succeed!(p.signal_exit()); // this shouldn't crash...
     let _ = p.signal_exit(); // ...and nor should this (and nor should the destructor)
 }
 
index c794e45c84522a6e0ae4c432bbb83393488fefde..a108f4dc5687469f54a1879ab6d0ed8f2c8c02d7 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:--crate-name crate-name-attr-used -F unused-attributes
+// compile-flags:--crate-name crate_name_attr_used -F unused-attributes
 
 // pretty-expanded FIXME #23616
 
-#![crate_name = "crate-name-attr-used"]
+#![crate_name = "crate_name_attr_used"]
 
 fn main() {}
index 801ca0e64f013c71e2ea3d032f353a10c38fcb97..6e3f8a288129c04a3adf7d5d2962518a443c5706 100644 (file)
 
 #![deny(dead_code)]
 
-static _X: uint = 0;
+static _X: usize = 0;
 
 fn _foo() {}
 
 struct _Y {
-    _z: uint
+    _z: usize
 }
 
 enum _Z {}
@@ -26,7 +26,7 @@ impl _Y {
     fn _bar() {}
 }
 
-type _A = int;
+type _A = isize;
 
 mod _bar {
     fn _qux() {}
index d691703f437939691d2e156831ca18ac0ddcea2b..16636fadbf8dc1ebe048092edbf3dc9649d9c560 100644 (file)
@@ -13,8 +13,8 @@
 
 // pretty-expanded FIXME #23616
 
-fn f(x: int) -> int {
-    if x == 1 { return 1; } else { let y: int = 1 + f(x - 1); return y; }
+fn f(x: isize) -> isize {
+    if x == 1 { return 1; } else { let y: isize = 1 + f(x - 1); return y; }
 }
 
 pub fn main() { assert!((f(5000) == 5000)); }
index d19debce00fe176475ae47f9a419f021cc07d2c9..5ccb66a76bf76cd076ce171fbe5cb1afe2717caa 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 trait Foo {
-    fn m(&self, _:int) { }
+    fn m(&self, _:isize) { }
 }
 
 pub fn main() { }
index 547f342243c2bc2de0d6fd0b76010bc4d4af055d..61de804a80a81100dc4e6c368cdb2a8690a7cfe6 100644 (file)
@@ -18,7 +18,7 @@ fn f(&self) {
 }
 
 struct A {
-    x: int
+    x: isize
 }
 
 impl Foo for A {
index 727cada21fa66549304cf788e1fbed9b4c3841d5..3b1e04be78d48d220bb8186715e49b19f65f1b1d 100644 (file)
 // Tests that we can call a function bounded over a supertrait from
 // a default method
 
-fn require_y<T: Y>(x: T) -> int { x.y() }
+fn require_y<T: Y>(x: T) -> isize { x.y() }
 
 trait Y {
-    fn y(self) -> int;
+    fn y(self) -> isize;
 }
 
 
 trait Z: Y + Sized {
-    fn x(self) -> int {
+    fn x(self) -> isize {
         require_y(self)
     }
 }
 
-impl Y for int {
-    fn y(self) -> int { self }
+impl Y for isize {
+    fn y(self) -> isize { self }
 }
 
-impl Z for int {}
+impl Z for isize {}
 
 pub fn main() {
     assert_eq!(12.x(), 12);
index b3c13e165dbf22a9d2457963cee2e3da33a5c297..8820003d3b24dc5d12932445ac8ebd1130d21e11 100644 (file)
 
 use std::ops::{Deref, DerefMut};
 
-fn inc<T: Deref<Target=int> + DerefMut>(mut t: T) {
+fn inc<T: Deref<Target=isize> + DerefMut>(mut t: T) {
     *t += 1;
 }
 
 fn main() {
-    let mut x: int = 5;
+    let mut x: isize = 5;
     inc(&mut x);
     assert_eq!(x, 6);
 }
index 4519a8311b009b6e77a2f50372befd8675e44578..84bfbd82297a7c763abc99fbefa0f4fd4a0722fd 100644 (file)
@@ -19,11 +19,11 @@ fn deref<U:Copy,T:Deref<Target=U>>(t: T) -> U {
 }
 
 fn main() {
-    let x: int = 3;
+    let x: isize = 3;
     let y = deref(&x);
     assert_eq!(y, 3);
 
-    let mut x: int = 4;
+    let mut x: isize = 4;
     let y = deref(&mut x);
     assert_eq!(y, 4);
 }
index 4249801b0bc6ad12ab52d5bdeb01483b65963076..4722ddd64c8e4d561541826c6f6c2530f5bd52ec 100644 (file)
@@ -14,6 +14,6 @@
 #![feature(box_syntax)]
 
 pub fn main() {
-    let x: Box<int> = box 10;
-    let _y: int = *x;
+    let x: Box<isize> = box 10;
+    let _y: isize = *x;
 }
index 4f48549d499b2b6ff05a562e729d2df85f6fdcb6..fbc6c28fd4a580e6e43e208aa5cdbe385d3cd773 100644 (file)
@@ -13,7 +13,7 @@
 
 extern crate core;
 extern crate rand;
-extern crate "serialize" as rustc_serialize;
+extern crate serialize as rustc_serialize;
 extern crate collections;
 
 // Issue #16803
index a4fd77f8993bb73240fb7ff3562d18d93782805f..8a07bad69618894ad0253426ede979d9d4f18caa 100644 (file)
@@ -18,5 +18,5 @@ enum E<T,U> {
 }
 
 pub fn main() {
-    let _ = E::A::<int, int>(1).clone();
+    let _ = E::A::<isize, isize>(1).clone();
 }
index 4e0eb37abc518588f27ecf990afd127bd1594f86..8bca8345085508240645eaee5135f2ae4381520d 100644 (file)
 
 #[derive(Clone)]
 struct S {
-    _int: int,
+    _int: isize,
     _i8: i8,
     _i16: i16,
     _i32: i32,
     _i64: i64,
 
-    _uint: uint,
+    _uint: usize,
     _u8: u8,
     _u16: u16,
     _u32: u32,
index 65bf040b387e68ab7b2692a91cf6d06126197cb2..1669f3fdd3d9ae2d368caa44e1c8d81cb9e681e8 100644 (file)
@@ -33,7 +33,7 @@ fn cmp(&self, _: &FailCmp) -> Ordering { panic!("cmp") }
 
 #[derive(PartialEq,PartialOrd,Eq,Ord)]
 struct ShortCircuit {
-    x: int,
+    x: isize,
     y: FailCmp
 }
 
index 2c8efc257745014c41e7f17ab14337cbc4ced844..d116c2dfc2ac2aee3ac892f1f2fe6afed9880a7d 100644 (file)
@@ -23,7 +23,7 @@
 
 #[derive(Encodable, Decodable)]
 struct A {
-    baz: int
+    baz: isize
 }
 
 #[derive(Encodable, Decodable)]
index ea43163775ce908172c827ff386abd5dc89a9847..cc6b88c788a7856d4b7458c2da1510aebd6ce3e0 100644 (file)
 #[derive(Encodable, Decodable, Eq, Rand)]
 struct A;
 #[derive(Encodable, Decodable, Eq, Rand)]
-struct B(int);
+struct B(isize);
 #[derive(Encodable, Decodable, Eq, Rand)]
-struct C(int, int, uint);
+struct C(isize, isize, usize);
 
 #[derive(Encodable, Decodable, Eq, Rand)]
 struct D {
-    a: int,
-    b: uint,
+    a: isize,
+    b: usize,
 }
 
 #[derive(Encodable, Decodable, Eq, Rand)]
 enum E {
     E1,
-    E2(uint),
+    E2(usize),
     E3(D),
-    E4{ x: uint },
+    E4{ x: usize },
 }
 
 #[derive(Encodable, Decodable, Eq, Rand)]
@@ -74,6 +74,6 @@ pub fn main() {
     for _ in 0..20 {
         roundtrip::<E>();
         roundtrip::<F>();
-        roundtrip::<G<int>>();
+        roundtrip::<G<isize>>();
     }
 }
index 925a5875171ce6fb5d4b6d70c5ee4fba0407f033..d45247c593e5a8e301c711ec3700368553010e31 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-pub type task_id = int;
+pub type task_id = isize;
 
 #[derive(PartialEq)]
 pub enum Task {
index 842de6e4984214140583855afc016bdd2c9b5d69..2ca34e91b62a1958d4dc9858be776c6c56e75951 100644 (file)
@@ -22,21 +22,21 @@ mod submod {
                Clone,
                Debug, Rand,
                Encodable, Decodable)]
-    enum A { A1(uint), A2(int) }
+    enum A { A1(usize), A2(isize) }
 
     #[derive(PartialEq, PartialOrd, Eq, Ord,
                Hash,
                Clone,
                Debug, Rand,
                Encodable, Decodable)]
-    struct B { x: uint, y: int }
+    struct B { x: usize, y: isize }
 
     #[derive(PartialEq, PartialOrd, Eq, Ord,
                Hash,
                Clone,
                Debug, Rand,
                Encodable, Decodable)]
-    struct C(uint, int);
+    struct C(usize, isize);
 
 }
 
index 216a4c9cf0033d581db5482e07848712fead5577..ce7ba9f25eb0721659e1b039598af6794058c1c5 100644 (file)
@@ -16,9 +16,9 @@
 
 #[derive(Hash)]
 struct Person {
-    id: uint,
+    id: usize,
     name: String,
-    phone: uint,
+    phone: usize,
 }
 
 fn hash<T: Hash>(t: &T) -> u64 {
index bf2c2b01e6a51a0512e0cc084841eb17fd89e516..435d15aab8f26fbdebf94ad19f1a10d07dec6c22 100644 (file)
@@ -11,7 +11,7 @@
 pub fn main() {
     #[derive(Debug)]
     struct Foo {
-        foo: int,
+        foo: isize,
     }
 
     let f = Foo { foo: 10 };
index 87df9a12505daf3255a120a3013776eb0cafebb1..a2d22699fcc1fe8250248a1516df39d4ef904796 100644 (file)
@@ -17,8 +17,8 @@
 #[derive(Clone)]
 #[derive(Hash)]
 struct Foo {
-    bar: uint,
-    baz: int
+    bar: usize,
+    baz: isize
 }
 
 fn hash<T: Hash>(_t: &T) {}
index 2d25cdf71b0c19dd182446e5cd34aebb49d6a69c..f1c930828d2aa585333634d18ec3f9eac98aa03c 100644 (file)
@@ -14,8 +14,8 @@
 
 #[derive(PartialEq, Clone, Hash)]
 struct Foo {
-    bar: uint,
-    baz: int
+    bar: usize,
+    baz: isize
 }
 
 fn hash<T: Hash>(_t: &T) {}
index 61f266f6d81ad79dcd4f4b08172e2ba0af6feb8f..b960c2ddd4a43c075e7af0650d9f09c68a5d2a2a 100644 (file)
@@ -18,7 +18,7 @@
 struct A;
 
 #[derive(Rand)]
-struct B(int, int);
+struct B(isize, isize);
 
 #[derive(Rand)]
 struct C {
@@ -29,7 +29,7 @@ struct C {
 #[derive(Rand)]
 enum D {
     D0,
-    D1(uint),
+    D1(usize),
     D2 { x: (), y: () }
 }
 
index 3277435e485b1fbef8f03d9b94d07a93d8592d1f..7a0d35f6f499fdebaaf199b761f9bfdf51ce247c 100644 (file)
@@ -14,7 +14,7 @@
 
 #[derive(Eq,Ord)]
 struct A<'a> {
-    x: &'a int
+    x: &'a isize
 }
 pub fn main() {
     let (a, b) = (A { x: &1 }, A { x: &2 });
index 44609b6d653ca5d710c74f1e24c95cc5fec6b11c..89771ed13bfcf2f50b8ef70f7a11cd2d6ebf8f70 100644 (file)
@@ -12,7 +12,7 @@
 
 #[derive(Eq,Ord)]
 struct A<'a> {
-    x: &'a int
+    x: &'a isize
 }
 
 pub fn main() {
index acd07bc98d319dce481e9a24a82c6c7b2d5dc64e..2b7438fd84540e4c89623c2315e67903ac829b05 100644 (file)
@@ -15,19 +15,19 @@ enum A {}
 #[derive(Debug)]
 enum B { B1, B2, B3 }
 #[derive(Debug)]
-enum C { C1(int), C2(B), C3(String) }
+enum C { C1(isize), C2(B), C3(String) }
 #[derive(Debug)]
-enum D { D1{ a: int } }
+enum D { D1{ a: isize } }
 #[derive(Debug)]
 struct E;
 #[derive(Debug)]
-struct F(int);
+struct F(isize);
 #[derive(Debug)]
-struct G(int, int);
+struct G(isize, isize);
 #[derive(Debug)]
-struct H { a: int }
+struct H { a: isize }
 #[derive(Debug)]
-struct I { a: int, b: int }
+struct I { a: isize, b: isize }
 #[derive(Debug)]
 struct J(Custom);
 
index 7986b97685f6af6f33a1b47233a2e4b54cd24571..1f30f3ecedc9682394888654c043a56183794520 100644 (file)
 struct Unit;
 
 #[derive(Debug)]
-struct Tuple(int, uint);
+struct Tuple(isize, usize);
 
 #[derive(Debug)]
-struct Struct { x: int, y: uint }
+struct Struct { x: isize, y: usize }
 
 #[derive(Debug)]
 enum Enum {
     Nullary,
-    Variant(int, uint),
-    StructVariant { x: int, y : uint }
+    Variant(isize, usize),
+    StructVariant { x: isize, y : usize }
 }
 
 macro_rules! t {
index 9761a87d4aa992ab51a901cb2ccc9fe37612e5c7..f43f5162196a7ebbcab1abd2ffc11a716186c056 100644 (file)
@@ -10,7 +10,7 @@
 
 #[derive(PartialEq, Debug)]
 enum Foo {
-    Bar(int, int),
+    Bar(isize, isize),
     Baz(f64, f64)
 }
 
index c0921070bc2ba87c1429a5d593f97394805d6eff..249661f003f0644b62182dfb3edc2584a28a0c92 100644 (file)
@@ -12,8 +12,8 @@
 
 #[derive(Hash)]
 enum Foo {
-    Bar(int, char),
-    Baz(char, int)
+    Bar(isize, char),
+    Baz(char, isize)
 }
 
 #[derive(Hash)]
index 791d3dd9549573c624ebcc470aa1b30378244a02..42f0e4562708446efef03a35d5e0c8b169cdaec2 100644 (file)
@@ -12,9 +12,9 @@
 
 #[derive(Hash)]
 struct Foo {
-    x: int,
-    y: int,
-    z: int
+    x: isize,
+    y: isize,
+    z: isize
 }
 
 pub fn main() {}
index ed92a3baab9aa6986846122c837b23f4bb8a6672..5f9d9b6fb21558701da2f31b363bc05786f788cc 100644 (file)
@@ -10,7 +10,7 @@
 
 #[derive(PartialEq, Debug)]
 enum S {
-    X { x: int, y: int },
+    X { x: isize, y: isize },
     Y
 }
 
index 9319a4f752dc62fa188850e469301d96537292c8..f9e1ea4a62384f979e17f625052a4272abe22a12 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #[derive(PartialEq, Debug)]
-struct Foo(int, int, String);
+struct Foo(isize, isize, String);
 
 pub fn main() {
   let a1 = Foo(5, 6, "abc".to_string());
index e32e080cacb0a99f9ed12aaf765dda4e41b09254..624fb4a58e1a135f5e55c86ba0d23d3a2f11337b 100644 (file)
@@ -10,9 +10,9 @@
 
 #[derive(PartialEq, Debug)]
 struct Foo {
-    x: int,
-    y: int,
-    z: int,
+    x: isize,
+    y: isize,
+    z: isize,
 }
 
 pub fn main() {
index 1a31743b4c0c31da5a2e8f7912d6bfc1c4b0719f..4d88dbbca37b9487ddafbc14d0f867d29f9f6f22 100644 (file)
@@ -10,9 +10,9 @@
 
 #[derive(PartialEq, Hash, Debug)]
 struct Foo<T> {
-    x: int,
+    x: isize,
     y: T,
-    z: int
+    z: isize
 }
 
 pub fn main() {
index 22853c5ad806e550f87ce1c89d9974fb38d16fe3..e2c96085714bac2394acf4ac88858a7a1044c76b 100644 (file)
@@ -13,6 +13,8 @@
 
 // pretty-expanded FIXME #23616
 
+#![feature(slice_patterns)]
+
 struct D { x: u8 }
 
 impl Drop for D { fn drop(&mut self) { } }
index 45b743383b110c3091e8fa40b1e3288eb5e9f594..6a81ebe67ba80472f6641baa2068c109241b3a61 100644 (file)
@@ -17,7 +17,7 @@
 fn f() {
     panic!();
 
-    let _x: int = panic!();
+    let _x: isize = panic!();
 }
 
 pub fn main() {
index f838f3554d5a79f1abf8ee23eeab060163eef942..237cfe19dc49b8218121fe77b13cde5e6f1c9fd4 100644 (file)
@@ -14,8 +14,8 @@
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    let x: int = 15;
-    let y: int = 5;
+    let x: isize = 15;
+    let y: isize = 5;
     assert_eq!(x / 5, 3);
     assert_eq!(x / 4, 3);
     assert_eq!(x / 3, 5);
index 4ee08edb52debb0def59468fca44018e2cbcdadd..13ce6a07e3641ad0be295e31e5077a7925c34104 100644 (file)
 // pretty-expanded FIXME #23616
 
 fn check_expr() {
-    let _:         & uint =     &1;
-    let _:       & & uint =    &&1;
-    let _:     & & & uint =   &&&1;
-    let _:     & & & uint =  & &&1;
-    let _:   & & & & uint =  &&&&1;
-    let _:   & & & & uint = & &&&1;
-    let _: & & & & & uint = &&&&&1;
+    let _:         & usize =     &1;
+    let _:       & & usize =    &&1;
+    let _:     & & & usize =   &&&1;
+    let _:     & & & usize =  & &&1;
+    let _:   & & & & usize =  &&&&1;
+    let _:   & & & & usize = & &&&1;
+    let _: & & & & & usize = &&&&&1;
 }
 
 fn check_ty() {
-    let _:     &uint =         & 1;
-    let _:    &&uint =       & & 1;
-    let _:   &&&uint =     & & & 1;
-    let _:  & &&uint =     & & & 1;
-    let _:  &&&&uint =   & & & & 1;
-    let _: & &&&uint =   & & & & 1;
-    let _: &&&&&uint = & & & & & 1;
+    let _:     &usize =         & 1;
+    let _:    &&usize =       & & 1;
+    let _:   &&&usize =     & & & 1;
+    let _:  & &&usize =     & & & 1;
+    let _:  &&&&usize =   & & & & 1;
+    let _: & &&&usize =   & & & & 1;
+    let _: &&&&&usize = & & & & & 1;
 }
 
 fn check_pat() {
diff --git a/src/test/run-pass/drop-flag-sanity-check.rs b/src/test/run-pass/drop-flag-sanity-check.rs
new file mode 100644 (file)
index 0000000..02f6cc7
--- /dev/null
@@ -0,0 +1,69 @@
+// 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.
+
+// compile-flags: -Z force-dropflag-checks=on
+
+// Quick-and-dirty test to ensure -Z force-dropflag-checks=on works as
+// expected. Note that the inlined drop-flag is slated for removal
+// (RFC 320); when that happens, the -Z flag and this test should
+// simply be removed.
+//
+// See also drop-flag-skip-sanity-check.rs.
+
+#![feature(old_io)]
+
+use std::env;
+use std::old_io::process::{Command, ExitSignal, ExitStatus};
+
+fn main() {
+    let args: Vec<String> = env::args().collect();
+    if args.len() > 1 && args[1] == "test" {
+        return test();
+    }
+
+    let mut p = Command::new(&args[0]).arg("test").spawn().unwrap();
+    // The invocation should fail due to the drop-flag sanity check.
+    assert!(!p.wait().unwrap().success());
+}
+
+#[derive(Debug)]
+struct Corrupted {
+    x: u8
+}
+
+impl Drop for Corrupted {
+    fn drop(&mut self) { println!("dropping"); }
+}
+
+fn test() {
+    {
+        let mut c1 = Corrupted { x: 1 };
+        let mut c2 = Corrupted { x: 2 };
+        unsafe {
+            let p1 = &mut c1 as *mut Corrupted as *mut u8;
+            let p2 = &mut c2 as *mut Corrupted as *mut u8;
+            for i in 0..std::mem::size_of::<Corrupted>() {
+                // corrupt everything, *including the drop flag.
+                //
+                // (We corrupt via two different means to safeguard
+                // against the hypothetical assignment of the
+                // dtor_needed/dtor_done values to v and v+k.  that
+                // happen to match with one of the corruption values
+                // below.)
+                *p1.offset(i as isize) += 2;
+                *p2.offset(i as isize) += 3;
+            }
+        }
+        // Here, at the end of the scope of `c1` and `c2`, the
+        // drop-glue should detect the corruption of (at least one of)
+        // the drop-flags.
+    }
+    println!("We should never get here.");
+}
diff --git a/src/test/run-pass/drop-flag-skip-sanity-check.rs b/src/test/run-pass/drop-flag-skip-sanity-check.rs
new file mode 100644 (file)
index 0000000..7066b40
--- /dev/null
@@ -0,0 +1,69 @@
+// 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.
+
+// compile-flags: -Z force-dropflag-checks=off
+
+// Quick-and-dirty test to ensure -Z force-dropflag-checks=off works as
+// expected. Note that the inlined drop-flag is slated for removal
+// (RFC 320); when that happens, the -Z flag and this test should
+// simply be removed.
+//
+// See also drop-flag-sanity-check.rs.
+
+#![feature(old_io)]
+
+use std::env;
+use std::old_io::process::{Command, ExitSignal, ExitStatus};
+
+fn main() {
+    let args: Vec<String> = env::args().collect();
+    if args.len() > 1 && args[1] == "test" {
+        return test();
+    }
+
+    let mut p = Command::new(&args[0]).arg("test").spawn().unwrap();
+    // Invocatinn should succeed as drop-flag sanity check is skipped.
+    assert!(p.wait().unwrap().success());
+}
+
+#[derive(Debug)]
+struct Corrupted {
+    x: u8
+}
+
+impl Drop for Corrupted {
+    fn drop(&mut self) { println!("dropping"); }
+}
+
+fn test() {
+    {
+        let mut c1 = Corrupted { x: 1 };
+        let mut c2 = Corrupted { x: 2 };
+        unsafe {
+            let p1 = &mut c1 as *mut Corrupted as *mut u8;
+            let p2 = &mut c2 as *mut Corrupted as *mut u8;
+            for i in 0..std::mem::size_of::<Corrupted>() {
+                // corrupt everything, *including the drop flag.
+                //
+                // (We corrupt via two different means to safeguard
+                // against the hypothetical assignment of the
+                // dtor_needed/dtor_done values to v and v+k.  that
+                // happen to match with one of the corruption values
+                // below.)
+                *p1.offset(i as isize) += 2;
+                *p2.offset(i as isize) += 3;
+            }
+        }
+        // Here, at the end of the scope of `c1` and `c2`, the
+        // drop-glue should detect the corruption of (at least one of)
+        // the drop-flags.
+    }
+    println!("We should never get here.");
+}
index a52dd133e075043ea4822c5345c9822016fed3fe..268de8ec55c9cda97023b9e3a74b68f11bdd628c 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-enum t { foo(Box<int>), }
+enum t { foo(Box<isize>), }
 
 pub fn main() {
     let tt = t::foo(box 10);
index f0b5d78707a831130d1a259ec797d137175ec0fa..fc517fa592f522fa60e97da57095a6f72830c5bf 100644 (file)
@@ -13,7 +13,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn f() -> int {
+fn f() -> isize {
     if true {
         let _s: String = "should not leak".to_string();
         return 1;
index bb8119d5274579d929fe195102210d323c35b778..efb98160a3e61ae4e261be6b07aaafcdaa3e2a59 100644 (file)
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-static mut value: uint = 0;
+static mut value: usize = 0;
 
 struct Cat {
-    name : uint,
+    name : usize,
 }
 
 trait Dummy {
-    fn get(&self) -> uint;
+    fn get(&self) -> usize;
 }
 
 impl Dummy for Cat {
-    fn get(&self) -> uint { self.name }
+    fn get(&self) -> usize { self.name }
 }
 
 impl Drop for Cat {
index 353bd7a9ce06222c06df4c7c83881f965eed7266..ce675547a68192cc379681cafa6701490be0d011 100644 (file)
@@ -32,7 +32,7 @@ fn drop(&mut self) {
 
 enum Foo {
     SimpleVariant(Sender<Message>),
-    NestedVariant(Box<uint>, SendOnDrop, Sender<Message>),
+    NestedVariant(Box<usize>, SendOnDrop, Sender<Message>),
     FailingVariant { on_drop: SendOnDrop }
 }
 
index 8cbfee6c78d304eccd65e78a31ebce23928bf805..21740eb393066e2560296f6cb96149bfa7a6617f 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 struct Foo {
-    x: int
+    x: isize
 }
 
 impl Drop for Foo {
index b0bc61e3f8b1c39879206fd5a5065fd211fb218e..3b2b7493fd0fa85a8c15c41c0df5956131348d15 100644 (file)
 use std::ops::{Deref, DerefMut};
 
 pub struct Arr {
-    ptr: Box<[uint]>
+    ptr: Box<[usize]>
 }
 
 impl Deref for Arr {
-    type Target = [uint];
+    type Target = [usize];
 
-    fn deref(&self) -> &[uint] {
+    fn deref(&self) -> &[usize] {
         panic!();
     }
 }
 
 impl DerefMut for Arr {
-    fn deref_mut(&mut self) -> &mut [uint] {
+    fn deref_mut(&mut self) -> &mut [usize] {
         &mut *self.ptr
     }
 }
 
 pub fn foo(arr: &mut Arr) {
-    let x: &mut [uint] = &mut **arr;
+    let x: &mut [usize] = &mut **arr;
     assert!(x[0] == 1);
     assert!(x[1] == 2);
     assert!(x[2] == 3);
index 838352b3a149d1d17f66afe4cbad59be84621a91..c8e658beef81b356c73b713c74e6206c213e95d7 100644 (file)
 use std::ops::Deref;
 
 pub struct Arr {
-    ptr: Box<[uint]>
+    ptr: Box<[usize]>
 }
 
 impl Deref for Arr {
-    type Target = [uint];
+    type Target = [usize];
 
-    fn deref(&self) -> &[uint] {
+    fn deref(&self) -> &[usize] {
         &*self.ptr
     }
 }
 
 pub fn foo(arr: &Arr) {
     assert!(arr.len() == 3);
-    let x: &[uint] = &**arr;
+    let x: &[usize] = &**arr;
     assert!(x[0] == 1);
     assert!(x[1] == 2);
     assert!(x[2] == 3);
index 62bdda95deebf311b1616b39200436a8600826c6..df4cd74740cdd377c0791981228f3aaf5345c067 100644 (file)
 
 struct S;
 
-impl Index<uint> for S {
+impl Index<usize> for S {
     type Output = str;
 
-    fn index<'a>(&'a self, _: uint) -> &'a str {
+    fn index<'a>(&'a self, _: usize) -> &'a str {
         "hello"
     }
 }
 
 struct T;
 
-impl Index<uint> for T {
+impl Index<usize> for T {
     type Output = Debug + 'static;
 
-    fn index<'a>(&'a self, idx: uint) -> &'a (Debug + 'static) {
-        static X: uint = 42;
+    fn index<'a>(&'a self, idx: usize) -> &'a (Debug + 'static) {
+        static X: usize = 42;
         &X as &(Debug + 'static)
     }
 }
index 6e8288d36e8f6bf352c9ed16622dbddc352d4bcf..5e0e5bd03fe6fa5180d10535065c4d929701c0c6 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait Trait {
-    fn foo(&self) -> int;
+    fn foo(&self) -> isize;
 }
 
 struct A {
-    f: int
+    f: isize
 }
 impl Trait for A {
-    fn foo(&self) -> int {
+    fn foo(&self) -> isize {
         self.f
     }
 }
@@ -56,7 +56,7 @@ pub fn main() {
     }
 
     // raw slice with explicit cast
-    let a = &[1, 2, 3] as *const [_];
+    let a = &[1, 2, 3] as *const [i32];
     unsafe {
         let b = (*a)[2];
         assert!(b == 3);
@@ -96,7 +96,7 @@ pub fn main() {
         assert!(len == 3);
     }
 
-    let a = &mut [1, 2, 3] as *mut [_];
+    let a = &mut [1, 2, 3] as *mut [i32];
     unsafe {
         let b = (*a)[2];
         assert!(b == 3);
index e3b6061cbdc979a02ca87c656917a0c8d0b58a58..fd19d02e688e92ae99c47bef94ce99a2e28ab8ff 100644 (file)
@@ -17,7 +17,7 @@ struct Fat<T: ?Sized> {
 }
 
 // x is a fat pointer
-fn foo(x: &Fat<[int]>) {
+fn foo(x: &Fat<[isize]>) {
     let y = &x.ptr;
     assert!(x.ptr.len() == 3);
     assert!(y[0] == 1);
@@ -51,11 +51,11 @@ pub fn main() {
     foo(&f1);
     let f2 = &f1;
     foo(f2);
-    let f3: &Fat<[int]> = f2;
+    let f3: &Fat<[isize]> = f2;
     foo(f3);
-    let f4: &Fat<[int]> = &f1;
+    let f4: &Fat<[isize]> = &f1;
     foo(f4);
-    let f5: &Fat<[int]> = &Fat { ptr: [1, 2, 3] };
+    let f5: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] };
     foo(f5);
 
     // With a vec of Bars.
@@ -72,14 +72,14 @@ pub fn main() {
     foo2(f5);
 
     // Assignment.
-    let f5: &mut Fat<[int]> = &mut Fat { ptr: [1, 2, 3] };
+    let f5: &mut Fat<[isize]> = &mut Fat { ptr: [1, 2, 3] };
     f5.ptr[1] = 34;
     assert!(f5.ptr[0] == 1);
     assert!(f5.ptr[1] == 34);
     assert!(f5.ptr[2] == 3);
 
     // Zero size vec.
-    let f5: &Fat<[int]> = &Fat { ptr: [] };
+    let f5: &Fat<[isize]> = &Fat { ptr: [] };
     assert!(f5.ptr.len() == 0);
     let f5: &Fat<[Bar]> = &Fat { ptr: [] };
     assert!(f5.ptr.len() == 0);
index 50ba85ad7189761b77165b778e8bcd1a0cb64331..055b61b25fbf7ea5845f3942f1609b69622610fc 100644 (file)
 #![feature(box_syntax)]
 
 struct Fat<T: ?Sized> {
-    f1: int,
+    f1: isize,
     f2: &'static str,
     ptr: T
 }
 
 // x is a fat pointer
-fn foo(x: &Fat<[int]>) {
+fn foo(x: &Fat<[isize]>) {
     let y = &x.ptr;
     assert!(x.ptr.len() == 3);
     assert!(y[0] == 1);
@@ -39,7 +39,7 @@ fn foo2<T:ToBar>(x: &Fat<[T]>) {
     assert!(x.f2 == "some str");
 }
 
-fn foo3(x: &Fat<Fat<[int]>>) {
+fn foo3(x: &Fat<Fat<[isize]>>) {
     let y = &x.ptr.ptr;
     assert!(x.f1 == 5);
     assert!(x.f2 == "some str");
@@ -70,11 +70,11 @@ pub fn main() {
     foo(&f1);
     let f2 = &f1;
     foo(f2);
-    let f3: &Fat<[int]> = f2;
+    let f3: &Fat<[isize]> = f2;
     foo(f3);
-    let f4: &Fat<[int]> = &f1;
+    let f4: &Fat<[isize]> = &f1;
     foo(f4);
-    let f5: &Fat<[int]> = &Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] };
+    let f5: &Fat<[isize]> = &Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] };
     foo(f5);
 
     // With a vec of Bars.
@@ -91,14 +91,14 @@ pub fn main() {
     foo2(f5);
 
     // Assignment.
-    let f5: &mut Fat<[int]> = &mut Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] };
+    let f5: &mut Fat<[isize]> = &mut Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] };
     f5.ptr[1] = 34;
     assert!(f5.ptr[0] == 1);
     assert!(f5.ptr[1] == 34);
     assert!(f5.ptr[2] == 3);
 
     // Zero size vec.
-    let f5: &Fat<[int]> = &Fat { f1: 5, f2: "some str", ptr: [] };
+    let f5: &Fat<[isize]> = &Fat { f1: 5, f2: "some str", ptr: [] };
     assert!(f5.ptr.len() == 0);
     let f5: &Fat<[Bar]> = &Fat { f1: 5, f2: "some str", ptr: [] };
     assert!(f5.ptr.len() == 0);
@@ -108,28 +108,28 @@ pub fn main() {
     foo3(&f1);
     let f2 = &f1;
     foo3(f2);
-    let f3: &Fat<Fat<[int]>> = f2;
+    let f3: &Fat<Fat<[isize]>> = f2;
     foo3(f3);
-    let f4: &Fat<Fat<[int]>> = &f1;
+    let f4: &Fat<Fat<[isize]>> = &f1;
     foo3(f4);
-    let f5: &Fat<Fat<[int]>> =
+    let f5: &Fat<Fat<[isize]>> =
         &Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: [1, 2, 3]} };
     foo3(f5);
 
     // Box.
     let f1 = Box::new([1, 2, 3]);
     assert!((*f1)[1] == 2);
-    let f2: Box<[int]> = f1;
+    let f2: Box<[isize]> = f1;
     assert!((*f2)[1] == 2);
 
     // Nested Box.
-    let f1 : Box<Fat<[int; 3]>> = box Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] };
+    let f1 : Box<Fat<[isize; 3]>> = box Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] };
     foo(&*f1);
-    let f2 : Box<Fat<[int]>> = f1;
+    let f2 : Box<Fat<[isize]>> = f1;
     foo(&*f2);
 
     // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-    let f3 : Box<Fat<[int]>> =
+    let f3 : Box<Fat<[isize]>> =
         Box::<Fat<[_; 3]>>::new(Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] });
     foo(&*f3);
 }
index 3fcbe71df6778d09943388cfdaa72eb36ff7f152..ede4b8c442e17764a6a6fe9dbef27299ecb96100 100644 (file)
@@ -14,7 +14,7 @@
 #![feature(box_syntax)]
 
 struct Fat<T: ?Sized> {
-    f1: int,
+    f1: isize,
     f2: &'static str,
     ptr: T
 }
@@ -24,19 +24,19 @@ struct Fat<T: ?Sized> {
 
 #[derive(Copy, PartialEq, Eq)]
 struct Bar1 {
-    f: int
+    f: isize
 }
 
 trait ToBar {
     fn to_bar(&self) -> Bar;
-    fn to_val(&self) -> int;
+    fn to_val(&self) -> isize;
 }
 
 impl ToBar for Bar {
     fn to_bar(&self) -> Bar {
         *self
     }
-    fn to_val(&self) -> int {
+    fn to_val(&self) -> isize {
         0
     }
 }
@@ -44,7 +44,7 @@ impl ToBar for Bar1 {
     fn to_bar(&self) -> Bar {
         Bar
     }
-    fn to_val(&self) -> int {
+    fn to_val(&self) -> isize {
         self.f
     }
 }
index a8c20dfb8c116fb442ce30a5b31ec3965687ec5d..7bd292e66f2585975499986084be4eb6fd63132d 100644 (file)
@@ -10,5 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
-fn wsucc(n: int) -> int { 0 + { return n + 1 } }
+use std::num::Int;
+
+fn wsucc<T:Int>(n: T) -> T { n + { return n } }
+
 pub fn main() { }
index efe96b96a34c889992212ac9d15b380755952a08..2d2cf6fbf0a7fc60a7672eec85899ae7f1333f9e 100644 (file)
 trait thing<A> {
     fn foo(&self) -> Option<A>;
 }
-impl<A> thing<A> for int {
+impl<A> thing<A> for isize {
     fn foo(&self) -> Option<A> { None }
 }
 fn foo_func<A, B: thing<A>>(x: B) -> Option<A> { x.foo() }
 
-struct A { a: int }
+struct A { a: isize }
 
 pub fn main() {
     let _x: Option<f64> = foo_func(0);
index 881103210e46acd16bceff3cf9b8f878fe964638..757579faa17c7e53370e304557f2fc02a0c05b17 100644 (file)
@@ -13,4 +13,4 @@
 #![allow(unused_mut)]
 
 
-pub fn main() { let mut _v: Vec<int> = Vec::new(); }
+pub fn main() { let mut _v: Vec<isize> = Vec::new(); }
index 95af729e5e16545d88022e321a1b84e4d4bdde11..ff2a70467ea889ca6ac86d11237b5f835202155c 100644 (file)
@@ -13,7 +13,7 @@ enum chan { chan_t, }
 
 impl PartialEq for chan {
     fn eq(&self, other: &chan) -> bool {
-        ((*self) as uint) == ((*other) as uint)
+        ((*self) as usize) == ((*other) as usize)
     }
     fn ne(&self, other: &chan) -> bool { !(*self).eq(other) }
 }
index ecab52326446ecc0f6161b37f7da4b7e4cdc247f..df779d0d713fd5ab1a016e66553e9cb3c9ad3f5f 100644 (file)
 
 use std::mem;
 
-fn addr_of<T>(ptr: &T) -> uint {
-    ptr as *const T as uint
+fn addr_of<T>(ptr: &T) -> usize {
+    ptr as *const T as usize
 }
 
 fn is_aligned<T>(ptr: &T) -> bool {
     unsafe {
-        let addr: uint = mem::transmute(ptr);
+        let addr: usize = mem::transmute(ptr);
         (addr % mem::min_align_of::<T>()) == 0
     }
 }
index 2920fd4f734ac5c841ed338daae6844f1931e97a..f129a5153414306773a3f7565dbd39207b8b06d6 100644 (file)
@@ -31,11 +31,11 @@ enum Foo {
 }
 
 #[inline(never)]
-extern "C" fn foo(_x: uint) -> Foo { Foo::B }
+extern "C" fn foo(_x: usize) -> Foo { Foo::B }
 
 pub fn main() {
   unsafe {
-    let f: extern "C" fn(uint) -> u32 = ::std::mem::transmute(foo);
+    let f: extern "C" fn(usize) -> u32 = ::std::mem::transmute(foo);
     assert_eq!(f(0xDEADBEEF), Foo::B as u32);
   }
 }
index a1224b93418b59ae38ec6fca29ca993b0016ecfc..5c01d544cf533f4739982f8962ffc134c8463e5d 100644 (file)
@@ -27,6 +27,6 @@ enum Hero {
 pub fn main() {
     let pet: Animal = Animal::Snake;
     let hero: Hero = Hero::Superman;
-    assert!(pet as uint == 3);
-    assert!(hero as int == -2);
+    assert!(pet as usize == 3);
+    assert!(hero as isize == -2);
 }
index 323b349643d0e75536e12f91e7803f5cbcffc136..b23cfa9f32b8e02bf72f0548d66a456edd0e7a1c 100644 (file)
@@ -60,13 +60,13 @@ enum Eu64 {
     Bu64 = 1
 }
 
-#[repr(int)]
+#[repr(isize)]
 enum Eint {
     Aint = 0,
     Bint = 1
 }
 
-#[repr(uint)]
+#[repr(usize)]
 enum Euint {
     Auint = 0,
     Buint = 1
@@ -81,6 +81,6 @@ pub fn main() {
     assert_eq!(size_of::<Eu32>(), 4);
     assert_eq!(size_of::<Ei64>(), 8);
     assert_eq!(size_of::<Eu64>(), 8);
-    assert_eq!(size_of::<Eint>(), size_of::<int>());
-    assert_eq!(size_of::<Euint>(), size_of::<uint>());
+    assert_eq!(size_of::<Eint>(), size_of::<isize>());
+    assert_eq!(size_of::<Euint>(), size_of::<usize>());
 }
index 533d328628a7a93a3cb7e693dc648f1e9c7f36c5..9a2f45d00790e5898852b8bfb4fe41c9aef43ccc 100644 (file)
@@ -21,6 +21,6 @@ pub fn main() {
     test_color(color::imaginary, -1, "imaginary".to_string());
 }
 
-fn test_color(color: color, val: int, _name: String) {
-    assert!(color as int == val);
+fn test_color(color: color, val: isize, _name: String) {
+    assert!(color as isize == val);
 }
index b8819ab61e8992a79fe53baae369258433db7f72..9fc799a97f6b9011eef59a511d109f5f639e8fbc 100644 (file)
@@ -23,13 +23,13 @@ trait Trait { fn dummy(&self) { } }
 
 fn main() {
     // Functions
-    assert_eq!(size_of::<fn(int)>(), size_of::<Option<fn(int)>>());
-    assert_eq!(size_of::<extern "C" fn(int)>(), size_of::<Option<extern "C" fn(int)>>());
+    assert_eq!(size_of::<fn(isize)>(), size_of::<Option<fn(isize)>>());
+    assert_eq!(size_of::<extern "C" fn(isize)>(), size_of::<Option<extern "C" fn(isize)>>());
 
     // Slices - &str / &[T] / &mut [T]
     assert_eq!(size_of::<&str>(), size_of::<Option<&str>>());
-    assert_eq!(size_of::<&[int]>(), size_of::<Option<&[int]>>());
-    assert_eq!(size_of::<&mut [int]>(), size_of::<Option<&mut [int]>>());
+    assert_eq!(size_of::<&[isize]>(), size_of::<Option<&[isize]>>());
+    assert_eq!(size_of::<&mut [isize]>(), size_of::<Option<&mut [isize]>>());
 
     // Traits - Box<Trait> / &Trait / &mut Trait
     assert_eq!(size_of::<Box<Trait>>(), size_of::<Option<Box<Trait>>>());
@@ -37,33 +37,33 @@ fn main() {
     assert_eq!(size_of::<&mut Trait>(), size_of::<Option<&mut Trait>>());
 
     // Pointers - Box<T>
-    assert_eq!(size_of::<Box<int>>(), size_of::<Option<Box<int>>>());
+    assert_eq!(size_of::<Box<isize>>(), size_of::<Option<Box<isize>>>());
 
     // The optimization can't apply to raw pointers
-    assert!(size_of::<Option<*const int>>() != size_of::<*const int>());
-    assert!(Some(0 as *const int).is_some()); // Can't collapse None to null
+    assert!(size_of::<Option<*const isize>>() != size_of::<*const isize>());
+    assert!(Some(0 as *const isize).is_some()); // Can't collapse None to null
 
     struct Foo {
-        _a: Box<int>
+        _a: Box<isize>
     }
-    struct Bar(Box<int>);
+    struct Bar(Box<isize>);
 
     // Should apply through structs
     assert_eq!(size_of::<Foo>(), size_of::<Option<Foo>>());
     assert_eq!(size_of::<Bar>(), size_of::<Option<Bar>>());
     // and tuples
-    assert_eq!(size_of::<(u8, Box<int>)>(), size_of::<Option<(u8, Box<int>)>>());
+    assert_eq!(size_of::<(u8, Box<isize>)>(), size_of::<Option<(u8, Box<isize>)>>());
     // and fixed-size arrays
-    assert_eq!(size_of::<[Box<int>; 1]>(), size_of::<Option<[Box<int>; 1]>>());
+    assert_eq!(size_of::<[Box<isize>; 1]>(), size_of::<Option<[Box<isize>; 1]>>());
 
     // Should apply to NonZero
-    assert_eq!(size_of::<NonZero<uint>>(), size_of::<Option<NonZero<uint>>>());
+    assert_eq!(size_of::<NonZero<usize>>(), size_of::<Option<NonZero<usize>>>());
     assert_eq!(size_of::<NonZero<*mut i8>>(), size_of::<Option<NonZero<*mut i8>>>());
 
     // Should apply to types that use NonZero internally
-    assert_eq!(size_of::<Vec<int>>(), size_of::<Option<Vec<int>>>());
-    assert_eq!(size_of::<Arc<int>>(), size_of::<Option<Arc<int>>>());
-    assert_eq!(size_of::<Rc<int>>(), size_of::<Option<Rc<int>>>());
+    assert_eq!(size_of::<Vec<isize>>(), size_of::<Option<Vec<isize>>>());
+    assert_eq!(size_of::<Arc<isize>>(), size_of::<Option<Arc<isize>>>());
+    assert_eq!(size_of::<Rc<isize>>(), size_of::<Option<Rc<isize>>>());
 
     // Should apply to types that have NonZero transitively
     assert_eq!(size_of::<String>(), size_of::<Option<String>>());
index 2284c1427c046cd95636a3a89962f3e8a3bd0c4b..3a7c7ea9a714b76fe995b72a30bc90cb8a9b8529 100644 (file)
@@ -13,7 +13,7 @@
 use std::result::Result;
 use std::result::Result::Ok;
 
-static C: Result<(), Box<int>> = Ok(());
+static C: Result<(), Box<isize>> = Ok(());
 
 // This is because of yet another bad assertion (ICE) about the null side of a nullable enum.
 // So we won't actually compile if the bug is present, but we check the value in main anyway.
index 39ab8316958a65b653ce9a83b157d791027d7a1a..0bf5df5d61021f204df4adc8ed402780ff5c6653 100644 (file)
@@ -17,26 +17,26 @@ enum Enum1 { }
 
 enum Enum2 { A, B, C }
 
-enum Enum3 { D(int), E, F }
+enum Enum3 { D(isize), E, F }
 
-enum Enum4 { H(int), I(int), J }
+enum Enum4 { H(isize), I(isize), J }
 
 enum Enum5 { //~ ERROR three times larger
-    L(int, int, int, int), //~ NOTE this variant is the largest
-    M(int),
+    L(isize, isize, isize, isize), //~ NOTE this variant is the largest
+    M(isize),
     N
 }
 
 enum Enum6<T, U> {
     O(T),
     P(U),
-    Q(int)
+    Q(isize)
 }
 
 #[allow(enum_size_variance)]
 enum Enum7 {
-    R(int, int, int, int),
-    S(int),
+    R(isize, isize, isize, isize),
+    S(isize),
     T
 }
 pub fn main() { }
index 5be8ca6c6cb48ea883c612ad8bfea01ad54957de..037ee5f77775886762457a3de5fb98460ec93651 100644 (file)
@@ -14,13 +14,13 @@ enum Flopsy {
     Bunny = 2
 }
 
-const BAR:uint = Flopsy::Bunny as uint;
-const BAR2:uint = BAR;
+const BAR:usize = Flopsy::Bunny as usize;
+const BAR2:usize = BAR;
 
 pub fn main() {
-    let _v = [0;  Flopsy::Bunny as uint];
+    let _v = [0;  Flopsy::Bunny as usize];
     let _v = [0;  BAR];
     let _v = [0;  BAR2];
-    const BAR3:uint = BAR2;
+    const BAR3:usize = BAR2;
     let _v = [0;  BAR3];
 }
index 28b5f781b5cfd7d962cd5d6b434e8adf35ac58f9..b3771f38482ba3331742ac714ccb7265809fafd0 100644 (file)
 // Doesn't work; needs a design decision.
 
 pub fn main() {
-    let x : [int; 5] = [1,2,3,4,5];
-    let _y : [int; 5] = [1,2,3,4,5];
+    let x : [isize; 5] = [1,2,3,4,5];
+    let _y : [isize; 5] = [1,2,3,4,5];
     let mut z = [1,2,3,4,5];
     z = x;
     assert_eq!(z[0], 1);
     assert_eq!(z[4], 5);
 
-    let a : [int; 5] = [1,1,1,1,1];
-    let b : [int; 5] = [2,2,2,2,2];
-    let c : [int; 5] = [2,2,2,2,3];
+    let a : [isize; 5] = [1,1,1,1,1];
+    let b : [isize; 5] = [2,2,2,2,2];
+    let c : [isize; 5] = [2,2,2,2,3];
 
     log(debug, a);
 
index 734ac3066534e3d00207730351c1d5333b3e0a90..52ccbe52d460e5ca8ecaff70ec69bc921ae954bd 100644 (file)
 #![allow(dead_assignment)]
 
 pub fn main() {
-    let x : &[int] = &[1,2,3,4,5];
-    let mut z : &[int] = &[1,2,3,4,5];
+    let x : &[isize] = &[1,2,3,4,5];
+    let mut z : &[isize] = &[1,2,3,4,5];
     z = x;
     assert_eq!(z[0], 1);
     assert_eq!(z[4], 5);
 
-    let a : &[int] = &[1,1,1,1,1];
-    let b : &[int] = &[2,2,2,2,2];
-    let c : &[int] = &[2,2,2,2,3];
-    let cc : &[int] = &[2,2,2,2,2,2];
+    let a : &[isize] = &[1,1,1,1,1];
+    let b : &[isize] = &[2,2,2,2,2];
+    let c : &[isize] = &[2,2,2,2,3];
+    let cc : &[isize] = &[2,2,2,2,2,2];
 
     println!("{:?}", a);
 
index 6029b488f0867271872baf4e7c7a24ada62266c5..fa3970b62805b808dd533260d80ddb5cd702fc0e 100644 (file)
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    let x: int = 8;
+    let x: isize = 8;
     let y = 9;
     x + y;
 
-    let q: int = -8;
+    let q: isize = -8;
     let r = -9;
     q + r;
 }
index 4fcac31c533a5221b5246eed27c5a73c4aeaaa06..cb3a28d19d2e53c1fc8882fcd4651615a9b86f1c 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct Box {
-    x: uint
+    x: usize
 }
 
 impl Box {
-    pub fn set_many(&mut self, xs: &[uint]) {
+    pub fn set_many(&mut self, xs: &[usize]) {
         for x in xs { self.x = *x; }
     }
 }
index c4b8099e8501cf9dbd7d41501af3d9c96bf7ce18..25f09ee94b019db62ca375efd0dc8150f421642e 100644 (file)
@@ -14,7 +14,7 @@
 #![feature(box_syntax)]
 
 #[derive(Copy)]
-struct LM { resize_at: uint, size: uint }
+struct LM { resize_at: usize, size: usize }
 
 enum HashMap<K,V> {
     HashMap_(LM, Vec<(K,V)>)
@@ -27,7 +27,7 @@ fn linear_map<K,V>() -> HashMap<K,V> {
 }
 
 impl<K,V> HashMap<K,V> {
-    pub fn len(&mut self) -> uint {
+    pub fn len(&mut self) -> usize {
         match *self {
             HashMap::HashMap_(ref l, _) => l.size
         }
index ce0cdf0d2496b389a15c83e5b5a45d62abca0882..08ea638f93a56bc163e2d8e7a18c1f50ebb0469b 100644 (file)
@@ -18,7 +18,7 @@ trait Foo {
 }
 
 struct S {
-    x: int
+    x: isize
 }
 
 impl Foo for S {
index 1d013c3abc81b521b5be30a4f559b580438af48f..b81090555ea64ab89bbd64e60a5b1280fe2be645 100644 (file)
@@ -52,7 +52,7 @@ struct thing {
 
 #[derive(Clone)]
 struct A {
-    a: int
+    a: isize
 }
 
 fn thing(x: A) -> thing {
@@ -62,10 +62,10 @@ fn thing(x: A) -> thing {
 }
 
 impl thing {
-    pub fn bar(self: Box<thing>) -> int { self.x.a }
-    pub fn quux(&self) -> int { self.x.a }
+    pub fn bar(self: Box<thing>) -> isize { self.x.a }
+    pub fn quux(&self) -> isize { self.x.a }
     pub fn baz<'a>(&'a self) -> &'a A { &self.x }
-    pub fn spam(self) -> int { self.x.a }
+    pub fn spam(self) -> isize { self.x.a }
 }
 
 trait Nus { fn f(&self); }
index debe9b0ddf18aed96e413c63b1a3128e0ecad5e8..4f821ebcc185a67493d49c341d156724c16b9dce 100644 (file)
@@ -18,7 +18,7 @@
 mod foo {
     use foo::bar::*;
     pub mod bar {
-        pub static a : int = 10;
+        pub static a : isize = 10;
     }
     pub fn zum() {
         let _b = a;
index 821dfbec0be628d31619fa18d8c7e60943ec6511..c88721471b64cbed03eb749f58671e2e83b1fefb 100644 (file)
@@ -13,7 +13,7 @@
 // pretty-expanded FIXME #23616
 
 fn test_fn() {
-    fn ten() -> int { return 10; }
+    fn ten() -> isize { return 10; }
     let rs = ten;
     assert!((rs() == 10));
 }
index 81d4078a3e9572f949f793f2550fd80334a9224a..bd2936773953ba477574b6c9aa3e125ca1323b6b 100644 (file)
@@ -19,8 +19,8 @@ fn test_generic<T, F>(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> boo
 }
 
 fn test_vec() {
-    fn compare_vec(v1: Box<int>, v2: Box<int>) -> bool { return v1 == v2; }
-    test_generic::<Box<int>, _>(box 1, compare_vec);
+    fn compare_vec(v1: Box<isize>, v2: Box<isize>) -> bool { return v1 == v2; }
+    test_generic::<Box<isize>, _>(box 1, compare_vec);
 }
 
 pub fn main() { test_vec(); }
index e4040238cd53bd35037ebffe237787ac041810ce..d26c6e62f536eb74a01bed7605ed9734aab964c6 100644 (file)
@@ -22,8 +22,8 @@ fn test_bool() {
 
 #[derive(Clone)]
 struct Pair {
-    a: int,
-    b: int,
+    a: isize,
+    b: isize,
 }
 
 fn test_rec() {
index 5f4515924e7119d8dff2f5c81113acfbd43fc97b..57b5a426f5c5cd8592038c756b29a316dcf6d0b0 100644 (file)
@@ -12,8 +12,8 @@
 
 // pretty-expanded FIXME #23616
 
-struct A { a: int }
-struct V { v: int }
+struct A { a: isize }
+struct V { v: isize }
 
 pub fn main() {
     let a = { let b = A {a: 3}; b };
index dd4c4d0cd73dca30b33869dde4ebfb638805664e..64f86237ab3bb03d5d425022969a61cdf165ffde 100644 (file)
@@ -17,7 +17,7 @@
 
 fn test_basic() { let rs: bool = { true }; assert!((rs)); }
 
-struct RS { v1: int, v2: int }
+struct RS { v1: isize, v2: isize }
 
 fn test_rec() { let rs = { RS {v1: 10, v2: 20} }; assert!((rs.v2 == 20)); }
 
index f236f6999383abdbaff9d32ddcfdfa1708f34a67..80729fb2164745470106078153b0642337db7066 100644 (file)
@@ -16,7 +16,7 @@ fn f(arg: &mut A) {
 }
 
 #[derive(Copy)]
-struct A { a: int }
+struct A { a: isize }
 
 pub fn main() {
     let mut x = A {a: 10};
index 51ef5f00ab70b119b5242caf7900fffd6c880188..0c9151cec7df4b007df955ec6b4695964425a6d9 100644 (file)
 // pretty-expanded FIXME #23616
 
 fn test_int() {
-    fn f() -> int { 10 }
+    fn f() -> isize { 10 }
     assert_eq!(f(), 10);
 }
 
 fn test_vec() {
-    fn f() -> Vec<int> { vec!(10, 11) }
+    fn f() -> Vec<isize> { vec!(10, 11) }
     let vect = f();
     assert_eq!(vect[1], 11);
 }
@@ -28,22 +28,22 @@ fn f<T>(t: T) -> T { t }
 }
 
 fn test_alt() {
-    fn f() -> int { match true { false => { 10 } true => { 20 } } }
+    fn f() -> isize { match true { false => { 10 } true => { 20 } } }
     assert_eq!(f(), 20);
 }
 
 fn test_if() {
-    fn f() -> int { if true { 10 } else { 20 } }
+    fn f() -> isize { if true { 10 } else { 20 } }
     assert_eq!(f(), 10);
 }
 
 fn test_block() {
-    fn f() -> int { { 10 } }
+    fn f() -> isize { { 10 } }
     assert_eq!(f(), 10);
 }
 
 fn test_ret() {
-    fn f() -> int {
+    fn f() -> isize {
         return 10 // no semi
 
     }
@@ -53,7 +53,7 @@ fn f() -> int {
 
 // From issue #372
 fn test_372() {
-    fn f() -> int { let x = { 3 }; x }
+    fn f() -> isize { let x = { 3 }; x }
     assert_eq!(f(), 3);
 }
 
index 3f1c059ffee9270c5eb70f2ec344e4605ca7f8f7..47e79de6b11246bcda2dd5e7ecb8b9a71475dff8 100644 (file)
@@ -25,8 +25,8 @@ fn test_bool() {
 
 #[derive(Clone)]
 struct Pair {
-    a: int,
-    b: int,
+    a: isize,
+    b: isize,
 }
 
 fn test_rec() {
index ee2c07150435e9cb9a51e7fec7d3da6ef285a0c9..ad39783063854a1c0f72d5c5e878440d23b7428e 100644 (file)
@@ -15,7 +15,7 @@
 // Tests for if as expressions returning nominal types
 
 #[derive(Copy)]
-struct I { i: int }
+struct I { i: isize }
 
 fn test_rec() {
     let rs = if true { I {i: 100} } else { I {i: 101} };
@@ -27,7 +27,7 @@ enum mood { happy, sad, }
 
 impl PartialEq for mood {
     fn eq(&self, other: &mood) -> bool {
-        ((*self) as uint) == ((*other) as uint)
+        ((*self) as usize) == ((*other) as usize)
     }
     fn ne(&self, other: &mood) -> bool { !(*self).eq(other) }
 }
index d8e3172ea47c150da02865e2d78f9843a33a4fea..95f47d005d3d60aa9829deac2c466d50e0fd7cbc 100644 (file)
@@ -22,8 +22,8 @@ fn test_generic<T: Clone, F>(expected: T, eq: F) where F: FnOnce(T, T) -> bool {
 }
 
 fn test_vec() {
-    fn compare_box(v1: Box<int>, v2: Box<int>) -> bool { return v1 == v2; }
-    test_generic::<Box<int>, _>(box 1, compare_box);
+    fn compare_box(v1: Box<isize>, v2: Box<isize>) -> bool { return v1 == v2; }
+    test_generic::<Box<isize>, _>(box 1, compare_box);
 }
 
 pub fn main() { test_vec(); }
index 513197be8f31525ce0b2e05d32628768fb60413c..f8e82de9a0a36f1121b6e7b4e55e2b4cc6643679 100644 (file)
@@ -25,8 +25,8 @@ fn test_bool() {
 
 #[derive(Clone)]
 struct Pair {
-    a: int,
-    b: int,
+    a: isize,
+    b: isize,
 }
 
 fn test_rec() {
index e4ce71200b5f315f3425e8e00485305f72972e71..91ad142c3863a7b6aac39c3ac724c17dd0feb180 100644 (file)
@@ -14,7 +14,7 @@
 
 // Tests for match as expressions resulting in struct types
 #[derive(Copy)]
-struct R { i: int }
+struct R { i: isize }
 
 fn test_rec() {
     let rs = match true { true => R {i: 100}, _ => panic!() };
@@ -26,7 +26,7 @@ enum mood { happy, sad, }
 
 impl PartialEq for mood {
     fn eq(&self, other: &mood) -> bool {
-        ((*self) as uint) == ((*other) as uint)
+        ((*self) as usize) == ((*other) as usize)
     }
     fn ne(&self, other: &mood) -> bool { !(*self).eq(other) }
 }
index 8e050aa3f4db765242709cba5c9fac3fd1d8a162..25a990383e412eb19a5bb36970449bc445d6610b 100644 (file)
@@ -14,7 +14,7 @@
 use std::cell::Cell;
 
 #[derive(Copy)]
-struct Point {x: int, y: int, z: int}
+struct Point {x: isize, y: isize, z: isize}
 
 fn f(p: &Cell<Point>) {
     assert!((p.get().z == 12));
index bd05b3ce5a45cdcdb0a3ceb612ff7d1903ad367b..38cd4a8d79d0d3918916b39eb6b35a8c937f8e74 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern fn f(x: uint) -> uint { x * 2 }
+extern fn f(x: usize) -> usize { x * 2 }
 
 pub fn main() {
     let x = f(22);
index 2d633b1de69f67a23aee069027676d6754ea5d58..09411c9c6eb2972e5fcba8c39df1a080317278f1 100644 (file)
 extern fn voidret1() {}
 extern fn voidret2() {}
 
-extern fn uintret() -> uint { 22 }
+extern fn uintret() -> usize { 22 }
 
-extern fn uintvoidret(_x: uint) {}
+extern fn uintvoidret(_x: usize) {}
 
-extern fn uintuintuintuintret(x: uint, y: uint, z: uint) -> uint { x+y+z }
-type uintuintuintuintret = extern fn(uint,uint,uint) -> uint;
+extern fn uintuintuintuintret(x: usize, y: usize, z: usize) -> usize { x+y+z }
+type uintuintuintuintret = extern fn(usize,usize,usize) -> usize;
 
 pub fn main() {
     assert!(voidret1 as extern fn() == voidret1 as extern fn());
     assert!(voidret1 as extern fn() != voidret2 as extern fn());
 
-    assert!(uintret as extern fn() -> uint == uintret as extern fn() -> uint);
+    assert!(uintret as extern fn() -> usize == uintret as extern fn() -> usize);
 
-    assert!(uintvoidret as extern fn(uint) == uintvoidret as extern fn(uint));
+    assert!(uintvoidret as extern fn(usize) == uintvoidret as extern fn(usize));
 
     assert!(uintuintuintuintret as uintuintuintuintret ==
             uintuintuintuintret as uintuintuintuintret);
index 50c070483f6974ad4455c34357735e047f16cfc9..1757ff51fed3f64bcff298ba4905a2ae4ab5ce34 100644 (file)
@@ -10,6 +10,6 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "std" as mystd;
+extern crate std as mystd;
 
 pub fn main() {}
index 172ec2f09050ca8e5bf03a33e386292bba5d06a1..5cb2abbfb0a685d05016010b706131ab3b34de99 100644 (file)
@@ -11,7 +11,7 @@
 
 
 
-fn f(x: int) -> int {
+fn f(x: isize) -> isize {
     // println!("in f:");
 
     println!("{}", x);
@@ -22,7 +22,7 @@ fn f(x: int) -> int {
     } else {
         // println!("recurring");
 
-        let y: int = x * f(x - 1);
+        let y: isize = x * f(x - 1);
         // println!("returned");
 
         println!("{}", y);
index 09683c43ece222826cce557f2682de32014b2d75..900da3c2d6ab29830790a3ac7975d2d13be14242 100644 (file)
@@ -32,12 +32,12 @@ fn deref_mut<'a>(&'a mut self) -> &'a mut T {
 }
 
 struct Point {
-    x: int,
-    y: int
+    x: isize,
+    y: isize
 }
 
 impl Point {
-    fn get(&mut self) -> (int, int) {
+    fn get(&mut self) -> (isize, isize) {
         (self.x, self.y)
     }
 }
index 0fd0f6a110d56fb735a75144952ee468bdaf9bdc..d83dc7858056f38ddd76f0f752f8d461e6038e30 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn f(i: int, called: &mut bool) {
+fn f(i: isize, called: &mut bool) {
     assert_eq!(i, 10);
     *called = true;
 }
 
-fn g(f: fn(int, v: &mut bool), called: &mut bool) {
+fn g(f: fn(isize, v: &mut bool), called: &mut bool) {
     f(10, called);
 }
 
index b373294e243f21083bfcebdacdfb1a3c13ebe3bf..117cf13584f18ee35aa6f74081d2c69cefc39344 100644 (file)
@@ -14,5 +14,5 @@
 
 pub fn main() {
     // Bare functions should just be a pointer
-    assert_eq!(mem::size_of::<extern "Rust" fn()>(), mem::size_of::<int>());
+    assert_eq!(mem::size_of::<extern "Rust" fn()>(), mem::size_of::<isize>());
 }
index 8a16724561025f31e5a8f6f0c4e93ce11485f027..0a3c8916270683e8b5136a7542a42873e2a30246 100644 (file)
@@ -16,7 +16,7 @@ fn spawn<T:Send>(val: T, f: fn(T)) {
     f(val);
 }
 
-fn f(i: int) {
+fn f(i: isize) {
     assert_eq!(i, 100);
 }
 
index 7f9248f4d2ac2a40d23668d4244615ff9d76107a..f8b1582c515776756907889a4359f386b190c3cb 100644 (file)
@@ -12,9 +12,9 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo(x: int) -> int { x * 2 }
-fn bar(x: int) -> int { x * 4 }
-type IntMap = fn(int) -> int;
+fn foo(x: isize) -> isize { x * 2 }
+fn bar(x: isize) -> isize { x * 4 }
+type IntMap = fn(isize) -> isize;
 
 fn eq<T>(x: T, y: T) { }
 
index 34489555dbc203b9b56050a0bafeb2f1e7028b35..67899bfd683d861428ba2497c3bcbf87042c8781 100644 (file)
@@ -12,9 +12,9 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo(x: int) -> int { x * 2 }
-fn bar(x: int) -> int { x * 4 }
-type IntMap = fn(int) -> int;
+fn foo(x: isize) -> isize { x * 2 }
+fn bar(x: isize) -> isize { x * 4 }
+type IntMap = fn(isize) -> isize;
 
 fn eq<T>(x: T, y: T) { }
 
index efb58474118a6196426e20e2342a8be928e0bbd5..13c96f43468942f2f21016315a669e87161e228e 100644 (file)
@@ -13,8 +13,8 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo(_f: fn(int) -> int) { }
+fn foo(_f: fn(isize) -> isize) { }
 
-fn id(x: int) -> int { return x; }
+fn id(x: isize) -> isize { return x; }
 
 pub fn main() { foo(id); }
index 4e2c8facaf8202ab01585456b9607c5d3bc3d25b..66a7123c795f7b1c44457bd4e6900c8d8fc1b56c 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 pub fn main() {
-    let v : &[(int,int)] = &[ (1, 2), (3, 4), (5, 6) ];
+    let v : &[(isize,isize)] = &[ (1, 2), (3, 4), (5, 6) ];
     for &(x, y) in v {
         println!("{}", y);
         println!("{}", x);
index 2287df4b1055299351f1691b2e466d872fa49ea8..352d0b13c640775631c707f877111711c7cef6a3 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    let f = |(x, y): (int, int)| {
+    let f = |(x, y): (isize, isize)| {
         assert_eq!(x, 1);
         assert_eq!(y, 2);
     };
index 2db01b1aa40671e4c5319ae417bdf94a22e6e941..9d8c432e98209eadccbb7a9dc27a29804deec3b4 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct Pair { x: int, y: int }
+struct Pair { x: isize, y: isize }
 
 pub fn main() {
     for elt in &(vec!(Pair {x: 10, y: 20}, Pair {x: 30, y: 0})) {
index 8784af1888648990ab81e414372a0aca94eac14e..4b6b6dcf1d555f365523a53b4f3e22c43eb87be8 100644 (file)
@@ -15,7 +15,7 @@ enum BogusOption<T> {
     Some(T),
 }
 
-type Iterator = int;
+type Iterator = isize;
 
 pub fn main() {
     let x = [ 3, 3, 3 ];
index 769d9116f5a8100667b39c16a8d0478a1ee25795..6deaec1905960abf1d8fb1ecf7e4bd4dd4fe8cba 100644 (file)
@@ -13,7 +13,7 @@
 #![feature(lang_items, start, no_std, core, collections)]
 #![no_std]
 
-extern crate "std" as other;
+extern crate std as other;
 
 #[macro_use] extern crate core;
 #[macro_use] extern crate collections;
@@ -21,7 +21,7 @@
 use core::slice::SliceExt;
 
 #[start]
-fn start(_argc: int, _argv: *const *const u8) -> int {
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
     for _ in [1,2,3].iter() { }
     0
 }
index 7664e74cd33badaf0f0bb73c40ac4fbd7cffc15b..908932fe396bee513416d8e2390a748a52cedbf3 100644 (file)
@@ -11,4 +11,4 @@
 
 // pretty-expanded FIXME #23616
 
-pub fn main() { let x: Vec<int> = Vec::new(); for _ in &x { panic!("moop"); } }
+pub fn main() { let x: Vec<isize> = Vec::new(); for _ in &x { panic!("moop"); } }
index 45e57e8a7e8d36d5af30b687b9679f7bda8bfb07..075539b621ac71ec8b2d080164722cf700ba86ca 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn two<F>(mut it: F) where F: FnMut(int) { it(0); it(1); }
+fn two<F>(mut it: F) where F: FnMut(isize) { it(0); it(1); }
 
 pub fn main() {
-    let mut a: Vec<int> = vec!(-1, -1, -1, -1);
-    let mut p: int = 0;
+    let mut a: Vec<isize> = vec!(-1, -1, -1, -1);
+    let mut p: isize = 0;
     two(|i| {
-        two(|j| { a[p as uint] = 10 * i + j; p += 1; })
+        two(|j| { a[p as usize] = 10 * i + j; p += 1; })
     });
     assert_eq!(a[0], 0);
     assert_eq!(a[1], 1);
index 029dddb7a21109734d92a3f14d05dc7f6cb0da24..028e31d76aa8070cdc6e03c7d1b0d5a71178868b 100644 (file)
 
 
 
-fn pairs<F>(mut it: F) where F: FnMut((int, int)) {
-    let mut i: int = 0;
-    let mut j: int = 0;
+fn pairs<F>(mut it: F) where F: FnMut((isize, isize)) {
+    let mut i: isize = 0;
+    let mut j: isize = 0;
     while i < 10 { it((i, j)); i += 1; j += i; }
 }
 
 pub fn main() {
-    let mut i: int = 10;
-    let mut j: int = 0;
+    let mut i: isize = 10;
+    let mut j: isize = 0;
     pairs(|p| {
         let (_0, _1) = p;
         println!("{}", _0);
index 9ccb2dd56cfdcd20ecc7b2df910c038d60e956c7..674c2e344823d20145eaea5a9f3e91a597e8c2ac 100644 (file)
 
 
 pub fn main() {
-    let mut sum: int = 0;
+    let mut sum: isize = 0;
     first_ten(|i| { println!("main"); println!("{}", i); sum = sum + i; });
     println!("sum");
     println!("{}", sum);
     assert_eq!(sum, 45);
 }
 
-fn first_ten<F>(mut it: F) where F: FnMut(int) {
-    let mut i: int = 0;
+fn first_ten<F>(mut it: F) where F: FnMut(isize) {
+    let mut i: isize = 0;
     while i < 10 { println!("first_ten"); it(i); i = i + 1; }
 }
index 3c5abba902dc15dea3b37d8a9a56f414bcab9ec2..2d3ff62a00537e6744b238e76a5932144b70bb4c 100644 (file)
@@ -33,7 +33,7 @@ pub fn main() {
 
 extern fn callback(data: libc::uintptr_t) {
     unsafe {
-        let data: *const int = mem::transmute(data);
+        let data: *const isize = mem::transmute(data);
         assert_eq!(*data, 100);
     }
 }
index b7fe3705e10a5a31b328d23411ba6ce6727ea488..5db83d50b61ec52ffb0bb4690ea04a7675bc8809 100644 (file)
@@ -25,11 +25,11 @@ mod mlibc {
     }
 }
 
-fn strlen(str: String) -> uint {
+fn strlen(str: String) -> usize {
     // C string is terminated with a zero
     let s = CString::new(str).unwrap();
     unsafe {
-        mlibc::my_strlen(s.as_ptr()) as uint
+        mlibc::my_strlen(s.as_ptr()) as usize
     }
 }
 
index 71934b42c33f510ed8bf9befe8fe1f6a1508982b..9204cdfd755b63ab552a85b88e8e1782b0274ca4 100644 (file)
@@ -13,7 +13,7 @@
 #![feature(lang_items, start, no_std, core, collections)]
 #![no_std]
 
-extern crate "std" as other;
+extern crate std as other;
 
 #[macro_use] extern crate core;
 #[macro_use] extern crate collections;
@@ -21,7 +21,7 @@
 use collections::string::ToString;
 
 #[start]
-fn start(_argc: int, _argv: *const *const u8) -> int {
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
     let s = format!("{}", 1_isize);
     assert_eq!(s, "1".to_string());
 
index e04fa36d80b4c8dfd3902445d7de6ae701bdcfc1..fecaf279d043d555e53b6bab600eb68c5361b215 100644 (file)
 
 use std::marker::NoCopy as NP;
 
-struct ncint { np: NP, v: int }
-fn ncint(v: int) -> ncint { ncint { np: NP, v: v } }
+struct ncint { np: NP, v: isize }
+fn ncint(v: isize) -> ncint { ncint { np: NP, v: v } }
 
-struct NoFoo { copied: int, nocopy: ncint, }
+struct NoFoo { copied: isize, nocopy: ncint, }
 impl NoFoo {
-    fn new(x:int,y:int) -> NoFoo { NoFoo { copied: x, nocopy: ncint(y) } }
+    fn new(x:isize,y:isize) -> NoFoo { NoFoo { copied: x, nocopy: ncint(y) } }
 }
 
-struct MoveFoo { copied: int, moved: Box<int>, }
+struct MoveFoo { copied: isize, moved: Box<isize>, }
 impl MoveFoo {
-    fn new(x:int,y:int) -> MoveFoo { MoveFoo { copied: x, moved: box y } }
+    fn new(x:isize,y:isize) -> MoveFoo { MoveFoo { copied: x, moved: box y } }
 }
 
 struct DropNoFoo { inner: NoFoo }
 impl DropNoFoo {
-    fn new(x:int,y:int) -> DropNoFoo { DropNoFoo { inner: NoFoo::new(x,y) } }
+    fn new(x:isize,y:isize) -> DropNoFoo { DropNoFoo { inner: NoFoo::new(x,y) } }
 }
 impl Drop for DropNoFoo { fn drop(&mut self) { } }
 
 struct DropMoveFoo { inner: MoveFoo }
 impl DropMoveFoo {
-    fn new(x:int,y:int) -> DropMoveFoo { DropMoveFoo { inner: MoveFoo::new(x,y) } }
+    fn new(x:isize,y:isize) -> DropMoveFoo { DropMoveFoo { inner: MoveFoo::new(x,y) } }
 }
 impl Drop for DropMoveFoo { fn drop(&mut self) { } }
 
index 526787c8b9c9e46c11204ac3dddca9c9bf344cb8..0fe4bbcb7a2281e4620ca1119c09590d9f8a1868 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn ho<F>(f: F) -> int where F: FnOnce(int) -> int { let n: int = f(3); return n; }
+fn ho<F>(f: F) -> isize where F: FnOnce(isize) -> isize { let n: isize = f(3); return n; }
 
-fn direct(x: int) -> int { return x + 1; }
+fn direct(x: isize) -> isize { return x + 1; }
 
 pub fn main() {
-    let a: int = direct(3); // direct
-    let b: int = ho(direct); // indirect unbound
+    let a: isize = direct(3); // direct
+    let b: isize = ho(direct); // indirect unbound
 
     assert_eq!(a, b);
 }
index b04377d3616c44966bc3d87f1e39c337f2546673..48dfcb73da45ca88cae215ddb941a387a258d05d 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn f() -> int { return 42; }
+fn f() -> isize { return 42; }
 
 pub fn main() {
-    let g: fn() -> int = f;
-    let i: int = g();
+    let g: fn() -> isize = f;
+    let i: isize = g();
     assert_eq!(i, 42);
 }
index 4476ce309c478e63cdf956cbbf0d994686ba35bb..28337237085236c6728a57398b86fef4fbdf1d7a 100644 (file)
 #![feature(box_syntax)]
 
 struct Foo {
-    x: Box<uint>,
-    y: Box<uint>,
+    x: Box<usize>,
+    y: Box<usize>,
 }
 
-fn foo(Foo {x, ..}: Foo) -> *const uint {
-    let addr: *const uint = &*x;
+fn foo(Foo {x, ..}: Foo) -> *const usize {
+    let addr: *const usize = &*x;
     addr
 }
 
 pub fn main() {
     let obj: Box<_> = box 1;
-    let objptr: *const uint = &*obj;
+    let objptr: *const usize = &*obj;
     let f = Foo {x: obj, y: box 2};
     let xptr = foo(f);
     assert_eq!(objptr, xptr);
index 5893eec63f02754482387ce6d05f13727fbf1510..fcc00afb00bdba58aa19fca2e40ef12438ee5df5 100644 (file)
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 
-fn getaddr(box ref x: Box<uint>) -> *const uint {
-    let addr: *const uint = &*x;
+fn getaddr(box ref x: Box<usize>) -> *const usize {
+    let addr: *const usize = &*x;
     addr
 }
 
-fn checkval(box ref x: Box<uint>) -> uint {
+fn checkval(box ref x: Box<usize>) -> usize {
     *x
 }
 
 pub fn main() {
     let obj: Box<_> = box 1;
-    let objptr: *const uint = &*obj;
+    let objptr: *const usize = &*obj;
     let xptr = getaddr(obj);
     assert_eq!(objptr, xptr);
 
index 2eb6279455ea3cffb83aeac0abe58e481c04faa1..4f74ca0ff721597cb1b4baf8c0fcd3ee7661644b 100644 (file)
@@ -13,7 +13,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo((x, _): (int, int)) -> int {
+fn foo((x, _): (isize, isize)) -> isize {
     x
 }
 
index 8c686aba5f358d37df243008f0c4f0d828fc0305..240d49d718f331e84e0f6bac6e806fb45319ae69 100644 (file)
@@ -10,8 +10,8 @@
 
 #[derive(Debug)]
 struct Foo {
-    x: int,
-    y: int
+    x: isize,
+    y: isize
 }
 
 pub fn main() {
index 42062b89cfd2fe459eb7d2c86612ec88cab8a7dc..b8d7c2140be6fcb5caf82718c0d27915a3a2018d 100644 (file)
@@ -15,7 +15,7 @@
 
 pub fn main() {
     let expected: Box<_> = box 100;
-    let actual = id::<Box<int>>(expected.clone());
+    let actual = id::<Box<isize>>(expected.clone());
     println!("{}", *actual);
     assert_eq!(*expected, *actual);
 }
index c76d942575c425608f375507f747a4f68dba6c22..4cf9f93bcaccf642ebc72709d4c3cbbfb326cfe3 100644 (file)
@@ -19,8 +19,8 @@
 struct Foo;
 
 fn main() {
-    let _a = Vec::<int>(None);
-    let _b = Vec::<int, default_type_params_xc::FakeHeap>(None);
-    let _c = default_type_params_xc::FakeVec::<int> { f: None };
-    let _d = default_type_params_xc::FakeVec::<int, Foo> { f: None };
+    let _a = Vec::<isize>(None);
+    let _b = Vec::<isize, default_type_params_xc::FakeHeap>(None);
+    let _c = default_type_params_xc::FakeVec::<isize> { f: None };
+    let _d = default_type_params_xc::FakeVec::<isize, Foo> { f: None };
 }
index e7ef1d42f5fc14486d2c97c77e7df61eeaa3930d..e30cb7657988d6bfa1c21fe0a61313e8d6c66d82 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct Foo<A = (int, char)> {
+struct Foo<A = (isize, char)> {
     a: A
 }
 
-impl Foo<int> {
-    fn bar_int(&self) -> int {
+impl Foo<isize> {
+    fn bar_int(&self) -> isize {
         self.a
     }
 }
@@ -26,7 +26,7 @@ fn bar_char(&self) -> char {
 
 impl Foo {
     fn bar(&self) {
-        let (i, c): (int, char) = self.a;
+        let (i, c): (isize, char) = self.a;
         assert_eq!(Foo { a: i }.bar_int(), i);
         assert_eq!(Foo { a: c }.bar_char(), c);
     }
@@ -39,7 +39,7 @@ fn baz(&self) -> A {
 }
 
 fn default_foo(x: Foo) {
-    let (i, c): (int, char) = x.a;
+    let (i, c): (isize, char) = x.a;
     assert_eq!(i, 1);
     assert_eq!(c, 'a');
 
index 0db03b46748798f4d7d7f00aad3aac9ca1ab112a..74a71873e287ff276763d850fae2b1eaafed1484 100644 (file)
@@ -22,7 +22,7 @@ fn f<T:Clone>(t: T) -> Pair<T> {
 }
 
 pub fn main() {
-    let b = f::<int>(10);
+    let b = f::<isize>(10);
     println!("{}" ,b.a);
     println!("{}", b.b);
     assert_eq!(b.a, 10);
index 7265b021adc467f052568076d4332d33d97c3dae..0e3ce3869bf7b6da968ff525b48ceb14e40021b2 100644 (file)
@@ -18,7 +18,7 @@ struct Recbox<T> {x: Box<T>}
 fn reclift<T>(t: T) -> Recbox<T> { return Recbox {x: box t}; }
 
 pub fn main() {
-    let foo: int = 17;
-    let rbfoo: Recbox<int> = reclift::<int>(foo);
+    let foo: isize = 17;
+    let rbfoo: Recbox<isize> = reclift::<isize>(foo);
     assert_eq!(*rbfoo.x, foo);
 }
index 4ea05a375d11121b614eb37ca13796ba2e8a790b..7a765703e23a0cedae5dba942f14c287d0e988fa 100644 (file)
 
 #![feature(core)]
 
-use std::num::Int;
+use std::ops::Add;
 
-extern "C" fn foo<T: WrappingOps>(a: T, b: T) -> T { a.wrapping_add(b) }
+extern "C" fn foo<T: Add>(a: T, b: T) -> T::Output { a + b }
 
 fn main() {
-    assert_eq!(99u8, foo(255u8, 100u8));
-    assert_eq!(99u16, foo(65535u16, 100u16));
+    assert_eq!(100u8, foo(0u8, 100u8));
+    assert_eq!(100u16, foo(0u16, 100u16));
 }
index 0eb17c41307d0a40985a57a2eb361222897a5e95..e01f507372216273c62a20adc093d24ad1ff8bd5 100644 (file)
@@ -17,4 +17,4 @@
 
 fn id<T>(x: T) -> T { return x; }
 
-pub fn main() { let x: int = 42; let y: int = id(x); assert!((x == y)); }
+pub fn main() { let x: isize = 42; let y: isize = id(x); assert!((x == y)); }
index 04a8824abedcbdc2efc4cf1153b6a4dd3bf75bfb..b37c73f7f759c18e49037f7eaf5f3eb3272c7cce 100644 (file)
@@ -17,4 +17,4 @@ mod foomod {
     pub fn foo<T>() { }
 }
 
-pub fn main() { foomod::foo::<int>(); foomod::foo::<int>(); }
+pub fn main() { foomod::foo::<isize>(); foomod::foo::<isize>(); }
index 8da8c6808478b799daef899eafaacb35802581a8..82b03abf0570b5325d3fe436a0ba554c39cc07b0 100644 (file)
@@ -13,7 +13,7 @@
 fn id<T>(x: T) -> T { return x; }
 
 #[derive(Copy)]
-struct Triple {x: int, y: int, z: int}
+struct Triple {x: isize, y: isize, z: isize}
 
 pub fn main() {
     let mut x = 62;
@@ -22,7 +22,7 @@ pub fn main() {
     let mut b = 'b';
     let p: Triple = Triple {x: 65, y: 66, z: 67};
     let mut q: Triple = Triple {x: 68, y: 69, z: 70};
-    y = id::<int>(x);
+    y = id::<isize>(x);
     println!("{}", y);
     assert_eq!(x, y);
     b = id::<char>(a);
index 4934b9de36c6f7dca266e0b0b76d57829cdf3243..44b32f62f9227742a6664bcfdd5d7c66121ec98f 100644 (file)
@@ -18,17 +18,17 @@ trait Foo<T> {
 }
 
 struct S {
-    x: int
+    x: isize
 }
 
-impl Foo<int> for S {
-    fn get(&self) -> int {
+impl Foo<isize> for S {
+    fn get(&self) -> isize {
         self.x
     }
 }
 
 pub fn main() {
     let x = box S { x: 1 };
-    let y = x as Box<Foo<int>>;
+    let y = x as Box<Foo<isize>>;
     assert_eq!(y.get(), 1);
 }
index 845375d9b840a6c0da7606cd5aea1a7cfbad4160..863e0d7e33332b37d3ff6f075618d9cd9665b912 100644 (file)
@@ -16,9 +16,9 @@
 enum list<T> { cons(Box<T>, Box<list<T>>), nil, }
 
 pub fn main() {
-    let _a: list<int> =
-        list::cons::<int>(box 10,
-        box list::cons::<int>(box 12,
-        box list::cons::<int>(box 13,
-        box list::nil::<int>)));
+    let _a: list<isize> =
+        list::cons::<isize>(box 10,
+        box list::cons::<isize>(box 12,
+        box list::cons::<isize>(box 13,
+        box list::nil::<isize>)));
 }
index 64eb4e498691648adadead8587be98b7cb148872..830c982e13c80662ec898e9cd5d3b1acc6a2072a 100644 (file)
@@ -18,4 +18,4 @@ fn altfoo<T>(f: foo<T>) {
     assert!((hit));
 }
 
-pub fn main() { altfoo::<int>(foo::arm::<int>(10)); }
+pub fn main() { altfoo::<isize>(foo::arm::<isize>(10)); }
index 6ed85588363d1817feccbdc943d887f2444d3493..fef26593eac873dba06a4249883d7fee61f2d4a0 100644 (file)
 
 enum noption<T> { some(T), }
 
-struct Pair { x: int, y: int }
+struct Pair { x: isize, y: isize }
 
 pub fn main() {
-    let nop: noption<int> = noption::some::<int>(5);
-    match nop { noption::some::<int>(n) => { println!("{}", n); assert!((n == 5)); } }
+    let nop: noption<isize> = noption::some::<isize>(5);
+    match nop { noption::some::<isize>(n) => { println!("{}", n); assert!((n == 5)); } }
     let nop2: noption<Pair> = noption::some(Pair{x: 17, y: 42});
     match nop2 {
       noption::some(t) => {
index 38f6707d9eff3be31c4165204e60a6bac3febbaf..942bdb97ba20383b16fcb8fde05ae8d230dde877 100644 (file)
@@ -18,6 +18,6 @@
 enum option<T> { some(Box<T>), none, }
 
 pub fn main() {
-    let mut a: option<int> = option::some::<int>(box 10);
-    a = option::none::<int>;
+    let mut a: option<isize> = option::some::<isize>(box 10);
+    a = option::none::<isize>;
 }
index 3db794d88f025f73c7f7094ce16bc5f0488faafb..8b63fb94b52ee1af23fde8b630ac737fc622de92 100644 (file)
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 
-fn mk() -> int { return 1; }
+fn mk() -> isize { return 1; }
 
-fn chk(a: int) { println!("{}", a); assert!((a == 1)); }
+fn chk(a: isize) { println!("{}", a); assert!((a == 1)); }
 
 fn apply<T>(produce: fn() -> T,
             consume: fn(T)) {
@@ -19,7 +19,7 @@ fn apply<T>(produce: fn() -> T,
 }
 
 pub fn main() {
-    let produce: fn() -> int = mk;
-    let consume: fn(v: int) = chk;
-    apply::<int>(produce, consume);
+    let produce: fn() -> isize = mk;
+    let consume: fn(v: isize) = chk;
+    apply::<isize>(produce, consume);
 }
index 6f93ae0d42bc2e586ab3ff11b8cb39f7407e13d7..73fc3a0d8023629704a796053ffeee9fcefced0c 100644 (file)
@@ -15,7 +15,7 @@
 struct Pair<T> {x: T, y: T}
 
 pub fn main() {
-    let x: Pair<int> = Pair {x: 10, y: 12};
+    let x: Pair<isize> = Pair {x: 10, y: 12};
     assert_eq!(x.x, 10);
     assert_eq!(x.y, 12);
 }
index 4c5072b10c96726222c81151505a57487ca76405..9cf98364eb9937df70d3887b16f88c3ec75c1a29 100644 (file)
@@ -18,6 +18,6 @@ struct Triple<T> { x: T, y: T, z: T }
 fn box_it<T>(x: Triple<T>) -> Box<Triple<T>> { return box x; }
 
 pub fn main() {
-    let x: Box<Triple<int>> = box_it::<int>(Triple{x: 1, y: 2, z: 3});
+    let x: Box<Triple<isize>> = box_it::<isize>(Triple{x: 1, y: 2, z: 3});
     assert_eq!(x.y, 2);
 }
index 73c15382d9ea574027c8dba7a229a6c7807dfed6..64d9368a88be8200efcb7a523c6f8444ff558692 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-pub fn f() -> int { return 1; }
+pub fn f() -> isize { return 1; }
 
 pub mod foo {
-    pub fn f() -> int { return 2; }
+    pub fn f() -> isize { return 2; }
     pub fn g() { assert!((f() == 2)); assert!((::f() == 1)); }
 }
 
index f038353ada27abf709d8f8e917d240fa0b11408a..59ec14e097e6728d34f7d9cd302687d278aa4aaa 100644 (file)
@@ -11,9 +11,9 @@
 // pretty-expanded FIXME #23616
 
 #[derive(Copy)]
-enum Q { R(Option<uint>) }
+enum Q { R(Option<usize>) }
 
-fn xyzzy(q: Q) -> uint {
+fn xyzzy(q: Q) -> usize {
     match q {
         Q::R(S) if S.is_some() => { 0 }
         _ => 1
index 59e7c3782e11156b0794ccd3e43d8e0dcd2af92a..598172ac18ead7816ace05bed580d10935db3c85 100644 (file)
 // pretty-expanded FIXME #23616
 
 #[derive(Copy)]
-struct Pair { x: int, y: int }
+struct Pair { x: isize, y: isize }
 
 pub fn main() {
-    let a: int =
+    let a: isize =
         match 10 { x if x < 7 => { 1 } x if x < 11 => { 2 } 10 => { 3 } _ => { 4 } };
     assert_eq!(a, 2);
 
-    let b: int =
+    let b: isize =
         match (Pair {x: 10, y: 20}) {
           x if x.x < 5 && x.y < 5 => { 1 }
           Pair {x: x, y: y} if x == 10 && y == 20 => { 2 }
index 93ff18207341136f9b02c97154eb772a2fa82a34..3d1b74438a845ddaa6f9b85fa0f15ff11f06a6c6 100644 (file)
@@ -31,7 +31,7 @@ mod map_reduce {
 
     pub type mapper = extern fn(String, putter);
 
-    enum ctrl_proto { find_reducer(Vec<u8>, Sender<int>), mapper_done, }
+    enum ctrl_proto { find_reducer(Vec<u8>, Sender<isize>), mapper_done, }
 
     fn start_mappers(ctrl: Sender<ctrl_proto>, inputs: Vec<String>) {
         for i in &inputs {
@@ -44,7 +44,7 @@ fn start_mappers(ctrl: Sender<ctrl_proto>, inputs: Vec<String>) {
     fn map_task(ctrl: Sender<ctrl_proto>, input: String) {
         let mut intermediates = HashMap::new();
 
-        fn emit(im: &mut HashMap<String, int>,
+        fn emit(im: &mut HashMap<String, isize>,
                 ctrl: Sender<ctrl_proto>, key: String,
                 _val: String) {
             if im.contains_key(&key) {
@@ -71,13 +71,13 @@ pub fn map_reduce(inputs: Vec<String>) {
         // This task becomes the master control task. It spawns others
         // to do the rest.
 
-        let mut reducers: HashMap<String, int>;
+        let mut reducers: HashMap<String, isize>;
 
         reducers = HashMap::new();
 
         start_mappers(tx, inputs.clone());
 
-        let mut num_mappers = inputs.len() as int;
+        let mut num_mappers = inputs.len() as isize;
 
         while num_mappers > 0 {
             match rx.recv().unwrap() {
index 495c1ccf1f4fbff65c1fea9a02eb1705337b7e43..bcd519bc25d202bff878a96db979f5065b89cecf 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait Typer<'tcx> {
-    fn method(&self, data: &'tcx int) -> &'tcx int { data }
+    fn method(&self, data: &'tcx isize) -> &'tcx isize { data }
 }
 
 struct Tcx<'tcx> {
-    fields: &'tcx int
+    fields: &'tcx isize
 }
 
 impl<'tcx> Typer<'tcx> for Tcx<'tcx> {
index 9cb588b101047e8a6077529069f9772159ba025b..6761cc12876fe47ba9f23264aa4a1ce7f920528d 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 trait Typer<'tcx> {
-    fn method(&self, data: &'tcx int) -> &'tcx int { data }
+    fn method(&self, data: &'tcx isize) -> &'tcx isize { data }
     fn dummy(&self) { }
 }
 
index 676c7b8245a64870b5b065211d3b1afce66ecad7..858179fb5fe76fc32188776aa43c713946eefff6 100644 (file)
@@ -16,7 +16,7 @@ trait FnLike<A,R> {
     fn call(&self, arg: A) -> R;
 }
 
-type FnObject<'b> = for<'a> FnLike<&'a int, &'a int> + 'b;
+type FnObject<'b> = for<'a> FnLike<&'a isize, &'a isize> + 'b;
 
 struct Identity;
 
index d837dafc759ba8a76bc3cc592cdac9ee26707313..8b4c2aec8452b667d546ba054f7190fce006bfb9 100644 (file)
@@ -25,7 +25,7 @@ fn call(&self, arg: &'a T) -> &'a T {
 }
 
 fn call_repeatedly<F>(f: F)
-    where F : for<'a> FnLike<&'a int, &'a int>
+    where F : for<'a> FnLike<&'a isize, &'a isize>
 {
     let x = 3;
     let y = f.call(&x);
index f27fb29717611ed14f72656ea23a9bf02871ee71..bc00a0758f45e8cc6a54c328fe1598f5f82d4284 100644 (file)
 
 #![feature(unboxed_closures)]
 
-// Test that `F : Fn(int) -> int + Send` is interpreted as two
+// Test that `F : Fn(isize) -> isize + Send` is interpreted as two
 // distinct bounds on `F`.
 
 fn foo1<F>(f: F)
-    where F : FnOnce(int) -> int + Send
+    where F : FnOnce(isize) -> isize + Send
 {
     bar(f);
 }
 
 fn foo2<F>(f: F)
-    where F : FnOnce(int) -> int + Send
+    where F : FnOnce(isize) -> isize + Send
 {
     baz(f);
 }
 
 fn bar<F:Send>(f: F) { }
 
-fn baz<F:FnOnce(int) -> int>(f: F) { }
+fn baz<F:FnOnce(isize) -> isize>(f: F) { }
 
 fn main() {}
index 2c247c8099057e2965f5e65c1376049f12955bb3..892f2f1ae9df7522bf52b8d64100a7421977a195 100644 (file)
 #![allow(unknown_features)]
 #![feature(unboxed_closures)]
 
-// Test that `Fn(int) -> int + 'static` parses as `(Fn(int) -> int) +
-// 'static` and not `Fn(int) -> (int + 'static)`. The latter would
+// Test that `Fn(isize) -> isize + 'static` parses as `(Fn(isize) -> isize) +
+// 'static` and not `Fn(isize) -> (isize + 'static)`. The latter would
 // cause a compilation error. Issue #18772.
 
-fn adder(y: int) -> Box<Fn(int) -> int + 'static> {
+fn adder(y: isize) -> Box<Fn(isize) -> isize + 'static> {
     // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     Box::new(move |x| y + x)
 }
index bdebadd54112cfc89de9f4a839f541f6d43bdaba..bdbcda89099e5558faa003dbe36cd260c39bd99f 100644 (file)
@@ -16,7 +16,7 @@ trait FnLike<A,R> {
     fn call(&self, arg: A) -> R;
 }
 
-type FnObject<'b> = for<'a> FnLike<&'a int, &'a int> + 'b;
+type FnObject<'b> = for<'a> FnLike<&'a isize, &'a isize> + 'b;
 
 fn main() {
 }
index 1f63349b2d8da807589b1825449ac5a22af26355..48d0959630f7d528f0507807fa4e5f68a40a22bf 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait PrinterSupport<'ast> {
-    fn ast_map(&self) -> Option<&'ast uint> { None }
+    fn ast_map(&self) -> Option<&'ast usize> { None }
 }
 
 struct NoAnn<'ast> {
-    f: Option<&'ast uint>
+    f: Option<&'ast usize>
 }
 
 impl<'ast> PrinterSupport<'ast> for NoAnn<'ast> {
 }
 
-fn foo<'ast, G>(f: Option<&'ast uint>, g: G) where G: FnOnce(&PrinterSupport) {
+fn foo<'ast, G>(f: Option<&'ast usize>, g: G) where G: FnOnce(&PrinterSupport) {
     let annotation = NoAnn { f: f };
     g(&annotation)
 }
index c34e1a4862f828502032508d0af68fe704b1f1a2..008e7ddbc9c5d9043a3902eb5ec27df4c1464ab8 100644 (file)
 
 #![feature(unboxed_closures)]
 
-fn foo<F:Fn(&int)>(f: F) {
+fn foo<F:Fn(&isize)>(f: F) {
     let x = 22;
     f(&x);
 }
 
 fn main() {
-    foo(|x: &int| println!("{}", *x));
+    foo(|x: &isize| println!("{}", *x));
 }
index 8421f47e94d8c68ce0bccfa209a83319a7d47836..e5acc4a2edd68f7f9fa55acc03b75d920b72411d 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 mod x {
-    pub fn g() -> uint {14}
+    pub fn g() -> usize {14}
 }
 
 pub fn main(){
index cca0e5b163c434b17402ed91e538a047f271d678..589d6e1581bde7914ec3662c514991f800bf48da 100644 (file)
@@ -34,7 +34,7 @@ macro_rules! run_once {
 pub fn main() {
     let mut i = 0;
 
-    let j: int = {
+    let j: isize = {
         'x: loop {
             // this 'x should refer to the outer loop, lexically
             loop_x!(break 'x);
@@ -44,7 +44,7 @@ pub fn main() {
     };
     assert_eq!(j, 1);
 
-    let k: int = {
+    let k: isize = {
         'x: for _ in 0..1 {
             // ditto
             loop_x!(break 'x);
@@ -54,7 +54,7 @@ pub fn main() {
     };
     assert_eq!(k, 1);
 
-    let l: int = {
+    let l: isize = {
         'x: for _ in 0..1 {
             // ditto
             while_true!(break 'x);
@@ -64,7 +64,7 @@ pub fn main() {
     };
     assert_eq!(l, 1);
 
-    let n: int = {
+    let n: isize = {
         'x: for _ in 0..1 {
             // ditto
             run_once!(continue 'x);
index 44c834d233fe7f02d45fce3dc112a8c46140c676..e66a8c85723a0c5532afbb89e51742b5153c17ce 100644 (file)
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 pub fn main() {
-    let i: int = if false { panic!() } else { 5 };
+    let i: isize = if false { panic!() } else { 5 };
     println!("{}", i);
 }
index 766cced4c2673ba11dffcff136480054cb129a8a..c72cd10a082e95b7596909e96d66507d6a0ec45d 100644 (file)
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn even(x: uint) -> bool {
+fn even(x: usize) -> bool {
     if x < 2 {
         return false;
     } else if x == 2 { return true; } else { return even(x - 2); }
 }
 
-fn foo(x: uint) {
+fn foo(x: usize) {
     if even(x) {
         println!("{}", x);
     } else {
index 1286b29309a295ece557ae47de39ff97b047c368..c41d02f9b3365f42d526c81b3dc2d13e75627c8a 100644 (file)
@@ -22,7 +22,7 @@ pub fn main() {
         worked = true;
     }
     assert!(worked);
-    let clause: uint;
+    let clause: usize;
     if let None = Some("test") {
         clause = 1;
     } else if 4_usize > 5 {
@@ -42,8 +42,8 @@ pub fn main() {
 
     enum Foo {
         One,
-        Two(uint),
-        Three(String, int)
+        Two(usize),
+        Three(String, isize)
     }
 
     let foo = Foo::Three("three".to_string(), 42);
index 839ec6457e175d9073e5a0bbac7f9831659d79da..711f2dd6c66763db9aed1ba10bfc4b37688efb99 100644 (file)
 // pretty-expanded FIXME #23616
 
 #![feature(advanced_slice_patterns)]
+#![feature(slice_patterns)]
 
-struct Foo(int, int, int, int);
-struct Bar{a: int, b: int, c: int, d: int}
+struct Foo(isize, isize, isize, isize);
+struct Bar{a: isize, b: isize, c: isize, d: isize}
 
 pub fn main() {
     let Foo(..) = Foo(5, 5, 5, 5);
index 33a44b3bcd64601a1807d0eaaaf29325158df926..7f1d576e09944e9cceb2bbe541f18ce67a1fe5dc 100644 (file)
@@ -21,7 +21,7 @@ pub fn foo(&self) -> bool { true }
 
 enum option__ {
     none__,
-    some__(int)
+    some__(isize)
 }
 
 impl option__ {
index 3470b54ccbbbc333d31ba6d34cedd855bd40a95f..c2b459d2887276dec1b00ef5df41b86da0161797 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 mod foo {
-    pub fn x(y: int) { println!("{}", y); }
+    pub fn x(y: isize) { println!("{}", y); }
 }
 
 mod bar {
index 532c3843284d26b2cf31f1a6933cbf7eab4d6069..0f3891bf06715f9ca7d69100bed80de1c77fbb90 100644 (file)
@@ -13,7 +13,7 @@
 use foo::x as z;
 
 mod foo {
-    pub fn x(y: int) { println!("{}", y); }
+    pub fn x(y: isize) { println!("{}", y); }
 }
 
 pub fn main() { x(10); z(10); }
index c599f2249996a6d19f3c41ad93a74ad533fff3d6..f00005fc7d0b58c8fadf64c80937111339a82d47 100644 (file)
@@ -13,6 +13,6 @@
 
 // pretty-expanded FIXME #23616
 
-fn f() -> Vec<int> { Vec::new() }
+fn f() -> Vec<isize> { Vec::new() }
 
 pub fn main() { }
index e4168ea145212aa9afc0f219171b68c0a959cbb9..e8c5996f4fa098791f139e52b50183cea94386ef 100644 (file)
@@ -14,7 +14,7 @@
 */
 // ignore-test
 
-fn loopy(n: int) {
+fn loopy(n: isize) {
     if n > 0 { spawn(move|| { loopy(n - 1) }); spawn(move|| { loopy(n - 1) }); }
     loop { }
 }
index 3d1fff7b5f0c316b9de3520efc8af76a72dc6689..eb50fbed774e41d28e9c67741822c0c9c1ef9364 100644 (file)
@@ -20,7 +20,7 @@
 // as a move unless the stored thing is used afterwards.
 
 struct r<'a> {
-    i: &'a Cell<int>,
+    i: &'a Cell<isize>,
 }
 
 struct BoxR<'a> { x: r<'a> }
@@ -32,7 +32,7 @@ fn drop(&mut self) {
     }
 }
 
-fn r(i: &Cell<int>) -> r {
+fn r(i: &Cell<isize>) -> r {
     r {
         i: i
     }
index e4a3f2c8d1d4b847076b4f5832da0c3612d93126..28fba70eb24d96c5daccc484c2d902b0278ab4d2 100644 (file)
@@ -16,7 +16,7 @@
 // even though it would be if the nxt field had type @foo:
 struct foo(X);
 
-struct X { x: uint, nxt: *const foo }
+struct X { x: usize, nxt: *const foo }
 
 pub fn main() {
     let _x = foo(X {x: 0, nxt: ptr::null()});
index 09d6501267d7063c47e93d7411d387df430c522f..9495552af409bd7930794864b27391170a2734bf 100644 (file)
@@ -13,4 +13,4 @@
 
 // pretty-expanded FIXME #23616
 
-pub fn main() { let _x: int = 10; }
+pub fn main() { let _x: isize = 10; }
index 35da4b8a9364bb3cc59c6b1d2ab28c35266fadd5..57f80bb14e2fec8a4c0048e78a79e09c9b993a63 100644 (file)
@@ -16,7 +16,7 @@ fn id_i16(n: i16) -> i16 { n }
     fn id_i32(n: i32) -> i32 { n }
     fn id_i64(n: i64) -> i64 { n }
 
-    fn id_uint(n: uint) -> uint { n }
+    fn id_uint(n: usize) -> usize { n }
     fn id_u8(n: u8) -> u8 { n }
     fn id_u16(n: u16) -> u16 { n }
     fn id_u32(n: u32) -> u32 { n }
@@ -42,7 +42,7 @@ fn id_u64(n: u64) -> u64 { n }
     id_i64(j);
     id_i64(-9_223_372_036_854_775_808);
 
-    let _i: uint = 1;
+    let _i: usize = 1;
     let j = 1;
     id_uint(j);
     id_uint(1);
index 5bf8a4bc8f70740e840069c8754052a9d0f657ee..9ccf1c3bbb80381be78e003fcc9e477a8f2ac33d 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // Regression test for type inference failure around shifting. In this
-// case, the iteration yields an int, but we hadn't run the full type
+// case, the iteration yields an isize, but we hadn't run the full type
 // propagation yet, and so we just saw a type variable, yielding an
 // error.
 
index c970b17d2a1d49353ea94fca27bb2891ff7ab4c5..44dd191eb3ee39d14ab266e519c48ff109e2f296 100644 (file)
@@ -14,8 +14,8 @@
 
 mod rusti {
     extern "rust-intrinsic" {
-        pub fn pref_align_of<T>() -> uint;
-        pub fn min_align_of<T>() -> uint;
+        pub fn pref_align_of<T>() -> usize;
+        pub fn min_align_of<T>() -> usize;
     }
 }
 
index 89aea93e7b35a5a3f535b2a53ea13c590ebe9402..98f069f77f3f03bcb257c0eba6c0f58cbf1a9a9d 100644 (file)
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 #![feature(intrinsics)]
+// needed to check for drop fill word.
+#![feature(filling_drop)]
 
-use std::mem::transmute;
+use std::mem::{self, transmute};
 
 mod rusti {
     extern "rust-intrinsic" {
@@ -27,9 +29,10 @@ pub fn main() {
     unsafe {
         let x: Box<_> = box 1;
         let mut y = rusti::init();
-        let mut z: *const uint = transmute(&x);
+        let mut z: *const usize = transmute(&x);
         rusti::move_val_init(&mut y, x);
         assert_eq!(*y, 1);
-        assert_eq!(*z, 0); // `x` is nulled out, not directly visible
+        // `x` is nulled out, not directly visible
+        assert_eq!(*z, mem::POST_DROP_USIZE);
     }
 }
index ff6346943dbcd5182a8331e39afe2d309e3f438a..1ff910356eb9860d873e023b4d7c87deebffbfe0 100644 (file)
@@ -24,9 +24,9 @@ struct Point {
     fn return_address() -> *const u8;
 }
 
-fn f(result: &mut uint) -> Point {
+fn f(result: &mut usize) -> Point {
     unsafe {
-        *result = return_address() as uint;
+        *result = return_address() as usize;
         Point {
             x: 1.0,
             y: 2.0,
@@ -39,6 +39,6 @@ fn f(result: &mut uint) -> Point {
 fn main() {
     let mut intrinsic_reported_address = 0;
     let pt = f(&mut intrinsic_reported_address);
-    let actual_address = &pt as *const Point as uint;
+    let actual_address = &pt as *const Point as usize;
     assert_eq!(intrinsic_reported_address, actual_address);
 }
index 834455d560e42a9a542ccc30fe3a9b5712cc806e..3d2c1ec5c197746e512b07468a6dbadae56ad300 100644 (file)
@@ -18,5 +18,5 @@ mod rusti {
     }
 }
 pub fn main() {
-    let _a : int = unsafe {rusti::uninit()};
+    let _a : isize = unsafe {rusti::uninit()};
 }
index c095ad1a070df906e55b4979c607749cbfd62ccf..86a370a0942d965ea4060911219bbd1c42e0b99b 100644 (file)
@@ -16,7 +16,7 @@
 
 // See also src/test/run-make/intrinsic-unreachable.
 
-unsafe fn f(x: uint) -> uint {
+unsafe fn f(x: usize) -> usize {
     match x {
         17 => 23,
         _ => intrinsics::unreachable(),
index fdaa71d1cfb4c9e0918dce0b714e754f82f22102..53d6f67f119eef142111718147b1c07b73bde5e9 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-10028" as issue10028;
+extern crate issue_10028 as issue10028;
 
 use issue10028::ZeroLengthThingWithDestructor;
 
index 29c5a8208baecc448dd023fcd9dbbe03cf879e32..2d695c75d30446fd28a07ca510e0ca812fad52b5 100644 (file)
@@ -10,8 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
-struct A { foo: int }
-struct B { a: int, b: int, c: int }
+struct A { foo: isize }
+struct B { a: isize, b: isize, c: isize }
 
 fn mka() -> A { panic!() }
 fn mkb() -> B { panic!() }
index ba003c0b1ba73af5208a3636aa10c9cf2afcc87f..c049bdfe83cf142216dcdc8f535e0aec49b0b2f9 100644 (file)
@@ -16,7 +16,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn work(_: Box<int>) {}
+fn work(_: Box<isize>) {}
 fn foo<F:FnOnce()>(_: F) {}
 
 pub fn main() {
index 27773a42abb4bbc45db8374402d6c117afd72b1b..49694f2755c234da6ae5072c79dfa62ce2b0373f 100644 (file)
@@ -12,7 +12,7 @@
 
 #![feature(unsafe_no_drop_flag)]
 
-static mut drop_count: uint = 0;
+static mut drop_count: usize = 0;
 
 #[unsafe_no_drop_flag]
 struct Foo {
index 5b8828cf0b550fbf9cb4d6545a404076a69b48ef..49883f15d3192e62c8f4882c198fa0b484d6e228 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-pub fn foo() -> int {
+pub fn foo() -> isize {
     3
 }
-pub fn bar() -> int {
+pub fn bar() -> isize {
     4
 }
 
 pub mod baz {
     use {foo, bar};
-    pub fn quux() -> int {
+    pub fn quux() -> isize {
         foo() + bar()
     }
 }
 
 pub mod grault {
     use {foo};
-    pub fn garply() -> int {
+    pub fn garply() -> isize {
         foo()
     }
 }
 
 pub mod waldo {
     use {};
-    pub fn plugh() -> int {
+    pub fn plugh() -> isize {
         0
     }
 }
index 4009d2a7d313fa1641657040d0f8bbec720dd9a3..c024c6297bf10304afe9ef08baf08c2bf546ca99 100644 (file)
 struct Foo {
     #[cfg(fail)]
     bar: baz,
-    foo: int,
+    foo: isize,
 }
 
 struct Foo2 {
     #[cfg(foo)]
-    foo: int,
+    foo: isize,
 }
 
 enum Bar1 {
@@ -37,8 +37,8 @@ enum Bar2 {
 enum Bar3 {
     Bar3_1 {
         #[cfg(fail)]
-        foo: int,
-        bar: int,
+        foo: isize,
+        bar: isize,
     }
 }
 
index b3187d889a1c490e521386da4bf5f816a41743b9..3d131b51033dc447ede56af358a95496e5c4ce1e 100644 (file)
@@ -24,7 +24,7 @@ struct X<T> {
 }
 
 pub fn main() {
-    let x: X<int> = X {
+    let x: X<isize> = X {
         a: 12345678,
         b: 9,
         c: true,
index 70bec062d17a5888a621e3618483d672d3b544bf..41b54727b662fe30ac9c784fca0f55e36e4b380c 100644 (file)
@@ -15,7 +15,7 @@
 // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
 
 trait Foo { fn dummy(&self) { } }
-impl Foo for int {}
+impl Foo for isize {}
 fn foo(_: [&Foo; 2]) {}
 fn foos(_: &[&Foo]) {}
 fn foog<T>(_: &[T], _: &[T]) {}
index f226e25eaa4611b3d7301d16e6381c94037ca5a7..14017ee1789242db25ec2182e5445459a7532f0b 100644 (file)
@@ -12,6 +12,6 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-11224" as unused;
+extern crate issue_11224 as unused;
 
 pub fn main() {}
index e960558e52c8ca3aaf71ea445e17389717b0f71a..a74fdbe3de472b0112a06f076b90c19b2fd744a8 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-11225-1" as foo;
+extern crate issue_11225_1 as foo;
 
 pub fn main() {
     foo::foo(1);
index 56144edb5c74484563fa65b9c18504a41cfa228b..c6fc5e8b484e03e81edd38d200604f77086e4fd1 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-11225-2" as foo;
+extern crate issue_11225_2 as foo;
 
 pub fn main() {
     foo::foo(1);
index 6fb2c532e0c0b1f48300f3d3740138c80e6092da..1a1227c7920193c4e07d3aa7bbd6fafe2633618c 100644 (file)
 trait T<U> {
     fn next(&mut self) -> Option<U>;
 }
-impl T<int> for Empty {
-    fn next(&mut self) -> Option<int> { None }
+impl T<isize> for Empty {
+    fn next(&mut self) -> Option<isize> { None }
 }
 
-fn do_something_with(a : &mut T<int>) {
+fn do_something_with(a : &mut T<isize>) {
     println!("{:?}", a.next())
 }
 
index 1fc72fd2cbef6f1f648afd7b6c93dab6a166c810..21ed30683f50fb9d6af2c7d9efb8bc3e142dd841 100644 (file)
@@ -10,7 +10,7 @@
 
 // aux-build:issue-11508.rs
 
-extern crate "issue-11508" as rand;
+extern crate issue_11508 as rand;
 
 use rand::{Closed01, random};
 
index 535fc3669911a6bd02e56fa041411b9a57c403e8..e5d95874be61fda8f16a8b0b2c7c38c9c175b177 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-11529" as a;
+extern crate issue_11529 as a;
 
 fn main() {
     let one = 1;
index bf5ad945b9f4370bc3fa165304826081163db1c8..1f91c6aaa4d0ae1275db4fa309f3d44246a1c3fa 100644 (file)
@@ -17,7 +17,7 @@
 #[derive(Clone)]
 enum Noun
 {
-    Atom(int),
+    Atom(isize),
     Cell(Box<Noun>, Box<Noun>)
 }
 
index 06d5b66b3e8502ae1dbd7c8dae77624edf3f7c7f..ecb7a3a3691ca9cb95e66ab1f6aa3a9f6db2f8a9 100644 (file)
 // Destructuring struct variants would ICE where regular structs wouldn't
 
 enum Foo {
-    VBar { num: int }
+    VBar { num: isize }
 }
 
-struct SBar { num: int }
+struct SBar { num: isize }
 
 pub fn main() {
     let vbar = Foo::VBar { num: 1 };
diff --git a/src/test/run-pass/issue-11592.rs b/src/test/run-pass/issue-11592.rs
new file mode 100644 (file)
index 0000000..432e7ff
--- /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.
+
+//! Ensure the private trait Bar isn't complained about.
+
+#![deny(missing_docs)]
+
+mod foo {
+    trait Bar { fn bar(&self) { } }
+    impl Bar for i8 { fn bar(&self) { } }
+}
+
+fn main() { }
index 1edd1d137a9291bafa3a987988101b9b1b58d981..a3eec42831f2036fafc0bfc71aed826f4c3dc9d1 100644 (file)
@@ -24,7 +24,7 @@ struct S<T> {f: Box<X<T>+'static>,
              g: Box<X<T>+'static>}
 
 struct F;
-impl X<int> for F {
+impl X<isize> for F {
 }
 
 fn main() {
index 72cc8d470d054537dd0e2d9b6b2b1130b778d4bc..fde04efc8bad9c63f204da244196403c0c719475 100644 (file)
@@ -21,7 +21,7 @@ fn main() {
     // Generate sieve of Eratosthenes for n up to 1e6
     let n = 1000000;
     let mut sieve = BitVec::from_elem(n+1, true);
-    let limit: uint = (n as f32).sqrt() as uint;
+    let limit: usize = (n as f32).sqrt() as usize;
     for i in 2..limit+1 {
         if sieve[i] {
             let mut j = 0;
index 4044468c3fe7c7326bcaa5733c4e3889f31fc683..811926826dd12a0746cf69250b5a166d2c6748da 100644 (file)
@@ -32,7 +32,7 @@ struct Foo {
 
 #[derive(Encodable)]
 struct Bar {
-    froboz: uint,
+    froboz: usize,
 }
 
 enum WireProtocol {
index 7e5b0c2230141cacb2ebdfe7557a7838ad939bb7..d47bb818c4946641687517a34dd36cadc0362753 100644 (file)
@@ -13,7 +13,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-12133-rlib" as a;
-extern crate "issue-12133-dylib" as b;
+extern crate issue_12133_rlib as a;
+extern crate issue_12133_dylib as b;
 
 fn main() {}
index 76bae09bd49422e8f042b5747832780d46a28fae..580c487af0de9a803ba092b3ad63d32bb3c71e15 100644 (file)
@@ -14,7 +14,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-12133-rlib" as a;
-extern crate "issue-12133-dylib" as b;
+extern crate issue_12133_rlib as a;
+extern crate issue_12133_dylib as b;
 
 fn main() {}
index 514cfeab6af1a64419b78e1019f69921dcec9cb7..79a530785452ac58c1bfa1d0f8694a452aae9594 100644 (file)
@@ -14,6 +14,6 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-12133-dylib2" as other;
+extern crate issue_12133_dylib2 as other;
 
 fn main() {}
index 6b66c640b6b5dc0d44ff7b9dd054780db903931e..ad03c7fddb49bb211100d6730bf8cdd8d932f7a8 100644 (file)
@@ -18,9 +18,9 @@
 
 #[derive(Copy, PartialEq, Eq, Hash)]
 struct XYZ {
-    x: int,
-    y: int,
-    z: int
+    x: isize,
+    y: isize,
+    z: isize
 }
 
 fn main() {
index dd541ff948c9d01629a7d52295703be623bcd2c8..e15321907301c183cf1ceb32ce4e71fe57679f6c 100644 (file)
@@ -23,6 +23,6 @@ fn main() {
     let v2: Vec<_> = arr.iter().map(copy).collect();
 
     let m1: HashMap<_, _> = arr.iter().map(copy).collect();
-    let m2: HashMap<int, _> = arr.iter().map(copy).collect();
-    let m3: HashMap<_, uint> = arr.iter().map(copy).collect();
+    let m2: HashMap<isize, _> = arr.iter().map(copy).collect();
+    let m3: HashMap<_, usize> = arr.iter().map(copy).collect();
 }
index 056c86b01f7346c92ab6c179f0a7bbfebd567dc1..dadd480dc6a2cd644106fd5443aa9f5f3d63e24e 100644 (file)
 // Tests that match expression handles overlapped literal and range
 // properly in the presence of guard function.
 
-fn val() -> uint { 1 }
+#![feature(slice_patterns)]
 
-static CONST: uint = 1;
+fn val() -> usize { 1 }
+
+static CONST: usize = 1;
 
 pub fn main() {
     lit_shadow_range();
@@ -174,7 +176,7 @@ fn range_shadow_multi_pats() {
 
 fn misc() {
     enum Foo {
-        Bar(uint, bool)
+        Bar(usize, bool)
     }
     // This test basically mimics how trace_macros! macro is implemented,
     // which is a rare combination of vector patterns, multiple wild-card
index 304d0297424647ed69bbfa72c02c11b6b9efd64c..414f6768e0a6b0b0ba8e6a328bfc7b37c7581b4c 100644 (file)
@@ -23,7 +23,7 @@ fn next(&mut self) -> Option<(&'static str, &'a T)> {
         self.iter.by_ref().map(|&(key, ref value)| (key, value)).next()
     }
 
-    fn size_hint(&self) -> (uint, Option<uint>) {
+    fn size_hint(&self) -> (usize, Option<usize>) {
         self.iter.size_hint()
     }
 }
index 904b8feb884b961882ef672a670323546f6c6a2c..ec9d777974bb01d23ff5e78a9ae96be92d7dc6c8 100644 (file)
@@ -14,7 +14,7 @@
 // pretty-expanded FIXME #23616
 
 pub trait Foo {
-    fn bar<'a, I: Iterator<Item=&'a ()>>(&self, it: I) -> uint {
+    fn bar<'a, I: Iterator<Item=&'a ()>>(&self, it: I) -> usize {
         let mut xs = it.filter(|_| true);
         xs.count()
     }
index 07da2b286c27b9a060aa3e8580dcf46ce4e159cf..e82a7602ef594f845cffa4bffed210609923e3ba 100644 (file)
@@ -62,10 +62,10 @@ fn get<'a>(&'a self) -> &'a Node {
 struct Node;
 
 impl Node {
-    fn RemoveChild(&self, _a: uint) {
+    fn RemoveChild(&self, _a: usize) {
     }
 
-    fn AddChild(&self, _a: uint) {
+    fn AddChild(&self, _a: usize) {
     }
 }
 
diff --git a/src/test/run-pass/issue-13352.rs b/src/test/run-pass/issue-13352.rs
deleted file mode 100644 (file)
index af31fee..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// pretty-expanded FIXME #23616
-
-#![feature(std_misc, libc)]
-
-extern crate libc;
-
-use std::thunk::Thunk;
-
-fn foo(_: Thunk) {}
-
-fn main() {
-    foo(loop {
-        unsafe { libc::exit(0 as libc::c_int); }
-    });
-    2_usize + (loop {});
-}
index d1a24e4a450d5d1f6820753fbf8affbc5bfd19c2..c8b26dc4aed15cab7af054569f1ff8fa7cbaab23 100644 (file)
 
 struct Foo<'a> {
     i: &'a bool,
-    j: Option<&'a int>,
+    j: Option<&'a isize>,
 }
 
 impl<'a> Foo<'a> {
-    fn bar(&mut self, j: &int) {
+    fn bar(&mut self, j: &isize) {
         let child = Foo {
             i: self.i,
             j: Some(j)
index 3fa9f66c9e3ccc0f4ef1f8a43f2b36e881367cf0..6159edbfe1ee4c27150602868faf79785726ad5c 100644 (file)
@@ -27,7 +27,7 @@ fn helper(rx: Receiver<Sender<()>>) {
 fn main() {
     let (tx, rx) = channel();
     let _t = Thread::spawn(move|| { helper(rx) });
-    let (snd, rcv) = channel::<int>();
+    let (snd, rcv) = channel::<isize>();
     for _ in 1..100000 {
         snd.send(1).unwrap();
         let (tx2, rx2) = channel();
index 8ed8426b8f5da628e619fa56c2997977aac7fda3..4c46831418707bb0c95cda5b6497c23d88d396e3 100644 (file)
@@ -13,7 +13,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-13620-2" as crate2;
+extern crate issue_13620_2 as crate2;
 
 fn main() {
     (crate2::FOO2.foo)();
index fd482b370489fd4e400ef0a2718180de5ce9a13d..173b8dda05795a45d6883bd83e5a3648e278a0cb 100644 (file)
@@ -10,6 +10,6 @@
 
 // pretty-expanded FIXME #23616
 
-pub struct Foo<'a, 'b: 'a> { foo: &'a &'b int }
+pub struct Foo<'a, 'b: 'a> { foo: &'a &'b isize }
 pub fn foo<'a, 'b>(x: Foo<'a, 'b>, _o: Option<&   &   ()>) { let _y = x.foo; }
 fn main() {}
index c8bf74c5d9b4508a9f58aa2b520f48b2feeca6e5..fb82cccc871e71032bb50dba67fd96cdbf28fade 100644 (file)
@@ -14,9 +14,9 @@
 
 use std::u8;
 
-const NUM: uint = u8::BITS as uint;
+const NUM: usize = u8::BITS as usize;
 
-struct MyStruct { nums: [uint; 8] }
+struct MyStruct { nums: [usize; 8] }
 
 
 fn main() {
index 38ecab67372d04ead022a0996034cd5fe8178f74..3b70bea719b2ff8b382e41d463fe77ead3008b77 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 trait Foo {
-    fn bar(&self, int) {}
+    fn bar(&self, isize) {}
 }
 
 fn main() {}
index cd6711df7f33503c1611d3c1bf35b0936a2d4f9e..d90b9cffb6abdec60c30567e0ac2fd33c8d3d093 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct TestStruct {
-    x: *const [int; 2]
+    x: *const [isize; 2]
 }
 
 unsafe impl Sync for TestStruct {}
 
-static TEST_VALUE : TestStruct = TestStruct{x: 0x1234 as *const [int; 2]};
+static TEST_VALUE : TestStruct = TestStruct{x: 0x1234 as *const [isize; 2]};
 
 fn main() {}
index 8a2e1585da6838a5d1c0f39d5b5fbc82cbca7fb2..a902e141bb6ca4a935a7f3c0be304ae91b41066c 100644 (file)
@@ -14,7 +14,7 @@
 // pretty-expanded FIXME #23616
 
 enum Foo {
-    FooUint(uint),
+    FooUint(usize),
     FooNullary,
 }
 
index 66cf37eb61fc558d236f4dc1a85387dc8aebdac7..e9fb7945d04007215093f75d3e69827273be0c2c 100644 (file)
@@ -14,7 +14,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-13872-3" as other;
+extern crate issue_13872_3 as other;
 
 fn main() {
     other::foo();
index 849d7e249a8df146616b4d1d79580aad18686965..ed96eee6ddffb8072487b6d4b0c5f88d167dfad9 100644 (file)
@@ -17,7 +17,7 @@ fn bah(_: Option<Self>) { }
 }
 
 struct BarTy {
-    x : int,
+    x : isize,
     y : f64,
 }
 
@@ -68,34 +68,34 @@ fn bar(&self) {
 }
 
 // If these fail, it's necessary to update rustc_resolve and the cfail tests.
-impl Foo for *const int {
+impl Foo for *const isize {
     fn bar(&self) {
         self.baz();
-        Foo::bah(None::<*const int>);
+        Foo::bah(None::<*const isize>);
     }
 }
 
 // If these fail, it's necessary to update rustc_resolve and the cfail tests.
-impl<'a> Foo for &'a int {
+impl<'a> Foo for &'a isize {
     fn bar(&self) {
         self.baz();
-        Foo::bah(None::<&int>);
+        Foo::bah(None::<&isize>);
     }
 }
 
 // If these fail, it's necessary to update rustc_resolve and the cfail tests.
-impl<'a> Foo for &'a mut int {
+impl<'a> Foo for &'a mut isize {
     fn bar(&self) {
         self.baz();
-        Foo::bah(None::<&mut int>);
+        Foo::bah(None::<&mut isize>);
     }
 }
 
 // If these fail, it's necessary to update rustc_resolve and the cfail tests.
-impl Foo for Box<int> {
+impl Foo for Box<isize> {
     fn bar(&self) {
         self.baz();
-        Foo::bah(None::<Box<int>>);
+        Foo::bah(None::<Box<isize>>);
     }
 }
 
index fd311a1e9b56284558bc92d8c647fae0d3618abc..f67d0946e9823429ed4f3182d55196ecc649df94 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct A(int);
+struct A(isize);
 struct B;
 
 fn main() {
index 48c4aed50f4b160e00cbce99759ca7df7bf3f2e7..dd5b7e722fe7bb775d533dc4b12d45d9d0fbb0aa 100644 (file)
@@ -10,6 +10,6 @@
 
 // pretty-expanded FIXME #23616
 
-#[macro_use] extern crate "std" as std2;
+#[macro_use] extern crate std as std2;
 
 fn main() {}
index e6425f7cb7a0220d8186d628a38cd4b5770f799e..046d888030f0c4acc929a054a9df1e24d9b23670 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-14421" as bug_lib;
+extern crate issue_14421 as bug_lib;
 
 use bug_lib::B;
 use bug_lib::make;
index d3f1858c36324c6aea7b4c3d34e755d7e0a105db..178a219f5bfc0b03d55f75ba451ab3da7da88409 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-14422" as bug_lib;
+extern crate issue_14422 as bug_lib;
 
 use bug_lib::B;
 use bug_lib::make;
index 7392c7a75d153a5a99bdcd1f81456340be9aae9e..b0893e21af7e92eeef90baa34c9d1d98bbefc39f 100644 (file)
@@ -31,5 +31,5 @@ fn send(&self, _: T) {}
 }
 
 trait Foo { fn dummy(&self) { }}
-struct Output(int);
+struct Output(isize);
 impl Foo for Output {}
index 6d2d02d2b8b63ae9d4fd00a5089d8045fc6ce9cb..6e1cfc7186299e0eabc40c9c20ed32e5ce8e380a 100644 (file)
@@ -12,5 +12,5 @@
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    {|i| if 1 == i { }};
+    {|i: u32| if 1 == i { }};
 }
index 92cb30068de676c05e64bf7350a12554ca90db70..5589acdda37e14fc2ae7cd018c607eef3b928ad9 100644 (file)
@@ -13,7 +13,7 @@
 #[deny(dead_code)]
 pub enum Foo {
     Bar {
-        baz: int
+        baz: isize
     }
 }
 
index 5dca6e82ba2fc5f0749aa862bfbc3628ba5e6201..e78736b77fd93bc1283d6b81f5710f174fe88542 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 enum X {
-    Foo(uint),
+    Foo(usize),
     Bar(bool)
 }
 
index 9a85f83c03b9524de11404f2faec33d088642d55..371e926ab18d5f05062de87439c779215453e732 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 trait Matcher {
-    fn next_match(&mut self) -> Option<(uint, uint)>;
+    fn next_match(&mut self) -> Option<(usize, usize)>;
 }
 
 struct CharPredMatcher<'a, 'b> {
@@ -20,7 +20,7 @@ struct CharPredMatcher<'a, 'b> {
 }
 
 impl<'a, 'b> Matcher for CharPredMatcher<'a, 'b> {
-    fn next_match(&mut self) -> Option<(uint, uint)> {
+    fn next_match(&mut self) -> Option<(usize, usize)> {
         None
     }
 }
@@ -44,9 +44,9 @@ struct MatchIndices<M> {
 }
 
 impl<M: Matcher> Iterator for MatchIndices<M> {
-    type Item = (uint, uint);
+    type Item = (usize, usize);
 
-    fn next(&mut self) -> Option<(uint, uint)> {
+    fn next(&mut self) -> Option<(usize, usize)> {
         self.matcher.next_match()
     }
 }
@@ -59,5 +59,5 @@ fn match_indices<'a, M, T: IntoMatcher<'a, M>>(s: &'a str, from: T) -> MatchIndi
 fn main() {
     let s = "abcbdef";
     match_indices(s, |c: char| c == 'b')
-        .collect::<Vec<(uint, uint)>>();
+        .collect::<Vec<(usize, usize)>>();
 }
index 0e03f13241853c1f29b7c1ec18949459d3725853..f6815b76083048e508e4268c928465c31e879c3d 100644 (file)
@@ -10,6 +10,6 @@
 
 // pretty-expanded FIXME #23616
 
-pub type BigRat<T = int> = T;
+pub type BigRat<T = isize> = T;
 
 fn main() {}
index 05e2fff8a44247830625279c2874360973ee1a8c..2361c385b4148c451196733cfd7aa4331e981326 100644 (file)
@@ -22,8 +22,8 @@ fn wrap<A>(x:A, which: &'static str, history: &mut History) -> A {
 macro_rules! demo {
     ( $output_constraint:tt ) => {
         {
-            let mut x: int = 0;
-            let y: int = 1;
+            let mut x: isize = 0;
+            let y: isize = 1;
 
             let mut history: History = vec!();
             unsafe {
index fda7b9019797827792cf3feb7f0949badbd41bed..adf56388acd69d93f427dbe3aec503b5f0286b03 100644 (file)
 
 struct S<T>(T);
 
-static s1: S<S<uint>>=S(S(0));
-static s2: S<uint>=S(0);
+static s1: S<S<usize>>=S(S(0));
+static s2: S<usize>=S(0);
 
 fn main() {
-    let foo: S<S<uint>>=S(S(0));
-    let foo: S<uint>=S(0);
+    let foo: S<S<usize>>=S(S(0));
+    let foo: S<usize>=S(0);
 }
index a6d4f5fde5df94673aa437380b51fc5aaec488af..4369dc6292c36909b73b078a42b50d176e6eeb9c 100644 (file)
@@ -10,6 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
+#![feature(slice_patterns)]
+
 fn main() {
     let mut x: &[_] = &[1, 2, 3, 4];
 
index f56f3b63927546b8a10848be88d4c77fbce742e9..db04e10cfe383c36991390399d591a535a0d225e 100644 (file)
 
 // pretty-expanded FIXME #23616
 
+#![feature(slice_patterns)]
+
 fn main() {
     assert_eq!(count_members(&[1, 2, 3, 4]), 4);
 }
 
-fn count_members(v: &[uint]) -> uint {
+fn count_members(v: &[usize]) -> usize {
     match v {
         []         => 0,
         [_]        => 1,
index 9910c2e0d6007bc15627fa5e913bd93f5e89f7db..54705c6bf1301133d70ff9f4da29357f03e2cb4d 100644 (file)
@@ -16,7 +16,7 @@ pub enum T {
 }
 
 pub enum V {
-    V1(int),
+    V1(isize),
     V2(bool)
 }
 
index 0e194860251a8067900e846b664bf44ba1e62914..ee348d9cb0ccfe7ebb6aa8534e6fee9960fb7abc 100644 (file)
@@ -28,7 +28,7 @@ fn main() {
         // checking that it ends_with the executable name. This
         // is needed because of Windows, which has a different behavior.
         // See #15149 for more info.
-        return assert!(args[0].ends_with(&format!("mytest{}", env::consts::EXE_SUFFIX)[]));
+        return assert!(args[0].ends_with(&format!("mytest{}", env::consts::EXE_SUFFIX)));
     }
 
     test();
index b1d74e471c19bc86f3a45d41bd6b681a43c58d43..239fef1232639cdc1feea1f12dda2323eddf6402 100644 (file)
@@ -10,8 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
-static mut n_mut: uint = 0;
+static mut n_mut: usize = 0;
 
-static n: &'static uint = unsafe{ &n_mut };
+static n: &'static usize = unsafe{ &n_mut };
 
 fn main() {}
index 6a11f15dc847cbf0950726375b08d09bdd3bb97d..e9a9eabcd917fcffadef52101bbe508ad389b24b 100644 (file)
@@ -22,11 +22,11 @@ fn bar<T: MyTrait>(t: &T) {
     t.foo()
 }
 
-fn thing(a: int, b: int) -> int {
+fn thing(a: isize, b: isize) -> isize {
     a + b
 }
 
 fn main() {
-    let thing: fn(int, int) -> int = thing; // coerce to fn type
+    let thing: fn(isize, isize) -> isize = thing; // coerce to fn type
     bar(&thing);
 }
index 6556dba653435e7eb8523ed25f85cedbdc818b82..f1ef57e44b1d5f54c1e1b5a056dcf6e847eaafb2 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-15562" as i;
+extern crate issue_15562 as i;
 
 pub fn main() {
     extern {
index ddfb57f345b868de8949b546bb30efd864e670d4..9fc1cce56b767d4527eb3c0d71d4135038541409 100644 (file)
@@ -12,7 +12,7 @@
 
 #[derive(PartialEq)]
 enum Test<'a> {
-    Slice(&'a int)
+    Slice(&'a isize)
 }
 
 fn main() {
index 71306a63e9060dc3ae7a11b06b72c2cc1f50d6d0..922b18c01d9ebdf03482355e4982ec266204fc1e 100644 (file)
@@ -12,7 +12,7 @@
 
 #[derive(Clone)]
 enum Test<'a> {
-    Slice(&'a int)
+    Slice(&'a isize)
 }
 
 fn main() {}
index 29e2a403ebc3b35de04ee1d6576e2dfe0c4e7445..d058cb737117730d75fe9ee6cd103165593142c2 100644 (file)
 
 use std::ops::Index;
 
-struct Mat<T> { data: Vec<T>, cols: uint, }
+struct Mat<T> { data: Vec<T>, cols: usize, }
 
 impl<T> Mat<T> {
-    fn new(data: Vec<T>, cols: uint) -> Mat<T> {
+    fn new(data: Vec<T>, cols: usize) -> Mat<T> {
         Mat { data: data, cols: cols }
     }
-    fn row<'a>(&'a self, row: uint) -> Row<&'a Mat<T>> {
+    fn row<'a>(&'a self, row: usize) -> Row<&'a Mat<T>> {
         Row { mat: self, row: row, }
     }
 }
 
-impl<T> Index<(uint, uint)> for Mat<T> {
+impl<T> Index<(usize, usize)> for Mat<T> {
     type Output = T;
 
-    fn index<'a>(&'a self, (row, col): (uint, uint)) -> &'a T {
+    fn index<'a>(&'a self, (row, col): (usize, usize)) -> &'a T {
         &self.data[row * self.cols + col]
     }
 }
 
-impl<'a, T> Index<(uint, uint)> for &'a Mat<T> {
+impl<'a, T> Index<(usize, usize)> for &'a Mat<T> {
     type Output = T;
 
-    fn index<'b>(&'b self, index: (uint, uint)) -> &'b T {
+    fn index<'b>(&'b self, index: (usize, usize)) -> &'b T {
         (*self).index(index)
     }
 }
 
-struct Row<M> { mat: M, row: uint, }
+struct Row<M> { mat: M, row: usize, }
 
-impl<T, M: Index<(uint, uint), Output=T>> Index<uint> for Row<M> {
+impl<T, M: Index<(usize, usize), Output=T>> Index<usize> for Row<M> {
     type Output = T;
 
-    fn index<'a>(&'a self, col: uint) -> &'a T {
+    fn index<'a>(&'a self, col: usize) -> &'a T {
         &self.mat[(self.row, col)]
     }
 }
@@ -66,6 +66,6 @@ fn main() {
     let e = r[2];
     assert!(e == 6);
 
-    let e: uint = r[2];
+    let e: usize = r[2];
     assert!(e == 6);
 }
index f30991a19635251797a88dc08e06e72980789f41..b5251d63ff09e392a7a6be6ef4858a61fb732b8d 100644 (file)
@@ -13,7 +13,7 @@
 
 #[derive(PartialEq, Debug)]
 struct Bar {
-    x: int
+    x: isize
 }
 impl Drop for Bar {
     fn drop(&mut self) {
@@ -24,17 +24,17 @@ fn drop(&mut self) {
 #[derive(PartialEq, Debug)]
 struct Foo {
     x: Bar,
-    a: int
+    a: isize
 }
 
-fn foo() -> Result<Foo, int> {
+fn foo() -> Result<Foo, isize> {
     return Ok(Foo {
         x: Bar { x: 22 },
         a: return Err(32)
     });
 }
 
-fn baz() -> Result<Foo, int> {
+fn baz() -> Result<Foo, isize> {
     Ok(Foo {
         x: Bar { x: 22 },
         a: return Err(32)
@@ -42,41 +42,41 @@ fn baz() -> Result<Foo, int> {
 }
 
 // explicit immediate return
-fn aa() -> int {
+fn aa() -> isize {
     return 3;
 }
 
 // implicit immediate return
-fn bb() -> int {
+fn bb() -> isize {
     3
 }
 
 // implicit outptr return
-fn cc() -> Result<int, int> {
+fn cc() -> Result<isize, isize> {
     Ok(3)
 }
 
 // explicit outptr return
-fn dd() -> Result<int, int> {
+fn dd() -> Result<isize, isize> {
     return Ok(3);
 }
 
 trait A {
-    fn aaa(&self) -> int {
+    fn aaa(&self) -> isize {
         3
     }
-    fn bbb(&self) -> int {
+    fn bbb(&self) -> isize {
         return 3;
     }
-    fn ccc(&self) -> Result<int, int> {
+    fn ccc(&self) -> Result<isize, isize> {
         Ok(3)
     }
-    fn ddd(&self) -> Result<int, int> {
+    fn ddd(&self) -> Result<isize, isize> {
         return Ok(3);
     }
 }
 
-impl A for int {}
+impl A for isize {}
 
 fn main() {
     assert_eq!(foo(), Err(32));
@@ -87,12 +87,12 @@ fn main() {
     assert_eq!(cc().unwrap(), 3);
     assert_eq!(dd().unwrap(), 3);
 
-    let i = box 32i as Box<A>;
+    let i = box 32is as Box<A>;
     assert_eq!(i.aaa(), 3);
-    let i = box 32i as Box<A>;
+    let i = box 32is as Box<A>;
     assert_eq!(i.bbb(), 3);
-    let i = box 32i as Box<A>;
+    let i = box 32is as Box<A>;
     assert_eq!(i.ccc().unwrap(), 3);
-    let i = box 32i as Box<A>;
+    let i = box 32is as Box<A>;
     assert_eq!(i.ddd().unwrap(), 3);
 }
index b830234ded2b35eb1e6cc0aa5b7a9910da92a1cd..21baf47ee661071c78c75852b3f2fdc3da4281c2 100644 (file)
@@ -21,7 +21,7 @@ enum Enum {
 }
 
 #[inline(never)]
-fn foo(x: Enum) -> int {
+fn foo(x: Enum) -> isize {
     match x {
         Enum::Variant1(true) => 1,
         Enum::Variant1(false) => 2,
index 0f55ca707bdd3c52e2d50c8a44e2685cd2a819e4..242bcb69be60d1cdb6afb38b2f090f3aadeedfa5 100644 (file)
@@ -12,7 +12,7 @@
 
 use std::mem;
 
-static mut DROP_COUNT: uint = 0;
+static mut DROP_COUNT: usize = 0;
 
 struct Fragment;
 
index d9c87da57237322b013411955c5195e7a1c4f626..b6056d0ab8ca902df1ee403579ed9c8ecbae7d72 100644 (file)
@@ -13,6 +13,6 @@
 fn main() {
     if true { return }
     match () {
-        () => { static MAGIC: uint = 0; }
+        () => { static MAGIC: usize = 0; }
     }
 }
index 67af19b85175984aa49e64cfe613483f9b2af11a..fcb0462766291073da2f2de7c2fe787e56f0ca70 100644 (file)
 use std::cell::Cell;
 
 struct Field {
-    number: uint,
-    state: Rc<Cell<uint>>
+    number: usize,
+    state: Rc<Cell<usize>>
 }
 
 impl Field {
-    fn new(number: uint, state: Rc<Cell<uint>>) -> Field {
+    fn new(number: usize, state: Rc<Cell<usize>>) -> Field {
         Field {
             number: number,
             state: state
index 15a5080f5a242c09c2e43743a7c7af96c4fd83cf..33842fab6989cecf2df6720b630aadb74599b6bf 100644 (file)
@@ -17,7 +17,7 @@
 
 fn main() {
     let y = 0u8;
-    let closure = move |x| y + x;
+    let closure = move |x: u8| y + x;
 
     // Check that both closures are capturing by value
     assert_eq!(1, mem::size_of_val(&closure));
index cc64ffcab6f93213ebd1a11eab1ae9a3daff1c49..2a59c3051d5cb9a0a1d1a7fb9cf2dd34fb103949 100644 (file)
@@ -11,5 +11,5 @@
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    static _x: int = 1<<2;
+    static _x: isize = 1<<2;
 }
index a0d9eeb9e0bfda8ca970cbc6cdc18bc7a14a2ac7..54572296df7e0c4ecb9b9b91ccb4cf6c5eb499e3 100644 (file)
@@ -12,8 +12,8 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-16643" as i;
+extern crate issue_16643 as i;
 
 pub fn main() {
-    i::TreeBuilder { h: 3u }.process_token();
+    i::TreeBuilder { h: 3 }.process_token();
 }
index 6b0d5d7c5131330d13aa682f12bac632f396e40b..f0ff9ce7554b5c3cb23c58e885cfc82d576b6572 100644 (file)
 
 // pretty-expanded FIXME #23616
 
+#![feature(slice_patterns)]
+
 fn main() {
-    let x: (int, &[int]) = (2, &[1, 2]);
+    let x: (isize, &[isize]) = (2, &[1, 2]);
     assert_eq!(match x {
         (0, [_, _]) => 0,
         (1, _) => 1,
index e7af88647c02adc96f93cdc424e1ffd30a16fff7..17d0969ce1c023e9044387ddc0d5dfb7b1742d55 100644 (file)
@@ -17,7 +17,7 @@
 
 use std::ops::{Deref, DerefMut};
 
-struct X(Box<int>);
+struct X(Box<isize>);
 
 static mut DESTRUCTOR_RAN: bool = false;
 
@@ -31,16 +31,16 @@ fn drop(&mut self) {
 }
 
 impl Deref for X {
-    type Target = int;
+    type Target = isize;
 
-    fn deref(&self) -> &int {
+    fn deref(&self) -> &isize {
         let &X(box ref x) = self;
         x
     }
 }
 
 impl DerefMut for X {
-    fn deref_mut(&mut self) -> &mut int {
+    fn deref_mut(&mut self) -> &mut isize {
         let &mut X(box ref mut x) = self;
         x
     }
index 7db1b9b6f79689ceb0729dd18790e8c40484f4cf..55a6d4cdbace7f43000a0386225496241fc11261 100644 (file)
@@ -12,7 +12,7 @@
 // binding of a for loop
 // pretty-expanded FIXME #23616
 
-fn foo<'a>(v: &'a [uint]) -> &'a uint {
+fn foo<'a>(v: &'a [usize]) -> &'a usize {
     for &ref x in v { return x; }
     unreachable!()
 }
index 0c9debec3e037f7e6464eb69792719c72c0dc399..35bd07c896bb6bae66a2cce7348530aa79951ec6 100644 (file)
@@ -12,8 +12,8 @@
 
 static mut DROPPED: [bool; 2] = [false, false];
 
-struct A(uint);
-struct Foo { _a: A, _b: int }
+struct A(usize);
+struct Foo { _a: A, _b: isize }
 
 impl Drop for A {
     fn drop(&mut self) {
index a071224999be094bcfc0d598fce7b86eebd1c2de..796277ce74d1428a63e69d6cd504b6e64ea09993 100644 (file)
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 fn main() {
-    let s: &[int] = &[0, 1, 2, 3, 4];
-    let ss: &&[int] = &s;
-    let sss: &&&[int] = &ss;
+    let s: &[isize] = &[0, 1, 2, 3, 4];
+    let ss: &&[isize] = &s;
+    let sss: &&&[isize] = &ss;
 
     println!("{:?}", &s[..3]);
     println!("{:?}", &ss[3..]);
index ce1c077b23c57e45680060e87a18e566c17a226e..36e12b96c8744dd88b6f9c75f5f9335871ac5ecb 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-17662" as i;
+extern crate issue_17662 as i;
 
 use std::marker;
 
 struct Bar<'a> { m: marker::PhantomData<&'a ()> }
 
-impl<'a> i::Foo<'a, uint> for Bar<'a> {
-    fn foo(&self) -> uint { 5 }
+impl<'a> i::Foo<'a, usize> for Bar<'a> {
+    fn foo(&self) -> usize { 5 }
 }
 
 pub fn main() {
index 34699cf81b44775f0ed924665f2c0e6fc356be39..1fc8f3274d459cfb4bc2b7c1c353d9dca713acb5 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-const FOO: uint = 3;
+const FOO: usize = 3;
 
 fn main() {
     assert_eq!(FOO, 3);
index 3f6bfb84fbf3e947b317369dc12fa7042790e9c9..29d72000d07cc0271fd70c7510d2565ef7f6a215 100644 (file)
@@ -36,13 +36,13 @@ enum UnsafeEnum<T> {
 
 unsafe impl<T: Send> Sync for UnsafeEnum<T> {}
 
-static STATIC1: UnsafeEnum<int> = UnsafeEnum::VariantSafe;
+static STATIC1: UnsafeEnum<isize> = UnsafeEnum::VariantSafe;
 
-static STATIC2: MyUnsafePack<int> = MyUnsafePack(UnsafeCell { value: 1 });
-const CONST: MyUnsafePack<int> = MyUnsafePack(UnsafeCell { value: 1 });
-static STATIC3: MyUnsafe<int> = MyUnsafe{value: CONST};
+static STATIC2: MyUnsafePack<isize> = MyUnsafePack(UnsafeCell { value: 1 });
+const CONST: MyUnsafePack<isize> = MyUnsafePack(UnsafeCell { value: 1 });
+static STATIC3: MyUnsafe<isize> = MyUnsafe{value: CONST};
 
-static STATIC4: &'static MyUnsafePack<int> = &STATIC2;
+static STATIC4: &'static MyUnsafePack<isize> = &STATIC2;
 
 struct Wrap<T> {
     value: T
@@ -50,8 +50,8 @@ struct Wrap<T> {
 
 unsafe impl<T: Send> Sync for Wrap<T> {}
 
-static UNSAFE: MyUnsafePack<int> = MyUnsafePack(UnsafeCell{value: 2});
-static WRAPPED_UNSAFE: Wrap<&'static MyUnsafePack<int>> = Wrap { value: &UNSAFE };
+static UNSAFE: MyUnsafePack<isize> = MyUnsafePack(UnsafeCell{value: 2});
+static WRAPPED_UNSAFE: Wrap<&'static MyUnsafePack<isize>> = Wrap { value: &UNSAFE };
 
 fn main() {
     let a = &STATIC1;
index 2827ab9293642cebb37b836be19468d26b22e210..13e082eada884be65a7a5d69cbb649474782eafd 100644 (file)
 
 #![feature(core)]
 
-extern crate "issue-17718" as other;
+extern crate issue_17718 as other;
 
 use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
 
-const C1: uint = 1;
+const C1: usize = 1;
 const C2: AtomicUsize = ATOMIC_USIZE_INIT;
 const C3: fn() = foo;
-const C4: uint = C1 * C1 + C1 / C1;
-const C5: &'static uint = &C4;
-const C6: uint = {
-    const C: uint = 3;
+const C4: usize = C1 * C1 + C1 / C1;
+const C5: &'static usize = &C4;
+const C6: usize = {
+    const C: usize = 3;
     C
 };
 
-static S1: uint = 3;
+static S1: usize = 3;
 static S2: AtomicUsize = ATOMIC_USIZE_INIT;
 
 mod test {
-    static A: uint = 4;
-    static B: &'static uint = &A;
-    static C: &'static uint = &(A);
+    static A: usize = 4;
+    static B: &'static usize = &A;
+    static C: &'static usize = &(A);
 }
 
 fn foo() {}
index 82f324a395abd8cce3916e041c6811fd90a791a2..41fab9d9d54e0f905613e2200d58f5bd0b09846c 100644 (file)
@@ -10,6 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
+#![feature(slice_patterns)]
+
 fn main() {
     assert_eq!(match [0u8; 1024] {
         _ => 42_usize,
index adc33e3eed02281afbf225aceb858c80cafdd04b..3fbdb92e906172564053987806902bcbcf860dca 100644 (file)
@@ -12,7 +12,7 @@
 
 use std::thunk::Thunk;
 
-fn action(cb: Thunk<uint, uint>) -> uint {
+fn action(cb: Thunk<usize, usize>) -> usize {
     cb.invoke(1)
 }
 
index edf6f5e32c31f58cea035bf434400f767574176f..41dacd3320379c5eeb3abf6f7aba5a42a5a835a7 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait Foo {
-    fn foo(&self) -> uint;
+    fn foo(&self) -> usize;
 }
 
-struct A(uint);
+struct A(usize);
 
 impl A {
-    fn bar(&self) -> uint { self.0 }
+    fn bar(&self) -> usize { self.0 }
 }
 
 impl Foo for A {
-    fn foo(&self) -> uint { self.bar() }
+    fn foo(&self) -> usize { self.bar() }
 }
 
 fn main() {
index de6a5be83de38ef438aebcd0d7c123e34fe34bae..fb8158c6ddc600a24fc35582d11098add01e38cb 100644 (file)
@@ -15,7 +15,7 @@
 // aux-build:issue-18501.rs
 // pretty-expanded FIXME #23616
 
-extern crate "issue-18501" as issue;
+extern crate issue_18501 as issue;
 
 fn main() {
     issue::pass_method();
index f284ac90b4e6b0e558954daf822e801e8cb39178..b0b2f068bb74bb1be4f67cd62deee78da9bb132d 100644 (file)
@@ -17,7 +17,7 @@
 // aux-build:issue-18514.rs
 // pretty-expanded FIXME #23616
 
-extern crate "issue-18514" as ice;
+extern crate issue_18514 as ice;
 use ice::{Tr, St};
 
 fn main() {
index 897a3d082ba9af12fe3a0ccb365ad49513626f14..8de2d1e4259cfafafd6354d03f878a2b1f27666d 100644 (file)
@@ -15,7 +15,7 @@
 
 struct Foo;
 
-fn uint_to_foo(_: uint) -> Foo {
+fn uint_to_foo(_: usize) -> Foo {
     Foo
 }
 
index a4e6e6181ee31e1956397a25004a3656ede25392..2c346b93f5e8014dbb5d42f502e43837c3e4c6d1 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 mod a {
-    pub type rust_task = uint;
+    pub type rust_task = usize;
     pub mod rustrt {
         use super::rust_task;
         extern {
index 81c717f8174877555de3e2dbe9ef88b7e008b115..277ad3260c514845eb81e830856e5579b23ca5f3 100644 (file)
@@ -16,7 +16,7 @@
 #![feature(unboxed_closures)]
 
 // aux-build:issue-18711.rs
-extern crate "issue-18711" as issue;
+extern crate issue_18711 as issue;
 
 fn main() {
     (|| issue::inner(()))();
index 644a429750fbc9e937ae8f4ad5c6f997195f5faa..a92fcb01f5b302d9a6dd3599901014fdc28c377d 100644 (file)
@@ -12,7 +12,7 @@
 
 #[derive(Eq, PartialEq, PartialOrd, Ord)]
 enum Test<'a> {
-    Int(&'a int),
+    Int(&'a isize),
     Slice(&'a [u8]),
 }
 
index f72e7fbe30a35a14dd74df9a73b9952b805483cd..16e6c99f0e31d3d187511d9b93b0569ab98bdb4a 100644 (file)
@@ -21,6 +21,6 @@ pub fn name() -> &'static str {
 }
 
 fn main() {
-    assert_eq!(module_path!(), "issue-18859");
-    assert_eq!(foo::bar::baz::name(), "issue-18859::foo::bar::baz");
+    assert_eq!(module_path!(), "issue_18859");
+    assert_eq!(foo::bar::baz::name(), "issue_18859::foo::bar::baz");
 }
index ba2aaee02894d833fe74d945c064c96833553cfe..e553c244c865313d5e62f3826a32ef5bc4b48d6e 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-19340-1" as lib;
+extern crate issue_19340_1 as lib;
 
 use lib::Homura;
 
index 8b5269ab92f03f89848ce94021d39671c56d70e6..c0c210b3e96a468a61d88a1e75a178eceafb2bcc 100644 (file)
@@ -20,7 +20,7 @@ struct Bar<T> where T: Trait {
     bar: T,
 }
 
-impl Trait for int {}
+impl Trait for isize {}
 
 fn main() {
     let a = Foo { foo: 12 };
index 4c1d30d9eed58f769ef8b9543e695766f8053bd5..15ca6a9d4c1d244df9546e14507f5c9b37722f3f 100644 (file)
@@ -15,7 +15,7 @@
 
 trait Int {
     fn one() -> Self;
-    fn leading_zeros(self) -> uint;
+    fn leading_zeros(self) -> usize;
 }
 
 trait Foo {
index 80541171307651f696333e3269f2d92fb82e1dc8..d2e2d9bd6efcf052e8774af622739811cbc43044 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 trait Trait {
-        fn method(self) -> int;
+        fn method(self) -> isize;
 }
 
 struct Wrapper<T> {
@@ -19,7 +19,7 @@ struct Wrapper<T> {
 }
 
 impl<'a, T> Trait for &'a Wrapper<T> where &'a T: Trait {
-    fn method(self) -> int {
+    fn method(self) -> isize {
         let r: &'a T = &self.field;
         Trait::method(r); // these should both work
         r.method()
index f5d34c39ee578d4126b8e7e24e6d4cc4b0ff9423..bd844b7720c868a6f1d8031966e4c92f03db0677 100644 (file)
 pub fn main() {
     let one = || {
         enum r { a };
-        r::a as uint
+        r::a as usize
     };
     let two = || {
         enum r { a };
-        r::a as uint
+        r::a as usize
     };
     one(); two();
 }
index e9b9aeebdaf314e97e39d146ca1654975c9f56a6..41a9ca840b1782a3750538286f94c55bf118bc99 100644 (file)
@@ -17,7 +17,7 @@ fn test<T : Clone>(arg: T) -> T {
 }
 
 #[derive(PartialEq)]
-struct Test(int);
+struct Test(isize);
 
 fn main() {
     // Check that ranges implement clone
index 53297d0a8f3b96867c097366bc7fbb35fba3d5b0..fe540e1aabef8b6a4582d9c13025901fac25ea41 100644 (file)
 // pretty-expanded FIXME #23616
 
 fn main() {
-    if let Ok(x) = "3.1415".parse() {
+    if let Ok(x) = "3.1415".parse::<f64>() {
         assert_eq!(false, x <= 0.0);
     }
-    if let Ok(x) = "3.1415".parse() {
+    if let Ok(x) = "3.1415".parse::<f64>() {
         assert_eq!(3.1415, x + 0.0);
     }
-    if let Ok(mut x) = "3.1415".parse() {
+    if let Ok(mut x) = "3.1415".parse::<f64>() {
         assert_eq!(8.1415, { x += 5.0; x });
     }
 }
index 3da0a67ea8ef0a7ec5e589a297c5842a235cdf5e..fb0d2f0ad85057a36583c443aa4a44f519a1e05d 100644 (file)
@@ -17,8 +17,8 @@
 //
 // Running /usr/local/bin/rustc:
 // issue-2185.rs:24:0: 26:1 error: conflicting implementations for a trait
-// issue-2185.rs:24 impl iterable<uint> for 'static ||uint|| {
-// issue-2185.rs:25     fn iter(&self, blk: |v: uint|) { self( |i| blk(i) ) }
+// issue-2185.rs:24 impl iterable<usize> for 'static ||usize|| {
+// issue-2185.rs:25     fn iter(&self, blk: |v: usize|) { self( |i| blk(i) ) }
 // issue-2185.rs:26 }
 // issue-2185.rs:20:0: 22:1 note: note conflicting implementation here
 // issue-2185.rs:20 impl<A> iterable<A> for 'static ||A|| {
@@ -26,7 +26,7 @@
 // issue-2185.rs:22 }
 //
 // … so it looks like it's just not possible to implement both
-// the generic iterable<uint> and iterable<A> for the type iterable<uint>.
+// the generic iterable<usize> and iterable<A> for the type iterable<usize>.
 // Is it okay if I just remove this test?
 //
 // but Niko responded:
@@ -50,8 +50,8 @@ impl<A> iterable<A> for 'static ||A|| {
     fn iter(&self, blk: |A|) { self(blk); }
 }
 
-impl iterable<uint> for 'static ||uint|| {
-    fn iter(&self, blk: |v: uint|) { self( |i| blk(i) ) }
+impl iterable<usize> for 'static ||usize|| {
+    fn iter(&self, blk: |v: usize|) { self( |i| blk(i) ) }
 }
 
 fn filter<A,IA:iterable<A>>(self: IA, prd: 'static |A| -> bool, blk: |A|) {
@@ -68,7 +68,7 @@ fn foldl<A,B,IA:iterable<A>>(self: IA, b0: B, blk: |B, A| -> B) -> B {
     b
 }
 
-fn range(lo: uint, hi: uint, it: |uint|) {
+fn range(lo: usize, hi: usize, it: |usize|) {
     let mut i = lo;
     while i < hi {
         it(i);
@@ -77,12 +77,12 @@ fn range(lo: uint, hi: uint, it: |uint|) {
 }
 
 pub fn main() {
-    let range: 'static ||uint|| = |a| range(0, 1000, a);
-    let filt: 'static ||v: uint|| = |a| filter(
+    let range: 'static ||usize|| = |a| range(0, 1000, a);
+    let filt: 'static ||v: usize|| = |a| filter(
         range,
-        |&&n: uint| n % 3 != 0 && n % 5 != 0,
+        |&&n: usize| n % 3 != 0 && n % 5 != 0,
         a);
-    let sum = foldl(filt, 0, |accum, &&n: uint| accum + n );
+    let sum = foldl(filt, 0, |accum, &&n: usize| accum + n );
 
     println!("{}", sum);
 }
index 37acd34fbf0779e93ce2fad9ae3d8fc0125753bb..0e35de7cdcbaffccbf08bfaf72f17f40ff9ae911 100644 (file)
@@ -10,9 +10,9 @@
 
 // pretty-expanded FIXME #23616
 
-static foo: [uint; 3] = [1, 2, 3];
+static foo: [usize; 3] = [1, 2, 3];
 
-static slice_1: &'static [uint] = &foo;
-static slice_2: &'static [uint] = &foo;
+static slice_1: &'static [usize] = &foo;
+static slice_2: &'static [usize] = &foo;
 
 fn main() {}
index 41017134ba8a668d01616a18ae810bcbb9c84e98..b2c21a274cb83c07a6ea7a7bcae92b940dc4968e 100644 (file)
 use std::thread::Builder;
 use std::thunk::Thunk;
 
-static generations: uint = 1024+256+128+49;
+static generations: usize = 1024+256+128+49;
 
 fn spawn(f: Thunk<'static>) {
     Builder::new().stack_size(32 * 1024).spawn(move|| f.invoke(()));
 }
 
-fn child_no(x: uint) -> Thunk<'static> {
+fn child_no(x: usize) -> Thunk<'static> {
     Thunk::new(move|| {
         if x < generations {
             spawn(child_no(x+1));
index b5ea9c194a8a244b9af35a5b2e5cc5354ecd9a5e..38895e1414ceef04d59f0d65de1082879cc0d715 100644 (file)
 use std::mem;
 use libc::{c_double, c_int};
 
-fn to_c_int(v: &mut int) -> &mut c_int {
+fn to_c_int(v: &mut isize) -> &mut c_int {
     unsafe {
         mem::transmute_copy(&v)
     }
 }
 
-fn lgamma(n: c_double, value: &mut int) -> c_double {
+fn lgamma(n: c_double, value: &mut isize) -> c_double {
     unsafe {
         return m::lgamma(n, to_c_int(value));
     }
@@ -44,7 +44,7 @@ mod m {
 }
 
 pub fn main() {
-  let mut y: int = 5;
-  let x: &mut int = &mut y;
+  let mut y: isize = 5;
+  let x: &mut isize = &mut y;
   assert_eq!(lgamma(1.0 as c_double, x), 0.0 as c_double);
 }
index d4c882655b17a1b57a3d79303090075a89b158b7..3364fae0d6f3418171ec1bb5ea707a11af3359e0 100644 (file)
@@ -40,6 +40,6 @@ fn f<A>(x: Box<clam<A>>, a: A) {
 pub fn main() {
 
   let c = foo(42);
-  let d: Box<clam<int>> = box c as Box<clam<int>>;
+  let d: Box<clam<isize>> = box c as Box<clam<isize>>;
   f(d, c.x);
 }
index 76bb216ed77eb6b90ba5f2629464d6eaa4e9b470..fa056191e671e81ea6ca16274ba1a140c5596728 100644 (file)
@@ -14,7 +14,7 @@
 
 trait clam<A> { fn get(self) -> A; }
 
-struct foo(int);
+struct foo(isize);
 
 impl foo {
     pub fn bar<B,C:clam<B>>(&self, _c: C) -> B { panic!(); }
diff --git a/src/test/run-pass/issue-23485.rs b/src/test/run-pass/issue-23485.rs
new file mode 100644 (file)
index 0000000..f176c60
--- /dev/null
@@ -0,0 +1,58 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test for an ICE that occurred when a default method implementation
+// was applied to a type that did not meet the prerequisites. The
+// problem occurred specifically because normalizing
+// `Self::Item::Target` was impossible in this case.
+
+use std::boxed::Box;
+use std::marker::Sized;
+use std::clone::Clone;
+use std::ops::Deref;
+use std::option::Option;
+use std::option::Option::{Some,None};
+
+trait Iterator {
+    type Item;
+
+    fn next(&mut self) -> Option<Self::Item>;
+
+    fn clone_first(mut self) -> Option<<Self::Item as Deref>::Target> where
+        Self: Sized,
+        Self::Item: Deref,
+        <Self::Item as Deref>::Target: Clone,
+    {
+        self.next().map(|x| x.clone())
+    }
+}
+
+struct Counter {
+    value: i32
+}
+
+struct Token {
+    value: i32
+}
+
+impl Iterator for Counter {
+    type Item = Token;
+
+    fn next(&mut self) -> Option<Token> {
+        let x = self.value;
+        self.value += 1;
+        Some(Token { value: x })
+    }
+}
+
+fn main() {
+    let mut x: Box<Iterator<Item=Token>> = Box::new(Counter { value: 22 });
+    assert_eq!(x.next().unwrap().value, 22);
+}
diff --git a/src/test/run-pass/issue-23781.rs b/src/test/run-pass/issue-23781.rs
new file mode 100644 (file)
index 0000000..23ac8d2
--- /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.
+
+use std::fmt;
+
+struct Foo;
+impl fmt::Debug for Foo {
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+        println!("<Foo as Debug>::fmt()");
+
+        write!(fmt, "")
+    }
+}
+
+fn test1() {
+    let foo_str = format!("{:?}", Foo);
+
+    println!("{}", foo_str);
+}
+
+fn test2() {
+    println!("{:?}", Foo);
+}
+
+fn main() {
+    // This works fine
+    test1();
+
+    // This fails
+    test2();
+}
index df604fd8e667cbd79c348f813dff87699ccc04c6..402eb0349ab232e933cb2a5bd0a953790546564d 100644 (file)
 
 pub fn main() {
     let _foo = 100;
-    const quux: int = 5;
+    const quux: isize = 5;
 
     enum Stuff {
         Bar = quux
     }
 
-    assert_eq!(Stuff::Bar as int, quux);
+    assert_eq!(Stuff::Bar as isize, quux);
 }
index 7c72b3aad9290da09b09aa4f25d017a3af9ff8ec..c1d17d263d6d68691f547ed15ed6bcfcfff96af9 100644 (file)
@@ -15,7 +15,7 @@ struct c1<T> {
 }
 
 impl<T> c1<T> {
-    pub fn f1(&self, _x: int) {
+    pub fn f1(&self, _x: isize) {
     }
 }
 
@@ -26,12 +26,12 @@ fn c1<T>(x: T) -> c1<T> {
 }
 
 impl<T> c1<T> {
-    pub fn f2(&self, _x: int) {
+    pub fn f2(&self, _x: isize) {
     }
 }
 
 
 pub fn main() {
-    c1::<int>(3).f1(4);
-    c1::<int>(3).f2(4);
+    c1::<isize>(3).f1(4);
+    c1::<isize>(3).f2(4);
 }
index 3c72aa24f9b1cce238bcd805181a0fe48dbcfdee..0b6cf5890fd3ea002786f1532e8478b7422a1937 100644 (file)
@@ -30,6 +30,6 @@ pub fn f2(&self, _x: T) {}
 
 
 pub fn main() {
-    c1::<int>(3).f1(4);
-    c1::<int>(3).f2(4);
+    c1::<isize>(3).f1(4);
+    c1::<isize>(3).f2(4);
 }
index 2dc913a8f93e99d852d46bbb0eb91cafccc386db..f0b0614535bdf531ba3fd15743ce21c2c559e229 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct Pair { f: int, g: int }
+struct Pair { f: isize, g: isize }
 
 pub fn main() {
 
index 1c62d6a5f4a247c6e66fb33a6c0032399da5f2eb..76450b351f4570a37000b4abc0616ab280d1ba1e 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 struct socket {
-    sock: int,
+    sock: isize,
 
 }
 
@@ -33,6 +33,6 @@ fn socket() -> socket {
 
 fn closure<F>(f: F) where F: FnOnce() { f() }
 
-fn setsockopt_bytes(_sock: int) { }
+fn setsockopt_bytes(_sock: isize) { }
 
 pub fn main() {}
index d1e97e6cddf97616f852269e986e9793ff01951a..87b0b198f9b67c7acc17c310719d09f9a5bacb2a 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct C {
-    x: uint,
+    x: usize,
 }
 
-fn C(x: uint) -> C {
+fn C(x: usize) -> C {
     C {
         x: x
     }
index 17ace84b1e8a5e5f73a4cf9dfeed862889caab70..8cf80333e97222fcafce4495777e86a0e20ec0de 100644 (file)
@@ -18,7 +18,7 @@ trait A {
 }
 
 struct E {
- f: int
+ f: isize
 }
 
 impl A for E {
index b6d180da849c0c6e9c1c86317f49cd3e8adc2e40..7413ebd35046059abfa82a2b0199b272daa1dbef 100644 (file)
@@ -24,5 +24,5 @@ pub fn main() {
   let v = vec!(Rc::new("hi".to_string()));
   let mut m: req::header_map = HashMap::new();
   m.insert("METHOD".to_string(), Rc::new(RefCell::new(v)));
-  request::<int>(&m);
+  request::<isize>(&m);
 }
index 3812ead42f998b3c3bc37f1f6180571d890a3aa4..7b5a055d33435de68f6a0745a99c96cb2fe5ea69 100644 (file)
@@ -14,7 +14,7 @@
 #![feature(box_syntax)]
 
 
-fn a_val(x: Box<int>, y: Box<int>) -> int {
+fn a_val(x: Box<isize>, y: Box<isize>) -> isize {
     *x + *y
 }
 
index 113fe620d30dee5f35b16e932bf7d0b24edad924..f0bc31fb391c082d89ec74c9e8f7012987e8f160 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 fn f() {
-   let _x: uint = loop { loop { break; } };
+   let _x: usize = loop { loop { break; } };
 }
 
 pub fn main() {
index 3f9dc46775a1b4fd72b1e538178fdb3a3836c05e..d3916db3f755b6bdf75b2606ddf5429cbb1f842d 100644 (file)
@@ -14,9 +14,9 @@
 #![feature(box_syntax)]
 
 struct Font {
-    fontbuf: uint,
-    cairo_font: uint,
-    font_dtor: uint,
+    fontbuf: usize,
+    cairo_font: usize,
+    font_dtor: usize,
 
 }
 
index 7ca0ee01015b89f2c0db75779ff2ee1bd6afe691..7842bcb7dd1ec16637826896a28389a191fbc68a 100644 (file)
@@ -12,7 +12,7 @@
 
 #![feature(unsafe_destructor, std_misc)]
 
-pub type Task = int;
+pub type Task = isize;
 
 // tjc: I don't know why
 pub mod pipes {
@@ -31,7 +31,7 @@ pub struct Stuff<T> {
     }
 
     #[derive(PartialEq, Debug)]
-    #[repr(int)]
+    #[repr(isize)]
     pub enum state {
         empty,
         full,
@@ -59,9 +59,9 @@ pub fn packet<T:Send>() -> *const packet<T> {
     }
 
     mod rusti {
-      pub fn atomic_xchg(_dst: &mut int, _src: int) -> int { panic!(); }
-      pub fn atomic_xchg_acq(_dst: &mut int, _src: int) -> int { panic!(); }
-      pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { panic!(); }
+      pub fn atomic_xchg(_dst: &mut isize, _src: isize) -> isize { panic!(); }
+      pub fn atomic_xchg_acq(_dst: &mut isize, _src: isize) -> isize { panic!(); }
+      pub fn atomic_xchg_rel(_dst: &mut isize, _src: isize) -> isize { panic!(); }
     }
 
     // We should consider moving this to ::std::unsafe, although I
@@ -72,13 +72,13 @@ pub unsafe fn uniquify<T>(x: *const T) -> Box<T> {
 
     pub fn swap_state_acq(dst: &mut state, src: state) -> state {
         unsafe {
-            transmute(rusti::atomic_xchg_acq(transmute(dst), src as int))
+            transmute(rusti::atomic_xchg_acq(transmute(dst), src as isize))
         }
     }
 
     pub fn swap_state_rel(dst: &mut state, src: state) -> state {
         unsafe {
-            transmute(rusti::atomic_xchg_rel(transmute(dst), src as int))
+            transmute(rusti::atomic_xchg_rel(transmute(dst), src as isize))
         }
     }
 
index 5590f3432d509ded1cf3ba596db39e1f5af3fd30..8f30d262f41f5a6e6a7e11ed4e8e583811c9257b 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn thing<'r>(x: &'r [int]) -> &'r [int] { x }
+fn thing<'r>(x: &'r [isize]) -> &'r [isize] { x }
 
 pub fn main() {
     let x = &[1,2,3];
index 4c09c39e4f9a657fb3482aa5d049938131d98ead..6afb31619d1caf87077ffa5164457e1a006b1281 100644 (file)
@@ -17,7 +17,7 @@
 
 use std::collections::HashMap;
 
-fn add_interfaces(managed_ip: String, device: HashMap<String, int>)  {
+fn add_interfaces(managed_ip: String, device: HashMap<String, isize>)  {
      println!("{}, {}", managed_ip, device["interfaces"]);
 }
 
index dc1bee3a38c9e8a6fb2c421c47631411f194c89d..a2b4e218a079b74f5d4de69e0be0129d4a073548 100644 (file)
@@ -39,7 +39,7 @@ fn lookup(table: json::Object, key: String, default: String) -> String
     }
 }
 
-fn add_interface(_store: int, managed_ip: String, data: json::Json) -> (String, object)
+fn add_interface(_store: isize, managed_ip: String, data: json::Json) -> (String, object)
 {
     match &data {
         &Json::Object(ref interface) => {
@@ -57,7 +57,7 @@ fn add_interface(_store: int, managed_ip: String, data: json::Json) -> (String,
     }
 }
 
-fn add_interfaces(store: int, managed_ip: String, device: HashMap<String, json::Json>)
+fn add_interfaces(store: isize, managed_ip: String, device: HashMap<String, json::Json>)
 -> Vec<(String, object)> {
     match device["interfaces"] {
         Json::Array(ref interfaces) =>
index af5cf97519e94a73be4e7e336b055c1f5b56819c..3f4c630cc2b0a3e47899c142ce3237eabc2cb51a 100644 (file)
 use std::mem;
 
 struct Cat {
-    x: int
+    x: isize
 }
 
 struct Kitty {
-    x: int,
+    x: isize,
 }
 
 impl Drop for Kitty {
@@ -26,12 +26,12 @@ fn drop(&mut self) {}
 
 #[cfg(any(target_arch = "x86_64", target_arch="aarch64"))]
 pub fn main() {
-    assert_eq!(mem::size_of::<Cat>(), 8 as uint);
-    assert_eq!(mem::size_of::<Kitty>(), 16 as uint);
+    assert_eq!(mem::size_of::<Cat>(), 8 as usize);
+    assert_eq!(mem::size_of::<Kitty>(), 16 as usize);
 }
 
 #[cfg(any(target_arch = "x86", target_arch = "arm"))]
 pub fn main() {
-    assert_eq!(mem::size_of::<Cat>(), 4 as uint);
-    assert_eq!(mem::size_of::<Kitty>(), 8 as uint);
+    assert_eq!(mem::size_of::<Cat>(), 4 as usize);
+    assert_eq!(mem::size_of::<Kitty>(), 8 as usize);
 }
index e653dda8de5f00591470368694d1b2ad82b4aac8..fd8e1e6b036baa8123567679e216a977b352af55 100644 (file)
@@ -11,7 +11,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-//type t = { a: int };
+//type t = { a: isize };
 // type t = { a: bool };
 type t = bool;
 
index fb72773f4908237eead973965a1e1b354fb26677..5c63230f5d0ca63b9bccb0f7935b5fe375f436f2 100644 (file)
@@ -19,22 +19,22 @@ fn foo<T, U: bar<T>>(b: U) -> T {
 }
 
 struct cbar {
-    x: int,
+    x: isize,
 }
 
-impl bar<int> for cbar {
-    fn get_bar(&self) -> int {
+impl bar<isize> for cbar {
+    fn get_bar(&self) -> isize {
         self.x
     }
 }
 
-fn cbar(x: int) -> cbar {
+fn cbar(x: isize) -> cbar {
     cbar {
         x: x
     }
 }
 
 pub fn main() {
-    let x: int = foo::<int, cbar>(cbar(5));
+    let x: isize = foo::<isize, cbar>(cbar(5));
     assert_eq!(x, 5);
 }
index e7cd7926b2e828393786f5dd36d69fd4cc00afe0..d8499992f94d180d732dd21e8ef37b7f34c8ce35 100644 (file)
@@ -19,7 +19,7 @@
 
 pub fn main() {
     let x: Box<_>;
-    let mut buggy_map: HashMap<uint, &uint> = HashMap::new();
+    let mut buggy_map: HashMap<usize, &usize> = HashMap::new();
     x = box 1;
     buggy_map.insert(42, &*x);
 }
index ae4d05c76e321c9e13404d14fc58cdb032b016a9..0a37a013037775b38942cccc6e7ec663d5527a43 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct thing { x: int, }
+struct thing { x: isize, }
 
 impl Drop for thing {
     fn drop(&mut self) {}
index ecce97a301345cbebfe3b84f4b7056ab6052ac7c..29d963bb704688c3c1171b38f3e9b07a7e617760 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(unboxed_closures, old_path, std_misc)]
 
-use std::old_path::{Path};
+use std::old_path::Path;
 use std::old_path;
 use std::result;
 use std::thunk::Thunk;
index 6443ba243e2769eb1c71d8437b7091f46438698f..65c21317cf247727a0961558416bb7b3a46a78c4 100644 (file)
@@ -11,8 +11,8 @@
 // pretty-expanded FIXME #23616
 
 trait Canvas {
-    fn add_point(&self, point: &int);
-    fn add_points(&self, shapes: &[int]) {
+    fn add_point(&self, point: &isize);
+    fn add_points(&self, shapes: &[isize]) {
         for pt in shapes {
             self.add_point(pt)
         }
index 5dfe02cc9ec4b428d568bde176f38cdced7bd560..078376251176134da55c46743748cbbdf3c17f13 100644 (file)
 // Represents a position on a canvas.
 #[derive(Copy)]
 struct Point {
-    x: int,
-    y: int,
+    x: isize,
+    y: isize,
 }
 
 // Represents an offset on a canvas. (This has the same structure as a Point.
 // but different semantics).
 #[derive(Copy)]
 struct Size {
-    width: int,
-    height: int,
+    width: isize,
+    height: isize,
 }
 
 #[derive(Copy)]
@@ -51,8 +51,8 @@ struct Rect {
 
 // Contains the information needed to do shape rendering via ASCII art.
 struct AsciiArt {
-    width: uint,
-    height: uint,
+    width: usize,
+    height: usize,
     fill: char,
     lines: Vec<Vec<char> > ,
 
@@ -67,7 +67,7 @@ fn drop(&mut self) {}
 // It's common to define a constructor sort of function to create struct instances.
 // If there is a canonical constructor it is typically named the same as the type.
 // Other constructor sort of functions are typically named from_foo, from_bar, etc.
-fn AsciiArt(width: uint, height: uint, fill: char) -> AsciiArt {
+fn AsciiArt(width: usize, height: usize, fill: char) -> AsciiArt {
     // Use an anonymous function to build a vector of vectors containing
     // blank characters for each position in our canvas.
     let mut lines = Vec::new();
@@ -82,12 +82,12 @@ fn AsciiArt(width: uint, height: uint, fill: char) -> AsciiArt {
 
 // Methods particular to the AsciiArt struct.
 impl AsciiArt {
-    fn add_pt(&mut self, x: int, y: int) {
-        if x >= 0 && x < self.width as int {
-            if y >= 0 && y < self.height as int {
+    fn add_pt(&mut self, x: isize, y: isize) {
+        if x >= 0 && x < self.width as isize {
+            if y >= 0 && y < self.height as isize {
                 // Note that numeric types don't implicitly convert to each other.
-                let v = y as uint;
-                let h = x as uint;
+                let v = y as usize;
+                let h = x as usize;
 
                 // Vector subscripting will normally copy the element, but &v[i]
                 // will return a reference which is what we need because the
index e6c816666e798247c1c506720060f7969c5dbb3f..096eec803ffa1716aa51facbbb46d11ff6a82904 100644 (file)
 
 
 trait Foo {
-    fn a(&self) -> int;
-    fn b(&self) -> int {
+    fn a(&self) -> isize;
+    fn b(&self) -> isize {
         self.a() + 2
     }
 }
 
-impl Foo for int {
-    fn a(&self) -> int {
+impl Foo for isize {
+    fn a(&self) -> isize {
         3
     }
 }
index 6ac252c07ef793eb918e0dda836166dce90919b3..3d5f38e38cc56e37e0534ab644a8938e0c7e1b1d 100644 (file)
@@ -17,7 +17,7 @@ trait T {
 
 #[derive(Debug)]
 struct S {
-    s: int,
+    s: isize,
 }
 
 impl T for S {
index 9216c8aa1aef92c9218ac182cd3c43bf8e5e2f62..bd3a726991b915d43b08a1e4f5ed7dc2a467d9a2 100644 (file)
@@ -9,12 +9,12 @@
 // except according to those terms.
 
 mod buildings {
-    pub struct Tower { pub height: uint }
+    pub struct Tower { pub height: usize }
 }
 
 pub fn main() {
     let sears = buildings::Tower { height: 1451 };
-    let h: uint = match sears {
+    let h: usize = match sears {
         buildings::Tower { height: h } => { h }
     };
 
index 0fe1e2af0c1406e0e7750034ac5c8bd23f3e88dc..a29a26758654e8dd1ae842ba0b1f1ebae6ad531a 100644 (file)
@@ -10,9 +10,9 @@
 
 // pretty-expanded FIXME #23616
 
-enum PureCounter { PureCounterVariant(uint) }
+enum PureCounter { PureCounterVariant(usize) }
 
-fn each<F>(thing: PureCounter, blk: F) where F: FnOnce(&uint) {
+fn each<F>(thing: PureCounter, blk: F) where F: FnOnce(&usize) {
     let PureCounter::PureCounterVariant(ref x) = thing;
     blk(x);
 }
index 14e1b635e9446947819e9fb8eee4528a47a5211a..61708acf7f317f0d36e5eadc564a29471cdf7e43 100644 (file)
@@ -24,18 +24,18 @@ fn translate(&mut self, dx: S) {
   }
 }
 
-struct Point { x: int, y: int }
+struct Point { x: isize, y: isize }
 
-impl Positioned<int> for Point {
-    fn SetX(&mut self, x: int) {
+impl Positioned<isize> for Point {
+    fn SetX(&mut self, x: isize) {
         self.x = x;
     }
-    fn X(&self) -> int {
+    fn X(&self) -> isize {
         self.x
     }
 }
 
-impl Movable<int> for Point {}
+impl Movable<isize> for Point {}
 
 pub fn main() {
     let mut p = Point{ x: 1, y: 2};
index ddd005224523cfa7538ff2ec958ee6f9f742c0d0..0784877849ad108e6bc4f5967eaac76eda99a875 100644 (file)
 extern crate issue_3979_traits;
 use issue_3979_traits::{Positioned, Movable};
 
-struct Point { x: int, y: int }
+struct Point { x: isize, y: isize }
 
 impl Positioned for Point {
-    fn SetX(&mut self, x: int) {
+    fn SetX(&mut self, x: isize) {
         self.x = x;
     }
-    fn X(&self) -> int {
+    fn X(&self) -> isize {
         self.x
     }
 }
index 06d1cfa0e0d3a0bdecd8576e3d520773cd45bbe0..341866e4982ff96d4965ae158e83880b84506898 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait Positioned {
-  fn SetX(&mut self, int);
-  fn X(&self) -> int;
+  fn SetX(&mut self, isize);
+  fn X(&self) -> isize;
 }
 
 trait Movable: Positioned {
-  fn translate(&mut self, dx: int) {
+  fn translate(&mut self, dx: isize) {
     let x = self.X();
     self.SetX(x + dx);
   }
 }
 
-struct Point { x: int, y: int }
+struct Point { x: isize, y: isize }
 
 impl Positioned for Point {
-    fn SetX(&mut self, x: int) {
+    fn SetX(&mut self, x: isize) {
         self.x = x;
     }
-    fn X(&self) -> int {
+    fn X(&self) -> isize {
         self.x
     }
 }
index 77fb488488c2436373f81cbceca4f04049098adc..d89cf8c2e1064cf349d6bb275467ee49238f1b48 100644 (file)
@@ -12,7 +12,7 @@
 // pretty-expanded FIXME #23616
 
 struct HasNested {
-    nest: Vec<Vec<int> > ,
+    nest: Vec<Vec<isize> > ,
 }
 
 impl HasNested {
index b4aaf4cc7e987af7cc0575ad665b3cbfd96d6492..ae7bb8a6842243c2f72b75085d9bb2f4d9805d7d 100644 (file)
@@ -23,5 +23,5 @@
 pub fn main() {
     let json = json::from_str("[1]").unwrap();
     let mut decoder = json::Decoder::new(json);
-    let _x: Vec<int> = Decodable::decode(&mut decoder).unwrap();
+    let _x: Vec<isize> = Decodable::decode(&mut decoder).unwrap();
 }
index 0be76dd1b2243d1f07af02c569efa486a8108f8d..18025c315c95c9abf6eaa5ecaf8be87ee2e16331 100644 (file)
@@ -15,16 +15,16 @@ pub fn main() {
 }
 
 pub trait Index<Index,Result> { fn get(&self, Index) -> Result { panic!() } }
-pub trait Dimensional<T>: Index<uint, T> { }
+pub trait Dimensional<T>: Index<usize, T> { }
 
 pub struct Mat2<T> { x: T }
 pub struct Vec2<T> { x: T }
 
 impl<T> Dimensional<Vec2<T>> for Mat2<T> { }
-impl<T> Index<uint, Vec2<T>> for Mat2<T> { }
+impl<T> Index<usize, Vec2<T>> for Mat2<T> { }
 
 impl<T> Dimensional<T> for Vec2<T> { }
-impl<T> Index<uint, T> for Vec2<T> { }
+impl<T> Index<usize, T> for Vec2<T> { }
 
 pub trait Matrix<T,V>: Dimensional<V> {
     fn identity(t:T) -> Self;
index 89cf2f69b34ec456197260dbcebe7e84f4cad6df..c650fc25ee1636805e3d3ed8b4e408f7db897cfb 100644 (file)
 use extra::net::tcp::TcpSocketBuf;
 
 use std::io;
-use std::int;
+use std::isize;
 
 use std::io::{ReaderUtil,WriterUtil};
 
 enum Result {
   Nil,
-  Int(int),
+  Int(isize),
   Data(~[u8]),
   List(~[Result]),
   Error(String),
   Status(String)
 }
 
-priv fn parse_data(len: uint, io: @io::Reader) -> Result {
+priv fn parse_data(len: usize, io: @io::Reader) -> Result {
   let res =
       if (len > 0) {
-      let bytes = io.read_bytes(len as uint);
+      let bytes = io.read_bytes(len as usize);
       assert_eq!(bytes.len(), len);
       Data(bytes)
   } else {
@@ -42,7 +42,7 @@ enum Result {
   return res;
 }
 
-priv fn parse_list(len: uint, io: @io::Reader) -> Result {
+priv fn parse_list(len: usize, io: @io::Reader) -> Result {
     let mut list: ~[Result] = ~[];
     for _ in 0..len {
         let v = match io.read_char() {
@@ -60,26 +60,26 @@ enum Result {
 }
 
 priv fn parse_bulk(io: @io::Reader) -> Result {
-    match from_str::<int>(chop(io.read_line())) {
+    match from_str::<isize>(chop(io.read_line())) {
     None => panic!(),
     Some(-1) => Nil,
-    Some(len) if len >= 0 => parse_data(len as uint, io),
+    Some(len) if len >= 0 => parse_data(len as usize, io),
     Some(_) => panic!()
     }
 }
 
 priv fn parse_multi(io: @io::Reader) -> Result {
-    match from_str::<int>(chop(io.read_line())) {
+    match from_str::<isize>(chop(io.read_line())) {
     None => panic!(),
     Some(-1) => Nil,
     Some(0) => List(~[]),
-    Some(len) if len >= 0 => parse_list(len as uint, io),
+    Some(len) if len >= 0 => parse_list(len as usize, io),
     Some(_) => panic!()
     }
 }
 
 priv fn parse_int(io: @io::Reader) -> Result {
-    match from_str::<int>(chop(io.read_line())) {
+    match from_str::<isize>(chop(io.read_line())) {
     None => panic!(),
     Some(i) => Int(i)
     }
index 08ee955cabbacd65e29a8300f9901f6f29f60b6b..73ef35f0457d8650431cbd286d292c6f4206395e 100644 (file)
@@ -18,7 +18,7 @@ fn default_method<T: std::fmt::Debug>(&self, x: &T) {
 }
 
 #[derive(Debug)]
-struct Y(int);
+struct Y(isize);
 
 #[derive(Debug)]
 struct Z<T: X+std::fmt::Debug> {
index 753500cec99e995a9f6bcd498b89387347c0a583..675ca2c3b7ef879dcf97e84fc9d0bbeb3094a357 100644 (file)
@@ -10,6 +10,6 @@
 
 // pretty-expanded FIXME #23616
 
-fn broken(v: &[u8], i: uint, j: uint) -> &[u8] { &v[i..j] }
+fn broken(v: &[u8], i: usize, j: usize) -> &[u8] { &v[i..j] }
 
 pub fn main() {}
index a9d04167a41db9eba4951e87a7fbd5d7d9372cf5..6cb7ccc0e9543bec6e27c0c1a91ed9a01847d7e8 100644 (file)
@@ -12,5 +12,5 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-4545" as somelib;
-pub fn main() { somelib::mk::<int>(); }
+extern crate issue_4545 as somelib;
+pub fn main() { somelib::mk::<isize>(); }
index 30c8cb1bfa4581441c2aeb2574a6513d0426e7e3..82925852a6a3d0408a256e31ab929b6be256ad22 100644 (file)
 
 #![allow(path_statement)]
 
-struct A { n: int }
+struct A { n: isize }
 struct B;
 
-static mut NUM_DROPS: uint = 0;
+static mut NUM_DROPS: usize = 0;
 
 impl Drop for A {
     fn drop(&mut self) {
index 45db84ca93af01200775bdd2c16a9c3b546e07e4..56e69a9f36e789b2489345ad535506221d849227 100644 (file)
 impl Drop for NonCopyable {
     fn drop(&mut self) {
         let NonCopyable(p) = *self;
-        let _v = unsafe { transmute::<*const c_void, Box<int>>(p) };
+        let _v = unsafe { transmute::<*const c_void, Box<isize>>(p) };
     }
 }
 
 pub fn main() {
     let t = box 0;
-    let p = unsafe { transmute::<Box<int>, *const c_void>(t) };
+    let p = unsafe { transmute::<Box<isize>, *const c_void>(t) };
     let _z = NonCopyable(p);
 }
index c2fc559ae81d30f0871f7fe0e3ed7c31c292b173..a26d6b05d7ee7ad8a8b8600008bd51da636c48fa 100644 (file)
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct T { a: Box<int> }
+struct T { a: Box<isize> }
 
 trait U {
     fn f(self);
 }
 
-impl U for Box<int> {
+impl U for Box<isize> {
     fn f(self) { }
 }
 
index 15d870b12a719a4e13bb777af958013e97ca4f23..f615767c215587fc455f3dcb86b2f6bbcab7341e 100644 (file)
@@ -13,7 +13,7 @@
 
 pub struct Scheduler {
     /// The event loop used to drive the scheduler and perform I/O
-    event_loop: Box<int>
+    event_loop: Box<isize>
 }
 
 pub fn main() { }
index 2a871522b447e0b7314c2cd4034dfea72ca384bc..d8f7f25508dd8aa0fb1c10f9609a7765bca337b4 100644 (file)
@@ -18,7 +18,7 @@ fn dummy(&self) { }
 }
 
 pub struct UvEventLoop {
-    uvio: int
+    uvio: isize
 }
 
 impl UvEventLoop {
index 6720bb3f0f95d1ffc1b0251162b5f671a490728c..d8491070bd8b51d87a92f458a32fa36509975b2e 100644 (file)
@@ -13,7 +13,7 @@
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    let _f = |ref x: int| { *x };
+    let _f = |ref x: isize| { *x };
     let foo = 10;
     assert!(_f(foo) == 10);
 }
index 31dc8208725c07d5ef2fcec60d025e3b0c56a698..eda0eea70712cd04c9af8944e294ae1bf2d2e549 100644 (file)
@@ -15,7 +15,7 @@
 // pretty-expanded FIXME #23616
 
 struct S<'a> {
-    v: &'a int
+    v: &'a isize
 }
 
 fn f<'lt>(_s: &'lt S<'lt>) {}
index 2ab41f7783862860932f85db8ca8815cd9071147..d0bc396c368bdf4b1f8aa49896bd93490ef72e84 100644 (file)
@@ -14,7 +14,7 @@ trait Fooable {
     fn yes(self);
 }
 
-impl Fooable for uint {
+impl Fooable for usize {
     fn yes(self) {
         for _ in 0..self { println!("yes"); }
     }
index e24b69bb0de1ff092140e1cc3cca74563e8b1498..5981a0148a0af39f84c3ffb8717f10d5b4cd82f1 100644 (file)
@@ -12,6 +12,6 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-5518" as other;
+extern crate issue_5518 as other;
 
 fn main() {}
index c9196fc66b032f5bbfc8e2bed97a57f4e44568a5..4ad729f1bc60a114b34bcb591d9a33d321582223 100644 (file)
@@ -13,7 +13,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-5521" as foo;
+extern crate issue_5521 as foo;
 
 fn bar(a: foo::map) {
     if false {
index 7b3d226fe124edfd05f617bef9051b5737d11a57..50b9ca6e797d8dc868251a49f3780640a688ee28 100644 (file)
 // pretty-expanded FIXME #23616
 
 enum Enum {
-    Foo { foo: uint },
-    Bar { bar: uint }
+    Foo { foo: usize },
+    Bar { bar: usize }
 }
 
-fn fun1(e1: &Enum, e2: &Enum) -> uint {
+fn fun1(e1: &Enum, e2: &Enum) -> usize {
     match (e1, e2) {
         (&Enum::Foo { foo: _ }, &Enum::Foo { foo: _ }) => 0,
         (&Enum::Foo { foo: _ }, &Enum::Bar { bar: _ }) => 1,
@@ -24,7 +24,7 @@ fn fun1(e1: &Enum, e2: &Enum) -> uint {
     }
 }
 
-fn fun2(e1: &Enum, e2: &Enum) -> uint {
+fn fun2(e1: &Enum, e2: &Enum) -> usize {
     match (e1, e2) {
         (&Enum::Foo { foo: _ }, &Enum::Foo { foo: _ }) => 0,
         (&Enum::Foo { foo: _ }, _              ) => 1,
index 63dcae41d8384b823a1c5c3e023bdac7f88d0ca2..e8190a7245a1e88c2659b19027385081a8c8b027 100644 (file)
@@ -28,7 +28,7 @@ fn default() -> X<T> {
 
 macro_rules! constants {
     () => {
-        let _ : X<int> = Default::default();
+        let _ : X<isize> = Default::default();
     }
 }
 
index 9612c4bf181bd6d2a55b6e8991eb31d7bea31625..3c25c6dc8edd743de11ceee267f6bf1e9ee08fcb 100644 (file)
 
 ...should print &[1, 2, 3] but instead prints something like
 &[4492532864, 24]. It is pretty evident that the compiler messed up
-with the representation of [int; n] and [int] somehow, or at least
+with the representation of [isize; n] and [isize] somehow, or at least
 failed to typecheck correctly.
 */
 
 #[derive(Copy)]
-struct X { vec: &'static [int] }
+struct X { vec: &'static [isize] }
 
 static V: &'static [X] = &[X { vec: &[1, 2, 3] }];
 
index 54773d71cbec0464575cabb24c2ea131181cadab..dfb560db10067f4c81fec2133926622f4f160bfb 100644 (file)
@@ -24,7 +24,7 @@ trait Inner {
     fn print(&self);
 }
 
-impl Inner for int {
+impl Inner for isize {
     fn print(&self) { print!("Inner: {}\n", *self); }
 }
 
@@ -41,7 +41,7 @@ fn new(inner: &Inner) -> Outer {
 }
 
 pub fn main() {
-    let inner: int = 5;
+    let inner: isize = 5;
     let outer = Outer::new(&inner as &Inner);
     outer.inner.print();
 }
index 8eea99cf562363bbde8c3e01da8b8b33fc873112..964809631d9cdc1b82287df666f83b7513a3988e 100644 (file)
@@ -20,13 +20,13 @@ macro_rules! foo {
         if $tag == $string {
             let element: Box<_> = box Element;
             unsafe {
-                return std::mem::transmute::<_, uint>(element);
+                return std::mem::transmute::<_, usize>(element);
             }
         }
     }
 }
 
-fn bar() -> uint {
+fn bar() -> usize {
     foo!("a", "b");
     0
 }
index d798560a232a1d3985b816f24c5b72db1dde5c48..2096bebd2b2d3c50126055b32ff7da1b86a45857 100644 (file)
 #![feature(box_syntax)]
 
 pub struct Foo {
-    a: int,
+    a: isize,
 }
 
 struct Bar<'a> {
-    a: Box<Option<int>>,
+    a: Box<Option<isize>>,
     b: &'a Foo,
 }
 
index 65ece1f671154257920cb79206b7cfd55797ada0..d3a43b51dcff49e676429be211806535ab0cecdd 100644 (file)
@@ -17,7 +17,7 @@ pub struct FooStruct { bar : Bar }
 }
 
 pub enum Bar {
-    Bar0 = 0 as int
+    Bar0 = 0 as isize
 }
 
 pub fn main() {}
index 56122700683b789bad6a1353b3a038692e4bd666..7f741182f422313495d5f5061fde718ea8b11d26 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct T (&'static [int]);
+struct T (&'static [isize]);
 static t : T = T (&[5, 4, 3]);
 pub fn main () {
     let T(ref v) = t;
index dd311c812e50ffa233ddfb1c28b82df6128629fe..48923bc82b4e0c4f13bbd75b3b9722181fed568a 100644 (file)
@@ -19,6 +19,6 @@ enum E<T> { V(T) }
 }
 
 fn main() {
-    let b = f::<int>();
+    let b = f::<isize>();
     assert!(b);
 }
index 84baff9aae1d826940df87cf803c8f54c018d5ae..baf829bc269b626bebe04767a10a828c5b0e3c1c 100644 (file)
@@ -23,16 +23,16 @@ trait Graph<Node, Edge> {
 
 }
 
-impl<E> Graph<int, E> for HashMap<int, int> {
+impl<E> Graph<isize, E> for HashMap<isize, isize> {
     fn f(&self, _e: E) {
         panic!();
     }
-    fn g(&self, _e: int) {
+    fn g(&self, _e: isize) {
         panic!();
     }
 }
 
 pub fn main() {
-    let g : Box<HashMap<int,int>> = box HashMap::new();
-    let _g2 : Box<Graph<int,int>> = g as Box<Graph<int,int>>;
+    let g : Box<HashMap<isize,isize>> = box HashMap::new();
+    let _g2 : Box<Graph<isize,isize>> = g as Box<Graph<isize,isize>>;
 }
index 1f204ab896b9feb4c6d56e055cadf6bc2866bd76..6f158339169cbeea971fc422bc106be01e0889e6 100644 (file)
 #![deny(type_limits)]
 
 pub fn main() {
-    let i: uint = 0;
+    let i: usize = 0;
     assert!(i <= 0xFFFF_FFFF);
 
-    let i: int = 0;
+    let i: isize = 0;
     assert!(i >= -0x8000_0000);
     assert!(i <= 0x7FFF_FFFF);
 }
index 5df3478c84cdaa76638fc3b611abb1de0ae402de..c280ea31ebc4745fe88106173fe7c00d0da05c90 100644 (file)
@@ -11,7 +11,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn swap<F>(f: F) -> Vec<int> where F: FnOnce(Vec<int>) -> Vec<int> {
+fn swap<F>(f: F) -> Vec<isize> where F: FnOnce(Vec<isize>) -> Vec<isize> {
     let x = vec!(1, 2, 3);
     f(x)
 }
index 756aaece681aba8d847cb22946f64473ebd32db8..c7832ae41e3fb86aa409a4205efd28a2cdad8ab2 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-pub trait OpInt { fn call(&mut self, int, int) -> int; }
+pub trait OpInt { fn call(&mut self, isize, isize) -> isize; }
 
-impl<F> OpInt for F where F: FnMut(int, int) -> int {
-    fn call(&mut self, a:int, b:int) -> int {
+impl<F> OpInt for F where F: FnMut(isize, isize) -> isize {
+    fn call(&mut self, a:isize, b:isize) -> isize {
         (*self)(a, b)
     }
 }
 
-fn squarei<'a>(x: int, op: &'a mut OpInt) -> int { op.call(x, x) }
+fn squarei<'a>(x: isize, op: &'a mut OpInt) -> isize { op.call(x, x) }
 
-fn muli(x:int, y:int) -> int { x * y }
+fn muli(x:isize, y:isize) -> isize { x * y }
 
 pub fn main() {
     let mut f = |x, y| muli(x, y);
index fa546a80bfbc3241b0ecd861520b37fbb2f751ae..2f2dca8fe226c298598d842cbd29d0d1277e020d 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait A {
-    fn a(&self) -> uint;
+    fn a(&self) -> usize;
 }
 
 trait B {
-    fn b(&self) -> uint;
+    fn b(&self) -> usize;
 }
 
 trait C {
-    fn combine<T:A+B>(&self, t: &T) -> uint;
+    fn combine<T:A+B>(&self, t: &T) -> usize;
 }
 
 struct Foo;
 
 impl A for Foo {
-    fn a(&self) -> uint { 1 }
+    fn a(&self) -> usize { 1 }
 }
 
 impl B for Foo {
-    fn b(&self) -> uint { 2 }
+    fn b(&self) -> usize { 2 }
 }
 
 struct Bar;
 
 impl C for Bar {
     // Note below: bounds in impl decl are in reverse order.
-    fn combine<T:B+A>(&self, t: &T) -> uint {
+    fn combine<T:B+A>(&self, t: &T) -> usize {
         (t.a() * 100) + t.b()
     }
 }
 
-fn use_c<S:C, T:B+A>(s: &S, t: &T) -> uint {
+fn use_c<S:C, T:B+A>(s: &S, t: &T) -> usize {
     s.combine(t)
 }
 
index 8ca921f5a0595e947c339b06ee6e3e244424f9f2..41abaa2c8b853abaf29e883bc8e50f59cc8c8de4 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 #[derive(PartialEq)]
-struct A { x: uint }
+struct A { x: usize }
 
 impl Drop for A {
     fn drop(&mut self) {}
index 65ee062a0396078f4b38fecaedb89138bb9c94bd..8449d9f572bf06c8e7eba90e7dad0ceadfc6ac57 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct A { x: uint }
+struct A { x: usize }
 
 impl Drop for A {
     fn drop(&mut self) {}
index ee99ec957b5a6c4a62632a4112e82aec23411b22..4bb23295c858c633c5d61003868a5c0403451670 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct A { x: uint }
+struct A { x: usize }
 
 impl Drop for A {
     fn drop(&mut self) {}
index 6d2b3ffc75beba415831e9da0ccc86bb96df5539..3b33a0ac86f697db94930af6d5e76c62f729cf0f 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 enum Foo {
-    Bar(int),
+    Bar(isize),
     Baz,
 }
 
index 05a5dcbc3f88973b4bf65531c3cb0b6c7076aa80..9b5f78a14504a5e76b32300139a5748541e38917 100644 (file)
@@ -12,7 +12,7 @@
 
 pub mod Bar {
     pub struct Foo {
-        v: int,
+        v: isize,
     }
 
     extern {
index a618b3d2e7cd98c796ac8ebc422d5ed374f4e124..eba87f418e48974c16e13afc6e7e3ce88fa3112e 100644 (file)
@@ -14,6 +14,6 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 
-fn foo(box (_x, _y): Box<(int, int)>) {}
+fn foo(box (_x, _y): Box<(isize, isize)>) {}
 
 pub fn main() {}
index 43da077ab1f8f147101f29fdc5296aa1c217eba0..4469dcc0ced81df203f2c649cd24c7b5bcfb6a91 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct Foo;
-struct Bar { x: int }
-struct Baz(int);
-enum FooBar { _Foo(Foo), _Bar(uint) }
+struct Bar { x: isize }
+struct Baz(isize);
+enum FooBar { _Foo(Foo), _Bar(usize) }
 
-static mut NUM_DROPS: uint = 0;
+static mut NUM_DROPS: usize = 0;
 
 impl Drop for Foo {
     fn drop(&mut self) {
index 19e59ea2d73313245539eb3a7c4d6a450d5f0041..3138aad2c8cc9b5778e34a65717272301b35d2ab 100644 (file)
 use std::intrinsics;
 
 /// Returns the size of a type
-pub fn size_of<T>() -> uint {
+pub fn size_of<T>() -> usize {
     TypeInfo::size_of(None::<T>)
 }
 
 /// Returns the size of the type that `val` points to
-pub fn size_of_val<T>(val: &T) -> uint {
+pub fn size_of_val<T>(val: &T) -> usize {
     val.size_of_val()
 }
 
 pub trait TypeInfo {
-    fn size_of(_lame_type_hint: Option<Self>) -> uint;
-    fn size_of_val(&self) -> uint;
+    fn size_of(_lame_type_hint: Option<Self>) -> usize;
+    fn size_of_val(&self) -> usize;
 }
 
 impl<T> TypeInfo for T {
     /// The size of the type in bytes.
-    fn size_of(_lame_type_hint: Option<T>) -> uint {
+    fn size_of(_lame_type_hint: Option<T>) -> usize {
         unsafe { intrinsics::size_of::<T>() }
     }
 
     /// Returns the size of the type of `self` in bytes.
-    fn size_of_val(&self) -> uint {
+    fn size_of_val(&self) -> usize {
         TypeInfo::size_of(None::<T>)
     }
 }
index 3180927f74d88ea43064b99cb21e02c61ca26024..0882203cb1ea51089a1ff49a4762c33f376e5631 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-7178" as cross_crate_self;
+extern crate issue_7178 as cross_crate_self;
 
 pub fn main() {
     let _ = cross_crate_self::Foo::new(&1);
index eda2057f6d6afbc70cb4266d4f6a5e2ef727828c..6d2a602fc8df7d7fdf5ad0e297e0d1d430d2ecc6 100644 (file)
@@ -13,9 +13,9 @@ trait IDummy {
 }
 
 #[derive(Debug)]
-struct A { a: int }
+struct A { a: isize }
 #[derive(Debug)]
-struct B<'a> { b: int, pa: &'a A }
+struct B<'a> { b: isize, pa: &'a A }
 
     impl IDummy for A {
         fn do_nothing(&self) {
index 471caa551498f8b3f7a3e4447cf7fe7e46f263bb..727ed91eadc6c41ba59dfc0e272ea7ca8cabcfd3 100644 (file)
@@ -19,8 +19,8 @@ trait Bar {
     fn new(&self) -> bool { true }
 }
 
-impl Bar for int {}
-impl Foo for int {}
+impl Bar for isize {}
+impl Foo for isize {}
 
 fn main() {
     assert!(1.new());
index f044c4d3e5022710e560f808127b130e8ec7ba63..b0ebc6c9cc82b16679953a83a9705069fef9fc88 100644 (file)
 
 use std::collections::HashMap;
 
-struct A(int, int);
+struct A(isize, isize);
 
 pub fn main() {
-    let mut m: HashMap<int, A> = HashMap::new();
+    let mut m: HashMap<isize, A> = HashMap::new();
     m.insert(1, A(0, 0));
 
     let A(ref _a, ref _b) = m[&1];
index 3b954ff19481a4d0d3008273f13e3d409e987606..007127aeae186b1d87e0c6255a25f1744c9af57b 100644 (file)
@@ -14,8 +14,8 @@
 
 mod test1 {
 
-    mod foo { pub fn p() -> int { 1 } }
-    mod bar { pub fn p() -> int { 2 } }
+    mod foo { pub fn p() -> isize { 1 } }
+    mod bar { pub fn p() -> isize { 2 } }
 
     pub mod baz {
         use test1::bar::p;
@@ -26,8 +26,8 @@ pub mod baz {
 
 mod test2 {
 
-    mod foo { pub fn p() -> int { 1 } }
-    mod bar { pub fn p() -> int { 2 } }
+    mod foo { pub fn p() -> isize { 1 } }
+    mod bar { pub fn p() -> isize { 2 } }
 
     pub mod baz {
         use test2::bar::p;
index 9dc2bd81182850f25e6f5adb148aec4f97c74d8c..e2016feeb0ad75dbb0c4cdf72c7397e46e1f5d4a 100644 (file)
@@ -11,6 +11,7 @@
 // pretty-expanded FIXME #23616
 
 #![feature(advanced_slice_patterns)]
+#![feature(slice_patterns)]
 
 use std::ops::Add;
 
index a830de42862dfbe4dfdec1ebebe941dda48c8144..a17565fa0ac5b0b572918e628d0b6aa14a974d4e 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-7899" as testcrate;
+extern crate issue_7899 as testcrate;
 
 fn main() {
     let f = testcrate::V2(1.0f32, 2.0f32);
index 284b0ff034815c6c14f27a8251cc737027bc2221..4f72409c36e1c9acd48256a94fec304e0c593760 100644 (file)
@@ -12,9 +12,9 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-8044" as minimal;
+extern crate issue_8044 as minimal;
 use minimal::{BTree, leaf};
 
 pub fn main() {
-    BTree::<int> { node: leaf(1) };
+    BTree::<isize> { node: leaf(1) };
 }
index 34e5ee5621b15df11c79fd42cb74875fae0470ab..e7f09789c5ba05890d25751f80ff3f38d9f0bc2a 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-8259" as other;
+extern crate issue_8259 as other;
 static a: other::Foo<'static> = other::Foo::A;
 
 pub fn main() {}
index 4e42f943d356c3e63229bbf6e65beee9d17c1cb6..a11e14fb333671130c9d61277158fb76bcc7a778 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 enum E {
-    Foo{f: int},
+    Foo{f: isize},
     Bar,
 }
 
index 10dd803d050c7c868e82bed23a787fdd4fa7e41f..7cf221926a6d375d173ed28303dc4de2310831e8 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 enum E {
-    Foo{f: int, b: bool},
+    Foo{f: isize, b: bool},
     Bar,
 }
 
index 0ef668794ec0df00489f09c214a4a79122ac12a8..7d8c4ab210d002e1d09d60564f4d41e565aed1f7 100644 (file)
@@ -25,19 +25,19 @@ fn main() {
     assert!(thread::spawn(move|| { min_val::<i16>() / -1; }).join().is_err());
     assert!(thread::spawn(move|| { min_val::<i32>() / -1; }).join().is_err());
     assert!(thread::spawn(move|| { min_val::<i64>() / -1; }).join().is_err());
-    assert!(thread::spawn(move|| { 1isize / zero(); }).join().is_err());
-    assert!(thread::spawn(move|| { 1i8 / zero(); }).join().is_err());
-    assert!(thread::spawn(move|| { 1i16 / zero(); }).join().is_err());
-    assert!(thread::spawn(move|| { 1i32 / zero(); }).join().is_err());
-    assert!(thread::spawn(move|| { 1i64 / zero(); }).join().is_err());
+    assert!(thread::spawn(move|| { 1isize / zero::<isize>(); }).join().is_err());
+    assert!(thread::spawn(move|| { 1i8 / zero::<i8>(); }).join().is_err());
+    assert!(thread::spawn(move|| { 1i16 / zero::<i16>(); }).join().is_err());
+    assert!(thread::spawn(move|| { 1i32 / zero::<i32>(); }).join().is_err());
+    assert!(thread::spawn(move|| { 1i64 / zero::<i64>(); }).join().is_err());
     assert!(thread::spawn(move|| { min_val::<isize>() % -1; }).join().is_err());
     assert!(thread::spawn(move|| { min_val::<i8>() % -1; }).join().is_err());
     assert!(thread::spawn(move|| { min_val::<i16>() % -1; }).join().is_err());
     assert!(thread::spawn(move|| { min_val::<i32>() % -1; }).join().is_err());
     assert!(thread::spawn(move|| { min_val::<i64>() % -1; }).join().is_err());
-    assert!(thread::spawn(move|| { 1isize % zero(); }).join().is_err());
-    assert!(thread::spawn(move|| { 1i8 % zero(); }).join().is_err());
-    assert!(thread::spawn(move|| { 1i16 % zero(); }).join().is_err());
-    assert!(thread::spawn(move|| { 1i32 % zero(); }).join().is_err());
-    assert!(thread::spawn(move|| { 1i64 % zero(); }).join().is_err());
+    assert!(thread::spawn(move|| { 1isize % zero::<isize>(); }).join().is_err());
+    assert!(thread::spawn(move|| { 1i8 % zero::<i8>(); }).join().is_err());
+    assert!(thread::spawn(move|| { 1i16 % zero::<i16>(); }).join().is_err());
+    assert!(thread::spawn(move|| { 1i32 % zero::<i32>(); }).join().is_err());
+    assert!(thread::spawn(move|| { 1i64 % zero::<i64>(); }).join().is_err());
 }
index a75696fbe29303a6d28a070ff43e022e149d1620..6467262929810ab9d426656b859ff476f5d207ce 100644 (file)
@@ -19,6 +19,6 @@ macro_rules! spath {
 }
 
 fn main() {
-    assert_eq!(sty!(int), "int");
+    assert_eq!(sty!(isize), "isize");
     assert_eq!(spath!(std::option), "std::option");
 }
index 8097df4927adf3d61b21b022809874b7d27d9bee..485a76ff7ece91c09b6acd9fb55cebcac6fe98f0 100644 (file)
@@ -12,7 +12,7 @@
 
 use std::default::Default;
 
-struct X { pub x: uint }
+struct X { pub x: usize }
 impl Default for X {
     fn default() -> X {
         X { x: 42 }
index b2aa93d280c926c568741a894cd0b055888120cf..4e1ff84291eb129f0d2e21b5fbdaa126aaa67d7a 100644 (file)
@@ -13,7 +13,7 @@
 use std::thread::Thread;
 use std::sync::mpsc::{channel, Receiver};
 
-fn periodical(n: int) -> Receiver<bool> {
+fn periodical(n: isize) -> Receiver<bool> {
     let (chan, port) = channel();
     Thread::spawn(move|| {
         loop {
@@ -32,7 +32,7 @@ fn periodical(n: int) -> Receiver<bool> {
     return port;
 }
 
-fn integers() -> Receiver<int> {
+fn integers() -> Receiver<isize> {
     let (chan, port) = channel();
     Thread::spawn(move|| {
         let mut i = 1;
index 48cb2a64bb7fcc82cf193292ac308a3647f17b09..2a0c02b23e8eed2a5f2b07f48883c95bb0aef21c 100644 (file)
 // pretty-expanded FIXME #23616
 
 enum T {
-    A(int),
-    B(uint)
+    A(isize),
+    B(usize)
 }
 
 macro_rules! test {
     ($id:ident, $e:expr) => (
-        fn foo(t: T) -> int {
+        fn foo(t: T) -> isize {
             match t {
                 T::A($id) => $e,
                 T::B($id) => $e
@@ -31,7 +31,7 @@ fn foo(t: T) -> int {
     )
 }
 
-test!(y, 10 + (y as int));
+test!(y, 10 + (y as isize));
 
 pub fn main() {
     foo(T::A(20));
index 968f621037fa531970a3132a27e618c9803b10fb..8024eaeda83cbc791d396d17cd56c3ad5811317c 100644 (file)
@@ -10,9 +10,9 @@
 
 // pretty-expanded FIXME #23616
 
-static mut DROP: int = 0;
-static mut DROP_S: int = 0;
-static mut DROP_T: int = 0;
+static mut DROP: isize = 0;
+static mut DROP_S: isize = 0;
+static mut DROP_T: isize = 0;
 
 struct S;
 impl Drop for S {
@@ -25,7 +25,7 @@ fn drop(&mut self) {
 }
 fn f(ref _s: S) {}
 
-struct T { i: int }
+struct T { i: isize }
 impl Drop for T {
     fn drop(&mut self) {
         unsafe {
index 99413819852188dd19a56482fe36208ce1ee767e..aa3e601c3a205d83716ff33036d2fcec9a9e517e 100644 (file)
@@ -10,7 +10,7 @@
 
 fn decode() -> String {
     'outer: loop {
-        let mut ch_start: uint;
+        let mut ch_start: usize;
         break 'outer;
     }
     "".to_string()
index 6c843993040f38d65dcf0a77c0bb90801c982265..99db47c172e21fbba778f6dbdb0c7eb3d7bc5525 100644 (file)
@@ -17,7 +17,7 @@
 pub struct S;
 impl bomb for S { fn boom(&self, _: Ident) { } }
 
-pub struct Ident { name: uint }
+pub struct Ident { name: usize }
 
 // macro_rules! int3 { () => ( unsafe { asm!( "int3" ); } ) }
 macro_rules! int3 { () => ( { } ) }
index 1600ce22dd4d6682794627e03a571782a9e15a67..0bd8a8e0d9df27ad505d2101672ed3d002b4a9f2 100644 (file)
@@ -16,6 +16,6 @@
 
 pub fn main() {
     let a = issue_9188::bar();
-    let b = issue_9188::foo::<int>();
+    let b = issue_9188::foo::<isize>();
     assert_eq!(*a, *b);
 }
index f9cc8cb293fd1de4e30b9b3cc5eb5ca3310461fe..2c84e202b26f1bd2dde7b9e7513727fa7c80fb1d 100644 (file)
 
 
 struct Thing1<'a> {
-    baz: &'a [Box<int>],
+    baz: &'a [Box<isize>],
     bar: Box<u64>,
 }
 
 struct Thing2<'a> {
-    baz: &'a [Box<int>],
+    baz: &'a [Box<isize>],
     bar: u64,
 }
 
index 6e88379f9a41b2676b33eb65002d535cb57376a5..108f1a0d73daf6d1e76a17b62dcf62862e451761 100644 (file)
@@ -18,32 +18,32 @@ pub enum Enum<T> {
     pub trait X {
         fn dummy(&self) { }
     }
-    impl X for int {}
+    impl X for isize {}
 
     pub struct Z<'a>(Enum<&'a (X+'a)>);
-    fn foo() { let x: int = 42; let z = Z(Enum::A(&x as &X)); let _ = z; }
+    fn foo() { let x: isize = 42; let z = Z(Enum::A(&x as &X)); let _ = z; }
 }
 
 mod b {
     trait X {
         fn dummy(&self) { }
     }
-    impl X for int {}
+    impl X for isize {}
     struct Y<'a>{
         x:Option<&'a (X+'a)>,
     }
 
     fn bar() {
-        let x: int = 42;
+        let x: isize = 42;
         let _y = Y { x: Some(&x as &X) };
     }
 }
 
 mod c {
     pub trait X { fn f(&self); }
-    impl X for int { fn f(&self) {} }
+    impl X for isize { fn f(&self) {} }
     pub struct Z<'a>(Option<&'a (X+'a)>);
-    fn main() { let x: int = 42; let z = Z(Some(&x as &X)); let _ = z; }
+    fn main() { let x: isize = 42; let z = Z(Some(&x as &X)); let _ = z; }
 }
 
 pub fn main() {}
index 81edac3cef2659d9a2a8daec70692fd0aa785d14..3283dc44f308398356de7a91f3452df05fa1255c 100644 (file)
@@ -15,7 +15,7 @@
 use std::cell::Cell;
 
 struct r<'a> {
-    b: &'a Cell<int>,
+    b: &'a Cell<isize>,
 }
 
 #[unsafe_destructor]
@@ -25,7 +25,7 @@ fn drop(&mut self) {
     }
 }
 
-fn r(b: &Cell<int>) -> r {
+fn r(b: &Cell<isize>) -> r {
     r {
         b: b
     }
index 2730f567aa3bab39346b88de38ec1d45c45bc6fa..84f848fc9cdb20381c929e21aa4887e2542b1bc2 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-9906" as testmod;
+extern crate issue_9906 as testmod;
 
 pub fn main() {
     testmod::foo();
index 1c554250a1118ead9c573cac0371288a70456357..222eb0c651815d11c7b44e60fe380e1d42cbcaa2 100644 (file)
@@ -11,5 +11,5 @@
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    const S: uint = 23 as uint; [0; S]; ()
+    const S: usize = 23 as usize; [0; S]; ()
 }
index 5761c8d9438483ad74c6785281528004a9324729..c8af811d13d8d799ac19e7c8e455aae844c051f7 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "issue-9968" as lib;
+extern crate issue_9968 as lib;
 
 use lib::{Trait, Struct};
 
index e1b980d7132087ec0fde8e5ba80793bccaff0e2b..c2ed68fc5d4003c6afea7e3aeef986b9e9bdee18 100644 (file)
@@ -30,7 +30,7 @@ mod test_first_item_in_file_mod {}
 
 mod test_single_attr_outer {
     #[attr = "val"]
-    pub static x: int = 10;
+    pub static x: isize = 10;
 
     #[attr = "val"]
     pub fn f() { }
@@ -47,7 +47,7 @@ pub mod rustrt {
 mod test_multi_attr_outer {
     #[attr1 = "val"]
     #[attr2 = "val"]
-    pub static x: int = 10;
+    pub static x: isize = 10;
 
     #[attr1 = "val"]
     #[attr2 = "val"]
@@ -65,13 +65,13 @@ pub mod rustrt {
 
     #[attr1 = "val"]
     #[attr2 = "val"]
-    struct t {x: int}
+    struct t {x: isize}
 }
 
 mod test_stmt_single_attr_outer {
     pub fn f() {
         #[attr = "val"]
-        static x: int = 10;
+        static x: isize = 10;
 
         #[attr = "val"]
         fn f() { }
@@ -93,7 +93,7 @@ pub fn f() {
 
         #[attr1 = "val"]
         #[attr2 = "val"]
-        static x: int = 10;
+        static x: isize = 10;
 
         #[attr1 = "val"]
         #[attr2 = "val"]
@@ -176,8 +176,8 @@ pub mod rustrt {
 /*mod test_literals {
     #![str = "s"]
     #![char = 'c']
-    #![int = 100]
-    #![uint = 100_usize]
+    #![isize = 100]
+    #![usize = 100_usize]
     #![mach_int = 100u32]
     #![float = 1.0]
     #![mach_float = 1.0f32]
index 29ac563878bc4ce7aec13a54c703a3681afb181c..a6130841b5c52d1948d09ac90b68569a7bb125b1 100644 (file)
 
 
 
-fn range_<F>(a: int, b: int, mut it: F) where F: FnMut(int) {
+fn range_<F>(a: isize, b: isize, mut it: F) where F: FnMut(isize) {
     assert!((a < b));
-    let mut i: int = a;
+    let mut i: isize = a;
     while i < b { it(i); i += 1; }
 }
 
 pub fn main() {
-    let mut sum: int = 0;
+    let mut sum: isize = 0;
     range_(0, 100, |x| sum += x );
     println!("{}", sum);
 }
index 246ba19a59bc7c27cf62b76681dac18574687cfb..62aa300578355027ff8fbf315d301a20bb560d96 100644 (file)
@@ -11,5 +11,5 @@
 
 // pretty-expanded FIXME #23616
 
-fn f(_a: Vec<int> ) { }
+fn f(_a: Vec<isize> ) { }
 pub fn main() { f(vec!(1, 2, 3, 4, 5)); }
index 97025f209a2c210609910012cada364d0a55c599..9838fe62394ce17b1696bdebac12201634c6a6d5 100644 (file)
@@ -20,7 +20,7 @@ pub fn main() {
 mod foo {
 }
 
-fn bar() -> int {
+fn bar() -> isize {
     match 0 {
       _ => { 0 }
     }
index ca405f54415c971bf04e30578d20719c36fd4d0d..4645e8ff3924a0ad1706f497b18a4818d9e3711f 100644 (file)
@@ -12,7 +12,7 @@
 
 use std::thread::Thread;
 
-fn user(_i: int) {}
+fn user(_i: isize) {}
 
 fn foo() {
     // Here, i is *copied* into the proc (heap closure).
index 05c6cb7f5ac6823b06332a0e2abac0eef6b690fc..84c5da1ad6c2adfcc096ca94b92a1a460750fd5d 100644 (file)
@@ -22,5 +22,5 @@
 use kinds_in_metadata::f;
 
 pub fn main() {
-    f::<int>();
+    f::<isize>();
 }
index 3c2a3f355b412e15ecf549bba8e8318d559fc438..fca700f6e4a8460a803b1f8c4c5d548ce9b99a1f 100644 (file)
 // resolved when we finish typechecking the ||.
 
 
-struct Refs { refs: Vec<int> , n: int }
+struct Refs { refs: Vec<isize> , n: isize }
 
 pub fn main() {
     let mut e = Refs{refs: vec!(), n: 0};
     let _f = || println!("{}", e.n);
-    let x: &[int] = &e.refs;
+    let x: &[isize] = &e.refs;
     assert_eq!(x.len(), 0);
 }
index a6060bebbc5cde4ec793ec374d0e54d73469ada4..e5bdca1a06773a8773eada2ece519870980db73d 100644 (file)
@@ -15,7 +15,7 @@ macro_rules! bad_macro {
     ($ex:expr) => ({(|_x| { $ex }) (9) })
 }
 
-fn takes_x(_x : int) {
+fn takes_x(_x : isize) {
     assert_eq!(bad_macro!(_x),8);
 }
 fn main() {
index 6f5ded6c475b6f3f058a094b52767753e5baa242..f5b9bd4fbaa69b800f332b2e333afe0975358c90 100644 (file)
@@ -14,7 +14,7 @@
 #![feature(lang_items, start, no_std)]
 #![no_std]
 
-extern crate "lang-item-public" as lang_lib;
+extern crate lang_item_public as lang_lib;
 
 #[cfg(target_os = "linux")]
 #[link(name = "c")]
@@ -45,6 +45,6 @@
 extern {}
 
 #[start]
-fn main(_: int, _: *const *const u8) -> int {
-    1 % 1
+fn main(_: isize, _: *const *const u8) -> isize {
+    1_isize % 1_isize
 }
index 6824d9a1ccebbbc2f8b54553f2d5ea4a1ccf0844..e9c66093fb0cfe98f649f1b4ebf77c234fe57e4e 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-struct Large {a: int,
-             b: int,
-             c: int,
-             d: int,
-             e: int,
-             f: int,
-             g: int,
-             h: int,
-             i: int,
-             j: int,
-             k: int,
-             l: int}
+struct Large {a: isize,
+             b: isize,
+             c: isize,
+             d: isize,
+             e: isize,
+             f: isize,
+             g: isize,
+             h: isize,
+             i: isize,
+             j: isize,
+             k: isize,
+             l: isize}
 fn f() {
     let _foo: Large =
         Large {a: 0,
index 7b11aae168ca965744ccbb01a9423e799947db1f..35a17150787775ce9f3fa79ed3aa297119786d01 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct A { a: Box<int> }
+struct A { a: Box<isize> }
 
 pub fn main() {
     fn invoke<F>(f: F) where F: FnOnce() { f(); }
index 559c9e78945707a8321510fb0dd11738a9b8f4f0..500de64ae832ce0d7004e7fc29f29f9da9aef148 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn incr(x: &mut int) -> bool { *x += 1; assert!((false)); return false; }
+fn incr(x: &mut isize) -> bool { *x += 1; assert!((false)); return false; }
 
 pub fn main() {
     let x = 1 == 2 || 3 == 3;
     assert!((x));
-    let mut y: int = 10;
+    let mut y: isize = 10;
     println!("{}", x || incr(&mut y));
     assert_eq!(y, 10);
     if true && x { assert!((true)); } else { assert!((false)); }
index 60f7689ecfa638b536111516e8ae9972d7ff1567..d71d7e751a045c2f24c2fcbcc5941e850a4f1119 100644 (file)
@@ -10,6 +10,6 @@
 
 
 
-fn foo(x: int) { println!("{}", x); }
+fn foo(x: isize) { println!("{}", x); }
 
-pub fn main() { let mut x: int; if 1 > 2 { x = 12; } else { x = 10; } foo(x); }
+pub fn main() { let mut x: isize; if 1 > 2 { x = 12; } else { x = 10; } foo(x); }
index fe89d52bcb317f319943245ae6858f193daecd20..30838b3121a95692c2bb250fd68211a0c8f40849 100644 (file)
@@ -15,4 +15,4 @@
 
 fn leaky<T>(_t: T) { }
 
-pub fn main() { let x = box 10; leaky::<Box<int>>(x); }
+pub fn main() { let x = box 10; leaky::<Box<isize>>(x); }
index 1500edce779c371d5baa8ee5d069b95a2695c4f8..c53bc83ef6b7862f24d085654bdac7987ca37683 100644 (file)
@@ -13,7 +13,7 @@
 
 fn f() {
     let a: Box<_> = box 1;
-    let b: &int = &*a;
+    let b: &isize = &*a;
     println!("{}", b);
 }
 
index 22a29279a67ae974c7d5a291098c5b844eefabce..80bd15578d1152d56d6d738ac385b2f7a5cc2d91 100644 (file)
@@ -17,7 +17,7 @@ pub fn main() {
     println!("{}", y);
     assert_eq!(y, 6);
     let s = "hello there".to_string();
-    let mut i: int = 0;
+    let mut i: isize = 0;
     for c in s.bytes() {
         if i == 0 { assert!((c == 'h' as u8)); }
         if i == 1 { assert!((c == 'e' as u8)); }
index 38b5a858aff083cd2358091b440392ea06947677..3336ce7e723de6e79050b89f347985f91b2c2045 100644 (file)
@@ -16,11 +16,11 @@ fn i_live_in_more_text() -> &'static str {
 
 #[cfg(not(target_os = "macos"))]
 #[link_section=".imm"]
-static magic: uint = 42;
+static magic: usize = 42;
 
 #[cfg(not(target_os = "macos"))]
 #[link_section=".mut"]
-static mut frobulator: uint = 0xdeadbeef;
+static mut frobulator: usize = 0xdeadbeef;
 
 #[cfg(target_os = "macos")]
 #[link_section="__TEXT,__moretext"]
@@ -30,11 +30,11 @@ fn i_live_in_more_text() -> &'static str {
 
 #[cfg(target_os = "macos")]
 #[link_section="__RODATA,__imm"]
-static magic: uint = 42;
+static magic: usize = 42;
 
 #[cfg(target_os = "macos")]
 #[link_section="__DATA,__mut"]
-static mut frobulator: uint = 0xdeadbeef;
+static mut frobulator: usize = 0xdeadbeef;
 
 pub fn main() {
     unsafe {
index 3c238d3fe78c6d92e86e71772f0626be67dfb794..945cf9370f4149c6df1214d1643e59cc743f785d 100644 (file)
 
 #![feature(std_misc, old_path)]
 
-extern crate "linkage-visibility" as foo;
+extern crate linkage_visibility as foo;
 
 pub fn main() {
     foo::test();
-    foo::foo2::<int>();
+    foo::foo2::<isize>();
     foo::foo();
 }
index 5cd741350d57195cd267e0b74a7c7d184c41cf9d..0794a5e0daf2f586af538cea6faac6bf810e1d61 100644 (file)
 
 #![feature(linkage)]
 
-extern crate "linkage1" as other;
+extern crate linkage1 as other;
 
 extern {
     #[linkage = "extern_weak"]
-    static foo: *const int;
+    static foo: *const isize;
     #[linkage = "extern_weak"]
-    static something_that_should_never_exist: *mut int;
+    static something_that_should_never_exist: *mut isize;
 }
 
 fn main() {
index 061f7025527567e24beba0554b5d97dd9761ba8f..6ddaee9c8bd5c1a669f1889bd8955e4cbaf00b2f 100644 (file)
@@ -20,6 +20,6 @@
 
 struct ヒ;
 
-static ラ: uint = 0;
+static ラ: usize = 0;
 
 pub fn main() {}
index 37de5745bb48bc74f4f3729269d528d1f1b85e1f..3b4bd001e8dc051abba93eecb027eb383160c5e5 100644 (file)
@@ -13,6 +13,6 @@
 // pretty-expanded FIXME #23616
 
 #[forbid(non_camel_case_types)]
-type Foo_ = int;
+type Foo_ = isize;
 
 pub fn main() { }
index b530a3facaf180285f975112d117ac003b305af3..aa5b3834c01786fc0d58684a6aaabfc69839649a 100644 (file)
@@ -14,6 +14,6 @@
 #![forbid(non_camel_case_types)]
 #![forbid(non_upper_case_globals)]
 
-static mut bar: int = 2;
+static mut bar: isize = 2;
 
 pub fn main() {}
index dfd2d191d494b12a34446f4c82973c87e8c6499f..8f0cbf96b604999aaaf7baaf0657622821b837a8 100644 (file)
@@ -13,6 +13,6 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-enum list { cons(int, Box<list>), nil, }
+enum list { cons(isize, Box<list>), nil, }
 
 pub fn main() { list::cons(10, box list::cons(11, box list::cons(12, box list::nil))); }
index ce6f77633db56f7ccfa2cf6e909d3fe0497c1133..df89809ef1fed25a0dc86778e8b784790bedc9d8 100644 (file)
@@ -15,7 +15,7 @@
 #![allow(unused_variable)]
 
 fn test(_cond: bool) {
-    let v: int;
+    let v: isize;
     v = 1;
     loop { } // loop never terminates, so no error is reported
     v = 2;
index f10d851a463ed9ff89e0f19377679adf624694e3..6fc15478f7a55e0d23d9b1a4fca5b83f8afe0e05 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unreachable_code)]
 
 fn test() {
-    let _v: int;
+    let _v: isize;
     _v = 1;
     return;
     _v = 2; //~ WARNING: unreachable statement
index 4f1b6f3b925a618faa4fdfe7589fca708abf795a..f9bb45ee4009b5a4bbddde49d83d014141ade072 100644 (file)
@@ -11,7 +11,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn take(x: int) -> int {x}
+fn take(x: isize) -> isize {x}
 
 fn the_loop() {
     let mut list = Vec::new();
index c4b45ae0f0e62cf49b3db6293516414483aa1725..1991e2b178d51c4ddb76f25d19e5e5d6960884b3 100644 (file)
@@ -10,7 +10,7 @@
 
 #[derive(Clone, Debug)]
 enum foo {
-  a(uint),
+  a(usize),
   b(String),
 }
 
index 24ef02956266b1238beba43d11a4b539297a569b..294d4d1217952c9c1d4fb8f95122f57572417acb 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// exec-env:RUST_LOG=logging-enabled=info
+// exec-env:RUST_LOG=logging_enabled=info
 
 // pretty-expanded FIXME #23616
 
index b03c4b5ff47badc1e096c0b85d9298cb9ca0f159..575f087d8335f1b865c2c25fab6a0c4bcd5c1cc4 100644 (file)
@@ -15,7 +15,7 @@
 use std::fmt;
 use std::thread;
 
-struct Foo(Cell<int>);
+struct Foo(Cell<isize>);
 
 impl fmt::Debug for Foo {
     fn fmt(&self, _fmt: &mut fmt::Formatter) -> fmt::Result {
index 63993182a427d30fb91a4481c31b2c45dd519b58..7caeeb401244b3035c5cbb7b8215ab9a1fc763db 100644 (file)
@@ -27,5 +27,5 @@
 
 pub fn main() {
     // this function panicks if logging is turned on
-    logging_right_crate::foo::<int>();
+    logging_right_crate::foo::<isize>();
 }
index 2c2c2be39a49c41afe198cdce7e901004deaddb8..6e0f1bb87a5fb678e558d176249f7eeb99ed374e 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unused_variable)]
 
 pub fn main() {
-    let mut i: int = 0;
+    let mut i: isize = 0;
     while i < 1000000 {
         i += 1;
         let x = 3;
index 80b2f408c1915674ad74da5987f5eb904bb59df5..d582fc3b721b4d0fc7cb3892908f415205e18233 100644 (file)
@@ -14,7 +14,7 @@ pub fn main() {
 
     macro_rules! mylambda_tt {
         ($x:ident, $body:expr) => ({
-            fn f($x: int) -> int { return $body; };
+            fn f($x: isize) -> isize { return $body; };
             f
         })
     }
index cb919297b04064c2ef0042157ad8bf89c07cb322..ed7b1cbacadd7f401a516011944c9f6231a62708 100644 (file)
@@ -12,7 +12,7 @@
 // ignore-stage1
 
 #[macro_use]
-extern crate "macro_crate_nonterminal" as new_name;
+extern crate macro_crate_nonterminal as new_name;
 
 pub fn main() {
     new_name::check_local();
index 38f646b79a5eeed4bb878c212cec8eb67e192714..557f982713a17a52ea3ef61b34a9178a69071dc5 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-pub fn increment(x: uint) -> uint {
+pub fn increment(x: usize) -> usize {
     x + 1
 }
 
index 9782ee146fc502ba0873a3b24e03ef53d920eee7..e6b5d50b36e6d2808aaa14fa940dd9e6d1d95253 100644 (file)
@@ -25,7 +25,7 @@ fn $fnname($arg: $ty) -> Option<$ty> $body
 }
 
 pub fn main() {
-    assert!(overly_complicated!(f, x, Option<uint>, { return Some(x); },
+    assert!(overly_complicated!(f, x, Option<usize>, { return Some(x); },
                                Some(8), Some(y), y) == 8)
 
 }
index d20777aadc4a140fa54d96fda51cdc3ef4e14c48..cb1540459771b335c583807cad102ab020ce756d 100644 (file)
@@ -12,7 +12,7 @@
 
 struct A;
 
-macro_rules! make_thirteen_method {() => (fn thirteen(&self)->int {13})}
+macro_rules! make_thirteen_method {() => (fn thirteen(&self)->isize {13})}
 impl A { make_thirteen_method!(); }
 
 fn main() {
index 15387f908b441907c21e941797d0568d57b62ea1..659113d4e0c95e6c6393bb97758457ccca5a178b 100644 (file)
@@ -40,7 +40,7 @@ macro_rules! ident_pat {
     )
 }
 
-fn f(c: Option<char>) -> uint {
+fn f(c: Option<char>) -> usize {
     match c {
         Some('x') => 1,
         mypat!() => 2,
index 072bc84fb63a287c9647ff46eadd8ede670e5055..2e8806229778e7279d9d42e131a673aed48fbaac 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 mod m {
-    pub type t = int;
+    pub type t = isize;
 }
 
 macro_rules! foo {
index 3aa029870988a510c750571bf0817184f89865e4..0d8b86012d6e0285dcb9c04f596a40653b05f360 100644 (file)
@@ -12,7 +12,7 @@
 
 macro_rules! myfn {
     ( $f:ident, ( $( $x:ident ),* ), $body:block ) => (
-        fn $f( $( $x : int),* ) -> int $body
+        fn $f( $( $x : isize),* ) -> isize $body
     )
 }
 
index b9b78012c3df0e5369a44af6202cde10b9a7b324..e21f89aee43b4c1ca8119418e07a2f60ae5f3dfb 100644 (file)
@@ -39,7 +39,7 @@ enum EnumWithStructVariants {
 
 pub mod glfw {
     #[derive(Copy)]
-    pub struct InputState(uint);
+    pub struct InputState(usize);
 
     pub const RELEASE  : InputState = InputState(0);
     pub const PRESS    : InputState = InputState(1);
@@ -101,7 +101,7 @@ enum A { AA(()) }
 fn issue_15393() {
     #![allow(dead_code)]
     struct Flags {
-        bits: uint
+        bits: usize
     }
 
     const FOO: Flags = Flags { bits: 0x01 };
index 00804634ea8ee472c61f83a5424ab27bae841e35..4fa951b34794b142e586b467d6f761394ae33abf 100644 (file)
@@ -11,5 +11,5 @@
 // n.b. This was only ever failing with optimization disabled.
 // pretty-expanded FIXME #23616
 
-fn a() -> int { match return 1 { 2 => 3, _ => panic!() } }
+fn a() -> isize { match return 1 { 2 => 3, _ => panic!() } }
 pub fn main() { a(); }
index 74cf3faea46ee1646441319f0f7debae7b5a7fe3..7745410fa434a9adbb10a28633334083a1dba6cb 100644 (file)
@@ -10,7 +10,7 @@
 
 
 pub fn main() {
-    let i: int =
-        match Some::<int>(3) { None::<int> => { panic!() } Some::<int>(_) => { 5 } };
+    let i: isize =
+        match Some::<isize>(3) { None::<isize> => { panic!() } Some::<isize>(_) => { 5 } };
     println!("{}", i);
 }
index 5bd8db7b17b3dc3e8213ca219d52a22584b0c729..06d19cec185bb3cf28775a8c5e69198bfa731869 100644 (file)
@@ -13,7 +13,7 @@
 // pretty-expanded FIXME #23616
 
 enum E {
-    Foo{f : int},
+    Foo{f : isize},
     Bar
 }
 
index 1224a5dd31403815b79ad146f3bd010d7b9dc24a..e4766f32a57f3d0e5623667eec36b2b64a2d3883 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 enum E {
-    Foo{f : int},
+    Foo{f : isize},
     Bar
 }
 
index a49f7bcebcf7e2b68271c2d71d99eb9060c6c139..d481c02eb410aa7828fd1b6d2250cadcba5105bd 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct Pair { a: Box<int>, b: Box<int> }
+struct Pair { a: Box<isize>, b: Box<isize> }
 
 pub fn main() {
     let mut x: Box<_> = box Pair {a: box 10, b: box 20};
index 374b1b54e0b327d87a977b265b4c4dda50fa17ad..27bbbc936ae5c4ae3f97a54d663841063a7393c5 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 enum Foo {
-    B { b1: int, bb1: int},
+    B { b1: isize, bb1: isize},
 }
 
 macro_rules! match_inside_expansion {
index a9039885296b0020200ff23ade39b4753ebbd31d..b47732b325a9802e0c542bd38a4231c7c783f590 100644 (file)
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 fn foo<T>(y: Option<T>) {
-    let mut x: int;
-    let mut rs: Vec<int> = Vec::new();
+    let mut x: isize;
+    let mut rs: Vec<isize> = Vec::new();
     /* tests that x doesn't get put in the precondition for the
        entire if expression */
 
@@ -25,4 +25,4 @@ fn foo<T>(y: Option<T>) {
     return;
 }
 
-pub fn main() { println!("hello"); foo::<int>(Some::<int>(5)); }
+pub fn main() { println!("hello"); foo::<isize>(Some::<isize>(5)); }
index 0e6bb1e62a5b2e2b278145fb6e853758e76af4e0..e558e88e03d9cc954e13de9ead6a87b6a715f279 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct X { x: int }
+struct X { x: isize }
 
 pub fn main() {
     let _x = match 0 {
index d8422ba6917015b1062aa881d5fef9d11a799ee2..a2b35e6558c47873c7fc860b2888759e6c74f523 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct X { x: int }
+struct X { x: isize }
 
 pub fn main() {
     let _x = match 0 {
index 4265d0a5406aa9c59b842c54ddd5a65f762d6182..33c77f33c44bdabf139a1f4284c4af34f1f3788b 100644 (file)
@@ -10,7 +10,7 @@
 
 
 
-fn altlit(f: int) -> int {
+fn altlit(f: isize) -> isize {
     match f {
       10 => { println!("case 10"); return 20; }
       11 => { println!("case 11"); return 22; }
index d76c8faa5b6ce3dbfde6029dea0cba7be846808f..ccf23b87ea3b8a9acbf98977dcd9a5ecce504878 100644 (file)
@@ -10,7 +10,7 @@
 
 enum maybe<T> { nothing, just(T), }
 
-fn foo(x: maybe<int>) {
+fn foo(x: maybe<isize>) {
     match x {
         maybe::nothing => { println!("A"); }
         maybe::just(_a) => { println!("B"); }
index f8a6e475a3bd6939c7c5e6f38556c9042b559a95..8e729e2eab38628cf7ec102fa1e971f0e02b7a0d 100644 (file)
@@ -12,6 +12,6 @@
 
 // pretty-expanded FIXME #23616
 
-fn altsimple(f: int) { match f { _x => () } }
+fn altsimple(f: isize) { match f { _x => () } }
 
 pub fn main() { }
index 5e15c642b67f612ae8321bc24626d4f6e1bb9cf3..ac070cb1f2542d593c25a798b971f63ae8207c52 100644 (file)
@@ -15,7 +15,7 @@
 
 enum thing { a, b, c, }
 
-fn foo<F>(it: F) where F: FnOnce(int) { it(10); }
+fn foo<F>(it: F) where F: FnOnce(isize) { it(10); }
 
 pub fn main() {
     let mut x = true;
index 56e6f4dce592bd1755281c923cc1f726d2d1d1b1..9aafcda1b02add7506e0697b741d176ef0658806 100644 (file)
@@ -10,8 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
-const s: int = 1;
-const e: int = 42;
+const s: isize = 1;
+const e: isize = 42;
 
 pub fn main() {
     match 7 {
index 9dfe079c8a828f285f80bed339dc4113984fefd4..26c91e1703cafed5486662d00f310410f0ce3da4 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 struct Rec {
-    f: int
+    f: isize
 }
 
 fn destructure(x: &mut Rec) {
index 03d5c6817e471e752c0b136d19955ab8ba49fab3..826edb30b36f4ec38680c4510a27ee712518f9e1 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn destructure(x: Option<int>) -> int {
+fn destructure(x: Option<isize>) -> isize {
     match x {
       None => 0,
       Some(ref v) => *v
index 433ef8a63197c307ca445468a2b76127de10c856..21b806f80dee4ee17bee4a6b4b6dd473a0b30079 100644 (file)
@@ -20,7 +20,7 @@
 
 #![deny(non_upper_case_globals)]
 
-pub const A : int = 97;
+pub const A : isize = 97;
 
 fn f() {
     let r = match (0,0) {
@@ -37,7 +37,7 @@ fn f() {
 
 mod m {
     #[allow(non_upper_case_globals)]
-    pub const aha : int = 7;
+    pub const aha : isize = 7;
 }
 
 fn g() {
index e550b354d40ee9301f813102e58a9c28d276cee0..450b310b8f40813b09fdb345023d7e2a8606c1d7 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 struct Foo{
-    f : int,
+    f : isize,
 }
 
 pub fn main() {
index 4a04fd55df5b542e2bad83af44da5b026c609ca4..82d29f9050bfc0d72555ad59ca3cb7e75e9bd2c6 100644 (file)
 // pretty-expanded FIXME #23616
 
 enum color {
-    rgb(int, int, int),
-    rgba(int, int, int, int),
-    hsl(int, int, int),
+    rgb(isize, isize, isize),
+    rgba(isize, isize, isize, isize),
+    hsl(isize, isize, isize),
 }
 
-fn process(c: color) -> int {
-    let mut x: int;
+fn process(c: color) -> isize {
+    let mut x: isize;
     match c {
       color::rgb(r, _, _) => { x = r; }
       color::rgba(_, _, _, a) => { x = a; }
index e008874e6d7be9b3a4e32d84a3891e22d3c73136..d4f4f3bb27eac8b247993d8d59985dbd837fc565 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn foo(x: Option<Box<int>>, b: bool) -> int {
+fn foo(x: Option<Box<isize>>, b: bool) -> isize {
     match x {
       None => { 1 }
       Some(ref x) if b => { *x.clone() }
index 520c2e8108d48735528fd93e92a04ef70b6e5586..f9b49281bab0c648ef6db5e89f6da1bfcb00beb1 100644 (file)
@@ -11,6 +11,7 @@
 // pretty-expanded FIXME #23616
 
 #![feature(advanced_slice_patterns)]
+#![feature(slice_patterns)]
 
 fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str {
     match (l1, l2) {
@@ -59,22 +60,22 @@ fn match_nested_vecs_snoc<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -
 fn main() {
     assert_eq!(match_vecs(&[1, 2], &[2, 3]), "both non-empty");
     assert_eq!(match_vecs(&[], &[1, 2, 3, 4]), "one empty");
-    assert_eq!(match_vecs::<uint>(&[], &[]), "both empty");
+    assert_eq!(match_vecs::<usize>(&[], &[]), "both empty");
     assert_eq!(match_vecs(&[1, 2, 3], &[]), "one empty");
 
     assert_eq!(match_vecs_cons(&[1, 2], &[2, 3]), "both non-empty");
     assert_eq!(match_vecs_cons(&[], &[1, 2, 3, 4]), "one empty");
-    assert_eq!(match_vecs_cons::<uint>(&[], &[]), "both empty");
+    assert_eq!(match_vecs_cons::<usize>(&[], &[]), "both empty");
     assert_eq!(match_vecs_cons(&[1, 2, 3], &[]), "one empty");
 
     assert_eq!(match_vecs_snoc(&[1, 2], &[2, 3]), "both non-empty");
     assert_eq!(match_vecs_snoc(&[], &[1, 2, 3, 4]), "one empty");
-    assert_eq!(match_vecs_snoc::<uint>(&[], &[]), "both empty");
+    assert_eq!(match_vecs_snoc::<usize>(&[], &[]), "both empty");
     assert_eq!(match_vecs_snoc(&[1, 2, 3], &[]), "one empty");
 
     assert_eq!(match_nested_vecs_cons(None, Ok::<&[_], ()>(&[4_usize, 2_usize])),
                "None, Ok(at least two elements)");
-    assert_eq!(match_nested_vecs_cons::<uint>(None, Err(())), "None, Ok(less than one element)");
+    assert_eq!(match_nested_vecs_cons::<usize>(None, Err(())), "None, Ok(less than one element)");
     assert_eq!(match_nested_vecs_cons::<bool>(Some::<&[_]>(&[]), Ok::<&[_], ()>(&[])),
                "Some(empty), Ok(empty)");
     assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[1]), Err(())), "Some(non-empty), any");
@@ -83,7 +84,7 @@ fn main() {
 
     assert_eq!(match_nested_vecs_snoc(None, Ok::<&[_], ()>(&[4_usize, 2_usize])),
                "None, Ok(at least two elements)");
-    assert_eq!(match_nested_vecs_snoc::<uint>(None, Err(())), "None, Ok(less than one element)");
+    assert_eq!(match_nested_vecs_snoc::<usize>(None, Err(())), "None, Ok(less than one element)");
     assert_eq!(match_nested_vecs_snoc::<bool>(Some::<&[_]>(&[]), Ok::<&[_], ()>(&[])),
                "Some(empty), Ok(empty)");
     assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[1]), Err(())), "Some(non-empty), any");
index e3c375f8b0fdea321aa5019b6ae821bb6cf367fc..f0844b8e1eb1770d24a5058aa71dfdaaa8798274 100644 (file)
@@ -9,27 +9,27 @@
 // except according to those terms.
 
 trait Product {
-    fn product(&self) -> int;
+    fn product(&self) -> isize;
 }
 
 struct Foo {
-    x: int,
-    y: int,
+    x: isize,
+    y: isize,
 }
 
 impl Foo {
-    pub fn sum(&self) -> int {
+    pub fn sum(&self) -> isize {
         self.x + self.y
     }
 }
 
 impl Product for Foo {
-    fn product(&self) -> int {
+    fn product(&self) -> isize {
         self.x * self.y
     }
 }
 
-fn Foo(x: int, y: int) -> Foo {
+fn Foo(x: isize, y: isize) -> Foo {
     Foo { x: x, y: y }
 }
 
index ccf5efddebefa1dbe84a5980ad91d2fc34b97e1c..400ecda411e18b98df5ebd1c5076a49e62bdb0f0 100644 (file)
@@ -23,7 +23,7 @@ trait frobable {
 }
 
 #[int_frobable]
-impl frobable for int {
+impl frobable for isize {
     #[frob_attr1]
     fn frob(&self) {
         #![frob_attr2]
index e013c5b0be794b29cca573acce431da10120ea73..7cc762c93482665fac08891ed2119e393f2f98b5 100644 (file)
@@ -26,7 +26,7 @@ trait MyWriter {
 
 impl<'a> MyWriter for &'a mut [u8] {
     fn my_write(&mut self, buf: &[u8]) -> IoResult<()> {
-        slice::bytes::copy_memory(*self, buf);
+        slice::bytes::copy_memory(buf, *self);
 
         let write_len = buf.len();
         unsafe {
index 926a0c371e9dec0e1a9c19a893c5580e8d9c7b40..3a1ce74a64c023b60bce4881d2769b27c5bf3ee9 100644 (file)
@@ -38,7 +38,7 @@ impl Hasher for SipHasher {
     fn finish(&self) -> u64 { 4 }
 }
 
-impl Hash<SipHasher> for int {
+impl Hash<SipHasher> for isize {
     fn hash(&self, h: &mut SipHasher) {}
 }
 
index 496625213f7ead3e6016ecdfdb04741d8de3f571..3db726820708667d4cda13d77576beb6ded444f8 100644 (file)
@@ -19,13 +19,13 @@ trait MakeString {
     fn make_string(&self) -> String;
 }
 
-impl MakeString for int {
+impl MakeString for isize {
     fn make_string(&self) -> String {
         format!("{}", *self)
     }
 }
 
-impl MakeString for uint {
+impl MakeString for usize {
     fn make_string(&self) -> String {
         format!("{}", *self)
     }
@@ -46,13 +46,13 @@ fn foo<F:Foo>(f: &F) -> String {
 ///////////////////////////////////////////////////////////////////////////
 
 struct SomeStruct {
-    field: int,
+    field: isize,
 }
 
 impl Foo for SomeStruct {
-    type F = int;
+    type F = isize;
 
-    fn get(&self) -> &int {
+    fn get(&self) -> &isize {
         &self.field
     }
 }
@@ -60,13 +60,13 @@ fn get(&self) -> &int {
 ///////////////////////////////////////////////////////////////////////////
 
 struct SomeOtherStruct {
-    field: uint,
+    field: usize,
 }
 
 impl Foo for SomeOtherStruct {
-    type F = uint;
+    type F = usize;
 
-    fn get(&self) -> &uint {
+    fn get(&self) -> &usize {
         &self.field
     }
 }
index 9784149c44057ade8ba3d00c926a554dd50857ab..98ab67b05afda080a72915039aca16b33e197211 100644 (file)
@@ -15,7 +15,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-static mut COUNT: uint = 1;
+static mut COUNT: usize = 1;
 
 #[derive(Copy)]
 struct Foo;
index 36f16f36cc0ab0aad49e837d641522eda2d7070a..d87ed03e94e01816f2936c09138128aafae3d3bd 100644 (file)
 #![feature(box_syntax)]
 
 trait Foo {
-    fn foo(&self) -> int;
+    fn foo(&self) -> isize;
 }
 
 impl<T:Copy> Foo for Vec<T> {
-    fn foo(&self) -> int {1}
+    fn foo(&self) -> isize {1}
 }
 
 impl<T> Foo for Vec<Box<T>> {
-    fn foo(&self) -> int {2}
+    fn foo(&self) -> isize {2}
 }
 
-fn call_foo_copy() -> int {
+fn call_foo_copy() -> isize {
     let mut x = Vec::new();
     let y = x.foo();
     x.push(0_usize);
     y
 }
 
-fn call_foo_other() -> int {
+fn call_foo_other() -> isize {
     let mut x: Vec<Box<_>> = Vec::new();
     let y = x.foo();
     x.push(box 0);
index de8d116255ba227a2ae18f36f8a9103871d2bca3..329b77776b6394e8b2624b0bd4eaa78e66dd6941 100644 (file)
@@ -32,7 +32,7 @@ fn foo(self) {}
 }
 
 fn main() {
-    let x: [int; 4] = [1,2,3,4];
-    let xptr = x.as_slice() as *const [int];
+    let x: [isize; 4] = [1,2,3,4];
+    let xptr = x.as_slice() as *const [isize];
     xptr.foo();
 }
index 602ab95b048d30629fffb719dea2a9b6a5d2b54e..3055f90ee259772e4472d49c75e278533d734d1d 100644 (file)
@@ -27,11 +27,11 @@ trait Trait<T> {
 }
 
 struct S2 {
-    contents: int,
+    contents: isize,
 }
 
-impl Trait<int> for S2 {
-    fn new<U>(x: int, _: U) -> S2 {
+impl Trait<isize> for S2 {
+    fn new<U>(x: isize, _: U) -> S2 {
         S2 {
             contents: x,
         }
@@ -39,6 +39,6 @@ fn new<U>(x: int, _: U) -> S2 {
 }
 
 pub fn main() {
-    let _ = S::<int>::new::<f64>(1, 1.0);
-    let _: S2 = Trait::<int>::new::<f64>(1, 1.0);
+    let _ = S::<isize>::new::<f64>(1, 1.0);
+    let _: S2 = Trait::<isize>::new::<f64>(1, 1.0);
 }
index 60e9a2b8acba700c1d8d4e77c78b3358dfb11465..836f2960d717465c6c8d5825355563456e8cf832 100644 (file)
@@ -10,9 +10,9 @@
 
 // pretty-expanded FIXME #23616
 
-fn f() -> int {
+fn f() -> isize {
     mod m {
-        pub fn g() -> int { 720 }
+        pub fn g() -> isize { 720 }
     }
 
     m::g()
index 40069c32cd9b01d350eb613cd57f6a7c3e708d97..ba23197b83c7f202678f886f18b366728b526513 100644 (file)
@@ -17,7 +17,7 @@
 // pretty-expanded FIXME #23616
 
 mod m {
-    pub fn f() -> Vec<int> { Vec::new() }
+    pub fn f() -> Vec<isize> { Vec::new() }
 }
 
 pub fn main() { let _x = m::f(); }
index a3c1628725a07ed4b8525df1c021d8dcc0da0d50..58c1beee3be70324333f93e76f4ff6dca68ca20e 100644 (file)
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub fn foo() -> int { 10 }
+pub fn foo() -> isize { 10 }
index a3c1628725a07ed4b8525df1c021d8dcc0da0d50..58c1beee3be70324333f93e76f4ff6dca68ca20e 100644 (file)
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub fn foo() -> int { 10 }
+pub fn foo() -> isize { 10 }
index 4d18decdc13a48fa3ca255efd31a630e913aaf0a..b7470811f6034bb1a547807d3b4219528ef7ca84 100644 (file)
@@ -10,4 +10,4 @@
 
 // ignore-test Not a test. Used by other tests
 
-pub fn foo() -> int { 10 }
+pub fn foo() -> isize { 10 }
index 1b725d6ae214f7d28c5c482b137fcda7e992edcd..d6844f0f4abde59a177e5f3a74c6e263af23ae57 100644 (file)
@@ -12,8 +12,8 @@
 
 mod m {
     pub struct S {
-        pub x: int,
-        pub y: int
+        pub x: isize,
+        pub y: isize
     }
 }
 
index c9994e9b5156e2ed10d2505b2e03002577023799..9ccb8f2e6fdd9cb74b94a3c90afae36f77351223 100644 (file)
@@ -39,7 +39,7 @@ fn bind<B, F>(&self, f: F) -> Option<B> where F: FnOnce(&A) -> Option<B> {
     }
 }
 
-fn transform(x: Option<int>) -> Option<String> {
+fn transform(x: Option<isize>) -> Option<String> {
     x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_string()) )
 }
 
index b45805902dfd7af7abc18613ef3f93d32753046f..12162ba9022aec3b0a6a07c526e0322f6124aef0 100644 (file)
@@ -21,7 +21,7 @@ trait Serializable {
     fn serialize<S:Serializer>(&self, s: S);
 }
 
-impl Serializable for int {
+impl Serializable for isize {
     fn serialize<S:Serializer>(&self, _s: S) { }
 }
 
@@ -33,7 +33,7 @@ fn serialize<S:Serializer>(&self, s: S) {
     }
 }
 
-impl Serializer for int {
+impl Serializer for isize {
 }
 
 pub fn main() {
index 74f474b87525d29faf30cb4bfeaaadf316b4fbf0..ab9770b13d4514897846f30df797390957e5a8fe 100644 (file)
 
 #[derive(Clone)]
 struct Triple {
-    x: int,
-    y: int,
-    z: int,
+    x: isize,
+    y: isize,
+    z: isize,
 }
 
-fn test(x: bool, foo: Box<Triple>) -> int {
+fn test(x: bool, foo: Box<Triple>) -> isize {
     let bar = foo;
     let mut y: Box<Triple>;
     if x { y = bar; } else { y = box Triple{x: 4, y: 5, z: 6}; }
index 175c369e62842725affdd20117f6fd5083fb4232..c65e58a7b65023cce65ddb39c3e77c7ae993e00f 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct X { x: int, y: int, z: int }
+struct X { x: isize, y: isize, z: isize }
 
 pub fn main() {
     let x: Box<_> = box X{x: 1, y: 2, z: 3};
index faf45f8ae09b86db0e2fd1aa05ffebe4eceb55a1..054b57b2f432efdfe4b44f21bd8c521b00e3f5c5 100644 (file)
@@ -13,6 +13,6 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct X { x: int, y: int, z: int }
+struct X { x: isize, y: isize, z: isize }
 
 pub fn main() { let x: Box<_> = box X {x: 1, y: 2, z: 3}; let y = x; assert!((y.y == 2)); }
index 171c455e8075c1b53434bf33d7fb90c4e8e5d5ae..6036fa26ccf991d84b329997fc776e39f8ff02e6 100644 (file)
 
 #[derive(Clone)]
 struct Triple {
-    x: int,
-    y: int,
-    z: int,
+    x: isize,
+    y: isize,
+    z: isize,
 }
 
-fn test(x: bool, foo: Box<Triple>) -> int {
+fn test(x: bool, foo: Box<Triple>) -> isize {
     let bar = foo;
     let mut y: Box<Triple>;
     if x { y = bar; } else { y = box Triple {x: 4, y: 5, z: 6}; }
index 94fa3dbca0e4093ce6401755248fedf25453f1af..79a1b294da9bb3914c1db650af60077c5bc6f79b 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct Triple {a: int, b: int, c: int}
+struct Triple {a: isize, b: isize, c: isize}
 
 fn test(foo: Box<Triple>) -> Box<Triple> {
     let foo = foo;
index 5c80e683ba42c64cfcb2be8a83c85c6031f0c591..16ef95023542b7f75ea41d11fc72928f60ebf6f7 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct Triple { a: int, b: int, c: int }
+struct Triple { a: isize, b: isize, c: isize }
 
 fn test(foo: Box<Triple>) -> Box<Triple> {
     let foo = foo;
index fd13db560e094f4fca34244e5521c1b1862e419a..7aec948c8d4725dd4a08ca208ed788eea999d1f5 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn test(foo: Box<Vec<int>> ) { assert!(((*foo)[0] == 10)); }
+fn test(foo: Box<Vec<isize>> ) { assert!(((*foo)[0] == 10)); }
 
 pub fn main() {
     let x = box vec!(10);
index fd8eddd0c1c1ed93e82211c8ad73497c692b0c10..69b66d81e4355bbe18f6633ce8130f135e295224 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn test(foo: Box<Vec<int>>) { assert!(((*foo)[0] == 10)); }
+fn test(foo: Box<Vec<isize>>) { assert!(((*foo)[0] == 10)); }
 
 pub fn main() {
     let x = box vec!(10);
index 197f044ea782d0d50b3f6dce85b5f95f6069cdbe..3d9eba8c09f20a12b3185372bb542ca7c29268f1 100644 (file)
@@ -10,6 +10,6 @@
 
 // pretty-expanded FIXME #23616
 
-fn test(foo: int) { assert!((foo == 10)); }
+fn test(foo: isize) { assert!((foo == 10)); }
 
 pub fn main() { let x = 10; test(x); }
index a0ca9a43a5d4b88f615f4d59b0fc37b39f26222a..a5b0a8b9bf482faa6756bad2efec52f622ea3eae 100644 (file)
@@ -12,8 +12,8 @@
 
 pub fn main() {
 
-    let y: int = 42;
-    let mut x: int;
+    let y: isize = 42;
+    let mut x: isize;
     x = y;
     assert_eq!(x, 42);
 }
index 4243b28614cef14ea8b3def1723e092d6ba145d5..0233a7ff48553552c5dcc54f3e1c7001c1ceba74 100644 (file)
@@ -18,11 +18,11 @@ trait MyTrait<T> {
 
 #[derive(Copy)]
 struct MyType {
-    dummy: uint
+    dummy: usize
 }
 
-impl MyTrait<uint> for MyType {
-    fn get(&self) -> uint { self.dummy }
+impl MyTrait<usize> for MyType {
+    fn get(&self) -> usize { self.dummy }
 }
 
 impl MyTrait<u8> for MyType {
@@ -38,6 +38,6 @@ fn test_eq<T,M>(m: M, v: T)
 
 pub fn main() {
     let value = MyType { dummy: 256 + 22 };
-    test_eq::<uint, _>(value, value.dummy);
+    test_eq::<usize, _>(value, value.dummy);
     test_eq::<u8, _>(value, value.dummy as u8);
 }
index 0655552c85bb4fecb249e87aa1b260db96c7f6e1..161913f6f5ddb2e81062e7264de84ad56e3509d4 100644 (file)
@@ -27,11 +27,11 @@ fn get(&self) -> T {
 
 #[derive(Copy)]
 struct MyType {
-    dummy: uint
+    dummy: usize
 }
 
-impl MyTrait<uint> for MyType {
-    fn get(&self) -> uint { self.dummy }
+impl MyTrait<usize> for MyType {
+    fn get(&self) -> usize { self.dummy }
 }
 
 fn test_eq<T,M>(m: M, v: T)
index 311eaf27da9f0bdffbf13f0e7654c1528e13a2a2..644e45575521e28f2ac6e449a261c4ecd802c0db 100644 (file)
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn f(mut y: Box<int>) {
+fn f(mut y: Box<isize>) {
     *y = 5;
     assert_eq!(*y, 5);
 }
 
 fn g() {
-    let frob = |mut q: Box<int>| { *q = 2; assert!(*q == 2); };
+    let frob = |mut q: Box<isize>| { *q = 2; assert!(*q == 2); };
     let w = box 37;
     frob(w);
 
index f97dc9a5dd727cf2b92dfffff87a28dd61c88050..2a8f6f1fc31eae3bc8830b8c7be8b41634f683c6 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 trait Foo {
-    fn foo(&self, mut x: int) -> int {
+    fn foo(&self, mut x: isize) -> isize {
         let val = x;
         x = 37 * x;
         val + x
@@ -32,7 +32,7 @@ pub fn main() {
     assert_eq!(X.foo(2), 76);
 
     enum Bar {
-       Foo(int),
+       Foo(isize),
        Baz(f32, u8)
     }
 
@@ -63,14 +63,14 @@ fn check_bar(y: &Bar) {
         }
     }
 
-    fn foo1((x, mut y): (f64, int), mut z: int) -> int {
+    fn foo1((x, mut y): (f64, isize), mut z: isize) -> isize {
         y = 2 * 6;
-        z = y + (x as int);
+        z = y + (x as isize);
         y - z
     }
 
     struct A {
-        x: int
+        x: isize
     }
     let A { x: mut x } = A { x: 10 };
     assert_eq!(x, 10);
index bc90a8cf0d77b280af160d8fe2ecd8da9be6e912..503f3ce5f9b2ff5e29ae3461d6bc3561397e6af5 100644 (file)
@@ -11,5 +11,5 @@
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    let _x: &mut [int] = &mut [ 1, 2, 3 ];
+    let _x: &mut [isize] = &mut [ 1, 2, 3 ];
 }
index 28dd89edd629d79d758dc2c49bc5090342be3bc7..3f90cedca9b5a92e1f76342190e400b63bbe3a83 100644 (file)
@@ -8,16 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn grow(v: &mut Vec<int> ) {
+fn grow(v: &mut Vec<isize> ) {
     v.push(1);
 }
 
 pub fn main() {
-    let mut v: Vec<int> = Vec::new();
+    let mut v: Vec<isize> = Vec::new();
     grow(&mut v);
     grow(&mut v);
     grow(&mut v);
     let len = v.len();
     println!("{}", len);
-    assert_eq!(len, 3 as uint);
+    assert_eq!(len, 3 as usize);
 }
index cb2361dd5698ec335eb0ffced718c5a22497571a..72a8847094b2c08630fc7412b940a19a81eecb23 100644 (file)
@@ -17,6 +17,6 @@ enum tree { children(Box<list>), leaf(colour), }
 
 enum list { cons(Box<tree>, Box<list>), nil, }
 
-enum small_list { kons(int, Box<small_list>), neel, }
+enum small_list { kons(isize, Box<small_list>), neel, }
 
 pub fn main() { }
index c557d624586bb67c1927deeb39b71dfbb01c628f..0f85c20d3151bda20a0267917b1ea2b241542d23 100644 (file)
@@ -15,8 +15,8 @@
 
 pub enum Foo {
     A,
-    B(int),
-    C { a: int },
+    B(isize),
+    C { a: isize },
 }
 
 impl Foo {
@@ -34,8 +34,8 @@ mod nest {
 
     pub enum Bar {
         D,
-        E(int),
-        F { a: int },
+        E(isize),
+        F { a: isize },
     }
 
     impl Bar {
index 8d58cd950a8db846a76f570a95439c0a1ff801d2..f506ea11f848be7c5af6f80484c888ca908f14d1 100644 (file)
@@ -13,8 +13,8 @@
 mod m2 {
     pub enum Foo {
         A,
-        B(int),
-        C { a: int },
+        B(isize),
+        C { a: isize },
     }
 
     impl Foo {
index a0b8109b93b2ee229fbf628b9e7888fd0aeffab7..3e72f73bc4894f1b5b502ce34180955835dec434 100644 (file)
@@ -12,8 +12,8 @@
 
 enum Foo {
     A,
-    B(int),
-    C { a: int },
+    B(isize),
+    C { a: isize },
 }
 
 fn _foo (f: Foo) {
index b151eddb94e5dd3fd7d054a44f3847c6931cea14..deb0b5030614e651e653f85ef9e9e9e4acb7bad2 100644 (file)
@@ -11,7 +11,7 @@
 #![feature(start)]
 
 #[start]
-pub fn main(_: int, _: *const *const u8) -> int {
+pub fn main(_: isize, _: *const *const u8) -> isize {
     println!("hello");
     0
 }
index 8b156ae364dd66e889155dcdb26d9e2f135a2876..86197d44a689dc25b459994ca0bd12937121a204 100644 (file)
 
 pub fn main() {
     struct b {
-        i: int,
+        i: isize,
     }
 
     impl b {
-        fn do_stuff(&self) -> int { return 37; }
+        fn do_stuff(&self) -> isize { return 37; }
     }
 
-    fn b(i:int) -> b {
+    fn b(i:isize) -> b {
         b {
             i: i
         }
     }
 
-    //  fn b(x:int) -> int { panic!(); }
+    //  fn b(x:isize) -> isize { panic!(); }
 
     let z = b(42);
     assert_eq!(z.i, 42);
index 0b30cc2cde3661e26405b247759b8aded71cb525..e0a3b1adfe49fd1dbef4a8f4a1d43e0029e50096 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct Foo { foo: bool, bar: Option<int>, baz: int }
+struct Foo { foo: bool, bar: Option<isize>, baz: isize }
 
 pub fn main() {
     match (Foo{foo: true, bar: Some(10), baz: 20}) {
index 488a722f67411a56b31db59bb342fc50192b4bea..28f3438f9862b451e4207ccb5857941c239747c0 100644 (file)
 pub struct X;
 
 impl X {
-    fn f(&self) -> int {
+    fn f(&self) -> isize {
         #[inline(never)]
-        fn inner() -> int {
+        fn inner() -> isize {
             0
         }
         inner()
     }
 
-    fn g(&self) -> int {
+    fn g(&self) -> isize {
         #[inline(never)]
-        fn inner_2() -> int {
+        fn inner_2() -> isize {
             1
         }
         inner_2()
     }
 
-    fn h(&self) -> int {
+    fn h(&self) -> isize {
         #[inline(never)]
-        fn inner() -> int {
+        fn inner() -> isize {
             2
         }
         inner()
index b0ac9fb597a241d10539e8b4559d0845fabe7ff4..46d30b68f78980c5f00e20800447aa1b1bc615a3 100644 (file)
 fn baz() -> ! { panic!(); }
 
 fn foo() {
-    match Some::<int>(5) {
-      Some::<int>(_x) => {
+    match Some::<isize>(5) {
+      Some::<isize>(_x) => {
         let mut bar;
-        match None::<int> { None::<int> => { bar = 5; } _ => { baz(); } }
+        match None::<isize> { None::<isize> => { bar = 5; } _ => { baz(); } }
         println!("{}", bar);
       }
-      None::<int> => { println!("hello"); }
+      None::<isize> => { println!("hello"); }
     }
 }
 
index 14a84484f649c01d13a8091b14cc690b7547059d..f9abdd56fa4447eb3f501b9c80a85445ec489463 100644 (file)
 
 // a bug was causing this to complain about leaked memory on exit
 
-enum t { foo(int, uint), bar(int, Option<int>), }
+enum t { foo(isize, usize), bar(isize, Option<isize>), }
 
 fn nested(o: t) {
     match o {
-        t::bar(_i, Some::<int>(_)) => { println!("wrong pattern matched"); panic!(); }
+        t::bar(_i, Some::<isize>(_)) => { println!("wrong pattern matched"); panic!(); }
         _ => { println!("succeeded"); }
     }
 }
 
-pub fn main() { nested(t::bar(1, None::<int>)); }
+pub fn main() { nested(t::bar(1, None::<isize>)); }
diff --git a/src/test/run-pass/nested-vec-1.rs b/src/test/run-pass/nested-vec-1.rs
new file mode 100644 (file)
index 0000000..2b92ed3
--- /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.
+
+// Test that using the `vec!` macro nested within itself works
+
+fn main() {
+    let nested = vec![vec![1u32, 2u32, 3u32]];
+    assert_eq!(nested[0][1], 2);
+}
diff --git a/src/test/run-pass/nested-vec-2.rs b/src/test/run-pass/nested-vec-2.rs
new file mode 100644 (file)
index 0000000..669f9e4
--- /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.
+
+// Test that using the `vec!` macro nested within itself works
+// when the contents implement Drop
+
+struct D(u32);
+
+impl Drop for D {
+    fn drop(&mut self) { println!("Dropping {}", self.0); }
+}
+
+fn main() {
+    let nested = vec![vec![D(1u32), D(2u32), D(3u32)]];
+    assert_eq!(nested[0][1].0, 2);
+}
diff --git a/src/test/run-pass/nested-vec-3.rs b/src/test/run-pass/nested-vec-3.rs
new file mode 100644 (file)
index 0000000..60cf795
--- /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.
+
+// Test that using the `vec!` macro nested within itself works when
+// the contents implement Drop and we hit a panic in the middle of
+// construction.
+
+
+use std::thread;
+use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+
+static LOG: AtomicUsize = ATOMIC_USIZE_INIT;
+
+struct D(u8);
+
+impl Drop for D {
+    fn drop(&mut self) {
+        println!("Dropping {}", self.0);
+        let old = LOG.load(Ordering::SeqCst);
+        LOG.compare_and_swap(old, old << 4 | self.0 as usize, Ordering::SeqCst);
+    }
+}
+
+fn main() {
+    fn die() -> D { panic!("Oh no"); }
+    let g = thread::spawn(|| {
+        let _nested = vec![vec![D( 1), D( 2), D( 3), D( 4)],
+                           vec![D( 5), D( 6), D( 7), D( 8)],
+                           vec![D( 9), D(10), die(), D(12)],
+                           vec![D(13), D(14), D(15), D(16)]];
+    });
+    assert!(g.join().is_err());
+
+    // When the panic occurs, we will be in the midst of constructing the
+    // second inner vector.  Therefore, we drop the elements of the
+    // partially filled vector first, before we get around to dropping
+    // the elements of the filled vector.
+
+    // Issue 23222: The order in which the elements actually get
+    // dropped is a little funky: as noted above, we'll drop the 9+10
+    // first, but due to #23222, they get dropped in reverse
+    // order. Likewise, again due to #23222, we will drop the second
+    // filled vec before the first filled vec.
+    //
+    // If Issue 23222 is "fixed", then presumably the corrected
+    // expected order of events will be 0x__9_A__1_2_3_4__5_6_7_8;
+    // that is, we would still drop 9+10 first, since they belong to
+    // the more deeply nested expression when the panic occurs.
+
+    let expect = 0x__A_9__5_6_7_8__1_2_3_4;
+    let actual = LOG.load(Ordering::SeqCst);
+    assert!(actual == expect, "expect: 0x{:x} actual: 0x{:x}", expect, actual);
+}
index 3c0123f7519ddf403a86f8d9a2b57383dc27754e..f7adfe36695d2da907f2149c4675353f6e85babc 100644 (file)
@@ -16,5 +16,5 @@
 
 pub fn main() {
     assert_eq!(2, nested_item::foo::<()>());
-    assert_eq!(2, nested_item::foo::<int>());
+    assert_eq!(2, nested_item::foo::<isize>());
 }
index 8482dd84d876cd2260de85539b3ff91a5630dbea..95168b1bff7886a54df50f8b20f5d78c9baacfcb 100644 (file)
 use std::boxed::{Box, HEAP};
 
 struct Structure {
-    x: int,
-    y: int,
+    x: isize,
+    y: isize,
 }
 
 pub fn main() {
-    let x: Box<int> = box(HEAP) 2;
-    let y: Box<int> = box 2;
-    let b: Box<int> = box()(1 + 2);
+    let x: Box<isize> = box(HEAP) 2;
+    let y: Box<isize> = box 2;
+    let b: Box<isize> = box()(1 + 2);
     let c = box()(3 + 4);
 }
index 3e4665bb231f445bc5e9161d34475d2282847d13..17f71c3de432fce4273e6721a5140dbae0d9a790 100644 (file)
@@ -11,8 +11,8 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn f(x: Box<int>) {
-    let y: &int = &*x;
+fn f(x: Box<isize>) {
+    let y: &isize = &*x;
     println!("{}", *x);
     println!("{}", *y);
 }
index bd0a53b620c0a9252d512a82fdda5be261944cd8..554fab53e4b589eb0fa00ba94efeee5414c55ec1 100644 (file)
@@ -11,8 +11,8 @@
 use std::fmt;
 
 struct Thingy {
-    x: int,
-    y: int
+    x: isize,
+    y: isize
 }
 
 impl fmt::Debug for Thingy {
index fa681c81398fecfa1cedaa55739b3bfed5b8b007..36d66d1e12b6bbd4df9bffbe3c669c1c4cba4b3a 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-static FOO: int = 3;
+static FOO: isize = 3;
 
 pub fn main() {
     println!("{}", FOO);
index e06461daed0c93c9afea708e96e195bf276283cc..4d9f0394eb4407368353add8da4a3b8a6792c572 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-static FOO: [int; 3] = [1, 2, 3];
+static FOO: [isize; 3] = [1, 2, 3];
 
 pub fn main() {
     println!("{} {} {}", FOO[0], FOO[1], FOO[2]);
index db387224c3879e498cef4cd432d54f6e9ee1e57c..a0d631046a6354498d3bdcf02d492d90bee2c746 100644 (file)
@@ -11,6 +11,6 @@
 // pretty-expanded FIXME #23616
 
 fn main() {
-    let _a: *const int = 3 as *const int;
-    let _a: *mut int = 3 as *mut int;
+    let _a: *const isize = 3 as *const isize;
+    let _a: *mut isize = 3 as *mut isize;
 }
index 0fe1227523f63a0bfedd48a659490aec4193ddcd..c6fa7cc35fd9af3b92a2b1a4ed8955f185fb5e15 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn f<F>(i: int, f: F) -> int where F: FnOnce(int) -> int { f(i) }
+fn f<F>(i: isize, f: F) -> isize where F: FnOnce(isize) -> isize { f(i) }
 
 fn g<G>(_g: G) where G: FnOnce() { }
 
index ad878fe4b319de94d6d9d98b355b07231b4ab850..2d162ba7e336bfcd8d93d88a4ed2f4c69159baae 100644 (file)
@@ -16,7 +16,7 @@
 
 use std::cell::Cell;
 
-struct Foo<'a>(&'a Cell<int>);
+struct Foo<'a>(&'a Cell<isize>);
 
 #[unsafe_destructor]
 impl<'a> Drop for Foo<'a> {
index 5952258e46c32f61ae1a6a155a4d46da7ca6788e..19790a488b58e09864527d2939f4788283270924 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #[derive(PartialEq, Debug)]
-struct Foo(uint);
+struct Foo(usize);
 
 fn foo() -> Foo {
     Foo(42)
index 869ae4a37d22a62b4e881ea58c71130f843ca881..fb43f041e0465f19a572c4f934108c507816d7c9 100644 (file)
 
 #[derive(Copy)]
 struct Mytype {
-    compute: fn(mytype) -> int,
-    val: int,
+    compute: fn(mytype) -> isize,
+    val: isize,
 }
 
-fn compute(i: mytype) -> int {
+fn compute(i: mytype) -> isize {
     let mytype(m) = i;
     return m.val + 20;
 }
index f5f34607aff7b8955a8e0081915c83604503c253..43f6b27d64fc41dfad448be4b268a98f73147d8d 100644 (file)
@@ -30,7 +30,7 @@ pub mod linkhack {
 }
 
 #[start]
-pub fn main(_: int, _: **u8, _: *u8) -> int {
+pub fn main(_: isize, _: **u8, _: *u8) -> isize {
     no_std_crate::foo();
     0
 }
index 1eeea662383223a7e9b68e3e291baee12a1d3cd1..5f1c69bb4b6542c985f3d0fa07b4030c298e1cdb 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct X {
-    repr: int
+    repr: isize
 }
 
 fn apply<T, F>(x: T, f: F) where F: FnOnce(T) {
     f(x);
 }
 
-fn check_int(x: int) {
+fn check_int(x: isize) {
     assert_eq!(x, 22);
 }
 
index 42cef21f8849640f163e19635ffddd982450c450..22aa09c718a747c0019e00cd2fe19b12518fd962 100644 (file)
 use std::mem;
 
 #[inline(never)]
-extern "C" fn foo<'a>(x: &'a int) -> Option<&'a int> { Some(x) }
+extern "C" fn foo<'a>(x: &'a isize) -> Option<&'a isize> { Some(x) }
 
-static FOO: int = 0xDEADBEE;
+static FOO: isize = 0xDEADBEE;
 
 pub fn main() {
     unsafe {
-        let f: for<'a> extern "C" fn(&'a int) -> &'a int = mem::transmute(foo);
+        let f: for<'a> extern "C" fn(&'a isize) -> &'a isize = mem::transmute(foo);
         assert_eq!(*f(&FOO), FOO);
     }
 }
index b92ae3f23ec1a2df4d7f568c1e6d7d260ae430b8..ad2716e00de56f76993bf7905ab6849308811227 100644 (file)
@@ -23,7 +23,7 @@
 // trying to get assert failure messages that at least identify which case
 // failed.
 
-enum E<T> { Thing(int, T), Nothing((), ((), ()), [i8; 0]) }
+enum E<T> { Thing(isize, T), Nothing((), ((), ()), [i8; 0]) }
 impl<T> E<T> {
     fn is_none(&self) -> bool {
         match *self {
@@ -31,7 +31,7 @@ fn is_none(&self) -> bool {
             E::Nothing(..) => true
         }
     }
-    fn get_ref(&self) -> (int, &T) {
+    fn get_ref(&self) -> (isize, &T) {
         match *self {
             E::Nothing(..) => panic!("E::get_ref(Nothing::<{}>)",  stringify!(T)),
             E::Thing(x, ref y) => (x, y)
@@ -76,11 +76,11 @@ macro_rules! check_type {
 }
 
 pub fn main() {
-    check_type!(&17, &int);
-    check_type!(box 18, Box<int>);
+    check_type!(&17, &isize);
+    check_type!(box 18, Box<isize>);
     check_type!("foo".to_string(), String);
-    check_type!(vec!(20, 22), Vec<int> );
-    let mint: uint = unsafe { mem::transmute(main) };
+    check_type!(vec!(20, 22), Vec<isize> );
+    let mint: usize = unsafe { mem::transmute(main) };
     check_type!(main, fn(), |pthing| {
         assert!(mint == unsafe { mem::transmute(*pthing) })
     });
index 2b908a6c5b775bfd3cc4a524e2ed2d55f8e4eb11..6e3f438575e2a850cd9d3316ae74162d73a24b8b 100644 (file)
@@ -12,8 +12,8 @@
 
 use std::mem;
 
-enum E<T> { Thing(int, T), Nothing((), ((), ()), [i8; 0]) }
-struct S<T>(int, T);
+enum E<T> { Thing(isize, T), Nothing((), ((), ()), [i8; 0]) }
+struct S<T>(isize, T);
 
 // These are macros so we get useful assert messages.
 
@@ -37,7 +37,7 @@ macro_rules! check_type {
 }
 
 pub fn main() {
-    check_type!(&'static int);
-    check_type!(Box<int>);
+    check_type!(&'static isize);
+    check_type!(Box<isize>);
     check_type!(extern fn());
 }
index 4369e4095fbe5b295d2dc1c9cd0d4de9cd4eedc6..f4cfc80827498350d6d2731ad5b95a9b437161c6 100644 (file)
@@ -12,7 +12,7 @@
 
 enum blah { a, b, }
 
-fn or_alt(q: blah) -> int {
+fn or_alt(q: blah) -> isize {
   match q { blah::a | blah::b => { 42 } }
 }
 
index baf8c6e4c97913e459911e0940be8e47220833d3..aa2dbf03bb2c4f69cb84cba5d14ee941818f52e1 100644 (file)
 use std::any::Any;
 
 trait Wrap {
-    fn get(&self) -> int;
+    fn get(&self) -> isize;
     fn wrap(self: Box<Self>) -> Box<Any+'static>;
 }
 
-impl Wrap for int {
-    fn get(&self) -> int {
+impl Wrap for isize {
+    fn get(&self) -> isize {
         *self
     }
-    fn wrap(self: Box<int>) -> Box<Any+'static> {
+    fn wrap(self: Box<isize>) -> Box<Any+'static> {
         self as Box<Any+'static>
     }
 }
 
-fn is<T:'static>(x: &Any) -> bool {
+fn is<T:Any>(x: &Any) -> bool {
     x.is::<T>()
 }
 
index 368842ed1b0304244841ae3d233670baf9351281..686924a31400a1fd80e647e4d151e07cbfc6995e 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait Foo {
-    fn foo(&self) -> uint;
-    fn bar(&mut self) -> uint;
+    fn foo(&self) -> usize;
+    fn bar(&mut self) -> usize;
 }
 
-impl Foo for uint {
-    fn foo(&self) -> uint {
+impl Foo for usize {
+    fn foo(&self) -> usize {
         *self
     }
 
-    fn bar(&mut self) -> uint {
+    fn bar(&mut self) -> usize {
         *self += 1;
         *self
     }
@@ -36,13 +36,13 @@ fn do_it_mut(obj: &mut Foo) {
     do_it_imm(obj, y);
 }
 
-fn do_it_imm(obj: &Foo, v: uint) {
+fn do_it_imm(obj: &Foo, v: usize) {
     let y = obj.foo();
     assert_eq!(v, y);
 }
 
 pub fn main() {
-    let mut x: uint = 22;
+    let mut x: usize = 22;
     let obj = &mut x as &mut Foo;
     do_it_mut(obj);
     do_it_imm(obj, 23);
index 15ed94e62bad93cb37ebd9e9624b6d0f43fa02ff..9a1cdd2922f7a7deabe8feb02dbc8c0b1503163f 100644 (file)
 
 
 trait FooTrait {
-    fn foo(&self) -> uint;
+    fn foo(&self) -> usize;
 }
 
 struct BarStruct {
-    x: uint
+    x: usize
 }
 
 impl FooTrait for BarStruct {
-    fn foo(&self) -> uint {
+    fn foo(&self) -> usize {
         self.x
     }
 }
index e72065885324e4fc9a35064d68d32cc2c964d88a..4357adbf65bfd98617d0c8cec634df0256366698 100644 (file)
 #![feature(box_syntax)]
 
 trait FooTrait {
-    fn foo(self: Box<Self>) -> uint;
+    fn foo(self: Box<Self>) -> usize;
 }
 
 struct BarStruct {
-    x: uint
+    x: usize
 }
 
 impl FooTrait for BarStruct {
-    fn foo(self: Box<BarStruct>) -> uint {
+    fn foo(self: Box<BarStruct>) -> usize {
         self.x
     }
 }
index 3f00cf7d18400e6b783a98b54b9e29972571cd27..f5f0928ff144a74954246f6db837b68c60cde812 100644 (file)
@@ -12,7 +12,7 @@
 
 
 pub fn main() {
-    let mut x: int = 1;
+    let mut x: isize = 1;
     x *= 2;
     println!("{}", x);
     assert_eq!(x, 2);
index 4ce6fcee8c78e06dfaf0efc7fcebe45f99cbea25..af7deef11b6b2f95af3341d238925b5572e2677b 100644 (file)
@@ -15,8 +15,8 @@
 
 #[derive(Debug,PartialEq,Eq)]
 struct Point {
-    x: int,
-    y: int
+    x: isize,
+    y: isize
 }
 
 impl ops::Add for Point {
@@ -27,10 +27,10 @@ fn add(self, other: Point) -> Point {
     }
 }
 
-impl ops::Add<int> for Point {
+impl ops::Add<isize> for Point {
     type Output = Point;
 
-    fn add(self, other: int) -> Point {
+    fn add(self, other: isize) -> Point {
         Point {x: self.x + other,
                y: self.y + other}
     }
index 69542042c4fbfcc578ef0f87f368952a76c71427..fc089839683ed5f2f856f141b8b8ede94a58af86 100644 (file)
@@ -15,8 +15,8 @@
 
 #[derive(Copy, Debug)]
 struct Point {
-    x: int,
-    y: int
+    x: isize,
+    y: isize
 }
 
 impl ops::Add for Point {
@@ -52,9 +52,9 @@ fn not(self) -> Point {
 }
 
 impl ops::Index<bool> for Point {
-    type Output = int;
+    type Output = isize;
 
-    fn index(&self, x: bool) -> &int {
+    fn index(&self, x: bool) -> &isize {
         if x {
             &self.x
         } else {
@@ -87,4 +87,4 @@ pub fn main() {
     result(p[true]);
 }
 
-fn result(i: int) { }
+fn result(i: isize) { }
index b0f5d8e53bd5dbe41136ee4d4475239409afdfed..4902038667cd87784ba8e554a006afb731e47551 100644 (file)
@@ -15,7 +15,7 @@
 use std::cell::Cell;
 
 struct dtor<'a> {
-    x: &'a Cell<int>,
+    x: &'a Cell<isize>,
 }
 
 #[unsafe_destructor]
index 1aaef7b817440d38c70326f11afce5bc4d34c44f..3ab78e8d053447ba9750ae3fa75393b0d9d2bf54 100644 (file)
@@ -10,9 +10,9 @@
 
 // pretty-expanded FIXME #23616
 
-enum blah { a(int, int, uint), b(int, int), c, }
+enum blah { a(isize, isize, usize), b(isize, isize), c, }
 
-fn or_alt(q: blah) -> int {
+fn or_alt(q: blah) -> isize {
     match q { blah::a(x, y, _) | blah::b(x, y) => { return x + y; } blah::c => { return 0; } }
 }
 
index a42720d3cb430244018502c2c7d7ee1529a6dfde..c8a2ba0af47cb98a8c31ad36d6a6b19c244734a6 100644 (file)
@@ -16,8 +16,8 @@
 
 // pretty-expanded FIXME #23616
 
-static mut ORDER: [uint; 3] = [0, 0, 0];
-static mut INDEX: uint = 0;
+static mut ORDER: [usize; 3] = [0, 0, 0];
+static mut INDEX: usize = 0;
 
 struct A;
 impl Drop for A {
index 1a6c60426afa86ef5254aca7d248c5a7eb4bc4c4..eb0a6c95134aea94d90a1b272ad970e49be66ee2 100644 (file)
@@ -12,8 +12,8 @@
 
 #[derive(Copy)]
 pub struct Foo {
-    f1: int,
-    _f2: int,
+    f1: isize,
+    _f2: isize,
 }
 
 #[inline(never)]
index f80fbdeb1e3769d8edc548ff83632d2f605bad9a..33489688d4a5c60ada36996534e109a5951ddca3 100644 (file)
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct A { a: int, b: int }
-struct Abox { a: Box<int>, b: Box<int> }
+struct A { a: isize, b: isize }
+struct Abox { a: Box<isize>, b: Box<isize> }
 
-fn ret_int_i() -> int { 10 }
+fn ret_int_i() -> isize { 10 }
 
-fn ret_ext_i() -> Box<int> { box 10 }
+fn ret_ext_i() -> Box<isize> { box 10 }
 
 fn ret_int_rec() -> A { A {a: 10, b: 10} }
 
@@ -31,8 +31,8 @@ fn ret_ext_mem() -> Abox { Abox {a: box 10, b: box 10} }
 fn ret_ext_ext_mem() -> Box<Abox> { box Abox{a: box 10, b: box 10} }
 
 pub fn main() {
-    let mut int_i: int;
-    let mut ext_i: Box<int>;
+    let mut int_i: isize;
+    let mut ext_i: Box<isize>;
     let mut int_rec: A;
     let mut ext_rec: Box<A>;
     let mut ext_mem: Abox;
index c2b42ac1c8163a5b4667a07ec8898b23bbcd479c..e4e07941470a815655bf5fdb73c603a4e7b2c066 100644 (file)
@@ -10,7 +10,7 @@
 
 // Regression test for issue #152.
 pub fn main() {
-    let mut b: uint = 1_usize;
+    let mut b: usize = 1_usize;
     while b < std::mem::size_of::<usize>() {
         0_usize << b;
         b <<= 1_usize;
index cc36b625c35d50f728902e1ee8c2c80e3c77e119..14a9cc4c2489a5b005d2c2368f5f24bb0e74bdd6 100644 (file)
@@ -13,8 +13,8 @@
 
 #[derive(PartialEq)]
 struct DerefCounter<T> {
-    count_imm: Cell<uint>,
-    count_mut: uint,
+    count_imm: Cell<usize>,
+    count_mut: usize,
     value: T
 }
 
@@ -27,7 +27,7 @@ fn new(value: T) -> DerefCounter<T> {
         }
     }
 
-    fn counts(&self) -> (uint, uint) {
+    fn counts(&self) -> (usize, usize) {
         (self.count_imm.get(), self.count_mut)
     }
 }
@@ -50,12 +50,12 @@ fn deref_mut(&mut self) -> &mut T {
 
 #[derive(PartialEq, Debug)]
 struct Point {
-    x: int,
-    y: int
+    x: isize,
+    y: isize
 }
 
 impl Point {
-    fn get(&self) -> (int, int) {
+    fn get(&self) -> (isize, isize) {
         (self.x, self.y)
     }
 }
index f949f6e4ef43a0dd7ecef6231d8e810d6de391ed..38bf68b746946c1ca52bb3259612d4a3de16ccbd 100644 (file)
@@ -35,10 +35,10 @@ fn deref(&self) -> &T {
     }
 }
 
-struct Foo {x: int}
+struct Foo {x: isize}
 
 impl Foo {
-    fn foo(&self) -> int {self.x}
+    fn foo(&self) -> isize {self.x}
 }
 
 pub fn main() {
index 7b956dc772f54a28f2e4675c6d1cfad9ec056ea7..ddd6ae4d0a090cf4fcce7c5973f50b677d3bf4a3 100644 (file)
@@ -17,8 +17,8 @@
 
 #[derive(PartialEq, Debug)]
 struct Point {
-    x: int,
-    y: int
+    x: isize,
+    y: isize
 }
 
 pub fn main() {
index 7cb57a912535a819f585d6c4981cf4d1617b70d3..291d2c6498f999ccf9ec7b755d7865ee09eed289 100644 (file)
@@ -13,7 +13,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo(f: &mut FnMut(int) -> int) -> int {
+fn foo(f: &mut FnMut(isize) -> isize) -> isize {
     f(22)
 }
 
index 65a63a33d1bb63c84ac121bc37588cf4c3fef381..42c71572a3a94301c947de2da95f3def2f0b61f3 100644 (file)
@@ -13,7 +13,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo(f: &mut FnMut(int, int) -> int) -> int {
+fn foo(f: &mut FnMut(isize, isize) -> isize) -> isize {
     f(1, 2)
 }
 
index 46fa0619082091a44ee2836f673e99f74bd51b67..9bc6c9f042835bf34157103340518dca167c3444 100644 (file)
@@ -13,7 +13,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo(f: &mut FnMut() -> int) -> int {
+fn foo(f: &mut FnMut() -> isize) -> isize {
     f()
 }
 
index 110109018db59d672476ca3f9e9deea720b69b59..8df4adf6713c423223670463cff85d842a68ab48 100644 (file)
@@ -12,7 +12,7 @@
 
 #![feature(unboxed_closures, core)]
 
-use std::ops::{FnMut};
+use std::ops::FnMut;
 
 struct S {
     x: i32,
index 187b032b0f17031e4d57e7852446c7cbc01b0bad..5f6eb87ae1be41198f635fec5230e1758e98cfc7 100644 (file)
@@ -15,8 +15,8 @@
 use std::vec::Vec;
 
 struct DerefCounter<T> {
-    count_imm: Cell<uint>,
-    count_mut: uint,
+    count_imm: Cell<usize>,
+    count_mut: usize,
     value: T
 }
 
@@ -29,7 +29,7 @@ fn new(value: T) -> DerefCounter<T> {
         }
     }
 
-    fn counts(&self) -> (uint, uint) {
+    fn counts(&self) -> (usize, usize) {
         (self.count_imm.get(), self.count_mut)
     }
 }
index 20e55de2f058a5dddcf679197c276e03f4b91254..6d8bb30c83755ffd37a5928d6f4ee5ec61ec53d2 100644 (file)
@@ -16,8 +16,8 @@
 
 #[derive(PartialEq, Debug)]
 struct Point {
-    x: int,
-    y: int
+    x: isize,
+    y: isize
 }
 
 pub fn main() {
index 37de83aef33b391b99ae752dc8f0d5c8aad06dec..56d71edd56cd00a4d1c4ed6d7be2d7cc3cb94bee 100644 (file)
 use std::ops::{Index, IndexMut};
 
 struct Foo {
-    x: int,
-    y: int,
+    x: isize,
+    y: isize,
 }
 
-impl Index<int> for Foo {
-    type Output = int;
+impl Index<isize> for Foo {
+    type Output = isize;
 
-    fn index(&self, z: int) -> &int {
+    fn index(&self, z: isize) -> &isize {
         if z == 0 {
             &self.x
         } else {
@@ -34,8 +34,8 @@ fn index(&self, z: int) -> &int {
     }
 }
 
-impl IndexMut<int> for Foo {
-    fn index_mut(&mut self, z: int) -> &mut int {
+impl IndexMut<isize> for Foo {
+    fn index_mut(&mut self, z: isize) -> &mut isize {
         if z == 0 {
             &mut self.x
         } else {
@@ -45,14 +45,14 @@ fn index_mut(&mut self, z: int) -> &mut int {
 }
 
 trait Int {
-    fn get(self) -> int;
-    fn get_from_ref(&self) -> int;
+    fn get(self) -> isize;
+    fn get_from_ref(&self) -> isize;
     fn inc(&mut self);
 }
 
-impl Int for int {
-    fn get(self) -> int { self }
-    fn get_from_ref(&self) -> int { *self }
+impl Int for isize {
+    fn get(self) -> isize { self }
+    fn get_from_ref(&self) -> isize { *self }
     fn inc(&mut self) { *self += 1; }
 }
 
index 2370c6a28566f97b0161c93a051463d6c36a92c1..bc53836aca3ef9dc6b3371fa59120d2b4a62dca0 100644 (file)
 use std::ops::Index;
 
 struct Foo {
-    x: int,
-    y: int,
+    x: isize,
+    y: isize,
 }
 
 struct Bar {
     foo: Foo
 }
 
-impl Index<int> for Foo {
-    type Output = int;
+impl Index<isize> for Foo {
+    type Output = isize;
 
-    fn index(&self, z: int) -> &int {
+    fn index(&self, z: isize) -> &isize {
         if z == 0 {
             &self.x
         } else {
@@ -39,14 +39,14 @@ fn index(&self, z: int) -> &int {
 }
 
 trait Int {
-    fn get(self) -> int;
-    fn get_from_ref(&self) -> int;
+    fn get(self) -> isize;
+    fn get_from_ref(&self) -> isize;
     fn inc(&mut self);
 }
 
-impl Int for int {
-    fn get(self) -> int { self }
-    fn get_from_ref(&self) -> int { *self }
+impl Int for isize {
+    fn get(self) -> isize { self }
+    fn get_from_ref(&self) -> isize { *self }
     fn inc(&mut self) { *self += 1; }
 }
 
index 79c2b14aa93d3e23cead0ddb193492e3eced6406..4f8cf0e9e38efd6867f49cfff464df8b2a0b3d1d 100644 (file)
 use std::ops::{Index, IndexMut};
 
 struct Foo {
-    x: int,
-    y: int,
+    x: isize,
+    y: isize,
 }
 
-impl Index<int> for Foo {
-    type Output = int;
+impl Index<isize> for Foo {
+    type Output = isize;
 
-    fn index(&self, z: int) -> &int {
+    fn index(&self, z: isize) -> &isize {
         if z == 0 {
             &self.x
         } else {
@@ -31,8 +31,8 @@ fn index(&self, z: int) -> &int {
     }
 }
 
-impl IndexMut<int> for Foo {
-    fn index_mut(&mut self, z: int) -> &mut int {
+impl IndexMut<isize> for Foo {
+    fn index_mut(&mut self, z: isize) -> &mut isize {
         if z == 0 {
             &mut self.x
         } else {
@@ -42,14 +42,14 @@ fn index_mut(&mut self, z: int) -> &mut int {
 }
 
 trait Int {
-    fn get(self) -> int;
-    fn get_from_ref(&self) -> int;
+    fn get(self) -> isize;
+    fn get_from_ref(&self) -> isize;
     fn inc(&mut self);
 }
 
-impl Int for int {
-    fn get(self) -> int { self }
-    fn get_from_ref(&self) -> int { *self }
+impl Int for isize {
+    fn get(self) -> isize { self }
+    fn get_from_ref(&self) -> isize { *self }
     fn inc(&mut self) { *self += 1; }
 }
 
index e7a662c5260928028b4c9f9d868808cd4d18ef2e..8819b201361055b68848c08a7b2df8b6ddce6ca9 100644 (file)
@@ -13,7 +13,7 @@
 #[repr(packed)]
 struct Foo {
     bar: u8,
-    baz: uint
+    baz: usize
 }
 
 pub fn main() {
index 6df761d1b21fe1cbf3e630546a70fa9b5c751a5d..3c3d632222e192ade9653e81a976ff3f7bdb6af4 100644 (file)
@@ -13,7 +13,7 @@
 #[repr(packed)]
 struct Foo {
     bar: u8,
-    baz: uint
+    baz: usize
 }
 
 pub fn main() {
index c1ebd2a530451bf7f364349144562c9d7f5995d5..4226fba9d3e37ea9e1972def5576ea344d7a70f1 100644 (file)
@@ -19,7 +19,7 @@ struct A {
 }
 
 struct B {
-    foo: int,
+    foo: isize,
 }
 
 impl Drop for A {
index eb483009662bf1b9c1ee71c580df094f97191583..3e74341d819812f3bf98940a1372755c773367e6 100644 (file)
@@ -23,7 +23,7 @@ mod foo {
 
 fn foo1<T>(_: &(A<T> + Send)) {}
 fn foo2<T>(_: Box<A<T> + Send + Sync>) {}
-fn foo3<T>(_: Box<B<int, uint> + 'static>) {}
+fn foo3<T>(_: Box<B<isize, usize> + 'static>) {}
 fn foo4<'a, T>(_: Box<C<'a, T> + 'static + Send>) {}
 fn foo5<'a, T>(_: Box<foo::D<'a, T> + 'static + Send>) {}
 
index b1a761d09fda053f4cd54bd8d4a65dc1cca25508..fddc2744eb1745c2e90c856ddd91afecdd619d18 100644 (file)
@@ -13,7 +13,7 @@
 // pretty-expanded FIXME #23616
 
 mod foo {
-    pub fn bar(_offset: uint) { }
+    pub fn bar(_offset: usize) { }
 }
 
 pub fn main() { foo::bar(0); }
index ad12775a31df805aaf4f751cfff96a2c51729aa9..1ab578b93325789d328f3b0a90ebf14e9ae35df7 100644 (file)
@@ -14,7 +14,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo(src: uint) {
+fn foo(src: usize) {
 
     match Some(src) {
       Some(src_id) => {
index e4f1df2d6376df916c553f21a2e8ec7abbaf7d17..909ed985d7f48804c6184587331231e3586c33cf 100644 (file)
@@ -9,12 +9,12 @@
 // except according to those terms.
 
 struct Foo {
-    x: int,
-    y: int
+    x: isize,
+    y: isize
 }
 
 pub fn main() {
-    let f = |(x, _): (int, int)| println!("{}", x + 1);
+    let f = |(x, _): (isize, isize)| println!("{}", x + 1);
     let g = |Foo { x: x, y: _y }: Foo| println!("{}", x + 1);
     f((2, 3));
     g(Foo { x: 1, y: 2 });
index d761f1610d4a87a767fed1e5ea0fcdfd41bd8005..f0f3d3d7bd886fa9cb1921f4f639af278632ee7d 100644 (file)
@@ -13,6 +13,6 @@
 
 // pretty-expanded FIXME #23616
 
-fn bad(_a: int) -> int { return 37; } //~ ERROR Non-boolean return type
+fn bad(_a: isize) -> isize { return 37; } //~ ERROR Non-boolean return type
 
 pub fn main() { }
index bcfc39ee7e4e65c947d8247af0adf5eb6b0ce219..7e5e41820e99947a1ed3ad3a99df9945c9d174ad 100644 (file)
 // note: halfway done porting to modern rust
 use std::comm;
 
-fn starve_main(alive: Receiver<int>) {
+fn starve_main(alive: Receiver<isize>) {
     println!("signalling main");
     alive.recv();
     println!("starving main");
-    let mut i: int = 0;
+    let mut i: isize = 0;
     loop { i += 1; }
 }
 
@@ -29,7 +29,7 @@ pub fn main() {
     spawn(move|| {
         starve_main(port);
     });
-    let mut i: int = 0;
+    let mut i: isize = 0;
     println!("main waiting for alive signal");
     chan.send(i);
     println!("main got alive signal");
index 17fb5aad6d097d7dd439534f80e803e8df9c2c29..aa2db260dd4ae3ca424d9247766e5355af0cb5a4 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "priv-impl-prim-ty" as bar;
+extern crate priv_impl_prim_ty as bar;
 
 pub fn main() {
     bar::frob(1);
index 27b8d5965e9809524e7d6861e01d32fb8bb8156b..d32ac4b90821f8ccf657e1c5901e6e4e1388c1e3 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct cat {
-    meows : uint,
+    meows : usize,
 
-    how_hungry : int,
+    how_hungry : isize,
 }
 
 impl cat {
-  pub fn meow_count(&mut self) -> uint { self.meows }
+  pub fn meow_count(&mut self) -> usize { self.meows }
 }
 
-fn cat(in_x : uint, in_y : int) -> cat {
+fn cat(in_x : usize, in_y : isize) -> cat {
     cat {
         meows: in_x,
         how_hungry: in_y
index a15c7b58ce119b50251fd9b5a328b71a03956a00..0d6e6010c56c84c719a6eaafde7ed554e7de0623 100644 (file)
@@ -11,9 +11,9 @@
 // pretty-expanded FIXME #23616
 
 struct cat {
-    meows : uint,
+    meows : usize,
 
-    how_hungry : int,
+    how_hungry : isize,
 }
 
 impl cat {
@@ -27,7 +27,7 @@ impl cat {
     fn nap(&mut self) { for _ in 1_usize..10_usize { } }
 }
 
-fn cat(in_x : uint, in_y : int) -> cat {
+fn cat(in_x : usize, in_y : isize) -> cat {
     cat {
         meows: in_x,
         how_hungry: in_y
index 85897f171b6ce4d7a5bf1f89d1cff4645e6c28c2..ac1b6aebec5b1cd1785a5389115a5a8ac6d11ba8 100644 (file)
 
 pub fn main() {
     // &mut -> &
-    let x: &mut int = &mut 42;
-    let x: &int = x;
+    let x: &mut isize = &mut 42;
+    let x: &isize = x;
 
-    let x: &int = &mut 42;
+    let x: &isize = &mut 42;
 
     // & -> *const
-    let x: &int = &42;
-    let x: *const int = x;
+    let x: &isize = &42;
+    let x: *const isize = x;
 
-    let x: *const int = &42;
+    let x: *const isize = &42;
 
     // &mut -> *const
-    let x: &mut int = &mut 42;
-    let x: *const int = x;
+    let x: &mut isize = &mut 42;
+    let x: *const isize = x;
 
-    let x: *const int = &mut 42;
+    let x: *const isize = &mut 42;
 
     // *mut -> *const
-    let x: *mut int = &mut 42;
-    let x: *const int = x;
+    let x: *mut isize = &mut 42;
+    let x: *const isize = x;
 }
index 2612a21bc01b53fb32fec9aabf67261fa906fb4e..c27b95e1f135d5e533c18d299af18041989ffac5 100644 (file)
@@ -15,7 +15,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn sums_to(v: Vec<int> , sum: int) -> bool {
+fn sums_to(v: Vec<isize> , sum: isize) -> bool {
     let mut i = 0;
     let mut sum0 = 0;
     while i < v.len() {
@@ -25,7 +25,7 @@ fn sums_to(v: Vec<int> , sum: int) -> bool {
     return sum0 == sum;
 }
 
-fn sums_to_using_uniq(v: Vec<int> , sum: int) -> bool {
+fn sums_to_using_uniq(v: Vec<isize> , sum: isize) -> bool {
     let mut i = 0;
     let mut sum0: Box<_> = box 0;
     while i < v.len() {
@@ -35,7 +35,7 @@ fn sums_to_using_uniq(v: Vec<int> , sum: int) -> bool {
     return *sum0 == sum;
 }
 
-fn sums_to_using_rec(v: Vec<int> , sum: int) -> bool {
+fn sums_to_using_rec(v: Vec<isize> , sum: isize) -> bool {
     let mut i = 0;
     let mut sum0 = F {f: 0};
     while i < v.len() {
@@ -47,7 +47,7 @@ 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 {
+fn sums_to_using_uniq_rec(v: Vec<isize> , sum: isize) -> bool {
     let mut i = 0;
     let mut sum0 = F::<Box<_>> {f: box 0};
     while i < v.len() {
index f2aa17d4069a882d852afc3ac3bceb4048a7beee..4633f73b9a007a0994a7b81b815cd444c2274100 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo() -> int { 42 }
+fn foo() -> isize { 42 }
 
 // Test that range syntax works in return statements
 fn return_range_to() -> ::std::ops::RangeTo<i32> { return ..1; }
index bad3621cbf06a27a77722012e76afd094d28c7cf..870d7a0bc0873009d6e4d3ad126c4883ba4eb8ef 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct Foo {
-    foo: uint,
+    foo: usize,
 }
 
 impl Foo {
-    fn bar(&self) -> uint { 5 }
+    fn bar(&self) -> usize { 5 }
 }
 
 fn main() {
index 7bc761d2f606d06119d9b83a25196ade1b54c10b..6e9769ea2b9282a8037ee21d99d6f102b30db4c6 100644 (file)
 #![feature(box_syntax)]
 
 trait get {
-    fn get(self) -> int;
+    fn get(self) -> isize;
 }
 
 // Note: impl on a slice; we're checking that the pointers below
-// correctly get borrowed to `&`. (similar to impling for `int`, with
+// correctly get borrowed to `&`. (similar to impling for `isize`, with
 // `&self` instead of `self`.)
-impl<'a> get for &'a int {
-    fn get(self) -> int {
+impl<'a> get for &'a isize {
+    fn get(self) -> isize {
         return *self;
     }
 }
index 6a5da0149947abd8225cc0b4bd02cdf745a4e480..1ec16747181c2b2d0a7efabbcc477065d4c23d22 100644 (file)
 
 
 trait sum {
-    fn sum_(self) -> int;
+    fn sum_(self) -> isize;
 }
 
 // Note: impl on a slice
-impl<'a> sum for &'a [int] {
-    fn sum_(self) -> int {
+impl<'a> sum for &'a [isize] {
+    fn sum_(self) -> isize {
         self.iter().fold(0, |a, &b| a + b)
     }
 }
 
-fn call_sum(x: &[int]) -> int { x.sum_() }
+fn call_sum(x: &[isize]) -> isize { x.sum_() }
 
 pub fn main() {
     let x = vec!(1, 2, 3);
index ff00dc0ab5336db0350f4352937bffdc2970f5d9..d3b9e56f7d07938f7dbccd0e83ba8a88e4b3e994 100644 (file)
@@ -13,7 +13,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct Point {x: int, y: int, z: int}
+struct Point {x: isize, y: isize, z: isize}
 
 fn f(p: Point) { assert!((p.z == 12)); }
 
index 0b714578c66bf31aa09ac6f161ff3f2c15825edb..cd9cc0901202c45d6d061c449b8e9ec7481d7ba8 100644 (file)
@@ -28,10 +28,10 @@ fn main() {
 }
 
 unsafe fn test_triangle() -> bool {
-    static COUNT : uint = 16;
+    static COUNT : usize = 16;
     let mut ascend = repeat(ptr::null_mut()).take(COUNT).collect::<Vec<_>>();
     let ascend = &mut *ascend;
-    static ALIGN : uint = 1;
+    static ALIGN : usize = 1;
 
     // Checks that `ascend` forms triangle of ascending size formed
     // from pairs of rows (where each pair of rows is equally sized),
@@ -40,37 +40,37 @@ unsafe fn sanity_check(ascend: &[*mut u8]) {
         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 {
-                assert_eq!(*p0.offset(j as int), i as u8);
-                assert_eq!(*p1.offset(j as int), i as u8);
+                assert_eq!(*p0.offset(j as isize), i as u8);
+                assert_eq!(*p1.offset(j as isize), i as u8);
             }
         }
     }
 
     static PRINT : bool = false;
 
-    unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
+    unsafe fn allocate(size: usize, align: usize) -> *mut u8 {
         if PRINT { println!("allocate(size={} align={})", size, align); }
 
         let ret = heap::allocate(size, align);
         if ret.is_null() { alloc::oom() }
 
         if PRINT { println!("allocate(size={} align={}) ret: 0x{:010x}",
-                            size, align, ret as uint);
+                            size, align, ret as usize);
         }
 
         ret
     }
-    unsafe fn deallocate(ptr: *mut u8, size: uint, align: uint) {
+    unsafe fn deallocate(ptr: *mut u8, size: usize, align: usize) {
         if PRINT { println!("deallocate(ptr=0x{:010x} size={} align={})",
-                            ptr as uint, size, align);
+                            ptr as usize, size, align);
         }
 
         heap::deallocate(ptr, size, align);
     }
-    unsafe fn reallocate(ptr: *mut u8, old_size: uint, size: uint, align: uint) -> *mut u8 {
+    unsafe fn reallocate(ptr: *mut u8, old_size: usize, size: usize, align: usize) -> *mut u8 {
         if PRINT {
             println!("reallocate(ptr=0x{:010x} old_size={} size={} align={})",
-                     ptr as uint, old_size, size, align);
+                     ptr as usize, old_size, size, align);
         }
 
         let ret = heap::reallocate(ptr, old_size, size, align);
@@ -79,12 +79,12 @@ unsafe fn reallocate(ptr: *mut u8, old_size: uint, size: uint, align: uint) -> *
         if PRINT {
             println!("reallocate(ptr=0x{:010x} old_size={} size={} align={}) \
                       ret: 0x{:010x}",
-                     ptr as uint, old_size, size, align, ret as uint);
+                     ptr as usize, old_size, size, align, ret as usize);
         }
         ret
     }
 
-    fn idx_to_size(i: uint) -> uint { (i+1) * 10 }
+    fn idx_to_size(i: usize) -> usize { (i+1) * 10 }
 
     // Allocate pairs of rows that form a triangle shape.  (Hope is
     // that at least two rows will be allocated near each other, so
@@ -100,8 +100,8 @@ fn idx_to_size(i: uint) -> uint { (i+1) * 10 }
     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;
-            *p1.offset(j as int) = i as u8;
+            *p0.offset(j as isize) = i as u8;
+            *p1.offset(j as isize) = i as u8;
         }
     }
 
index 94fe3f1d9eaee5cf14c122c7e02ee9249c7befd0..e5d76c3e67abd5f6c76dfde5afc00b35f04f6863 100644 (file)
@@ -16,8 +16,8 @@
 
 mod rusti {
     extern "rust-intrinsic" {
-        pub fn pref_align_of<T>() -> uint;
-        pub fn min_align_of<T>() -> uint;
+        pub fn pref_align_of<T>() -> usize;
+        pub fn min_align_of<T>() -> usize;
     }
 }
 
@@ -38,14 +38,14 @@ struct Outer {
 
 #[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "aarch64"))]
 mod m {
-    pub fn align() -> uint { 4 }
-    pub fn size() -> uint { 8 }
+    pub fn align() -> usize { 4 }
+    pub fn size() -> usize { 8 }
 }
 
 #[cfg(target_arch = "x86_64")]
 mod m {
-    pub fn align() -> uint { 4 }
-    pub fn size() -> uint { 8 }
+    pub fn align() -> usize { 4 }
+    pub fn size() -> usize { 8 }
 }
 
 pub fn main() {
index 8b7434ed063453a28e5a9de7f37e9756d1ed36a8..bae95bcb50f50d2beee9c0422df10a11fc1c1748 100644 (file)
@@ -16,8 +16,8 @@
 
 mod rusti {
     extern "rust-intrinsic" {
-        pub fn pref_align_of<T>() -> uint;
-        pub fn min_align_of<T>() -> uint;
+        pub fn pref_align_of<T>() -> usize;
+        pub fn min_align_of<T>() -> usize;
     }
 }
 
@@ -44,14 +44,14 @@ struct Outer {
 mod m {
     #[cfg(target_arch = "x86")]
     pub mod m {
-        pub fn align() -> uint { 4 }
-        pub fn size() -> uint { 12 }
+        pub fn align() -> usize { 4 }
+        pub fn size() -> usize { 12 }
     }
 
     #[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))]
     pub mod m {
-        pub fn align() -> uint { 8 }
-        pub fn size() -> uint { 16 }
+        pub fn align() -> usize { 8 }
+        pub fn size() -> usize { 16 }
     }
 }
 
@@ -59,8 +59,8 @@ pub fn size() -> uint { 16 }
 mod m {
     #[cfg(target_arch = "x86_64")]
     pub mod m {
-        pub fn align() -> uint { 8 }
-        pub fn size() -> uint { 16 }
+        pub fn align() -> usize { 8 }
+        pub fn size() -> usize { 16 }
     }
 }
 
@@ -68,14 +68,14 @@ pub fn size() -> uint { 16 }
 mod m {
     #[cfg(target_arch = "x86")]
     pub mod m {
-        pub fn align() -> uint { 8 }
-        pub fn size() -> uint { 16 }
+        pub fn align() -> usize { 8 }
+        pub fn size() -> usize { 16 }
     }
 
     #[cfg(target_arch = "x86_64")]
     pub mod m {
-        pub fn align() -> uint { 8 }
-        pub fn size() -> uint { 16 }
+        pub fn align() -> usize { 8 }
+        pub fn size() -> usize { 16 }
     }
 }
 
@@ -83,8 +83,8 @@ pub fn size() -> uint { 16 }
 mod m {
     #[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
     pub mod m {
-        pub fn align() -> uint { 8 }
-        pub fn size() -> uint { 16 }
+        pub fn align() -> usize { 8 }
+        pub fn size() -> usize { 16 }
     }
 }
 
index f511db8db5a71278148f5b447434a793bfc57729..1071df84cd2bb957fa6216442dd806aa6d7a21b1 100644 (file)
@@ -13,7 +13,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct Point {x: int, y: int}
+struct Point {x: isize, y: isize}
 
 pub fn main() {
     let origin: Point = Point {x: 0, y: 0};
index eb3fe430c4b10f88d42b26d92b9297a49ff3458b..c61c387c7812f7b51e10a033ea01ae53b44c5e2b 100644 (file)
 // pretty-expanded FIXME #23616
 
 #[derive(Copy)]
-struct Point {x: int, y: int}
+struct Point {x: isize, y: isize}
 
 type rect = (Point, Point);
 
 fn fst(r: rect) -> Point { let (fst, _) = r; return fst; }
 fn snd(r: rect) -> Point { let (_, snd) = r; return snd; }
 
-fn f(r: rect, x1: int, y1: int, x2: int, y2: int) {
+fn f(r: rect, x1: isize, y1: isize, x2: isize, y2: isize) {
     assert_eq!(fst(r).x, x1);
     assert_eq!(fst(r).y, y1);
     assert_eq!(snd(r).x, x2);
@@ -32,7 +32,7 @@ pub fn main() {
     assert_eq!(snd(r).x, 11);
     assert_eq!(snd(r).y, 22);
     let r2 = r;
-    let x: int = fst(r2).x;
+    let x: isize = fst(r2).x;
     assert_eq!(x, 10);
     f(r, 10, 20, 11, 22);
     f(r2, 10, 20, 11, 22);
index 9be1884267d09df83350a7709e50752e011217f6..96b6b50237d73825ff6faadb72d596e0490ec2ac 100644 (file)
@@ -11,9 +11,9 @@
 // pretty-expanded FIXME #23616
 
 #[derive(Copy)]
-struct Rect {x: int, y: int, w: int, h: int}
+struct Rect {x: isize, y: isize, w: isize, h: isize}
 
-fn f(r: Rect, x: int, y: int, w: int, h: int) {
+fn f(r: Rect, x: isize, y: isize, w: isize, h: isize) {
     assert_eq!(r.x, x);
     assert_eq!(r.y, y);
     assert_eq!(r.w, w);
@@ -27,7 +27,7 @@ pub fn main() {
     assert_eq!(r.w, 100);
     assert_eq!(r.h, 200);
     let r2: Rect = r;
-    let x: int = r2.x;
+    let x: isize = r2.x;
     assert_eq!(x, 10);
     f(r, 10, 20, 100, 200);
     f(r2, 10, 20, 100, 200);
index 79cc4e47f5eb690d5c209c7e6e19816ea0a68d30..6b39cc196f1e6ba951c7eda79fa4ff1330dc23eb 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-enum t1 { a(int), b(uint), }
-struct T2 {x: t1, y: int}
-enum t3 { c(T2, uint), }
+enum t1 { a(isize), b(usize), }
+struct T2 {x: t1, y: isize}
+enum t3 { c(T2, usize), }
 
-fn m(input: t3) -> int {
+fn m(input: t3) -> isize {
     match input {
       t3::c(T2 {x: t1::a(m), ..}, _) => { return m; }
-      t3::c(T2 {x: t1::b(m), y: y}, z) => { return ((m + z) as int) + y; }
+      t3::c(T2 {x: t1::b(m), y: y}, z) => { return ((m + z) as isize) + y; }
     }
 }
 
index 2c92965ee7a6740a331708d6e1d77b61453ea5a5..1243d72af5efb4cd68ac6a3e73535adcb55c5488 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "reexport-should-still-link" as foo;
+extern crate reexport_should_still_link as foo;
 
 pub fn main() {
     foo::bar();
index 374d0d8d9b961d724db512750c8bd41ce3d8a8ff..3efd913cf543c935789d7a69a52dfc0723895fb5 100644 (file)
@@ -19,8 +19,8 @@
 use reexported_static_methods::Bort;
 
 pub fn main() {
-    assert_eq!(42, Foo::foo());
-    assert_eq!(84, Baz::bar());
+    assert_eq!(42_isize, Foo::foo());
+    assert_eq!(84_isize, Baz::bar());
     assert!(Boz::boz(1));
     assert_eq!("bort()".to_string(), Bort::bort());
 }
index c211d8d704d09fc184caf5b602155eabac4a7a1a..4839067e53d1fb5923b1d21dff479baf86a23265 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct Point {
-    x: int,
-    y: int
+    x: isize,
+    y: isize
 }
 
 struct Character {
     pos: Box<Point>,
 }
 
-fn get_x(x: &Character) -> &int {
+fn get_x(x: &Character) -> &isize {
     // interesting case because the scope of this
     // borrow of the unique pointer is in fact
     // larger than the fn itself
index a046ba456a6b06e9eb306a764986fca97bfb0ec3..3baf2fa2de5174a058ad8b07429f9bf69ffad71f 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn f(x: &int) -> &int {
+fn f(x: &isize) -> &isize {
     return &*x;
 }
 
index 56dd386ead1c19fc31cf2443d83894fa47477cdc..83a82041af937d9590b3c0bb7766b8b4aae0273e 100644 (file)
@@ -11,7 +11,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn foo(x: &uint) -> uint {
+fn foo(x: &usize) -> usize {
     *x
 }
 
index 1258dfe3306646a9c7d233b2ff83b219cbdb1627..7f3db86783060685bf1ec724533d321ac4a2e800 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo(x: &[int]) -> int {
+fn foo(x: &[isize]) -> isize {
     x[0]
 }
 
index dd42eb2717a000dee158a3a6f2d1fd018dd20912..adf88037d284161467f62a8414baf5d2be35f79e 100644 (file)
@@ -11,7 +11,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo(x: &[int]) -> int {
+fn foo(x: &[isize]) -> isize {
     x[0]
 }
 
index c0c985fa0d1dbc70afcc9247124e816410efe6e7..01a4e9c20ca5b693f906822ec8f6a63a32d7c50e 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn foo(x: &uint) -> uint {
+fn foo(x: &usize) -> usize {
     *x
 }
 
index 43cf6bd42ff8c4d9b5d8e7d4b923ba3f6832613a..269e30741f47a25f82ed4e89f73e7f0073b44491 100644 (file)
@@ -14,7 +14,7 @@
 
 fn produce_static<T>() -> &'static T { panic!(); }
 
-fn foo<T>(_x: &T) -> &uint { produce_static() }
+fn foo<T>(_x: &T) -> &usize { produce_static() }
 
 pub fn main() {
 }
index d0157788cc9a40787df2933d7bc805d355f17c3e..cc417219ee3df06ac15d927e0985b0efdef0af33 100644 (file)
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-trait SomeTrait { fn get(&self) -> int; }
+trait SomeTrait { fn get(&self) -> isize; }
 
-impl<'a> SomeTrait for &'a int {
-    fn get(&self) -> int {
+impl<'a> SomeTrait for &'a isize {
+    fn get(&self) -> isize {
         **self
     }
 }
@@ -29,7 +29,7 @@ fn make_object<'a,A:SomeTrait+'a>(v: A) -> Box<SomeTrait+'a> {
 }
 
 fn main() {
-    let i: int = 22;
+    let i: isize = 22;
     let obj = make_object(&i);
     assert_eq!(22, obj.get());
 }
index 8bd3bd4c0ddf53afb6e9904fab5f68af12ca0961..66d28f5afa17a2a32cf9a95be0dc05392c9fb622 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 enum ast<'a> {
-    num(uint),
+    num(usize),
     add(&'a ast<'a>, &'a ast<'a>)
 }
 
index 032ed068d5a298b868dcfc72170ac3727a07b5b3..4bd12863e2a3d5e9553f86ff6d951d1e8acbb99a 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 enum ast<'a> {
-    num(uint),
+    num(usize),
     add(&'a ast<'a>, &'a ast<'a>)
 }
 
index 0439cb81c47ed6d06b2c1b48fbc38838ca1abbcf..0cb70735dbac8c3a156b2ddd59ce39a2fbb81c5e 100644 (file)
@@ -22,9 +22,9 @@ struct A {
 }
 
 struct B {
-    v1: int,
-    v2: [int; 3],
-    v3: Vec<int> ,
+    v1: isize,
+    v2: [isize; 3],
+    v3: Vec<isize> ,
     v4: C,
     v5: Box<C>,
     v6: Option<C>
@@ -32,57 +32,57 @@ struct B {
 
 #[derive(Copy)]
 struct C {
-    f: int
+    f: isize
 }
 
-fn get_v1(a: &A) -> &int {
+fn get_v1(a: &A) -> &isize {
     // Region inferencer must deduce that &v < L2 < L1
     let foo = &a.value; // L1
     &foo.v1             // L2
 }
 
-fn get_v2(a: &A, i: uint) -> &int {
+fn get_v2(a: &A, i: usize) -> &isize {
     let foo = &a.value;
     &foo.v2[i]
 }
 
-fn get_v3(a: &A, i: uint) -> &int {
+fn get_v3(a: &A, i: usize) -> &isize {
     let foo = &a.value;
     &foo.v3[i]
 }
 
-fn get_v4(a: &A, _i: uint) -> &int {
+fn get_v4(a: &A, _i: usize) -> &isize {
     let foo = &a.value;
     &foo.v4.f
 }
 
-fn get_v5(a: &A, _i: uint) -> &int {
+fn get_v5(a: &A, _i: usize) -> &isize {
     let foo = &a.value;
     &foo.v5.f
 }
 
-fn get_v6_a(a: &A, _i: uint) -> &int {
+fn get_v6_a(a: &A, _i: usize) -> &isize {
     match a.value.v6 {
         Some(ref v) => &v.f,
         None => panic!()
     }
 }
 
-fn get_v6_b(a: &A, _i: uint) -> &int {
+fn get_v6_b(a: &A, _i: usize) -> &isize {
     match *a {
         A { value: B { v6: Some(ref v), .. } } => &v.f,
         _ => panic!()
     }
 }
 
-fn get_v6_c(a: &A, _i: uint) -> &int {
+fn get_v6_c(a: &A, _i: usize) -> &isize {
     match a {
         &A { value: B { v6: Some(ref v), .. } } => &v.f,
         _ => panic!()
     }
 }
 
-fn get_v5_ref(a: &A, _i: uint) -> &int {
+fn get_v5_ref(a: &A, _i: usize) -> &isize {
     match &a.value {
         &B {v5: box C {f: ref v}, ..} => v
     }
index 4652fed8a9dc709e140cd9fe5fe3a7bf549e433b..fd0d8121f5fc6df925ea96889bbc23f1c66fa639 100644 (file)
@@ -14,9 +14,9 @@
 
 // pretty-expanded FIXME #23616
 
-fn subslice1<'r>(v: &'r [uint]) -> &'r [uint] { v }
+fn subslice1<'r>(v: &'r [usize]) -> &'r [usize] { v }
 
-fn both<'r>(v: &'r [uint]) -> &'r [uint] {
+fn both<'r>(v: &'r [usize]) -> &'r [usize] {
     subslice1(subslice1(v))
 }
 
index 4d3fed5031fe47ab8779af98b4e791944798a069..1b869e462b0ff93e654daaf11278491dbf06a5d9 100644 (file)
@@ -13,7 +13,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct Foo(int);
+struct Foo(isize);
 pub fn main() {
     // Here the lifetime of the `&` should be at least the
     // block, since a ref binding is created to the interior.
index 2dc4071830779d31722a1c0486179705ee6f739d..9aed91551243469c3b8e49c1ca82dac1e38b3091 100644 (file)
@@ -28,7 +28,7 @@ pub trait Decoder<'v> {
 }
 
 pub trait Decodable<'v, D: Decoder<'v>>
-    : marker::PhantomFn<(), &'v int>
+    : marker::PhantomFn<(), &'v isize>
 {
     fn decode(d: &mut D) -> Self;
 }
index c87c79ca24edaab83cd7ac4aba3063342ff95493..738f5dbb7b9adf75ba85caf6180e3b350ebb6053 100644 (file)
 #![feature(box_syntax)]
 
 trait Trait<'a> {
-    fn long(&'a self) -> int;
-    fn short<'b>(&'b self) -> int;
+    fn long(&'a self) -> isize;
+    fn short<'b>(&'b self) -> isize;
 }
 
-fn poly_invoke<'c, T: Trait<'c>>(x: &'c T) -> (int, int) {
+fn poly_invoke<'c, T: Trait<'c>>(x: &'c T) -> (isize, isize) {
     let l = x.long();
     let s = x.short();
     (l,s)
 }
 
-fn object_invoke1<'d>(x: &'d Trait<'d>) -> (int, int) {
+fn object_invoke1<'d>(x: &'d Trait<'d>) -> (isize, isize) {
     let l = x.long();
     let s = x.short();
     (l,s)
@@ -37,7 +37,7 @@ struct Struct1<'e> {
     f: &'e (Trait<'e>+'e)
 }
 
-fn field_invoke1<'f, 'g>(x: &'g Struct1<'f>) -> (int,int) {
+fn field_invoke1<'f, 'g>(x: &'g Struct1<'f>) -> (isize,isize) {
     let l = x.f.long();
     let s = x.f.short();
     (l,s)
@@ -47,11 +47,11 @@ struct Struct2<'h, 'i> {
     f: &'h (Trait<'i>+'h)
 }
 
-fn object_invoke2<'j, 'k>(x: &'k Trait<'j>) -> int {
+fn object_invoke2<'j, 'k>(x: &'k Trait<'j>) -> isize {
     x.short()
 }
 
-fn field_invoke2<'l, 'm, 'n>(x: &'n Struct2<'l,'m>) -> int {
+fn field_invoke2<'l, 'm, 'n>(x: &'n Struct2<'l,'m>) -> isize {
     x.f.short()
 }
 
@@ -71,12 +71,12 @@ fn make_ref<'r, T:RefMakerTrait<'r>>(t:T) -> &'r T {
     RefMakerTrait::mk(t)
 }
 
-impl<'s> Trait<'s> for (int,int) {
-    fn long(&'s self) -> int {
+impl<'s> Trait<'s> for (isize,isize) {
+    fn long(&'s self) -> isize {
         let &(x,_) = self;
         x
     }
-    fn short<'b>(&'b self) -> int {
+    fn short<'b>(&'b self) -> isize {
         let &(_,y) = self;
         y
     }
@@ -84,18 +84,18 @@ fn short<'b>(&'b self) -> int {
 
 impl<'t> MakerTrait for Box<Trait<'t>+'static> {
     fn mk() -> Box<Trait<'t>+'static> {
-        let tup: Box<(int, int)> = box() (4,5);
+        let tup: Box<(isize, isize)> = box() (4,5);
         tup as Box<Trait>
     }
 }
 
 enum List<'l> {
-    Cons(int, &'l List<'l>),
+    Cons(isize, &'l List<'l>),
     Null
 }
 
 impl<'l> List<'l> {
-    fn car<'m>(&'m self) -> int {
+    fn car<'m>(&'m self) -> isize {
         match self {
             &List::Cons(car, _) => car,
             &List::Null => panic!(),
index 360457cf3f1d6c9f30510dfce831570218c1af3a..b1f9ff4de0f411c7410ac395d353132851c1dda8 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait GetRef<'a> {
-    fn get(&self) -> &'a int;
+    fn get(&self) -> &'a isize;
 }
 
 #[derive(Copy)]
 struct Box<'a> {
-    t: &'a int
+    t: &'a isize
 }
 
 impl<'a> GetRef<'a> for Box<'a> {
-    fn get(&self) -> &'a int {
+    fn get(&self) -> &'a isize {
         self.t
     }
 }
 
 impl<'a> Box<'a> {
-    fn add<'b,G:GetRef<'b>>(&self, g2: G) -> int {
+    fn add<'b,G:GetRef<'b>>(&self, g2: G) -> isize {
         *self.t + *g2.get()
     }
 }
index 924f9b8f70b90cd658d19f98a60062dc835c7349..9c2d2726a73502e8ea8f8d8d4c4e3ef8bc506392 100644 (file)
@@ -29,7 +29,7 @@ fn get(&self) -> &'a T {
     }
 }
 
-fn add<'a,G:GetRef<'a, int>>(g1: G, g2: G) -> int {
+fn add<'a,G:GetRef<'a, isize>>(g1: G, g2: G) -> isize {
     *g1.get() + *g2.get()
 }
 
index c31d4d45fb92f940b3ed3b9debfd078cec57b0b3..830fb7127b9b4a59bb09568bd6410376eabe2720 100644 (file)
@@ -28,7 +28,7 @@ fn get(&self) -> T {
     }
 }
 
-fn add<'a,G:Get<&'a int>>(g1: G, g2: G) -> int {
+fn add<'a,G:Get<&'a isize>>(g1: G, g2: G) -> isize {
     *g1.get() + *g2.get()
 }
 
index cd32c426527e2b3628d8bbb56d118dfc24a202c8..3e2fec717f9976d2c73a46421871565ee9265053 100644 (file)
@@ -13,8 +13,8 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn foo(x: &uint) -> &uint { x }
-fn bar(x: &uint) -> uint { *x }
+fn foo(x: &usize) -> &usize { x }
+fn bar(x: &usize) -> usize { *x }
 
 pub fn main() {
     let p: Box<_> = box 3;
index ee4bbcebb7800ea3f7457080b4ef885c1e2ab676..7ad3c3f4e1713fcc2701547ce05f4caf1cbc5a39 100644 (file)
@@ -13,7 +13,7 @@
 // pretty-expanded FIXME #23616
 
 struct Foo {
-    f: uint
+    f: usize
 }
 
 impl Foo {
index b8b5f6fb05f2c78db059593e1a1d532f0a985df5..7f2fc11cb8e0e7f765958ac3bd20771c9f1c114b 100644 (file)
 // that `x` is in.
 // pretty-expanded FIXME #23616
 
-fn has_same_region(f: Box<for<'a> FnMut(&'a int, Box<FnMut(&'a int)>)>) {
+fn has_same_region(f: Box<for<'a> FnMut(&'a isize, Box<FnMut(&'a isize)>)>) {
     // `f` should be the type that `wants_same_region` wants, but
     // right now the compiler complains that it isn't.
     wants_same_region(f);
 }
 
-fn wants_same_region(_f: Box<for<'b> FnMut(&'b int, Box<FnMut(&'b int)>)>) {
+fn wants_same_region(_f: Box<for<'b> FnMut(&'b isize, Box<FnMut(&'b isize)>)>) {
 }
 
 pub fn main() {
index d9079dfe3f599c27ddf889e8c6ec726daae5bf78..e5b652c306f4df744b91e3cb8d679bb209bd97d8 100644 (file)
 // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
 
 // Should pass region checking.
-fn ok(f: Box<FnMut(&uint)>) {
-    // Here, g is a function that can accept a uint pointer with
-    // lifetime r, and f is a function that can accept a uint pointer
+fn ok(f: Box<FnMut(&usize)>) {
+    // Here, g is a function that can accept a usize pointer with
+    // lifetime r, and f is a function that can accept a usize pointer
     // with any lifetime.  The assignment g = f should be OK (i.e.,
     // f's type should be a subtype of g's type), because f can be
     // used in any context that expects g's type.  But this currently
     // fails.
-    let mut g: Box<for<'r> FnMut(&'r uint)> = Box::new(|x| { });
+    let mut g: Box<for<'r> FnMut(&'r usize)> = Box::new(|x| { });
     g = f;
 }
 
 // This version is the same as above, except that here, g's type is
 // inferred.
-fn ok_inferred(f: Box<FnMut(&uint)>) {
-    let mut g: Box<for<'r> FnMut(&'r uint)> = Box::new(|_| {});
+fn ok_inferred(f: Box<FnMut(&usize)>) {
+    let mut g: Box<for<'r> FnMut(&'r usize)> = Box::new(|_| {});
     g = f;
 }
 
index acbe091a6a4560bea130e62cfc030f605da312d6..3289da3cfd87ea814d20e766920fb6ec0c4ff0a5 100644 (file)
@@ -13,9 +13,9 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct Point {x: int, y: int}
+struct Point {x: isize, y: isize}
 
-fn x_coord(p: &Point) -> &int {
+fn x_coord(p: &Point) -> &isize {
     return &p.x;
 }
 
index cc1bf05db5f59245118780a6894ccba093bac88b..7e6767b0de422c0c8c46f0c1ee321f1be875f0df 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn takes_two(x: &int, y: &int) -> int { *x + *y }
+fn takes_two(x: &isize, y: &isize) -> isize { *x + *y }
 
-fn with<T, F>(f: F) -> T where F: FnOnce(&int) -> T {
+fn with<T, F>(f: F) -> T where F: FnOnce(&isize) -> T {
     f(&20)
 }
 
-fn has_one<'a>(x: &'a int) -> int {
+fn has_one<'a>(x: &'a isize) -> isize {
     with(|y| takes_two(x, y))
 }
 
index c1044b59af26f09b4fbe97335fc5cfe7bbde41bb..bc752a1d504e3b32010fc110679f0094075ef672 100644 (file)
@@ -10,9 +10,9 @@
 
 // pretty-expanded FIXME #23616
 
-fn takes_two(x: &int, y: &int) -> int { *x + *y }
+fn takes_two(x: &isize, y: &isize) -> isize { *x + *y }
 
-fn has_two<'a,'b>(x: &'a int, y: &'b int) -> int {
+fn has_two<'a,'b>(x: &'a isize, y: &'b isize) -> isize {
     takes_two(x, y)
 }
 
index 11c3ab111cf5a72cb1a7406fa22e3de34adb331b..73cfbcddd9aa76800992ab6a78020da6588f4e17 100644 (file)
 // pretty-expanded FIXME #23616
 
 struct boxed_int<'a> {
-    f: &'a int,
+    f: &'a isize,
 }
 
-fn max<'r>(bi: &'r boxed_int, f: &'r int) -> int {
+fn max<'r>(bi: &'r boxed_int, f: &'r isize) -> isize {
     if *bi.f > *f {*bi.f} else {*f}
 }
 
-fn with(bi: &boxed_int) -> int {
+fn with(bi: &boxed_int) -> isize {
     let i = 22;
     max(bi, &i)
 }
index 6b143908f052839f2d865e477cf7ada6eee925f1..2349b6c3bc14602ad5a3bf98b71742300f40ce8e 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn foo<'a,'b>(x: &'a &'b mut int) -> &'a int {
-    let y = &*x; // should be inferred to have type &'a &'b mut int...
+fn foo<'a,'b>(x: &'a &'b mut isize) -> &'a isize {
+    let y = &*x; // should be inferred to have type &'a &'b mut isize...
 
-    // ...because if we inferred, say, &'x &'b mut int where 'x <= 'a,
+    // ...because if we inferred, say, &'x &'b mut isize where 'x <= 'a,
     // this reborrow would be illegal:
     &**y
 }
index 586c9ab3a72efb8d308ba97453ba3ab8a0afad7a..a8418f967fdb3d7307ee6571bf60d4d3aaf342a3 100644 (file)
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 
-// check that the &int here does not cause us to think that `foo`
+// check that the &isize here does not cause us to think that `foo`
 // contains region pointers
 // pretty-expanded FIXME #23616
 
-struct foo(Box<FnMut(&int)+'static>);
+struct foo(Box<FnMut(&isize)+'static>);
 
 fn take_foo<T:'static>(x: T) {}
 
index 391501014b3ae13a1c1bceb93ff53a4ded81ca53..403dfbf655f3b1ad6c9108b0f1a2454f232117ce 100644 (file)
@@ -14,9 +14,9 @@
 
 // pretty-expanded FIXME #23616
 
-static i: uint = 3;
+static i: usize = 3;
 fn foo<F:FnOnce()+'static>(_: F) {}
-fn read(_: uint) { }
+fn read(_: usize) { }
 pub fn main() {
     let x = &i;
     foo(move|| {
index 99a4f5647bb44c75078a898f3ed544fca941d4f7..a2c07d27288d23f074ddd868ad48075f7f4f825e 100644 (file)
 
 pub fn main() {
     fn explicit() {
-        fn test<F>(_x: Option<Box<F>>) where F: FnMut(Box<for<'a> FnMut(&'a int)>) {}
-        test(Some(box |_f: Box<for<'a> FnMut(&'a int)>| {}));
+        fn test<F>(_x: Option<Box<F>>) where F: FnMut(Box<for<'a> FnMut(&'a isize)>) {}
+        test(Some(box |_f: Box<for<'a> FnMut(&'a isize)>| {}));
     }
 
     // The code below is shorthand for the code above (and more likely
     // to represent what one encounters in practice).
     fn implicit() {
-        fn test<F>(_x: Option<Box<F>>) where F: FnMut(Box<        FnMut(&   int)>) {}
-        test(Some(box |_f: Box<        FnMut(&   int)>| {}));
+        fn test<F>(_x: Option<Box<F>>) where F: FnMut(Box<        FnMut(&   isize)>) {}
+        test(Some(box |_f: Box<        FnMut(&   isize)>| {}));
     }
 
     explicit();
index 077d4f5a25e3b43cb8bbab2170a3f9560be24a8a..451c745358ae6dea08aa8f4de2a07b7c17e93f39 100644 (file)
@@ -25,5 +25,5 @@ enum E {V=1, A=0}
         static C: E = E::V;
     }
 
-    f::<int>(&mut None);
+    f::<isize>(&mut None);
 }
index 0b5ab35f7fe8621b09ecf80402abd49dc87ff46b..9e8ce6160487ea16cfc47feef15ff3384bbaf04f 100644 (file)
@@ -15,7 +15,7 @@
 
 #![allow(dead_code)]
 
-fn with<'a, F>(_: F) where F: FnOnce(&'a Vec<int>) -> &'a Vec<int> { }
+fn with<'a, F>(_: F) where F: FnOnce(&'a Vec<isize>) -> &'a Vec<isize> { }
 
 fn foo() {
     with(|&ref ints| ints);
index f2e0837c6ea0e8429d1949d9eabc414cf03cdc9d..c6bacac63e068c34a7704de8b154578ac038b008 100644 (file)
@@ -56,7 +56,7 @@ struct TypeContext<'tcx, 'ast> {
     type_table: HashMap<NodeId, Type<'tcx>>,
 
     ast_arena: &'ast AstArena<'ast>,
-    ast_counter: uint,
+    ast_counter: usize,
 }
 
 impl<'tcx,'ast> TypeContext<'tcx, 'ast> {
@@ -96,7 +96,7 @@ fn ast(&mut self, a: AstKind<'ast>) -> Ast<'ast> {
 
 #[derive(Copy, PartialEq, Eq, Hash)]
 struct NodeId {
-    id: uint
+    id: usize
 }
 
 type Ast<'ast> = &'ast AstStructure<'ast>;
@@ -110,7 +110,7 @@ struct AstStructure<'ast> {
 #[derive(Copy)]
 enum AstKind<'ast> {
     ExprInt,
-    ExprVar(uint),
+    ExprVar(usize),
     ExprLambda(Ast<'ast>),
 }
 
index b6ba7d979ac670e1a9e13df99c8711dc0fdc8946..b67612c94b00955ab2c74c33ff71714fae54ebe3 100644 (file)
@@ -27,7 +27,7 @@ struct Fcx<'a> {
 }
 
 struct Ccx {
-    x: int
+    x: isize
 }
 
 fn alloc<'a>(_bcx : &'a arena) -> &'a Bcx<'a> {
index c2a8f7e66c654cad3a96a30f489b0d23f2adeef6..ae55b97dc932da5f2b80ff2a7e5ad0fa83a3d0e9 100644 (file)
 // pretty-expanded FIXME #23616
 
 enum roption<'a> {
-    a, b(&'a uint)
+    a, b(&'a usize)
 }
 
-fn mk(cond: bool, ptr: &uint) -> roption {
+fn mk(cond: bool, ptr: &usize) -> roption {
     if cond {roption::a} else {roption::b(ptr)}
 }
 
index c7ee3213f37417c447cf4f913b635b617d3af24f..5002fcce96b96ca0a3786d3b7c051c85c1edfffd 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn region_identity(x: &uint) -> &uint { x }
+fn region_identity(x: &usize) -> &usize { x }
 
 fn apply<T, F>(t: T, f: F) -> T where F: FnOnce(T) -> T { f(t) }
 
-fn parameterized(x: &uint) -> uint {
+fn parameterized(x: &usize) -> usize {
     let z = apply(x, ({|y|
         region_identity(y)
     }));
index 89a9d3f1290a9117b2200da015d6a30ba8e82195..b29cc8f90368ab47f73dc49e04a705288779f404 100644 (file)
@@ -14,7 +14,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo(x: &int) {
+fn foo(x: &isize) {
     let a = 1;
     let mut z = x;
     z = &a;
index 02c59dde1d6b3a972e3ca5a69d2c74cf7eeafdd0..58d4f556a79cb3261589e7546b0f0b9ab9301929 100644 (file)
@@ -14,7 +14,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo(x: &int) {
+fn foo(x: &isize) {
     let a = 1;
     match x {
         mut z => {
index 310902d4d0a8511eff0ea6497ee6f793a457cb44..a36c1b30ead0bef62cabc8b16492aa8bcd145a40 100644 (file)
@@ -23,7 +23,7 @@
 #![feature(box_syntax)]
 
 struct Ctxt<'tcx> {
-    x: &'tcx Vec<int>
+    x: &'tcx Vec<isize>
 }
 
 struct Foo<'a,'tcx:'a> {
@@ -31,7 +31,7 @@ struct Foo<'a,'tcx:'a> {
 }
 
 impl<'a,'tcx> Foo<'a,'tcx> {
-    fn bother(&mut self) -> int {
+    fn bother(&mut self) -> isize {
         // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
         self.elaborate_bounds(Box::new(|this| {
             // (*) Here: type of `this` is `&'f0 Foo<&'f1, '_2>`,
@@ -50,14 +50,14 @@ fn bother(&mut self) -> int {
         }))
     }
 
-    fn foo(&mut self) -> int {
+    fn foo(&mut self) -> isize {
         22
     }
 
     fn elaborate_bounds(
         &mut self,
-        mut mk_cand: Box<for<'b> FnMut(&mut Foo<'b, 'tcx>) -> int>)
-        -> int
+        mut mk_cand: Box<for<'b> FnMut(&mut Foo<'b, 'tcx>) -> isize>)
+        -> isize
     {
         mk_cand(self)
     }
index b30b3cfa47695f6049ce054486881086d3919a66..26e3fbfab9e6157bd4094106fb968af882e64385 100644 (file)
@@ -9,15 +9,15 @@
 // except according to those terms.
 
 struct Clam<'a> {
-    chowder: &'a int
+    chowder: &'a isize
 }
 
 trait get_chowder<'a> {
-    fn get_chowder(&self) -> &'a int;
+    fn get_chowder(&self) -> &'a isize;
 }
 
 impl<'a> get_chowder<'a> for Clam<'a> {
-    fn get_chowder(&self) -> &'a int { return self.chowder; }
+    fn get_chowder(&self) -> &'a isize { return self.chowder; }
 }
 
 pub fn main() {
index ab0b4acc7698ada6f8500b47068b04a6e86ac792..9ff20e93a0dfcc64451a225d2c35b585e747ba6b 100644 (file)
@@ -9,13 +9,13 @@
 // except according to those terms.
 
 enum int_wrapper<'a> {
-    int_wrapper_ctor(&'a int)
+    int_wrapper_ctor(&'a isize)
 }
 
 pub fn main() {
     let x = 3;
     let y = int_wrapper::int_wrapper_ctor(&x);
-    let mut z : &int;
+    let mut z : &isize;
     match y {
         int_wrapper::int_wrapper_ctor(zz) => { z = zz; }
     }
index d540605180a4eea87041576a2ee7ff6659b8e66f..f4fe73131fe3cecbef59f2ebbaf91cb5fba4440d 100644 (file)
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 pub fn main() {
-    let mut x: int = 3;
-    let y: &mut int = &mut x;
+    let mut x: isize = 3;
+    let y: &mut isize = &mut x;
     *y = 5;
     println!("{}", *y);
 }
index 1b174580b0e14fd32bd912a006919a49daf5a06b..5e5be1c25877d51db9e2930b5f3b6858c033b44f 100644 (file)
@@ -17,7 +17,7 @@
 // pretty-expanded FIXME #23616
 
 struct Contravariant<'a> {
-    f: &'a int
+    f: &'a isize
 }
 
 fn use_<'a>(c: Contravariant<'a>) {
@@ -28,7 +28,7 @@ fn use_<'a>(c: Contravariant<'a>) {
     // if 'call <= 'a, which is true, so no error.
     collapse(&x, c);
 
-    fn collapse<'b>(x: &'b int, c: Contravariant<'b>) { }
+    fn collapse<'b>(x: &'b isize, c: Contravariant<'b>) { }
 }
 
 pub fn main() {}
index 4021048232724e94d6c9ab99741f995db9471901..02562781373a88e0da179a617ca0442317eb4fa0 100644 (file)
@@ -20,7 +20,7 @@
 // pretty-expanded FIXME #23616
 
 struct Covariant<'a> {
-    f: extern "Rust" fn(&'a int)
+    f: extern "Rust" fn(&'a isize)
 }
 
 fn use_<'a>(c: Covariant<'a>) {
index 12cf0c0de45b446e389d97cffc47fd75a50804c8..5a4475ae947b6d943d93c36554538f489c2e29f2 100644 (file)
@@ -10,8 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
-static FOO: [int; 4] = [32; 4];
-static BAR: [int; 4] = [32, 32, 32, 32];
+static FOO: [isize; 4] = [32; 4];
+static BAR: [isize; 4] = [32, 32, 32, 32];
 
 pub fn main() {
     assert!(FOO == BAR);
index 39b89bb3e4e94e84010a84dadeafaa85dd08e112..bad5b83b5484c0176dfa4df109a5ff49f9f5d97a 100644 (file)
@@ -10,6 +10,6 @@
 
 // pretty-expanded FIXME #23616
 
-const foo: int = 4 >> 1;
+const foo: isize = 4 >> 1;
 enum bs { thing = foo }
-pub fn main() { assert!((bs::thing as int == foo)); }
+pub fn main() { assert!((bs::thing as isize == foo)); }
index abc33e9f2e64cb49186aae72b34c8ae1bfb63e82..ba63c2db7cf59052e690bf1f6fc53c91d067d15e 100644 (file)
@@ -14,7 +14,7 @@
 
 #[derive(Debug)]
 struct r<'a> {
-    i: &'a Cell<int>,
+    i: &'a Cell<isize>,
 }
 
 #[unsafe_destructor]
@@ -24,7 +24,7 @@ fn drop(&mut self) {
     }
 }
 
-fn r(i: &Cell<int>) -> r {
+fn r(i: &Cell<isize>) -> r {
     r {
         i: i
     }
index 71bf6cc626153d38e962626512f59fd66a4c9c96..229ceba08b0ff3730be40d6134f214796717cdbe 100644 (file)
@@ -13,7 +13,7 @@
 use std::cell::Cell;
 
 struct shrinky_pointer<'a> {
-  i: &'a Cell<int>,
+  i: &'a Cell<isize>,
 }
 
 #[unsafe_destructor]
@@ -24,10 +24,10 @@ fn drop(&mut self) {
 }
 
 impl<'a> shrinky_pointer<'a> {
-    pub fn look_at(&self) -> int { return self.i.get(); }
+    pub fn look_at(&self) -> isize { return self.i.get(); }
 }
 
-fn shrinky_pointer(i: &Cell<int>) -> shrinky_pointer {
+fn shrinky_pointer(i: &Cell<isize>) -> shrinky_pointer {
     shrinky_pointer {
         i: i
     }
index 14b398b3d9a64dff9796ed2d9d9ea936f6317c2f..7d4d0218112270cbdd087a60eeced047bdfcdcf5 100644 (file)
@@ -13,7 +13,7 @@
 
 fn my_err(s: String) -> ! { println!("{}", s); panic!(); }
 
-fn okay(i: uint) -> int {
+fn okay(i: usize) -> isize {
     if i == 3 {
         my_err("I don't like three".to_string());
     } else {
index ea0de67572ded25b70c000e7b7c42fba8688c4f4..032a4b662cb1a3dbb4c640ae0060067a8e0cd03b 100644 (file)
@@ -16,4 +16,4 @@ enum option<T> { none, some(T), }
 
 fn f<T>() -> option<T> { return option::none; }
 
-pub fn main() { f::<int>(); }
+pub fn main() { f::<isize>(); }
index 0a87e76ef4e077c629110d92723bfd5b87995b48..4395f6fcb4b7cfc36431026e56efa4a839666c8b 100644 (file)
 // not the surrounding function.
 // pretty-expanded FIXME #23616
 
-static mut calls: uint = 0;
+static mut calls: usize = 0;
 
 fn surrounding() {
-    let return_works = |n: int| {
+    let return_works = |n: isize| {
         unsafe { calls += 1 }
 
         if n >= 0 { return; }
@@ -25,7 +25,7 @@ fn surrounding() {
     return_works(10);
     return_works(20);
 
-    let return_works_proc = |n: int| {
+    let return_works_proc = |n: isize| {
         unsafe { calls += 1 }
 
         if n >= 0 { return; }
index 75f66d5bf26776097cbbab863bdc3ada1bba3ce4..c5b59e6c6e071f08f93fc1a4bca8ecfe9ca88d81 100644 (file)
@@ -20,7 +20,7 @@
 use std::thunk::Thunk;
 
 #[start]
-fn start(argc: int, argv: *const *const u8) -> int {
+fn start(argc: isize, argv: *const *const u8) -> isize {
     if argc > 1 {
         unsafe {
             match **argv.offset(1) {
@@ -36,8 +36,8 @@ fn start(argc: int, argv: *const *const u8) -> int {
     }
 
     let args = unsafe {
-        (0..argc as uint).map(|i| {
-            let ptr = *argv.offset(i as int) as *const _;
+        (0..argc as usize).map(|i| {
+            let ptr = *argv.offset(i as isize) as *const _;
             ffi::c_str_to_bytes(&ptr).to_vec()
         }).collect::<Vec<_>>()
     };
index 0f7fb31fbae1b59972773f063f18ef5dd6a6f369..bc379f1a76f7f382b5d9517bc34e0f9c329b42ad 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// exec-env:RUST_LOG=rust-log-filter/foo
+// exec-env:RUST_LOG=rust_log_filter/foo
 
 // pretty-expanded FIXME #23616
 
index 1b3020b8dbe9b399620567174d81f93354061717..6eb9600cf8b5393faa3e9641ac099106390205f3 100644 (file)
@@ -18,7 +18,7 @@
 fn main() {
     let args: Vec<String> = env::args().collect();
     if args.len() > 1 && args[1] == "segfault" {
-        unsafe { *(0 as *mut int) = 1 }; // trigger a segfault
+        unsafe { *(0 as *mut isize) = 1 }; // trigger a segfault
     } else {
         let segfault = Command::new(&args[0]).arg("segfault").output().unwrap();
         assert!(!segfault.status.success());
index 75a68677e5203103e0efd5010f0d8fdd631088a8..c32773aa88c2aaf5a91eee4500777479eabeb187 100644 (file)
@@ -34,7 +34,7 @@ trait Bar<X> {
     fn dummy(&self, x: X) { }
 }
 
-impl Bar<int> for Box<Baz<int>> {
+impl Bar<isize> for Box<Baz<isize>> {
     fn bar(_x: Self, _y: &Self, _z: Box<Self>) -> Self {
         box Baz { f: 42 }
     }
@@ -42,7 +42,7 @@ fn bar(_x: Self, _y: &Self, _z: Box<Self>) -> Self {
 
 fn main() {
     let _: Foo = Foo::foo(Foo, &Foo, box Foo);
-    let _: Box<Baz<int>> = Bar::bar(box Baz { f: 42 },
+    let _: Box<Baz<isize>> = Bar::bar(box Baz { f: 42 },
                                     &box Baz { f: 42 },
                                     box box Baz { f: 42 });
 }
index 64d49215f22a7654418c550e6592132d9e65e32d..f8502137be129992733aa8842d4dae7b2f7f3360 100644 (file)
@@ -14,7 +14,7 @@
 #![feature(box_syntax)]
 
 struct X {
-    a: int
+    a: isize
 }
 
 trait Changer : Sized {
@@ -28,11 +28,11 @@ fn change_again(mut self: Box<Self>) -> Box<Self> {
         self
     }
 
-    fn set_to(&mut self, a: int);
+    fn set_to(&mut self, a: isize);
 }
 
 impl Changer for X {
-    fn set_to(&mut self, a: int) {
+    fn set_to(&mut self, a: isize) {
         self.a = a;
     }
 }
index 69cad7ab3dd4428d4f633cf2a795f01832be5c17..fa7b21a26c542889fe13ba8b7501c1324b18bc49 100644 (file)
@@ -15,7 +15,7 @@
 
 #[derive(Copy)]
 struct Value {
-    n: int
+    n: isize
 }
 
 impl Value {
index 6621de0d8beefc0b1f27f71c86e6247f57471135..5de1686ef9d8dc419653170fce36c6e0d9baf6f8 100644 (file)
@@ -13,7 +13,7 @@
 mod a {
     pub mod b {
         pub mod a {
-            pub fn foo() -> int { return 1; }
+            pub fn foo() -> isize { return 1; }
         }
     }
 }
index ea2bec8c86126c79fcbd83393b4d8f7cb3f71200..ac810606a93285eb0ea953c6b856799d8a93bac8 100644 (file)
@@ -15,7 +15,7 @@ trait MyTrait {
 }
 
 struct S {
-    x: int
+    x: isize
 }
 
 impl MyTrait for S {
index 47c3766797a106f8df5de4ae0df8ce3074e21285..2c897c48a33c9da89e53d5dca7c659f8a5b4477b 100644 (file)
 use std::sync::mpsc::channel;
 
 struct test {
-  f: int,
+  f: isize,
 }
 
 impl Drop for test {
     fn drop(&mut self) {}
 }
 
-fn test(f: int) -> test {
+fn test(f: isize) -> test {
     test {
         f: f
     }
index d109f7abde44abc2fac4767f46cdbcedbb842f46..16a695f08fe6e463d625579e104b9ec80336334d 100644 (file)
@@ -20,7 +20,7 @@
 type SendStr = Cow<'static, str>;
 
 pub fn main() {
-    let mut map: HashMap<SendStr, uint> = HashMap::new();
+    let mut map: HashMap<SendStr, usize> = HashMap::new();
     assert!(map.insert("foo".into_cow(), 42).is_none());
     assert!(map.insert("foo".to_string().into_cow(), 42).is_some());
     assert!(map.insert("foo".into_cow(), 42).is_some());
index 07dd54433480c9e5d6ef89720a43bf4035d696d3..d56657ee4d5170e64b359d6f386987355da08ac4 100644 (file)
@@ -20,7 +20,7 @@
 type SendStr = Cow<'static, str>;
 
 pub fn main() {
-    let mut map: BTreeMap<SendStr, uint> = BTreeMap::new();
+    let mut map: BTreeMap<SendStr, usize> = BTreeMap::new();
     assert!(map.insert("foo".into_cow(), 42).is_none());
     assert!(map.insert("foo".to_string().into_cow(), 42).is_some());
     assert!(map.insert("foo".into_cow(), 42).is_some());
index 993ae2a43fb6927861e6b04ec21e34a7276bd92e..4fb1c32952f8ecea44a407ce288ad6fdeb55749e 100644 (file)
 use std::sync::mpsc::channel;
 
 struct foo {
-  i: int,
+  i: isize,
   j: char,
 }
 
-fn foo(i:int, j: char) -> foo {
+fn foo(i:isize, j: char) -> foo {
     foo {
         i: i,
         j: j
index 5f23b72edb7f893687461fffed78a2eab18a5898..59b92ec6a48daa26b9dbc11813728f71a7964653 100644 (file)
@@ -11,7 +11,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn test<F>(f: F) -> uint where F: FnOnce(uint) -> uint {
+fn test<F>(f: F) -> usize where F: FnOnce(usize) -> usize {
     return f(22);
 }
 
index 264ee5f55b9771814b3907724d1d0209f3f85a1c..63ffa552405bea33680bcc7195ce5f5367217ff8 100644 (file)
 
 pub fn main() { test05(); }
 
-fn test05_start<F:FnOnce(int)>(f: F) {
+fn test05_start<F:FnOnce(isize)>(f: F) {
     f(22);
 }
 
 fn test05() {
     let three: Box<_> = box 3;
-    let fn_to_send = move|n:int| {
+    let fn_to_send = move|n:isize| {
         println!("{}", *three + n); // will copy x into the closure
         assert_eq!(*three, 3);
     };
index 07393d83e67b660ed54a532011fc72eaa042109c..6a92f32c0b314c29b08db88bebd2b5aa4e3c2cae 100644 (file)
 extern crate sepcomp_cci_lib;
 use sepcomp_cci_lib::{cci_fn, CCI_STATIC};
 
-fn call1() -> uint {
+fn call1() -> usize {
     cci_fn() + CCI_STATIC
 }
 
 mod a {
     use sepcomp_cci_lib::{cci_fn, CCI_STATIC};
-    pub fn call2() -> uint {
+    pub fn call2() -> usize {
         cci_fn() + CCI_STATIC
     }
 }
 
 mod b {
     use sepcomp_cci_lib::{cci_fn, CCI_STATIC};
-    pub fn call3() -> uint {
+    pub fn call3() -> usize {
         cci_fn() + CCI_STATIC
     }
 }
index fc85fc223a467203fdd4913d8556b5b1c8855cf2..f91c3d1ff3775c9cdeebdd9a712a0c87ce36b492 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-#[link(name = "sepcomp-extern-lib")]
+#[link(name = "sepcomp_extern_lib")]
 extern {
     #[allow(ctypes)]
-    fn foo() -> uint;
+    fn foo() -> usize;
 }
 
-fn call1() -> uint {
+fn call1() -> usize {
     unsafe { foo() }
 }
 
 mod a {
-    pub fn call2() -> uint {
+    pub fn call2() -> usize {
         unsafe { ::foo() }
     }
 }
 
 mod b {
-    pub fn call3() -> uint {
+    pub fn call3() -> usize {
         unsafe { ::foo() }
     }
 }
index 7998841322925e4949ea7fd0f080def80e4d63f4..2e510082e2773e54f902dfbd4e18afe0347c7d5a 100644 (file)
 // compilation unit as the top-level module.
 // pretty-expanded FIXME #23616
 
-fn pad() -> uint { 0 }
+fn pad() -> usize { 0 }
 
 mod b {
-    pub fn three() -> uint {
+    pub fn three() -> usize {
         ::one() + ::a::two()
     }
 }
 
 mod a {
-    pub fn two() -> uint {
+    pub fn two() -> usize {
         ::one() + ::one()
     }
 }
 
-fn one() -> uint {
+fn one() -> usize {
     1
 }
 
index f3673dfdbf2c567cb32e9a80dda89daf3189d2ac..f4fa0ed56981284af8c552f55cd56e088474ee30 100644 (file)
 // compilation unit as the top-level module.
 // pretty-expanded FIXME #23616
 
-fn one() -> uint { 1 }
+fn one() -> usize { 1 }
 
 mod a {
-    pub fn two() -> uint {
+    pub fn two() -> usize {
         ::one() + ::one()
     }
 }
 
 mod b {
-    pub fn three() -> uint {
+    pub fn three() -> usize {
         ::one() + ::a::two()
     }
 }
index 43d03e2bb6b03f1accd7d72d875286b22420f9f0..e926114e21924c0b6b1b04e60e06f8cd3cb30054 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn pad() -> uint { 0 }
+fn pad() -> usize { 0 }
 
-const ONE: uint = 1;
+const ONE: usize = 1;
 
 mod b {
     // Separate compilation always switches to the LLVM module with the fewest
     // instructions.  Make sure we have some instructions in this module so
     // that `a` and `b` don't go into the same compilation unit.
-    fn pad() -> uint { 0 }
+    fn pad() -> usize { 0 }
 
-    pub static THREE: uint = ::ONE + ::a::TWO;
+    pub static THREE: usize = ::ONE + ::a::TWO;
 }
 
 mod a {
-    fn pad() -> uint { 0 }
+    fn pad() -> usize { 0 }
 
-    pub const TWO: uint = ::ONE + ::ONE;
+    pub const TWO: usize = ::ONE + ::ONE;
 }
 
 fn main() {
index 6b39510c8c25afa32841acb42d7f0330d87cb8bc..71d3d91e84fde89f2c9cd6ee20d50d3c6e12b8bf 100644 (file)
@@ -23,7 +23,7 @@
 
 use std::thread;
 
-fn pad() -> uint { 0 }
+fn pad() -> usize { 0 }
 
 mod a {
     pub fn f() {
index 6e03c1e4a80f2eb3d8de27d2262c7d66e5d7dc72..3b719d1806e1138b545de7f674c9ce40473d900a 100644 (file)
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn foo(c: Vec<int> ) {
-    let a: int = 5;
-    let mut b: Vec<int> = Vec::new();
+fn foo(c: Vec<isize> ) {
+    let a: isize = 5;
+    let mut b: Vec<isize> = Vec::new();
 
 
-    match t::none::<int> {
-        t::some::<int>(_) => {
+    match t::none::<isize> {
+        t::some::<isize>(_) => {
             for _i in &c {
                 println!("{}", a);
                 let a = 17;
index 138a681ce2acbc767cad85d8866e4aa29c1506e6..f1637fe1e0931fad9475d94fd8391501fc51ecb2 100644 (file)
@@ -24,60 +24,60 @@ fn test_misc() {
 }
 
 fn test_expr() {
-    let v10 = 10 as uint;
+    let v10 = 10 as usize;
     let v4 = 4 as u8;
     let v2 = 2 as u8;
-    assert_eq!(v10 >> v2 as uint, v2 as uint);
-    assert_eq!(v10 << v4 as uint, 160 as uint);
+    assert_eq!(v10 >> v2 as usize, v2 as usize);
+    assert_eq!(v10 << v4 as usize, 160 as usize);
 
     let v10 = 10 as u8;
-    let v4 = 4 as uint;
-    let v2 = 2 as uint;
-    assert_eq!(v10 >> v2 as uint, v2 as u8);
-    assert_eq!(v10 << v4 as uint, 160 as u8);
+    let v4 = 4 as usize;
+    let v2 = 2 as usize;
+    assert_eq!(v10 >> v2 as usize, v2 as u8);
+    assert_eq!(v10 << v4 as usize, 160 as u8);
 
-    let v10 = 10 as int;
+    let v10 = 10 as isize;
     let v4 = 4 as i8;
     let v2 = 2 as i8;
-    assert_eq!(v10 >> v2 as uint, v2 as int);
-    assert_eq!(v10 << v4 as uint, 160 as int);
+    assert_eq!(v10 >> v2 as usize, v2 as isize);
+    assert_eq!(v10 << v4 as usize, 160 as isize);
 
     let v10 = 10 as i8;
-    let v4 = 4 as int;
-    let v2 = 2 as int;
-    assert_eq!(v10 >> v2 as uint, v2 as i8);
-    assert_eq!(v10 << v4 as uint, 160 as i8);
+    let v4 = 4 as isize;
+    let v2 = 2 as isize;
+    assert_eq!(v10 >> v2 as usize, v2 as i8);
+    assert_eq!(v10 << v4 as usize, 160 as i8);
 
-    let v10 = 10 as uint;
-    let v4 = 4 as int;
-    let v2 = 2 as int;
-    assert_eq!(v10 >> v2 as uint, v2 as uint);
-    assert_eq!(v10 << v4 as uint, 160 as uint);
+    let v10 = 10 as usize;
+    let v4 = 4 as isize;
+    let v2 = 2 as isize;
+    assert_eq!(v10 >> v2 as usize, v2 as usize);
+    assert_eq!(v10 << v4 as usize, 160 as usize);
 }
 
 fn test_const() {
-    static r1_1: uint = 10_usize >> 2_usize;
-    static r2_1: uint = 10_usize << 4_usize;
-    assert_eq!(r1_1, 2 as uint);
-    assert_eq!(r2_1, 160 as uint);
+    static r1_1: usize = 10_usize >> 2_usize;
+    static r2_1: usize = 10_usize << 4_usize;
+    assert_eq!(r1_1, 2 as usize);
+    assert_eq!(r2_1, 160 as usize);
 
     static r1_2: u8 = 10u8 >> 2_usize;
     static r2_2: u8 = 10u8 << 4_usize;
     assert_eq!(r1_2, 2 as u8);
     assert_eq!(r2_2, 160 as u8);
 
-    static r1_3: int = 10 >> 2_usize;
-    static r2_3: int = 10 << 4_usize;
-    assert_eq!(r1_3, 2 as int);
-    assert_eq!(r2_3, 160 as int);
+    static r1_3: isize = 10 >> 2_usize;
+    static r2_3: isize = 10 << 4_usize;
+    assert_eq!(r1_3, 2 as isize);
+    assert_eq!(r2_3, 160 as isize);
 
     static r1_4: i8 = 10i8 >> 2_usize;
     static r2_4: i8 = 10i8 << 4_usize;
     assert_eq!(r1_4, 2 as i8);
     assert_eq!(r2_4, 160 as i8);
 
-    static r1_5: uint = 10_usize >> 2_usize;
-    static r2_5: uint = 10_usize << 4_usize;
-    assert_eq!(r1_5, 2 as uint);
-    assert_eq!(r2_5, 160 as uint);
+    static r1_5: usize = 10_usize >> 2_usize;
+    static r2_5: usize = 10_usize << 4_usize;
+    assert_eq!(r1_5, 2 as usize);
+    assert_eq!(r2_5, 160 as usize);
 }
index 90bb36f25f75eb3e3c431b92786e011fbc28e82b..bfc4aee7757a59800ba8bb337877a765e2568990 100644 (file)
@@ -20,7 +20,7 @@ pub fn main() {
     let args: Vec<String> = env::args().collect();
     if args.len() >= 2 && args[1] == "signal" {
         // Raise a segfault.
-        unsafe { *(0 as *mut int) = 0; }
+        unsafe { *(0 as *mut isize) = 0; }
     } else {
         let status = Command::new(&args[0]).arg("signal").status().unwrap();
         // Windows does not have signal, so we get exit status 0xC0000028 (STATUS_BAD_STACK).
index eab4a0dfb7fcc402e94bd16a652c5a39971c8797..7167236438088e3139fea255c3cedb5225f4aa29 100644 (file)
@@ -12,5 +12,5 @@
 
 enum test { thing = -5 >> 1_usize }
 pub fn main() {
-    assert_eq!(test::thing as int, -3);
+    assert_eq!(test::thing as isize, -3);
 }
index 3273b73b4e286fd50504103ee1c7088bc00bf11c..02fc2a61d017bfe619c4476664549abe9f5d088a 100644 (file)
@@ -14,4 +14,4 @@
 
 enum clam<T> { a(T), }
 
-pub fn main() { let c = clam::a(2); match c { clam::a::<int>(_) => { } } }
+pub fn main() { let c = clam::a(2); match c { clam::a::<isize>(_) => { } } }
index 2217dddbd21f0884a2efa04a48e7a97fb0a8ade6..52989b3666924bf43ad9157916cfeba3d3ac4d90 100644 (file)
@@ -11,9 +11,9 @@
 enum opt<T> { none, some(T) }
 
 pub fn main() {
-    let x = opt::none::<int>;
+    let x = opt::none::<isize>;
     match x {
-        opt::none::<int> => { println!("hello world"); }
+        opt::none::<isize> => { println!("hello world"); }
         opt::some(_) => { }
     }
 }
index 4b587ae70a1c262481cf2008abd7a77debdd614d..007ce52d7c455bdf8a17ab03c5e0461f4fefa28b 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-enum clam<T> { a(T, int), b, }
+enum clam<T> { a(T, isize), b, }
 
 fn uhoh<T>(v: Vec<clam<T>> ) {
     match v[1] {
@@ -22,6 +22,6 @@ fn uhoh<T>(v: Vec<clam<T>> ) {
 }
 
 pub fn main() {
-    let v: Vec<clam<int>> = vec!(clam::b::<int>, clam::b::<int>, clam::a::<int>(42, 17));
-    uhoh::<int>(v);
+    let v: Vec<clam<isize>> = vec!(clam::b::<isize>, clam::b::<isize>, clam::a::<isize>(42, 17));
+    uhoh::<isize>(v);
 }
index 1d0d28d5f95b9e0b90a54ff976def2029c91faf8..7f34b94ad04b09e51fddda165cad1cbf44cead33 100644 (file)
 // pretty-expanded FIXME #23616
 
 fn main() {
-    let x: &[int] = &[1, 2, 3, 4, 5];
-    let cmp: &[int] = &[1, 2, 3, 4, 5];
+    let x: &[isize] = &[1, 2, 3, 4, 5];
+    let cmp: &[isize] = &[1, 2, 3, 4, 5];
     assert!(&x[..] == cmp);
-    let cmp: &[int] = &[3, 4, 5];
+    let cmp: &[isize] = &[3, 4, 5];
     assert!(&x[2..] == cmp);
-    let cmp: &[int] = &[1, 2, 3];
+    let cmp: &[isize] = &[1, 2, 3];
     assert!(&x[..3] == cmp);
-    let cmp: &[int] = &[2, 3, 4];
+    let cmp: &[isize] = &[2, 3, 4];
     assert!(&x[1..4] == cmp);
 
-    let x: Vec<int> = vec![1, 2, 3, 4, 5];
-    let cmp: &[int] = &[1, 2, 3, 4, 5];
+    let x: Vec<isize> = vec![1, 2, 3, 4, 5];
+    let cmp: &[isize] = &[1, 2, 3, 4, 5];
     assert!(&x[..] == cmp);
-    let cmp: &[int] = &[3, 4, 5];
+    let cmp: &[isize] = &[3, 4, 5];
     assert!(&x[2..] == cmp);
-    let cmp: &[int] = &[1, 2, 3];
+    let cmp: &[isize] = &[1, 2, 3];
     assert!(&x[..3] == cmp);
-    let cmp: &[int] = &[2, 3, 4];
+    let cmp: &[isize] = &[2, 3, 4];
     assert!(&x[1..4] == cmp);
 
-    let x: &mut [int] = &mut [1, 2, 3, 4, 5];
+    let x: &mut [isize] = &mut [1, 2, 3, 4, 5];
     {
-        let cmp: &mut [int] = &mut [1, 2, 3, 4, 5];
+        let cmp: &mut [isize] = &mut [1, 2, 3, 4, 5];
         assert!(&mut x[..] == cmp);
     }
     {
-        let cmp: &mut [int] = &mut [3, 4, 5];
+        let cmp: &mut [isize] = &mut [3, 4, 5];
         assert!(&mut x[2..] == cmp);
     }
     {
-        let cmp: &mut [int] = &mut [1, 2, 3];
+        let cmp: &mut [isize] = &mut [1, 2, 3];
         assert!(&mut x[..3] == cmp);
     }
     {
-        let cmp: &mut [int] = &mut [2, 3, 4];
+        let cmp: &mut [isize] = &mut [2, 3, 4];
         assert!(&mut x[1..4] == cmp);
     }
 
-    let mut x: Vec<int> = vec![1, 2, 3, 4, 5];
+    let mut x: Vec<isize> = vec![1, 2, 3, 4, 5];
     {
-        let cmp: &mut [int] = &mut [1, 2, 3, 4, 5];
+        let cmp: &mut [isize] = &mut [1, 2, 3, 4, 5];
         assert!(&mut x[..] == cmp);
     }
     {
-        let cmp: &mut [int] = &mut [3, 4, 5];
+        let cmp: &mut [isize] = &mut [3, 4, 5];
         assert!(&mut x[2..] == cmp);
     }
     {
-        let cmp: &mut [int] = &mut [1, 2, 3];
+        let cmp: &mut [isize] = &mut [1, 2, 3];
         assert!(&mut x[..3] == cmp);
     }
     {
-        let cmp: &mut [int] = &mut [2, 3, 4];
+        let cmp: &mut [isize] = &mut [2, 3, 4];
         assert!(&mut x[1..4] == cmp);
     }
 }
index bb8db83ccdc057787fcd9e4b23854696e75754f7..a4f737f74619cababf55e5864f74abef27ddbde1 100644 (file)
@@ -16,7 +16,7 @@
 
 struct Foo;
 
-static mut DTOR_COUNT: int = 0;
+static mut DTOR_COUNT: isize = 0;
 
 impl Drop for Foo {
     fn drop(&mut self) { unsafe { DTOR_COUNT += 1; } }
index 94ea026d87d1f76aa1e709cfd22dd115466a8caf..f02a84b9070bf8cdf1f94b260f4d7ad0d69f542d 100644 (file)
 
 struct Foo;
 
-static mut DTOR_COUNT: int = 0;
+static mut DTOR_COUNT: isize = 0;
 
 impl Drop for Foo {
     fn drop(&mut self) { unsafe { DTOR_COUNT += 1; } }
 }
 
-fn bar() -> uint {
+fn bar() -> usize {
     panic!();
 }
 
index ec6cdf448303db2e00fac23493d5d3226a45d814..edc5f6b18462474a2e047696bac0c638e7370261 100644 (file)
@@ -17,7 +17,7 @@
 extern crate core;
 use core::ops::{Index, IndexMut, Range, RangeTo, RangeFrom, RangeFull};
 
-static mut COUNT: uint = 0;
+static mut COUNT: usize = 0;
 
 struct Foo;
 
index d7926ec8b29c75c5d172fd0ae2fa752a61ed6cbc..5e84ce19de1efa21b5f64b96c3cb732de5970101 100644 (file)
@@ -26,9 +26,9 @@
 
 #[start]
 #[no_stack_check]
-fn main(_: int, _: *const *const u8) -> int {
+fn main(_: isize, _: *const *const u8) -> isize {
     unsafe {
-        let (ptr, _): (*const u8, uint) = transmute("Hello!\0");
+        let (ptr, _): (*const u8, usize) = transmute("Hello!\0");
         puts(ptr);
     }
     return 0;
index 4f8ba7f655ee6d48d6f8405db6d17163a0bc2506..efddf0455cd5fbe472bb57e6158e1dff84739a08 100644 (file)
@@ -8,23 +8,21 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(std_misc)]
+use std::thread;
 
-use std::thread::Thread;
-
-fn x(s: String, n: int) {
+fn x(s: String, n: isize) {
     println!("{}", s);
     println!("{}", n);
 }
 
 pub fn main() {
-    let _t = Thread::spawn(|| x("hello from first spawned fn".to_string(), 65) );
-    let _t = Thread::spawn(|| x("hello from second spawned fn".to_string(), 66) );
-    let _t = Thread::spawn(|| x("hello from third spawned fn".to_string(), 67) );
-    let mut i: int = 30;
+    let _t = thread::scoped(|| x("hello from first spawned fn".to_string(), 65) );
+    let _t = thread::scoped(|| x("hello from second spawned fn".to_string(), 66) );
+    let _t = thread::scoped(|| x("hello from third spawned fn".to_string(), 67) );
+    let mut i = 30;
     while i > 0 {
         i = i - 1;
         println!("parent sleeping");
-        Thread::yield_now();
+        thread::yield_now();
     }
 }
index baf7bb6308f712a86091fe96e52a729549f92fa9..aab292a940afbb25c3cfc0b939136de06f6c370e 100644 (file)
 use std::thread;
 use std::sync::mpsc::{channel, Sender};
 
-type ctx = Sender<int>;
+type ctx = Sender<isize>;
 
 fn iotask(_tx: &ctx, ip: String) {
     assert_eq!(ip, "localhost".to_string());
 }
 
 pub fn main() {
-    let (tx, _rx) = channel::<int>();
+    let (tx, _rx) = channel::<isize>();
     let t = thread::spawn(move|| iotask(&tx, "localhost".to_string()) );
     t.join().ok().unwrap();
 }
index 90b47f4986bfb95ca5726c9220d040ca9184c09c..1c34634c73da27990d689550c84964b95e511715 100644 (file)
@@ -14,4 +14,4 @@ pub fn main() {
     thread::spawn(move|| child(10)).join().ok().unwrap();
 }
 
-fn child(i: int) { println!("{}", i); assert!((i == 10)); }
+fn child(i: isize) { println!("{}", i); assert!((i == 10)); }
index b808ea472a28a93b0621662bbacff81727e9c6b2..93dc3faaa205dfb47e72ef6fe27f10a75e7b7d94 100644 (file)
@@ -15,7 +15,7 @@ pub fn main() {
     t.join().ok().unwrap(); // forget Err value, since it doesn't implement Debug
 }
 
-fn child(args: (int, int, int, int, int, int, int, int, int)) {
+fn child(args: (isize, isize, isize, isize, isize, isize, isize, isize, isize)) {
     let (i1, i2, i3, i4, i5, i6, i7, i8, i9) = args;
     println!("{}", i1);
     println!("{}", i2);
index 920cd9e03ab6b4ee97fd876a94e5c60bbfa44d92..f93600195dc259cc89275f650375ee9b1bf1507c 100644 (file)
@@ -13,6 +13,6 @@
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    let foo: int = 1;
-    assert_eq!(&foo as *const int, &foo as *const int);
+    let foo: isize = 1;
+    assert_eq!(&foo as *const isize, &foo as *const isize);
 }
index b2fbff67ac7c2718f677cd992774a617b2e7c280..80de65c0e9f656daba5bcce0d6946693def88c35 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "static_fn_inline_xc_aux" as mycore;
+extern crate static_fn_inline_xc_aux as mycore;
 
 use mycore::num;
 
index 7c9049ffacfc20181e15672562c534c28706d161..550e03c8b12fbedd17b4fdeb06646a1ff1927e1c 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "static_fn_trait_xc_aux" as mycore;
+extern crate static_fn_trait_xc_aux as mycore;
 
 use mycore::num;
 
index f4d6e89d170a7c3c66892e7375b011afff8d1036..55f3b0883b9d90728ad9be9a600a9200958ef8fe 100644 (file)
@@ -11,9 +11,9 @@
 // aux-build:static-function-pointer-aux.rs
 // pretty-expanded FIXME #23616
 
-extern crate "static-function-pointer-aux" as aux;
+extern crate static_function_pointer_aux as aux;
 
-fn f(x: int) -> int { x }
+fn f(x: isize) -> isize { x }
 
 pub fn main() {
     assert_eq!(aux::F(42), -42);
index a2b1572db6360f85375f814e644d4c488efb945d..67cc033f7cf755d8d79e53ab1b625161897e0969 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn f(x: int) -> int { x }
-fn g(x: int) -> int { 2 * x }
+fn f(x: isize) -> isize { x }
+fn g(x: isize) -> isize { 2 * x }
 
-static F: fn(int) -> int = f;
-static mut G: fn(int) -> int = f;
+static F: fn(isize) -> isize = f;
+static mut G: fn(isize) -> isize = f;
 
 pub fn main() {
     assert_eq!(F(42), 42);
index 6af348b0e3ed3438ac23d091112585f52cd31eef..aff2797c1acce41b55b0eb33b639f06147cf1794 100644 (file)
 // pretty-expanded FIXME #23616
 
 pub trait plus {
-    fn plus(&self) -> int;
+    fn plus(&self) -> isize;
 }
 
 mod a {
     use plus;
-    impl plus for uint { fn plus(&self) -> int { *self as int + 20 } }
+    impl plus for usize { fn plus(&self) -> isize { *self as isize + 20 } }
 }
 
 mod b {
     use plus;
-    impl plus for String { fn plus(&self) -> int { 200 } }
+    impl plus for String { fn plus(&self) -> isize { 200 } }
 }
 
 trait uint_utils {
     fn str(&self) -> String;
-    fn multi<F>(&self, f: F) where F: FnMut(uint);
+    fn multi<F>(&self, f: F) where F: FnMut(usize);
 }
 
-impl uint_utils for uint {
+impl uint_utils for usize {
     fn str(&self) -> String {
         self.to_string()
     }
-    fn multi<F>(&self, mut f: F) where F: FnMut(uint) {
+    fn multi<F>(&self, mut f: F) where F: FnMut(usize) {
         let mut c = 0_usize;
         while c < *self { f(c); c += 1_usize; }
     }
 }
 
 trait vec_utils<T> {
-    fn length_(&self, ) -> uint;
+    fn length_(&self, ) -> usize;
     fn iter_<F>(&self, f: F) where F: FnMut(&T);
     fn map_<U, F>(&self, f: F) -> Vec<U> where F: FnMut(&T) -> U;
 }
 
 impl<T> vec_utils<T> for Vec<T> {
-    fn length_(&self) -> uint { self.len() }
+    fn length_(&self) -> usize { self.len() }
     fn iter_<F>(&self, mut f: F) where F: FnMut(&T) { for x in self { f(x); } }
     fn map_<U, F>(&self, mut f: F) -> Vec<U> where F: FnMut(&T) -> U {
         let mut r = Vec::new();
@@ -66,7 +66,7 @@ pub fn main() {
     assert_eq!((vec!(1)).length_().str(), "1".to_string());
     let vect = vec!(3, 4).map_(|a| *a + 4);
     assert_eq!(vect[0], 7);
-    let vect = (vec!(3, 4)).map_::<uint, _>(|a| *a as uint + 4_usize);
+    let vect = (vec!(3, 4)).map_::<usize, _>(|a| *a as usize + 4_usize);
     assert_eq!(vect[0], 7_usize);
     let mut x = 0_usize;
     10_usize.multi(|_n| x += 2_usize );
index 1eb20370f687c270cd389eeba7b3d2544db48b09..4ccb044bbd2caacd4aa2f52cf41997d59fddb07a 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait Deserializer {
-    fn read_int(&self) -> int;
+    fn read_int(&self) -> isize;
 }
 
 trait Deserializable<D:Deserializer> {
     fn deserialize(d: &D) -> Self;
 }
 
-impl<D:Deserializer> Deserializable<D> for int {
-    fn deserialize(d: &D) -> int {
+impl<D:Deserializer> Deserializable<D> for isize {
+    fn deserialize(d: &D) -> isize {
         return d.read_int();
     }
 }
@@ -27,11 +27,11 @@ fn deserialize(d: &D) -> int {
 struct FromThinAir { dummy: () }
 
 impl Deserializer for FromThinAir {
-    fn read_int(&self) -> int { 22 }
+    fn read_int(&self) -> isize { 22 }
 }
 
 pub fn main() {
     let d = FromThinAir { dummy: () };
-    let i: int = Deserializable::deserialize(&d);
+    let i: isize = Deserializable::deserialize(&d);
     assert_eq!(i, 22);
 }
index ed9160e1d5850c6532936bf48cc503a08c70bf7d..d0b69b430a69244557b180317602245208610393 100644 (file)
@@ -17,7 +17,7 @@
 use static_methods_crate::read;
 
 pub fn main() {
-    let result: int = read("5".to_string());
+    let result: isize = read("5".to_string());
     assert_eq!(result, 5);
     assert_eq!(read::readMaybe("false".to_string()), Some(false));
     assert_eq!(read::readMaybe("foo".to_string()), None::<bool>);
index 33c1ce4d2c3d5d8527da22054e20a4fc935d41c2..cb23feb05a59dd09460deb65b3689a8d28dd0ff7 100644 (file)
@@ -15,22 +15,22 @@ pub trait Foo {
         fn foo() -> Self;
     }
 
-    impl Foo for int {
-        fn foo() -> int {
+    impl Foo for isize {
+        fn foo() -> isize {
             3
         }
     }
 
-    impl Foo for uint {
-        fn foo() -> uint {
+    impl Foo for usize {
+        fn foo() -> usize {
             5
         }
     }
 }
 
 pub fn main() {
-    let x: int = a::Foo::foo();
-    let y: uint = a::Foo::foo();
+    let x: isize = a::Foo::foo();
+    let y: usize = a::Foo::foo();
     assert_eq!(x, 3);
     assert_eq!(y, 5);
 }
index a32bf7a7af2758677fe14cd9b45e81050b12575a..0456d17bdc4b4277015f470117af0679acd6b03b 100644 (file)
@@ -18,9 +18,9 @@
 
 extern crate static_mut_xc;
 
-unsafe fn static_bound(_: &'static int) {}
+unsafe fn static_bound(_: &'static isize) {}
 
-fn static_bound_set(a: &'static mut int) {
+fn static_bound_set(a: &'static mut isize) {
     *a = 3;
 }
 
@@ -43,5 +43,5 @@ pub fn main() {
 }
 
 pub mod inner {
-    pub static mut a: int = 4;
+    pub static mut a: isize = 4;
 }
index c27e6e4576cbc52d54cea556899a012987d3a5a8..79e7960cfb27c9fbb40f2f068ff5cb9d7dc41b50 100644 (file)
@@ -11,8 +11,8 @@
 // pretty-expanded FIXME #23616
 
 struct S {
-    x: int,
-    y: int,
+    x: isize,
+    y: isize,
 }
 
 type S2 = S;
index 8ff17bf08f8ce93bfe3d1c2a4615d3a27c771b2b..a55e5143a0bfba8f003e9ccdc3d34f27ef9e8253 100644 (file)
@@ -12,8 +12,8 @@
 
 enum Foo {
     Bar {
-        a: int,
-        b: int
+        a: isize,
+        b: isize
     },
     Baz {
         c: f64,
index 36b9a6d9e8dd4e3cc2ebbe244f24d81c62a31470..f072d315d72bf2f0af8bdf9af5bb2d9400adce72 100644 (file)
@@ -12,8 +12,8 @@
 
 enum Foo {
     Bar {
-        x: int,
-        y: int
+        x: isize,
+        y: isize
     },
     Baz {
         x: f64,
index 22a57cbf0430c034bf3d3226d9a0ce4e7e3a64f9..73f27448f81a48d0206e39106b4f176a62221752 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 struct Foo {
-    new: int,
+    new: isize,
 }
 
 pub fn main() {
index 1c7101402ab93434a5c4fb3967952a78cc89b8fe..49ec695a1228b133b14284c415e73fddec7c5ffe 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct S { f0: String, f1: int }
+struct S { f0: String, f1: isize }
 
 pub fn main() {
     let s = "Hello, world!".to_string();
index 8f75b763d9635641b3d1a4b56637f8762878e298..3b04bfc1acca04ba6ff7b0ba0076f3235838df5a 100644 (file)
@@ -12,8 +12,8 @@
 pub struct Partial<T> { x: T, y: T }
 
 #[derive(PartialEq, Debug)]
-struct S { val: int }
-impl S { fn new(v: int) -> S { S { val: v } } }
+struct S { val: isize }
+impl S { fn new(v: isize) -> S { S { val: v } } }
 impl Drop for S { fn drop(&mut self) { } }
 
 pub fn f<T, F>((b1, b2): (T, T), mut f: F) -> Partial<T> where F: FnMut(T) -> T {
index 377e9e6b89afcb0b402dd8662ea1b4e3f94ff0cb..b9c697c71eaaad6924abca02eafbd9573e9627f2 100644 (file)
@@ -12,8 +12,8 @@
 pub struct Partial<T> { x: T, y: T }
 
 #[derive(PartialEq, Debug)]
-struct S { val: int }
-impl S { fn new(v: int) -> S { S { val: v } } }
+struct S { val: isize }
+impl S { fn new(v: isize) -> S { S { val: v } } }
 impl Drop for S { fn drop(&mut self) { } }
 
 pub type Two<T> = (Partial<T>, Partial<T>);
index 6033554d0cbeeef5001f5db809d911ea039a0738..9c3ce54f36914f6c542ac42e3de98714f607986b 100644 (file)
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 struct Foo {
-    x: int,
-    y: int,
+    x: isize,
+    y: isize,
 }
 
 pub fn main() {
index d67c6322c61cad85d6adde002036c087f00ac495..9e372913e0540ccb780142aba957fe9f2a9010da 100644 (file)
@@ -33,10 +33,10 @@ fn test1() {
                  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);
+        println!("a: {:x}", qq.a as usize);
+        println!("b: {:x}", qq.b as usize);
+        println!("c: {:x}", qq.c as usize);
+        println!("d: {:x}", qq.d as usize);
         assert_eq!(qq.a, q.c + 1);
         assert_eq!(qq.b, q.d - 1);
         assert_eq!(qq.c, q.a + 1);
@@ -52,7 +52,7 @@ fn test2() {
                  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!("b: {}", ff.b as usize);
         println!("c: {}", ff.c as f64);
         assert_eq!(ff.a, f.c + 1.0f64);
         assert_eq!(ff.b, 0xff);
index 383292fe097edf0101022375773ec274972f7a9d..b6e7846e96d03c96514691c2991376da9c24607d 100644 (file)
@@ -12,7 +12,7 @@
 
 mod foo {
     pub enum Foo {
-        Bar { a: int }
+        Bar { a: isize }
     }
 }
 
index 12d8fe8f4c8c3131da6591d6956496e02dcd3562..4df802849e2fdf88b1877f8e5ee4984c3c7b1a46 100644 (file)
@@ -15,7 +15,7 @@ enum foo { large, small, }
 
 impl PartialEq for foo {
     fn eq(&self, other: &foo) -> bool {
-        ((*self) as uint) == ((*other) as uint)
+        ((*self) as usize) == ((*other) as usize)
     }
     fn ne(&self, other: &foo) -> bool { !(*self).eq(other) }
 }
index f00ba36a00450e1c8fa2646b51bb8115e75c413a..69ec0a2222ddbc50e84ba5b22c26e129e97e30dc 100644 (file)
@@ -14,7 +14,7 @@
 //
 // Big stack is needed for pretty printing, a little sad...
 
-static a: int =
+static a: isize =
 (((((((((((((((((((((((((((((((((((((((((((((((((((
 (((((((((((((((((((((((((((((((((((((((((((((((((((
 (((((((((((((((((((((((((((((((((((((((((((((((((((
index 7f705146aaa128937c8b2bba08bc98f51720d165..811b9dce4bc32889d2234fa4aba2ed6e97dee3ca 100644 (file)
@@ -14,8 +14,8 @@
 
 pub fn main() {
   let f = 1_usize as *const libc::FILE;
-  println!("{:?}", f as int);
-  println!("{:?}", f as uint);
+  println!("{:?}", f as isize);
+  println!("{:?}", f as usize);
   println!("{:?}", f as i8);
   println!("{:?}", f as i16);
   println!("{:?}", f as i32);
@@ -25,8 +25,8 @@ pub fn main() {
   println!("{:?}", f as u32);
   println!("{:?}", f as u64);
 
-  println!("{:?}", 1 as int);
-  println!("{:?}", 1 as uint);
+  println!("{:?}", 1 as isize);
+  println!("{:?}", 1 as usize);
   println!("{:?}", 1 as *const libc::FILE);
   println!("{:?}", 1 as i8);
   println!("{:?}", 1 as i16);
@@ -39,8 +39,8 @@ pub fn main() {
   println!("{:?}", 1 as f32);
   println!("{:?}", 1 as f64);
 
-  println!("{:?}", 1_usize as int);
-  println!("{:?}", 1_usize as uint);
+  println!("{:?}", 1_usize as isize);
+  println!("{:?}", 1_usize as usize);
   println!("{:?}", 1_usize as *const libc::FILE);
   println!("{:?}", 1_usize as i8);
   println!("{:?}", 1_usize as i16);
@@ -53,8 +53,8 @@ pub fn main() {
   println!("{:?}", 1_usize as f32);
   println!("{:?}", 1_usize as f64);
 
-  println!("{:?}", 1i8 as int);
-  println!("{:?}", 1i8 as uint);
+  println!("{:?}", 1i8 as isize);
+  println!("{:?}", 1i8 as usize);
   println!("{:?}", 1i8 as *const libc::FILE);
   println!("{:?}", 1i8 as i8);
   println!("{:?}", 1i8 as i16);
@@ -67,8 +67,8 @@ pub fn main() {
   println!("{:?}", 1i8 as f32);
   println!("{:?}", 1i8 as f64);
 
-  println!("{:?}", 1u8 as int);
-  println!("{:?}", 1u8 as uint);
+  println!("{:?}", 1u8 as isize);
+  println!("{:?}", 1u8 as usize);
   println!("{:?}", 1u8 as *const libc::FILE);
   println!("{:?}", 1u8 as i8);
   println!("{:?}", 1u8 as i16);
@@ -81,8 +81,8 @@ pub fn main() {
   println!("{:?}", 1u8 as f32);
   println!("{:?}", 1u8 as f64);
 
-  println!("{:?}", 1i16 as int);
-  println!("{:?}", 1i16 as uint);
+  println!("{:?}", 1i16 as isize);
+  println!("{:?}", 1i16 as usize);
   println!("{:?}", 1i16 as *const libc::FILE);
   println!("{:?}", 1i16 as i8);
   println!("{:?}", 1i16 as i16);
@@ -95,8 +95,8 @@ pub fn main() {
   println!("{:?}", 1i16 as f32);
   println!("{:?}", 1i16 as f64);
 
-  println!("{:?}", 1u16 as int);
-  println!("{:?}", 1u16 as uint);
+  println!("{:?}", 1u16 as isize);
+  println!("{:?}", 1u16 as usize);
   println!("{:?}", 1u16 as *const libc::FILE);
   println!("{:?}", 1u16 as i8);
   println!("{:?}", 1u16 as i16);
@@ -109,8 +109,8 @@ pub fn main() {
   println!("{:?}", 1u16 as f32);
   println!("{:?}", 1u16 as f64);
 
-  println!("{:?}", 1i32 as int);
-  println!("{:?}", 1i32 as uint);
+  println!("{:?}", 1i32 as isize);
+  println!("{:?}", 1i32 as usize);
   println!("{:?}", 1i32 as *const libc::FILE);
   println!("{:?}", 1i32 as i8);
   println!("{:?}", 1i32 as i16);
@@ -123,8 +123,8 @@ pub fn main() {
   println!("{:?}", 1i32 as f32);
   println!("{:?}", 1i32 as f64);
 
-  println!("{:?}", 1u32 as int);
-  println!("{:?}", 1u32 as uint);
+  println!("{:?}", 1u32 as isize);
+  println!("{:?}", 1u32 as usize);
   println!("{:?}", 1u32 as *const libc::FILE);
   println!("{:?}", 1u32 as i8);
   println!("{:?}", 1u32 as i16);
@@ -137,8 +137,8 @@ pub fn main() {
   println!("{:?}", 1u32 as f32);
   println!("{:?}", 1u32 as f64);
 
-  println!("{:?}", 1i64 as int);
-  println!("{:?}", 1i64 as uint);
+  println!("{:?}", 1i64 as isize);
+  println!("{:?}", 1i64 as usize);
   println!("{:?}", 1i64 as *const libc::FILE);
   println!("{:?}", 1i64 as i8);
   println!("{:?}", 1i64 as i16);
@@ -151,8 +151,8 @@ pub fn main() {
   println!("{:?}", 1i64 as f32);
   println!("{:?}", 1i64 as f64);
 
-  println!("{:?}", 1u64 as int);
-  println!("{:?}", 1u64 as uint);
+  println!("{:?}", 1u64 as isize);
+  println!("{:?}", 1u64 as usize);
   println!("{:?}", 1u64 as *const libc::FILE);
   println!("{:?}", 1u64 as i8);
   println!("{:?}", 1u64 as i16);
@@ -165,8 +165,8 @@ pub fn main() {
   println!("{:?}", 1u64 as f32);
   println!("{:?}", 1u64 as f64);
 
-  println!("{:?}", 1u64 as int);
-  println!("{:?}", 1u64 as uint);
+  println!("{:?}", 1u64 as isize);
+  println!("{:?}", 1u64 as usize);
   println!("{:?}", 1u64 as *const libc::FILE);
   println!("{:?}", 1u64 as i8);
   println!("{:?}", 1u64 as i16);
@@ -179,8 +179,8 @@ pub fn main() {
   println!("{:?}", 1u64 as f32);
   println!("{:?}", 1u64 as f64);
 
-  println!("{:?}", true as int);
-  println!("{:?}", true as uint);
+  println!("{:?}", true as isize);
+  println!("{:?}", true as usize);
   println!("{:?}", true as *const libc::FILE);
   println!("{:?}", true as i8);
   println!("{:?}", true as i16);
@@ -193,8 +193,8 @@ pub fn main() {
   println!("{:?}", true as f32);
   println!("{:?}", true as f64);
 
-  println!("{:?}", 1f32 as int);
-  println!("{:?}", 1f32 as uint);
+  println!("{:?}", 1f32 as isize);
+  println!("{:?}", 1f32 as usize);
   println!("{:?}", 1f32 as i8);
   println!("{:?}", 1f32 as i16);
   println!("{:?}", 1f32 as i32);
@@ -206,8 +206,8 @@ pub fn main() {
   println!("{:?}", 1f32 as f32);
   println!("{:?}", 1f32 as f64);
 
-  println!("{:?}", 1f64 as int);
-  println!("{:?}", 1f64 as uint);
+  println!("{:?}", 1f64 as isize);
+  println!("{:?}", 1f64 as usize);
   println!("{:?}", 1f64 as i8);
   println!("{:?}", 1f64 as i16);
   println!("{:?}", 1f64 as i32);
index 45bcba61b152830dd92f22d58c5b43abc758af52..3891376e463c7308394020942f99b5703690bec4 100644 (file)
@@ -13,7 +13,7 @@
 use std::mem::swap;
 
 pub fn main() {
-    let mut a: Vec<int> = vec!(0, 1, 2, 3, 4, 5, 6);
+    let mut a: Vec<isize> = vec!(0, 1, 2, 3, 4, 5, 6);
     a.swap(2, 4);
     assert_eq!(a[2], 4);
     assert_eq!(a[4], 2);
index 96cab66ab661f6379afc933d3bd1a8076b500e7d..2e5386d6866edefa56136210f1648fd0651dce22 100644 (file)
@@ -36,8 +36,8 @@ pub enum TestName {
 }
 
 pub enum TestFn {
-    DynTestFn(int),
-    DynBenchFn(int),
+    DynTestFn(isize),
+    DynBenchFn(isize),
 }
 
 pub struct TestDesc {
index b0d4b4c4404c8cd29b3132e3c6c477f94c7ada92..a9f5875023f18217ba1797afae1ca7bf69244fbe 100644 (file)
@@ -26,7 +26,7 @@ fn mk_rec() -> Rec {
 }
 
 fn is_u64_aligned(u: &Tag<u64>) -> bool {
-    let p: uint = unsafe { mem::transmute(u) };
+    let p: usize = unsafe { mem::transmute(u) };
     let u64_align = std::mem::min_align_of::<u64>();
     return (p & (u64_align - 1)) == 0;
 }
index 672a63824aa36eb2ecd8b8e0fc50e047ce2fdd6f..90b583e2e5072963041a7320eff4187f40750348 100644 (file)
@@ -28,12 +28,12 @@ fn mk_rec<A,B>(a: A, b: B) -> Rec<A,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) };
+fn is_aligned<A>(amnt: usize, u: &A) -> bool {
+    let p: usize = unsafe { mem::transmute(u) };
     return (p & (amnt-1)) == 0;
 }
 
-fn variant_data_is_aligned<A,B>(amnt: uint, u: &Tag<A,B>) -> bool {
+fn variant_data_is_aligned<A,B>(amnt: usize, u: &Tag<A,B>) -> bool {
     match u {
       &Tag::VarA(ref a) => is_aligned(amnt, a),
       &Tag::VarB(ref b) => is_aligned(amnt, b)
index ca0e3ee95f880e06b629f3fbce07e3eb35813c70..e922ac3b4668e5915de1dba28719ce8b3540ed34 100644 (file)
@@ -26,7 +26,7 @@ fn mk_rec() -> Rec {
 }
 
 fn is_u64_aligned(u: &Tag) -> bool {
-    let p: uint = unsafe { mem::transmute(u) };
+    let p: usize = unsafe { mem::transmute(u) };
     let u64_align = std::mem::min_align_of::<u64>();
     return (p & (u64_align - 1)) == 0;
 }
index 95bfb7868991836671eccbff2105ea869ad19478..affabff916490d4616fc508a6ba01c53ba5b046e 100644 (file)
@@ -25,7 +25,7 @@ enum color {
 
 impl PartialEq for color {
     fn eq(&self, other: &color) -> bool {
-        ((*self) as uint) == ((*other) as uint)
+        ((*self) as usize) == ((*other) as usize)
     }
     fn ne(&self, other: &color) -> bool { !(*self).eq(other) }
 }
@@ -41,9 +41,9 @@ pub fn main() {
     test_color(orange, 4, "orange".to_string());
 }
 
-fn test_color(color: color, val: int, name: String) {
+fn test_color(color: color, val: isize, name: String) {
     //assert!(unsafe::transmute(color) == val);
-    assert_eq!(color as int, val);
+    assert_eq!(color as isize, val);
     assert!(get_color_alt(color) == name);
     assert!(get_color_if(color) == name);
 }
index d6d4cd2de78a2331a81e4b05bce2a52af641d02e..dbd65ee6bd483b5b974d6a2e2bc37f95e4b0cd30 100644 (file)
@@ -11,7 +11,7 @@
 
 // pretty-expanded FIXME #23616
 
-enum colour { red(int, int), green, }
+enum colour { red(isize, isize), green, }
 
 impl PartialEq for colour {
     fn eq(&self, other: &colour) -> bool {
index 6f03f385a83e4a638db87806b3a33355ace5f9ae..b6313905923d6c69f06220ac81cace53489b2a11 100644 (file)
 
 pub fn main() { let k = checktrue; evenk(42, k); oddk(45, k); }
 
-fn evenk(n: int, k: fn(bool) -> bool) -> bool {
+fn evenk(n: isize, k: fn(bool) -> bool) -> bool {
     println!("evenk");
     println!("{}", n);
     if n == 0 { return k(true); } else { return oddk(n - 1, k); }
 }
 
-fn oddk(n: int, k: fn(bool) -> bool) -> bool {
+fn oddk(n: isize, k: fn(bool) -> bool) -> bool {
     println!("oddk");
     println!("{}", n);
     if n == 0 { return k(false); } else { return evenk(n - 1, k); }
index 640da0697ac2a2edab40ec62f1599133f3021a36..01fc18af34332edd151870d20d7332d094a9a681 100644 (file)
@@ -15,6 +15,6 @@
 
 pub fn main() { assert!((even(42))); assert!((odd(45))); }
 
-fn even(n: int) -> bool { if n == 0 { return true; } else { return odd(n - 1); } }
+fn even(n: isize) -> bool { if n == 0 { return true; } else { return odd(n - 1); } }
 
-fn odd(n: int) -> bool { if n == 0 { return false; } else { return even(n - 1); } }
+fn odd(n: isize) -> bool { if n == 0 { return false; } else { return even(n - 1); } }
index a24d61c8ceaf98ca17d47e74528f85431cbc8b06..05197cd6a3d896605684525fa6ee8a46ee8df929 100644 (file)
@@ -15,7 +15,7 @@
 
 pub fn main() { test05(); }
 
-fn test05_start(tx : &Sender<int>) {
+fn test05_start(tx : &Sender<isize>) {
     tx.send(10).unwrap();
     println!("sent 10");
     tx.send(20).unwrap();
@@ -27,7 +27,7 @@ fn test05_start(tx : &Sender<int>) {
 fn test05() {
     let (tx, rx) = channel();
     let _t = Thread::spawn(move|| { test05_start(&tx) });
-    let mut value: int = rx.recv().unwrap();
+    let mut value: isize = rx.recv().unwrap();
     println!("{}", value);
     value = rx.recv().unwrap();
     println!("{}", value);
index 952adf1cd78a69fb309bf6eb1e203877518938cb..9ef5afab2e0919c3a1d2ba62b887af6c0a579ee1 100644 (file)
@@ -15,7 +15,7 @@
 use std::sync::mpsc::{channel, Sender};
 use std::thread::Thread;
 
-fn start(tx: &Sender<Sender<int>>) {
+fn start(tx: &Sender<Sender<isize>>) {
     let (tx2, _rx) = channel();
     tx.send(tx2).unwrap();
 }
index ff6d959327d03e6bd3771a062ad2cdbc7c170340..8921529c6bea3884887b3a5bb548059ef832c48b 100644 (file)
 
 pub fn main() { test00(); }
 
-fn start(_task_number: int) { println!("Started / Finished task."); }
+fn start(_task_number: isize) { println!("Started / Finished task."); }
 
 fn test00() {
-    let i: int = 0;
+    let i: isize = 0;
     let mut result = Thread::scoped(move|| {
         start(i)
     });
index 1f7da10252bd5d2a755a8a65aff805880a62218a..3a0757548e8c6e0aad5fade48fba4052d5a29cc5 100644 (file)
@@ -13,8 +13,8 @@
 use std::sync::mpsc::{channel, Sender};
 use std::thread::Thread;
 
-fn start(tx: &Sender<int>, start: int, number_of_messages: int) {
-    let mut i: int = 0;
+fn start(tx: &Sender<isize>, start: isize, number_of_messages: isize) {
+    let mut i: isize = 0;
     while i< number_of_messages { tx.send(start + i).unwrap(); i += 1; }
 }
 
index 785df73317aa1ee4018ef348f15a7b7028e9475e..2ef09cdcf874d8502f56f268b5ad9e3fc7bd21ea 100644 (file)
@@ -16,7 +16,7 @@
 pub fn main() {
     let (tx, rx) = channel();
 
-    // Spawn 10 tasks each sending us back one int.
+    // Spawn 10 tasks each sending us back one isize.
     let mut i = 10;
     while (i > 0) {
         println!("{}", i);
@@ -38,7 +38,7 @@ pub fn main() {
     println!("main thread exiting");
 }
 
-fn child(x: int, tx: &Sender<int>) {
+fn child(x: isize, tx: &Sender<isize>) {
     println!("{}", x);
     tx.send(x).unwrap();
 }
index 4db4333c9647e44fc22e9c68f335267868bef25d..605900495b50cca0c944d3f633c0919d314eae4f 100644 (file)
@@ -15,7 +15,7 @@
 use std::sync::mpsc::{channel, Sender};
 use std::thread::Thread;
 
-fn start(tx: &Sender<int>, i0: int) {
+fn start(tx: &Sender<isize>, i0: isize) {
     let mut i = i0;
     while i > 0 {
         tx.send(0).unwrap();
index ca009677ee9746a00155e16a2d41a2092971e354..c6d8f3c0d9b0bb490dfb722aba34b6ee67bf5da0 100644 (file)
@@ -13,7 +13,7 @@
 
 // Tests of ports and channels on various types
 fn test_rec() {
-    struct R {val0: int, val1: u8, val2: char}
+    struct R {val0: isize, val1: u8, val2: char}
 
     let (tx, rx) = channel();
     let r0: R = R {val0: 0, val1: 1, val2: '2'};
@@ -27,7 +27,7 @@ struct R {val0: int, val1: u8, val2: char}
 
 fn test_vec() {
     let (tx, rx) = channel();
-    let v0: Vec<int> = vec!(0, 1, 2);
+    let v0: Vec<isize> = vec!(0, 1, 2);
     tx.send(v0).unwrap();
     let v1 = rx.recv().unwrap();
     assert_eq!(v1[0], 0);
@@ -49,8 +49,8 @@ fn test_str() {
 #[derive(Debug)]
 enum t {
     tag1,
-    tag2(int),
-    tag3(int, u8, char)
+    tag2(isize),
+    tag3(isize, u8, char)
 }
 
 impl cmp::PartialEq for t {
@@ -102,7 +102,7 @@ fn test_chan() {
     // Does the transmitted channel still work?
 
     tx2.send(10).unwrap();
-    let mut i: int;
+    let mut i: isize;
     i = rx2.recv().unwrap();
     assert_eq!(i, 10);
 }
index bb0749eb8c005abc44a808092c56fc362fcd830e..d742b7bb11ab6122a6d1b8ed8a133c96a612fbe5 100644 (file)
@@ -17,9 +17,9 @@
 
 pub fn main() { println!("===== WITHOUT THREADS ====="); test00(); }
 
-fn test00_start(ch: &Sender<int>, message: int, count: int) {
+fn test00_start(ch: &Sender<isize>, message: isize, count: isize) {
     println!("Starting test00_start");
-    let mut i: int = 0;
+    let mut i: isize = 0;
     while i < count {
         println!("Sending Message");
         ch.send(message + 0).unwrap();
@@ -29,14 +29,14 @@ fn test00_start(ch: &Sender<int>, message: int, count: int) {
 }
 
 fn test00() {
-    let number_of_tasks: int = 16;
-    let number_of_messages: int = 4;
+    let number_of_tasks: isize = 16;
+    let number_of_messages: isize = 4;
 
     println!("Creating tasks");
 
     let (tx, rx) = channel();
 
-    let mut i: int = 0;
+    let mut i: isize = 0;
 
     // Create and spawn tasks...
     let mut results = Vec::new();
index 1f1b750aa5727fd63ad51d39185a840a227df769..e70a00591d6c9be247bdd6a4a9f0eb9b53f7b349 100644 (file)
@@ -15,8 +15,8 @@
 pub fn main() { test00(); }
 
 fn test00() {
-    let mut r: int = 0;
-    let mut sum: int = 0;
+    let mut r: isize = 0;
+    let mut sum: isize = 0;
     let (tx, rx) = channel();
     tx.send(1).unwrap();
     tx.send(2).unwrap();
index 9bae0ad069cd37861ee39d195d06bff137eddd1d..cd3d97b88bade11a7ada0630642b124c77bebe97 100644 (file)
 pub fn main() { test00(); }
 
 fn test00() {
-    let _r: int = 0;
-    let mut sum: int = 0;
+    let _r: isize = 0;
+    let mut sum: isize = 0;
     let (tx, rx) = channel();
-    let number_of_messages: int = 1000;
-    let mut i: int = 0;
+    let number_of_messages: isize = 1000;
+    let mut i: isize = 0;
     while i < number_of_messages { tx.send(i + 0).unwrap(); i += 1; }
     i = 0;
     while i < number_of_messages { sum += rx.recv().unwrap(); i += 1; }
index 2657951ca48763209821bff730b9889cdddbf51d..80e777d242cfcc3cb253bc7bf497e42ee84e8866 100644 (file)
 pub fn main() { test00(); }
 
 fn test00() {
-    let mut r: int = 0;
-    let mut sum: int = 0;
+    let mut r: isize = 0;
+    let mut sum: isize = 0;
     let (tx, rx) = channel();
     let mut tx0 = tx.clone();
     let mut tx1 = tx.clone();
     let mut tx2 = tx.clone();
     let mut tx3 = tx.clone();
-    let number_of_messages: int = 1000;
-    let mut i: int = 0;
+    let number_of_messages: isize = 1000;
+    let mut i: isize = 0;
     while i < number_of_messages {
         tx0.send(i + 0).unwrap();
         tx1.send(i + 0).unwrap();
index 44e3bab20ef74afba0b6dbae22f002022b675ffd..82e8fe0af417eaf144ac1a8b9f2bc6d25a0efc3b 100644 (file)
 
 pub fn main() { test00(); }
 
-fn test00_start(c: &Sender<int>, start: int,
-                number_of_messages: int) {
-    let mut i: int = 0;
+fn test00_start(c: &Sender<isize>, start: isize,
+                number_of_messages: isize) {
+    let mut i: isize = 0;
     while i < number_of_messages { c.send(start + i).unwrap(); i += 1; }
 }
 
 fn test00() {
-    let mut r: int = 0;
-    let mut sum: int = 0;
+    let mut r: isize = 0;
+    let mut sum: isize = 0;
     let (tx, rx) = channel();
-    let number_of_messages: int = 10;
+    let number_of_messages: isize = 10;
 
     let tx2 = tx.clone();
     let _t = Thread::spawn(move|| {
@@ -47,7 +47,7 @@ fn test00() {
         test00_start(&tx2, number_of_messages * 3, number_of_messages);
     });
 
-    let mut i: int = 0;
+    let mut i: isize = 0;
     while i < number_of_messages {
         r = rx.recv().unwrap();
         sum += r;
index 81d9148955a64c71c2d3511effd1743b5a34f0a8..3e4a75b8e220f3da0cfe910b9f29ce5dde44d056 100644 (file)
 
 pub fn main() { test00(); }
 
-fn test00_start(c: &Sender<int>, number_of_messages: int) {
-    let mut i: int = 0;
+fn test00_start(c: &Sender<isize>, number_of_messages: isize) {
+    let mut i: isize = 0;
     while i < number_of_messages { c.send(i + 0).unwrap(); i += 1; }
 }
 
 fn test00() {
-    let r: int = 0;
-    let mut sum: int = 0;
+    let r: isize = 0;
+    let mut sum: isize = 0;
     let (tx, rx) = channel();
-    let number_of_messages: int = 10;
+    let number_of_messages: isize = 10;
 
     let result = Thread::scoped(move|| {
         test00_start(&tx, number_of_messages);
     });
 
-    let mut i: int = 0;
+    let mut i: isize = 0;
     while i < number_of_messages {
         sum += rx.recv().unwrap();
         println!("{}", r);
index 5c0d0fe9a63d8ed74b4ff05042e1562a6debf52c..637f564f72649edcbc9b96d65fa45941a3c11f86 100644 (file)
 use std::sync::mpsc::channel;
 
 pub fn main() {
-    let (tx, rx) = channel::<uint>();
+    let (tx, rx) = channel::<usize>();
 
-    let x: Box<int> = box 1;
-    let x_in_parent = &(*x) as *const int as uint;
+    let x: Box<isize> = box 1;
+    let x_in_parent = &(*x) as *const isize as usize;
 
     let _t = Thread::spawn(move || {
-        let x_in_child = &(*x) as *const int as uint;
+        let x_in_child = &(*x) as *const isize as usize;
         tx.send(x_in_child).unwrap();
     });
 
index 5633ef2ecfc9b2f409c8da38c87b6f6cd3ba6754..99d36a179aaf5b93ddcdf1d1306f3f31ccfba538 100644 (file)
@@ -21,8 +21,8 @@
 use std::sync::mpsc::channel;
 use std::thread::Thread;
 
-static N: uint = 8;
-static M: uint = 20;
+static N: usize = 8;
+static M: usize = 20;
 
 fn main() {
     test();
index b59d11d8674c7479c285aa10f56afa4ee24dc9a2..ec9e7de40dce1bdbdf1de74700214ce657deab1c 100644 (file)
 
 use std::thread;
 
-fn test_break() { loop { let _x: Box<int> = break; } }
+fn test_break() { loop { let _x: Box<isize> = break; } }
 
-fn test_cont() { let mut i = 0; while i < 1 { i += 1; let _x: Box<int> = continue; } }
+fn test_cont() { let mut i = 0; while i < 1 { i += 1; let _x: Box<isize> = continue; } }
 
-fn test_ret() { let _x: Box<int> = return; }
+fn test_ret() { let _x: Box<isize> = return; }
 
 fn test_panic() {
-    fn f() { let _x: Box<int> = panic!(); }
+    fn f() { let _x: Box<isize> = panic!(); }
     thread::spawn(move|| f() ).join().err().unwrap();
 }
 
 fn test_panic_indirect() {
     fn f() -> ! { panic!(); }
-    fn g() { let _x: Box<int> = f(); }
+    fn g() { let _x: Box<isize> = f(); }
     thread::spawn(move|| g() ).join().err().unwrap();
 }
 
index 436fb1fe9b5d27c8d0a01d37af556a55f5361f75..4fc0995290493499ab93d283f5454768ddc19d52 100644 (file)
@@ -21,4 +21,4 @@ pub fn main() {
     println!("main thread exiting");
 }
 
-fn child(x: int) { println!("{}", x); }
+fn child(x: isize) { println!("{}", x); }
index 79e0df0133b4410fce3f56f22e78901cfb42733d..b9eda0846537fc5e0c1190dbe808282a37940074 100644 (file)
@@ -11,6 +11,7 @@
 // pretty-expanded FIXME #23616
 
 #![feature(advanced_slice_patterns,)]
+#![feature(slice_patterns)]
 
 fn f<T,>(_: T,) {}
 
@@ -19,24 +20,24 @@ fn f<T,>(_: T,) {}
 struct Bar;
 
 impl Bar {
-    fn f(_: int,) {}
-    fn g(self, _: int,) {}
+    fn f(_: isize,) {}
+    fn g(self, _: isize,) {}
     fn h(self,) {}
 }
 
 enum Baz {
-    Qux(int,),
+    Qux(isize,),
 }
 
 #[allow(unused,)]
 pub fn main() {
-    f::<int,>(0,);
+    f::<isize,>(0,);
     let (_, _,) = (1, 1,);
     let [_, _,] = [1, 1,];
     let [_, _, .., _,] = [1, 1, 1, 1,];
     let [_, _, _.., _,] = [1, 1, 1, 1,];
 
-    let x: Foo<int,> = Foo::<int,>(1);
+    let x: Foo<isize,> = Foo::<isize,>(1);
 
     Bar::f(0,);
     Bar.g(0,);
index 7357c387511376ee15e7acb4f647c6d58c309a98..33bfbc396035c55b6a72ea7800667c223fd74796 100644 (file)
@@ -18,7 +18,7 @@ trait A {
     fn foo<T: Eq + Ord>(&self);
 }
 
-impl A for int {
+impl A for isize {
     fn foo<T: Ord>(&self) {} // Ord implies Eq, so this is ok.
 }
 
index d2782976463808c77c25cc696eee2cca7035e54a..2d97633771e61739ae7a22f4955acfa157aaf238 100644 (file)
 
 trait Pet {
     fn name(&self, blk: Box<FnMut(&str)>);
-    fn num_legs(&self) -> uint;
+    fn num_legs(&self) -> usize;
     fn of_good_pedigree(&self) -> bool;
 }
 
 struct Catte {
-    num_whiskers: uint,
+    num_whiskers: usize,
     name: String,
 }
 
 struct Dogge {
-    bark_decibels: uint,
-    tricks_known: uint,
+    bark_decibels: usize,
+    tricks_known: usize,
     name: String,
 }
 
 struct Goldfyshe {
-    swim_speed: uint,
+    swim_speed: usize,
     name: String,
 }
 
 impl Pet for Catte {
     fn name(&self, mut blk: Box<FnMut(&str)>) { blk(&self.name) }
-    fn num_legs(&self) -> uint { 4 }
+    fn num_legs(&self) -> usize { 4 }
     fn of_good_pedigree(&self) -> bool { self.num_whiskers >= 4 }
 }
 impl Pet for Dogge {
     fn name(&self, mut blk: Box<FnMut(&str)>) { blk(&self.name) }
-    fn num_legs(&self) -> uint { 4 }
+    fn num_legs(&self) -> usize { 4 }
     fn of_good_pedigree(&self) -> bool {
         self.bark_decibels < 70 || self.tricks_known > 20
     }
 }
 impl Pet for Goldfyshe {
     fn name(&self, mut blk: Box<FnMut(&str)>) { blk(&self.name) }
-    fn num_legs(&self) -> uint { 0 }
+    fn num_legs(&self) -> usize { 0 }
     fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 }
 }
 
index 0db77ec2f79d0c1b17aa100e88af312788950f61..642119df15cbf20f39e90e3db5263cb07dc7753d 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 trait connection {
-    fn read(&self) -> int;
+    fn read(&self) -> isize;
 }
 
 trait connection_factory<C:connection> {
@@ -22,7 +22,7 @@ trait connection_factory<C:connection> {
 type my_connection_factory = ();
 
 impl connection for () {
-    fn read(&self) -> int { 43 }
+    fn read(&self) -> isize { 43 }
 }
 
 impl connection_factory<my_connection> for my_connection_factory {
index 96203ba47793a42d319ad6271e8803b89a1358bc..2f33621e36c701a0542203bab422aa75a9f3fd90 100644 (file)
@@ -14,8 +14,8 @@ trait Trait<T> {
 
 #[derive(Copy)]
 struct Struct {
-    x: int,
-    y: int,
+    x: isize,
+    y: isize,
 }
 
 impl Trait<&'static str> for Struct {
index 6f2fc8ba79aea7e71e42133b15e607a18ed13b59..de0a2e9e4d458ba83a8697d65909120df326642b 100644 (file)
@@ -19,8 +19,8 @@ trait Trait {
 
 #[derive(Copy)]
 struct Struct {
-    x: int,
-    y: int,
+    x: isize,
+    y: isize,
 }
 
 impl Trait for Struct {
index 49ac66167cd8f038a896cf0f6f6e875b4cd057b5..4fedbba81f41a46458f3d935a1359b1278b8c468 100644 (file)
@@ -15,7 +15,7 @@ trait A<T> {
     fn g(&self, x: T) -> T { x }
 }
 
-impl A<int> for int { }
+impl A<isize> for isize { }
 
 fn f<T, V: A<T>>(i: V, j: T) -> T {
     i.g(j)
index abf135a668576f93b27516fe7ce8b99b10f66b16..4f749cbd3fdbd198851a74e4d9c0e73250df67f6 100644 (file)
@@ -15,7 +15,7 @@ trait A {
     fn g<T>(&self, x: T, y: T) -> (T, T) { (x, y) }
 }
 
-impl A for int { }
+impl A for isize { }
 
 fn f<T, V: A>(i: V, j: T, k: T) -> (T, T) {
     i.g(j, k)
index ba94fc4cd3601bc196b2568d07f4d46318c888c7..6774569cd252ab5147b57cd107f6a0cd2fec2f86 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait A<T> {
-    fn g(&self, x: uint) -> uint { x }
+    fn g(&self, x: usize) -> usize { x }
     fn h(&self, x: T) { }
 }
 
-impl<T> A<T> for int { }
+impl<T> A<T> for isize { }
 
-fn f<T, V: A<T>>(i: V, j: uint) -> uint {
+fn f<T, V: A<T>>(i: V, j: usize) -> usize {
     i.g(j)
 }
 
 pub fn main () {
-    assert_eq!(f::<f64, int>(0, 2), 2);
-    assert_eq!(f::<uint, int>(0, 2), 2);
+    assert_eq!(f::<f64, isize>(0, 2), 2);
+    assert_eq!(f::<usize, isize>(0, 2), 2);
 }
index 4f1127c0b09494be6c99fdcd0e196f5a19fdfc31..4107540a47145c86637fd73f8d2e4ce098327191 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait A {
-    fn g(&self) -> int { 10 }
+    fn g(&self) -> isize { 10 }
 }
 
-impl A for int { }
+impl A for isize { }
 
 fn f<T:A>(i: T) {
     assert_eq!(i.g(), 10);
index b3e83f747a395b7260baf3fd3546196687ca369b..d4ed72704001690073c8c7f9312a29c770736f45 100644 (file)
@@ -14,8 +14,8 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "trait_default_method_xc_aux" as aux;
-extern crate "trait_default_method_xc_aux_2" as aux2;
+extern crate trait_default_method_xc_aux as aux;
+extern crate trait_default_method_xc_aux_2 as aux2;
 use aux::A;
 use aux2::{a_struct, welp};
 
index eb2a75f62fb81f0c019db6f2927e8606febf454b..65e8c53a25ec592e058b7ce02219133e736a1193 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "trait_default_method_xc_aux" as aux;
+extern crate trait_default_method_xc_aux as aux;
 use aux::{A, TestEquality, Something};
 use aux::B;
 
@@ -20,16 +20,16 @@ fn f<T: aux::A>(i: T) {
     assert_eq!(i.g(), 10);
 }
 
-fn welp<T>(i: int, _x: &T) -> int {
+fn welp<T>(i: isize, _x: &T) -> isize {
     i.g()
 }
 
 mod stuff {
-    pub struct thing { pub x: int }
+    pub struct thing { pub x: isize }
 }
 
 impl A for stuff::thing {
-    fn f(&self) -> int { 10 }
+    fn f(&self) -> isize { 10 }
 }
 
 fn g<T, U, V: B<T>>(i: V, j: T, k: U) -> (T, U) {
@@ -69,7 +69,7 @@ pub fn main() {
 
     assert_eq!(0.thing(3.14f64, 1), (3.14f64, 1));
     assert_eq!(B::staticthing(&0, 3.14f64, 1), (3.14f64, 1));
-    assert_eq!(B::<f64>::staticthing::<int>(&0, 3.14, 1), (3.14, 1));
+    assert_eq!(B::<f64>::staticthing::<isize>(&0, 3.14, 1), (3.14, 1));
 
     assert_eq!(g(0, 3.14f64, 1), (3.14f64, 1));
     assert_eq!(g(false, 3.14f64, 1), (3.14, 1));
index 2a5f9b80e9d82f006f084f4296b7e33c5a254f1b..6ef0dacee746ad0728a099ea5478c69b30a00418 100644 (file)
@@ -15,7 +15,7 @@
 trait to_str {
     fn to_string_(&self) -> String;
 }
-impl to_str for int {
+impl to_str for isize {
     fn to_string_(&self) -> String { self.to_string() }
 }
 impl to_str for String {
@@ -47,7 +47,7 @@ fn bar<U:to_str,T:map<U>>(x: T) -> Vec<String> {
 
 pub fn main() {
     assert_eq!(foo(vec!(1)), ["hi".to_string()]);
-    assert_eq!(bar::<int, Vec<int> >(vec!(4, 5)), ["4".to_string(), "5".to_string()]);
+    assert_eq!(bar::<isize, Vec<isize> >(vec!(4, 5)), ["4".to_string(), "5".to_string()]);
     assert_eq!(bar::<String, Vec<String> >(vec!("x".to_string(), "y".to_string())),
                ["x".to_string(), "y".to_string()]);
     assert_eq!(bar::<(), Vec<()>>(vec!(())), ["()".to_string()]);
index 0caa4c2d2d2b316812d2cc4523285bc02fd689aa..95fd7bda474baa867d8bc5f6431205240f9b8a4b 100644 (file)
@@ -16,7 +16,7 @@
 extern crate traitimpl;
 use traitimpl::Bar;
 
-static mut COUNT: uint = 1;
+static mut COUNT: usize = 1;
 
 trait T {
     fn t(&self) {}
@@ -31,7 +31,7 @@ fn bar() {
     }
 }
 
-impl T for int {}
+impl T for isize {}
 
 struct Foo;
 impl<'a> Bar<'a> for Foo {}
index 9db1af230d5f2bb6931a7a03643a5cb4d13096fd..128be2993ec1db26fda867ecfbf8536b94321de7 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "trait_inheritance_auto_xc_2_aux" as aux;
+extern crate trait_inheritance_auto_xc_2_aux as aux;
 
 // aux defines impls of Foo, Bar and Baz for A
 use aux::{Foo, Bar, Baz, A};
index b58839931b0c5f47e1dee692e09d679331954f42..827674c81adc1678ed661db9a1534ce2394876f4 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-extern crate "trait_inheritance_auto_xc_aux" as aux;
+extern crate trait_inheritance_auto_xc_aux as aux;
 
 use aux::{Foo, Bar, Baz, Quux};
 
-struct A { x: int }
+struct A { x: isize }
 
-impl Foo for A { fn f(&self) -> int { 10 } }
-impl Bar for A { fn g(&self) -> int { 20 } }
-impl Baz for A { fn h(&self) -> int { 30 } }
+impl Foo for A { fn f(&self) -> isize { 10 } }
+impl Bar for A { fn g(&self) -> isize { 20 } }
+impl Baz for A { fn h(&self) -> isize { 30 } }
 
 fn f<T:Quux>(a: &T) {
     assert_eq!(a.f(), 10);
index dfd541c6932d41bc194b4cd91986a11ccd176f50..1b72736cde439e7c4eb9668a25b3d1402c2deda4 100644 (file)
 
 impl<T:Foo + Bar + Baz> Quux for T { }
 
-trait Foo { fn f(&self) -> int; }
-trait Bar { fn g(&self) -> int; }
-trait Baz { fn h(&self) -> int; }
+trait Foo { fn f(&self) -> isize; }
+trait Bar { fn g(&self) -> isize; }
+trait Baz { fn h(&self) -> isize; }
 
 trait Quux: Foo + Bar + Baz { }
 
-struct A { x: int }
+struct A { x: isize }
 
-impl Foo for A { fn f(&self) -> int { 10 } }
-impl Bar for A { fn g(&self) -> int { 20 } }
-impl Baz for A { fn h(&self) -> int { 30 } }
+impl Foo for A { fn f(&self) -> isize { 10 } }
+impl Bar for A { fn g(&self) -> isize { 20 } }
+impl Baz for A { fn h(&self) -> isize { 30 } }
 
 fn f<T:Quux>(a: &T) {
     assert_eq!(a.f(), 10);
index c62941a517490fc4ce9b2a348da3dfca92950bb2..c8df12392faf4ee23fd31cab6ecf051b0d1fa6d4 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-trait Foo { fn f(&self) -> int; }
-trait Bar : Foo { fn g(&self) -> int; }
+trait Foo { fn f(&self) -> isize; }
+trait Bar : Foo { fn g(&self) -> isize; }
 
-struct A { x: int }
+struct A { x: isize }
 
-impl Foo for A { fn f(&self) -> int { 10 } }
-impl Bar for A { fn g(&self) -> int { 20 } }
+impl Foo for A { fn f(&self) -> isize { 10 } }
+impl Bar for A { fn g(&self) -> isize { 20 } }
 
 // Call a function on Foo, given a T: Bar
-fn gg<T:Bar>(a: &T) -> int {
+fn gg<T:Bar>(a: &T) -> isize {
     a.f()
 }
 
index 2ee3a2ec124ec829c009aee3cc789c667ceb64fb..fcd6143579c12b9762f553010fe5e00fa5f2b17d 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-trait Foo { fn f(&self) -> int; }
-trait Bar : Foo { fn g(&self) -> int; }
-trait Baz : Bar { fn h(&self) -> int; }
+trait Foo { fn f(&self) -> isize; }
+trait Bar : Foo { fn g(&self) -> isize; }
+trait Baz : Bar { fn h(&self) -> isize; }
 
-struct A { x: int }
+struct A { x: isize }
 
-impl Foo for A { fn f(&self) -> int { 10 } }
-impl Bar for A { fn g(&self) -> int { 20 } }
-impl Baz for A { fn h(&self) -> int { 30 } }
+impl Foo for A { fn f(&self) -> isize { 10 } }
+impl Bar for A { fn g(&self) -> isize { 20 } }
+impl Baz for A { fn h(&self) -> isize { 30 } }
 
 // Call a function on Foo, given a T: Baz,
 // which is inherited via Bar
-fn gg<T:Baz>(a: &T) -> int {
+fn gg<T:Baz>(a: &T) -> isize {
     a.f()
 }
 
index 5afdc60b0e83ab6ea354ae869564c8271fa7be63..3996ae850e84ef9a925fcf839a7c645663547b18 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait Foo {
-    fn f(&self) -> int;
+    fn f(&self) -> isize;
 }
 
 trait Bar : Foo {
-    fn g(&self) -> int;
+    fn g(&self) -> isize;
 }
 
 struct A {
-    x: int
+    x: isize
 }
 
 impl Foo for A {
-    fn f(&self) -> int { 10 }
+    fn f(&self) -> isize { 10 }
 }
 
 impl Bar for A {
-    fn g(&self) -> int { 20 }
+    fn g(&self) -> isize { 20 }
 }
 
 pub fn main() {
index 84ffb395588dd9bceb9869053eb233662c111d4c..7784ed2f26ae90398929d6f69e88dd68a3afdc1d 100644 (file)
 // pretty-expanded FIXME #23616
 
 trait Foo {
-    fn f(&self) -> int;
+    fn f(&self) -> isize;
 }
 
 trait Bar : Foo {
-    fn g(&self) -> int;
+    fn g(&self) -> isize;
 }
 
 struct A {
-    x: int
+    x: isize
 }
 
 impl Foo for A {
-    fn f(&self) -> int { 10 }
+    fn f(&self) -> isize { 10 }
 }
 
 impl Bar for A {
-    fn g(&self) -> int { 20 }
+    fn g(&self) -> isize { 20 }
 }
 
 pub fn main() {
index 8de867eff9082dcdbfbfb201b7b29f5c80ff45f4..c665c35b418c0b9654751c0a5250f6e1149a1dce 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-extern crate "trait_inheritance_cross_trait_call_xc_aux" as aux;
+extern crate trait_inheritance_cross_trait_call_xc_aux as aux;
 
 use aux::Foo;
 
 trait Bar : Foo {
-    fn g(&self) -> int;
+    fn g(&self) -> isize;
 }
 
 impl Bar for aux::A {
-    fn g(&self) -> int { self.f() }
+    fn g(&self) -> isize { self.f() }
 }
 
 pub fn main() {
index 88645a36b6ee8da1e2120ff7da75d73bb7b4802a..418986f961e5878806fbccc3aefa8e2566943313 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-trait Foo { fn f(&self) -> int; }
-trait Bar : Foo { fn g(&self) -> int; }
+trait Foo { fn f(&self) -> isize; }
+trait Bar : Foo { fn g(&self) -> isize; }
 
-struct A { x: int }
+struct A { x: isize }
 
-impl Foo for A { fn f(&self) -> int { 10 } }
+impl Foo for A { fn f(&self) -> isize { 10 } }
 
 impl Bar for A {
     // Testing that this impl can call the impl of Foo
-    fn g(&self) -> int { self.f() }
+    fn g(&self) -> isize { self.f() }
 }
 
 pub fn main() {
index 69f97d8d6526dd89d34870156d77ffed20bf46ba..07b1a79110f63fbaf957000b71dfcb195eb085ce 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-trait A { fn a(&self) -> int; }
-trait B: A { fn b(&self) -> int; }
-trait C: A { fn c(&self) -> int; }
-trait D: B + C { fn d(&self) -> int; }
+trait A { fn a(&self) -> isize; }
+trait B: A { fn b(&self) -> isize; }
+trait C: A { fn c(&self) -> isize; }
+trait D: B + C { fn d(&self) -> isize; }
 
 struct S { bogus: () }
 
-impl A for S { fn a(&self) -> int { 10 } }
-impl B for S { fn b(&self) -> int { 20 } }
-impl C for S { fn c(&self) -> int { 30 } }
-impl D for S { fn d(&self) -> int { 40 } }
+impl A for S { fn a(&self) -> isize { 10 } }
+impl B for S { fn b(&self) -> isize { 20 } }
+impl C for S { fn c(&self) -> isize { 30 } }
+impl D for S { fn d(&self) -> isize { 40 } }
 
 fn f<T:D>(x: &T) {
     assert_eq!(x.a(), 10);
index 47c8726c3e7f8f4b95544d8a01d297e6232bb993..b89246269542e445084a30fe5aeb69bec86774f8 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-trait A { fn a(&self) -> int; }
-trait B: A { fn b(&self) -> int; }
-trait C: A { fn c(&self) -> int; }
+trait A { fn a(&self) -> isize; }
+trait B: A { fn b(&self) -> isize; }
+trait C: A { fn c(&self) -> isize; }
 
 struct S { bogus: () }
 
-impl A for S { fn a(&self) -> int { 10 } }
-impl B for S { fn b(&self) -> int { 20 } }
-impl C for S { fn c(&self) -> int { 30 } }
+impl A for S { fn a(&self) -> isize { 10 } }
+impl B for S { fn b(&self) -> isize { 20 } }
+impl C for S { fn c(&self) -> isize { 30 } }
 
 // Both B and C inherit from A
 fn f<T:B + C>(x: &T) {
index da57d9a4e97c057f3d66190fa591d00b78163eb5..37803edb752b1807d8230a223637fda0fd32a3ef 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-trait A { fn a(&self) -> int; }
-trait B: A { fn b(&self) -> int; }
-trait C: A { fn c(&self) -> int; }
+trait A { fn a(&self) -> isize; }
+trait B: A { fn b(&self) -> isize; }
+trait C: A { fn c(&self) -> isize; }
 
 struct S { bogus: () }
 
-impl A for S { fn a(&self) -> int { 10 } }
-impl B for S { fn b(&self) -> int { 20 } }
-impl C for S { fn c(&self) -> int { 30 } }
+impl A for S { fn a(&self) -> isize { 10 } }
+impl B for S { fn b(&self) -> isize { 20 } }
+impl C for S { fn c(&self) -> isize { 30 } }
 
 // Multiple type params, multiple levels of inheritance
 fn f<X:A,Y:B,Z:C>(x: &X, y: &Y, z: &Z) {
index a4b0d5b88ca5a2959fbe0464f826117e3cf2ffda..b7f9534935697b4f20afa7ff4ac60a92b078cee0 100644 (file)
@@ -18,7 +18,7 @@
 use std::num::NumCast;
 
 pub trait Num {
-    fn from_int(i: int) -> Self;
+    fn from_int(i: isize) -> Self;
     fn gt(&self, other: &Self) -> bool;
 }
 
index df751a6d00461d69c401ada8c9aa9f3a1f169a8f..773fc387a2a34370bbff8732a942ad621c2d4755 100644 (file)
@@ -21,13 +21,13 @@ impl TypeExt for u8 {}
 impl TypeExt for u16 {}
 impl TypeExt for u32 {}
 impl TypeExt for u64 {}
-impl TypeExt for uint {}
+impl TypeExt for usize {}
 
 impl TypeExt for i8 {}
 impl TypeExt for i16 {}
 impl TypeExt for i32 {}
 impl TypeExt for i64 {}
-impl TypeExt for int {}
+impl TypeExt for isize {}
 
 impl TypeExt for f32 {}
 impl TypeExt for f64 {}
@@ -39,13 +39,13 @@ impl NumExt for u8 {}
 impl NumExt for u16 {}
 impl NumExt for u32 {}
 impl NumExt for u64 {}
-impl NumExt for uint {}
+impl NumExt for usize {}
 
 impl NumExt for i8 {}
 impl NumExt for i16 {}
 impl NumExt for i32 {}
 impl NumExt for i64 {}
-impl NumExt for int {}
+impl NumExt for isize {}
 
 impl NumExt for f32 {}
 impl NumExt for f64 {}
@@ -57,7 +57,7 @@ impl UnSignedExt for u8 {}
 impl UnSignedExt for u16 {}
 impl UnSignedExt for u32 {}
 impl UnSignedExt for u64 {}
-impl UnSignedExt for uint {}
+impl UnSignedExt for usize {}
 
 
 pub trait SignedExt: NumExt {}
@@ -66,7 +66,7 @@ impl SignedExt for i8 {}
 impl SignedExt for i16 {}
 impl SignedExt for i32 {}
 impl SignedExt for i64 {}
-impl SignedExt for int {}
+impl SignedExt for isize {}
 
 impl SignedExt for f32 {}
 impl SignedExt for f64 {}
@@ -78,13 +78,13 @@ impl IntegerExt for u8 {}
 impl IntegerExt for u16 {}
 impl IntegerExt for u32 {}
 impl IntegerExt for u64 {}
-impl IntegerExt for uint {}
+impl IntegerExt for usize {}
 
 impl IntegerExt for i8 {}
 impl IntegerExt for i16 {}
 impl IntegerExt for i32 {}
 impl IntegerExt for i64 {}
-impl IntegerExt for int {}
+impl IntegerExt for isize {}
 
 
 pub trait FloatExt: NumExt {}
index cce9bd3c7146d5da8020ef19ac81d211994f5143..b2c3900bc0282886157664c1b0c5144a353d93ad 100644 (file)
 pub trait NumExt: PartialEq + NumCast {}
 
 impl NumExt for f32 {}
-impl NumExt for int {}
+impl NumExt for isize {}
 
 fn num_eq_one<T:NumExt>() -> T {
     NumCast::from(1).unwrap()
 }
 
 pub fn main() {
-    num_eq_one::<int>(); // you need to actually use the function to trigger the ICE
+    num_eq_one::<isize>(); // you need to actually use the function to trigger the ICE
 }
index 4cd9fbeba9c1d59d5713480eefa5ff6ed2fb5c40..9c1f585fe450ba406be509fc36274c02b403a82e 100644 (file)
@@ -13,7 +13,7 @@
 trait MyNum : PartialEq { }
 
 #[derive(Debug)]
-struct MyInt { val: int }
+struct MyInt { val: isize }
 
 impl PartialEq for MyInt {
     fn eq(&self, other: &MyInt) -> bool { self.val == other.val }
@@ -26,7 +26,7 @@ fn f<T:MyNum>(x: T, y: T) -> bool {
     return x == y;
 }
 
-fn mi(v: int) -> MyInt { MyInt { val: v } }
+fn mi(v: isize) -> MyInt { MyInt { val: v } }
 
 pub fn main() {
     let (x, y, z) = (mi(3), mi(5), mi(3));
index 20d6817fcddf07973680633807f75adf50f3ef93..f44c6927c87e082b5ce8b89289adee91ddf71c33 100644 (file)
@@ -19,7 +19,7 @@ fn f<T:MyNum>(x: T, y: T) -> (T, T, T) {
     return (x.clone() + y.clone(), x.clone() - y.clone(), x * y);
 }
 
-fn mi(v: int) -> MyInt { MyInt { val: v } }
+fn mi(v: isize) -> MyInt { MyInt { val: v } }
 
 pub fn main() {
     let (x, y) = (mi(3), mi(5));
index 893f782cba4369dc16e5f2987c24bdc74acfb211..b7d0400dd892b334f979682f5c607544c0e08eae 100644 (file)
@@ -14,7 +14,7 @@
 trait MyNum : Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + PartialEq + Clone { }
 
 #[derive(Clone, Debug)]
-struct MyInt { val: int }
+struct MyInt { val: isize }
 
 impl Add for MyInt {
     type Output = MyInt;
@@ -45,7 +45,7 @@ fn f<T:MyNum>(x: T, y: T) -> (T, T, T) {
     return (x.clone() + y.clone(), x.clone() - y.clone(), x * y);
 }
 
-fn mi(v: int) -> MyInt { MyInt { val: v } }
+fn mi(v: isize) -> MyInt { MyInt { val: v } }
 
 pub fn main() {
     let (x, y) = (mi(3), mi(5));
index 07b0929968dfeedeca924963e2954b57511cd784..7d975da4a2491b204648192c6ab5f1f76b27bf1f 100644 (file)
@@ -17,7 +17,7 @@ trait Bar : Foo<Self> {
 }
 
 struct S {
-    x: int
+    x: isize
 }
 
 impl Foo<S> for S {
index f06ae1104c08c873c1f6db1a76962fafadbd68e8..ff89b1ee5d30df324ea8969c7fdb5564299a4dc2 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-trait Foo { fn f(&self) -> int; }
-trait Bar : Foo { fn g(&self) -> int; }
+trait Foo { fn f(&self) -> isize; }
+trait Bar : Foo { fn g(&self) -> isize; }
 
-struct A { x: int }
+struct A { x: isize }
 
-impl Foo for A { fn f(&self) -> int { 10 } }
-impl Bar for A { fn g(&self) -> int { 20 } }
+impl Foo for A { fn f(&self) -> isize { 10 } }
+impl Bar for A { fn g(&self) -> isize { 20 } }
 
-fn ff<T:Foo>(a: &T) -> int {
+fn ff<T:Foo>(a: &T) -> isize {
     a.f()
 }
 
-fn gg<T:Bar>(a: &T) -> int {
+fn gg<T:Bar>(a: &T) -> isize {
     a.g()
 }
 
index cd486754e7845a9af06d7e7fda4a2ce697578166..9ed5fd0aaa53fb77b239a3ae3b59b66623090c79 100644 (file)
 // pretty-expanded FIXME #23616
 
 pub trait MyNum {
-    fn from_int(int) -> Self;
+    fn from_int(isize) -> Self;
 }
 
 pub trait NumExt: MyNum { }
 
-struct S { v: int }
+struct S { v: isize }
 
 impl MyNum for S {
-    fn from_int(i: int) -> S {
+    fn from_int(i: isize) -> S {
         S {
             v: i
         }
index 86bfe0aa5c84cd9cf685041f13674634d0ed04ec..9fe9d7fce7af5c66d712f97b2f6ed7eb842ab4ea 100644 (file)
 pub trait MyEq : ::std::marker::MarkerTrait { }
 
 pub trait MyNum : ::std::marker::MarkerTrait {
-    fn from_int(int) -> Self;
+    fn from_int(isize) -> Self;
 }
 
 pub trait NumExt: MyEq + MyNum { }
 
-struct S { v: int }
+struct S { v: isize }
 
 impl MyEq for S { }
 
 impl MyNum for S {
-    fn from_int(i: int) -> S {
+    fn from_int(i: isize) -> S {
         S {
             v: i
         }
index d7cddbe62ca5c8b060d7c0ab849d2e5a9abddc1d..d35a937a5733d703978c1e9c6878df8c2899c762 100644 (file)
@@ -16,7 +16,7 @@ pub trait Add<RHS,Result> {
 
 trait MyNum : Add<Self,Self> { }
 
-struct MyInt { val: int }
+struct MyInt { val: isize }
 
 impl Add<MyInt, MyInt> for MyInt {
     fn add(&self, other: &MyInt) -> MyInt { mi(self.val + other.val) }
@@ -28,7 +28,7 @@ fn f<T:MyNum>(x: T, y: T) -> T {
     return x.add(&y);
 }
 
-fn mi(v: int) -> MyInt { MyInt { val: v } }
+fn mi(v: isize) -> MyInt { MyInt { val: v } }
 
 pub fn main() {
     let (x, y) = (mi(3), mi(5));
index 5949308a7ebc1393abdbd0b3e20864a1a51fec2f..e0be5759503c6bde71f4d28501d2ac07ce45e9fd 100644 (file)
@@ -20,7 +20,7 @@ trait Add<RHS,Result>: Panda<RHS> {
 
 trait MyNum : Add<Self,Self> { }
 
-struct MyInt { val: int }
+struct MyInt { val: isize }
 
 impl Panda<MyInt> for MyInt {
     fn chomp(&self, bamboo: &MyInt) -> MyInt {
@@ -38,7 +38,7 @@ fn f<T:MyNum>(x: T, y: T) -> T {
     return x.add(&y).chomp(&y);
 }
 
-fn mi(v: int) -> MyInt { MyInt { val: v } }
+fn mi(v: isize) -> MyInt { MyInt { val: v } }
 
 pub fn main() {
     let (x, y) = (mi(3), mi(5));
index 225e0ee90eb4fb590e0cfce58771f1845c853fbd..8c8b9232dee8c445378f6df7fab62d097c8107f9 100644 (file)
@@ -11,9 +11,9 @@
 // pretty-expanded FIXME #23616
 
 mod traits {
-    pub trait Foo { fn f(&self) -> int; }
+    pub trait Foo { fn f(&self) -> isize; }
 
-    impl Foo for int { fn f(&self) -> int { 10 } }
+    impl Foo for isize { fn f(&self) -> isize { 10 } }
 }
 
 trait Quux: traits::Foo { }
index 2885afd7bd622a8f308a307d6e36ea4621fb24cd..9e721836d631909853c0909e223a161c33c90c78 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-trait Foo { fn f(&self) -> int; }
-trait Bar { fn g(&self) -> int; }
-trait Baz { fn h(&self) -> int; }
+trait Foo { fn f(&self) -> isize; }
+trait Bar { fn g(&self) -> isize; }
+trait Baz { fn h(&self) -> isize; }
 
 trait Quux: Foo + Bar + Baz { }
 
-struct A { x: int }
+struct A { x: isize }
 
-impl Foo for A { fn f(&self) -> int { 10 } }
-impl Bar for A { fn g(&self) -> int { 20 } }
-impl Baz for A { fn h(&self) -> int { 30 } }
+impl Foo for A { fn f(&self) -> isize { 10 } }
+impl Bar for A { fn g(&self) -> isize { 20 } }
+impl Baz for A { fn h(&self) -> isize { 30 } }
 impl Quux for A {}
 
 fn f<T:Quux + Foo + Bar + Baz>(a: &T) {
index b528cbe271a4728c1aeafc1f8cd14c723d3248b5..63246b870cb594323b21cacf3797aac90c6431fc 100644 (file)
@@ -42,11 +42,11 @@ pub fn step(&self) {
 enum Type<T> { Constant(T) }
 
 trait Trait<K,V> {
-    fn method(&self,Type<(K,V)>) -> int;
+    fn method(&self,Type<(K,V)>) -> isize;
 }
 
 impl<V> Trait<u8,V> for () {
-    fn method(&self, _x: Type<(u8,V)>) -> int { 0 }
+    fn method(&self, _x: Type<(u8,V)>) -> isize { 0 }
 }
 
 pub fn main() {
index 412fb6625e33fa062a720975a05c927c20303cbc..95311e62e634338360ff068de8cdd00930a2ba21 100644 (file)
@@ -9,15 +9,15 @@
 // except according to those terms.
 
 trait Foo {
-    fn f(&self) -> int;
+    fn f(&self) -> isize;
 }
 
 struct A {
-    x: int
+    x: isize
 }
 
 impl Foo for A {
-    fn f(&self) -> int {
+    fn f(&self) -> isize {
         println!("Today's number is {}", self.x);
         return self.x;
     }
index 28f683c485ae47f38ad8f0d128f1c96f357a7d70..ada79399561a9265dc9411c16d06d39668811184 100644 (file)
 
 use lib::Foo;
 
-struct Bar { x: int }
+struct Bar { x: isize }
 unsafe impl Foo for Bar {
-    fn foo(&self) -> int { self.x }
+    fn foo(&self) -> isize { self.x }
 }
 
-fn take_foo<F:Foo>(f: &F) -> int { f.foo() }
+fn take_foo<F:Foo>(f: &F) -> isize { f.foo() }
 
 fn main() {
-    let x: int = 22;
+    let x: isize = 22;
     assert_eq!(22, take_foo(&x));
 
     let x: Bar = Bar { x: 23 };
index c5679627fc34267ff8bf85cf64f7935f19c8447f..3cd23aeaf27a532b96761b2fb1d72af1e80528ca 100644 (file)
 // pretty-expanded FIXME #23616
 
 unsafe trait Foo {
-    fn foo(&self) -> int;
+    fn foo(&self) -> isize;
 }
 
-unsafe impl Foo for int {
-    fn foo(&self) -> int { *self }
+unsafe impl Foo for isize {
+    fn foo(&self) -> isize { *self }
 }
 
-fn take_foo<F:Foo>(f: &F) -> int { f.foo() }
+fn take_foo<F:Foo>(f: &F) -> isize { f.foo() }
 
 fn main() {
-    let x: int = 22;
+    let x: isize = 22;
     assert_eq!(22, take_foo(&x));
 }
index ea8a5a28c34ff64414ab1b877a2cafb3e005719e..3d84092c062e6b5117169b7a69b048f5fa54ae84 100644 (file)
@@ -15,7 +15,7 @@ trait to_str {
     fn to_string_(&self) -> String;
 }
 
-impl to_str for int {
+impl to_str for isize {
     fn to_string_(&self) -> String { self.to_string() }
 }
 
index 6b2c5093c83bd3758a14f5336238942dfd5e8623..34a79c4cf31a05c547384312b15d8674bd75db25 100644 (file)
@@ -27,8 +27,8 @@ fn do_get2(&self) -> (T, T) {
 
 }
 
-impl Getter<int> for int {
-    fn do_get(&self) -> int { *self }
+impl Getter<isize> for isize {
+    fn do_get(&self) -> isize { *self }
 }
 
 impl<T: Clone> Getter<T> for Option<T> {
index c9f003a022068c19268fd0cb28af776f016a8ac1..65a48844620de2154683b1cc9e4d023bc13cabd8 100644 (file)
 ///////////////////////////////////////////////////////////////////////////
 
 struct SomeGoableThing {
-    counter: Rc<Cell<int>>
+    counter: Rc<Cell<isize>>
 }
 
 impl Go for SomeGoableThing {
-    fn go(&self, arg: int) {
+    fn go(&self, arg: isize) {
         self.counter.set(self.counter.get() + arg);
     }
 }
@@ -38,11 +38,11 @@ fn go(&self, arg: int) {
 ///////////////////////////////////////////////////////////////////////////
 
 struct SomeGoOnceableThing {
-    counter: Rc<Cell<int>>
+    counter: Rc<Cell<isize>>
 }
 
 impl GoOnce for SomeGoOnceableThing {
-    fn go_once(self, arg: int) {
+    fn go_once(self, arg: isize) {
         self.counter.set(self.counter.get() + arg);
     }
 }
index 29b52ea5897c980e4c75bfb4c8d8434fa0a391a6..3f61eb47233b6dc731196181e84d3fd411f72360 100644 (file)
@@ -14,7 +14,7 @@
 #![allow(unused_variable)]
 
 trait Foo {
-    fn foo(&self, mut v: int) { v = 1; }
+    fn foo(&self, mut v: isize) { v = 1; }
 }
 
 pub fn main() {}
index 270b95452187a309da9a009ca4ac3cbdb327a9c9..d9536108f4df3d77db84dc3178cf0c1fa5e7390e 100644 (file)
@@ -17,7 +17,7 @@ fn scratch(&self) -> bool { self.purr() }
     fn purr(&self) -> bool { true }
 }
 
-impl Cat for int {
+impl Cat for isize {
     fn meow(&self) -> bool {
         self.scratch()
     }
index 474632a7ffa58028e80bd8d5100ebc4013c15ac0..0e71fcab9d1476e461c21c0746994abe6cb5d3b2 100644 (file)
@@ -17,7 +17,7 @@ trait Cat {
     fn purr(&self) -> bool { true }
 }
 
-impl Cat for int {
+impl Cat for isize {
     fn meow(&self) -> bool {
         self.scratch()
     }
index f81b753acbb9b21dfb160ac663359c02857772dc..1f1d1a46cf973cb4627ee333dfd9470b2b054c7b 100644 (file)
@@ -30,7 +30,7 @@ fn convert(&self) -> i16 {
     }
 }
 
-fn test<T,U>(_: T, _: U, t_size: uint, u_size: uint)
+fn test<T,U>(_: T, _: U, t_size: usize, u_size: usize)
 where T : Convert<U>
 {
     assert_eq!(mem::size_of::<T>(), t_size);
index d8314005082c7e0291ae2b25fc613e33736b542e..bd705a909b0ec5a1d15df3335576fbfc791b6db7 100644 (file)
@@ -15,6 +15,6 @@
 
 pub fn main() {
     unsafe {
-        ::std::mem::transmute::<[int; 1],int>([1])
+        ::std::mem::transmute::<[isize; 1],isize>([1])
     };
 }
index 396d6911cf23565bfc8f75549829b8e29181711b..50687756e2abe34f8f7b794bbf23271ead6253db 100644 (file)
@@ -10,9 +10,9 @@
 
 // pretty-expanded FIXME #23616
 
-type point = (int, int);
+type point = (isize, isize);
 
-fn f(p: point, x: int, y: int) {
+fn f(p: point, x: isize, y: isize) {
     let (a, b) = p;
     assert_eq!(a, x);
     assert_eq!(b, y);
index 7d6f42c7ddcf5d57e23b78fc15be6b89223115cf..395531d1573a1a4fb8f49b0c3f749c9593ef73cb 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-struct Foo<'a>(&'a [int]);
+struct Foo<'a>(&'a [isize]);
 
 fn main() {
-    let x: &[int] = &[1, 2, 3];
+    let x: &[isize] = &[1, 2, 3];
     let y = (x,);
     assert_eq!(y.0, x);
 
-    let x: &[int] = &[1, 2, 3];
+    let x: &[isize] = &[1, 2, 3];
     let y = Foo(x);
     assert_eq!(y.0, x);
 }
index 004e7e33d4e141aee57c6a9bef754ea78022bc45..a70b49296fa1937be1f3bc01900dfb1a6e5d1b9f 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct Point(int, int);
+struct Point(isize, isize);
 
 fn main() {
     let mut x = Point(3, 2);
index 7773bf647f9988acd389129e038dd889a9dd8c07..c40adf2260dd4df196f9637a4b852d2f99742ecc 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #[derive(Debug)]
-struct Foo(int, int);
+struct Foo(isize, isize);
 
 pub fn main() {
     let x = Foo(1, 2);
index bcd62e92b4619d1edfe8972ab279a4ce13ca4b4a..90cf94666deda229e64c89b9fede310b8fc54569 100644 (file)
@@ -9,13 +9,13 @@
 // except according to those terms.
 
 #[derive(PartialEq, Debug)]
-struct Foo(int);
+struct Foo(isize);
 #[derive(PartialEq, Debug)]
-struct Bar(int, int);
+struct Bar(isize, isize);
 
 pub fn main() {
-    let f: fn(int) -> Foo = Foo;
-    let g: fn(int, int) -> Bar = Bar;
+    let f: fn(isize) -> Foo = Foo;
+    let g: fn(isize, isize) -> Bar = Bar;
     assert_eq!(f(42), Foo(42));
     assert_eq!(g(4, 7), Bar(4, 7));
 }
index ec7675abf833738c4278267255bf14ec9d174369..4b0eb26cf9484c75808e4983855c260938fcc6b3 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct Foo(int, int);
+struct Foo(isize, isize);
 
 pub fn main() {
     let x = Foo(1, 2);
index f50b04059532d009c37b0c1d6d389078113b667d..b37302fce0830aabf09ab3e16239d87ee12db4e1 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct Foo(int, int);
+struct Foo(isize, isize);
 
 pub fn main() {
     let x = Foo(1, 2);
index 5b25dcbb347a70292c37d7663b96de69a93e59f8..fa2c9768fcb5008f5b69e3a2db9d6fab7bd6c31b 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct Foo(int, int, int);
+struct Foo(isize, isize, isize);
 
 pub fn main() {
 }
index cc97959e41a3d6b81e97605af7a8008f5a2b423a..4ba7e786ec8d25fcc7c5c3e2c9e90fd87c7c2831 100644 (file)
@@ -20,7 +20,7 @@ struct Foo<T> {
 
 pub fn main() {
     unsafe {
-        assert_eq!(type_name::<int>(), "isize");
-        assert_eq!(type_name::<Foo<uint>>(), "Foo<usize>");
+        assert_eq!(type_name::<isize>(), "isize");
+        assert_eq!(type_name::<Foo<usize>>(), "Foo<usize>");
     }
 }
index 5670c45b68ad00a2865149ed54f42cef3c20fd98..ec5aa2863a0c58494feb2567eee9d0a3fbe28f8f 100644 (file)
 
 #![feature(unboxed_closures, core)]
 
-use std::any::TypeId;
+use std::any::{Any, TypeId};
 
 fn main() {
     // Bare fns
     {
-        let a = TypeId::of::<fn(&'static int, &'static int)>();
-        let b = TypeId::of::<for<'a> fn(&'static int, &'a int)>();
-        let c = TypeId::of::<for<'a, 'b> fn(&'a int, &'b int)>();
-        let d = TypeId::of::<for<'a, 'b> fn(&'b int, &'a int)>();
+        let a = TypeId::of::<fn(&'static isize, &'static isize)>();
+        let b = TypeId::of::<for<'a> fn(&'static isize, &'a isize)>();
+        let c = TypeId::of::<for<'a, 'b> fn(&'a isize, &'b isize)>();
+        let d = TypeId::of::<for<'a, 'b> fn(&'b isize, &'a isize)>();
         assert!(a != b);
         assert!(a != c);
         assert!(a != d);
@@ -32,16 +32,16 @@ fn main() {
         assert_eq!(c, d);
 
         // Make sure De Bruijn indices are handled correctly
-        let e = TypeId::of::<for<'a> fn(fn(&'a int) -> &'a int)>();
-        let f = TypeId::of::<fn(for<'a> fn(&'a int) -> &'a int)>();
+        let e = TypeId::of::<for<'a> fn(fn(&'a isize) -> &'a isize)>();
+        let f = TypeId::of::<fn(for<'a> fn(&'a isize) -> &'a isize)>();
         assert!(e != f);
     }
     // Boxed unboxed closures
     {
-        let a = TypeId::of::<Box<Fn(&'static int, &'static int)>>();
-        let b = TypeId::of::<Box<for<'a> Fn(&'static int, &'a int)>>();
-        let c = TypeId::of::<Box<for<'a, 'b> Fn(&'a int, &'b int)>>();
-        let d = TypeId::of::<Box<for<'a, 'b> Fn(&'b int, &'a int)>>();
+        let a = TypeId::of::<Box<Fn(&'static isize, &'static isize)>>();
+        let b = TypeId::of::<Box<for<'a> Fn(&'static isize, &'a isize)>>();
+        let c = TypeId::of::<Box<for<'a, 'b> Fn(&'a isize, &'b isize)>>();
+        let d = TypeId::of::<Box<for<'a, 'b> Fn(&'b isize, &'a isize)>>();
         assert!(a != b);
         assert!(a != c);
         assert!(a != d);
@@ -50,20 +50,20 @@ fn main() {
         assert_eq!(c, d);
 
         // Make sure De Bruijn indices are handled correctly
-        let e = TypeId::of::<Box<for<'a> Fn(Box<Fn(&'a int) -> &'a int>)>>();
-        let f = TypeId::of::<Box<Fn(Box<for<'a> Fn(&'a int) -> &'a int>)>>();
+        let e = TypeId::of::<Box<for<'a> Fn(Box<Fn(&'a isize) -> &'a isize>)>>();
+        let f = TypeId::of::<Box<Fn(Box<for<'a> Fn(&'a isize) -> &'a isize>)>>();
         assert!(e != f);
     }
     // Raw unboxed closures
     // Note that every unboxed closure has its own anonymous type,
     // so no two IDs should equal each other, even when compatible
     {
-        let a = id(|_: &int, _: &int| {});
-        let b = id(|_: &int, _: &int| {});
+        let a = id(|_: &isize, _: &isize| {});
+        let b = id(|_: &isize, _: &isize| {});
         assert!(a != b);
     }
 
-    fn id<T:'static>(_: T) -> TypeId {
+    fn id<T:Any>(_: T) -> TypeId {
         TypeId::of::<T>()
     }
 }
index 02b7fa50a2da82b9f040cf242189692ed27cde8e..7e2360caa93ff3d8c925a08aefda2bd764946d87 100644 (file)
@@ -14,7 +14,7 @@
 
 mod a {
     pub mod b {
-        pub type t = int;
+        pub type t = isize;
 
         pub fn foo() { let _x: t = 10; }
     }
index 00b7b0c359b8875dbc8a0063dbe909e95ff15d0f..c03ddd0c649f51b8c501c017ae4615d9635d6e9f 100644 (file)
@@ -10,8 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
-struct A { a: int }
+struct A { a: isize }
 
-fn a(a: A) -> int { return a.a; }
+fn a(a: A) -> isize { return a.a; }
 
 pub fn main() { let x: A = A {a: 1}; assert!((a(x) == 1)); }
index 5b8e78ba71ab67e6bf3906fce1f240474a74e616..381f1b6825739859af992baaaba6834d54ba778d 100644 (file)
@@ -18,14 +18,14 @@ fn s_foo<T>(_shared: T) { }
 fn u_foo<T:Send>(_unique: T) { }
 
 struct r {
-  i: int,
+  i: isize,
 }
 
 impl Drop for r {
     fn drop(&mut self) {}
 }
 
-fn r(i:int) -> r {
+fn r(i:isize) -> r {
     r {
         i: i
     }
index 3bfc61ddcbea54dd57766fff7d94f5a1b9a82c5e..fea2bd978eb9692975f3dff98d7f1b7a4c44b3e0 100644 (file)
 
 struct S<T> {
     a: T,
-    b: uint,
+    b: usize,
 }
 
-fn range_<F>(lo: uint, hi: uint, mut it: F) where F: FnMut(uint) {
+fn range_<F>(lo: usize, hi: usize, mut it: F) where F: FnMut(usize) {
     let mut lo_ = lo;
     while lo_ < hi { it(lo_); lo_ += 1; }
 }
 
-fn create_index<T>(_index: Vec<S<T>> , _hash_fn: extern fn(T) -> uint) {
+fn create_index<T>(_index: Vec<S<T>> , _hash_fn: extern fn(T) -> usize) {
     range_(0, 256, |_i| {
         let _bucket: Vec<T> = Vec::new();
     })
index 3b97cbbaa9050deb5e7d4a228b5a1cbcb0fd03ca..67ead80c89b2562394b5a6ac53dfae2025bbda52 100644 (file)
@@ -10,8 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
-fn f(a: *const int) -> *const int { return a; }
+fn f(a: *const isize) -> *const isize { return a; }
 
-fn g(a: *const int) -> *const int { let b = f(a); return b; }
+fn g(a: *const isize) -> *const isize { let b = f(a); return b; }
 
 pub fn main() { return; }
index 286a12100c45200d73120f625e82c3ae6a61f299..8c1251feea26984819fcfd6a8a194ce167873ddb 100644 (file)
@@ -16,9 +16,9 @@ struct t {a: u8, b: i8}
 struct u {a: u8, b: i8, c: u8}
 struct v {a: u8, b: i8, c: v2, d: u32}
 struct v2 {u: char, v: u8}
-struct w {a: int, b: ()}
-struct x {a: int, b: (), c: ()}
-struct y {x: int}
+struct w {a: isize, b: ()}
+struct x {a: isize, b: (), c: ()}
+struct y {x: isize}
 
 enum e1 {
     a(u8, u32), b(u32), c
@@ -32,26 +32,26 @@ enum e3 {
 }
 
 pub fn main() {
-    assert_eq!(size_of::<u8>(), 1 as uint);
-    assert_eq!(size_of::<u32>(), 4 as uint);
-    assert_eq!(size_of::<char>(), 4 as uint);
-    assert_eq!(size_of::<i8>(), 1 as uint);
-    assert_eq!(size_of::<i32>(), 4 as uint);
-    assert_eq!(size_of::<t>(), 2 as uint);
-    assert_eq!(size_of::<u>(), 3 as uint);
+    assert_eq!(size_of::<u8>(), 1 as usize);
+    assert_eq!(size_of::<u32>(), 4 as usize);
+    assert_eq!(size_of::<char>(), 4 as usize);
+    assert_eq!(size_of::<i8>(), 1 as usize);
+    assert_eq!(size_of::<i32>(), 4 as usize);
+    assert_eq!(size_of::<t>(), 2 as usize);
+    assert_eq!(size_of::<u>(), 3 as usize);
     // Alignment causes padding before the char and the u32.
 
     assert!(size_of::<v>() ==
-                16 as uint);
-    assert_eq!(size_of::<int>(), size_of::<uint>());
-    assert_eq!(size_of::<w>(), size_of::<int>());
-    assert_eq!(size_of::<x>(), size_of::<int>());
-    assert_eq!(size_of::<int>(), size_of::<y>());
+                16 as usize);
+    assert_eq!(size_of::<isize>(), size_of::<usize>());
+    assert_eq!(size_of::<w>(), size_of::<isize>());
+    assert_eq!(size_of::<x>(), size_of::<isize>());
+    assert_eq!(size_of::<isize>(), size_of::<y>());
 
     // Make sure enum types are the appropriate size, mostly
     // around ensuring alignment is handled properly
 
-    assert_eq!(size_of::<e1>(), 8 as uint);
-    assert_eq!(size_of::<e2>(), 8 as uint);
-    assert_eq!(size_of::<e3>(), 4 as uint);
+    assert_eq!(size_of::<e1>(), 8 as usize);
+    assert_eq!(size_of::<e2>(), 8 as usize);
+    assert_eq!(size_of::<e3>(), 4 as usize);
 }
index 6a684fe9d8c68673f45fbf2a88c3a15df4dadfd6..2da8b0a508ae4106add05fbef11cbe0feb5fe9af 100644 (file)
@@ -11,7 +11,7 @@
 // pretty-expanded FIXME #23616
 
 enum T {
-    A(int),
+    A(isize),
     B(f64)
 }
 
index 9dfd25b4fc4e18adf167c51a3e1dad6db0bd3b92..7a143ce5889155c9be6451631b2263627d0bf214 100644 (file)
@@ -15,8 +15,8 @@
 
 #![feature(hash, core)]
 
-extern crate "typeid-intrinsic" as other1;
-extern crate "typeid-intrinsic2" as other2;
+extern crate typeid_intrinsic as other1;
+extern crate typeid_intrinsic2 as other2;
 
 use std::hash::{self, SipHasher};
 use std::any::TypeId;
@@ -48,18 +48,18 @@ pub fn main() {
         assert_eq!(other1::id_G(), other2::id_G());
         assert_eq!(other1::id_H(), other2::id_H());
 
-        assert_eq!(TypeId::of::<int>(), other2::foo::<int>());
-        assert_eq!(TypeId::of::<int>(), other1::foo::<int>());
-        assert_eq!(other2::foo::<int>(), other1::foo::<int>());
+        assert_eq!(TypeId::of::<isize>(), other2::foo::<isize>());
+        assert_eq!(TypeId::of::<isize>(), other1::foo::<isize>());
+        assert_eq!(other2::foo::<isize>(), other1::foo::<isize>());
         assert_eq!(TypeId::of::<A>(), other2::foo::<A>());
         assert_eq!(TypeId::of::<A>(), other1::foo::<A>());
         assert_eq!(other2::foo::<A>(), other1::foo::<A>());
     }
 
     // sanity test of TypeId
-    let (a, b, c) = (TypeId::of::<uint>(), TypeId::of::<&'static str>(),
+    let (a, b, c) = (TypeId::of::<usize>(), TypeId::of::<&'static str>(),
                      TypeId::of::<Test>());
-    let (d, e, f) = (TypeId::of::<uint>(), TypeId::of::<&'static str>(),
+    let (d, e, f) = (TypeId::of::<usize>(), TypeId::of::<&'static str>(),
                      TypeId::of::<Test>());
 
     assert!(a != b);
@@ -71,7 +71,7 @@ pub fn main() {
     assert_eq!(c, f);
 
     // check it has a hash
-    let (a, b) = (TypeId::of::<uint>(), TypeId::of::<uint>());
+    let (a, b) = (TypeId::of::<usize>(), TypeId::of::<usize>());
 
     assert_eq!(hash::hash::<TypeId, SipHasher>(&a),
                hash::hash::<TypeId, SipHasher>(&b));
index 810148b012d13c11a0627373bdf81915407d3bef..3a1394447f624d5c405f7ff16a1a8b1c4e9a7e61 100644 (file)
 
 #[derive(Copy)]
 struct Foo {
-    f: int,
+    f: isize,
 }
 
 impl Foo {
-    fn foo(self: Foo, x: int) -> int {
+    fn foo(self: Foo, x: isize) -> isize {
         self.f + x
     }
-    fn bar(self: &Foo, x: int) -> int {
+    fn bar(self: &Foo, x: isize) -> isize {
         self.f + x
     }
-    fn baz(self: Box<Foo>, x: int) -> int {
+    fn baz(self: Box<Foo>, x: isize) -> isize {
         self.f + x
     }
 }
@@ -34,13 +34,13 @@ struct Bar<T> {
 }
 
 impl<T> Bar<T> {
-    fn foo(self: Bar<T>, x: int) -> int {
+    fn foo(self: Bar<T>, x: isize) -> isize {
         x
     }
-    fn bar<'a>(self: &'a Bar<T>, x: int) -> int {
+    fn bar<'a>(self: &'a Bar<T>, x: isize) -> isize {
         x
     }
-    fn baz(self: Bar<T>, x: int) -> int {
+    fn baz(self: Bar<T>, x: isize) -> isize {
         x
     }
 }
@@ -54,6 +54,6 @@ fn main() {
         f: 1,
     };
     println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2));
-    let bar: Box<Bar<int>> = bar;
+    let bar: Box<Bar<isize>> = bar;
     println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2));
 }
index 79ca103a29449748eefb4d5156508eab0f5eede8..a894d762979300f4f088cd1eec22a74e2686533f 100644 (file)
@@ -13,4 +13,4 @@
 
 // pretty-expanded FIXME #23616
 
-pub fn main() { let _x: uint = 10 as uint; }
+pub fn main() { let _x: usize = 10 as usize; }
index adbbf1aec9afc1204f15cf58d0c0c96b1fba8c6a..9d685e0263f22c007988fb52cda9d2f8e9e6a0e9 100644 (file)
@@ -26,7 +26,7 @@ pub fn main() {
     println!("{}", d_neg);
 
     let e = 1;
-    let e_neg: int = -e;
+    let e_neg: isize = -e;
     println!("{}", e_neg);
 
     // intentional overflows
@@ -48,6 +48,6 @@ pub fn main() {
     println!("{}", i_neg);
 
     let j = 1;
-    let j_neg: uint = -j;
+    let j_neg: usize = -j;
     println!("{}", j_neg);
 }
index b98f5549b012b62cab35193937a2362ac6628d56..9ca8e5403a1302fc93e995e50140da65cacc2a2e 100644 (file)
 
 #![feature(lang_items, unboxed_closures)]
 
-fn a<F:Fn(int, int) -> int>(f: F) -> int {
+fn a<F:Fn(isize, isize) -> isize>(f: F) -> isize {
     f(1, 2)
 }
 
-fn b<F:FnMut(int, int) -> int>(mut f: F) -> int {
+fn b<F:FnMut(isize, isize) -> isize>(mut f: F) -> isize {
     f(3, 4)
 }
 
-fn c<F:FnOnce(int, int) -> int>(f: F) -> int {
+fn c<F:FnOnce(isize, isize) -> isize>(f: F) -> isize {
     f(5, 6)
 }
 
 fn main() {
-    let z: int = 7;
-    assert_eq!(a(move |x: int, y| x + y + z), 10);
-    assert_eq!(b(move |x: int, y| x + y + z), 14);
-    assert_eq!(c(move |x: int, y| x + y + z), 18);
+    let z: isize = 7;
+    assert_eq!(a(move |x: isize, y| x + y + z), 10);
+    assert_eq!(b(move |x: isize, y| x + y + z), 14);
+    assert_eq!(c(move |x: isize, y| x + y + z), 18);
 }
index 7eb5e988424fc34ad66d0807a511df3857c3d0de..6e92850ac2e592a942c044d3b300b6e84d1873c2 100644 (file)
 
 use std::ops::FnMut;
 
-fn call_with_2(x: &fn(int) -> int) -> int
+fn call_with_2(x: &fn(isize) -> isize) -> isize
 {
     x(2) // look ma, no `*`
 }
 
-fn subtract_22(x: int) -> int { x - 22 }
+fn subtract_22(x: isize) -> isize { x - 22 }
 
 pub fn main() {
-    let subtract_22: fn(int) -> int = subtract_22;
+    let subtract_22: fn(isize) -> isize = subtract_22;
     let z = call_with_2(&subtract_22);
     assert_eq!(z, -20);
 }
index 6e8253d49ea09f15f81954f6ee3de32b32615da7..402b4b0b85d4b36355eda1d368de0a405f785c5c 100644 (file)
@@ -16,8 +16,8 @@
 
 use std::ops::FnMut;
 
-fn call_with_2<F>(x: &mut F) -> int
-    where F : FnMut(int) -> int
+fn call_with_2<F>(x: &mut F) -> isize
+    where F : FnMut(isize) -> isize
 {
     x(2) // look ma, no `*`
 }
index 271381f520e383e10a649835c24cf2545fda4c11..c82026235c2a35a12a028fb885ab06f88e0b7b7f 100644 (file)
@@ -15,7 +15,7 @@
 
 use std::ops::FnMut;
 
-fn make_adder(x: int) -> Box<FnMut(int)->int + 'static> {
+fn make_adder(x: isize) -> Box<FnMut(isize)->isize + 'static> {
     // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     Box::new(move |y| { x + y })
 }
index e51e35d2c65c952ba58d12f2a30c308367bbdd3b..629da1091ac5bfd153ab101b515ea6c1cbda5a10 100644 (file)
@@ -13,7 +13,7 @@
 
 use std::ops::FnMut;
 
-fn make_adder(x: int) -> Box<FnMut(int)->int + 'static> {
+fn make_adder(x: isize) -> Box<FnMut(isize)->isize + 'static> {
     // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
     Box::new(move |y| { x + y })
 }
index 31a901756717e20657e779a3de4eb23d392bf16d..0c255c6bd6cb807beec069f05257cfba8b29cb3d 100644 (file)
@@ -14,7 +14,7 @@
 // aux-build:unboxed-closures-cross-crate.rs
 // pretty-expanded FIXME #23616
 
-extern crate "unboxed-closures-cross-crate" as ubcc;
+extern crate unboxed_closures_cross_crate as ubcc;
 
 fn main() {
     assert_eq!(ubcc::has_closures(), 2_usize);
index 156934f909d9d6e44dd9b415ba4e3c6af1162e11..f0c6c0ff453ffc39141897ae02832f10e6d5082e 100644 (file)
 
 #![feature(unboxed_closures)]
 
-static mut DROP_COUNT: uint = 0;
+static mut DROP_COUNT: usize = 0;
 
-fn drop_count() -> uint {
+fn drop_count() -> usize {
     unsafe {
         DROP_COUNT
     }
 }
 
 struct Droppable {
-    x: int,
+    x: isize,
 }
 
 impl Droppable {
@@ -43,27 +43,27 @@ fn drop(&mut self) {
     }
 }
 
-fn a<F:Fn(int, int) -> int>(f: F) -> int {
+fn a<F:Fn(isize, isize) -> isize>(f: F) -> isize {
     f(1, 2)
 }
 
-fn b<F:FnMut(int, int) -> int>(mut f: F) -> int {
+fn b<F:FnMut(isize, isize) -> isize>(mut f: F) -> isize {
     f(3, 4)
 }
 
-fn c<F:FnOnce(int, int) -> int>(f: F) -> int {
+fn c<F:FnOnce(isize, isize) -> isize>(f: F) -> isize {
     f(5, 6)
 }
 
 fn test_fn() {
     {
-        a(move |a: int, b| { a + b });
+        a(move |a: isize, b| { a + b });
     }
     assert_eq!(drop_count(), 0);
 
     {
         let z = &Droppable::new();
-        a(move |a: int, b| { z; a + b });
+        a(move |a: isize, b| { z; a + b });
         assert_eq!(drop_count(), 0);
     }
     assert_eq!(drop_count(), 1);
@@ -71,7 +71,7 @@ fn test_fn() {
     {
         let z = &Droppable::new();
         let zz = &Droppable::new();
-        a(move |a: int, b| { z; zz; a + b });
+        a(move |a: isize, b| { z; zz; a + b });
         assert_eq!(drop_count(), 1);
     }
     assert_eq!(drop_count(), 3);
@@ -79,13 +79,13 @@ fn test_fn() {
 
 fn test_fn_mut() {
     {
-        b(move |a: int, b| { a + b });
+        b(move |a: isize, b| { a + b });
     }
     assert_eq!(drop_count(), 3);
 
     {
         let z = &Droppable::new();
-        b(move |a: int, b| { z; a + b });
+        b(move |a: isize, b| { z; a + b });
         assert_eq!(drop_count(), 3);
     }
     assert_eq!(drop_count(), 4);
@@ -93,7 +93,7 @@ fn test_fn_mut() {
     {
         let z = &Droppable::new();
         let zz = &Droppable::new();
-        b(move |a: int, b| { z; zz; a + b });
+        b(move |a: isize, b| { z; zz; a + b });
         assert_eq!(drop_count(), 4);
     }
     assert_eq!(drop_count(), 6);
@@ -101,13 +101,13 @@ fn test_fn_mut() {
 
 fn test_fn_once() {
     {
-        c(move |a: int, b| { a + b });
+        c(move |a: isize, b| { a + b });
     }
     assert_eq!(drop_count(), 6);
 
     {
         let z = Droppable::new();
-        c(move |a: int, b| { z; a + b });
+        c(move |a: isize, b| { z; a + b });
         assert_eq!(drop_count(), 7);
     }
     assert_eq!(drop_count(), 7);
@@ -115,7 +115,7 @@ fn test_fn_once() {
     {
         let z = Droppable::new();
         let zz = Droppable::new();
-        c(move |a: int, b| { z; zz; a + b });
+        c(move |a: isize, b| { z; zz; a + b });
         assert_eq!(drop_count(), 9);
     }
     assert_eq!(drop_count(), 9);
index 83fe32f9ca3a5be466e62d940b437d3032663e4b..4af4b320d0e4ea82c4af88ca2f33128592e44b3e 100644 (file)
 
 use std::ops::{Fn,FnMut,FnOnce};
 
-fn square(x: &int) -> int { (*x) * (*x) }
+fn square(x: &isize) -> isize { (*x) * (*x) }
 
-fn call_it<F:Fn(&int)->int>(f: &F, x: int) -> int {
+fn call_it<F:Fn(&isize)->isize>(f: &F, x: isize) -> isize {
     (*f)(&x)
 }
 
-fn call_it_boxed(f: &Fn(&int) -> int, x: int) -> int {
+fn call_it_boxed(f: &Fn(&isize) -> isize, x: isize) -> isize {
     f.call((&x,))
 }
 
-fn call_it_mut<F:FnMut(&int)->int>(f: &mut F, x: int) -> int {
+fn call_it_mut<F:FnMut(&isize)->isize>(f: &mut F, x: isize) -> isize {
     (*f)(&x)
 }
 
-fn call_it_once<F:FnOnce(&int)->int>(f: F, x: int) -> int {
+fn call_it_once<F:FnOnce(&isize)->isize>(f: F, x: isize) -> isize {
     f(&x)
 }
 
index 570627374b747f899f4e6a1ce1175359d6dba03b..d711ebbe4b8c243d957dd55d5ddd04128d33cece 100644 (file)
 
 use std::ops::{Fn,FnMut,FnOnce};
 
-fn square(x: int) -> int { x * x }
+fn square(x: isize) -> isize { x * x }
 
-fn call_it<F:Fn(int)->int>(f: &F, x: int) -> int {
+fn call_it<F:Fn(isize)->isize>(f: &F, x: isize) -> isize {
     f(x)
 }
 
-fn call_it_mut<F:FnMut(int)->int>(f: &mut F, x: int) -> int {
+fn call_it_mut<F:FnMut(isize)->isize>(f: &mut F, x: isize) -> isize {
     f(x)
 }
 
-fn call_it_once<F:FnOnce(int)->int>(f: F, x: int) -> int {
+fn call_it_once<F:FnOnce(isize)->isize>(f: F, x: isize) -> isize {
     f(x)
 }
 
index 790272c257ccba77131257ce4c7bb180a67a1ad7..d408612f9b8569e2846a5b91b950b901f38dabdd 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Test that we are able to infer that the type of `x` is `int` based
+// Test that we are able to infer that the type of `x` is `isize` based
 // on the expected type from the object.
 
 // pretty-expanded FIXME #23616
@@ -24,5 +24,5 @@ fn doit<T,F>(val: T, f: &F)
 }
 
 pub fn main() {
-    doit(0, &|x /*: int*/ | { x.to_int(); });
+    doit(0, &|x /*: isize*/ | { x.to_int(); });
 }
index 8f4e4f353f34188ce125e60fce940f1e47cb6926..c1e1ff3cd8e93738c5404c50c52f5b0ac65d72b4 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Test that we are able to infer that the type of `x` is `int` based
+// Test that we are able to infer that the type of `x` is `isize` based
 // on the expected type from the object.
 
 // pretty-expanded FIXME #23616
@@ -20,5 +20,5 @@
 fn doit<T>(val: T, f: &Fn(T)) { f.call((val,)) }
 
 pub fn main() {
-    doit(0, &|x /*: int*/ | { x.to_int(); });
+    doit(0, &|x /*: isize*/ | { x.to_int(); });
 }
index 1b8c9af8d4e09651b3f7a73998b5d5334f485061..99e2149de966a3e759a19c2d31a75fcba12dc020 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Test that we are able to infer that the type of `x` is `int` based
+// Test that we are able to infer that the type of `x` is `isize` based
 // on the expected type from the object.
 
 // pretty-expanded FIXME #23616
@@ -24,5 +24,5 @@ fn doit<T,F>(val: T, f: &F)
 }
 
 pub fn main() {
-    doit(0, &|x /*: int*/ | { x.to_int(); });
+    doit(0, &|x /*: isize*/ | { x.to_int(); });
 }
index e221811948c3b85cf26baebc5227ba45a0b1cce6..f16f757c6456f91952feab04138a70ffa5898711 100644 (file)
@@ -32,7 +32,7 @@ fn bar<'a, T:Clone+'a> (t: T) -> Box<FnMut()->T + 'a> {
     assert_eq!(f.call_mut(()), &x);
 
     #[derive(Clone, Copy, Debug, PartialEq)]
-    struct Foo(uint, &'static str);
+    struct Foo(usize, &'static str);
 
     let x = Foo(42, "forty-two");
     let mut f = bar(x);
index 88baa16c9457f4614eea28770592d418d2657710..1aca3174e1fed9cc5514d2331486e941ae77cac2 100644 (file)
@@ -18,7 +18,7 @@
 // mutably so we do not get a spurious warning about it not needing to
 // be declared mutable (issue #18336 and #18769)
 
-fn set(x: &mut uint) { *x = 42; }
+fn set(x: &mut usize) { *x = 42; }
 
 fn main() {
     {
index e8c977b4ed1d78a13d3260599cad3c13311abd42..313fb67637e08d4448d9ab72638200895aea9ba5 100644 (file)
 
 fn main() {
     // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
-    let task: Box<Fn(int) -> int> = Box::new(|x| x);
+    let task: Box<Fn(isize) -> isize> = Box::new(|x| x);
     task.call((0, ));
 
-    let mut task: Box<FnMut(int) -> int> = Box::new(|x| x);
+    let mut task: Box<FnMut(isize) -> isize> = Box::new(|x| x);
     task(0);
 
     call(|x| x, 22);
 }
 
-fn call<F:FnOnce(int) -> int>(f: F, x: int) -> int {
+fn call<F:FnOnce(isize) -> isize>(f: F, x: isize) -> isize {
     f(x)
 }
index 9335bc936d94287733648d7cade5d7600d67ac4f..1443d305bce940f5d430a0a7d94dbae3c6911c1b 100644 (file)
@@ -15,7 +15,7 @@
 use std::ops::FnMut;
 
 pub fn main() {
-    let mut f = |x: int, y: int| -> int { x + y };
+    let mut f = |x: isize, y: isize| -> isize { x + y };
     let z = f(1, 2);
     assert_eq!(z, 3);
 }
index 1517698fc82dce979dff06011d4b1e810c70521a..65a26d14e120bd3aa1b8216be02baab881448d2e 100644 (file)
 
 #![feature(unboxed_closures)]
 
-fn a<F:Fn(int, int) -> int>(f: F) -> int {
+fn a<F:Fn(isize, isize) -> isize>(f: F) -> isize {
     f(1, 2)
 }
 
-fn b<F:FnMut(int, int) -> int>(mut f: F) -> int {
+fn b<F:FnMut(isize, isize) -> isize>(mut f: F) -> isize {
     f(3, 4)
 }
 
-fn c<F:FnOnce(int, int) -> int>(f: F) -> int {
+fn c<F:FnOnce(isize, isize) -> isize>(f: F) -> isize {
     f(5, 6)
 }
 
 fn main() {
     let z = 10;
-    assert_eq!(a(move |x: int, y| x + y + z), 13);
-    assert_eq!(b(move |x: int, y| x + y + z), 17);
-    assert_eq!(c(move |x: int, y| x + y + z), 21);
+    assert_eq!(a(move |x: isize, y| x + y + z), 13);
+    assert_eq!(b(move |x: isize, y| x + y + z), 17);
+    assert_eq!(c(move |x: isize, y| x + y + z), 21);
 }
index e827833bbb2108232cd5270690e756d36db5e3de..403b2ca9aaf39df74b95a18c234a7dafb49578b7 100644 (file)
@@ -32,6 +32,6 @@ pub fn replace_map<'a, T, F>(src: &mut T, prod: F) where F: FnOnce(T) -> T {
 pub fn main() {
     let mut a = 7;
     let b = &mut a;
-    replace_map(b, |x: uint| x * 2);
+    replace_map(b, |x: usize| x * 2);
     assert_eq!(*b, 14);
 }
index a0c2b6c0a220245770b0486f84050eddc04659fa..fceccb499c7b0e0baba97c09fca33260b2bfc405 100644 (file)
@@ -20,7 +20,7 @@
 // cross-crate
 
 pub fn main() {
-    fn count(st: &mut uint) -> Option<uint> {
+    fn count(st: &mut usize) -> Option<usize> {
         if *st < 10 {
             let ret = Some(*st);
             *st += 1;
index b8184b62db1e372f1bfcf78a448209bb2d19696f..01b55ebb8e26ef6aa191aa6c03a28dab8db3f777 100644 (file)
@@ -22,4 +22,4 @@ fn null<T>() -> *const T {
     }
 }
 
-pub fn main() { null::<int>(); }
+pub fn main() { null::<isize>(); }
index 49f552edd83922e14cb02e529ae142bdf4444abc..a6408128c3a28197f738afaa610306f9c1aa5ab8 100644 (file)
@@ -14,7 +14,7 @@
 #![feature(box_syntax)]
 
 struct X {
-    a: int
+    a: isize
 }
 
 trait Changer {
index 290adcfb0149df3198adca7af51a90afcc9e8d5c..8ee1b28ea2e7ebfeca8d78e4c0eeaaa332f957a7 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct J { j: int }
+struct J { j: isize }
 
 pub fn main() {
     let i: Box<_> = box J {
index 21433d6c39bfc5bb18ae958039e9fe2d98c5026f..ce5a2bed48de0e3bde72b17fe2a3f70c3f648107 100644 (file)
@@ -14,7 +14,7 @@
 #![feature(box_syntax)]
 
 pub fn main() {
-    enum t { t1(int), t2(int), }
+    enum t { t1(isize), t2(isize), }
 
     let _x: Box<_> = box t::t1(10);
 
index 6c8177e6cd8b3a0c00f2d0e4d56129044b45632c..7404e8887ebce1b0e9b889699f74b4c508e8ac1e 100644 (file)
@@ -12,9 +12,9 @@
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    let _: Box<int>;
+    let _: Box<isize>;
 }
 
-fn f(_i: Box<int>) -> Box<int> {
+fn f(_i: Box<isize>) -> Box<isize> {
     panic!();
 }
index 92fa8d7af66563301faa28e2566d2019bd0ea53c..87bc6f6639d653cee89858cd8537068ba10cbcce 100644 (file)
@@ -14,7 +14,7 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 
-struct Foo { a: int, b: int }
+struct Foo { a: isize, b: isize }
 
 pub fn main() {
     let box Foo{a, b} = box Foo{a: 100, b: 200};
index c79dc6a6cfdb3978d9da119cabf8c57fb7a8f15f..e608ab9b6367a1761abb9393bd425e04efe9c5b5 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn f(i: Box<int>) {
+fn f(i: Box<isize>) {
     assert_eq!(*i, 100);
 }
 
index 82d724831c335d3d6a669f19ff40026230f86811..f0d2abfe27cbcb14b988f6c240e58c20b47ee7b5 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn f(i: &mut Box<int>) {
+fn f(i: &mut Box<isize>) {
     *i = box 200;
 }
 
index a4687cae65360997a3c8bc813559db0caf5711c5..3d7ef31d020e7a9c22ce5c51422d67dc1e64eb7b 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn f(i: Box<int>) {
+fn f(i: Box<isize>) {
     assert_eq!(*i, 100);
 }
 
index 5e248ebeb3328f77c758437b1fafdb7adeb47f6e..bb1948bf3c81bca99b6bd82d7dc005c7946aabf9 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-fn f() -> Box<int> {
+fn f() -> Box<isize> {
     box 100
 }
 
index 4f02018346bdb6b9ae9b90c45b133a8af3249501..0762b37ff8b89dd8f2873d6462af9dbcdd3838bf 100644 (file)
@@ -12,7 +12,7 @@
 #![feature(box_syntax)]
 
 fn test1() {
-    enum bar { u(Box<int>), w(int), }
+    enum bar { u(Box<isize>), w(isize), }
 
     let x = bar::u(box 10);
     assert!(match x {
index 0677e6a8df3ca796d9ccfd761f07ecb09b139f12..4d120e7caf36528568335a8abab5b1d8ef8a6075 100644 (file)
@@ -18,7 +18,7 @@
 pub trait EventLoop { fn foo(&self) {} }
 
 pub struct UvEventLoop {
-    uvio: int
+    uvio: isize
 }
 
 impl EventLoop for UvEventLoop { }
index 9063f15e7e73ec7de9392a24978a1a9686ed0aeb..d16355af99fd55df392fb23e35251d76b768a9e1 100644 (file)
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 
-struct Foo {a: int, b: uint}
+struct Foo {a: isize, b: usize}
 
-enum bar { u(Box<Foo>), w(int), }
+enum bar { u(Box<Foo>), w(isize), }
 
 pub fn main() {
     assert!(match bar::u(box Foo{a: 10, b: 40}) {
-              bar::u(box Foo{a: a, b: b}) => { a + (b as int) }
+              bar::u(box Foo{a: a, b: b}) => { a + (b as isize) }
               _ => { 66 }
             } == 50);
 }
index 42a4b1a9c0cbfc5c11db1b5998e8f8955ce88dd0..648e9599a979e994dfbff2d9d86eea91ed96fe15 100644 (file)
@@ -11,7 +11,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-enum bar { u(Box<int>), w(int), }
+enum bar { u(Box<isize>), w(isize), }
 
 pub fn main() {
     assert!(match bar::u(box 10) {
index 6770fa5fb16ecd4342d162ce29ebf7b80bcb330d..7a09e241ca63983b429630a0f46118e49fc9e077 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-struct X { x: int }
+struct X { x: isize }
 
 pub fn main() {
     let x: Box<_> = box X {x: 1};
index 1fb39ee8ca7021a6ccc6373efd8b47e38ce07a3c..99a3b64105318fd11b01aea77c5cd347b0139034 100644 (file)
@@ -16,7 +16,7 @@
 use std::sync::mpsc::{channel, Sender};
 use std::thread;
 
-fn child(tx: &Sender<Box<uint>>, i: uint) {
+fn child(tx: &Sender<Box<usize>>, i: usize) {
     tx.send(box i).unwrap();
 }
 
index 64a6d40f2c8de19de5c8d4631d195d6da61d2494..d498a70be491eb64b463193761b388f99cd64633 100644 (file)
 
 // pretty-expanded FIXME #23616
 
-fn good(_a: &int) {
+fn good(_a: &isize) {
 }
 
-// unnamed argument &int is now parse x: &int
+// unnamed argument &isize is now parse x: &isize
 
-fn called<F>(_f: F) where F: FnOnce(&int) {
+fn called<F>(_f: F) where F: FnOnce(&isize) {
 }
 
 pub fn main() {
index 171f4cb8a891a0139ce0560e88041b4b4ee08706..75c7cabfcb6d392865d678a999d3616df6218d63 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn f(x: *const int) {
+fn f(x: *const isize) {
     unsafe {
         assert_eq!(*x, 3);
     }
index 9eee782a630cae5ee452478a600175dbd56e6b62..965ce6bad1668bf006e17383eef554ae43ceff86 100644 (file)
@@ -96,14 +96,14 @@ struct S2<X: ?Sized> {
     f: X,
 }
 struct S3<X: ?Sized> {
-    f1: int,
+    f1: isize,
     f2: X,
 }
 enum E<X: ?Sized> {
     V1(X),
     V2{x: X},
-    V3(int, X),
-    V4{u: int, x: X},
+    V3(isize, X),
+    V4{u: isize, x: X},
 }
 
 pub fn main() {
index 2821de6f1e75183ed177090c05aa3ae4f7c2080c..98594183a00d0e95c79df10781901db98f6a5c87 100644 (file)
@@ -11,6 +11,6 @@
 // Issue #1706
 // pretty-expanded FIXME #23616
 
-extern crate "std" as stdlib;
+extern crate std as stdlib;
 
 pub fn main() {}
index 2106da6d25f92d399c97ab8d56adf9093e155289..044472606a53090e0711386977283c61f68a2896 100644 (file)
 // pretty-expanded FIXME #23616
 
 mod foo {
-    pub fn x() -> int { return 1; }
+    pub fn x() -> isize { return 1; }
 }
 
 mod bar {
-    pub fn y() -> int { return 1; }
+    pub fn y() -> isize { return 1; }
 }
 
 pub fn main() { foo::x(); bar::y(); }
index 5f44b5723610dcb3f34ccf34d6986fe90538b431..38952334e4d58800c2fe90f985352443515c4e53 100644 (file)
@@ -12,6 +12,6 @@
 
 // pretty-expanded FIXME #23616
 
-impl foo for int { fn foo(&self) -> int { 10 } }
-trait foo { fn foo(&self) -> int; }
+impl foo for isize { fn foo(&self) -> isize { 10 } }
+trait foo { fn foo(&self) -> isize; }
 pub fn main() {}
index efa6a2c583421e13d1b35ec14d7cd6a397701721..9e606384f3fa1f1b058183335230b547fabf6ea5 100644 (file)
@@ -10,8 +10,8 @@
 
 
 
-fn foo<T>(o: myoption<T>) -> int {
-    let mut x: int = 5;
+fn foo<T>(o: myoption<T>) -> isize {
+    let mut x: isize = 5;
     match o {
         myoption::none::<T> => { }
         myoption::some::<T>(_t) => { x += 1; }
index f2b487b70341b367e3bdd3f3f4e11aed894a5e19..dc0a6a26bc0250d6f43d12cd87aafbc47c7428c9 100644 (file)
@@ -10,8 +10,8 @@
 
 
 
-fn foo<T>(o: myoption<T>) -> int {
-    let mut x: int;
+fn foo<T>(o: myoption<T>) -> isize {
+    let mut x: isize;
     match o {
         myoption::none::<T> => { panic!(); }
         myoption::some::<T>(_t) => { x = 5; }
index 446bb4a148e9e7ce2ef46ba205b63e765d4b7e0a..40ab4c86c6f253c76ff2f5f59adebe1c27b8ef76 100644 (file)
@@ -15,7 +15,7 @@
 #![no_std]
 
 extern crate std;
-extern crate "std" as zed;
+extern crate std as zed;
 
 use std::str;
 use zed::str as x;
@@ -24,4 +24,4 @@ mod baz {
 }
 
 #[start]
-pub fn start(_: int, _: *const *const u8) -> int { 0 }
+pub fn start(_: isize, _: *const *const u8) -> isize { 0 }
index 4be54bd7080d2eab3aa7d837d6768fd2e6f9ff28..07fd7b297b4247e29c0a82c36b2a36094df3b9a8 100644 (file)
@@ -18,14 +18,14 @@ pub fn main() {
     let y_diaeresis: char = 'ÿ'; // 0xff
     let pi: char = 'Π'; // 0x3a0
 
-    assert_eq!(yen as int, 0xa5);
-    assert_eq!(c_cedilla as int, 0xe7);
-    assert_eq!(thorn as int, 0xfe);
-    assert_eq!(y_diaeresis as int, 0xff);
-    assert_eq!(pi as int, 0x3a0);
+    assert_eq!(yen as isize, 0xa5);
+    assert_eq!(c_cedilla as isize, 0xe7);
+    assert_eq!(thorn as isize, 0xfe);
+    assert_eq!(y_diaeresis as isize, 0xff);
+    assert_eq!(pi as isize, 0x3a0);
 
-    assert_eq!(pi as int, '\u{3a0}' as int);
-    assert_eq!('\x0a' as int, '\n' as int);
+    assert_eq!(pi as isize, '\u{3a0}' as isize);
+    assert_eq!('\x0a' as isize, '\n' as isize);
 
     let bhutan: String = "འབྲུག་ཡུལ།".to_string();
     let japan: String = "日本".to_string();
@@ -40,14 +40,14 @@ pub fn main() {
     let austria_e: String = "\u{d6}sterreich".to_string();
 
     let oo: char = 'Ö';
-    assert_eq!(oo as int, 0xd6);
+    assert_eq!(oo as isize, 0xd6);
 
     fn check_str_eq(a: String, b: String) {
-        let mut i: int = 0;
+        let mut i: isize = 0;
         for ab in a.bytes() {
             println!("{}", i);
             println!("{}", ab);
-            let bb: u8 = b.as_bytes()[i as uint];
+            let bb: u8 = b.as_bytes()[i as usize];
             println!("{}", bb);
             assert_eq!(ab, bb);
             i += 1;
index beb2f4d996910b9fcbe55613e087888e42627e0f..b11b7e83eb6713e979e948c88febf567fc41c765 100644 (file)
@@ -22,7 +22,7 @@ pub fn main() {
     assert_eq!(საჭმელად_გემრიელი_სადილი(), 0);
 }
 
-fn საჭმელად_გემრიელი_სადილი() -> int {
+fn საჭმელად_გემრიელი_სადილი() -> isize {
 
     // Lunch in several languages.
 
index 34c9fb5038a58339cfbec83a744535a54fe5723d..6961cd4977d969bd73287f691bb850bb032342de 100644 (file)
@@ -11,8 +11,8 @@
 // pretty-expanded FIXME #23616
 
 enum Foo {
-    Bar { x: int },
-    Baz { y: int }
+    Bar { x: isize },
+    Baz { y: isize }
 }
 
 pub fn main() { }
index 870d48213c74c703d29e066505818d968f224c15..658c35ae8d5ea32047b87a0bea55b530a103901f 100644 (file)
@@ -13,9 +13,9 @@
 use std::vec;
 
 pub fn main() {
-    let a: Vec<int> = vec!(1, 2, 3, 4, 5);
-    let b: Vec<int> = vec!(6, 7, 8, 9, 0);
-    let mut v: Vec<int> = a;
+    let a: Vec<isize> = vec!(1, 2, 3, 4, 5);
+    let b: Vec<isize> = vec!(6, 7, 8, 9, 0);
+    let mut v: Vec<isize> = a;
     v.push_all(&b);
     println!("{}", v[9]);
     assert_eq!(v[0], 1);
index 23b1ff7417e40ab230bee95e67874a6452af0094..e88acb3838ba8ecd9ff1562132eebba31bfb9d64 100644 (file)
@@ -15,8 +15,8 @@
 
 pub fn main() {
     // Tests for indexing into box/& [T; n]
-    let x: [int; 3] = [1, 2, 3];
-    let mut x: Box<[int; 3]> = box x;
+    let x: [isize; 3] = [1, 2, 3];
+    let mut x: Box<[isize; 3]> = box x;
     assert!(x[0] == 1);
     assert!(x[1] == 2);
     assert!(x[2] == 3);
@@ -25,8 +25,8 @@ pub fn main() {
     assert!(x[1] == 45);
     assert!(x[2] == 3);
 
-    let mut x: [int; 3] = [1, 2, 3];
-    let x: &mut [int; 3] = &mut x;
+    let mut x: [isize; 3] = [1, 2, 3];
+    let x: &mut [isize; 3] = &mut x;
     assert!(x[0] == 1);
     assert!(x[1] == 2);
     assert!(x[2] == 3);
index bd196aa4e4e66781066f8f7709f9eed39418358d..4dadf53c772221649a0b5eb8eced2c8f7f9f624c 100644 (file)
@@ -13,7 +13,7 @@
 use std::mem::size_of;
 
 pub fn main() {
-    let x: [int; 4] = [1, 2, 3, 4];
+    let x: [isize; 4] = [1, 2, 3, 4];
     assert_eq!(x[0], 1);
     assert_eq!(x[1], 2);
     assert_eq!(x[2], 3);
index dec0b3eaa78fbca3085e22bbb3f58810d52c8754..7a8c0739efeb978b792575ecb333649702fae806 100644 (file)
@@ -10,7 +10,7 @@
 
 
 pub fn main() {
-    let mut later: Vec<int> ;
+    let mut later: Vec<isize> ;
     if true { later = vec!(1); } else { later = vec!(2); }
     println!("{}", later[0]);
 }
index 360cecb9e6a8ac5f0e383061b08eaffe3acaf687..948fe28cc621adf1c467f373ef80a4ee17f24ef4 100644 (file)
@@ -13,7 +13,7 @@
 #![feature(lang_items, start, no_std, core, libc, collections)]
 #![no_std]
 
-extern crate "std" as other;
+extern crate std as other;
 
 #[macro_use]
 extern crate core;
@@ -29,7 +29,7 @@
 // Issue #16806
 
 #[start]
-fn start(_argc: int, _argv: *const *const u8) -> int {
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
     let x: Vec<u8> = vec![0, 1, 2];
     match x.last() {
         Some(&2) => (),
index 8f38123fe2852b94119cf016ac79e6b25f118229..2b80ad81037f216710a5fc691287b2b7c6bd204d 100644 (file)
@@ -10,6 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
+#![feature(slice_patterns)]
+
 pub fn main() {
     let x = [1, 2, 3];
     match x {
index b03a9a64b21be21a0396e8666bf9ade8428eb307..1278eaf96a48c015c9b205352141bd7c794219ea 100644 (file)
@@ -11,6 +11,7 @@
 // pretty-expanded FIXME #23616
 
 #![feature(advanced_slice_patterns)]
+#![feature(slice_patterns)]
 
 fn a() {
     let x = [1, 2, 3];
index 494a9d658a1d71d7bf307aa17126596d328d8992..c375fc85bc1d35865cb251c0f6c5d8d3bd9af496 100644 (file)
@@ -11,6 +11,7 @@
 // pretty-expanded FIXME #23616
 
 #![feature(advanced_slice_patterns)]
+#![feature(slice_patterns)]
 
 fn foldl<T, U, F>(values: &[T],
                   initial: U,
index 64309906156ae8867db2120cde95e05a81a5c022..e7553c8e157e3ce3ba99771069d8d0fac65a472c 100644 (file)
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(slice_patterns)]
+
 pub fn main() {
     let x = &[1, 2, 3, 4, 5];
-    let x: &[int] = &[1, 2, 3, 4, 5];
+    let x: &[isize] = &[1, 2, 3, 4, 5];
     if !x.is_empty() {
         let el = match x {
             [1, ref tail..] => &tail[0],
index 306d200319dc2896532af8f3a2a15d28bd35ed96..b81bdda613f7ccc07d486b502d5cc04ce9029e02 100644 (file)
@@ -11,6 +11,7 @@
 // pretty-expanded FIXME #23616
 
 #![feature(advanced_slice_patterns)]
+#![feature(slice_patterns)]
 
 fn a() {
     let x = [1];
@@ -76,7 +77,7 @@ fn d() {
 }
 
 fn e() {
-    let x: &[int] = &[1, 2, 3];
+    let x: &[isize] = &[1, 2, 3];
     match x {
         [1, 2] => (),
         [..] => ()
index 11a96ca533f3c8b8b56f966576534f4bfb527fd0..a6ca02d4fa90d5c065e2ca93184184119dce7841 100644 (file)
@@ -10,4 +10,4 @@
 
 // pretty-expanded FIXME #23616
 
-pub fn main() { let _a = [0; 1 as uint]; }
+pub fn main() { let _a = [0; 1 as usize]; }
index 25dc5db5a6071f6ca1d64eb034d598410650d8d3..1d749d4963c5eb5eb9c601c602c34347912ed65d 100644 (file)
@@ -16,7 +16,7 @@
 
 // Make sure that destructors get run on slice literals
 struct foo<'a> {
-    x: &'a Cell<int>,
+    x: &'a Cell<isize>,
 }
 
 #[unsafe_destructor]
@@ -26,7 +26,7 @@ fn drop(&mut self) {
     }
 }
 
-fn foo(x: &Cell<int>) -> foo {
+fn foo(x: &Cell<isize>) -> foo {
     foo {
         x: x
     }
index 3ee0cf33e432c6ed48c72107dcbdcb20f2ee91c2..091e3f03e7ac7dabfae546407a66f55bcbe1fa6b 100644 (file)
@@ -11,6 +11,8 @@
 
 // pretty-expanded FIXME #23616
 
+#![feature(slice_patterns)]
+
 struct Foo {
     string: String
 }
index d34c6bd4d0b59a149ddd6f25e1e1faabd2328e8e..a9bb68395c425b422b8a523c829d999db51ead83 100644 (file)
@@ -14,7 +14,7 @@ pub fn main() {
     assert_eq!(format!("{:?}", vec!(0, 1)), "[0, 1]".to_string());
 
     let foo = vec!(3, 4);
-    let bar: &[int] = &[4, 5];
+    let bar: &[isize] = &[4, 5];
 
     assert_eq!(format!("{:?}", foo), "[3, 4]");
     assert_eq!(format!("{:?}", bar), "[4, 5]");
index ff4077b249de7aebb67851798a335ee226d8ca7c..ce20d452c403c126200777b8476eb31bd6d0d0cf 100644 (file)
 // pretty-expanded FIXME #23616
 
 pub fn main() {
-    let v: Vec<int> = vec!(10, 20);
+    let v: Vec<isize> = vec!(10, 20);
     assert_eq!(v[0], 10);
     assert_eq!(v[1], 20);
-    let mut x: uint = 0;
+    let mut x: usize = 0;
     assert_eq!(v[x], 10);
     assert_eq!(v[x + 1], 20);
     x = x + 1;
index eb5b75639d59640bd76cb0d4830d46937ca52471..10f71b3e12c251d34779a61edf10eedbbbe4ca1e 100644 (file)
@@ -13,4 +13,4 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-pub fn main() { let _quux: Box<Vec<uint>> = box Vec::new(); }
+pub fn main() { let _quux: Box<Vec<usize>> = box Vec::new(); }
index c22a584f6d45524ff3d1e462e0806d0eb46acdf7..81a3c94eec3137fd612863539d7f595f6268cf45 100644 (file)
@@ -16,7 +16,7 @@
 
 mod libc {
     extern {
-        pub fn malloc(size: int) -> *const u8;
+        pub fn malloc(size: isize) -> *const u8;
     }
 }
 
index ec346a248a99f49dfef1531e8e56c32794f6d8be..5a567758bf45f673b0e8dba0e8e7cb8a730ea58c 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "weak-lang-items" as other;
+extern crate weak_lang_items as other;
 
 use std::thread;
 
index 20e42575b277f9e03cec4c6f916fc5d16e95da5b..b28760e6c91fb2977f1dd2e1be697d49a842411f 100644 (file)
@@ -54,14 +54,14 @@ fn zombiejesus() {
 }
 
 fn notsure() {
-    let mut _x: int;
+    let mut _x: isize;
     let mut _y = (_x = 0) == (_x = 0);
     let mut _z = (_x = 0) < (_x = 0);
     let _a = (_x += 0) == (_x = 0);
     let _b = swap(&mut _y, &mut _z) == swap(&mut _y, &mut _z);
 }
 
-fn canttouchthis() -> uint {
+fn canttouchthis() -> usize {
     fn p() -> bool { true }
     let _a = (assert!((true)) == (assert!(p())));
     let _c = (assert!((p())) == ());
index 47066232b870fabb9c827d209ebaacfa5cd42f9c..cdb5e3fe1d4ae59e4d23d427eb31252985281b71 100644 (file)
 // pretty-expanded FIXME #23616
 
 pub struct Context<'tcx> {
-    vec: &'tcx Vec<int>
+    vec: &'tcx Vec<isize>
 }
 
-pub type Cmd<'a> = &'a int;
+pub type Cmd<'a> = &'a isize;
 
 pub type DecodeInlinedItem<'a> =
-    Box<for<'tcx> FnMut(Cmd, &Context<'tcx>) -> Result<&'tcx int, ()> + 'a>;
+    Box<for<'tcx> FnMut(Cmd, &Context<'tcx>) -> Result<&'tcx isize, ()> + 'a>;
 
 fn foo(d: DecodeInlinedItem) {
 }
index c73e5a774eb420eb5ee251f20b6d4ffa379cad43..b9f605ec548bc7fd29aa9e5dc50a9775be3e1bb0 100644 (file)
 
 trait TheTrait { fn dummy(&self) { } }
 
-impl TheTrait for &'static int { }
+impl TheTrait for &'static isize { }
 
 fn foo<'a,T>(_: &'a T) where &'a T : TheTrait { }
 
 fn bar<T>(_: &'static T) where &'static T : TheTrait { }
 
 fn main() {
-    static x: int = 1;
+    static x: isize = 1;
     foo(&x);
     bar(&x);
 }
index 1972b11d2cb641a1af761f7c60fabd895d05798f..60df52bfeb922edbfc9320921e01bbedd997ad5a 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-struct A<'a, 'b> where 'a : 'b { x: &'a int, y: &'b int }
+struct A<'a, 'b> where 'a : 'b { x: &'a isize, y: &'b isize }
 
 fn main() {
     let x = 1;
index 6a2fec7260af019e6bf0de5986b5e077e8d31dbc..1b349b25ef3c519b146af69508cad5feb3334c7d 100644 (file)
@@ -18,5 +18,5 @@ fn main() {
     println!("{}", equal(&1, &2));
     println!("{}", equal(&1, &1));
     println!("{}", "hello".equal(&"hello"));
-    println!("{}", "hello".equals::<int,&str>(&1, &1, &"foo", &"bar"));
+    println!("{}", "hello".equals::<isize,&str>(&1, &1, &"foo", &"bar"));
 }
index 2803890d9d1b2e4f979e2d93e39a7b6ab780f786..bba20e8e92e666152e00466d72eb0ba24fb73c82 100644 (file)
@@ -10,7 +10,7 @@
 
 // pretty-expanded FIXME #23616
 
-fn foo<'a, I>(mut it: I) where I: Iterator<Item=&'a int> {}
+fn foo<'a, I>(mut it: I) where I: Iterator<Item=&'a isize> {}
 
 fn main() {
     foo([1, 2].iter());
index 0f0741dcea73827272fad036b3c7bb84510c671f..ab1f30c3d14287f58cef9a0b8f67fa9ab5df5649 100644 (file)
@@ -32,5 +32,5 @@ fn main() {
     println!("{}", equal(&1, &2));
     println!("{}", equal(&1, &1));
     println!("{}", "hello".equal(&"hello"));
-    println!("{}", "hello".equals::<int,&str>(&1, &1, &"foo", &"bar"));
+    println!("{}", "hello".equals::<isize,&str>(&1, &1, &"foo", &"bar"));
 }
index 3ea075d15869366f27adda30213eba119279d905..102a5a7558e0c8c7c5f65b191029d553154257fd 100644 (file)
@@ -12,4 +12,4 @@
 
 // pretty-expanded FIXME #23616
 
-pub fn main() { let x: int = 10; while x == 10 && x == 11 { let _y = 0xf00_usize; } }
+pub fn main() { let x: isize = 10; while x == 10 && x == 11 { let _y = 0xf00_usize; } }
index fa45d084060bfb928b872db1d8bd43a4fed736d5..b1e80c86ec72d7cf9937edd5a995781eea203554 100644 (file)
@@ -14,7 +14,7 @@
 
 use std::collections::BinaryHeap;
 
-fn make_pq() -> BinaryHeap<int> {
+fn make_pq() -> BinaryHeap<isize> {
     BinaryHeap::from_vec(vec![1,2,3])
 }
 
index 622b66d22a1dba495542ef2e1e118f51f5c64d7b..6e3392324753b42e5486755025c550564255c91d 100644 (file)
@@ -12,9 +12,9 @@
 #![allow(unused_variable)]
 
 pub fn main() {
-    let mut y: int = 42;
-    let mut z: int = 42;
-    let mut x: int;
+    let mut y: isize = 42;
+    let mut z: isize = 42;
+    let mut x: isize;
     while z < 50 {
         z += 1;
         while false { x = y; y = z; }
index b8473abb06db07b6a314c889a202da8b848216ce..88d5314a96ac59a1cf8e5e7dcff1082c9c31a45a 100644 (file)
@@ -17,7 +17,7 @@
 #[derive(PartialEq)]
 enum t { a, b(String), }
 
-fn make(i: int) -> t {
+fn make(i: isize) -> t {
     if i > 10 { return t::a; }
     let mut s = String::from_str("hello");
     // Ensure s is non-const.
index a7328267541ab9b7c47bef68edbf3a7b5b7ef106..ed149ad5109db8631e1c3c4e8cad349f04b695a4 100644 (file)
 
 
 pub fn main() {
-    let mut i: int = 90;
+    let mut i: isize = 90;
     while i < 100 {
         println!("{}", i);
         i = i + 1;
         if i == 95 {
-            let _v: Vec<int> =
+            let _v: Vec<isize> =
                 vec!(1, 2, 3, 4, 5); // we check that it is freed by break
 
             println!("breaking");
index bd8b1f0f088ab231465e0132d08171fc7b917993..bf56e76687fa5b98d629f05626cee312af7ecdc7 100644 (file)
@@ -11,8 +11,8 @@
 
 
 pub fn main() {
-    let mut x: int = 10;
-    let mut y: int = 0;
+    let mut x: isize = 10;
+    let mut y: isize = 0;
     while y < x { println!("{}", y); println!("hello"); y = y + 1; }
     while x > 0 {
         println!("goodbye");
index 874360e6399d7734872c0dc68bbae75c643f9e79..10718e981ff59685f761b97067049b4a45219fb3 100644 (file)
@@ -12,7 +12,7 @@
 
 use std::sync::Mutex;
 
-struct Point {x: int, y: int, z: int}
+struct Point {x: isize, y: isize, z: isize}
 
 fn f(p: &mut Point) { p.z = 13; }
 
index b884adb7a6ec3e92d1ed1e10cbdfee7097672fab..b0bfb5c29c18c9b48ad736d0a2a07fc72bd746bc 100644 (file)
@@ -13,8 +13,8 @@
 #[cfg(windows)]
 mod kernel32 {
   extern "system" {
-    pub fn SetLastError(err: uint);
-    pub fn GetLastError() -> uint;
+    pub fn SetLastError(err: usize);
+    pub fn GetLastError() -> usize;
   }
 }
 
index b359251a394cd2a48187e6ed0fec32144d72207b..7b15531dacc33f45c5f6cb5d56ddda2d372c93aa 100644 (file)
@@ -13,7 +13,7 @@
 pub type HANDLE = u32;
 pub type DWORD = u32;
 pub type SIZE_T = u32;
-pub type LPVOID = uint;
+pub type LPVOID = usize;
 pub type BOOL = u8;
 
 #[cfg(windows)]
index f133396a72592a4df429a457cdfe485b6bb4eae0..ac8b15d7bf58990e883430fa4e3d2facf7361acc 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "xcrate_address_insignificant" as foo;
+extern crate xcrate_address_insignificant as foo;
 
 pub fn main() {
     assert_eq!(foo::foo::<f64>(), foo::bar());
index 016ebc777f1dab9124f080147002c0e57397a786..62d62839ba31bc89b1d95492ad9ae3526111b8a3 100644 (file)
@@ -12,7 +12,7 @@
 
 // pretty-expanded FIXME #23616
 
-extern crate "xcrate-trait-lifetime-param" as other;
+extern crate xcrate_trait_lifetime_param as other;
 
 struct Reader<'a> {
     b : &'a [u8]
index 56dc02c6d2e673beab5235236d77d3aa08bf3fc4..acc55833133a33073c8cb582b87af892749ca289 100644 (file)
@@ -11,6 +11,6 @@
 use std::thread;
 
 pub fn main() {
-    let mut i: int = 0;
+    let mut i: isize = 0;
     while i < 100 { i = i + 1; println!("{}", i); thread::yield_now(); }
 }
index 76fe8150d3fca4bd99979d4cef2e406f01235636..dea9edf0582bd928d72214b3c6637e77919973e0 100644 (file)
@@ -12,7 +12,7 @@
 
 #![feature(unsafe_no_drop_flag)]
 
-static mut destructions : int = 3;
+static mut destructions : isize = 3;
 
 pub fn foo() {
     #[unsafe_no_drop_flag]
index ba12599747068ac7666d0655578f3181456dcc4d..b98f907774b97984dc79f628254b3f58c6b55ddb 100644 (file)
@@ -10,6 +10,8 @@
 
 // pretty-expanded FIXME #23616
 
+#![feature(slice_patterns)]
+
 fn main() {
     let x = [(), ()];